Lean / Reader
Lean readerAxialSource.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports AxialScale, AxialAdditive, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import AxialScaleimport AxialAdditivenamespace Axial/-- Entrywise integrality is exactly preservation of the standard integer lattice. -/theorem integralMat_iff_maps_lattice {n : ℕ} (A : Mat n) :IntegralMat A ↔ ∀ v : Vec n, IntegralVec v → IntegralVec (A.mulVec v) := byrefine ⟨fun h _ hv => h.mulVec hv,?_⟩intro h i jlet v : Vec n := fun k => if k=j then 1 else 0have hv : IntegralVec v := byintro k; by_cases hk : k=j <;> simp [v,hk,Integral.zero,Integral.one]have hi := h v hv isimpa [v,Matrix.mulVec,dotProduct,mul_ite] using hitheorem exists_normalized {n : ℕ} (A : Mat n) (hA : A ≠ 0) :∃ t : ℚ, Normalized A t := byhave he : ∃ i j, A i j ≠ 0 := byby_contra! h; apply hA; ext i j; exact h i jobtain ⟨i,j,ha⟩ := helet a := A i jhave hass : a ≠ 0 := haobtain ⟨s,hs⟩ := exists_normalized_of_one (a⁻¹ • A) i j (bychange a⁻¹*a=1; exact inv_mul_cancel₀ hass)refine ⟨s/a,div_ne_zero hs.1 hass,?_,?_⟩· simpa only [smul_smul,div_eq_mul_inv] using hs.2.1· intro u hu hmathave hi : IntegralMat ((u*a) • (a⁻¹ • A)) := bysimpa only [smul_smul,mul_assoc,mul_inv_cancel₀ hass,mul_one] using hmathave hmin := hs.2.2 _ (mul_ne_zero hu hass) hirw [abs_div, div_le_iff₀ (abs_pos.mpr hass),←abs_mul]exact hmintheorem AdditiveAction.conjugate_ne_zero {n : ℕ} (g : AdditiveAction n) (A : Mat n)(hn : A ≠ 0) (s : ℚ) : g.conjugate A s ≠ 0 := byintro hhave hinv : g.matrix s * g.matrix (-s) = 1 := by rw [←g.at_add,add_neg_cancel,g.at_zero]apply hnhave he := congrArg (fun M : Mat n => g.matrix s*M*g.matrix (-s)) hsimp [conjugate,←Matrix.mul_assoc,hinv] at hesimpa [Matrix.mul_assoc,hinv] using hetheorem AdditiveAction.exists_scale {n : ℕ} (g : AdditiveAction n) (A : Mat n) (hn : A ≠ 0) :∃ scale : ℚ → ℚ, ∀ s, Normalized (g.conjugate A s) (scale s) :=Classical.axiomOfChoice fun s => exists_normalized _ (g.conjugate_ne_zero A hn s)theorem zero_axial {n : ℕ} (axis : Vec n) (ha : axis ≠ 0) :AxialImage (0 : Mat n) axis = {0} := byext z; constructor· rintro ⟨v,hv,he⟩simp only [Matrix.zero_mulVec,eq_comm (a := (0 : Vec n)),smul_eq_zero,ha,or_false,Int.cast_eq_zero] at heexact he· rintro rfl; use 0exact ⟨fun _ => Integral.zero,by simp⟩theorem no_minimum_at_zero {n : ℕ} (t : ℚ) : ¬ Normalized (0 : Mat n) t := byintro hthave hi : IntegralMat ((t/2) • (0:Mat n)) := bysimp only [smul_zero]; exact fun _ _ => Integral.zerohave h := ht.2.2 _ (div_ne_zero ht.1 (by norm_num)) hirw [abs_div,abs_of_pos (by norm_num : (0:ℚ)<2)] at hhave := abs_pos.mpr ht.1linarithend Axial