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.Tensors |
| 2 | import PoincareLib.Geometry.Riemannian.Tensor.Linearity |
| 3 | import PoincareLib.Geometry.Riemannian.Hessian.Tensor |
| 4 | import PoincareLib.Geometry.RicciFlow.Connection.Variation |
| 5 | import PoincareLib.Geometry.RicciFlow.Curvature.Regularity |
| 6 | |
| 7 | /-! |
| 8 | # Covariant derivatives of Hamilton's tensors |
| 9 | |
| 10 | Antisymmetrization of the actual covariant Ricci derivative commutes with |
| 11 | another covariant derivative. The new derivative input is retained first, |
| 12 | including its connection correction in subsequent differentiations. |
| 13 | |
| 14 | The retained connection has a checked operator time derivative with the |
| 15 | Christoffel variation formula. This uses the original curvature theory's |
| 16 | tensor calculus. Hamilton's full P/M evolution remains a further calculation. |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | |
| 21 | open scoped Manifold ContDiff Bundle BigOperators |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace Poincare.RicciFlow.Harnack |
| 26 | |
| 27 | open PoincareMT |
| 28 | |
| 29 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 30 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 31 | {g : RiemannianMetric n M} {J : Set ℝ} |
| 32 | |
| 33 | /-- The fixed-input metric time derivative from the frozen Ricci flow equation. -/ |
| 34 | lemma metric_inner_hasDerivWithinAt_ricci |
| 35 | (F : RicciFlow n M J) (t : ℝ) (ht : t ∈ J) |
| 36 | (x : M) (u v : TangentSpace (𝓡 n) x) : |
| 37 | HasDerivWithinAt (fun s ↦ (F.metric s).inner x u v) |
| 38 | (-2 * (F.connection t).ricci x u v) J t := by |
| 39 | exact F.equation t ht x u v |
| 40 | |
| 41 | /-- Time differentiation of the raw Hamilton-P expression on fixed local |
| 42 | fields. The antisymmetrization exchanges the derivative direction and the |
| 43 | first Ricci input, while retaining the last Ricci input. -/ |
| 44 | lemma hasDerivAt_hamiltonP_raw |
| 45 | (hC : RicciFlowCurvatureTheory.{u}) (F : RicciFlow n M J) |
| 46 | {t : ℝ} (ht : t ∈ interior J) {x : M} |
| 47 | {X Y Z : (y : M) → TangentSpace (𝓡 n) y} |
| 48 | (hX : ContMDiffAt (𝓡 n) |
| 49 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% X) x) |
| 50 | (hY : ContMDiffAt (𝓡 n) |
| 51 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Y) x) |
| 52 | (hZ : ContMDiffAt (𝓡 n) |
| 53 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Z) x) : |
| 54 | HasDerivAt |
| 55 | (fun s => mvfderiv (𝓡 n) |
| 56 | (fun y => (F.connection s).ricci y (Y y) (Z y)) x (X x) - |
| 57 | mvfderiv (𝓡 n) |
| 58 | (fun y => (F.connection s).ricci y (X y) (Z y)) x (Y x)) |
| 59 | (mvfderiv (𝓡 n) (fun y => |
| 60 | (F.connection t).tensorLaplacian (F.connection t).ricciEvaluation y |
| 61 | ![Y y, Z y] + (F.connection t).ricciReaction y (Y y) (Z y)) x (X x) - |
| 62 | mvfderiv (𝓡 n) (fun y => |
| 63 | (F.connection t).tensorLaplacian (F.connection t).ricciEvaluation y |
| 64 | ![X y, Z y] + (F.connection t).ricciReaction y (X y) (Z y)) x (Y x)) t := by |
| 65 | exact (PoincareMT.RicciFlow.hasDerivAt_mvfderiv_ricci_fields |
| 66 | hC F ht hY hZ (X x)).sub |
| 67 | (PoincareMT.RicciFlow.hasDerivAt_mvfderiv_ricci_fields |
| 68 | hC F ht hX hZ (Y x)) |
| 69 | |
| 70 | /-- The raw Hamilton-P expression differs from the covariant tensor by the |
| 71 | four connection corrections for its two Ricci evaluations. -/ |
| 72 | lemma hamiltonP_eq_raw_sub_connection |
| 73 | (D : LeviCivitaData g) (x : M) (u v w : TangentSpace (𝓡 n) x) : |
| 74 | let X := fun a : TangentSpace (𝓡 n) x => |
| 75 | FiberBundle.extend (EuclideanSpace ℝ (Fin n)) a |
| 76 | hamiltonP D x u v w = |
| 77 | (mvfderiv (𝓡 n) (fun y => D.ricci y (X v y) (X w y)) x u - |
| 78 | mvfderiv (𝓡 n) (fun y => D.ricci y (X u y) (X w y)) x v) - |
| 79 | (D.ricci x (D.connection (X v) x u) w + |
| 80 | D.ricci x v (D.connection (X w) x u)) + |
| 81 | (D.ricci x (D.connection (X u) x v) w + |
| 82 | D.ricci x u (D.connection (X w) x v)) := by |
| 83 | simp [hamiltonP, LeviCivitaData.covariantTensorDerivative, |
| 84 | LeviCivitaData.ricciEvaluation, Fin.sum_univ_two] |
| 85 | ring |
| 86 | |
| 87 | /-- The connection variation used in Hamilton tensor evolution, supplied by |
| 88 | the frozen curvature theory and the original Ricci flow. -/ |
| 89 | lemma connection_hasDerivAt_ricci |
| 90 | (hC : RicciFlowCurvatureTheory.{u}) (F : RicciFlow n M J) |
| 91 | {t : ℝ} (ht : t ∈ interior J) (x : M) (v : TangentSpace (𝓡 n) x) : |
| 92 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 93 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 94 | ∃ A : TangentSpace (𝓡 n) x →L[ℝ] TangentSpace (𝓡 n) x, |
| 95 | HasDerivAt (fun s => (F.connection s).connection |
| 96 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) v) x) A t ∧ |
| 97 | ∀ u w : TangentSpace (𝓡 n) x, |
| 98 | (F.metric t).inner x (A u) w = |
| 99 | -(F.connection t).covariantTensorDerivative (F.connection t).ricciEvaluation x ![u, v, w] - |
| 100 | (F.connection t).covariantTensorDerivative (F.connection t).ricciEvaluation x ![v, u, w] + |
| 101 | (F.connection t).covariantTensorDerivative (F.connection t).ricciEvaluation x ![w, u, v] := |
| 102 | F.connection_hasDerivAt_ricci ht |
| 103 | (hC.tensor_calculus n M (F.metric t) (F.connection t)) x v |
| 104 | |
| 105 | /-- The derivative of Hamilton's three-tensor is the indicated |
| 106 | antisymmetrization of the second covariant Ricci derivative. -/ |
| 107 | lemma covariantTensorDerivative_hamiltonP |
| 108 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) |
| 109 | (x : M) (a u v w : TangentSpace (𝓡 n) x) : |
| 110 | D.covariantTensorDerivative |
| 111 | (fun y z ↦ hamiltonP D y (z 0) (z 1) (z 2)) x ![a, u, v, w] = |
| 112 | D.covariantTensorDerivative (D.covariantTensorDerivative D.ricciEvaluation) |
| 113 | x ![a, u, v, w] - |
| 114 | D.covariantTensorDerivative (D.covariantTensorDerivative D.ricciEvaluation) |
| 115 | x ![a, v, u, w] := by |
| 116 | have hA := hD.2.2.1 2 D.ricciEvaluation hD.2.1 |
| 117 | have hp : (fun y (z : Fin 3 → TangentSpace (𝓡 n) y) ↦ |
| 118 | hamiltonP D y (z 0) (z 1) (z 2)) = |
| 119 | (fun y z ↦ D.covariantTensorDerivative D.ricciEvaluation y z - |
| 120 | D.covariantTensorDerivative D.ricciEvaluation y (z ∘ Equiv.swap 0 1)) := by |
| 121 | funext y z |
| 122 | have he : ![z 0, z 1, z 2] = z := by |
| 123 | ext i |
| 124 | fin_cases i <;> rfl |
| 125 | have hs : ![z 1, z 0, z 2] = z ∘ Equiv.swap 0 1 := by |
| 126 | ext i |
| 127 | fin_cases i <;> simp [Equiv.swap_apply_def] |
| 128 | simp only [hamiltonP, he, hs] |
| 129 | rw [hp, D.covariantTensorDerivative_sub hA (hA.perm (Equiv.swap 0 1))] |
| 130 | dsimp only |
| 131 | rw [D.covariantTensorDerivative_reindex (D.covariantTensorDerivative D.ricciEvaluation) |
| 132 | (Equiv.swap 0 1) x ![a, u, v, w]] |
| 133 | congr 2 |
| 134 | ext i |
| 135 | fin_cases i <;> simp [Equiv.swap_apply_def] <;> rfl |
| 136 | |
| 137 | end Poincare.RicciFlow.Harnack |