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.CurveShortening.Ramp.LocalFlow.C2.TraceSpeedGradient |
| 2 | import Mathlib.Analysis.Calculus.MeanValue |
| 3 | |
| 4 | /-! |
| 5 | # Actual inverse-speed coefficients at the initial time |
| 6 | |
| 7 | The witnessed spatial derivative and explicit speed estimates control |
| 8 | the actual divergence-form coefficients. MT2007 Claim 19.1, p. 437; |
| 9 | MT2015Correction Lemma 0.1, p. 3; |
| 10 | `2026-09-22-c2-inverse-speed-coefficients.md`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Manifold ContDiff |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.M63 |
| 21 | |
| 22 | open M62 |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | {a b : ℝ} |
| 27 | |
| 28 | /-- The actual inverse squared speed has its witnessed spatial |
| 29 | derivative at every closed time, including when the constant v0 is |
| 30 | zero. MT2007 Claim 19.1, p. 437; inverse-speed derivation, statement 1. -/ |
| 31 | theorem curveSpeed_inverseSquared_hasDerivAt [T2Space M] |
| 32 | (F : RicciFlow n M (Icc a b)) (c : ℝ → ℝ → M) |
| 33 | (hc : M62ShrinkingCurve F c) (v0 : ℝ) {t : ℝ} (ht : t ∈ Icc a b) (x : ℝ) : |
| 34 | HasDerivAt (fun y => (curveSpeed F c t y ^ 2)⁻¹ - (v0 ^ 2)⁻¹) |
| 35 | (-2 * deriv (curveSpeed F c t) x / curveSpeed F c t x ^ 3) x := by |
| 36 | have hv := (speed_pos F c hc ht x).ne' |
| 37 | have hd := ((speed_contDiff F c hc ht).differentiable (by norm_num) x).hasDerivAt |
| 38 | convert! ((hd.pow 2).inv (pow_ne_zero 2 hv)).sub_const ((v0 ^ 2)⁻¹) using 1 |
| 39 | simp only [Pi.pow_apply] |
| 40 | field_simp |
| 41 | ring |
| 42 | |
| 43 | /-- The actual speed and inverse squared speed have explicit initial |
| 44 | moduli, with the correct positive initial speed retained. MT2007 |
| 45 | Claim 19.1, p. 437; inverse-speed derivation, statement 2. -/ |
| 46 | theorem curveSpeed_inverseSquared_initial_bounds [T2Space M] |
| 47 | (F : RicciFlow n M (Icc a b)) (c : ℝ → ℝ → M) |
| 48 | (hc : M62ShrinkingCurve F c) {K R J v0 : ℝ} |
| 49 | (hK : 0 ≤ K) (hR : 0 ≤ R) (hJ : 0 ≤ J) (hv0 : 0 < v0) |
| 50 | (hBounds : CurveEvolutionAmbientBounds F K K K) |
| 51 | (hInitial : ∀ y, curveSpeed F c a y = v0) |
| 52 | (hCurv : ∀ r ∈ Ioo a b, ∀ y, m62CurvatureSquared F c r y ≤ R) |
| 53 | (hJet : ∀ r ∈ Ioo a b, ∀ y, |
| 54 | (F.metric r).tangentNorm (c y r) (m63CurvatureJet F c 1 r y) ≤ |
| 55 | J / Real.sqrt (r - a)) |
| 56 | {t : ℝ} (ht : t ∈ Icc a b) (x : ℝ) : |
| 57 | let v := curveSpeed F c t |
| 58 | let η := fun y => (v y ^ 2)⁻¹ - (v0 ^ 2)⁻¹ |
| 59 | let B := K + R |
| 60 | let m := v0 * Real.exp (-B * (b - a)) |
| 61 | let V := v0 * Real.exp (B * (b - a)) |
| 62 | |v x - v0| ≤ V * B * (t - a) ∧ |
| 63 | |η x| ≤ (2 * V * B / m ^ 3) * (t - a) ∧ |
| 64 | |deriv η x| ≤ (2 * V ^ 2 / m ^ 3) * |
| 65 | ((K + 2 * K * Real.sqrt R) * (t - a) + |
| 66 | 4 * Real.sqrt R * J * Real.sqrt (t - a)) := by |
| 67 | dsimp only |
| 68 | let v := curveSpeed F c t |
| 69 | let η := fun y => (v y ^ 2)⁻¹ - (v0 ^ 2)⁻¹ |
| 70 | let B := K + R |
| 71 | let δ := b - a |
| 72 | let τ := t - a |
| 73 | let m := v0 * Real.exp (-B * δ) |
| 74 | let V := v0 * Real.exp (B * δ) |
| 75 | let Q := (K + 2 * K * Real.sqrt R) * τ + 4 * Real.sqrt R * J * Real.sqrt τ |
| 76 | have hB : 0 ≤ B := add_nonneg hK hR |
| 77 | have hδ : 0 ≤ δ := sub_nonneg.mpr (ht.1.trans ht.2) |
| 78 | have hτ : 0 ≤ τ := sub_nonneg.mpr ht.1 |
| 79 | have hτδ : τ ≤ δ := sub_le_sub_right ht.2 a |
| 80 | have hm : 0 < m := mul_pos hv0 (Real.exp_pos _) |
| 81 | have hV : 0 < V := mul_pos hv0 (Real.exp_pos _) |
| 82 | have hv : 0 < v x := speed_pos F c hc ht x |
| 83 | have hQ : 0 ≤ Q := by dsimp only [Q]; positivity |
| 84 | have hBδ : 0 ≤ B * δ := mul_nonneg hB hδ |
| 85 | have hBτ : 0 ≤ B * τ := mul_nonneg hB hτ |
| 86 | have hBτδ : B * τ ≤ B * δ := mul_le_mul_of_nonneg_left hτδ hB |
| 87 | have hspeed := curveSpeed_exp_bounds F c hc hBounds x (fun r hr => hCurv r hr x) |
| 88 | ⟨le_rfl, ht.1.trans ht.2⟩ ht ht.1 |
| 89 | rw [hInitial] at hspeed |
| 90 | change v0 * Real.exp (-B * τ) ≤ v x ∧ v x ≤ v0 * Real.exp (B * τ) at hspeed |
| 91 | have hvbounds : v x ∈ Icc m V := by |
| 92 | constructor |
| 93 | · exact (mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr |
| 94 | (by nlinarith only [hBτδ])) hv0.le).trans hspeed.1 |
| 95 | · exact hspeed.2.trans (mul_le_mul_of_nonneg_left |
| 96 | (Real.exp_le_exp.mpr hBτδ) hv0.le) |
| 97 | have hv0bounds : v0 ∈ Icc m V := by |
| 98 | constructor |
| 99 | · have h := mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr |
| 100 | (show -B * δ ≤ 0 by nlinarith only [hBδ])) hv0.le |
| 101 | simpa only [Real.exp_zero, mul_one] using h |
| 102 | · have h := mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr hBδ) hv0.le |
| 103 | simpa only [Real.exp_zero, mul_one] using h |
| 104 | have hExp (z : ℝ) (hz : z ∈ Icc (-B * δ) (B * δ)) : |
| 105 | |Real.exp z - 1| ≤ Real.exp (B * δ) * |z| := by |
| 106 | have h := (convex_Icc (-B * δ) (B * δ)).norm_image_sub_le_of_norm_hasDerivWithin_le |
| 107 | (fun y _ => (Real.hasDerivAt_exp y).hasDerivWithinAt) |
| 108 | (fun y hy => by simpa only [Real.norm_eq_abs, abs_of_pos (Real.exp_pos y)] using |
| 109 | Real.exp_le_exp.mpr hy.2) |
| 110 | (show (0 : ℝ) ∈ Icc (-B * δ) (B * δ) by constructor <;> nlinarith only [hBδ]) hz |
| 111 | simpa only [Real.norm_eq_abs, Real.exp_zero, sub_zero] using h |
| 112 | have hplus := hExp (B * τ) ⟨by nlinarith only [hBδ, hBτ], hBτδ⟩ |
| 113 | have hminus := hExp (-B * τ) |
| 114 | ⟨by nlinarith only [hBτδ], by nlinarith only [hBδ, hBτ]⟩ |
| 115 | rw [abs_of_nonneg hBτ] at hplus |
| 116 | have hnegabs : |-B * τ| = B * τ := by |
| 117 | rw [neg_mul, abs_neg, abs_of_nonneg hBτ] |
| 118 | rw [hnegabs] at hminus |
| 119 | have hspeedDiff : |v x - v0| ≤ V * B * τ := by |
| 120 | apply abs_le.mpr |
| 121 | constructor |
| 122 | · have h := mul_le_mul_of_nonneg_left (abs_le.mp hminus).1 hv0.le |
| 123 | dsimp only [V] |
| 124 | nlinarith only [h, hspeed.1] |
| 125 | · have h := mul_le_mul_of_nonneg_left (abs_le.mp hplus).2 hv0.le |
| 126 | dsimp only [V] |
| 127 | nlinarith only [h, hspeed.2] |
| 128 | have hInvD (z : ℝ) (hz : z ∈ Icc m V) : |
| 129 | HasDerivAt (fun y : ℝ => (y ^ 2)⁻¹) (-2 / z ^ 3) z := by |
| 130 | have hz0 : z ≠ 0 := (hm.trans_le hz.1).ne' |
| 131 | convert! ((hasDerivAt_id z).pow 2).inv (pow_ne_zero 2 hz0) using 1 |
| 132 | simp only [Pi.pow_apply, id_eq] |
| 133 | field_simp |
| 134 | ring |
| 135 | have hInvBound (z : ℝ) (hz : z ∈ Icc m V) : ‖-2 / z ^ 3‖ ≤ 2 / m ^ 3 := by |
| 136 | have hz0 : 0 < z := hm.trans_le hz.1 |
| 137 | rw [Real.norm_eq_abs, abs_div, abs_pow, abs_of_pos hz0] |
| 138 | norm_num only [abs_neg] |
| 139 | exact div_le_div_of_nonneg_left (by norm_num) (by positivity) |
| 140 | (pow_le_pow_left₀ hm.le hz.1 3) |
| 141 | have hInv := (convex_Icc m V).norm_image_sub_le_of_norm_hasDerivWithin_le |
| 142 | (fun z hz => (hInvD z hz).hasDerivWithinAt) hInvBound hv0bounds hvbounds |
| 143 | have hη : |η x| ≤ (2 * V * B / m ^ 3) * τ := by |
| 144 | change |(v x ^ 2)⁻¹ - (v0 ^ 2)⁻¹| ≤ _ |
| 145 | calc |
| 146 | _ ≤ (2 / m ^ 3) * |v x - v0| := by simpa only [Real.norm_eq_abs] using hInv |
| 147 | _ ≤ (2 / m ^ 3) * (V * B * τ) := |
| 148 | mul_le_mul_of_nonneg_left hspeedDiff (by positivity) |
| 149 | _ = _ := by ring |
| 150 | have hgrad : |deriv v x| ≤ V ^ 2 * Q := |
| 151 | curveSpeed_spatial_abs_bound F c hc hK hR hJ hv0 hBounds hInitial hCurv hJet ht x |
| 152 | have hηgrad : |deriv η x| ≤ (2 * V ^ 2 / m ^ 3) * Q := by |
| 153 | have hd := (curveSpeed_inverseSquared_hasDerivAt F c hc v0 ht x).deriv |
| 154 | change deriv η x = -2 * deriv v x / v x ^ 3 at hd |
| 155 | rw [hd, abs_div, abs_mul, abs_pow, abs_of_pos hv] |
| 156 | norm_num only [abs_neg] |
| 157 | calc |
| 158 | 2 * |deriv v x| / v x ^ 3 ≤ 2 * (V ^ 2 * Q) / v x ^ 3 := by |
| 159 | gcongr |
| 160 | _ ≤ 2 * (V ^ 2 * Q) / m ^ 3 := |
| 161 | div_le_div_of_nonneg_left (by positivity) (by positivity) |
| 162 | (pow_le_pow_left₀ hm.le hvbounds.1 3) |
| 163 | _ = _ := by ring |
| 164 | exact ⟨hspeedDiff, hη, hηgrad⟩ |
| 165 | |
| 166 | end PoincareMT.M63 |