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.Analysis.Calculus.BumpFunction.FiniteDimension |
| 2 | |
| 3 | /-! # Global smooth representatives of finite-dimensional germs -/ |
| 4 | |
| 5 | set_option autoImplicit false |
| 6 | open Set Metric Filter |
| 7 | open scoped ContDiff Topology |
| 8 | |
| 9 | namespace Poincare.Analysis |
| 10 | |
| 11 | variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 12 | [FiniteDimensional ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 13 | |
| 14 | theorem exists_global_contDiff_germ_finiteDimension {f : E → F} {U : Set E} {a : E} |
| 15 | (hU : IsOpen U) (hf : ContDiffOn ℝ ∞ f U) (ha : a ∈ U) : |
| 16 | ∃ g : E → F, ContDiff ℝ ∞ g ∧ g =ᶠ[𝓝 a] f := by |
| 17 | obtain ⟨r, hr, hrU⟩ := Metric.mem_nhds_iff.mp (hU.mem_nhds ha) |
| 18 | let χ : ContDiffBump a := { |
| 19 | rIn := r / 4 |
| 20 | rOut := r / 2 |
| 21 | rIn_pos := by positivity |
| 22 | rIn_lt_rOut := by linarith } |
| 23 | have hsupport : tsupport χ ⊆ U := by |
| 24 | rw [χ.tsupport_eq] |
| 25 | exact (closedBall_subset_ball (by change r / 2 < r; linarith)).trans hrU |
| 26 | refine ⟨fun x => χ x • f x, ?_, ?_⟩ |
| 27 | · rw [contDiff_iff_contDiffAt] |
| 28 | intro x |
| 29 | by_cases hx : x ∈ U |
| 30 | · exact χ.contDiffAt.smul ((hf x hx).contDiffAt (hU.mem_nhds hx)) |
| 31 | · have hn : x ∉ tsupport χ := fun h => hx (hsupport h) |
| 32 | apply (contDiffAt_const (c := (0 : F))).congr_of_eventuallyEq |
| 33 | filter_upwards [notMem_tsupport_iff_eventuallyEq.mp hn] with y hy |
| 34 | simp [hy] |
| 35 | · filter_upwards [ball_mem_nhds a χ.rIn_pos] with x hx |
| 36 | rw [χ.one_of_mem_closedBall (ball_subset_closedBall hx), one_smul] |
| 37 | |
| 38 | end Poincare.Analysis |