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.ContDiff.RCLike |
| 2 | import Mathlib.Analysis.SpecialFunctions.ExpDeriv |
| 3 | |
| 4 | /-! # Smoothly weighted exponentials of Lipschitz functions -/ |
| 5 | |
| 6 | noncomputable section |
| 7 | set_option autoImplicit false |
| 8 | |
| 9 | open Set |
| 10 | open scoped ContDiff NNReal |
| 11 | |
| 12 | namespace Poincare.Analysis |
| 13 | |
| 14 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 15 | |
| 16 | /-- A smooth weight times the exponential of a Lipschitz function remains |
| 17 | Lipschitz on a convex compact set. -/ |
| 18 | theorem exists_lipschitzOnWith_mul_exp_neg |
| 19 | {C : Set E} (hC : IsCompact C) (hconv : Convex ℝ C) |
| 20 | {a u : E → ℝ} (ha : ContDiffOn ℝ ∞ a C) |
| 21 | {L : ℝ≥0} (hu : LipschitzOnWith L u C) : |
| 22 | ∃ D : ℝ≥0, LipschitzOnWith D (fun z => a z * Real.exp (-u z)) C := by |
| 23 | obtain ⟨B, hB⟩ := hC.exists_bound_of_continuousOn hu.continuousOn |
| 24 | let T : Set (E × ℝ) := C ×ˢ Icc (-B) B |
| 25 | let H : E × ℝ → ℝ := fun z => a z.1 * Real.exp (-z.2) |
| 26 | have hH : ContDiffOn ℝ ∞ H T := |
| 27 | (ha.comp contDiffOn_fst (fun _ hz => hz.1)).mul |
| 28 | (Real.contDiff_exp.comp contDiff_snd.neg).contDiffOn |
| 29 | obtain ⟨D, hD⟩ := hH.exists_lipschitzOnWith (by simp) |
| 30 | (hconv.prod (convex_Icc _ _)) (hC.prod isCompact_Icc) |
| 31 | have hgraph : MapsTo (fun z => (z, u z)) C T := by |
| 32 | intro z hz |
| 33 | exact ⟨hz, abs_le.mp (hB z hz)⟩ |
| 34 | exact ⟨D * max 1 L, hD.comp (LipschitzWith.id.lipschitzOnWith.prodMk hu) hgraph⟩ |
| 35 | |
| 36 | end Poincare.Analysis |