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.ContMDiff.Defs |
| 2 | import Mathlib.Topology.Instances.Real.Lemmas |
| 3 | |
| 4 | /-! |
| 5 | # Smooth pasting on overlapping closed intervals |
| 6 | |
| 7 | Morgan-Tian Lemma 6.18, pp. 113-114. Actual curves agreeing on |
| 8 | a positive-width overlap paste smoothly, including the exterior |
| 9 | closed endpoints. Only relative neighborhoods are used. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped Manifold Topology |
| 16 | |
| 17 | namespace PoincareMT.M14 |
| 18 | |
| 19 | variable {E H M : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 20 | [TopologicalSpace H] (IM : ModelWithCorners ℝ E H) |
| 21 | [TopologicalSpace M] [ChartedSpace H M] |
| 22 | |
| 23 | /-- Agreement on a positive-width overlap gives a smooth pasted |
| 24 | curve on the full closed interval, including its boundary points, |
| 25 | as in the continuation argument of Lemma 6.18, pp. 113-114. -/ |
| 26 | theorem contMDiffOn_paste_closed_intervals {k : WithTop ℕ∞} {a l c r : ℝ} |
| 27 | (hlc : l < c) {f g : ℝ → M} |
| 28 | (hf : ContMDiffOn (𝓘(ℝ, ℝ)) IM k f (Icc a c)) |
| 29 | (hg : ContMDiffOn (𝓘(ℝ, ℝ)) IM k g (Icc l r)) |
| 30 | (heq : EqOn f g (Icc l c)) : |
| 31 | ContMDiffOn (𝓘(ℝ, ℝ)) IM k (fun s => if s ≤ c then f s else g s) (Icc a r) := by |
| 32 | have hleft : EqOn (fun s => if s ≤ c then f s else g s) f (Icc a c) := |
| 33 | fun s hs => if_pos hs.2 |
| 34 | have hright : EqOn (fun s => if s ≤ c then f s else g s) g (Icc l r) := by |
| 35 | intro s hs |
| 36 | by_cases hsc : s ≤ c |
| 37 | · exact (if_pos hsc).trans (heq ⟨hs.1, hsc⟩) |
| 38 | · exact if_neg hsc |
| 39 | intro s hs |
| 40 | by_cases hsc : s < c |
| 41 | · have hsold : s ∈ Icc a c := ⟨hs.1, hsc.le⟩ |
| 42 | apply ((hf s hsold).congr_of_mem hleft hsold).mono_of_mem_nhdsWithin |
| 43 | exact mem_nhdsWithin_iff_exists_mem_nhds_inter.mpr |
| 44 | ⟨Iio c, Iio_mem_nhds hsc, fun _ ht => ⟨ht.2.1, ht.1.le⟩⟩ |
| 45 | · have hcs : c ≤ s := le_of_not_gt hsc |
| 46 | have hsnew : s ∈ Icc l r := ⟨hlc.le.trans hcs, hs.2⟩ |
| 47 | apply ((hg s hsnew).congr_of_mem hright hsnew).mono_of_mem_nhdsWithin |
| 48 | exact mem_nhdsWithin_iff_exists_mem_nhds_inter.mpr |
| 49 | ⟨Ioi l, Ioi_mem_nhds (hlc.trans_le hcs), fun _ ht => ⟨ht.1.le, ht.2.2⟩⟩ |
| 50 | |
| 51 | end PoincareMT.M14 |