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.CurveShortening.Comparison.Compatibility.SourceNames |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C1.EmbeddingPushforward |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C2.GaugeWitnesses |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Mixed.EmbeddingHessian |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Retraction.TangentContinuity |
| 6 | import PoincareLib.Geometry.CurveShortening.Ramp.Data |
| 7 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 8 | import Mathlib.Topology.ContinuousMap.Compact |
| 9 | import Mathlib.Topology.Order.ProjIcc |
| 10 | |
| 11 | /-! |
| 12 | # Identifying closed limits as the actual curvature jets |
| 13 | |
| 14 | Finite C1 retraction witnesses identify the limiting spatial recurrences |
| 15 | with the actual covariant jets, including the final time endpoint. |
| 16 | MT2007 Claim 19.1, p. 437, and Lemma 19.24, pp. 454-455; |
| 17 | `2026-09-22-closed-curvature-jet-limit-identification.md`, statement 2. |
| 18 | -/ |
| 19 | |
| 20 | set_option autoImplicit false |
| 21 | set_option backward.isDefEq.respectTransparency false |
| 22 | |
| 23 | open Set |
| 24 | open scoped Manifold ContDiff Bundle |
| 25 | |
| 26 | universe u v |
| 27 | |
| 28 | namespace PoincareMT.M63 |
| 29 | |
| 30 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 31 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 32 | {ι : Type v} [Fintype ι] {a b : ℝ} |
| 33 | |
| 34 | local notation "W" => EuclideanSpace ℝ ι |
| 35 | local notation "X" => C(AddCircle curvePeriod, W) |
| 36 | |
| 37 | set_option maxHeartbeats 800000 in |
| 38 | -- Dependent tangent-fiber elaboration reached the default 200k budget. |
| 39 | /-- Actual spatial derivative witnesses identify every embedded limit |
| 40 | with the corresponding intrinsic jet and recover its C1 spatial and |
| 41 | closed bundle regularity. MT2007 Claim 19.1, p. 437; closed-jet |
| 42 | identification derivation, statement 2, including the final endpoint. -/ |
| 43 | theorem curvatureJet_identification_of_embedded_recurrences |
| 44 | [T2Space M] (F : RicciFlow n M (Icc a b)) {tau s : ℝ} |
| 45 | (_hat : a < tau) (hts : tau < s) (_hsb : s ≤ b) |
| 46 | {e : M → W} (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) |
| 47 | {U : Set W} (hU : IsOpen U) (heU : range e ⊆ U) {ρ : W → M} |
| 48 | (hρ : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ ρ U) (hρe : ∀ p, ρ (e p) = p) |
| 49 | {c : ℝ → ℝ → M} (hc : M63C2ShrinkingCurveOn F c (Icc tau s)) |
| 50 | (η : ℕ → C(Icc tau s, X)) |
| 51 | (hzero : ∀ (t : Icc tau s) (x : ℝ), η 0 t (x : AddCircle curvePeriod) = |
| 52 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (m62CurvatureVector F c t x)) |
| 53 | (hrec : ∀ i (t : Icc tau s) (x : ℝ), |
| 54 | HasDerivAt (fun y : ℝ => η i t (y : AddCircle curvePeriod)) |
| 55 | (curveSpeed F c t x • (η (i + 1) t (x : AddCircle curvePeriod) + |
| 56 | coordinateHessian (F.connection t) e (ρ (e (c x t))) |
| 57 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (e (c x t)) |
| 58 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (spatialUnitTangent F c t x))) |
| 59 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (e (c x t)) |
| 60 | (η i t (x : AddCircle curvePeriod))))) x) : |
| 61 | (∀ i (t : Icc tau s) (x : ℝ), η i t (x : AddCircle curvePeriod) = |
| 62 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (m63CurvatureJet F c i t x)) ∧ |
| 63 | (∀ i (t : Icc tau s), ContMDiff 𝓘(ℝ, ℝ) ((𝓡 n).prod (𝓡 n)) 1 |
| 64 | (fun x => (⟨c x t, m63CurvatureJet F c i t x⟩ : TangentBundle (𝓡 n) M))) ∧ |
| 65 | ∀ i, ContinuousOn |
| 66 | (fun z : ℝ × ℝ => (⟨c z.1 z.2, m63CurvatureJet F c i z.2 z.1⟩ : |
| 67 | TangentBundle (𝓡 n) M)) (univ ×ˢ Icc tau s) := by |
| 68 | let : Fact (0 < curvePeriod) := ⟨by unfold curvePeriod; positivity⟩ |
| 69 | let B := fun (t : ℝ) (z p q : W) => coordinateHessian (F.connection t) e (ρ z) |
| 70 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z p) (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z q) |
| 71 | have hpush : Continuous (fun p : TangentBundle (𝓡 n) M => |
| 72 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e p.1 p.2 : W)) := |
| 73 | (contMDiff_snd_tangentBundle_modelSpace (n := ∞) W 𝓘(ℝ, W)).continuous.comp |
| 74 | (he.continuous_tangentMap (by simp)) |
| 75 | have hvpos (t : Icc tau s) (x : ℝ) : 0 < curveSpeed F c t x := |
| 76 | Real.sqrt_pos.mpr ((F.metric t).pos _ _ (hc.immersed t t.property x)) |
| 77 | have hηcont (i : ℕ) (t : Icc tau s) : |
| 78 | Continuous (fun x : ℝ => η i t (x : AddCircle curvePeriod)) := |
| 79 | (η i t).continuous.comp (AddCircle.continuous_mk' curvePeriod) |
| 80 | have hB : ContinuousOn |
| 81 | (fun z : (ℝ × W) × (W × W) => B z.1.1 z.1.2 z.2.1 z.2.2) |
| 82 | ((Icc a b ×ˢ U) ×ˢ univ) := |
| 83 | (flow_coordinateHessian_mixed_pullback_contDiffOn F he hU hρ).continuousOn |
| 84 | have hηC1 (i : ℕ) (t : Icc tau s) : |
| 85 | ContDiff ℝ 1 (fun x : ℝ => η i t (x : AddCircle curvePeriod)) := by |
| 86 | have hbase := hc.spatial_regular t t.property |
| 87 | have hS : Continuous (fun x => (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) |
| 88 | (spatialUnitTangent F c t x) : W)) := |
| 89 | hpush.comp (unitTangent_contMDiff_of_c2 F c hbase |
| 90 | (hc.immersed t t.property)).continuous |
| 91 | let coefficientInput : ℝ → (ℝ × W) × (W × W) := fun x => ((t.1, e (c x t)), |
| 92 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (spatialUnitTangent F c t x), |
| 93 | η i t (x : AddCircle curvePeriod))) |
| 94 | have hmap : Continuous coefficientInput := |
| 95 | (continuous_const.prodMk (he.continuous.comp hbase.continuous)).prodMk |
| 96 | (hS.prodMk (hηcont i t)) |
| 97 | have hBi := hB.comp_continuous (f := coefficientInput) hmap (fun x => |
| 98 | show coefficientInput x ∈ ((Icc a b ×ˢ U) ×ˢ univ) from |
| 99 | ⟨⟨hc.domain_subset t.property, heU (mem_range_self (c x t))⟩, mem_univ _⟩) |
| 100 | have hRHS : Continuous (fun x : ℝ => curveSpeed F c t x • |
| 101 | (η (i + 1) t (x : AddCircle curvePeriod) + B t (e (c x t)) |
| 102 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (spatialUnitTangent F c t x)) |
| 103 | (η i t (x : AddCircle curvePeriod)))) := |
| 104 | (speed_contDiff_of_c2 F c hbase (hc.immersed t t.property)).continuous.smul |
| 105 | ((hηcont (i + 1) t).add hBi) |
| 106 | apply contDiff_one_iff_deriv.mpr |
| 107 | refine ⟨fun x => (hrec i t x).differentiableAt, ?_⟩ |
| 108 | have hd : deriv (fun x : ℝ => η i t (x : AddCircle curvePeriod)) = |
| 109 | fun x => curveSpeed F c t x • |
| 110 | (η (i + 1) t (x : AddCircle curvePeriod) + B t (e (c x t)) |
| 111 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (spatialUnitTangent F c t x)) |
| 112 | (η i t (x : AddCircle curvePeriod))) := |
| 113 | funext (fun x => (hrec i t x).deriv) |
| 114 | rw [hd] |
| 115 | exact hRHS |
| 116 | have hleft := (smooth_retraction_differentials he hU heU hρ hρe).2.2 |
| 117 | have hfield (i : ℕ) |
| 118 | (hi : ∀ (t : Icc tau s) (x : ℝ), η i t (x : AddCircle curvePeriod) = |
| 119 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (m63CurvatureJet F c i t x)) |
| 120 | (t : Icc tau s) : ContMDiff 𝓘(ℝ, ℝ) ((𝓡 n).prod (𝓡 n)) 1 |
| 121 | (fun x => (⟨c x t, m63CurvatureJet F c i t x⟩ : TangentBundle (𝓡 n) M)) := by |
| 122 | let T : ℝ → TangentBundle 𝓘(ℝ, W) W := |
| 123 | fun x => ⟨e (c x t), η i t (x : AddCircle curvePeriod)⟩ |
| 124 | have he1 : ContMDiff (𝓡 n) 𝓘(ℝ, W) 1 e := he.of_le (by simp) |
| 125 | have hc1 : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 1 (fun x => c x t) := |
| 126 | (hc.spatial_regular t t.property).of_le (by norm_num) |
| 127 | have hmodel : ContMDiff (𝓘(ℝ, W)).tangent (𝓘(ℝ, W)).tangent 1 |
| 128 | (fun q : W × W => (⟨q.1, q.2⟩ : TangentBundle 𝓘(ℝ, W) W)) := by |
| 129 | convert! (contMDiff_tangentBundleModelSpaceHomeomorph_symm |
| 130 | (I := 𝓘(ℝ, W)) (n := 1)) using 1 |
| 131 | rw [chartedSpaceSelf_prod] |
| 132 | rfl |
| 133 | have hT : ContMDiff 𝓘(ℝ, ℝ) (𝓘(ℝ, W)).tangent 1 T := |
| 134 | hmodel.comp ((he1.comp hc1).prodMk (hηC1 i t).contMDiff) |
| 135 | have hr := hρ.contMDiffOn_tangentMapWithin (m := 1) (by |
| 136 | change (↑(2 : ℕ∞) : WithTop ℕ∞) ≤ ↑(⊤ : ℕ∞) |
| 137 | exact WithTop.coe_le_coe.mpr le_top) hU.uniqueMDiffOn |
| 138 | have hcomp := hr.comp_contMDiff hT (fun x => heU (mem_range_self (c x t))) |
| 139 | have heq : tangentMapWithin 𝓘(ℝ, W) (𝓡 n) ρ U ∘ T = |
| 140 | fun x => (⟨c x t, m63CurvatureJet F c i t x⟩ : TangentBundle (𝓡 n) M) := by |
| 141 | funext x |
| 142 | dsimp only [Function.comp_def, T, tangentMapWithin] |
| 143 | rw [mfderivWithin_of_isOpen hU (heU (mem_range_self (c x t))), hi t x] |
| 144 | apply Bundle.TotalSpace.ext (hρe (c x t)) |
| 145 | apply heq_of_eq |
| 146 | exact hleft (c x t) (m63CurvatureJet F c i t x) |
| 147 | rw [heq] at hcomp |
| 148 | exact hcomp |
| 149 | have hscale (t : ℝ) (p : M) (Y Z : TangentSpace (𝓡 n) p) (r : ℝ) : |
| 150 | coordinateHessian (F.connection t) e p (r • Y) Z = |
| 151 | r • coordinateHessian (F.connection t) e p Y Z := by |
| 152 | ext k |
| 153 | have hek : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun q => e q k) := |
| 154 | (EuclideanSpace.proj k).contDiff.contMDiff.comp he |
| 155 | obtain ⟨A, hA⟩ := (M04.isSmoothCovariantTensor_hessian (F.connection t) hek).1 p |
| 156 | have hrep (v w : TangentSpace (𝓡 n) p) : |
| 157 | (F.connection t).hessian (fun q => e q k) p v w = A ![v, w] := hA ![v, w] |
| 158 | change (F.connection t).hessian (fun q => e q k) p (r • Y) Z = |
| 159 | r * (F.connection t).hessian (fun q => e q k) p Y Z |
| 160 | rw [hrep, hrep] |
| 161 | simpa only [Matrix.vecCons, smul_eq_mul] using A.cons_smul ![Z] r Y |
| 162 | have hident : ∀ i (t : Icc tau s) (x : ℝ), η i t (x : AddCircle curvePeriod) = |
| 163 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (m63CurvatureJet F c i t x) := by |
| 164 | intro i |
| 165 | induction i with |
| 166 | | zero => exact hzero |
| 167 | | succ i hi => |
| 168 | intro t x |
| 169 | have hvel : curveVelocity (n := n) (fun y => c y t) x = |
| 170 | curveSpeed F c t x • spatialUnitTangent F c t x := by |
| 171 | symm |
| 172 | change curveSpeed F c t x • ((curveSpeed F c t x)⁻¹ • |
| 173 | curveVelocity (n := n) (fun y => c y t) x) = _ |
| 174 | rw [smul_smul, mul_inv_cancel₀ (hvpos t x).ne', one_smul] |
| 175 | have hcov : rampHorizontalCovariantDerivative (F.connection t) (fun y => c y t) |
| 176 | (fun y => m63CurvatureJet F c i t y) x = |
| 177 | curveSpeed F c t x • m63CurvatureJet F c (i + 1) t x := by |
| 178 | change _ = curveSpeed F c t x • ((curveSpeed F c t x)⁻¹ • _) |
| 179 | rw [smul_smul, mul_inv_cancel₀ (hvpos t x).ne', one_smul] |
| 180 | have hBi : B t (e (c x t)) |
| 181 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (spatialUnitTangent F c t x)) |
| 182 | (η i t (x : AddCircle curvePeriod)) = |
| 183 | coordinateHessian (F.connection t) e (c x t) |
| 184 | (spatialUnitTangent F c t x) (m63CurvatureJet F c i t x) := by |
| 185 | dsimp only [B] |
| 186 | rw [hi t x] |
| 187 | erw [hleft (c x t) (spatialUnitTangent F c t x), |
| 188 | hleft (c x t) (m63CurvatureJet F c i t x), hρe (c x t)] |
| 189 | have hp := hasDerivAt_embedding_pushforward_of_contMDiffAt_one |
| 190 | (F.connection t) he ((hc.spatial_regular t t.property).of_le (by norm_num) x) |
| 191 | (fun y => m63CurvatureJet F c i t y) (hfield i hi t x) |
| 192 | have hp' : HasDerivAt (fun y : ℝ => η i t (y : AddCircle curvePeriod)) |
| 193 | (curveSpeed F c t x • |
| 194 | (HAdd.hAdd (α := W) (β := W) (γ := W) |
| 195 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (m63CurvatureJet F c (i + 1) t x)) |
| 196 | (B t (e (c x t)) |
| 197 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (spatialUnitTangent F c t x)) |
| 198 | (η i t (x : AddCircle curvePeriod))))) x := by |
| 199 | rw [show (fun y : ℝ => η i t (y : AddCircle curvePeriod)) = |
| 200 | (fun y => mfderiv (𝓡 n) 𝓘(ℝ, W) e (c y t) (m63CurvatureJet F c i t y)) |
| 201 | from funext (hi t)] |
| 202 | apply hp.congr_deriv |
| 203 | change HAdd.hAdd (α := W) (β := W) (γ := W) |
| 204 | (coordinateHessian (F.connection t) e (c x t) |
| 205 | (curveVelocity (n := n) (fun y => c y t) x) (m63CurvatureJet F c i t x)) |
| 206 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) |
| 207 | (rampHorizontalCovariantDerivative (F.connection t) (fun y => c y t) |
| 208 | (fun y => m63CurvatureJet F c i t y) x)) = _ |
| 209 | rw [hvel, hcov, hscale, map_smul, smul_add, hBi] |
| 210 | exact add_comm _ _ |
| 211 | have hd := congrArg (fun w : W => (curveSpeed F c t x)⁻¹ • w) |
| 212 | ((hrec i t x).unique hp') |
| 213 | simp only [smul_smul, inv_mul_cancel₀ (hvpos t x).ne', one_smul] at hd |
| 214 | exact add_right_cancel hd |
| 215 | refine ⟨hident, fun i t => hfield i (hident i) t, ?_⟩ |
| 216 | intro i |
| 217 | apply continuousOn_tangentSection_of_retraction_pushforward he hU heU hρ hρe |
| 218 | (fun z : ℝ × ℝ => c z.1 z.2) |
| 219 | (fun z => m63CurvatureJet F c i z.2 z.1) hc.continuous |
| 220 | have heval : Continuous (fun z : ℝ × ℝ => |
| 221 | η i (projIcc tau s hts.le z.2) (z.1 : AddCircle curvePeriod)) := |
| 222 | ((η i).continuous.comp (continuous_projIcc.comp continuous_snd)).eval |
| 223 | ((AddCircle.continuous_mk' curvePeriod).comp continuous_fst) |
| 224 | apply heval.continuousOn.congr |
| 225 | intro z hz |
| 226 | exact (hident i ⟨z.2, hz.2⟩ z.1).symm.trans |
| 227 | (congrArg (fun t : Icc tau s => η i t (z.1 : AddCircle curvePeriod)) |
| 228 | (projIcc_of_mem hts.le hz.2).symm) |
| 229 | |
| 230 | end PoincareMT.M63 |