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.Geometry.Manifold.BumpFunction |
| 2 | import Mathlib.Geometry.Manifold.Instances.Real |
| 3 | |
| 4 | /-! # Extending a smooth scalar function near a point -/ |
| 5 | |
| 6 | set_option autoImplicit false |
| 7 | |
| 8 | open Set Filter |
| 9 | open scoped Manifold ContDiff Topology |
| 10 | |
| 11 | namespace Poincare.Manifold |
| 12 | |
| 13 | /-- A function smooth on an open set agrees near each point with a globally |
| 14 | smooth function. A bump supported in that open set gives the extension. -/ |
| 15 | theorem exists_contMDiff_eq_near |
| 16 | {n : ℕ} {M : Type*} [TopologicalSpace M] [T2Space M] |
| 17 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 18 | {f : M → ℝ} {U : Set M} (hU : IsOpen U) |
| 19 | (hf : ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ f U) {x : M} (hx : x ∈ U) : |
| 20 | ∃ F : M → ℝ, ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ F ∧ F =ᶠ[𝓝 x] f := by |
| 21 | obtain ⟨χ, _, hχU⟩ := (SmoothBumpFunction.nhds_basis_tsupport (I := 𝓡 n) x).mem_iff.mp |
| 22 | (hU.mem_nhds hx) |
| 23 | refine ⟨fun y => χ y * f y, ?_, ?_⟩ |
| 24 | · intro y |
| 25 | by_cases hy : y ∈ U |
| 26 | · exact χ.contMDiffAt.smul (hf.contMDiffAt (hU.mem_nhds hy)) |
| 27 | · apply (contMDiffAt_const (c := (0 : ℝ))).congr_of_eventuallyEq |
| 28 | have hz := notMem_tsupport_iff_eventuallyEq.mp (fun h => hy (hχU h)) |
| 29 | filter_upwards [hz] with z hz |
| 30 | simp [hz] |
| 31 | · filter_upwards [χ.eventuallyEq_one] with y hy |
| 32 | simp [hy] |
| 33 | |
| 34 | end Poincare.Manifold |