Lean / Reader
Lean readerAxialAdditive.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports AxialPolynomial, AxialArithmetic, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import AxialPolynomialimport AxialArithmeticnamespace Axialopen Matrixnamespace AdditiveActiondef conjugate {n : ℕ} (g : AdditiveAction n) (A : Mat n) (t : ℚ) :=g.matrix (-t) * A * g.matrix tprivate theorem conjugate_add {n : ℕ} (g : AdditiveAction n) (A : Mat n) (b s : ℚ) :g.conjugate A (b+s) = g.matrix (-s) * g.conjugate A b * g.matrix s := byhave h : -(b+s) = -s + -b := by ringsimp only [conjugate,h,g.at_add,Matrix.mul_assoc]private theorem transfer {n : ℕ} {B C L R : Mat n} {axis : Vec n} {s t : ℚ}{d : ℕ} {z : ℤ} (hc : C = L*B*R) (hrl : R*L = 1) (haxis : L.mulVec axis = axis)(hL : IntegralMat ((d:ℚ) • L)) (hR : IntegralMat ((d:ℚ) • R))(hs : Normalized B s) (ht : Normalized C t) (hz : z ∈ AxialImage (s • B) axis) :(d:ℤ)^3*z ∈ AxialImage (t • C) axis := byobtain ⟨v,hv,he⟩ := hzlet c := (d:ℚ)^2*s/thave hi : Integral c := byapply integral_ratio hthave h := (hL.mul hs.2.1).mul hRsimp only [Matrix.smul_mul,Matrix.mul_smul,smul_smul,←hc] at hconvert h using 2 <;> ringrefine ⟨c • (((d:ℚ) • L).mulVec v), (hL.mulVec hv).smul hi, ?_⟩have commute : C*L = L*B := by rw [hc,Matrix.mul_assoc,hrl,Matrix.mul_one]rw [Matrix.smul_mulVec] at hehave he' := congrArg (fun w => L.mulVec w) hesimp only [Matrix.mulVec_smul,Matrix.mulVec_mulVec,haxis] at he'simp only [Matrix.smul_mulVec,Matrix.mulVec_smul,Matrix.mulVec_mulVec,Matrix.smul_mul,commute,smul_smul,Int.cast_mul,Int.cast_pow,Int.cast_natCast]calc_ = ((d:ℚ)^3*s) • (L*B).mulVec v := bycongr 1; dsimp [c]; field_simp [ht.1]_ = (d:ℚ)^3 • (s • (L*B).mulVec v) := by rw [smul_smul]_ = _ := by rw [he',smul_smul]private theorem step {n : ℕ} (g : AdditiveAction n) {axis : Vec n}(haxis : ∀ t, (g.matrix t).mulVec axis = axis) (A : Mat n) (scale : ℚ → ℚ)(hs : ∀ s, Normalized (g.conjugate A s) (scale s))(b s : ℚ) (d : ℕ) (hR : IntegralMat ((d:ℚ) • g.matrix s))(hL : IntegralMat ((d:ℚ) • g.matrix (-s))) {z : ℤ}(hz : z ∈ AxialImage (scale b • g.conjugate A b) axis) :(d:ℤ)^3*z ∈ AxialImage (scale (b+s) • g.conjugate A (b+s)) axis := byapply transfer (g.conjugate_add A b s) _ (haxis (-s)) hL hR (hs b) (hs _) hzrw [←g.at_add,add_neg_cancel,g.at_zero]/-- For any algebraic additive action fixing the given axis and any operator thatadmits the source's minimal normalization, its normalized axial union is a subgroup.In particular this covers the stated nilpotent operators annihilating the axis. -/theorem subgroup {n : ℕ} (g : AdditiveAction n) (axis : Vec n)(haxis : ∀ t, (g.matrix t).mulVec axis = axis) (A : Mat n) (scale : ℚ → ℚ)(hs : ∀ s, Normalized (g.conjugate A s) (scale s)) :∃ H : AddSubgroup ℤ, (H : Set ℤ) = AxialUnion (g.conjugate A) scale axis := bylet H (u : ℚ) := axialSubgroup (scale u • g.conjugate A u) axissuffices hadd : ∀ x y : ℤ, ∀ a b : ℚ, x ∈ H a → y ∈ H b → ∃ s, x+y ∈ H s byexact ⟨{ carrier := AxialUnion (g.conjugate A) scale axiszero_mem' := ⟨0,(H 0).zero_mem⟩add_mem' := fun ⟨a,ha⟩ ⟨b,hb⟩ => hadd _ _ a b ha hbneg_mem' := fun ⟨a,ha⟩ => ⟨a,(H a).neg_mem ha⟩ },rfl⟩intro x y a b hx hyby_cases hy0 : y=0· exact ⟨a,by simpa [hy0] using hx⟩let δ := b-aobtain ⟨D,hD,hstep⟩ := g.clear_steps δobtain ⟨h,l,r,h₁,h₂,c,e,hcomb⟩ := glueIntegers D hD x y hy0have moves (d : ℕ) (j : ℤ) (hd : (D:ℤ) ∣ d*j) :IntegralMat ((d:ℚ) • g.matrix ((j:ℚ)*δ)) ∧ IntegralMat ((d:ℚ) • g.matrix (-((j:ℚ)*δ))) := byrefine ⟨hstep j d hd,?_⟩simpa using hstep (-j) d (by simpa using dvd_neg.mpr hd)obtain ⟨hlp,hlm⟩ := moves l h h₁obtain ⟨hrp,hrm⟩ := moves r (h-1) h₂have hleft := g.step haxis A scale hs a ((h:ℚ)*δ) l hlp hlm hxhave hright := g.step haxis A scale hs b (((h-1:ℤ):ℚ)*δ) r hrp hrm hyhave heq : b+((h-1:ℤ):ℚ)*δ = a+(h:ℚ)*δ := by dsimp [δ]; push_cast; ringrw [heq] at hrightrefine ⟨a+(h:ℚ)*δ,?_⟩rw [←hcomb]exact (H _).add_mem ((H _).zsmul_mem hleft c) ((H _).zsmul_mem hright e)#print axioms subgroupend AdditiveActionend Axial