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.SmoothApprox |
| 2 | |
| 3 | /-! |
| 4 | # Smooth coordinate approximation preserving one value |
| 5 | |
| 6 | Cut off a coordinate map before applying Mathlib's support-preserving smooth |
| 7 | approximation. The cutoff is one near the compact set. Shifting the chosen |
| 8 | value to zero makes the approximation fix its full inverse image there. |
| 9 | Source: the C1 approximation derivation for MT Claim 18.16, printed p. 430. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set Filter Function |
| 15 | open scoped Manifold ContDiff Topology |
| 16 | |
| 17 | namespace PoincareMT.Proofs.M59 |
| 18 | |
| 19 | variable {E H X F : Type*} |
| 20 | [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] |
| 21 | [TopologicalSpace H] (I : ModelWithCorners ℝ E H) |
| 22 | [TopologicalSpace X] [ChartedSpace H X] [IsManifold I ∞ X] |
| 23 | [T2Space X] [NormalSpace X] [SigmaCompactSpace X] |
| 24 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 25 | |
| 26 | /-- A continuous coordinate map on an open set can be approximated smoothly |
| 27 | on a compact subset, fixing every occurrence of a prescribed value. |
| 28 | Source: the constant-boundary approximation in MT Claim 18.16, p. 430. -/ |
| 29 | theorem exists_coordinate_approximation_preserving_value |
| 30 | {K U : Set X} (hK : IsCompact K) (hU : IsOpen U) (hKU : K ⊆ U) |
| 31 | (f : X → F) (hf : ContinuousOn f U) (p : F) {delta : ℝ} (hd : 0 < delta) : |
| 32 | ∃ v : X → F, ContMDiff I 𝓘(ℝ, F) ∞ v ∧ |
| 33 | (∀ x ∈ K, dist (v x) (f x) < delta) ∧ |
| 34 | ∀ x ∈ K, f x = p → v x = p := by |
| 35 | obtain ⟨a, ha0, ha1, _⟩ := exists_contMDiffMap_zero_one_nhds_of_isClosed I |
| 36 | hU.isClosed_compl hK.isClosed |
| 37 | (by exact disjoint_left.mpr fun x hx hKx => hx (hKU hKx)) (n := (⊤ : ℕ∞)) |
| 38 | let w : X → F := fun x => a x • (f x - p) |
| 39 | have hw : Continuous w := by |
| 40 | apply continuous_iff_continuousAt.mpr |
| 41 | intro x |
| 42 | by_cases hx : x ∈ U |
| 43 | · exact a.contMDiff.continuous.continuousAt.smul |
| 44 | (((hf x hx).continuousAt (hU.mem_nhds hx)).sub continuousAt_const) |
| 45 | · have ha : (a : X → ℝ) =ᶠ[𝓝 x] 0 := ha0.filter_mono (nhds_le_nhdsSet hx) |
| 46 | have he : w =ᶠ[𝓝 x] 0 := by |
| 47 | filter_upwards [ha] with y hy |
| 48 | simp only [w, hy, Pi.zero_apply, zero_smul] |
| 49 | exact he.continuousAt |
| 50 | obtain ⟨g, hg, hsupp⟩ := hw.exists_contMDiff_approx I (⊤ : ℕ∞) |
| 51 | (ε := fun _ => delta) continuous_const (fun _ => hd) |
| 52 | refine ⟨fun x => g x + p, g.contMDiff.add contMDiff_const, ?_, ?_⟩ |
| 53 | · intro x hx |
| 54 | have hax : a x = 1 := ha1.self_of_nhdsSet x hx |
| 55 | have hdist : dist (g x + p) (f x) = dist (g x) (w x) := by |
| 56 | simp only [dist_eq_norm, w, hax, one_smul] |
| 57 | congr 1 |
| 58 | abel |
| 59 | rw [hdist] |
| 60 | exact hg x |
| 61 | · intro x _ hxp |
| 62 | have hw0 : w x = 0 := by simp only [w, hxp, sub_self, smul_zero] |
| 63 | have hg0 : g x = 0 := by |
| 64 | by_contra h |
| 65 | exact hsupp h hw0 |
| 66 | simp only [hg0, zero_add] |
| 67 | |
| 68 | end PoincareMT.Proofs.M59 |