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 | import Mathlib.Analysis.Calculus.ContDiff.Operations |
| 3 | import Mathlib.Analysis.Calculus.FDeriv.Const |
| 4 | import Mathlib.Analysis.InnerProductSpace.PiL2 |
| 5 | import Mathlib.Analysis.Normed.Group.Bounded |
| 6 | |
| 7 | /-! A compactly supported C2 extension of a genuine local C2 map, with |
| 8 | bounded first and second derivatives. The bump preserves the original |
| 9 | germ. Source: the cutoff argument in the audited M65 Euler reconstruction; |
| 10 | M64 finite-boundary-regularity derivation. |
| 11 | |
| 12 | Morgan--Tian context: Lemma 19.15, printed pp. 447-449. This project analytic helper |
| 13 | supports the actual annular minimizer and boundary regularity construction. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | set_option warningAsError true |
| 19 | |
| 20 | open Set Metric Filter |
| 21 | open scoped Topology ContDiff |
| 22 | |
| 23 | namespace PoincareMT |
| 24 | |
| 25 | private theorem exists_compact_C2_extension {N K : ℕ} |
| 26 | {h : EuclideanSpace ℝ (Fin N) → EuclideanSpace ℝ (Fin K)} |
| 27 | {a : EuclideanSpace ℝ (Fin N)} (hh : ContDiffAt ℝ 2 h a) : |
| 28 | ∃ g : EuclideanSpace ℝ (Fin N) → EuclideanSpace ℝ (Fin K), |
| 29 | ContDiff ℝ 2 g ∧ HasCompactSupport g ∧ |
| 30 | g =ᶠ[𝓝 a] h := by |
| 31 | obtain ⟨r, hr, hrc⟩ := Metric.mem_nhds_iff.mp (hh.eventually (by norm_num)) |
| 32 | let chi : ContDiffBump a := |
| 33 | { rIn := r / 4 |
| 34 | rOut := r / 2 |
| 35 | rIn_pos := by positivity |
| 36 | rIn_lt_rOut := by linarith } |
| 37 | let g (y : EuclideanSpace ℝ (Fin N)) := chi y • h y |
| 38 | have hchi : ContDiff ℝ 2 chi := chi.contDiff |
| 39 | have hg : ContDiff ℝ 2 g := by |
| 40 | apply contDiff_iff_contDiffAt.mpr |
| 41 | intro y |
| 42 | by_cases hy : y ∈ ball a r |
| 43 | · exact hchi.contDiffAt.smul (hrc hy) |
| 44 | · have hys : y ∉ tsupport chi := by |
| 45 | rw [chi.tsupport_eq] |
| 46 | exact fun h => hy ((closedBall_subset_ball (by dsimp only [chi]; linarith)) h) |
| 47 | have hz : g =ᶠ[𝓝 y] fun _ => 0 := by |
| 48 | filter_upwards [notMem_tsupport_iff_eventuallyEq.mp hys] with z hz |
| 49 | change chi z • h z = 0 |
| 50 | simp only [hz, Pi.zero_apply, zero_smul] |
| 51 | exact contDiffAt_const.congr_of_eventuallyEq hz |
| 52 | have hgc : HasCompactSupport g := chi.hasCompactSupport.smul_right |
| 53 | refine ⟨g, hg, hgc, ?_⟩ |
| 54 | filter_upwards [chi.eventuallyEq_one] with y hy |
| 55 | change chi y • h y = h y |
| 56 | simp only [hy, Pi.one_apply, one_smul] |
| 57 | |
| 58 | private theorem compact_first_derivative_bound |
| 59 | {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 60 | [NormedAddCommGroup F] [NormedSpace ℝ F] {g : E → F} |
| 61 | (hg : ContDiff ℝ 1 g) (hgc : HasCompactSupport g) : |
| 62 | ∃ C : ℝ, ∀ y, ‖fderiv ℝ g y‖ ≤ C := |
| 63 | (hgc.fderiv ℝ).exists_bound_of_continuous (hg.continuous_fderiv one_ne_zero) |
| 64 | |
| 65 | private theorem compact_C2_derivative_bounds |
| 66 | {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 67 | [NormedAddCommGroup F] [NormedSpace ℝ F] {g : E → F} |
| 68 | (hg : ContDiff ℝ 2 g) (hgc : HasCompactSupport g) : |
| 69 | ∃ C : ℝ, 0 < C ∧ ∀ y, ‖fderiv ℝ g y‖ ≤ C ∧ ‖fderiv ℝ (fderiv ℝ g) y‖ ≤ C := by |
| 70 | have hD : ContDiff ℝ 1 (fderiv ℝ g) := hg.fderiv_right (by norm_num) |
| 71 | have hDc : HasCompactSupport (fderiv ℝ g) := hgc.fderiv ℝ |
| 72 | obtain ⟨C1, hC1⟩ := compact_first_derivative_bound (hg.of_le (by norm_num)) hgc |
| 73 | obtain ⟨C2, hC2⟩ := compact_first_derivative_bound hD hDc |
| 74 | refine ⟨max (max C1 C2) 0 + 1, by positivity, ?_⟩ |
| 75 | intro y |
| 76 | constructor |
| 77 | · exact (hC1 y).trans (by linarith [le_max_left C1 C2, le_max_left (max C1 C2) 0]) |
| 78 | · exact (hC2 y).trans (by linarith [le_max_right C1 C2, le_max_left (max C1 C2) 0]) |
| 79 | |
| 80 | /-- A local C2 map has a global C2 extension with both derivative orders bounded and exactly |
| 81 | the same germ at the specified point. Source: |
| 82 | derivations/2026-09-26-finite-boundary-regularity.md, bounded C2 coordinate extension. -/ |
| 83 | theorem m64C2_exists_bounded_extension {N K : ℕ} |
| 84 | {h : EuclideanSpace ℝ (Fin N) → EuclideanSpace ℝ (Fin K)} |
| 85 | {a : EuclideanSpace ℝ (Fin N)} (hh : ContDiffAt ℝ 2 h a) : |
| 86 | ∃ (g : EuclideanSpace ℝ (Fin N) → EuclideanSpace ℝ (Fin K)) (C : ℝ), |
| 87 | 0 < C ∧ ContDiff ℝ 2 g ∧ HasCompactSupport g ∧ |
| 88 | (∀ y, ‖fderiv ℝ g y‖ ≤ C ∧ ‖fderiv ℝ (fderiv ℝ g) y‖ ≤ C) ∧ |
| 89 | g =ᶠ[𝓝 a] h := by |
| 90 | obtain ⟨g, hg, hgc, heq⟩ := exists_compact_C2_extension hh |
| 91 | obtain ⟨C, hC, hbounds⟩ := compact_C2_derivative_bounds hg hgc |
| 92 | exact ⟨g, C, hC, hg, hgc, hbounds, heq⟩ |
| 93 | |
| 94 | end PoincareMT |