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.MeanValue |
| 2 | import Mathlib.Analysis.SpecialFunctions.Log.Deriv |
| 3 | |
| 4 | /-! |
| 5 | # Exponential comparison from logarithmic derivative bounds |
| 6 | |
| 7 | These scalar estimates supply the calculus step in metric comparison under |
| 8 | Ricci flow. Applied to the squared norm of a fixed tangent vector, they support |
| 9 | the curve-length comparison used in Topping, *Remarks on Hamilton's Compactness |
| 10 | Theorem for Ricci flow*, Theorem 1.7, printed p. 179. |
| 11 | -/ |
| 12 | |
| 13 | namespace Poincare |
| 14 | |
| 15 | open Set |
| 16 | |
| 17 | /-- A positive function whose derivative is bounded by a constant times itself |
| 18 | has Lipschitz logarithm on a convex subset of the real line. -/ |
| 19 | theorem abs_log_sub_le_of_abs_deriv_le_mul |
| 20 | {f f' : ℝ → ℝ} {s : Set ℝ} {C x y : ℝ} |
| 21 | (hs : Convex ℝ s) (hpos : ∀ t ∈ s, 0 < f t) |
| 22 | (hderiv : ∀ t ∈ s, HasDerivWithinAt f (f' t) s t) |
| 23 | (hbound : ∀ t ∈ s, |f' t| ≤ C * f t) |
| 24 | (hx : x ∈ s) (hy : y ∈ s) : |
| 25 | |Real.log (f y) - Real.log (f x)| ≤ C * |y - x| := by |
| 26 | have hlog : ∀ t ∈ s, |
| 27 | HasDerivWithinAt (fun u ↦ Real.log (f u)) (f' t / f t) s t := by |
| 28 | intro t ht |
| 29 | exact (hderiv t ht).log (ne_of_gt (hpos t ht)) |
| 30 | have hquot : ∀ t ∈ s, ‖f' t / f t‖ ≤ C := by |
| 31 | intro t ht |
| 32 | rw [Real.norm_eq_abs, abs_div, abs_of_pos (hpos t ht)] |
| 33 | exact (div_le_iff₀ (hpos t ht)).2 (hbound t ht) |
| 34 | simpa only [Real.norm_eq_abs] using |
| 35 | hs.norm_image_sub_le_of_norm_hasDerivWithin_le hlog hquot hx hy |
| 36 | |
| 37 | /-- Two-sided exponential comparison at any two points of a convex set. |
| 38 | The derivative and positivity assumptions are needed only within that set. -/ |
| 39 | theorem exp_bounds_of_abs_deriv_le_mul |
| 40 | {f f' : ℝ → ℝ} {s : Set ℝ} {C x y : ℝ} |
| 41 | (hs : Convex ℝ s) (hpos : ∀ t ∈ s, 0 < f t) |
| 42 | (hderiv : ∀ t ∈ s, HasDerivWithinAt f (f' t) s t) |
| 43 | (hbound : ∀ t ∈ s, |f' t| ≤ C * f t) |
| 44 | (hx : x ∈ s) (hy : y ∈ s) : |
| 45 | Real.exp (-C * |y - x|) * f x ≤ f y ∧ |
| 46 | f y ≤ Real.exp (C * |y - x|) * f x := by |
| 47 | have hlog := abs_le.mp |
| 48 | (abs_log_sub_le_of_abs_deriv_le_mul hs hpos hderiv hbound hx hy) |
| 49 | constructor |
| 50 | · have h : -C * |y - x| + Real.log (f x) ≤ Real.log (f y) := by |
| 51 | linarith [hlog.1] |
| 52 | simpa only [Real.exp_add, Real.exp_log (hpos x hx), Real.exp_log (hpos y hy)] |
| 53 | using Real.exp_le_exp.mpr h |
| 54 | · have h : Real.log (f y) ≤ C * |y - x| + Real.log (f x) := by |
| 55 | linarith [hlog.2] |
| 56 | simpa only [Real.exp_add, Real.exp_log (hpos x hx), Real.exp_log (hpos y hy)] |
| 57 | using Real.exp_le_exp.mpr h |
| 58 | |
| 59 | end Poincare |