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.AnnularEvolution.Finite.ParameterJets |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Modulus.MovingMetricDerivative |
| 3 | |
| 4 | /-! The genuine moving-metric derivative for a C1 parameter map. |
| 5 | An affine parameter replacement preserves every time-dependent first |
| 6 | jet at the given source point. Source: MT Lemma 19.15, pp. 447-449; |
| 7 | finite-conormal-variation derivation. -/ |
| 8 | |
| 9 | noncomputable section |
| 10 | set_option autoImplicit false |
| 11 | set_option warningAsError true |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped Manifold ContDiff Topology |
| 16 | |
| 17 | namespace PoincareMT |
| 18 | |
| 19 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 20 | {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 22 | {a b : ℝ} |
| 23 | |
| 24 | /-- The actual moving metric contributes precisely the two weighted Ricci contractions, even |
| 25 | for a merely differentiable parameter map. Source: Morgan--Tian (2007), Lemma 19.15 and |
| 26 | Corollary 19.16, pp. 447-449; project derivation |
| 27 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 28 | theorem m64ParameterAnnulus_moving_metric_energy_hasDerivAt |
| 29 | (F : RicciFlow n M (Icc a b)) (r : ℝ) {t : ℝ} (ht : t ∈ Ioo a b) |
| 30 | {Phi : ℝ × E → M} {O : Set (ℝ × E)} (hO : IsOpen O) |
| 31 | (hPhi : ContMDiffOn 𝓘(ℝ, ℝ × E) (𝓡 n) ∞ Phi O) |
| 32 | {h : LoopPlane → E} {p : LoopPlane} (hh : DifferentiableAt ℝ h p) |
| 33 | (hp : (0, h p) ∈ O) : |
| 34 | let v := fun s q => Phi (s, h q) |
| 35 | let d := mfderiv (𝓡 2) (𝓡 n) (v 0) p |
| 36 | HasDerivAt (fun s => m64ModulusEnergyDensity (F.metric (t + s)) r (v s) p) |
| 37 | (deriv (fun s => m64ModulusEnergyDensity (F.metric t) r (v s) p) 0 - |
| 38 | r * (F.connection t).ricci (v 0 p) |
| 39 | (d (EuclideanSpace.basisFun (Fin 2) ℝ 0)) |
| 40 | (d (EuclideanSpace.basisFun (Fin 2) ℝ 0)) - |
| 41 | r⁻¹ * (F.connection t).ricci (v 0 p) |
| 42 | (d (EuclideanSpace.basisFun (Fin 2) ℝ 1)) |
| 43 | (d (EuclideanSpace.basisFun (Fin 2) ℝ 1))) 0 := by |
| 44 | let H := fun q : LoopPlane => h p + fderiv ℝ h p (q - p) |
| 45 | have hHp : H p = h p := by simp [H] |
| 46 | have hH : HasFDerivAt H (fderiv ℝ h p) p := by |
| 47 | simpa only [H, ContinuousLinearMap.comp_id, Function.comp_def, id_eq] using! |
| 48 | (((fderiv ℝ h p).hasFDerivAt.comp p ((hasFDerivAt_id p).sub_const p)).const_add (h p)) |
| 49 | have hHs : ContDiff ℝ ∞ H := by dsimp only [H]; fun_prop |
| 50 | let v := fun s q => Phi (s, h q) |
| 51 | let w := fun s q => Phi (s, H q) |
| 52 | have hproxy : ContMDiffAt 𝓘(ℝ, ℝ × LoopPlane) (𝓡 n) ∞ |
| 53 | (fun q => w q.1 q.2) (0, p) := by |
| 54 | have heq : ((0 : ℝ), H p) = (0, h p) := Prod.ext rfl hHp |
| 55 | exact (heq.symm ▸ hPhi.contMDiffAt (hO.mem_nhds hp)).comp (0, p) |
| 56 | ((contDiffAt_fst.prodMk (hHs.contDiffAt.comp (0, p) contDiffAt_snd)).contMDiffAt) |
| 57 | have hnear : ∀ᶠ s in 𝓝 (0 : ℝ), (s, h p) ∈ O := |
| 58 | (continuous_id.prodMk continuous_const).continuousAt (hO.mem_nhds hp) |
| 59 | have heq (g : RiemannianMetric n M) (s : ℝ) (hs : (s, h p) ∈ O) : |
| 60 | m64ModulusEnergyDensity g r (v s) p = m64ModulusEnergyDensity g r (w s) p := |
| 61 | m64ParameterAnnulus_energy_eq_of_firstJet g r |
| 62 | ((hPhi.contMDiffAt (hO.mem_nhds hs)).mdifferentiableAt (by simp)) |
| 63 | hh hH.differentiableAt hHp.symm hH.fderiv.symm |
| 64 | have hfixed : (fun s => m64ModulusEnergyDensity (F.metric t) r (v s) p) =ᶠ[𝓝 0] |
| 65 | fun s => m64ModulusEnergyDensity (F.metric t) r (w s) p := |
| 66 | hnear.mono fun s hs => heq (F.metric t) s hs |
| 67 | have hmove : (fun s => m64ModulusEnergyDensity (F.metric (t + s)) r (v s) p) =ᶠ[𝓝 0] |
| 68 | fun s => m64ModulusEnergyDensity (F.metric (t + s)) r (w s) p := |
| 69 | hnear.mono fun s hs => heq (F.metric (t + s)) s hs |
| 70 | have hcol (d : LoopPlane) : mfderiv (𝓡 2) (𝓡 n) (w 0) p d = |
| 71 | mfderiv (𝓡 2) (𝓡 n) (v 0) p d := |
| 72 | (m64ParameterAnnulus_differential_eq_of_firstJet |
| 73 | ((hPhi.contMDiffAt (hO.mem_nhds hp)).mdifferentiableAt (by simp)) |
| 74 | hh hH.differentiableAt hHp.symm hH.fderiv.symm d).symm |
| 75 | have hric (i : Fin 2) : |
| 76 | (F.connection t).ricci (w 0 p) |
| 77 | (mfderiv (𝓡 2) (𝓡 n) (w 0) p (EuclideanSpace.basisFun (Fin 2) ℝ i)) |
| 78 | (mfderiv (𝓡 2) (𝓡 n) (w 0) p (EuclideanSpace.basisFun (Fin 2) ℝ i)) = |
| 79 | (F.connection t).ricci (v 0 p) |
| 80 | (mfderiv (𝓡 2) (𝓡 n) (v 0) p (EuclideanSpace.basisFun (Fin 2) ℝ i)) |
| 81 | (mfderiv (𝓡 2) (𝓡 n) (v 0) p (EuclideanSpace.basisFun (Fin 2) ℝ i)) := by |
| 82 | have hdata : (w 0 p, |
| 83 | (mfderiv (𝓡 2) (𝓡 n) (w 0) p (EuclideanSpace.basisFun (Fin 2) ℝ i) : |
| 84 | EuclideanSpace ℝ (Fin n))) = |
| 85 | (v 0 p, |
| 86 | (mfderiv (𝓡 2) (𝓡 n) (v 0) p (EuclideanSpace.basisFun (Fin 2) ℝ i) : |
| 87 | EuclideanSpace ℝ (Fin n))) := |
| 88 | Prod.ext (congrArg (fun q => Phi (0, q)) hHp) (hcol _) |
| 89 | exact congrArg (fun q : M × EuclideanSpace ℝ (Fin n) => |
| 90 | (F.connection t).ricci q.1 q.2 q.2) hdata |
| 91 | have hd := m64ModulusAnnulus_moving_metric_energy_hasDerivAt F r ht p hproxy |
| 92 | apply (hd.congr_of_eventuallyEq hmove).congr_deriv |
| 93 | change deriv (fun s => m64ModulusEnergyDensity (F.metric t) r (w s) p) 0 - |
| 94 | r * (F.connection t).ricci (w 0 p) |
| 95 | (mfderiv (𝓡 2) (𝓡 n) (w 0) p (EuclideanSpace.basisFun (Fin 2) ℝ 0)) |
| 96 | (mfderiv (𝓡 2) (𝓡 n) (w 0) p (EuclideanSpace.basisFun (Fin 2) ℝ 0)) - |
| 97 | r⁻¹ * (F.connection t).ricci (w 0 p) |
| 98 | (mfderiv (𝓡 2) (𝓡 n) (w 0) p (EuclideanSpace.basisFun (Fin 2) ℝ 1)) |
| 99 | (mfderiv (𝓡 2) (𝓡 n) (w 0) p (EuclideanSpace.basisFun (Fin 2) ℝ 1)) = _ |
| 100 | rw [hric 0, hric 1, ← hfixed.deriv_eq] |
| 101 | |
| 102 | end PoincareMT |