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.Analysis.Immersed.CurveComposition |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.RCLike |
| 3 | |
| 4 | /-! Recover the original parameter from a C1 immersed curve, within |
| 5 | a closed source set. Source: MT Lemma 19.15; M64 classical-label |
| 6 | attainment derivation. This is the relative version of the M63 |
| 7 | scalar inverse argument. -/ |
| 8 | |
| 9 | noncomputable section |
| 10 | set_option autoImplicit false |
| 11 | set_option warningAsError true |
| 12 | |
| 13 | open Set Filter |
| 14 | open scoped Topology ContDiff NNReal |
| 15 | |
| 16 | namespace PoincareMT |
| 17 | |
| 18 | variable {A E : Type*} [NormedAddCommGroup A] [NormedSpace ℝ A] |
| 19 | [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 20 | |
| 21 | /-- The original continuous parameter inherits finite regularity within its source set from |
| 22 | its composition with a regular curve. Source: MT Lemma 19.15, pp. 447-449; |
| 23 | derivations/2026-09-26-classical-label-attainment.md. -/ |
| 24 | theorem m64ContDiffWithinAt_of_comp_immersed_curve |
| 25 | {k : WithTop ℕ∞} (hk : k ≠ 0) {phi : A → ℝ} {f : ℝ → E} |
| 26 | {S : Set A} {x : A} (hx : x ∈ S) |
| 27 | (hphi : ContinuousWithinAt phi S x) (hf : ContDiffAt ℝ k f (phi x)) |
| 28 | (hder : deriv f (phi x) ≠ 0) (hcomp : ContDiffWithinAt ℝ k (f ∘ phi) S x) : |
| 29 | ContDiffWithinAt ℝ k phi S x := by |
| 30 | let ell : E →L[ℝ] ℝ := innerSL ℝ (deriv f (phi x)) |
| 31 | let g : ℝ → ℝ := fun y => ell (f y) |
| 32 | have hg : ContDiffAt ℝ k g (phi x) := ell.contDiff.contDiffAt.comp (phi x) hf |
| 33 | have hd : HasDerivAt g (ell (deriv f (phi x))) (phi x) := |
| 34 | ell.hasFDerivAt.comp_hasDerivAt (phi x) ((hf.differentiableAt hk).hasDerivAt) |
| 35 | have hne : ell (deriv f (phi x)) ≠ 0 := inner_self_ne_zero.mpr hder |
| 36 | have hge := hd.hasFDerivAt_equiv hne |
| 37 | have hscalar : ContDiffWithinAt ℝ k (fun z => g (phi z)) S x := |
| 38 | ell.contDiff.contDiffAt.comp_contDiffWithinAt x hcomp |
| 39 | have hleft : ∀ᶠ y in 𝓝 (phi x), hg.localInverse hge hk (g y) = y := |
| 40 | (hg.hasStrictFDerivAt' hge hk).eventually_left_inverse |
| 41 | have heq : (fun z => hg.localInverse hge hk (g (phi z))) =ᶠ[𝓝[S] x] phi := |
| 42 | hphi.eventually hleft |
| 43 | have hregular := (hg.to_localInverse hge hk).comp_contDiffWithinAt x hscalar |
| 44 | exact hregular.congr_of_eventuallyEq_of_mem heq.symm hx |
| 45 | |
| 46 | /-- A continuous label whose regular-curve trace is C1 on a compact interval is Lipschitz on |
| 47 | that same interval. Source: MT Lemma 19.15, pp. 447-449; |
| 48 | derivations/2026-09-26-classical-label-attainment.md. -/ |
| 49 | theorem m64Label_lipschitzOn_of_regular_trace |
| 50 | {phi : ℝ → ℝ} {f : ℝ → E} {a b : ℝ} |
| 51 | (hphi : ContinuousOn phi (Icc a b)) (hf : ContDiff ℝ 1 f) |
| 52 | (hder : ∀ t, deriv f t ≠ 0) (hcomp : ContDiffOn ℝ 1 (f ∘ phi) (Icc a b)) : |
| 53 | ∃ K : ℝ≥0, LipschitzOnWith K phi (Icc a b) := by |
| 54 | have hC1 : ContDiffOn ℝ 1 phi (Icc a b) := fun x hx => |
| 55 | m64ContDiffWithinAt_of_comp_immersed_curve one_ne_zero hx (hphi x hx) |
| 56 | hf.contDiffAt (hder (phi x)) (hcomp x hx) |
| 57 | exact hC1.exists_lipschitzOnWith one_ne_zero (convex_Icc a b) isCompact_Icc |
| 58 | |
| 59 | end PoincareMT |