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.ODE.Gronwall |
| 2 | import Mathlib.Analysis.Real.Sqrt |
| 3 | import Mathlib.Tactic |
| 4 | |
| 5 | /-! |
| 6 | # Bounds for the nonnegative regularized energy |
| 7 | |
| 8 | The estimate uses energy plus one and remains valid at zero velocity. |
| 9 | Actual geometric coefficient bounds are supplied separately. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | namespace PoincareMT.ReducedLength |
| 15 | |
| 16 | theorem regularizedEnergy_abs_bound (s H B C e dR r : ℝ) |
| 17 | (hs : 0 ≤ s) (hsH : s ≤ H) (hB : 0 ≤ B) (hC : 0 ≤ C) (he : 0 ≤ e) |
| 18 | (hdR : |dR| ≤ C * Real.sqrt e) (hr : |r| ≤ B * e) : |
| 19 | |4 * s ^ 2 * dR - 4 * s * r| ≤ (2 * H ^ 2 * C + 4 * H * B) * (e + 1) := by |
| 20 | have hH : 0 ≤ H := hs.trans hsH |
| 21 | have hs2 : s ^ 2 ≤ H ^ 2 := by nlinarith |
| 22 | have hsqrt : 2 * Real.sqrt e ≤ e + 1 := by |
| 23 | nlinarith [sq_nonneg (Real.sqrt e - 1), Real.sq_sqrt he] |
| 24 | have hgrad := mul_le_mul_of_nonneg_left hsqrt (show 0 ≤ 2 * H ^ 2 * C by positivity) |
| 25 | have hric := mul_le_mul_of_nonneg_left (show e ≤ e + 1 by linarith) |
| 26 | (show 0 ≤ 4 * H * B by positivity) |
| 27 | calc |
| 28 | _ ≤ |4 * s ^ 2 * dR| + |4 * s * r| := abs_sub _ _ |
| 29 | _ = 4 * s ^ 2 * |dR| + 4 * s * |r| := by |
| 30 | simp only [abs_mul, abs_of_nonneg (show 0 ≤ (4 : ℝ) by norm_num), |
| 31 | abs_of_nonneg (sq_nonneg s), abs_of_nonneg hs] |
| 32 | _ ≤ 4 * s ^ 2 * (C * Real.sqrt e) + 4 * s * (B * e) := |
| 33 | add_le_add (mul_le_mul_of_nonneg_left hdR (by positivity)) |
| 34 | (mul_le_mul_of_nonneg_left hr (by positivity)) |
| 35 | _ ≤ 4 * H ^ 2 * (C * Real.sqrt e) + 4 * H * (B * e) := |
| 36 | add_le_add |
| 37 | (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hs2 (by norm_num)) |
| 38 | (by positivity)) |
| 39 | (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hsH (by norm_num)) |
| 40 | (by positivity)) |
| 41 | _ ≤ _ := by nlinarith |
| 42 | |
| 43 | theorem nonnegativeEnergy_exp_bound (e e' : ℝ → ℝ) (H A : ℝ) |
| 44 | (hH : 0 ≤ H) (_hA : 0 ≤ A) |
| 45 | (hc : ContinuousOn e (Set.Icc 0 H)) |
| 46 | (he : ∀ s ∈ Set.Icc 0 H, 0 ≤ e s) |
| 47 | (hd : ∀ s ∈ Set.Ico 0 H, HasDerivAt e (e' s) s) |
| 48 | (hbound : ∀ s ∈ Set.Ico 0 H, |e' s| ≤ A * (e s + 1)) : |
| 49 | ∀ s ∈ Set.Icc 0 H, e s + 1 ≤ (e 0 + 1) * Real.exp (A * s) := by |
| 50 | have hn : ∀ s ∈ Set.Icc 0 H, 0 ≤ e s + 1 := |
| 51 | fun s hs ↦ add_nonneg (he s hs) zero_le_one |
| 52 | have h := norm_le_gronwallBound_of_norm_deriv_right_le |
| 53 | (f := fun s ↦ e s + 1) (f' := e') (a := 0) (b := H) |
| 54 | (δ := e 0 + 1) (K := A) (ε := 0) |
| 55 | (hc.add_const 1) (fun s hs ↦ ((hd s hs).add_const 1).hasDerivWithinAt) |
| 56 | (by simp only [Real.norm_eq_abs, abs_of_nonneg (hn 0 ⟨le_rfl, hH⟩), le_refl]) |
| 57 | (fun s hs ↦ by |
| 58 | simpa only [Real.norm_eq_abs, abs_of_nonneg (hn s ⟨hs.1, hs.2.le⟩), add_zero] |
| 59 | using hbound s hs) |
| 60 | intro s hs |
| 61 | simpa only [Real.norm_eq_abs, abs_of_nonneg (hn s hs), gronwallBound_ε0, sub_zero] |
| 62 | using h s hs |
| 63 | |
| 64 | end PoincareMT.ReducedLength |