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.Integrals.Basic |
| 2 | |
| 3 | /-! # Exponential moments on a finite positive interval -/ |
| 4 | |
| 5 | set_option autoImplicit false |
| 6 | set_option backward.isDefEq.respectTransparency false |
| 7 | |
| 8 | open Set MeasureTheory intervalIntegral |
| 9 | |
| 10 | namespace Poincare.Analysis |
| 11 | |
| 12 | theorem integral_exp_neg_mul_le {L scale : ℝ} (hscale : 0 < scale) : |
| 13 | (∫ t : ℝ in 0..L, Real.exp (-scale * t)) ≤ 1 / scale := by |
| 14 | rw [intervalIntegral.integral_comp_mul_left Real.exp (neg_ne_zero.mpr hscale.ne')] |
| 15 | simp only [mul_zero, integral_exp, Real.exp_zero, smul_eq_mul] |
| 16 | have hpos := (Real.exp_pos (-(scale * L))).le |
| 17 | apply (mul_le_mul_iff_of_pos_left hscale).mp |
| 18 | field_simp |
| 19 | nlinarith |
| 20 | |
| 21 | theorem integral_sq_mul_exp_neg_mul_le {L scale : ℝ} (hL : 0 ≤ L) (hscale : 0 < scale) : |
| 22 | (∫ t : ℝ in 0..L, t ^ 2 * Real.exp (-scale * t)) ≤ 2 / scale ^ 3 := by |
| 23 | let F : ℝ → ℝ := fun t => |
| 24 | -Real.exp (-scale * t) * (t ^ 2 / scale + 2 * t / scale ^ 2 + 2 / scale ^ 3) |
| 25 | have hd (t : ℝ) : HasDerivAt F (t ^ 2 * Real.exp (-scale * t)) t := by |
| 26 | have he := (((hasDerivAt_id t).const_mul (-scale)).exp).neg |
| 27 | have hp := ((((hasDerivAt_id t).fun_pow 2).div_const scale).add |
| 28 | (((hasDerivAt_id t).const_mul 2).div_const (scale ^ 2))).add_const (2 / scale ^ 3) |
| 29 | convert! he.mul hp using 1 |
| 30 | dsimp only [id_eq, Pi.add_apply, Pi.neg_apply] |
| 31 | field_simp |
| 32 | ring |
| 33 | have hc : Continuous (fun t : ℝ => t ^ 2 * Real.exp (-scale * t)) := by fun_prop |
| 34 | rw [intervalIntegral.integral_eq_sub_of_hasDerivAt (fun t _ => hd t) |
| 35 | (hc.intervalIntegrable 0 L)] |
| 36 | have hp : 0 ≤ L ^ 2 / scale + 2 * L / scale ^ 2 + 2 / scale ^ 3 := by positivity |
| 37 | dsimp only [F] |
| 38 | simp only [mul_zero, Real.exp_zero, zero_pow, ne_eq, OfNat.ofNat_ne_zero, |
| 39 | not_false_eq_true, zero_div, zero_add] |
| 40 | nlinarith [mul_nonneg (Real.exp_nonneg (-scale * L)) hp] |
| 41 | |
| 42 | theorem integral_exp_neg_mul_quadratic_le {L scale A B : ℝ} |
| 43 | (hL : 0 ≤ L) (hscale : 0 < scale) (hA : 0 ≤ A) (hB : 0 ≤ B) : |
| 44 | (∫ t : ℝ in 0..L, Real.exp (-scale * t) * (A + B * t ^ 2)) ≤ |
| 45 | A / scale + 2 * B / scale ^ 3 := by |
| 46 | have he : Continuous (fun t : ℝ => Real.exp (-scale * t)) := by fun_prop |
| 47 | have hm : Continuous (fun t : ℝ => t ^ 2 * Real.exp (-scale * t)) := by fun_prop |
| 48 | have heq : (fun t : ℝ => Real.exp (-scale * t) * (A + B * t ^ 2)) = |
| 49 | (fun t => A * Real.exp (-scale * t) + B * (t ^ 2 * Real.exp (-scale * t))) := by |
| 50 | funext t |
| 51 | ring |
| 52 | rw [heq, intervalIntegral.integral_add ((he.const_mul A).intervalIntegrable 0 L) |
| 53 | ((hm.const_mul B).intervalIntegrable 0 L), intervalIntegral.integral_const_mul, |
| 54 | intervalIntegral.integral_const_mul] |
| 55 | have h := add_le_add |
| 56 | (mul_le_mul_of_nonneg_left (integral_exp_neg_mul_le (L := L) hscale) hA) |
| 57 | (mul_le_mul_of_nonneg_left (integral_sq_mul_exp_neg_mul_le hL hscale) hB) |
| 58 | convert! h using 1 |
| 59 | ring |
| 60 | |
| 61 | end Poincare.Analysis |