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.Topology.MetricSpace.Thickening |
| 2 | import Mathlib.Topology.UniformSpace.HeineCantor |
| 3 | import Mathlib.Topology.UniformSpace.UniformConvergenceTopology |
| 4 | |
| 5 | /-! |
| 6 | # Uniform composition near a compact limiting image |
| 7 | |
| 8 | A continuous outer map is uniformly continuous on a compact neighborhood |
| 9 | of the limiting image contained in its open domain. This is the finite-jet |
| 10 | operator step in Morgan--Tian, Claim 16.6, pp. 371-372; see |
| 11 | `derivations/16-geodesic-field-convergence.md`. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter Metric |
| 17 | open scoped Topology |
| 18 | |
| 19 | /-- A continuous outer map preserves uniform convergence when the |
| 20 | limiting image is compact and lies in its open domain. Local compactness |
| 21 | supplies a common compact neighborhood for all sufficiently late images. -/ |
| 22 | theorem ContinuousOn.comp_tendstoUniformlyOn_of_compact_image |
| 23 | {P E F ι : Type*} [MetricSpace E] [LocallyCompactSpace E] [UniformSpace F] |
| 24 | {l : Filter ι} {fseq : ι → P → E} {f : P → E} {s : Set P} |
| 25 | {g : E → F} {U : Set E} (hg : ContinuousOn g U) (hU : IsOpen U) |
| 26 | (hf : IsCompact (f '' s)) (hfU : MapsTo f s U) |
| 27 | (hconv : TendstoUniformlyOn fseq f l s) : |
| 28 | TendstoUniformlyOn (fun i x => g (fseq i x)) (fun x => g (f x)) l s := by |
| 29 | obtain ⟨K, hK, hfK, hKU⟩ := exists_compact_between hf hU (image_subset_iff.mpr hfU) |
| 30 | obtain ⟨delta, hdelta, hthick⟩ := hf.exists_cthickening_subset_open isOpen_interior hfK |
| 31 | have hseqK : ∀ᶠ i in l, ∀ x ∈ s, fseq i x ∈ K := by |
| 32 | filter_upwards [Metric.tendstoUniformlyOn_iff.mp hconv delta hdelta] with i hi |
| 33 | intro x hx |
| 34 | apply interior_subset (hthick ?_) |
| 35 | exact mem_cthickening_of_dist_le (fseq i x) (f x) delta (f '' s) |
| 36 | (mem_image_of_mem f hx) (by simpa only [dist_comm] using (hi x hx).le) |
| 37 | exact (hK.uniformContinuousOn_of_continuous (hg.mono hKU)).comp_tendstoUniformlyOn_eventually |
| 38 | hseqK (fun x hx => interior_subset (hfK (mem_image_of_mem f hx))) hconv |