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 PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Action.EnergyBound |
| 2 | import Mathlib.Analysis.Calculus.Deriv.Comp |
| 3 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic |
| 4 | |
| 5 | /-! |
| 6 | # Reverse energy and action coercivity |
| 7 | |
| 8 | The forward Gronwall estimate for the actual regularized energy can be |
| 9 | reversed on a shorter interval. This records the additive scalar-curvature |
| 10 | error needed for small-time initial-vector bounds. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | set_option maxHeartbeats 800000 |
| 16 | |
| 17 | open scoped intervalIntegral |
| 18 | |
| 19 | namespace PoincareMT.ReducedLength |
| 20 | |
| 21 | theorem nonnegativeEnergy_reverse_exp_bound (e e' : ℝ → ℝ) (H A : ℝ) |
| 22 | (_hH : 0 ≤ H) (hA : 0 ≤ A) |
| 23 | (hc : ContinuousOn e (Set.Icc 0 H)) |
| 24 | (he : ∀ s ∈ Set.Icc 0 H, 0 ≤ e s) |
| 25 | (hd : ∀ s ∈ Set.Icc 0 H, HasDerivAt e (e' s) s) |
| 26 | (hbound : ∀ s ∈ Set.Icc 0 H, |e' s| ≤ A * (e s + 1)) : |
| 27 | ∀ s ∈ Set.Icc 0 H, e 0 + 1 ≤ (e s + 1) * Real.exp (A * s) := by |
| 28 | intro s hs |
| 29 | let er : ℝ → ℝ := fun r ↦ e (s - r) |
| 30 | let er' : ℝ → ℝ := fun r ↦ -e' (s - r) |
| 31 | have hmap : Set.MapsTo (fun r : ℝ ↦ s - r) (Set.Icc 0 s) (Set.Icc 0 H) := by |
| 32 | intro r hr |
| 33 | change 0 ≤ s - r ∧ s - r ≤ H |
| 34 | constructor <;> linarith [hr.1, hr.2, hs.2] |
| 35 | have hce : ContinuousOn er (Set.Icc 0 s) := by |
| 36 | exact hc.comp (continuousOn_const.sub continuousOn_id) hmap |
| 37 | have hee : ∀ r ∈ Set.Icc 0 s, 0 ≤ er r := fun r hr ↦ he (s - r) (hmap hr) |
| 38 | have hde : ∀ r ∈ Set.Ico 0 s, HasDerivAt er (er' r) r := by |
| 39 | intro r hr |
| 40 | have h := (hd (s - r) (hmap ⟨hr.1, hr.2.le⟩)).comp r |
| 41 | ((hasDerivAt_const r s).sub (hasDerivAt_id r)) |
| 42 | simpa only [Function.comp_def, er, er', zero_sub, mul_neg_one] using h |
| 43 | have hbe : ∀ r ∈ Set.Ico 0 s, |er' r| ≤ A * (er r + 1) := by |
| 44 | intro r hr |
| 45 | simpa only [er', er, abs_neg] using hbound (s - r) (hmap ⟨hr.1, hr.2.le⟩) |
| 46 | have h := nonnegativeEnergy_exp_bound er er' s A hs.1 hA hce hee hde hbe s |
| 47 | ⟨hs.1, le_rfl⟩ |
| 48 | simpa only [er, sub_self, sub_zero, mul_comm] using h |
| 49 | |
| 50 | theorem nonnegativeEnergy_integral_reverse_bound (e e' : ℝ → ℝ) (H A : ℝ) |
| 51 | (hH : 0 ≤ H) (hA : 0 ≤ A) |
| 52 | (hc : ContinuousOn e (Set.Icc 0 H)) |
| 53 | (he : ∀ s ∈ Set.Icc 0 H, 0 ≤ e s) |
| 54 | (hd : ∀ s ∈ Set.Icc 0 H, HasDerivAt e (e' s) s) |
| 55 | (hbound : ∀ s ∈ Set.Icc 0 H, |e' s| ≤ A * (e s + 1)) : |
| 56 | H * (e 0 + 1) ≤ Real.exp (A * H) * |
| 57 | (∫ s in (0 : ℝ)..H, e s + 1) := by |
| 58 | have hpoint : ∀ s ∈ Set.Icc 0 H, e 0 + 1 ≤ |
| 59 | Real.exp (A * H) * (e s + 1) := by |
| 60 | intro s hs |
| 61 | calc |
| 62 | e 0 + 1 ≤ (e s + 1) * Real.exp (A * s) := |
| 63 | nonnegativeEnergy_reverse_exp_bound e e' H A hH hA hc he hd hbound s hs |
| 64 | _ ≤ (e s + 1) * Real.exp (A * H) := by |
| 65 | have hexp : Real.exp (A * s) ≤ Real.exp (A * H) := |
| 66 | Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hs.2 hA) |
| 67 | exact mul_le_mul_of_nonneg_left hexp (by linarith [he s hs]) |
| 68 | _ = Real.exp (A * H) * (e s + 1) := by ring |
| 69 | have hi : IntervalIntegrable (fun s : ℝ ↦ e s + 1) MeasureTheory.volume 0 H := by |
| 70 | apply ContinuousOn.intervalIntegrable |
| 71 | simpa only [Set.uIcc_of_le hH] using hc.add_const 1 |
| 72 | have hconst : IntervalIntegrable (fun _ : ℝ ↦ e 0 + 1) MeasureTheory.volume 0 H := |
| 73 | continuousOn_const.intervalIntegrable |
| 74 | have hm := intervalIntegral.integral_mono_on hH hconst (hi.const_mul (Real.exp (A * H))) |
| 75 | (fun s hs ↦ hpoint s hs) |
| 76 | simpa only [intervalIntegral.integral_const, sub_zero, smul_eq_mul, one_smul, |
| 77 | intervalIntegral.integral_const_mul] using hm |
| 78 | |
| 79 | theorem nonnegativeEnergy_action_reverse_bound (e e' R : ℝ → ℝ) (H A C : ℝ) |
| 80 | (hH : 0 ≤ H) (hA : 0 ≤ A) (hC : 0 ≤ C) |
| 81 | (hc : ContinuousOn e (Set.Icc 0 H)) |
| 82 | (he : ∀ s ∈ Set.Icc 0 H, 0 ≤ e s) |
| 83 | (hd : ∀ s ∈ Set.Icc 0 H, HasDerivAt e (e' s) s) |
| 84 | (hbound : ∀ s ∈ Set.Icc 0 H, |e' s| ≤ A * (e s + 1)) |
| 85 | (hRc : ContinuousOn R (Set.Icc 0 H)) |
| 86 | (hR : ∀ s ∈ Set.Icc 0 H, |R s| ≤ C) : |
| 87 | H * (e 0 + 1) ≤ Real.exp (A * H) * |
| 88 | (2 * (∫ s in (0 : ℝ)..H, 2 * s ^ 2 * R s + (1 / 2 : ℝ) * e s) + |
| 89 | 4 * C * H ^ 3 + H) := by |
| 90 | let L : ℝ → ℝ := fun s ↦ 2 * s ^ 2 * R s + (1 / 2 : ℝ) * e s |
| 91 | have hi : IntervalIntegrable e MeasureTheory.volume 0 H := by |
| 92 | apply ContinuousOn.intervalIntegrable |
| 93 | simpa only [Set.uIcc_of_le hH] using hc |
| 94 | have hLi : IntervalIntegrable L MeasureTheory.volume 0 H := by |
| 95 | apply ContinuousOn.intervalIntegrable |
| 96 | rw [Set.uIcc_of_le hH] |
| 97 | exact ((continuousOn_const.mul (continuousOn_id.pow 2)).mul hRc).add |
| 98 | (continuousOn_const.mul hc) |
| 99 | have hpoint : ∀ s ∈ Set.Icc 0 H, e s ≤ 2 * L s + 4 * C * H ^ 2 := by |
| 100 | intro s hs |
| 101 | have hRlo := (abs_le.mp (hR s hs)).1 |
| 102 | have hs2 : s ^ 2 ≤ H ^ 2 := by nlinarith [hs.1, hs.2] |
| 103 | have h1 := mul_le_mul_of_nonneg_left hRlo (sq_nonneg s) |
| 104 | have h2 := mul_le_mul_of_nonneg_left hs2 hC |
| 105 | dsimp [L] |
| 106 | nlinarith |
| 107 | have henergy := intervalIntegral.integral_mono_on hH hi |
| 108 | ((hLi.const_mul 2).add intervalIntegrable_const) hpoint |
| 109 | rw [intervalIntegral.integral_add (hLi.const_mul 2) intervalIntegrable_const, |
| 110 | intervalIntegral.integral_const_mul, intervalIntegral.integral_const] at henergy |
| 111 | simp only [sub_zero, smul_eq_mul] at henergy |
| 112 | have hreverse := nonnegativeEnergy_integral_reverse_bound e e' H A hH hA hc he hd hbound |
| 113 | rw [intervalIntegral.integral_add hi intervalIntegrable_const, |
| 114 | intervalIntegral.integral_const] at hreverse |
| 115 | simp only [sub_zero, smul_eq_mul, mul_one] at hreverse |
| 116 | apply hreverse.trans |
| 117 | apply mul_le_mul_of_nonneg_left _ (Real.exp_nonneg _) |
| 118 | dsimp [L] at henergy |
| 119 | nlinarith |
| 120 | |
| 121 | end PoincareMT.ReducedLength |