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.Basic |
| 2 | import PoincareLib.Geometry.RicciFlow.Curvature.Estimates.QuadraticRicci |
| 3 | import Mathlib.Analysis.Calculus.Deriv.MeanValue |
| 4 | import Mathlib.Analysis.SpecialFunctions.ExpDeriv |
| 5 | import Mathlib.Geometry.Manifold.Riemannian.Basic |
| 6 | import Mathlib.MeasureTheory.Integral.Lebesgue.Add |
| 7 | |
| 8 | /-! Adapted from Mapher06/Poincare-MorganTian, `PoincareMT/Proofs/M04/LocalMetricComparison.lean`, |
| 9 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. See the curvature import record under |
| 10 | `references/ricci-flow/mapher/curvature/`. -/ |
| 11 | |
| 12 | /-! |
| 13 | # Metric control on the initial curvature cylinder |
| 14 | |
| 15 | Pointwise curvature control gives the norm comparison used to retain |
| 16 | short paths in the initial ball. |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | |
| 21 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 22 | open Set MeasureTheory |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | namespace PoincareMT.RicciFlowAnalysis |
| 27 | |
| 28 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 30 | |
| 31 | theorem metric_comparison_at_of_curvature_bound {J : Set ℝ} |
| 32 | (F : RicciFlow n M J) {s t K : ℝ} |
| 33 | (hs : s ∈ J) (ht : t ∈ J) (hst : s ≤ t) (hK : 0 ≤ K) |
| 34 | (x : M) |
| 35 | (hRm : ∀ τ ∈ Icc s t, (F.connection τ).curvatureTensorNorm x ≤ K) |
| 36 | (v : TangentSpace (𝓡 n) x) : |
| 37 | Real.exp (-2 * (n : ℝ) * K * (t - s)) * |
| 38 | (F.metric s).inner x v v ≤ (F.metric t).inner x v v ∧ |
| 39 | (F.metric t).inner x v v ≤ |
| 40 | Real.exp (2 * (n : ℝ) * K * (t - s)) * (F.metric s).inner x v v := by |
| 41 | let q := fun τ ↦ (F.metric τ).inner x v v |
| 42 | let c := 2 * (n : ℝ) * K |
| 43 | have hJI : Set.Icc s t ⊆ J := F.interval.out hs ht |
| 44 | have hq0 (τ : ℝ) : 0 ≤ q τ := by |
| 45 | by_cases hv : v = 0 |
| 46 | · simp [q, hv] |
| 47 | · exact (F.metric τ).pos x v hv |>.le |
| 48 | have hqD (τ : ℝ) (hτ : τ ∈ Set.Icc s t) : |
| 49 | HasDerivWithinAt q (-2 * (F.connection τ).ricci x v v) (Set.Icc s t) τ := |
| 50 | (F.equation τ (hJI hτ) x v v).mono hJI |
| 51 | have hBound (τ : ℝ) (hτ : τ ∈ Set.Icc s t) : |
| 52 | -c * q τ ≤ -2 * (F.connection τ).ricci x v v ∧ |
| 53 | -2 * (F.connection τ).ricci x v v ≤ c * q τ := by |
| 54 | have h := (abs_ricci_le_curvatureTensorNorm (F.connection τ) x v).trans |
| 55 | (mul_le_mul_of_nonneg_right |
| 56 | (mul_le_mul_of_nonneg_left (hRm τ hτ) (Nat.cast_nonneg n)) (hq0 τ)) |
| 57 | have hnK : 0 ≤ (n : ℝ) * K := mul_nonneg (Nat.cast_nonneg n) hK |
| 58 | have h0 := mul_nonneg hnK (hq0 τ) |
| 59 | obtain ⟨hl, hu⟩ := abs_le.mp h |
| 60 | dsimp only [c, q] at * |
| 61 | constructor <;> nlinarith |
| 62 | let p := fun τ ↦ Real.exp (c * (τ - s)) * q τ |
| 63 | let m := fun τ ↦ Real.exp (-(c * (τ - s))) * q τ |
| 64 | have hpD (τ : ℝ) (hτ : τ ∈ Set.Icc s t) : |
| 65 | HasDerivWithinAt p |
| 66 | (Real.exp (c * (τ - s)) * (c * q τ - 2 * (F.connection τ).ricci x v v)) |
| 67 | (Set.Icc s t) τ := by |
| 68 | convert! ((((hasDerivAt_id τ).sub_const s).const_mul c).exp.hasDerivWithinAt.mul |
| 69 | (hqD τ hτ)) using 1 |
| 70 | dsimp only [id, Pi.neg_apply] |
| 71 | ring |
| 72 | have hmD (τ : ℝ) (hτ : τ ∈ Set.Icc s t) : |
| 73 | HasDerivWithinAt m |
| 74 | (Real.exp (-(c * (τ - s))) * (-2 * (F.connection τ).ricci x v v - c * q τ)) |
| 75 | (Set.Icc s t) τ := by |
| 76 | convert! (((((hasDerivAt_id τ).sub_const s).const_mul c).neg.exp.hasDerivWithinAt).mul |
| 77 | (hqD τ hτ)) using 1 |
| 78 | dsimp only [id, Pi.neg_apply] |
| 79 | ring |
| 80 | have hp : MonotoneOn p (Set.Icc s t) := by |
| 81 | apply monotoneOn_of_hasDerivWithinAt_nonneg (convex_Icc s t) |
| 82 | (fun τ hτ ↦ (hpD τ hτ).continuousWithinAt) |
| 83 | (fun τ hτ ↦ (hpD τ (interior_subset hτ)).mono interior_subset) |
| 84 | intro τ hτ |
| 85 | apply mul_nonneg (Real.exp_pos _).le |
| 86 | have h := (hBound τ (interior_subset hτ)).1 |
| 87 | linarith |
| 88 | have hm : AntitoneOn m (Set.Icc s t) := by |
| 89 | apply antitoneOn_of_hasDerivWithinAt_nonpos (convex_Icc s t) |
| 90 | (fun τ hτ ↦ (hmD τ hτ).continuousWithinAt) |
| 91 | (fun τ hτ ↦ (hmD τ (interior_subset hτ)).mono interior_subset) |
| 92 | intro τ hτ |
| 93 | apply mul_nonpos_of_nonneg_of_nonpos (Real.exp_pos _).le |
| 94 | have h := (hBound τ (interior_subset hτ)).2 |
| 95 | linarith |
| 96 | have hp' : q s ≤ Real.exp (c * (t - s)) * q t := by |
| 97 | simpa only [p, sub_self, mul_zero, Real.exp_zero, one_mul] using |
| 98 | hp ⟨le_rfl, hst⟩ ⟨hst, le_rfl⟩ hst |
| 99 | have hm' : Real.exp (-(c * (t - s))) * q t ≤ q s := by |
| 100 | simpa only [m, sub_self, mul_zero, neg_zero, Real.exp_zero, one_mul] using |
| 101 | hm ⟨le_rfl, hst⟩ ⟨hst, le_rfl⟩ hst |
| 102 | constructor |
| 103 | · have h := mul_le_mul_of_nonneg_left hp' (Real.exp_pos (-(c * (t - s)))).le |
| 104 | have he : Real.exp (-(c * (t - s))) * Real.exp (c * (t - s)) = 1 := by |
| 105 | rw [← Real.exp_add, neg_add_cancel, Real.exp_zero] |
| 106 | rw [← mul_assoc, he, one_mul] at h |
| 107 | simpa only [c, q, neg_mul] using h |
| 108 | · have h := mul_le_mul_of_nonneg_left hm' (Real.exp_pos (c * (t - s))).le |
| 109 | have he : Real.exp (c * (t - s)) * Real.exp (-(c * (t - s))) = 1 := by |
| 110 | rw [← Real.exp_add, add_neg_cancel, Real.exp_zero] |
| 111 | rw [← mul_assoc, he, one_mul] at h |
| 112 | exact h |
| 113 | |
| 114 | theorem tangentNorm_comparison_at_of_curvature_bound {J : Set ℝ} |
| 115 | (F : RicciFlow n M J) {s t K : ℝ} |
| 116 | (hs : s ∈ J) (ht : t ∈ J) (hst : s ≤ t) (hK : 0 ≤ K) |
| 117 | (x : M) |
| 118 | (hRm : ∀ τ ∈ Icc s t, (F.connection τ).curvatureTensorNorm x ≤ K) |
| 119 | (v : TangentSpace (𝓡 n) x) : |
| 120 | Real.exp (-(n : ℝ) * K * (t - s)) * |
| 121 | (F.metric s).tangentNorm x v ≤ (F.metric t).tangentNorm x v ∧ |
| 122 | (F.metric t).tangentNorm x v ≤ |
| 123 | Real.exp ((n : ℝ) * K * (t - s)) * (F.metric s).tangentNorm x v := by |
| 124 | have h := metric_comparison_at_of_curvature_bound F hs ht hst hK x hRm v |
| 125 | have hN (g : RiemannianMetric n M) : 0 ≤ g.tangentNorm x v := Real.sqrt_nonneg _ |
| 126 | have hsq (g : RiemannianMetric n M) : |
| 127 | (g.tangentNorm x v) ^ 2 = g.inner x v v := by |
| 128 | apply Real.sq_sqrt |
| 129 | by_cases hv : v = 0 |
| 130 | · simp [hv] |
| 131 | · exact (g.pos x v hv).le |
| 132 | have hlow : |
| 133 | (Real.exp (-(n : ℝ) * K * (t - s)) * (F.metric s).tangentNorm x v) ^ 2 ≤ |
| 134 | ((F.metric t).tangentNorm x v) ^ 2 := by |
| 135 | calc |
| 136 | _ = Real.exp (-2 * (n : ℝ) * K * (t - s)) * (F.metric s).inner x v v := by |
| 137 | rw [mul_pow, hsq, pow_two, ← Real.exp_add] |
| 138 | congr 2 |
| 139 | ring |
| 140 | _ ≤ _ := by simpa only [hsq] using h.1 |
| 141 | have hupp : |
| 142 | ((F.metric t).tangentNorm x v) ^ 2 ≤ |
| 143 | (Real.exp ((n : ℝ) * K * (t - s)) * (F.metric s).tangentNorm x v) ^ 2 := by |
| 144 | calc |
| 145 | _ ≤ Real.exp (2 * (n : ℝ) * K * (t - s)) * (F.metric s).inner x v v := by |
| 146 | simpa only [hsq] using h.2 |
| 147 | _ = _ := by |
| 148 | rw [mul_pow, hsq, pow_two, ← Real.exp_add] |
| 149 | congr 2 |
| 150 | ring |
| 151 | have hlow0 := mul_nonneg (Real.exp_pos (-(n : ℝ) * K * (t - s))).le (hN (F.metric s)) |
| 152 | have hupp0 := mul_nonneg (Real.exp_pos ((n : ℝ) * K * (t - s))).le (hN (F.metric s)) |
| 153 | constructor <;> nlinarith only [hlow, hupp, hlow0, hupp0, hN (F.metric t)] |
| 154 | |
| 155 | theorem tangentNorm_comparison_on_initial_ball |
| 156 | {T K α r : ℝ} (F : RicciFlow n M (Icc 0 T)) |
| 157 | (hK : 0 < K) (hT0 : 0 ≤ T) (hT : T ≤ α / K) (p : M) |
| 158 | (hRm : ∀ t ∈ Icc 0 T, ∀ x ∈ (F.metric 0).ball p r, |
| 159 | (F.connection t).curvatureTensorNorm x ≤ K) |
| 160 | {t : ℝ} (ht : t ∈ Icc 0 T) |
| 161 | {x : M} (hx : x ∈ (F.metric 0).ball p r) |
| 162 | (v : TangentSpace (𝓡 n) x) : |
| 163 | (F.metric 0).tangentNorm x v ≤ |
| 164 | Real.exp ((n : ℝ) * α) * (F.metric t).tangentNorm x v ∧ |
| 165 | (F.metric t).tangentNorm x v ≤ |
| 166 | Real.exp ((n : ℝ) * α) * (F.metric 0).tangentNorm x v := by |
| 167 | have h := tangentNorm_comparison_at_of_curvature_bound F ⟨le_rfl, hT0⟩ ht ht.1 hK.le x |
| 168 | (fun τ hτ => hRm τ ⟨hτ.1, hτ.2.trans ht.2⟩ x hx) v |
| 169 | simp only [sub_zero] at h |
| 170 | have hKt : K * t ≤ α := by |
| 171 | have hTK : T * K ≤ α := (le_div_iff₀ hK).mp hT |
| 172 | nlinarith [mul_le_mul_of_nonneg_left ht.2 hK.le] |
| 173 | have hexp : Real.exp ((n : ℝ) * K * t) ≤ Real.exp ((n : ℝ) * α) := by |
| 174 | apply Real.exp_le_exp.mpr |
| 175 | nlinarith [mul_le_mul_of_nonneg_left hKt (Nat.cast_nonneg n : (0 : ℝ) ≤ n)] |
| 176 | have hN (g : RiemannianMetric n M) : 0 ≤ g.tangentNorm x v := Real.sqrt_nonneg _ |
| 177 | constructor |
| 178 | · have hrev := mul_le_mul_of_nonneg_left h.1 (Real.exp_pos ((n : ℝ) * K * t)).le |
| 179 | have he : Real.exp ((n : ℝ) * K * t) * Real.exp (-(n : ℝ) * K * t) = 1 := by |
| 180 | rw [← Real.exp_add] |
| 181 | convert Real.exp_zero using 1; congr 1; ring |
| 182 | rw [← mul_assoc, he, one_mul] at hrev |
| 183 | exact hrev.trans (mul_le_mul_of_nonneg_right hexp (hN (F.metric t))) |
| 184 | · exact h.2.trans (mul_le_mul_of_nonneg_right hexp (hN (F.metric 0))) |
| 185 | |
| 186 | private theorem pathELength_eq_lintegral_tangentNorm |
| 187 | (g : RiemannianMetric n M) (γ : ℝ → M) (a b : ℝ) : |
| 188 | g.pathELength γ a b = |
| 189 | ∫⁻ u in Icc a b, |
| 190 | ENNReal.ofReal (g.tangentNorm (γ u) |
| 191 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) γ u 1)) := by |
| 192 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 193 | ⟨g.toRiemannianMetric⟩ |
| 194 | change Manifold.pathELength (𝓡 n) γ a b = _ |
| 195 | rw [Manifold.pathELength_eq_lintegral_mfderiv_Icc] |
| 196 | apply setLIntegral_congr_fun measurableSet_Icc |
| 197 | intro u _ |
| 198 | dsimp only |
| 199 | rw [← ofReal_norm, norm_eq_sqrt_real_inner] |
| 200 | rfl |
| 201 | |
| 202 | theorem pathELength_le_of_tangentNorm_le |
| 203 | (g h : RiemannianMetric n M) {U : Set M} {C a b : ℝ} |
| 204 | (hC : 0 ≤ C) |
| 205 | (hcomp : ∀ x ∈ U, ∀ v : TangentSpace (𝓡 n) x, |
| 206 | g.tangentNorm x v ≤ C * h.tangentNorm x v) |
| 207 | (γ : ℝ → M) (hU : MapsTo γ (Icc a b) U) : |
| 208 | g.pathELength γ a b ≤ ENNReal.ofReal C * h.pathELength γ a b := by |
| 209 | rw [pathELength_eq_lintegral_tangentNorm, pathELength_eq_lintegral_tangentNorm, |
| 210 | ← lintegral_const_mul' _ _ ENNReal.ofReal_ne_top] |
| 211 | apply setLIntegral_mono' measurableSet_Icc |
| 212 | intro u hu |
| 213 | calc |
| 214 | _ ≤ ENNReal.ofReal (C * h.tangentNorm (γ u) |
| 215 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) γ u 1)) := |
| 216 | ENNReal.ofReal_le_ofReal (hcomp _ (hU hu) _) |
| 217 | _ = _ := ENNReal.ofReal_mul hC |
| 218 | |
| 219 | private theorem metric_edist_le_pathELength |
| 220 | (g : RiemannianMetric n M) {γ : ℝ → M} {a b : ℝ} |
| 221 | (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 γ (Icc a b)) |
| 222 | (hab : a ≤ b) : |
| 223 | g.edist (γ a) (γ b) ≤ g.pathELength γ a b := by |
| 224 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 225 | ⟨g.toRiemannianMetric⟩ |
| 226 | exact Manifold.riemannianEDist_le_pathELength hγ rfl rfl hab |
| 227 | |
| 228 | private theorem metric_edist_triangle |
| 229 | (g : RiemannianMetric n M) (x y z : M) : |
| 230 | g.edist x z ≤ g.edist x y + g.edist y z := by |
| 231 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 232 | ⟨g.toRiemannianMetric⟩ |
| 233 | exact Manifold.riemannianEDist_triangle |
| 234 | |
| 235 | private theorem exists_contMDiff_path_length_lt |
| 236 | (g : RiemannianMetric n M) {x y : M} {L : ℝ≥0∞} |
| 237 | (hxy : g.edist x y < L) : |
| 238 | ∃ γ : ℝ → M, γ 0 = x ∧ γ 1 = y ∧ |
| 239 | ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 1 γ ∧ g.pathELength γ 0 1 < L := by |
| 240 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 241 | ⟨g.toRiemannianMetric⟩ |
| 242 | obtain ⟨γ, h0, h1, hγ, hL, _⟩ := |
| 243 | Manifold.exists_lt_locally_constant_of_riemannianEDist_lt hxy zero_lt_one |
| 244 | exact ⟨γ, h0, h1, hγ, hL⟩ |
| 245 | |
| 246 | private theorem continuous_metric_edist [T2Space M] |
| 247 | (g : RiemannianMetric n M) (p : M) : |
| 248 | Continuous (fun x => g.edist p x) := by |
| 249 | let : LocallyCompactSpace M := ChartedSpace.locallyCompactSpace (EuclideanSpace ℝ (Fin n)) M |
| 250 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 251 | ⟨g.toRiemannianMetric⟩ |
| 252 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 253 | (TangentSpace (𝓡 n) : M → Type _) := |
| 254 | ⟨⟨g.inner, g.contMDiff.continuous, fun _ _ _ => rfl⟩⟩ |
| 255 | let : PseudoEMetricSpace M := .ofRiemannianMetric (𝓡 n) M |
| 256 | exact continuous_const.edist continuous_id |
| 257 | |
| 258 | theorem initial_half_ball_closure_subset_initial_ball [T2Space M] |
| 259 | (g : RiemannianMetric n M) (p : M) {r : ℝ} (hr : 0 < r) : |
| 260 | closure (g.ball p (r / 2)) ⊆ g.ball p r := by |
| 261 | letI : LocallyCompactSpace M := |
| 262 | ChartedSpace.locallyCompactSpace (EuclideanSpace ℝ (Fin n)) M |
| 263 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 264 | ⟨g.toRiemannianMetric⟩ |
| 265 | letI : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 266 | (TangentSpace (𝓡 n) : M → Type _) := |
| 267 | ⟨⟨g.inner, g.contMDiff.continuous, fun _ _ _ => rfl⟩⟩ |
| 268 | letI : PseudoEMetricSpace M := .ofRiemannianMetric (𝓡 n) M |
| 269 | have hcont : Continuous (fun y => g.edist p y) := |
| 270 | continuous_const.edist continuous_id |
| 271 | have hclosed : IsClosed {y | g.edist p y ≤ ENNReal.ofReal (r / 2)} := by |
| 272 | exact isClosed_le hcont continuous_const |
| 273 | have hhalf : g.ball p (r / 2) ⊆ {y | g.edist p y ≤ ENNReal.ofReal (r / 2)} := by |
| 274 | intro y hy |
| 275 | change g.edist p y < ENNReal.ofReal (r / 2) at hy |
| 276 | exact le_of_lt hy |
| 277 | have hcl : closure (g.ball p (r / 2)) ⊆ |
| 278 | {y | g.edist p y ≤ ENNReal.ofReal (r / 2)} := |
| 279 | closure_minimal hhalf hclosed |
| 280 | intro y hy |
| 281 | change g.edist p y < ENNReal.ofReal r |
| 282 | exact (hcl hy).trans_lt |
| 283 | ((ENNReal.ofReal_lt_ofReal_iff hr).2 (by linarith)) |
| 284 | |
| 285 | end PoincareMT.RicciFlowAnalysis |
| 286 |