Lean / Reader
Lean readerSixExtremizers.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports SixEquality, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import SixEqualitynoncomputable sectionnamespace SixEquality/-- The ten representatives for the three-subset/complement pairs. -/def side : H → Finset V := ![{0,1,2}, {0,1,3}, {0,1,4}, {0,1,5}, {0,2,3}, {0,2,4}, {0,2,5}, {0,3,4}, {0,3,5}, {0,4,5}]private theorem side_card : ∀ i : H, (side i).card = 3 := by decide +kernelprivate theorem complement_card : ∀ i : H, (side i)ᶜ.card = 3 := by decide +kernelprivate theorem all_sides :∀ A : Finset V, A.card=3 → ∃ i : H, A = side i ∨ A = (side i)ᶜ := by decide +kernelprivate theorem sign_by_side (i : H) (v : V) :sign i v = if v ∈ side i then 1 else -1 := byfin_cases i <;> fin_cases v <;> norm_num [sign,side] <;> decide/-- Pick three of the six vertices. The edge weights are the displayedpositive-side, negative-side and cross-side constants. Their common scaleis immaterial in the homogeneous original inequality. -/def standardWeight (A : Finset V) (k : Edge) : ℝ :=if (endpoints k).1 ∈ A thenif (endpoints k).2 ∈ A then Real.sqrt 44/3+1 else -Real.sqrt 44/6elseif (endpoints k).2 ∈ A then -Real.sqrt 44/6 else Real.sqrt 44/3-1private theorem positive_family (i : H) (c : ℝ) :familyWeight i (Real.sqrt 44*c) c = fun k => c*standardWeight (side i) k := byfunext kunfold familyWeight standardWeightrw [sign_by_side,sign_by_side]split_ifs <;> ringprivate theorem negative_family (i : H) (c : ℝ) :familyWeight i (Real.sqrt 44*c) (-c) = fun k => c*standardWeight (side i)ᶜ k := byfunext kunfold familyWeight standardWeightrw [sign_by_side,sign_by_side]simp only [Finset.mem_compl]split_ifs <;> ringprivate theorem moment_pos_iff (w : Edge → ℝ) :0 < moment w 2 ↔ ∃ k, w k ≠ 0 := byconstructor· intro hpby_contra! hehave hL : ∀ i, left w i = 0 := by intro i; fin_cases i <;> simp [left,he]have hR : ∀ i, right w i = 0 := by intro i; fin_cases i <;> simp [right,he]simp [moment,hL,hR] at hp· rintro ⟨k,hk⟩by_contra! hnrw [moment_eq,total_two,halfDiff_eq,projected_squares _ (centered w)] at hnhave hm := sq_nonnegative (mean w)have hx := sq_nonnegative (xcoord w)have hm0 : ∀ j, mean w j = 0 := byintro jhave := single_sq_le (mean w) jnlinarith [sq_nonneg (mean w j)]have hx0 : ∀ j, xcoord w j = 0 := byintro jhave := single_sq_le (xcoord w) jnlinarith [sq_nonneg (xcoord w j)]have he := congrFun (recover_original w) ksimp [recover,hm0,hx0] at heexact hk he.symm/-- All nonzero equality cases, in the original fifteen edge variables.Exactly the nonzero multiples of permutations of one fixed 3+3 assignmentattain equality. The left and right sides use no auxiliary hypotheses. -/theorem all_nonzero_extremizers (w : Edge → ℝ) :((∃ k, w k ≠ 0) ∧ 124*moment w 4 = 71*(moment w 2)^2) ↔∃ A : Finset V, A.card = 3 ∧ ∃ c : ℝ, c ≠ 0 ∧w = fun k => c * standardWeight A k := byrw [← moment_pos_iff,extremizers_iff]have hroot : (Real.sqrt 44)^2=(44:ℝ) := Real.sq_sqrt (by norm_num)constructor· rintro ⟨i,u,t,ht,hu,rfl⟩have hp : (u-Real.sqrt 44*t)*(u+Real.sqrt 44*t)=0 := bycalc_ = u^2-(Real.sqrt 44)^2*t^2 := by ring_ = 0 := by rw [hu,hroot]; ringrcases mul_eq_zero.mp hp with hp | hn· rw [sub_eq_zero.mp hp]exact ⟨side i,side_card i,t,ht,positive_family i t⟩· have h : u = Real.sqrt 44 * (-t) := by linarith only [hn]rw [h]exact ⟨(side i)ᶜ,complement_card i,-t,neg_ne_zero.mpr ht,by simpa using negative_family i (-t)⟩· rintro ⟨A,hA,c,hc,rfl⟩obtain ⟨i,hi|hi⟩ := all_sides A hA· subst Aexact ⟨i,Real.sqrt 44*c,c,hc,by rw [mul_pow,hroot],(positive_family i c).symm⟩· subst Aexact ⟨i,Real.sqrt 44*c,-c,neg_ne_zero.mpr hc,by rw [mul_pow,hroot]; ring,(negative_family i c).symm⟩end SixEquality#print axioms SixEquality.all_nonzero_extremizers