Lean / Reader
Lean reader

SixEquality.lean

80 lines5 declarationsno sorryimports SixEqualityMoments

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.

  1. import SixEqualityMoments
  2. noncomputable section
  3. namespace SixEquality
  4. set_option maxRecDepth 12000
  5. set_option maxHeartbeats 1200000
  6. /-- If both endpoints lie on the positive side of the 3+3 partition the
  7. weight is u/3+t. On the negative side it is u/3-t. Across the partition it
  8. is -u/6. The sign convention places vertex zero on the positive side. -/
  9. def familyWeight (i : H) (u t : ℝ) (k : Edge) : ℝ :=
  10. t * (sign i (endpoints k).1 + sign i (endpoints k).2)/2 +
  11. u * ((1 + 3*sign i (endpoints k).1 * sign i (endpoints k).2)/12)
  12. theorem necessary (w : Edge → ℝ) (pos : 0 < moment w 2)
  13. (heq : 124 * moment w 4 = 71 * (moment w 2)^2) :
  14. ∃ (i : H) (u t : ℝ), t ≠ 0 ∧ u^2 = 44*t^2 ∧ w = familyWeight i u t := by
  15. let m := mean w
  16. let x := xcoord w
  17. let l := projection x
  18. have hx : ∑ v, x v = 0 := centered w
  19. have hmom (k : ℕ) : moment w k = total m l k := by
  20. rw [moment_eq,halfDiff_eq]
  21. rw [hmom] at pos
  22. rw [hmom,hmom] at heq
  23. obtain ⟨i,hi,hj,hB,hR⟩ := equality_support m l
  24. (projection_bound x hx) (projected_fourth_bound x hx) pos heq
  25. have param : (m i)^2=44*(l i/3)^2 := by nlinarith only [hB,hR]
  26. have ht : l i/3 ≠ 0 := by
  27. intro hz
  28. rw [hz] at param
  29. have : m i = 0 := by nlinarith only [param]
  30. exact hi this
  31. refine ⟨i,m i,l i/3,ht,param,?_⟩
  32. have hpart := coordinates_on_partition x hx i hB
  33. funext k
  34. calc
  35. w k = recover m x k := congrFun (recover_original w).symm k
  36. _ = familyWeight i (m i) (l i/3) k := by
  37. unfold recover familyWeight
  38. rw [Finset.sum_eq_single i, hpart, hpart]
  39. · change ((l i/3)*_+(l i/3)*_)/2 + _ = _
  40. ring
  41. · intro j _ hji
  42. rw [hj j hji, zero_mul]
  43. · simp
  44. theorem model_second (i : H) (u t : ℝ) :
  45. moment (familyWeight i u t) 2 = 2*u^2+36*t^2 := by
  46. fin_cases i <;> simp [moment, familyWeight, sign, endpoints, left, right, Fin.sum_univ_succ, Matrix.cons_val] <;> ring
  47. theorem model_fourth (i : H) (u t : ℝ) :
  48. moment (familyWeight i u t) 4 = 2*u^4+108*u^2*t^2+180*t^4 := by
  49. fin_cases i <;> simp [moment, familyWeight, sign, endpoints, left, right, Fin.sum_univ_succ, Matrix.cons_val] <;> ring
  50. /-- Classification of all nonzero extremizers of the four-moment inequality
  51. on six vertices. The input consists of the fifteen arbitrary real edge
  52. weights. Each partition is represented once, up to complement. -/
  53. theorem extremizers_iff (w : Edge → ℝ) :
  54. (0 < moment w 2 ∧ 124 * moment w 4 = 71 * (moment w 2)^2) ↔
  55. ∃ (i : H) (u t : ℝ), t ≠ 0 ∧ u^2 = 44*t^2 ∧ w = familyWeight i u t := by
  56. constructor
  57. · rintro ⟨hp,he⟩
  58. exact necessary w hp he
  59. · rintro ⟨i,u,t,ht,hu,rfl⟩
  60. rw [model_second, model_fourth]
  61. constructor
  62. · have := sq_pos_of_ne_zero ht
  63. nlinarith [sq_nonneg u]
  64. · calc
  65. 124*(2*u^4+108*u^2*t^2+180*t^4)
  66. = 71*(2*u^2+36*t^2)^2-36*(u^2-44*t^2)^2 := by ring
  67. _ = _ := by rw [hu]; ring
  68. end SixEquality
  69. #print axioms SixEquality.extremizers_iff