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.SpecialFunctions.SmoothTransition |
| 2 | import Mathlib.Analysis.InnerProductSpace.Calculus |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.Operations |
| 4 | import Mathlib.Topology.Algebra.Support |
| 5 | import Mathlib.Tactic.Linarith |
| 6 | import Mathlib.Tactic.Ring |
| 7 | |
| 8 | /-! |
| 9 | # Smooth moving bumps on coordinate balls |
| 10 | |
| 11 | The actual zero-extended function is an exponentially damped translate of |
| 12 | `expNegInvGlue (rho^2 - norm^2)`. The profile jet formulas hold at every real |
| 13 | argument, including the support boundary. This supports the barrier route to |
| 14 | Morgan--Tian Theorem 4.16; it does not assert existence of a heat solution. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | open Set Filter |
| 19 | open scoped Topology ContDiff InnerProductSpace |
| 20 | |
| 21 | namespace PoincareMT.RicciFlow.Splitting.MaximumPrinciple.Barrier |
| 22 | |
| 23 | /-- First derivative of the flat exponential, with its zero extension. -/ |
| 24 | def profileFirst (s : ℝ) : ℝ := s⁻¹ ^ 2 * expNegInvGlue s |
| 25 | |
| 26 | /-- Second derivative of the same flat exponential. -/ |
| 27 | def profileSecond (s : ℝ) : ℝ := |
| 28 | (s⁻¹ ^ 4 - 2 * s⁻¹ ^ 3) * expNegInvGlue s |
| 29 | |
| 30 | /-- The first profile derivative is valid also at zero. -/ |
| 31 | theorem hasDerivAt_profile (s : ℝ) : |
| 32 | HasDerivAt expNegInvGlue (profileFirst s) s := by |
| 33 | simpa [profileFirst] using |
| 34 | expNegInvGlue.hasDerivAt_polynomial_eval_inv_mul (1 : Polynomial ℝ) s |
| 35 | |
| 36 | /-- The second profile derivative is valid also at zero. -/ |
| 37 | theorem hasDerivAt_profileFirst (s : ℝ) : |
| 38 | HasDerivAt profileFirst (profileSecond s) s := by |
| 39 | have h : HasDerivAt profileFirst |
| 40 | (s⁻¹ ^ 2 * (s⁻¹ ^ 2 - 2 * s⁻¹) * expNegInvGlue s) s := by |
| 41 | have h := expNegInvGlue.hasDerivAt_polynomial_eval_inv_mul |
| 42 | (Polynomial.X ^ 2 : Polynomial ℝ) s |
| 43 | simp only [Polynomial.derivative_X_pow, Polynomial.eval_mul, Polynomial.eval_sub, |
| 44 | Polynomial.eval_X_pow, Polynomial.eval_C, Nat.cast_ofNat, Nat.reduceSub, pow_one] at h |
| 45 | rw [Polynomial.eval_X] at h |
| 46 | exact h |
| 47 | apply h.congr_deriv |
| 48 | unfold profileSecond |
| 49 | ring |
| 50 | |
| 51 | /-- The flat exponential is bounded by one. -/ |
| 52 | theorem profile_le_one (s : ℝ) : expNegInvGlue s ≤ 1 := by |
| 53 | by_cases hs : s ≤ 0 |
| 54 | · rw [expNegInvGlue.zero_of_nonpos hs] |
| 55 | exact zero_le_one |
| 56 | · simp only [expNegInvGlue, if_neg hs] |
| 57 | exact Real.exp_le_one_iff.mpr (neg_nonpos.mpr (inv_nonneg.mpr (le_of_not_ge hs))) |
| 58 | |
| 59 | variable {E : Type*} [NormedAddCommGroup E] |
| 60 | |
| 61 | /-- Squared distance to the boundary of the ball centered at `c`. -/ |
| 62 | def ballGap (rho : ℝ) (c x : E) : ℝ := rho ^ 2 - ‖x - c‖ ^ 2 |
| 63 | |
| 64 | /-- The actual moving bump, extended by zero across its moving boundary. -/ |
| 65 | def movingBump (rho C a : ℝ) (gamma : ℝ → E) (t : ℝ) (x : E) : ℝ := |
| 66 | Real.exp (-C * (t - a)) * expNegInvGlue (ballGap rho (gamma t) x) |
| 67 | |
| 68 | /-- Nonnegativity needs no time or damping sign restriction. -/ |
| 69 | theorem movingBump_nonneg (rho C a : ℝ) (gamma : ℝ → E) (t : ℝ) (x : E) : |
| 70 | 0 ≤ movingBump rho C a gamma t x := |
| 71 | mul_nonneg (Real.exp_pos _).le (expNegInvGlue.nonneg _) |
| 72 | |
| 73 | /-- The function is literally zero outside the open moving ball. -/ |
| 74 | theorem movingBump_eq_zero {rho : ℝ} (C a : ℝ) (gamma : ℝ → E) |
| 75 | (t : ℝ) {x : E} (hr : 0 ≤ rho) (hx : rho ≤ ‖x - gamma t‖) : |
| 76 | movingBump rho C a gamma t x = 0 := by |
| 77 | have hq : ballGap rho (gamma t) x ≤ 0 := by |
| 78 | unfold ballGap |
| 79 | nlinarith [norm_nonneg (x - gamma t)] |
| 80 | simp [movingBump, expNegInvGlue.zero_of_nonpos hq] |
| 81 | |
| 82 | /-- The exact center value at every time, including slab endpoints. -/ |
| 83 | theorem movingBump_center (rho C a : ℝ) (gamma : ℝ → E) (t : ℝ) : |
| 84 | movingBump rho C a gamma t (gamma t) = |
| 85 | Real.exp (-C * (t - a)) * expNegInvGlue (rho ^ 2) := by |
| 86 | simp [movingBump, ballGap] |
| 87 | |
| 88 | /-- Every center value is strictly positive for a positive radius. -/ |
| 89 | theorem movingBump_center_pos {rho : ℝ} (C a : ℝ) (gamma : ℝ → E) |
| 90 | (t : ℝ) (hr : 0 < rho) : 0 < movingBump rho C a gamma t (gamma t) := by |
| 91 | rw [movingBump_center] |
| 92 | exact mul_pos (Real.exp_pos _) (expNegInvGlue.pos_of_pos (sq_pos_of_pos hr)) |
| 93 | |
| 94 | variable [InnerProductSpace ℝ E] |
| 95 | |
| 96 | /-- Global spatial smoothness includes the moving support boundary. -/ |
| 97 | theorem contDiff_movingBump_space (rho C a : ℝ) (gamma : ℝ → E) (t : ℝ) : |
| 98 | ContDiff ℝ ∞ (movingBump rho C a gamma t) := by |
| 99 | unfold movingBump ballGap |
| 100 | exact contDiff_const.mul (expNegInvGlue.contDiff.comp |
| 101 | (contDiff_const.sub ((contDiff_norm_sq ℝ).comp (contDiff_id.sub contDiff_const)))) |
| 102 | |
| 103 | /-- A smooth center path gives joint smoothness, including zero extension. -/ |
| 104 | theorem contDiff_movingBump (rho C a : ℝ) {gamma : ℝ → E} |
| 105 | (hg : ContDiff ℝ ∞ gamma) : |
| 106 | ContDiff ℝ ∞ (fun z : ℝ × E => movingBump rho C a gamma z.1 z.2) := by |
| 107 | unfold movingBump ballGap |
| 108 | exact (Real.contDiff_exp.comp (contDiff_const.mul (contDiff_fst.sub contDiff_const))).mul |
| 109 | (expNegInvGlue.contDiff.comp (contDiff_const.sub |
| 110 | ((contDiff_norm_sq ℝ).comp (contDiff_snd.sub (hg.comp contDiff_fst))))) |
| 111 | |
| 112 | end PoincareMT.RicciFlow.Splitting.MaximumPrinciple.Barrier |
| 113 |