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.Calculus |
| 2 | import PoincareLib.Geometry.RicciFlow.Curvature.Theory |
| 3 | import PoincareLib.Geometry.Riemannian.Tensor.RicciDerivative |
| 4 | import PoincareLib.Geometry.Riemannian.Tensor.Algebra |
| 5 | import PoincareLib.Geometry.Riemannian.Hessian.Symmetry |
| 6 | import Mathlib.Tactic.Ring |
| 7 | |
| 8 | /-! |
| 9 | # Hamilton's Harnack tensors |
| 10 | |
| 11 | Geometric tensor inputs for Hamilton's matrix estimate, using the retained |
| 12 | Levi-Civita connection and the convention `Ric u v = sum_a Rm u a v a`. |
| 13 | See Chow et al., Part II, equations (15.5) and (15.9), PDF pp. 287-288. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open scoped Manifold ContDiff Bundle BigOperators |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace Poincare.RicciFlow.Harnack |
| 23 | |
| 24 | open PoincareMT |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 28 | {g : RiemannianMetric n M} |
| 29 | |
| 30 | /-- Hamilton's three-tensor, with the derivative input first. -/ |
| 31 | noncomputable def hamiltonP (D : LeviCivitaData g) |
| 32 | (x : M) (u v w : TangentSpace (𝓡 n) x) : ℝ := |
| 33 | D.covariantTensorDerivative D.ricciEvaluation x ![u, v, w] - |
| 34 | D.covariantTensorDerivative D.ricciEvaluation x ![v, u, w] |
| 35 | |
| 36 | /-- Hamilton's two-tensor; the parameter is elapsed time from the initial |
| 37 | time. At zero the last term uses the usual totalized real division. -/ |
| 38 | noncomputable def hamiltonM (D : LeviCivitaData g) (τ : ℝ) |
| 39 | (x : M) (u v : TangentSpace (𝓡 n) x) : ℝ := |
| 40 | let b := g.orthonormalBasis x |
| 41 | D.tensorLaplacian D.ricciEvaluation x ![u, v] - |
| 42 | D.hessian D.scalarCurvature x u v / 2 + |
| 43 | (2 * (∑ k, ∑ l, D.curvatureTensor x (b k) u (b l) v * |
| 44 | D.ricci x (b k) (b l)) - |
| 45 | ∑ k, D.ricci x u (b k) * D.ricci x (b k) v) + |
| 46 | D.ricci x u v / (2 * τ) |
| 47 | |
| 48 | theorem hamiltonP_skew (D : LeviCivitaData g) |
| 49 | (x : M) (u v w : TangentSpace (𝓡 n) x) : |
| 50 | hamiltonP D x u v w = -hamiltonP D x v u w := by |
| 51 | unfold hamiltonP |
| 52 | ring |
| 53 | |
| 54 | theorem hamiltonP_cyclic (D : LeviCivitaData g) |
| 55 | (hD : D.CurvatureTensorCalculus) |
| 56 | (x : M) (u v w : TangentSpace (𝓡 n) x) : |
| 57 | hamiltonP D x u v w + hamiltonP D x v w u + hamiltonP D x w u v = 0 := by |
| 58 | unfold hamiltonP |
| 59 | rw [D.covariantTensorDerivative_ricciEvaluation_symm hD x v u w, |
| 60 | D.covariantTensorDerivative_ricciEvaluation_symm hD x w v u, |
| 61 | D.covariantTensorDerivative_ricciEvaluation_symm hD x u w v] |
| 62 | ring |
| 63 | |
| 64 | /-- Antisymmetrizing the actual covariant Ricci derivative produces a smooth |
| 65 | covariant three-tensor, including pointwise multilinearity. -/ |
| 66 | lemma hamiltonP_isSmoothCovariantTensor |
| 67 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) : |
| 68 | IsSmoothCovariantTensor (k := 3) (fun x v ↦ hamiltonP D x (v 0) (v 1) (v 2)) := by |
| 69 | have hA := hD.2.2.1 2 D.ricciEvaluation hD.2.1 |
| 70 | have he (x : M) (v : Fin 3 → TangentSpace (𝓡 n) x) : |
| 71 | ![v 0, v 1, v 2] = v := by |
| 72 | ext i |
| 73 | fin_cases i <;> rfl |
| 74 | have hs (x : M) (v : Fin 3 → TangentSpace (𝓡 n) x) : |
| 75 | ![v 1, v 0, v 2] = v ∘ Equiv.swap 0 1 := by |
| 76 | ext i |
| 77 | fin_cases i <;> simp [Equiv.swap_apply_def] |
| 78 | have hp : (fun x (v : Fin 3 → TangentSpace (𝓡 n) x) ↦ |
| 79 | hamiltonP D x (v 0) (v 1) (v 2)) = |
| 80 | (fun x v ↦ D.covariantTensorDerivative D.ricciEvaluation x v - |
| 81 | D.covariantTensorDerivative D.ricciEvaluation x (v ∘ Equiv.swap 0 1)) := by |
| 82 | funext x v |
| 83 | simp only [hamiltonP, he, hs] |
| 84 | rw [hp] |
| 85 | exact hA.sub (hA.perm (Equiv.swap 0 1)) |
| 86 | |
| 87 | /-- The two algebraic contractions in Hamilton's two-tensor are symmetric. -/ |
| 88 | lemma harnackReaction_symm (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) |
| 89 | (x : M) (u v : TangentSpace (𝓡 n) x) : |
| 90 | let b := g.orthonormalBasis x |
| 91 | 2 * (∑ k, ∑ l, D.curvatureTensor x (b k) u (b l) v * D.ricci x (b k) (b l)) - |
| 92 | (∑ k, D.ricci x u (b k) * D.ricci x (b k) v) = |
| 93 | 2 * (∑ k, ∑ l, D.curvatureTensor x (b k) v (b l) u * D.ricci x (b k) (b l)) - |
| 94 | (∑ k, D.ricci x v (b k) * D.ricci x (b k) u) := by |
| 95 | let b := g.orthonormalBasis x |
| 96 | have hs (a c : TangentSpace (𝓡 n) x) : D.ricci x a c = D.ricci x c a := |
| 97 | (hD.2.2.2.1 x a c a c).2.2.2 |
| 98 | have hRm : (∑ k, ∑ l, D.curvatureTensor x (b k) u (b l) v * |
| 99 | D.ricci x (b k) (b l)) = |
| 100 | ∑ k, ∑ l, D.curvatureTensor x (b k) v (b l) u * D.ricci x (b k) (b l) := by |
| 101 | rw [Finset.sum_comm] |
| 102 | apply Finset.sum_congr rfl |
| 103 | intro k _ |
| 104 | apply Finset.sum_congr rfl |
| 105 | intro l _ |
| 106 | rw [(hD.2.2.2.1 x (b l) u (b k) v).2.1, hs (b l) (b k)] |
| 107 | have hRic : (∑ k, D.ricci x u (b k) * D.ricci x (b k) v) = |
| 108 | ∑ k, D.ricci x v (b k) * D.ricci x (b k) u := by |
| 109 | apply Finset.sum_congr rfl |
| 110 | intro k _ |
| 111 | rw [hs u (b k), hs (b k) v, mul_comm] |
| 112 | dsimp only |
| 113 | rw [hRm, hRic] |
| 114 | |
| 115 | /-- Rewriting the curvature slots identifies the algebraic part of `M` with |
| 116 | the fixed-input Ricci evolution reaction plus one Ricci square. -/ |
| 117 | lemma hamiltonM_eq_laplacian_add_ricciReaction |
| 118 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) |
| 119 | (τ : ℝ) (x : M) (u v : TangentSpace (𝓡 n) x) : |
| 120 | hamiltonM D τ x u v = |
| 121 | D.tensorLaplacian D.ricciEvaluation x ![u, v] + D.ricciReaction x u v - |
| 122 | D.hessian D.scalarCurvature x u v / 2 + |
| 123 | (∑ k, D.ricci x u (g.orthonormalBasis x k) * |
| 124 | D.ricci x (g.orthonormalBasis x k) v) + D.ricci x u v / (2 * τ) := by |
| 125 | have hflip (a b c d : TangentSpace (𝓡 n) x) : |
| 126 | D.curvatureTensor x a b c d = D.curvatureTensor x b a d c := by |
| 127 | rw [(hD.2.2.2.1 x a b c d).2.1, (hD.2.2.2.1 x c d a b).1, |
| 128 | (hD.2.2.2.1 x c d b a).2.1, (hD.2.2.2.1 x b a c d).1, neg_neg] |
| 129 | unfold hamiltonM LeviCivitaData.ricciReaction |
| 130 | simp_rw [hflip (g.orthonormalBasis x _) u (g.orthonormalBasis x _) v] |
| 131 | ring |
| 132 | |
| 133 | /-- Hamilton's two-tensor supplies the corresponding expression for the |
| 134 | actual fixed-input time derivative of Ricci. -/ |
| 135 | lemma ricci_hasDerivWithinAt_hamiltonM |
| 136 | (hC : RicciFlowCurvatureCalculus.{u}) (J : Set ℝ) (F : RicciFlow n M J) |
| 137 | (t : ℝ) (ht : t ∈ J) (τ : ℝ) |
| 138 | (x : M) (u v : TangentSpace (𝓡 n) x) : |
| 139 | HasDerivWithinAt (fun s ↦ (F.connection s).ricci x u v) |
| 140 | (hamiltonM (F.connection t) τ x u v + |
| 141 | (F.connection t).hessian (F.connection t).scalarCurvature x u v / 2 - |
| 142 | (∑ k, (F.connection t).ricci x u ((F.metric t).orthonormalBasis x k) * |
| 143 | (F.connection t).ricci x ((F.metric t).orthonormalBasis x k) v) - |
| 144 | (F.connection t).ricci x u v / (2 * τ)) J t := by |
| 145 | apply (hC.ricci_evolution n M J F t ht x u v).congr_deriv |
| 146 | rw [hamiltonM_eq_laplacian_add_ricciReaction (F.connection t) |
| 147 | (hC.tensor_calculus n M (F.metric t) (F.connection t))] |
| 148 | ring |
| 149 | |
| 150 | /-- Joint scalar regularity supplies spatial smoothness on every time slice, |
| 151 | including an included endpoint of the flow domain. -/ |
| 152 | lemma scalarCurvature_contMDiff_slice |
| 153 | (hC : RicciFlowCurvatureCalculus.{u}) (J : Set ℝ) (F : RicciFlow n M J) |
| 154 | (t : ℝ) (ht : t ∈ J) : |
| 155 | ContMDiff (𝓡 n) (𝓘(ℝ, ℝ)) ∞ (F.connection t).scalarCurvature := by |
| 156 | have hs : ContMDiff (𝓡 n) ((𝓘(ℝ, ℝ)).prod (𝓡 n)) ∞ (fun x : M ↦ (t, x)) := |
| 157 | (contMDiff_const (I := 𝓡 n) (I' := 𝓘(ℝ, ℝ)) (c := t)).prodMk |
| 158 | (contMDiff_id (I := 𝓡 n)) |
| 159 | simpa only [Function.comp_def] using |
| 160 | (hC.scalar_regular n M J F).comp_contMDiff (f := fun x : M ↦ (t, x)) |
| 161 | hs (fun x ↦ ⟨ht, Set.mem_univ x⟩) |
| 162 | |
| 163 | /-- Symmetry of Hamilton's actual two-tensor follows from the retained |
| 164 | torsion-free connection, scalar regularity, and curvature tensor calculus. -/ |
| 165 | theorem hamiltonM_symm_of_curvatureTheory |
| 166 | (hC : RicciFlowCurvatureCalculus.{u}) (J : Set ℝ) (F : RicciFlow n M J) |
| 167 | (t : ℝ) (ht : t ∈ J) (τ : ℝ) |
| 168 | (x : M) (u v : TangentSpace (𝓡 n) x) : |
| 169 | hamiltonM (F.connection t) τ x u v = hamiltonM (F.connection t) τ x v u := by |
| 170 | have hD := hC.tensor_calculus n M (F.metric t) (F.connection t) |
| 171 | have hH := (F.connection t).hessian_symm |
| 172 | (scalarCurvature_contMDiff_slice hC J F t ht) x u v |
| 173 | unfold hamiltonM |
| 174 | dsimp only |
| 175 | rw [(F.connection t).tensorLaplacian_ricciEvaluation_symm hD x u v, hH, |
| 176 | harnackReaction_symm (F.connection t) hD x u v, |
| 177 | (hD.2.2.2.1 x u v u v).2.2.2] |
| 178 | |
| 179 | end Poincare.RicciFlow.Harnack |