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.Curvature.Evolution.Connection.CurvatureFirstVariation |
| 2 | import PoincareLib.Geometry.RicciFlow.Curvature.Calculus.Identities.TensorCommutator |
| 3 | import PoincareLib.Geometry.RicciFlow.Curvature.Calculus.Identities.RiemannDifferentialContractions |
| 4 | import PoincareLib.Geometry.RicciFlow.Curvature.Reaction |
| 5 | |
| 6 | /-! Adapted from Mapher06/Poincare-MorganTian, `PoincareMT/Proofs/M04/RiemannEvolutionInterior.lean`, |
| 7 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. See the curvature import record under |
| 8 | `references/ricci-flow/mapher/curvature/`. -/ |
| 9 | |
| 10 | /-! |
| 11 | # Interior evolution of the actual curvature tensor |
| 12 | |
| 13 | Trace differentiated Bianchi, commute the two derivative inputs, and identify |
| 14 | the resulting four-slot curvature action with the fixed-input reaction. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open scoped Manifold ContDiff Bundle BigOperators |
| 20 | open Set Topology Filter |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.RicciFlowAnalysis |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 28 | {g : RiemannianMetric n M} {J : Set ℝ} |
| 29 | |
| 30 | set_option backward.isDefEq.respectTransparency false in |
| 31 | private theorem curvature_expand_first (D : LeviCivitaData g) (x : M) |
| 32 | (a b c d : TangentSpace (𝓡 n) x) : |
| 33 | D.curvatureTensor x a b c d = |
| 34 | ∑ i, g.inner x (g.orthonormalBasis x i) a * |
| 35 | D.curvatureTensor x (g.orthonormalBasis x i) b c d := by |
| 36 | classical |
| 37 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 38 | ⟨g.toRiemannianMetric⟩ |
| 39 | let e := g.orthonormalBasis x |
| 40 | obtain ⟨P, hP⟩ := (isSmoothCovariantTensor_riemannEvaluation D).1 x |
| 41 | let L := P.toLinearMap ![0, b, c, d] 0 |
| 42 | have hL (a : TangentSpace (𝓡 n) x) : L a = D.curvatureTensor x a b c d := by |
| 43 | have hu : Function.update ![0, b, c, d] 0 a = ![a, b, c, d] := by |
| 44 | funext i |
| 45 | fin_cases i <;> simp [Function.update] |
| 46 | change P (Function.update ![0, b, c, d] 0 a) = D.curvatureTensor x a b c d |
| 47 | rw [hu] |
| 48 | exact (hP ![a, b, c, d]).symm |
| 49 | calc |
| 50 | _ = L a := (hL a).symm |
| 51 | _ = L (∑ i, inner ℝ (e i) a • e i) := congrArg L (e.sum_repr' a).symm |
| 52 | _ = ∑ i, inner ℝ (e i) a * D.curvatureTensor x (e i) b c d := by |
| 53 | rw [map_sum] |
| 54 | apply Finset.sum_congr rfl |
| 55 | intro i hi |
| 56 | rw [map_smul, hL] |
| 57 | rfl |
| 58 | _ = _ := rfl |
| 59 | |
| 60 | set_option maxHeartbeats 2500000 in |
| 61 | -- The curvature-action expansion and orthonormal trace sums need extra elaboration. |
| 62 | set_option backward.isDefEq.respectTransparency false in |
| 63 | private theorem curvature_action_trace (D : LeviCivitaData g) (x : M) |
| 64 | (a b c d : TangentSpace (𝓡 n) x) : |
| 65 | let e := g.orthonormalBasis x |
| 66 | (∑ i, (D.curvatureTensor x (D.curvature x a (e i) (e i)) b c d + |
| 67 | D.curvatureTensor x (e i) (D.curvature x a (e i) b) c d + |
| 68 | D.curvatureTensor x (e i) b (D.curvature x a (e i) c) d + |
| 69 | D.curvatureTensor x (e i) b c (D.curvature x a (e i) d))) - |
| 70 | (∑ i, (D.curvatureTensor x (D.curvature x b (e i) (e i)) a c d + |
| 71 | D.curvatureTensor x (e i) (D.curvature x b (e i) a) c d + |
| 72 | D.curvatureTensor x (e i) a (D.curvature x b (e i) c) d + |
| 73 | D.curvatureTensor x (e i) a c (D.curvature x b (e i) d))) = |
| 74 | (∑ i, (D.ricci x a (e i) * D.curvatureTensor x (e i) b c d + |
| 75 | D.ricci x b (e i) * D.curvatureTensor x a (e i) c d)) - |
| 76 | 2 * (D.curvatureB x a b c d - D.curvatureB x a b d c - |
| 77 | D.curvatureB x a d b c + D.curvatureB x a c b d) := by |
| 78 | classical |
| 79 | let e := g.orthonormalBasis x |
| 80 | let E := TangentSpace (𝓡 n) x |
| 81 | let R := D.curvatureTensor x |
| 82 | let K := D.curvature x |
| 83 | let B := D.curvatureB x |
| 84 | have hswap (a b c d : E) : R a b c d = -R b a c d := |
| 85 | curvatureTensor_swap_first D x b a c d |
| 86 | have hlast (a b c d : E) : R a b c d = -R a b d c := |
| 87 | curvatureTensor_swap_last D x a b c d |
| 88 | have hpair (a b c d : E) : R a b c d = R c d a b := |
| 89 | curvatureTensor_pair_exchange D x a b c d |
| 90 | have hBianchi (a b c d : E) : R a b c d = R a c b d - R a d b c := by |
| 91 | have h := curvatureTensor_cyclic D x a b c d |
| 92 | change R a b c d + R b c a d + R c a b d = 0 at h |
| 93 | rw [hpair b c a d, hswap c a b d] at h |
| 94 | linarith only [h] |
| 95 | have hcoeff (a b c : E) (i) : g.inner x (e i) (K a b c) = R a b (e i) c := by |
| 96 | rw [g.symm] |
| 97 | rfl |
| 98 | have hR1 (v a c d : E) : R v a c d = ∑ i, g.inner x (e i) v * R (e i) a c d := |
| 99 | curvature_expand_first D x v a c d |
| 100 | have hR2 (v a c d : E) : R a v c d = ∑ i, g.inner x (e i) v * R a (e i) c d := by |
| 101 | calc |
| 102 | _ = -R v a c d := hswap a v c d |
| 103 | _ = -(∑ i, g.inner x (e i) v * R (e i) a c d) := congrArg Neg.neg (hR1 v a c d) |
| 104 | _ = _ := by |
| 105 | rw [← Finset.sum_neg_distrib] |
| 106 | apply Finset.sum_congr rfl |
| 107 | intro i hi |
| 108 | rw [hswap (e i) a c d] |
| 109 | ring |
| 110 | have hR3 (v a b d : E) : R a b v d = ∑ i, g.inner x (e i) v * R a b (e i) d := by |
| 111 | rw [hpair a b v d, hR1 v d a b] |
| 112 | apply Finset.sum_congr rfl |
| 113 | intro i hi |
| 114 | rw [hpair (e i) d a b] |
| 115 | have hR4 (v a b c : E) : R a b c v = ∑ i, g.inner x (e i) v * R a b c (e i) := by |
| 116 | rw [hpair a b c v, hR2 v c a b] |
| 117 | apply Finset.sum_congr rfl |
| 118 | intro i hi |
| 119 | rw [hpair c (e i) a b] |
| 120 | have hBpair (a b c d : E) : B a b c d = B c d a b := by |
| 121 | apply Finset.sum_congr rfl |
| 122 | intro i hi |
| 123 | apply Finset.sum_congr rfl |
| 124 | intro j hj |
| 125 | exact mul_comm _ _ |
| 126 | have hBswap (a b c d : E) : B b a c d = B a b d c := by |
| 127 | change (∑ i, ∑ j, R b (e i) a (e j) * R c (e i) d (e j)) = |
| 128 | ∑ i, ∑ j, R a (e i) b (e j) * R d (e i) c (e j) |
| 129 | rw [Finset.sum_comm] |
| 130 | apply Finset.sum_congr rfl |
| 131 | intro i hi |
| 132 | apply Finset.sum_congr rfl |
| 133 | intro j hj |
| 134 | rw [hpair b (e j) a (e i), hpair c (e j) d (e i)] |
| 135 | have h0 (a b c d : E) : |
| 136 | (∑ i, R (K a (e i) (e i)) b c d) = |
| 137 | ∑ i, D.ricci x a (e i) * R (e i) b c d := by |
| 138 | calc |
| 139 | _ = ∑ i, ∑ j, R a (e i) (e j) (e i) * R (e j) b c d := by |
| 140 | apply Finset.sum_congr rfl |
| 141 | intro i hi |
| 142 | rw [hR1 (K a (e i) (e i)) b c d] |
| 143 | apply Finset.sum_congr rfl |
| 144 | intro j hj |
| 145 | rw [hcoeff] |
| 146 | _ = _ := by |
| 147 | rw [Finset.sum_comm] |
| 148 | apply Finset.sum_congr rfl |
| 149 | intro i hi |
| 150 | rw [← Finset.sum_mul] |
| 151 | rfl |
| 152 | have h1 (a b c d : E) : |
| 153 | (∑ i, R (e i) (K a (e i) b) c d) = -(B a b c d - B a b d c) := by |
| 154 | change (∑ i, R (e i) (K a (e i) b) c d) = |
| 155 | -((∑ i, ∑ j, R a (e i) b (e j) * R c (e i) d (e j)) - |
| 156 | ∑ i, ∑ j, R a (e i) b (e j) * R d (e i) c (e j)) |
| 157 | rw [← Finset.sum_sub_distrib, ← Finset.sum_neg_distrib] |
| 158 | apply Finset.sum_congr rfl |
| 159 | intro i hi |
| 160 | rw [hR2 (K a (e i) b) (e i) c d, |
| 161 | ← Finset.sum_sub_distrib, ← Finset.sum_neg_distrib] |
| 162 | apply Finset.sum_congr rfl |
| 163 | intro j hj |
| 164 | rw [hcoeff, hlast a (e i) (e j) b, hpair (e i) (e j) c d, |
| 165 | hBianchi c d (e i) (e j), hpair c (e j) d (e i)] |
| 166 | ring |
| 167 | have h2 (a b c d : E) : |
| 168 | (∑ i, R (e i) b (K a (e i) c) d) = -B a c b d := by |
| 169 | change (∑ i, R (e i) b (K a (e i) c) d) = |
| 170 | -(∑ i, ∑ j, R a (e i) c (e j) * R b (e i) d (e j)) |
| 171 | rw [← Finset.sum_neg_distrib] |
| 172 | apply Finset.sum_congr rfl |
| 173 | intro i hi |
| 174 | rw [hR3 (K a (e i) c) (e i) b d, ← Finset.sum_neg_distrib] |
| 175 | apply Finset.sum_congr rfl |
| 176 | intro j hj |
| 177 | rw [hcoeff, hlast a (e i) (e j) c, hswap (e i) b (e j) d, |
| 178 | hlast b (e i) (e j) d] |
| 179 | ring |
| 180 | have h3 (a b c d : E) : |
| 181 | (∑ i, R (e i) b c (K a (e i) d)) = B a d b c := by |
| 182 | change (∑ i, R (e i) b c (K a (e i) d)) = |
| 183 | ∑ i, ∑ j, R a (e i) d (e j) * R b (e i) c (e j) |
| 184 | apply Finset.sum_congr rfl |
| 185 | intro i hi |
| 186 | rw [hR4 (K a (e i) d) (e i) b c] |
| 187 | apply Finset.sum_congr rfl |
| 188 | intro j hj |
| 189 | rw [hcoeff, hlast a (e i) (e j) d, hswap (e i) b c (e j)] |
| 190 | ring |
| 191 | have h0b : (∑ i, D.ricci x b (e i) * R (e i) a c d) = |
| 192 | -(∑ i, D.ricci x b (e i) * R a (e i) c d) := by |
| 193 | rw [← Finset.sum_neg_distrib] |
| 194 | apply Finset.sum_congr rfl |
| 195 | intro i hi |
| 196 | rw [hswap (e i) a c d] |
| 197 | ring |
| 198 | change (∑ i, (R (K a (e i) (e i)) b c d + R (e i) (K a (e i) b) c d + |
| 199 | R (e i) b (K a (e i) c) d + R (e i) b c (K a (e i) d))) - |
| 200 | (∑ i, (R (K b (e i) (e i)) a c d + R (e i) (K b (e i) a) c d + |
| 201 | R (e i) a (K b (e i) c) d + R (e i) a c (K b (e i) d))) = |
| 202 | (∑ i, (D.ricci x a (e i) * R (e i) b c d + D.ricci x b (e i) * R a (e i) c d)) - |
| 203 | 2 * (B a b c d - B a b d c - B a d b c + B a c b d) |
| 204 | simp only [Finset.sum_add_distrib, h0, h1, h2, h3] |
| 205 | rw [h0b, hBswap a b c d, hBswap a b d c, |
| 206 | hBpair b c a d, hBpair b d a c] |
| 207 | ring |
| 208 | |
| 209 | private theorem cons_cons_four_tuple {α : Type*} (p q a b c d : α) : |
| 210 | Fin.cons p (Fin.cons q ![a, b, c, d]) = ![p, q, a, b, c, d] := by |
| 211 | funext i |
| 212 | fin_cases i <;> rfl |
| 213 | |
| 214 | private theorem cons_cons_two_tuple {α : Type*} (p q a b : α) : |
| 215 | Fin.cons p (Fin.cons q ![a, b]) = ![p, q, a, b] := by |
| 216 | funext i |
| 217 | fin_cases i <;> rfl |
| 218 | |
| 219 | set_option maxHeartbeats 4000000 in |
| 220 | -- The variation identity and curvature reaction contractions need extra elaboration. |
| 221 | set_option backward.isDefEq.respectTransparency false in |
| 222 | theorem curvature_firstVariation_eq_laplacian_add_reaction (D : LeviCivitaData g) (x : M) |
| 223 | (a b c d : TangentSpace (𝓡 n) x) : |
| 224 | -2 * D.ricci x (D.curvature x a b d) c - |
| 225 | D.iteratedCovariantTensorDerivative D.ricciEvaluation 2 x ![a, b, d, c] - |
| 226 | D.iteratedCovariantTensorDerivative D.ricciEvaluation 2 x ![a, d, b, c] + |
| 227 | D.iteratedCovariantTensorDerivative D.ricciEvaluation 2 x ![a, c, b, d] + |
| 228 | D.iteratedCovariantTensorDerivative D.ricciEvaluation 2 x ![b, a, d, c] + |
| 229 | D.iteratedCovariantTensorDerivative D.ricciEvaluation 2 x ![b, d, a, c] - |
| 230 | D.iteratedCovariantTensorDerivative D.ricciEvaluation 2 x ![b, c, a, d] = |
| 231 | D.tensorLaplacian D.riemannEvaluation x ![a, b, c, d] + D.curvatureReaction x a b c d := by |
| 232 | classical |
| 233 | let E := TangentSpace (𝓡 n) x |
| 234 | let e := g.orthonormalBasis x |
| 235 | let R := D.curvatureTensor x |
| 236 | let K := D.curvature x |
| 237 | let H := D.iteratedCovariantTensorDerivative D.ricciEvaluation 2 x |
| 238 | let T := D.iteratedCovariantTensorDerivative D.riemannEvaluation 2 x |
| 239 | let L := D.tensorLaplacian D.riemannEvaluation x ![a, b, c, d] |
| 240 | let A (p q u v w z : E) := R (K p q u) v w z + R u (K p q v) w z + |
| 241 | R u v (K p q w) z + R u v w (K p q z) |
| 242 | let C := (∑ i, A a (e i) (e i) b c d) - ∑ i, A b (e i) (e i) a c d |
| 243 | let F4 := H ![a, c, b, d] - H ![a, d, b, c] - H ![b, c, a, d] + H ![b, d, a, c] |
| 244 | have hComm (p q u v w z : E) : |
| 245 | T ![p, q, u, v, w, z] - T ![q, p, u, v, w, z] = -A p q u v w z := by |
| 246 | have hc := covariantTensorDerivative_commutator D |
| 247 | (isSmoothCovariantTensor_riemannEvaluation D) x p q ![u, v, w, z] |
| 248 | rw [cons_cons_four_tuple, cons_cons_four_tuple, Fin.sum_univ_four] at hc |
| 249 | simpa [A, R, K, LeviCivitaData.riemannEvaluation, Function.update] using hc |
| 250 | have hCommSum (p q c d : E) : |
| 251 | (∑ i, T ![p, e i, e i, q, c, d]) - (∑ i, T ![e i, p, e i, q, c, d]) = |
| 252 | -(∑ i, A p (e i) (e i) q c d) := by |
| 253 | rw [← Finset.sum_sub_distrib, ← Finset.sum_neg_distrib] |
| 254 | apply Finset.sum_congr rfl |
| 255 | intro i hi |
| 256 | exact hComm p (e i) (e i) q c d |
| 257 | have hdiv (p q c d : E) : |
| 258 | (∑ i, T ![p, e i, e i, q, c, d]) = H ![p, c, q, d] - H ![p, d, q, c] := by |
| 259 | have hd := riemann_secondCovariantDerivative_divergence D x p q c d |
| 260 | rw [ricci_secondCovariantDerivative_symm D x p c d q, |
| 261 | ricci_secondCovariantDerivative_symm D x p d c q] at hd |
| 262 | exact hd |
| 263 | have hLtrace : L = ∑ i, T ![e i, e i, a, b, c, d] := by |
| 264 | apply Finset.sum_congr rfl |
| 265 | intro i hi |
| 266 | exact congrArg (D.iteratedCovariantTensorDerivative D.riemannEvaluation 2 x) |
| 267 | (cons_cons_four_tuple (e i) (e i) a b c d) |
| 268 | have hBianchi : (∑ i, T ![e i, e i, a, b, c, d]) - |
| 269 | (∑ i, T ![e i, a, e i, b, c, d]) + (∑ i, T ![e i, b, e i, a, c, d]) = 0 := by |
| 270 | rw [← Finset.sum_sub_distrib, ← Finset.sum_add_distrib] |
| 271 | apply Finset.sum_eq_zero |
| 272 | intro i hi |
| 273 | have hb := riemann_secondCovariantDerivative_bianchi D x (e i) (e i) a b c d |
| 274 | rw [riemann_secondCovariantDerivative_swap_first D x (e i) a b (e i) c d] at hb |
| 275 | exact hb |
| 276 | have hLap : L = F4 + C := by |
| 277 | have hca := hCommSum a b c d |
| 278 | have hcb := hCommSum b a c d |
| 279 | rw [hdiv] at hca hcb |
| 280 | rw [← hLtrace] at hBianchi |
| 281 | dsimp only [F4, C] |
| 282 | linarith only [hBianchi, hca, hcb] |
| 283 | have hRicComm : H ![a, b, d, c] - H ![b, a, d, c] = |
| 284 | -(D.ricci x (K a b d) c + D.ricci x d (K a b c)) := by |
| 285 | have hc := covariantTensorDerivative_commutator D |
| 286 | (isSmoothCovariantTensor_ricciEvaluation D) x a b ![d, c] |
| 287 | rw [cons_cons_two_tuple, cons_cons_two_tuple, Fin.sum_univ_two] at hc |
| 288 | simpa [K, LeviCivitaData.ricciEvaluation, Function.update] using hc |
| 289 | have hcoeff (u v w : E) (i) : g.inner x (e i) (K u v w) = R u v (e i) w := by |
| 290 | rw [g.symm] |
| 291 | rfl |
| 292 | have hRicK (u v w z : E) : |
| 293 | D.ricci x (K u v w) z = ∑ i, R u v (e i) w * D.ricci x (e i) z := by |
| 294 | change (∑ j, R (K u v w) (e j) z (e j)) = _ |
| 295 | calc |
| 296 | _ = ∑ j, ∑ i, R u v (e i) w * R (e i) (e j) z (e j) := by |
| 297 | apply Finset.sum_congr rfl |
| 298 | intro j hj |
| 299 | have he := curvature_expand_first D x (K u v w) (e j) z (e j) |
| 300 | change R (K u v w) (e j) z (e j) = |
| 301 | ∑ i, g.inner x (e i) (K u v w) * R (e i) (e j) z (e j) at he |
| 302 | rw [he] |
| 303 | apply Finset.sum_congr rfl |
| 304 | intro i hi |
| 305 | rw [hcoeff] |
| 306 | _ = _ := by |
| 307 | rw [Finset.sum_comm] |
| 308 | apply Finset.sum_congr rfl |
| 309 | intro i hi |
| 310 | rw [← Finset.mul_sum] |
| 311 | rfl |
| 312 | have hmetric1 : D.ricci x (K a b d) c = |
| 313 | ∑ i, D.ricci x c (e i) * R a b (e i) d := by |
| 314 | rw [hRicK] |
| 315 | apply Finset.sum_congr rfl |
| 316 | intro i hi |
| 317 | rw [ricci_symm D x (e i) c] |
| 318 | exact mul_comm _ _ |
| 319 | have hmetric2 : D.ricci x d (K a b c) = |
| 320 | -(∑ i, D.ricci x d (e i) * R a b c (e i)) := by |
| 321 | rw [ricci_symm D x d (K a b c), hRicK, ← Finset.sum_neg_distrib] |
| 322 | apply Finset.sum_congr rfl |
| 323 | intro i hi |
| 324 | rw [ricci_symm D x (e i) d] |
| 325 | have hs : R a b (e i) c = -R a b c (e i) := |
| 326 | curvatureTensor_swap_last D x a b (e i) c |
| 327 | rw [hs] |
| 328 | ring |
| 329 | have hC : C = (∑ i, (D.ricci x a (e i) * R (e i) b c d + |
| 330 | D.ricci x b (e i) * R a (e i) c d)) - |
| 331 | 2 * (D.curvatureB x a b c d - D.curvatureB x a b d c - |
| 332 | D.curvatureB x a d b c + D.curvatureB x a c b d) := |
| 333 | curvature_action_trace D x a b c d |
| 334 | have hReaction : -C - D.ricci x (K a b d) c + D.ricci x d (K a b c) = |
| 335 | D.curvatureReaction x a b c d := by |
| 336 | rw [hC, hmetric1, hmetric2] |
| 337 | simp only [LeviCivitaData.curvatureReaction, Finset.sum_add_distrib] |
| 338 | ring |
| 339 | change -2 * D.ricci x (K a b d) c - H ![a, b, d, c] - H ![a, d, b, c] + |
| 340 | H ![a, c, b, d] + H ![b, a, d, c] + H ![b, d, a, c] - H ![b, c, a, d] = |
| 341 | L + D.curvatureReaction x a b c d |
| 342 | dsimp only [F4] at hLap |
| 343 | linarith only [hLap, hRicComm, hReaction] |
| 344 | |
| 345 | theorem hasDerivAt_curvatureTensor_evolution (F : RicciFlow n M J) |
| 346 | {t : ℝ} (ht : t ∈ interior J) (x : M) |
| 347 | (u v w z : TangentSpace (𝓡 n) x) : |
| 348 | HasDerivAt (fun s ↦ (F.connection s).curvatureTensor x u v w z) |
| 349 | ((F.connection t).tensorLaplacian (F.connection t).riemannEvaluation x ![u, v, w, z] + |
| 350 | (F.connection t).curvatureReaction x u v w z) t := by |
| 351 | exact (hasDerivAt_curvatureTensor_first_variation F ht x u v w z).congr_deriv |
| 352 | (curvature_firstVariation_eq_laplacian_add_reaction (F.connection t) x u v w z) |
| 353 | |
| 354 | end PoincareMT.RicciFlowAnalysis |
| 355 |