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.Ramp.LocalFlow.Unit.SpeedInitialPeriod |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 3 | |
| 4 | /-! |
| 5 | # Smooth initial arclength on the actual physical period |
| 6 | |
| 7 | The actual speed primitive and its positive derivative upgrade the |
| 8 | existing C2 arclength homeomorphism for smooth initial curves. MT2007 |
| 9 | Claim 19.1, p. 437 and Lemma 19.6, pp. 441-442; |
| 10 | `2026-09-22-smooth-unit-speed-initial-parameter.md`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set |
| 17 | open scoped Manifold ContDiff Bundle |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.M63 |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | {a b : ℝ} |
| 26 | |
| 27 | /-- A smooth immersed spatial slice has smooth actual speed for each |
| 28 | selected metric, without a time equation. MT2007 Lemma 19.6, p. 441; |
| 29 | smooth initial unit-speed parameter derivation, statement 1. -/ |
| 30 | theorem speed_contDiff_of_smooth (F : RicciFlow n M (Icc a b)) |
| 31 | (q : ℝ → ℝ → M) {t : ℝ} |
| 32 | (hspace : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) ∞ (fun x => q x t)) |
| 33 | (himm : ∀ x, curveVelocity (n := n) (fun y => q y t) x ≠ 0) : |
| 34 | ContDiff ℝ ∞ (curveSpeed F q t) := by |
| 35 | have hone : ContMDiff 𝓘(ℝ, ℝ) (𝓘(ℝ, ℝ)).tangent ∞ |
| 36 | (fun x : ℝ => (⟨x, 1⟩ : TangentBundle 𝓘(ℝ, ℝ) ℝ)) := by |
| 37 | apply contMDiff_vectorSpace_iff_contDiff.mpr |
| 38 | exact contDiff_const |
| 39 | have hX : ContMDiff 𝓘(ℝ, ℝ) ((𝓡 n).prod (𝓡 n)) ∞ |
| 40 | (fun x => (⟨q x t, curveVelocity (n := n) (fun y => q y t) x⟩ : |
| 41 | TangentBundle (𝓡 n) M)) := |
| 42 | (hspace.contMDiff_tangentMap (m := ∞) (by simp)).comp hone |
| 43 | have hpair : ContMDiff 𝓘(ℝ, ℝ) ((𝓡 n).prod 𝓘(ℝ, ℝ)) ∞ |
| 44 | (fun x => Bundle.TotalSpace.mk' ℝ (E := Bundle.Trivial M ℝ) (q x t) |
| 45 | ((F.metric t).inner (q x t) (curveVelocity (fun y => q y t) x) |
| 46 | (curveVelocity (fun y => q y t) x))) := |
| 47 | ((F.metric t).contMDiff.comp hspace).clm_bundle_apply₂ hX hX |
| 48 | have hsq : ContMDiff 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) ∞ |
| 49 | (fun x => (F.metric t).inner (q x t) (curveVelocity (fun y => q y t) x) |
| 50 | (curveVelocity (fun y => q y t) x)) := by |
| 51 | intro x |
| 52 | exact (Bundle.contMDiffAt_totalSpace.mp (hpair x)).2 |
| 53 | exact hsq.contDiff.sqrt fun x => ((F.metric t).pos _ _ (himm x)).ne' |
| 54 | |
| 55 | /-- Smooth initial data upgrade the same actual arclength witness and |
| 56 | its inverse to smooth maps, preserving every physical period and |
| 57 | unit-speed identity. MT2007 Claim 19.1, p. 437 and Lemma 19.6, |
| 58 | pp. 441-442; smooth initial unit-speed parameter, statement 2. -/ |
| 59 | theorem exists_smooth_unit_speed_parameter (F : RicciFlow n M (Icc a b)) |
| 60 | (gamma : ℝ → M) (t : ℝ) (hperiod : Function.Periodic gamma curvePeriod) |
| 61 | (hgamma : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) ∞ gamma) |
| 62 | (himm : ∀ x, curveVelocity (n := n) gamma x ≠ 0) : |
| 63 | let v := curveSpeed F (fun x _ => gamma x) t |
| 64 | let ell := ∫ x in (0 : ℝ)..curvePeriod, v x |
| 65 | 0 < ell ∧ ∃ sigma : ℝ ≃ₜ ℝ, |
| 66 | (∀ x, sigma x = ∫ y in (0 : ℝ)..x, v y) ∧ |
| 67 | ContDiff ℝ ∞ (sigma : ℝ → ℝ) ∧ ContDiff ℝ ∞ (sigma.symm : ℝ → ℝ) ∧ |
| 68 | sigma 0 = 0 ∧ (∀ x, 0 < deriv sigma x) ∧ (∀ y, 0 < deriv sigma.symm y) ∧ |
| 69 | (∀ x, sigma (x + curvePeriod) = sigma x + ell) ∧ |
| 70 | (∀ y, sigma.symm (y + ell) = sigma.symm y + curvePeriod) ∧ |
| 71 | Function.Periodic (fun y => gamma (sigma.symm y)) ell ∧ |
| 72 | ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) ∞ (fun y => gamma (sigma.symm y)) ∧ |
| 73 | (∀ y, curveVelocity (n := n) (fun z => gamma (sigma.symm z)) y ≠ 0) ∧ |
| 74 | (∀ y, curveSpeed F (fun z _ => gamma (sigma.symm z)) t y = 1) ∧ |
| 75 | (∀ y, (curveSpeed F (fun z _ => gamma (sigma.symm z)) t y ^ 2)⁻¹ = 1) ∧ |
| 76 | ∀ x, gamma (sigma.symm (sigma x)) = gamma x := by |
| 77 | let v := curveSpeed F (fun x _ => gamma x) t |
| 78 | obtain ⟨hell, sigma, hformula, hsigma, _hinv, hzero, hpos, hinvpos, hshift, |
| 79 | hinvshift, hper, _hreg, himm', hunit, hprincipal, hrecovery⟩ := |
| 80 | exists_c2_unit_speed_parameter F gamma t hperiod |
| 81 | (hgamma.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)) himm |
| 82 | have hv : ContDiff ℝ ∞ v := |
| 83 | speed_contDiff_of_smooth F (fun x _ => gamma x) hgamma himm |
| 84 | have hd (x : ℝ) : HasDerivAt sigma (v x) x := by |
| 85 | have hprimitive : (sigma : ℝ → ℝ) = fun x => ∫ y in (0 : ℝ)..x, v y := |
| 86 | funext hformula |
| 87 | rw [hprimitive] |
| 88 | exact intervalIntegral.integral_hasDerivAt_right |
| 89 | (hv.continuous.intervalIntegrable 0 x) (hv.continuous.stronglyMeasurableAtFilter _ _) |
| 90 | hv.continuous.continuousAt |
| 91 | have hderiv : deriv sigma = v := funext fun x => (hd x).deriv |
| 92 | have hsmooth : ContDiff ℝ ∞ (sigma : ℝ → ℝ) := |
| 93 | contDiff_infty_iff_deriv.mpr |
| 94 | ⟨hsigma.differentiable (by norm_num), hderiv ▸ hv⟩ |
| 95 | have hinvsmooth : ContDiff ℝ ∞ (sigma.symm : ℝ → ℝ) := |
| 96 | sigma.contDiff_symm_deriv (fun x => by simpa only [← hderiv] using (hpos x).ne') |
| 97 | hd hsmooth |
| 98 | exact ⟨hell, sigma, hformula, hsmooth, hinvsmooth, hzero, hpos, hinvpos, hshift, |
| 99 | hinvshift, hper, hgamma.comp hinvsmooth.contMDiff, himm', hunit, hprincipal, hrecovery⟩ |
| 100 | |
| 101 | end PoincareMT.M63 |