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.Matrix.Positivity.Reaction |
| 2 | |
| 3 | /-! |
| 4 | # Reaction contractions for the Hamilton quadratic |
| 5 | |
| 6 | First Bianchi and the skew symmetries put the curvature-P terms into the |
| 7 | sharp-reaction and square terms of Chow et al., Part II, (15.57)-(15.58), |
| 8 | printed p. 279. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open scoped BigOperators |
| 14 | |
| 15 | namespace Poincare.RicciFlow.Harnack |
| 16 | |
| 17 | variable {I : Type*} [Fintype I] |
| 18 | |
| 19 | /-- First Bianchi contracts the crossed curvature indices against a skew |
| 20 | array to half of the ordinary curvature action. -/ |
| 21 | lemma curvature_bianchi_skew_contraction |
| 22 | (R : I → I → I → I → ℝ) (P : I → I → ℝ) |
| 23 | (hfirst : ∀ a b c d, R a b c d = -R b a c d) |
| 24 | (hlast : ∀ a b c d, R a b c d = -R a b d c) |
| 25 | (hpair : ∀ a b c d, R a b c d = R c d a b) |
| 26 | (hbianchi : ∀ a b c d, R a b c d + R b c a d + R c a b d = 0) |
| 27 | (hP : ∀ a b, P a b = -P b a) (a b : I) : |
| 28 | 2 * (∑ d, ∑ e, R a d b e * P d e) = |
| 29 | ∑ d, ∑ e, R a b d e * P d e := by |
| 30 | have hpoint (d e : I) : R a b d e = R a d b e - R a e b d := by |
| 31 | have h := hbianchi a d b e |
| 32 | rw [hpair d b a e, hlast a e d b, hfirst b a d e] at h |
| 33 | linarith only [h] |
| 34 | have hswap : (∑ d, ∑ e, R a e b d * P d e) = |
| 35 | -(∑ d, ∑ e, R a d b e * P d e) := by |
| 36 | rw [Finset.sum_comm] |
| 37 | simp only [← Finset.sum_neg_distrib] |
| 38 | apply Finset.sum_congr rfl |
| 39 | intro d _ |
| 40 | apply Finset.sum_congr rfl |
| 41 | intro e _ |
| 42 | rw [hP e d] |
| 43 | ring |
| 44 | simp only [hpoint, sub_mul, Finset.sum_sub_distrib, hswap] |
| 45 | ring |
| 46 | |
| 47 | /-- The three curvature-P terms in the P evolution split into the mixed |
| 48 | sharp reaction and the cross term of the completed square. -/ |
| 49 | lemma hamiltonP_reaction_quadratic_contraction |
| 50 | (R : I → I → I → I → ℝ) (P : I → I → I → ℝ) |
| 51 | (U : I → I → ℝ) (W : I → ℝ) |
| 52 | (hfirst : ∀ a b c d, R a b c d = -R b a c d) |
| 53 | (hlast : ∀ a b c d, R a b c d = -R a b d c) |
| 54 | (hpair : ∀ a b c d, R a b c d = R c d a b) |
| 55 | (hbianchi : ∀ a b c d, R a b c d + R b c a d + R c a b d = 0) |
| 56 | (hP : ∀ a b c, P a b c = -P b a c) |
| 57 | (hU : ∀ a b, U a b = -U b a) : |
| 58 | 4 * (∑ a, ∑ b, ∑ c, ∑ d, ∑ e, |
| 59 | (R a d b e * P d e c + R a d c e * P d b e + R b d c e * P a d e) * |
| 60 | U a b * W c) = |
| 61 | 8 * (∑ a, ∑ d, ∑ b, ∑ c, ∑ e, R a d c e * P d b e * U a b * W c) + |
| 62 | 2 * (∑ a, ∑ b, (∑ c, P a b c * W c) * (∑ d, ∑ e, R a b d e * U d e)) := by |
| 63 | have hswap : |
| 64 | (∑ a, ∑ b, ∑ c, ∑ d, ∑ e, R b d c e * P a d e * U a b * W c) = |
| 65 | ∑ a, ∑ b, ∑ c, ∑ d, ∑ e, R a d c e * P d b e * U a b * W c := by |
| 66 | rw [Finset.sum_comm] |
| 67 | apply Finset.sum_congr rfl |
| 68 | intro a _ |
| 69 | apply Finset.sum_congr rfl |
| 70 | intro b _ |
| 71 | apply Finset.sum_congr rfl |
| 72 | intro c _ |
| 73 | apply Finset.sum_congr rfl |
| 74 | intro d _ |
| 75 | apply Finset.sum_congr rfl |
| 76 | intro e _ |
| 77 | rw [hP b d e, hU b a] |
| 78 | ring |
| 79 | have hcross : |
| 80 | 2 * (∑ a, ∑ b, ∑ c, ∑ d, ∑ e, R a d b e * P d e c * U a b * W c) = |
| 81 | ∑ a, ∑ b, (∑ c, P a b c * W c) * (∑ d, ∑ e, R a b d e * U d e) := by |
| 82 | have hlocal (a b c : I) : |
| 83 | 2 * (∑ d, ∑ e, R a d b e * P d e c * U a b * W c) = |
| 84 | ∑ d, ∑ e, R a b d e * P d e c * U a b * W c := by |
| 85 | simpa only [Finset.sum_mul, mul_assoc] using congrArg |
| 86 | (fun q : ℝ => q * U a b * W c) |
| 87 | (curvature_bianchi_skew_contraction R (fun d e => P d e c) |
| 88 | hfirst hlast hpair hbianchi (fun d e => hP d e c) a b) |
| 89 | have hsum := congrArg |
| 90 | (fun f : I → I → I → ℝ => ∑ a, ∑ b, ∑ c, f a b c) |
| 91 | (funext fun a => funext fun b => funext (hlocal a b)) |
| 92 | simp only [← Finset.mul_sum] at hsum |
| 93 | rw [hsum] |
| 94 | let σ : (I × I × I × I × I) ≃ (I × I × I × I × I) := |
| 95 | { toFun := fun (a, b, c, d, e) => (d, e, c, a, b) |
| 96 | invFun := fun (a, b, c, d, e) => (d, e, c, a, b) |
| 97 | left_inv := by rintro ⟨a, b, c, d, e⟩; rfl |
| 98 | right_inv := by rintro ⟨a, b, c, d, e⟩; rfl } |
| 99 | have he := Fintype.sum_equiv σ |
| 100 | (fun (a, b, c, d, e) => R a b d e * P d e c * U a b * W c) |
| 101 | (fun (a, b, c, d, e) => P a b c * W c * (R a b d e * U d e)) |
| 102 | (by rintro ⟨a, b, c, d, e⟩; dsimp [σ]; rw [hpair a b d e]; ring) |
| 103 | simp only [Fintype.sum_prod_type] at he |
| 104 | rw [he] |
| 105 | simp only [← Finset.mul_sum, ← Finset.sum_mul] |
| 106 | have horder : |
| 107 | (∑ a, ∑ b, ∑ c, ∑ d, ∑ e, R a d c e * P d b e * U a b * W c) = |
| 108 | ∑ a, ∑ d, ∑ b, ∑ c, ∑ e, R a d c e * P d b e * U a b * W c := by |
| 109 | apply Finset.sum_congr rfl |
| 110 | intro a _ |
| 111 | exact Finset.sum_comm_cycle |
| 112 | simp only [add_mul, Finset.sum_add_distrib, hswap] |
| 113 | rw [← horder] |
| 114 | linarith only [hcross] |
| 115 | |
| 116 | /-- The B contraction on two copies of a two-form is one quarter of the |
| 117 | squared curvature action. -/ |
| 118 | lemma curvatureB_quadratic_eq_square |
| 119 | (R : I → I → I → I → ℝ) (U : I → I → ℝ) |
| 120 | (hfirst : ∀ a b c d, R a b c d = -R b a c d) |
| 121 | (hlast : ∀ a b c d, R a b c d = -R a b d c) |
| 122 | (hpair : ∀ a b c d, R a b c d = R c d a b) |
| 123 | (hbianchi : ∀ a b c d, R a b c d + R b c a d + R c a b d = 0) |
| 124 | (hU : ∀ a b, U a b = -U b a) : |
| 125 | 4 * (∑ a, ∑ b, ∑ c, ∑ d, |
| 126 | (∑ e, ∑ f, R a e b f * R c e d f) * U a b * U c d) = |
| 127 | ∑ e, ∑ f, (∑ a, ∑ b, R e f a b * U a b) ^ 2 := by |
| 128 | classical |
| 129 | have hflip (a e b f : I) : R a e b f = R e a f b := by |
| 130 | rw [hfirst a e b f, hlast e a b f, neg_neg] |
| 131 | have hlocal (e f : I) : |
| 132 | 2 * (∑ a, ∑ b, R a e b f * U a b) = ∑ a, ∑ b, R e f a b * U a b := by |
| 133 | simpa only [hflip] using |
| 134 | curvature_bianchi_skew_contraction R U hfirst hlast hpair hbianchi hU e f |
| 135 | have horder : |
| 136 | (∑ a, ∑ b, ∑ c, ∑ d, (∑ e, ∑ f, R a e b f * R c e d f) * U a b * U c d) = |
| 137 | ∑ e, ∑ f, (∑ a, ∑ b, R a e b f * U a b) ^ 2 := by |
| 138 | let σ : (I × I × I × I × I × I) ≃ (I × I × I × I × I × I) := |
| 139 | { toFun := fun (a, b, c, d, e, f) => (e, f, a, b, c, d) |
| 140 | invFun := fun (e, f, a, b, c, d) => (a, b, c, d, e, f) |
| 141 | left_inv := by rintro ⟨a, b, c, d, e, f⟩; rfl |
| 142 | right_inv := by rintro ⟨e, f, a, b, c, d⟩; rfl } |
| 143 | have he := Fintype.sum_equiv σ |
| 144 | (fun (a, b, c, d, e, f) => (R a e b f * R c e d f) * U a b * U c d) |
| 145 | (fun (e, f, a, b, c, d) => (R a e b f * U a b) * (R c e d f * U c d)) |
| 146 | (by rintro ⟨a, b, c, d, e, f⟩; dsimp [σ]; ring) |
| 147 | simp only [Fintype.sum_prod_type] at he |
| 148 | simp only [Finset.sum_mul] |
| 149 | rw [he] |
| 150 | simp only [← Finset.mul_sum, ← Finset.sum_mul, pow_two] |
| 151 | rw [horder, Finset.mul_sum] |
| 152 | apply Finset.sum_congr rfl |
| 153 | intro e _ |
| 154 | rw [Finset.mul_sum] |
| 155 | apply Finset.sum_congr rfl |
| 156 | intro f _ |
| 157 | rw [← hlocal] |
| 158 | ring |
| 159 | |
| 160 | /-- Contracting the curvature evolution reaction against a two-form gives |
| 161 | the curvature sharp term plus the squared curvature action. -/ |
| 162 | lemma curvature_reaction_quadratic_contraction |
| 163 | (R : I → I → I → I → ℝ) (U : I → I → ℝ) |
| 164 | (hfirst : ∀ a b c d, R a b c d = -R b a c d) |
| 165 | (hlast : ∀ a b c d, R a b c d = -R a b d c) |
| 166 | (hpair : ∀ a b c d, R a b c d = R c d a b) |
| 167 | (hbianchi : ∀ a b c d, R a b c d + R b c a d + R c a b d = 0) |
| 168 | (hU : ∀ a b, U a b = -U b a) : |
| 169 | let B := fun a b c d => ∑ e, ∑ f, R a e b f * R c e d f |
| 170 | 2 * (∑ a, ∑ b, ∑ c, ∑ d, |
| 171 | (B a b c d - B a b d c - B a d b c + B a c b d) * U a b * U c d) = |
| 172 | 4 * (∑ a, ∑ e, ∑ b, ∑ c, ∑ f, ∑ d, R a e c f * R b e d f * U a b * U c d) + |
| 173 | ∑ a, ∑ b, (∑ c, ∑ d, R a b c d * U c d) ^ 2 := by |
| 174 | let B := fun a b c d => ∑ e, ∑ f, R a e b f * R c e d f |
| 175 | have hswap (A : I → I → I → I → ℝ) : |
| 176 | (∑ a, ∑ b, ∑ c, ∑ d, A a b d c * U a b * U c d) = |
| 177 | -(∑ a, ∑ b, ∑ c, ∑ d, A a b c d * U a b * U c d) := by |
| 178 | simp only [← Finset.sum_neg_distrib] |
| 179 | apply Finset.sum_congr rfl |
| 180 | intro a _ |
| 181 | apply Finset.sum_congr rfl |
| 182 | intro b _ |
| 183 | rw [Finset.sum_comm] |
| 184 | apply Finset.sum_congr rfl |
| 185 | intro c _ |
| 186 | apply Finset.sum_congr rfl |
| 187 | intro d _ |
| 188 | rw [hU d c] |
| 189 | ring |
| 190 | have hs₁ := hswap B |
| 191 | have hs₂ := hswap (fun a b c d => B a c b d) |
| 192 | have hsquare := curvatureB_quadratic_eq_square R U hfirst hlast hpair hbianchi hU |
| 193 | have horder : (∑ a, ∑ b, ∑ c, ∑ d, B a c b d * U a b * U c d) = |
| 194 | ∑ a, ∑ e, ∑ b, ∑ c, ∑ f, ∑ d, R a e c f * R b e d f * U a b * U c d := by |
| 195 | classical |
| 196 | let σ : (I × I × I × I × I × I) ≃ (I × I × I × I × I × I) := |
| 197 | { toFun := fun (a, b, c, d, e, f) => (a, e, b, c, f, d) |
| 198 | invFun := fun (a, e, b, c, f, d) => (a, b, c, d, e, f) |
| 199 | left_inv := by rintro ⟨a, b, c, d, e, f⟩; rfl |
| 200 | right_inv := by rintro ⟨a, e, b, c, f, d⟩; rfl } |
| 201 | have he := Fintype.sum_equiv σ |
| 202 | (fun (a, b, c, d, e, f) => (R a e c f * R b e d f) * U a b * U c d) |
| 203 | (fun (a, e, b, c, f, d) => R a e c f * R b e d f * U a b * U c d) |
| 204 | (by rintro ⟨a, b, c, d, e, f⟩; rfl) |
| 205 | simpa only [B, Finset.sum_mul, Fintype.sum_prod_type] using he |
| 206 | dsimp only |
| 207 | change 2 * (∑ a, ∑ b, ∑ c, ∑ d, |
| 208 | (B a b c d - B a b d c - B a d b c + B a c b d) * U a b * U c d) = _ |
| 209 | simp only [sub_mul, add_mul, Finset.sum_sub_distrib, Finset.sum_add_distrib] |
| 210 | rw [hs₁, hs₂, horder] |
| 211 | dsimp only [B] |
| 212 | linarith only [hsquare] |
| 213 | |
| 214 | /-- The reaction left after the prescribed-jet cancellations is nonnegative |
| 215 | on the Hamilton cone. This connects the tensor-equation form of the reaction |
| 216 | to the checked sharp-reaction and square decomposition. -/ |
| 217 | lemma hamilton_reaction_collected_nonneg |
| 218 | (R : I → I → I → I → ℝ) (P : I → I → I → ℝ) |
| 219 | (M U : I → I → ℝ) (W : I → ℝ) |
| 220 | (hfirst : ∀ a b c d, R a b c d = -R b a c d) |
| 221 | (hlast : ∀ a b c d, R a b c d = -R a b d c) |
| 222 | (hpair : ∀ a b c d, R a b c d = R c d a b) |
| 223 | (hbianchi : ∀ a b c d, R a b c d + R b c a d + R c a b d = 0) |
| 224 | (hP : ∀ a b c, P a b c = -P b a c) |
| 225 | (hU : ∀ a b, U a b = -U b a) |
| 226 | (hQ : (Matrix.fromBlocks |
| 227 | (fun ac bd : I × I => R ac.1 ac.2 bd.1 bd.2) |
| 228 | (fun (ac : I × I) d => P ac.1 ac.2 d) |
| 229 | (fun c (bd : I × I) => P bd.1 bd.2 c) M).PosSemidef) : |
| 230 | let B := fun a b c d => ∑ e, ∑ f, R a e b f * R c e d f |
| 231 | 0 ≤ 2 * (∑ a, ∑ c, ∑ b, ∑ d, R a c b d * M c d * W a * W b) - |
| 232 | 2 * (∑ a, ∑ c, ∑ d, ∑ b, P a c d * P b d c * W a * W b) + |
| 233 | (∑ a, ∑ b, ∑ c, ∑ d, P c d a * P c d b * W a * W b) + |
| 234 | 4 * (∑ a, ∑ b, ∑ c, ∑ d, ∑ e, |
| 235 | (R a d b e * P d e c + R a d c e * P d b e + R b d c e * P a d e) * |
| 236 | U a b * W c) + |
| 237 | 2 * (∑ a, ∑ b, ∑ c, ∑ d, |
| 238 | (B a b c d - B a b d c - B a d b c + B a c b d) * U a b * U c d) := by |
| 239 | have hp := hamiltonP_reaction_quadratic_contraction R P U W |
| 240 | hfirst hlast hpair hbianchi hP hU |
| 241 | have hr := curvature_reaction_quadratic_contraction R U |
| 242 | hfirst hlast hpair hbianchi hU |
| 243 | have hnonneg := hamiltonReaction_nonneg R P M U W hpair hP hU hQ |
| 244 | have hPP : (∑ a, ∑ b, ∑ c, ∑ d, P c d a * P c d b * W a * W b) = |
| 245 | ∑ c, ∑ d, (∑ a, P c d a * W a) ^ 2 := by |
| 246 | rw [Finset.sum_comm_cycle] |
| 247 | apply Finset.sum_congr rfl |
| 248 | intro c _ |
| 249 | rw [Finset.sum_comm_cycle] |
| 250 | apply Finset.sum_congr rfl |
| 251 | intro d _ |
| 252 | simp only [pow_two, Finset.sum_mul, Finset.mul_sum] |
| 253 | apply Finset.sum_congr rfl |
| 254 | intro a _ |
| 255 | apply Finset.sum_congr rfl |
| 256 | intro b _ |
| 257 | ring |
| 258 | have hsquare : |
| 259 | (∑ a, ∑ b, ((∑ c, P a b c * W c) + (∑ c, ∑ d, R a b c d * U c d)) ^ 2) = |
| 260 | (∑ a, ∑ b, (∑ c, P a b c * W c) ^ 2) + |
| 261 | 2 * (∑ a, ∑ b, (∑ c, P a b c * W c) * (∑ c, ∑ d, R a b c d * U c d)) + |
| 262 | (∑ a, ∑ b, (∑ c, ∑ d, R a b c d * U c d) ^ 2) := by |
| 263 | simp only [add_sq, mul_assoc, Finset.sum_add_distrib, ← Finset.mul_sum] |
| 264 | dsimp only at hr ⊢ |
| 265 | rw [hp, hr, hPP] |
| 266 | rw [hsquare] at hnonneg |
| 267 | linarith only [hnonneg] |
| 268 | |
| 269 | end Poincare.RicciFlow.Harnack |