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 PoincareLib.Analysis.Calculus.Extension.Compact |
| 2 | |
| 3 | /-! # Compactly supported extension from a compact set -/ |
| 4 | |
| 5 | noncomputable section |
| 6 | set_option autoImplicit false |
| 7 | |
| 8 | open Set Metric |
| 9 | open scoped ContDiff |
| 10 | |
| 11 | namespace Poincare.Analysis |
| 12 | |
| 13 | /-- Smooth data near a compact set extend to a globally smooth map with |
| 14 | compact support, agreeing at every point of that set. -/ |
| 15 | theorem exists_contDiff_compactSupport_extension_on_compact |
| 16 | {E F : Type*} [NormedAddCommGroup E] [NormedSpace Real E] |
| 17 | [FiniteDimensional Real E] [NormedAddCommGroup F] [NormedSpace Real F] |
| 18 | {K U : Set E} (hK : IsCompact K) (hU : IsOpen U) (hKU : K ⊆ U) |
| 19 | (f : E -> F) (hf : ContDiffOn Real ∞ f U) : |
| 20 | ∃ g : E -> F, ContDiff Real ∞ g ∧ HasCompactSupport g ∧ EqOn g f K := by |
| 21 | obtain ⟨G, V, hG, _, hKV, _, heq⟩ := |
| 22 | exists_contDiff_extension_near_compact hK hU hKU f hf |
| 23 | obtain ⟨r, hr, hKr⟩ := hK.isBounded.subset_ball_lt 0 (0 : E) |
| 24 | let χ : ContDiffBump (0 : E) := ⟨r, r + 1, hr, lt_add_one r⟩ |
| 25 | refine ⟨fun x => χ x • G x, χ.contDiff.smul hG, χ.hasCompactSupport.smul_right, ?_⟩ |
| 26 | intro x hx |
| 27 | change χ x • G x = f x |
| 28 | rw [χ.one_of_mem_closedBall (ball_subset_closedBall (hKr hx)), one_smul, heq (hKV hx)] |
| 29 | |
| 30 | end Poincare.Analysis |