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.Harnack.Regularity |
| 3 | import Mathlib.Geometry.Manifold.MFDeriv.NormedSpace |
| 4 | |
| 5 | /-! |
| 6 | # Scalar curvature along manifold paths |
| 7 | |
| 8 | The spacetime chain rule splits the derivative along a path into its time |
| 9 | derivative and spatial differential. For scalar curvature, joint smoothness |
| 10 | is supplied by `RicciFlowCurvatureCalculus.scalar_regular`; only interior |
| 11 | times require ambient derivatives. |
| 12 | |
| 13 | These are calculus lemmas supporting the differentiation along a spacetime |
| 14 | path in the proof of Morgan--Tian, Theorem 4.40, not the Harnack inequality |
| 15 | itself. Reference: *Ricci Flow and the Poincare Conjecture*, arXiv:math/0607607v2 |
| 16 | (2007), Chapter 4, Section 5.2, proof of Theorem 4.40, p. 106. |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | |
| 21 | open Set |
| 22 | open scoped Manifold ContDiff Bundle |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | namespace Poincare.Geometry.RicciFlow.Harnack |
| 27 | |
| 28 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 30 | [IsManifold (𝓡 n) ∞ M] |
| 31 | |
| 32 | omit [IsManifold (𝓡 n) ∞ M] in |
| 33 | set_option backward.isDefEq.respectTransparency false in |
| 34 | theorem hasDerivAt_comp_manifold_spacetimePath |
| 35 | {f : ℝ × M → ℝ} {γ : ℝ → M} {t : ℝ} |
| 36 | (hf : MDifferentiableAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓘(ℝ, ℝ)) f (t, γ t)) |
| 37 | (hγ : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) γ t) : |
| 38 | HasDerivAt (fun s ↦ f (s, γ s)) |
| 39 | (deriv (fun s ↦ f (s, γ t)) t + |
| 40 | mvfderiv (𝓡 n) (fun x ↦ f (t, x)) (γ t) |
| 41 | (mfderiv (𝓘(ℝ, ℝ)) (𝓡 n) γ t 1)) t := by |
| 42 | have hpath := (hasMFDerivAt_id (I := 𝓘(ℝ, ℝ)) t).prodMk hγ.hasMFDerivAt |
| 43 | have h := (hf.hasMFDerivAt.comp t hpath).hasFDerivAt.hasDerivAt |
| 44 | change HasDerivAt (fun s ↦ f (s, γ s)) |
| 45 | (mfderiv ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓘(ℝ, ℝ)) f (t, γ t) |
| 46 | (1, mfderiv (𝓘(ℝ, ℝ)) (𝓡 n) γ t 1)) t at h |
| 47 | rw [mfderiv_prod_eq_add_apply hf] at h |
| 48 | simpa only [mfderiv_eq_fderiv, fderiv_apply_one_eq_deriv, mvfderiv, |
| 49 | ContinuousLinearMap.comp_apply] using! h |
| 50 | |
| 51 | theorem scalarCurvature_hasDerivAt_path |
| 52 | {J : Set ℝ} (hM04 : PoincareMT.RicciFlowCurvatureCalculus.{u}) |
| 53 | (F : PoincareMT.RicciFlow n M J) {a b : ℝ} |
| 54 | (hJ : Icc a b ⊆ J) (γ : ℝ → M) |
| 55 | (hγ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) 1 γ (Icc a b)) |
| 56 | {t : ℝ} (ht : t ∈ Ioo a b) : |
| 57 | HasDerivAt (fun s ↦ (F.connection s).scalarCurvature (γ s)) |
| 58 | (deriv (fun s ↦ (F.connection s).scalarCurvature (γ t)) t + |
| 59 | mvfderiv (𝓡 n) (F.connection t).scalarCurvature (γ t) |
| 60 | (mfderiv (𝓘(ℝ, ℝ)) (𝓡 n) γ t 1)) t := by |
| 61 | have hJnhds : J ∈ nhds t := Filter.mem_of_superset (Icc_mem_nhds ht.1 ht.2) hJ |
| 62 | apply hasDerivAt_comp_manifold_spacetimePath |
| 63 | (f := fun p : ℝ × M ↦ (F.connection p.1).scalarCurvature p.2) (γ := γ) |
| 64 | · exact ((hM04.scalar_regular n M J F).mdifferentiableOn (by simp) |
| 65 | (t, γ t) ⟨hJ (Ioo_subset_Icc_self ht), mem_univ _⟩).mdifferentiableAt |
| 66 | (prod_mem_nhds hJnhds Filter.univ_mem) |
| 67 | · exact (hγ.mdifferentiableOn (by simp) t (Ioo_subset_Icc_self ht)).mdifferentiableAt |
| 68 | (Icc_mem_nhds ht.1 ht.2) |
| 69 | |
| 70 | end Poincare.Geometry.RicciFlow.Harnack |