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.PartitionOfUnity |
| 2 | import Mathlib.Geometry.Manifold.ContMDiff.NormedSpace |
| 3 | |
| 4 | /-! |
| 5 | # Smooth extensions preserving germs along a closed subset |
| 6 | |
| 7 | Mathlib's smooth separation theorem produces a cutoff equal to one near |
| 8 | the closed subset and zero near the complement of the smooth domain. |
| 9 | The resulting extension preserves endpoint derivatives of the radial |
| 10 | curves used in Morgan--Tian, Remark 19.42, p. 472. See the closed-corner |
| 11 | ray derivation for the application and the totalization checks. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | set_option autoImplicit false |
| 16 | set_option warningAsError true |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Topology ContDiff Manifold |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | /-- A map smooth on an open set has a globally smooth representative with |
| 24 | the same germ at every point of a closed subset. The cutoff is supplied by |
| 25 | Mathlib's smooth Urysohn theorem; no regularity is required outside `U`. |
| 26 | This preserves the endpoint jets needed in MT Remark 19.42, p. 472. -/ |
| 27 | theorem m64_exists_contDiff_eq_nhds_of_isClosed |
| 28 | {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 29 | [FiniteDimensional ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 30 | {n : ℕ∞} {f : E → F} {K U : Set E} |
| 31 | (hK : IsClosed K) (hU : IsOpen U) (hKU : K ⊆ U) |
| 32 | (hf : ContDiffOn ℝ n f U) : |
| 33 | ∃ g : E → F, ContDiff ℝ n g ∧ ∀ x ∈ K, g =ᶠ[𝓝 x] f := by |
| 34 | obtain ⟨chi, hzero, hone, _⟩ := |
| 35 | exists_contMDiffMap_zero_one_nhds_of_isClosed (𝓘(ℝ, E)) |
| 36 | hU.isClosed_compl hK |
| 37 | (show Disjoint Uᶜ K from disjoint_left.mpr (fun _ hx hk => hx (hKU hk))) |
| 38 | (n := n) |
| 39 | refine ⟨fun x => chi x • f x, ?_, ?_⟩ |
| 40 | · rw [contDiff_iff_contDiffAt] |
| 41 | intro x |
| 42 | by_cases hx : x ∈ U |
| 43 | · exact chi.contMDiff.contDiff.contDiffAt.smul (hf.contDiffAt (hU.mem_nhds hx)) |
| 44 | · have hz : ∀ᶠ y in 𝓝 x, chi y = 0 := hzero.filter_mono (nhds_le_nhdsSet hx) |
| 45 | apply (contDiffAt_const (c := (0 : F))).congr_of_eventuallyEq |
| 46 | filter_upwards [hz] with y hy |
| 47 | exact hy ▸ zero_smul ℝ (f y) |
| 48 | · intro x hx |
| 49 | have ho : ∀ᶠ y in 𝓝 x, chi y = 1 := hone.filter_mono (nhds_le_nhdsSet hx) |
| 50 | filter_upwards [ho] with y hy |
| 51 | exact hy ▸ one_smul ℝ (f y) |
| 52 | |
| 53 | end PoincareMT |