Poincaré conjecture: the Lean proof, cleaned up together
The 2026 Lean proof of the Poincaré conjecture after Morgan and Tian, 3 million lines, cleaned up together: smaller, faster to build, more readable, the theorems unchanged

| 1 | import PoincareLib.Geometry.RicciFlow.Harnack.TensorContractions |
| 2 | |
| 3 | /-! |
| 4 | # Simple two-forms in Hamilton's Harnack quadratic |
| 5 | |
| 6 | The normalization `(V i * W j - W i * V j) / 2` is the one used in |
| 7 | Kleiner-Lott, Appendix F, pp. 2850-2851. These finite-sum identities account |
| 8 | for the skew-symmetry cancellations before taking the orthonormal trace. |
| 9 | -/ |
| 10 | |
| 11 | open scoped BigOperators |
| 12 | |
| 13 | namespace Poincare.RicciFlow.Harnack |
| 14 | |
| 15 | variable {I : Type*} [Fintype I] |
| 16 | |
| 17 | /-- Contracting a skew matrix with a half-wedge removes its antisymmetrization. -/ |
| 18 | lemma skew_contraction_half_wedge (A : I → I → ℝ) |
| 19 | (hA : ∀ i j, A i j = -A j i) (V W : I → ℝ) : |
| 20 | (∑ i, ∑ j, A i j * ((V i * W j - W i * V j) / 2)) = |
| 21 | ∑ i, ∑ j, A i j * V i * W j := by |
| 22 | have hswap : (∑ i, ∑ j, A i j * W i * V j) = |
| 23 | -(∑ i, ∑ j, A i j * V i * W j) := by |
| 24 | rw [Finset.sum_comm] |
| 25 | simp only [← Finset.sum_neg_distrib] |
| 26 | apply Finset.sum_congr rfl |
| 27 | intro i _ |
| 28 | apply Finset.sum_congr rfl |
| 29 | intro j _ |
| 30 | rw [hA j i] |
| 31 | ring |
| 32 | calc |
| 33 | _ = ((∑ i, ∑ j, A i j * V i * W j) - |
| 34 | (∑ i, ∑ j, A i j * W i * V j)) / 2 := by |
| 35 | simp only [← Finset.sum_sub_distrib, Finset.sum_div] |
| 36 | apply Finset.sum_congr rfl |
| 37 | intro i _ |
| 38 | apply Finset.sum_congr rfl |
| 39 | intro j _ |
| 40 | ring |
| 41 | _ = _ := by rw [hswap]; ring |
| 42 | |
| 43 | private lemma sum_four_swap_pairs (f : I → I → I → I → ℝ) : |
| 44 | (∑ i, ∑ j, ∑ k, ∑ l, f i j k l) = ∑ k, ∑ l, ∑ i, ∑ j, f i j k l := by |
| 45 | rw [Finset.sum_comm_cycle] |
| 46 | apply Finset.sum_congr rfl |
| 47 | intro k _ |
| 48 | exact Finset.sum_comm_cycle |
| 49 | |
| 50 | /-- The curvature block of the Harnack quadratic on a half-wedge is the |
| 51 | curvature evaluation on the two vectors. -/ |
| 52 | lemma curvature_contraction_half_wedge (Rm : I → I → I → I → ℝ) |
| 53 | (hfirst : ∀ i j k l, Rm i j k l = -Rm j i k l) |
| 54 | (hlast : ∀ i j k l, Rm i j k l = -Rm i j l k) (V W : I → ℝ) : |
| 55 | (∑ i, ∑ j, ∑ k, ∑ l, |
| 56 | Rm i j k l * ((V i * W j - W i * V j) / 2) * |
| 57 | ((V k * W l - W k * V l) / 2)) = |
| 58 | ∑ i, ∑ j, ∑ k, ∑ l, Rm i j k l * V i * W j * V k * W l := by |
| 59 | have hlastContract (i j : I) : |
| 60 | (∑ k, ∑ l, |
| 61 | Rm i j k l * ((V i * W j - W i * V j) / 2) * |
| 62 | ((V k * W l - W k * V l) / 2)) = |
| 63 | ∑ k, ∑ l, Rm i j k l * ((V i * W j - W i * V j) / 2) * V k * W l := by |
| 64 | apply skew_contraction_half_wedge |
| 65 | intro k l |
| 66 | rw [hlast i j k l] |
| 67 | ring |
| 68 | have hfirstContract (k l : I) : |
| 69 | (∑ i, ∑ j, Rm i j k l * ((V i * W j - W i * V j) / 2) * V k * W l) = |
| 70 | ∑ i, ∑ j, Rm i j k l * V i * W j * V k * W l := by |
| 71 | simpa only [Finset.sum_mul] using |
| 72 | congrArg (fun z : ℝ => z * V k * W l) |
| 73 | (skew_contraction_half_wedge (fun i j => Rm i j k l) |
| 74 | (fun i j => hfirst i j k l) V W) |
| 75 | simp_rw [hlastContract] |
| 76 | rw [sum_four_swap_pairs] |
| 77 | simp_rw [hfirstContract] |
| 78 | exact (sum_four_swap_pairs _).symm |
| 79 | |
| 80 | variable [DecidableEq I] |
| 81 | |
| 82 | /-- Tracing the curvature block over the standard orthonormal basis gives |
| 83 | the Ricci quadratic form. -/ |
| 84 | lemma curvature_contraction_half_wedge_trace (Rm : I → I → I → I → ℝ) |
| 85 | (Ric : I → I → ℝ) |
| 86 | (hfirst : ∀ i j k l, Rm i j k l = -Rm j i k l) |
| 87 | (hlast : ∀ i j k l, Rm i j k l = -Rm i j l k) |
| 88 | (hRic : ∀ k l, ∑ i, Rm k i l i = Ric k l) (V : I → ℝ) : |
| 89 | (∑ a, ∑ i, ∑ j, ∑ k, ∑ l, |
| 90 | Rm i j k l * ((V i * (if j = a then 1 else 0) - |
| 91 | (if i = a then 1 else 0) * V j) / 2) * |
| 92 | ((V k * (if l = a then 1 else 0) - |
| 93 | (if k = a then 1 else 0) * V l) / 2)) = |
| 94 | ∑ i, ∑ k, Ric i k * V i * V k := by |
| 95 | have hcontract (a : I) : |
| 96 | (∑ i, ∑ j, ∑ k, ∑ l, |
| 97 | Rm i j k l * ((V i * (if j = a then 1 else 0) - |
| 98 | (if i = a then 1 else 0) * V j) / 2) * |
| 99 | ((V k * (if l = a then 1 else 0) - |
| 100 | (if k = a then 1 else 0) * V l) / 2)) = |
| 101 | ∑ i, ∑ k, Rm i a k a * V i * V k := by |
| 102 | rw [curvature_contraction_half_wedge Rm hfirst hlast V |
| 103 | (fun i => if i = a then 1 else 0)] |
| 104 | simp [mul_ite, ite_mul, Finset.sum_ite_irrel] |
| 105 | simp_rw [hcontract] |
| 106 | rw [Finset.sum_comm] |
| 107 | apply Finset.sum_congr rfl |
| 108 | intro i _ |
| 109 | rw [Finset.sum_comm] |
| 110 | apply Finset.sum_congr rfl |
| 111 | intro k _ |
| 112 | rw [← Finset.sum_mul, ← Finset.sum_mul, hRic] |
| 113 | |
| 114 | /-- Tracing the mixed block pairs the vector with the last two-index trace |
| 115 | of a tensor skew in its first two indices. -/ |
| 116 | lemma mixed_contraction_half_wedge_trace (P : I → I → I → ℝ) |
| 117 | (hP : ∀ i j k, P i j k = -P j i k) (V : I → ℝ) : |
| 118 | (∑ a, ∑ i, ∑ j, ∑ k, |
| 119 | P i j k * ((V i * (if j = a then 1 else 0) - |
| 120 | (if i = a then 1 else 0) * V j) / 2) * |
| 121 | (if k = a then 1 else 0)) = |
| 122 | ∑ i, (∑ a, P i a a) * V i := by |
| 123 | have hcontract (a : I) : |
| 124 | (∑ i, ∑ j, ∑ k, |
| 125 | P i j k * ((V i * (if j = a then 1 else 0) - |
| 126 | (if i = a then 1 else 0) * V j) / 2) * |
| 127 | (if k = a then 1 else 0)) = ∑ i, P i a a * V i := by |
| 128 | simp only [mul_ite, mul_one, mul_zero, Finset.sum_ite_eq', |
| 129 | Finset.mem_univ, if_true] |
| 130 | simpa [mul_ite] using skew_contraction_half_wedge (fun i j => P i j a) |
| 131 | (fun i j => hP i j a) V (fun i => if i = a then 1 else 0) |
| 132 | simp_rw [hcontract] |
| 133 | rw [Finset.sum_comm] |
| 134 | simp only [Finset.sum_mul] |
| 135 | |
| 136 | /-- The full matrix Harnack quadratic traces to the two-tensor trace, the |
| 137 | contracted three-tensor pairing, and the Ricci quadratic form. -/ |
| 138 | lemma matrix_quadratic_half_wedge_trace (S : I → I → ℝ) |
| 139 | (P : I → I → I → ℝ) (Rm : I → I → I → I → ℝ) (Ric : I → I → ℝ) |
| 140 | (hP : ∀ i j k, P i j k = -P j i k) |
| 141 | (hfirst : ∀ i j k l, Rm i j k l = -Rm j i k l) |
| 142 | (hlast : ∀ i j k l, Rm i j k l = -Rm i j l k) |
| 143 | (hRic : ∀ k l, ∑ i, Rm k i l i = Ric k l) (V : I → ℝ) : |
| 144 | let e : I → I → ℝ := fun a i => if i = a then 1 else 0 |
| 145 | let U : I → I → I → ℝ := fun a i j => (V i * e a j - e a i * V j) / 2 |
| 146 | (∑ a, ((∑ i, ∑ j, S i j * e a i * e a j) + |
| 147 | 2 * (∑ i, ∑ j, ∑ k, P i j k * U a i j * e a k) + |
| 148 | (∑ i, ∑ j, ∑ k, ∑ l, Rm i j k l * U a i j * U a k l))) = |
| 149 | (∑ a, S a a) + 2 * (∑ i, (∑ a, P i a a) * V i) + |
| 150 | (∑ i, ∑ k, Ric i k * V i * V k) := by |
| 151 | dsimp only |
| 152 | have hS (a : I) : |
| 153 | (∑ i, ∑ j, S i j * (if i = a then 1 else 0) * |
| 154 | (if j = a then 1 else 0)) = S a a := by |
| 155 | simp [mul_ite] |
| 156 | simp_rw [hS] |
| 157 | simp only [Finset.sum_add_distrib, ← Finset.mul_sum] |
| 158 | rw [mixed_contraction_half_wedge_trace P hP V, |
| 159 | curvature_contraction_half_wedge_trace Rm Ric hfirst hlast hRic V] |
| 160 | |
| 161 | end Poincare.RicciFlow.Harnack |