Lean / Reader
Lean readerAxialMultiplicative.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports AxialTorus, AxialScale, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import AxialTorusimport AxialScalenamespace Axial.Multiplicativenoncomputable sectionopen Classicalprivate theorem scale_entries {t : ℚˣ} {c : ℚ} (hm : IntegralMat (c • conjugate t)) :Integral c ∧ Integral (c*(t:ℚ)) ∧ Integral (c*(((t:ℚ)-2)/5)) ∧Integral (c*(↑t⁻¹:ℚ)) := byrefine ⟨?_,hm 2 3,hm 2 4,hm 2 5⟩simpa only [mul_one] using (show Integral (c*1) from hm 0 1)private theorem integral_form (c t s : ℚ) (hc : Integral c) (ht : Integral (c*t))(hq : Integral (c*((t-2)/5))) (hs : Integral (c*s)) : IntegralMat (c • form t s) := byintro i jfin_cases i <;> fin_cases j <;>simp [form,Matrix.smul_apply,smul_eq_mul] <;>first | exact hc | exact ht | exact hq | exact hs | exact ⟨0,by norm_num⟩theorem axial_description (c : ℚ) (t : ℚˣ) (z : ℤ) :z ∈ AxialImage (c • conjugate t) axis ↔ ∃ a : ℤ, c*(a:ℚ)=z := byconstructor· rintro ⟨v,hv,he⟩obtain ⟨a,ha⟩ := hv 1refine ⟨a,?_⟩rw [Matrix.smul_mulVec,conjugate,form_vec] at hehave h0 := congrFun he 0change c*v 1=(z:ℚ)*1 at h0rwa [ha,mul_one] at *· rintro ⟨a,ha⟩let v : Vec 6 := ![0,(a:ℚ),0,0,0,0]refine ⟨v,?_,?_⟩· intro i; fin_cases i <;> first | exact ⟨a,rfl⟩ | exact ⟨0,rfl⟩· rw [Matrix.smul_mulVec,conjugate,form_vec]funext i; fin_cases i <;> simp [v,axis,ha]private theorem hit {t : ℚˣ} {p : ℕ} (hp : 0<p) (ht : (t:ℚ)=p) {c : ℚ}(hc : Normalized (conjugate t) c) (hclear : IntegralMat ((p:ℚ) • conjugate t)) :(p:ℤ) ∈ AxialImage (c • conjugate t) axis := byobtain ⟨a,ha⟩ := (scale_entries hc.2.1).2.2.2rw [Units.val_inv_eq_inv_val,ht] at hahave pp : (0:ℚ)<p := by exact_mod_cast hphave he : (a:ℚ)*p=c := bycalc_ = (c*(p:ℚ)⁻¹)*p := by rw [ha]_ = c := by field_simphave hb := hc.2.2 p pp.ne' hclearrw [abs_of_pos pp,← he,abs_mul,abs_of_pos pp] at hbhave hab : |(a:ℚ)| ≤ 1 := by nlinarithhave hai : |a| ≤ 1 := by exact_mod_cast habhave han : a ≠ 0 := by intro hz; apply hc.1; simpa [hz] using he.symmhave hpm : a=1 ∨ a = -1 := byhave h := abs_le.mp hai; omegaapply (axial_description _ _ _).mprrcases hpm with h|h· exact ⟨1,by simpa [h] using he.symm⟩· refine ⟨-1,?_⟩; rw [←he,h]; push_cast; ringdef u2 : ℚˣ := Units.mk0 2 (by norm_num)def u7 : ℚˣ := Units.mk0 7 (by norm_num)private theorem clear2 : IntegralMat ((2:ℚ) • conjugate u2) := byapply integral_form· exact ⟨2,by norm_num⟩· exact ⟨4,by norm_num [u2]⟩· exact ⟨0,by norm_num [u2]⟩· exact ⟨1,by norm_num [u2]⟩private theorem clear7 : IntegralMat ((7:ℚ) • conjugate u7) := byapply integral_form· exact ⟨7,by norm_num⟩· exact ⟨49,by norm_num [u7]⟩· exact ⟨7,by norm_num [u7]⟩· exact ⟨1,by norm_num [u7]⟩theorem no_one {c : ℚ} {t : ℚˣ} (hc : IntegralMat (c • conjugate t)) :(1:ℤ) ∉ AxialImage (c • conjugate t) axis := byintro hobtain ⟨a,ha⟩ := (axial_description _ _ _).mp hobtain ⟨⟨b,hb⟩,ht,hshift,hinv⟩ := scale_entries hchave hac : b*a=1 := by exact_mod_cast (show (b:ℚ)*(a:ℚ)=1 by rw [hb]; exact ha)have hunit : c=1 ∨ c = -1 := byrcases Int.eq_one_or_neg_one_of_mul_eq_one hac with e|e <;> simp [←hb,e]have unscale (q : ℚ) (hiq : Integral (c*q)) : Integral q := byrcases hunit with he|he· simpa [he] using hiq· simpa [he] using hiq.negobtain ⟨v,hv⟩ := unscale _ htobtain ⟨w,hw⟩ := unscale _ hinvobtain ⟨z,hz⟩ := unscale _ hshifthave hvw : v*w=1 := by exact_mod_cast (show (v:ℚ)*(w:ℚ)=1 by rw [hv,hw]; exact t.mul_inv)rw [←hv] at hzhave e : 5*z=v-2 := by exact_mod_cast (show 5*(z:ℚ)=(v:ℚ)-2 by linarith)rcases Int.eq_one_or_neg_one_of_mul_eq_one hvw with hh|hh <;> omegatheorem not_subgroup (scale : ℚˣ → ℚ) (hn : ∀t,Normalized (conjugate t) (scale t)) :¬ ∃ H : AddSubgroup ℤ, (H:Set ℤ)=AxialUnion conjugate scale axis := byrintro ⟨H,hH⟩have htwo : (2:ℤ)∈H := bychange (2:ℤ)∈(H:Set ℤ); rw [hH]exact ⟨u2,hit (p:=2) (by decide) rfl (hn u2) clear2⟩have hseven : (7:ℤ)∈H := bychange (7:ℤ)∈(H:Set ℤ); rw [hH]exact ⟨u7,hit (p:=7) (by decide) rfl (hn u7) clear7⟩have hone : (1:ℤ)∈H := byconvert H.sub_mem hseven (H.add_mem htwo (H.add_mem htwo htwo)) using 1change (1:ℤ)∈(H:Set ℤ) at honerw [hH] at honeobtain ⟨t,ht⟩ := honeexact no_one (hn t).2.1 httheorem counterexample :∃ scale : ℚˣ → ℚ, (∀t, Normalized (conjugate t) (scale t)) ∧¬ ∃ H : AddSubgroup ℤ, (H:Set ℤ)=AxialUnion conjugate scale axis := bychoose scale h using fun t : ℚˣ => exists_normalized_of_one (conjugate t) 0 1 rflexact ⟨scale,h,not_subgroup scale h⟩#print axioms counterexampleendend Axial.Multiplicative