Lean / Reader
Lean readerSixEquality.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports SixEqualityMoments, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import SixEqualityMomentsnoncomputable sectionnamespace SixEqualityset_option maxRecDepth 12000set_option maxHeartbeats 1200000/-- If both endpoints lie on the positive side of the 3+3 partition theweight is u/3+t. On the negative side it is u/3-t. Across the partition itis -u/6. The sign convention places vertex zero on the positive side. -/def familyWeight (i : H) (u t : ℝ) (k : Edge) : ℝ :=t * (sign i (endpoints k).1 + sign i (endpoints k).2)/2 +u * ((1 + 3*sign i (endpoints k).1 * sign i (endpoints k).2)/12)theorem necessary (w : Edge → ℝ) (pos : 0 < moment w 2)(heq : 124 * moment w 4 = 71 * (moment w 2)^2) :∃ (i : H) (u t : ℝ), t ≠ 0 ∧ u^2 = 44*t^2 ∧ w = familyWeight i u t := bylet m := mean wlet x := xcoord wlet l := projection xhave hx : ∑ v, x v = 0 := centered whave hmom (k : ℕ) : moment w k = total m l k := byrw [moment_eq,halfDiff_eq]rw [hmom] at posrw [hmom,hmom] at heqobtain ⟨i,hi,hj,hB,hR⟩ := equality_support m l(projection_bound x hx) (projected_fourth_bound x hx) pos heqhave param : (m i)^2=44*(l i/3)^2 := by nlinarith only [hB,hR]have ht : l i/3 ≠ 0 := byintro hzrw [hz] at paramhave : m i = 0 := by nlinarith only [param]exact hi thisrefine ⟨i,m i,l i/3,ht,param,?_⟩have hpart := coordinates_on_partition x hx i hBfunext kcalcw k = recover m x k := congrFun (recover_original w).symm k_ = familyWeight i (m i) (l i/3) k := byunfold recover familyWeightrw [Finset.sum_eq_single i, hpart, hpart]· change ((l i/3)*_+(l i/3)*_)/2 + _ = _ring· intro j _ hjirw [hj j hji, zero_mul]· simptheorem model_second (i : H) (u t : ℝ) :moment (familyWeight i u t) 2 = 2*u^2+36*t^2 := byfin_cases i <;> simp [moment, familyWeight, sign, endpoints, left, right, Fin.sum_univ_succ, Matrix.cons_val] <;> ringtheorem model_fourth (i : H) (u t : ℝ) :moment (familyWeight i u t) 4 = 2*u^4+108*u^2*t^2+180*t^4 := byfin_cases i <;> simp [moment, familyWeight, sign, endpoints, left, right, Fin.sum_univ_succ, Matrix.cons_val] <;> ring/-- Classification of all nonzero extremizers of the four-moment inequalityon six vertices. The input consists of the fifteen arbitrary real edgeweights. Each partition is represented once, up to complement. -/theorem extremizers_iff (w : Edge → ℝ) :(0 < moment w 2 ∧ 124 * moment w 4 = 71 * (moment w 2)^2) ↔∃ (i : H) (u t : ℝ), t ≠ 0 ∧ u^2 = 44*t^2 ∧ w = familyWeight i u t := byconstructor· rintro ⟨hp,he⟩exact necessary w hp he· rintro ⟨i,u,t,ht,hu,rfl⟩rw [model_second, model_fourth]constructor· have := sq_pos_of_ne_zero htnlinarith [sq_nonneg u]· calc124*(2*u^4+108*u^2*t^2+180*t^4)= 71*(2*u^2+36*t^2)^2-36*(u^2-44*t^2)^2 := by ring_ = _ := by rw [hu]; ringend SixEquality#print axioms SixEquality.extremizers_iff