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 Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 2 | import Mathlib.Analysis.Convex.Topology |
| 3 | import Mathlib.Topology.Separation.Basic |
| 4 | |
| 5 | /-! |
| 6 | # Extend a scalar-time estimate across finitely many exceptional times |
| 7 | |
| 8 | A strict scalar threshold gives a neighborhood on which the ordinary |
| 9 | estimate applies. Continuity of the within-derivative then extends it to |
| 10 | included exceptional times and interval endpoints. This is the elementary |
| 11 | time-calculus step in the M48 use of Assumptions 11.18. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Topology ContDiff |
| 18 | |
| 19 | namespace PoincareMT.M48 |
| 20 | |
| 21 | theorem time_estimate_extend {J E : Set ℝ} {f : ℝ → ℝ} {q A : ℝ} |
| 22 | (hJ : Convex ℝ J) (hne : J.Nontrivial) (hE : E.Finite) |
| 23 | (hf : ContDiffOn ℝ ∞ f J) |
| 24 | (ordinary : ∀ s ∈ interior J \ E, q < f s → |
| 25 | ∃ d, HasDerivAt f d s ∧ |d| ≤ A * f s ^ 2) |
| 26 | (t : ℝ) (ht : t ∈ J) (hq : q < f t) : |
| 27 | ∃ d, HasDerivWithinAt f d J t ∧ |d| ≤ A * f t ^ 2 := by |
| 28 | have hi : (interior J).Nonempty := hJ.nontrivial_iff_nonempty_interior.mp hne |
| 29 | have hu : UniqueDiffOn ℝ J := uniqueDiffOn_convex hJ hi |
| 30 | let U := interior J \ E |
| 31 | have hUJ : U ⊆ J := fun _ hs => interior_subset hs.1 |
| 32 | have hdense : J ⊆ closure U := by |
| 33 | have hEc : Dense Eᶜ := by |
| 34 | simpa only [sdiff_eq, univ_inter] using |
| 35 | (dense_univ : Dense (univ : Set ℝ)).sdiff_finite hE |
| 36 | have hsub : interior J ⊆ closure U := |
| 37 | hEc.open_subset_closure_inter isOpen_interior |
| 38 | have hclose : closure (interior J) ⊆ closure U := |
| 39 | closure_minimal hsub isClosed_closure |
| 40 | rw [hJ.closure_interior_eq_closure_of_nonempty_interior hi] at hclose |
| 41 | exact subset_closure.trans hclose |
| 42 | have : NeBot (𝓝[U] t) := mem_closure_iff_nhdsWithin_neBot.mp (hdense ht) |
| 43 | have hc := (hf.continuousOn t ht).mono hUJ |
| 44 | have hd := (hf.continuousOn_derivWithin hu (by simp) t ht).mono hUJ |
| 45 | refine ⟨derivWithin f J t, ((hf t ht).differentiableWithinAt (by simp)).hasDerivWithinAt, ?_⟩ |
| 46 | apply le_of_tendsto_of_tendsto hd.abs (continuousWithinAt_const.mul (hc.pow 2)) |
| 47 | have hhigh : ∀ᶠ s in 𝓝[U] t, q < f s := hc.eventually (Ioi_mem_nhds hq) |
| 48 | filter_upwards [self_mem_nhdsWithin, hhigh] with s hs hqs |
| 49 | obtain ⟨d, hd, hb⟩ := ordinary s hs hqs |
| 50 | change |derivWithin f J s| ≤ A * f s ^ 2 |
| 51 | simpa only [hd.hasDerivWithinAt.derivWithin (hu s (hUJ hs))] using hb |
| 52 | |
| 53 | end PoincareMT.M48 |