Lean / Reader
Lean reader

SixExtremizers.lean

99 lines10 declarationsno sorryimports SixEquality

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.

  1. import SixEquality
  2. noncomputable section
  3. namespace SixEquality
  4. /-- The ten representatives for the three-subset/complement pairs. -/
  5. 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}]
  6. private theorem side_card : ∀ i : H, (side i).card = 3 := by decide +kernel
  7. private theorem complement_card : ∀ i : H, (side i)ᶜ.card = 3 := by decide +kernel
  8. private theorem all_sides :
  9. ∀ A : Finset V, A.card=3 → ∃ i : H, A = side i ∨ A = (side i)ᶜ := by decide +kernel
  10. private theorem sign_by_side (i : H) (v : V) :
  11. sign i v = if v ∈ side i then 1 else -1 := by
  12. fin_cases i <;> fin_cases v <;> norm_num [sign,side] <;> decide
  13. /-- Pick three of the six vertices. The edge weights are the displayed
  14. positive-side, negative-side and cross-side constants. Their common scale
  15. is immaterial in the homogeneous original inequality. -/
  16. def standardWeight (A : Finset V) (k : Edge) : ℝ :=
  17. if (endpoints k).1 ∈ A then
  18. if (endpoints k).2 ∈ A then Real.sqrt 44/3+1 else -Real.sqrt 44/6
  19. else
  20. if (endpoints k).2 ∈ A then -Real.sqrt 44/6 else Real.sqrt 44/3-1
  21. private theorem positive_family (i : H) (c : ℝ) :
  22. familyWeight i (Real.sqrt 44*c) c = fun k => c*standardWeight (side i) k := by
  23. funext k
  24. unfold familyWeight standardWeight
  25. rw [sign_by_side,sign_by_side]
  26. split_ifs <;> ring
  27. private theorem negative_family (i : H) (c : ℝ) :
  28. familyWeight i (Real.sqrt 44*c) (-c) = fun k => c*standardWeight (side i)ᶜ k := by
  29. funext k
  30. unfold familyWeight standardWeight
  31. rw [sign_by_side,sign_by_side]
  32. simp only [Finset.mem_compl]
  33. split_ifs <;> ring
  34. private theorem moment_pos_iff (w : Edge → ℝ) :
  35. 0 < moment w 2 ↔ ∃ k, w k ≠ 0 := by
  36. constructor
  37. · intro hp
  38. by_contra! he
  39. have hL : ∀ i, left w i = 0 := by intro i; fin_cases i <;> simp [left,he]
  40. have hR : ∀ i, right w i = 0 := by intro i; fin_cases i <;> simp [right,he]
  41. simp [moment,hL,hR] at hp
  42. · rintro ⟨k,hk⟩
  43. by_contra! hn
  44. rw [moment_eq,total_two,halfDiff_eq,projected_squares _ (centered w)] at hn
  45. have hm := sq_nonnegative (mean w)
  46. have hx := sq_nonnegative (xcoord w)
  47. have hm0 : ∀ j, mean w j = 0 := by
  48. intro j
  49. have := single_sq_le (mean w) j
  50. nlinarith [sq_nonneg (mean w j)]
  51. have hx0 : ∀ j, xcoord w j = 0 := by
  52. intro j
  53. have := single_sq_le (xcoord w) j
  54. nlinarith [sq_nonneg (xcoord w j)]
  55. have he := congrFun (recover_original w) k
  56. simp [recover,hm0,hx0] at he
  57. exact hk he.symm
  58. /-- All nonzero equality cases, in the original fifteen edge variables.
  59. Exactly the nonzero multiples of permutations of one fixed 3+3 assignment
  60. attain equality. The left and right sides use no auxiliary hypotheses. -/
  61. theorem all_nonzero_extremizers (w : Edge → ℝ) :
  62. ((∃ k, w k ≠ 0) ∧ 124*moment w 4 = 71*(moment w 2)^2) ↔
  63. ∃ A : Finset V, A.card = 3 ∧ ∃ c : ℝ, c ≠ 0 ∧
  64. w = fun k => c * standardWeight A k := by
  65. rw [← moment_pos_iff,extremizers_iff]
  66. have hroot : (Real.sqrt 44)^2=(44:ℝ) := Real.sq_sqrt (by norm_num)
  67. constructor
  68. · rintro ⟨i,u,t,ht,hu,rfl⟩
  69. have hp : (u-Real.sqrt 44*t)*(u+Real.sqrt 44*t)=0 := by
  70. calc
  71. _ = u^2-(Real.sqrt 44)^2*t^2 := by ring
  72. _ = 0 := by rw [hu,hroot]; ring
  73. rcases mul_eq_zero.mp hp with hp | hn
  74. · rw [sub_eq_zero.mp hp]
  75. exact ⟨side i,side_card i,t,ht,positive_family i t⟩
  76. · have h : u = Real.sqrt 44 * (-t) := by linarith only [hn]
  77. rw [h]
  78. exact ⟨(side i)ᶜ,complement_card i,-t,neg_ne_zero.mpr ht,by simpa using negative_family i (-t)⟩
  79. · rintro ⟨A,hA,c,hc,rfl⟩
  80. obtain ⟨i,hi|hi⟩ := all_sides A hA
  81. · subst A
  82. exact ⟨i,Real.sqrt 44*c,c,hc,by rw [mul_pow,hroot],(positive_family i c).symm⟩
  83. · subst A
  84. exact ⟨i,Real.sqrt 44*c,-c,neg_ne_zero.mpr hc,by rw [mul_pow,hroot]; ring,
  85. (negative_family i c).symm⟩
  86. end SixEquality
  87. #print axioms SixEquality.all_nonzero_extremizers