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 | |
| 4 | /-! |
| 5 | # Uniform local control near a compact set |
| 6 | |
| 7 | The compact form of continuity controls points near, rather than only in, |
| 8 | the compact set. This is used to keep coordinate replacements in their |
| 9 | chart and to bound their error in the manifold. Source: the finite-chart |
| 10 | approximation derivation for MT Claim 18.16, printed p. 430. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set Metric |
| 16 | open scoped Topology |
| 17 | |
| 18 | namespace PoincareMT.Proofs.M59 |
| 19 | |
| 20 | /-- Near a compact set in an open domain, one radius controls membership |
| 21 | and the change in the mapped value. Source: MT Claim 18.16, p. 430, |
| 22 | finite-chart approximation derivation. -/ |
| 23 | theorem exists_uniform_compact_map_control |
| 24 | {A B : Type*} [PseudoMetricSpace A] [PseudoMetricSpace B] |
| 25 | (f : A → B) {S U : Set A} (hS : IsCompact S) (hU : IsOpen U) (hSU : S ⊆ U) |
| 26 | (hf : ∀ a ∈ S, ContinuousAt f a) {epsilon : ℝ} (he : 0 < epsilon) : |
| 27 | ∃ delta > 0, ∀ a ∈ S, ∀ z, dist z a < delta → |
| 28 | z ∈ U ∧ dist (f z) (f a) < epsilon := by |
| 29 | obtain ⟨d1, hd1, hsubset⟩ := hS.exists_thickening_subset_open hU hSU |
| 30 | obtain ⟨d2, hd2, hcontrol⟩ := Metric.mem_uniformity_dist.mp |
| 31 | (hS.uniformContinuousAt_of_continuousAt f hf (Metric.dist_mem_uniformity he)) |
| 32 | refine ⟨min d1 d2, lt_min hd1 hd2, ?_⟩ |
| 33 | intro a ha z hz |
| 34 | refine ⟨hsubset (Metric.mem_thickening_iff.mpr ⟨a, ha, hz.trans_le (min_le_left _ _)⟩), ?_⟩ |
| 35 | have h := hcontrol (a := a) (b := z) |
| 36 | (by simpa only [dist_comm] using hz.trans_le (min_le_right _ _)) ha |
| 37 | change dist (f a) (f z) < epsilon at h |
| 38 | simpa only [dist_comm] using h |
| 39 | |
| 40 | end PoincareMT.Proofs.M59 |