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.Curvature.Calculus |
| 2 | import PoincareLib.Geometry.RicciFlow.Harnack.Noncompact.CurvatureControl.Distance.Continuity |
| 3 | import PoincareLib.Geometry.RicciFlow.Harnack.Noncompact.CurvatureControl.Distance.Finite |
| 4 | |
| 5 | /-! |
| 6 | # Joint distance continuity on a finite terminal set |
| 7 | |
| 8 | The global continuity theorem uses preconnectedness only to make every |
| 9 | intrinsic distance finite. These variants retain the same local comparison |
| 10 | argument and require finiteness only at the selected points. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | set_option maxHeartbeats 800000 |
| 16 | |
| 17 | open Set Filter Bundle |
| 18 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.RicciFlow |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | {J : Set ℝ} |
| 27 | |
| 28 | private theorem finite_continuousAt_ricci_tangent_evaluation |
| 29 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 30 | (q : ℝ × TangentBundle (𝓡 n) M) (hq : q.1 ∈ interior J) : |
| 31 | ContinuousAt (fun z : ℝ × TangentBundle (𝓡 n) M => |
| 32 | (F.connection z.1).ricci z.2.1 z.2.2 z.2.2) q := by |
| 33 | apply Poincare.RicciFlow.Harnack.continuousAt_tensor_family_evaluation |
| 34 | (q := q) (t := Prod.fst) (x := fun z => z.2.1) |
| 35 | (T := fun t => (F.connection t).ricciEvaluation) |
| 36 | (fun t => (hC.tensor_calculus n M (F.metric t) (F.connection t)).2.1) |
| 37 | (X := fun z (_ : Fin 2) => z.2.2) |
| 38 | · intro O hO hx X hX |
| 39 | exact (F.contMDiffAt_ricci_fields hq |
| 40 | ((hX 0).contMDiffAt (hO.mem_nhds hx)) |
| 41 | ((hX 1).contMDiffAt (hO.mem_nhds hx))).continuousAt |
| 42 | · exact continuousAt_fst |
| 43 | · exact (FiberBundle.continuous_proj (EuclideanSpace ℝ (Fin n)) |
| 44 | (TangentSpace (𝓡 n))).continuousAt.comp continuousAt_snd |
| 45 | · intro i |
| 46 | exact continuousAt_snd |
| 47 | |
| 48 | private theorem finite_exists_ricci_bound_on_compact_relative |
| 49 | [T3Space M] (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 50 | (g : RiemannianMetric n M) {a b : ℝ} (hJ : Icc a b ⊆ interior J) |
| 51 | {K : Set M} (hK : IsCompact K) : |
| 52 | ∃ C : ℝ, 0 ≤ C ∧ ∀ t ∈ Icc a b, ∀ x ∈ K, |
| 53 | ∀ v : TangentSpace (𝓡 n) x, |
| 54 | |(F.connection t).ricci x v v| ≤ C * g.inner x v v := by |
| 55 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 56 | ⟨g.toRiemannianMetric⟩ |
| 57 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 58 | (TangentSpace (𝓡 n) : M → Type _) := |
| 59 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ ↦ rfl⟩⟩ |
| 60 | let : LocallyCompactSpace M := ChartedSpace.locallyCompactSpace |
| 61 | (EuclideanSpace ℝ (Fin n)) M |
| 62 | let S : Set (TangentBundle (𝓡 n) M) := {q | q.1 ∈ K ∧ ‖q.2‖ = 1} |
| 63 | have hS : IsCompact S := Poincare.VectorBundle.isCompact_sphere_over hK 1 |
| 64 | have hcont : ContinuousOn (fun z : ℝ × TangentBundle (𝓡 n) M => |
| 65 | (F.connection z.1).ricci z.2.1 z.2.2 z.2.2) (Icc a b ×ˢ S) := |
| 66 | fun q hq => |
| 67 | (finite_continuousAt_ricci_tangent_evaluation hC F q (hJ hq.1)).continuousWithinAt |
| 68 | obtain ⟨C, hCbound⟩ := (isCompact_Icc.prod hS).exists_bound_of_continuousOn hcont |
| 69 | refine ⟨max C 0, le_max_right _ _, ?_⟩ |
| 70 | intro t ht x hx v |
| 71 | obtain ⟨R, hR⟩ := (hC.tensor_calculus n M (F.metric t) (F.connection t)).2.1.1 x |
| 72 | have hscale (c : ℝ) (w : TangentSpace (𝓡 n) x) : |
| 73 | (F.connection t).ricci x (c • w) (c • w) = |
| 74 | c ^ 2 * (F.connection t).ricci x w w := by |
| 75 | have h := R.map_smul_univ (fun _ : Fin 2 => c) (fun _ => w) |
| 76 | simp_rw [← hR] at h |
| 77 | simpa [LeviCivitaData.ricciEvaluation, Fin.prod_univ_two, pow_two] using h |
| 78 | by_cases hv : v = 0 |
| 79 | · subst v |
| 80 | have hz := hscale 0 (0 : TangentSpace (𝓡 n) x) |
| 81 | simpa using hz |
| 82 | have hn : ‖v‖ ≠ 0 := norm_ne_zero_iff.mpr hv |
| 83 | let w := ‖v‖⁻¹ • v |
| 84 | have hw : ‖w‖ = 1 := by |
| 85 | simp [w, norm_smul, norm_inv, inv_mul_cancel₀ hn] |
| 86 | have hbound := hCbound (t, ⟨x, w⟩) ⟨ht, hx, hw⟩ |
| 87 | have hbound' : |(F.connection t).ricci x w w| ≤ C := by |
| 88 | simpa only [Real.norm_eq_abs] using hbound |
| 89 | have hvw : v = ‖v‖ • w := by simp [w, smul_smul, mul_inv_cancel₀ hn] |
| 90 | have hnorm : ‖v‖ ^ 2 = g.inner x v v := (real_inner_self_eq_norm_sq v).symm |
| 91 | calc |
| 92 | |(F.connection t).ricci x v v| = |
| 93 | ‖v‖ ^ 2 * |(F.connection t).ricci x w w| := by |
| 94 | conv_lhs => rw [hvw, hscale] |
| 95 | rw [abs_mul, abs_of_nonneg (sq_nonneg _)] |
| 96 | _ ≤ ‖v‖ ^ 2 * max C 0 := mul_le_mul_of_nonneg_left |
| 97 | (hbound'.trans (le_max_left C 0)) (sq_nonneg _) |
| 98 | _ = max C 0 * g.inner x v v := by rw [hnorm]; ring |
| 99 | |
| 100 | private theorem finite_exists_local_distance_exp_comparison |
| 101 | [T3Space M] (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 102 | {a b : ℝ} (hJ : Icc a b ⊆ interior J) |
| 103 | (hcomplete : MetricComplete (F.metric b)) |
| 104 | (hRic : ∀ t ∈ Icc a b, ∀ x : M, ∀ v : TangentSpace (𝓡 n) x, |
| 105 | 0 ≤ (F.connection t).ricci x v v) |
| 106 | (O : M) {r : ℝ} (hr : 0 < r) : |
| 107 | ∃ C : ℝ, 0 ≤ C ∧ ∀ s ∈ Icc a b, ∀ t ∈ Icc a b, |
| 108 | ∀ y ∈ (F.metric a).ball O r, |
| 109 | ((F.metric t).edist O y).toReal ≤ Real.exp (C * |t - s|) * |
| 110 | ((F.metric s).edist O y).toReal := by |
| 111 | obtain ⟨C, hCnonneg, hbound⟩ := finite_exists_ricci_bound_on_compact_relative hC F |
| 112 | (F.metric b) hJ |
| 113 | ((F.metric b).isCompact_closedBall_of_metricComplete hcomplete O (3 * r)) |
| 114 | refine ⟨C, hCnonneg, ?_⟩ |
| 115 | intro s hs t ht y hy |
| 116 | have hab : a ≤ b := hs.1.trans hs.2 |
| 117 | have ha : a ∈ Icc a b := ⟨le_rfl, hab⟩ |
| 118 | have hb : b ∈ Icc a b := ⟨hab, le_rfl⟩ |
| 119 | have hy' : y ∈ (F.metric s).ball O r := |
| 120 | F.ball_subset_ball_of_ricci_nonneg hJ O r ha hs hs.1 |
| 121 | (fun τ hτ z _ v => hRic τ hτ z v) hy |
| 122 | have hO : O ∈ (F.metric s).ball O r := by |
| 123 | simpa only [RiemannianMetric.ball, mem_ofPred_eq, RiemannianMetric.edist, |
| 124 | Manifold.riemannianEDist_self] using ENNReal.ofReal_pos.mpr hr |
| 125 | have hdist := F.edist_le_exp_mul_of_ricci_bound (convex_Icc a b) |
| 126 | (hJ.trans interior_subset) O r C hr hs ht (fun τ hτ z hz v => by |
| 127 | have hz' : (F.metric b).edist O z ≤ ENNReal.ofReal (3 * r) := |
| 128 | (F.ball_subset_ball_of_ricci_nonneg hJ O (3 * r) hs hb hs.2 |
| 129 | (fun q hq w _ u => hRic q hq w u) hz).le |
| 130 | exact (hbound τ hτ z hz' v).trans (mul_le_mul_of_nonneg_left |
| 131 | (F.antitoneOn_metric_inner_self_of_ricci_nonneg hJ z v |
| 132 | (fun q hq => hRic q hq z v) hτ hb hτ.2) hCnonneg)) hO hy' |
| 133 | have hsfinite : (F.metric s).edist O y ≠ ⊤ := |
| 134 | ne_top_of_lt (hy'.trans ENNReal.ofReal_lt_top) |
| 135 | have hfinite : ENNReal.ofReal (Real.exp (C * |t - s|)) * |
| 136 | (F.metric s).edist O y ≠ ⊤ := |
| 137 | ENNReal.mul_ne_top ENNReal.ofReal_ne_top hsfinite |
| 138 | simpa only [ENNReal.toReal_mul, ENNReal.toReal_ofReal (Real.exp_nonneg _)] using |
| 139 | ENNReal.toReal_mono hfinite hdist |
| 140 | |
| 141 | /-- Pointwise joint continuity on an interior slab, assuming the selected |
| 142 | point is finite at the initial time. -/ |
| 143 | theorem continuousWithinAt_toReal_edist_of_ricci_nonneg_of_finite |
| 144 | [T3Space M] (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 145 | {a b : ℝ} (hJ : Icc a b ⊆ interior J) |
| 146 | (hcomplete : MetricComplete (F.metric b)) |
| 147 | (hRic : ∀ t ∈ Icc a b, ∀ x : M, ∀ v : TangentSpace (𝓡 n) x, |
| 148 | 0 ≤ (F.connection t).ricci x v v) |
| 149 | (O : M) {p : ℝ × M} (hp : p.1 ∈ Icc a b) |
| 150 | (hfinite : (F.metric a).edist O p.2 ≠ ⊤) : |
| 151 | ContinuousWithinAt |
| 152 | (fun q : ℝ × M => ((F.metric q.1).edist O q.2).toReal) |
| 153 | (Icc a b ×ˢ univ) p := by |
| 154 | let r := ((F.metric a).edist O p.2).toReal + 1 |
| 155 | have hr : 0 < r := by dsimp only [r]; positivity |
| 156 | have hpball : ((F.metric a).edist O p.2).toReal < r := lt_add_one _ |
| 157 | obtain ⟨C, _, hcompare⟩ := finite_exists_local_distance_exp_comparison hC F hJ |
| 158 | hcomplete hRic O hr |
| 159 | have hnear : ∀ᶠ q : ℝ × M in 𝓝 p, q.2 ∈ (F.metric a).ball O r := by |
| 160 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 161 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 162 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 163 | (TangentSpace (𝓡 n) : M → Type _) := |
| 164 | ⟨⟨(F.metric a).inner, (F.metric a).toContinuousRiemannianMetric.continuous, |
| 165 | fun _ _ _ => rfl⟩⟩ |
| 166 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 n) M |
| 167 | have hbase : (F.metric a).edist O p.2 < ENNReal.ofReal r := by |
| 168 | rw [← ENNReal.ofReal_toReal hfinite] |
| 169 | exact (ENNReal.ofReal_lt_ofReal_iff hr).mpr hpball |
| 170 | have hcont : ContinuousAt |
| 171 | (fun q : ℝ × M => (F.metric a).edist O q.2) p := |
| 172 | (continuous_const.edist continuous_snd).continuousAt |
| 173 | exact hcont.eventually_lt_const hbase |
| 174 | let D : ℝ × M → ℝ := fun q => ((F.metric p.1).edist O q.2).toReal |
| 175 | let E : ℝ × M → ℝ := fun q => Real.exp (C * |q.1 - p.1|) |
| 176 | have hpfinite : (F.metric p.1).edist O p.2 ≠ ⊤ := by |
| 177 | have hbase : p.2 ∈ (F.metric a).ball O r := by |
| 178 | change (F.metric a).edist O p.2 < ENNReal.ofReal r |
| 179 | rw [← ENNReal.ofReal_toReal hfinite] |
| 180 | exact (ENNReal.ofReal_lt_ofReal_iff hr).mpr hpball |
| 181 | have hball := F.ball_subset_ball_of_ricci_nonneg hJ O r |
| 182 | (show a ∈ Icc a b from ⟨le_rfl, hp.1.trans hp.2⟩) hp hp.1 |
| 183 | (fun τ hτ z _ v => hRic τ hτ z v) hbase |
| 184 | exact ne_top_of_lt (hball.trans ENNReal.ofReal_lt_top) |
| 185 | have hD : ContinuousAt D p := |
| 186 | (PoincareMT.RiemannianMetric.continuousAt_toReal_edist_of_ne_top |
| 187 | (F.metric p.1) O p.2 hpfinite).comp continuousAt_snd |
| 188 | have hE : Continuous E := by dsimp only [E]; fun_prop |
| 189 | have hupper : Tendsto (fun q => E q * D q) (𝓝[Icc a b ×ˢ univ] p) |
| 190 | (𝓝 (((F.metric p.1).edist O p.2).toReal)) := by |
| 191 | convert (hE.continuousAt.mul hD).tendsto.mono_left |
| 192 | (nhdsWithin_le_nhds : 𝓝[Icc a b ×ˢ univ] p ≤ 𝓝 p) using 1 <;> |
| 193 | first | rfl | simp [E, D] |
| 194 | have hlower : Tendsto (fun q => (E q)⁻¹ * D q) (𝓝[Icc a b ×ˢ univ] p) |
| 195 | (𝓝 (((F.metric p.1).edist O p.2).toReal)) := by |
| 196 | convert ((hE.continuousAt.inv₀ (Real.exp_ne_zero _)).mul hD).tendsto.mono_left |
| 197 | (nhdsWithin_le_nhds : 𝓝[Icc a b ×ˢ univ] p ≤ 𝓝 p) using 1 <;> |
| 198 | first | rfl | simp [E, D] |
| 199 | apply tendsto_of_tendsto_of_tendsto_of_le_of_le' hlower hupper |
| 200 | · filter_upwards [self_mem_nhdsWithin, hnear.filter_mono nhdsWithin_le_nhds] with q hq hqy |
| 201 | apply (inv_mul_le_iff₀ (Real.exp_pos _)).mpr |
| 202 | simpa only [E, D, abs_sub_comm p.1 q.1] using |
| 203 | hcompare q.1 hq.1 p.1 hp q.2 hqy |
| 204 | · filter_upwards [self_mem_nhdsWithin, hnear.filter_mono nhdsWithin_le_nhds] with q hq hqy |
| 205 | exact hcompare p.1 hp q.1 hq.1 q.2 hqy |
| 206 | |
| 207 | /-- Joint continuity on a set whose points are finite at the initial slice. -/ |
| 208 | theorem continuousOn_toReal_edist_of_ricci_nonneg_of_finite |
| 209 | [T3Space M] (hC : RicciFlowCurvatureTheory.{u}) (F : RicciFlow n M J) |
| 210 | {a b : ℝ} (hJ : Icc a b ⊆ interior J) |
| 211 | (hcomplete : MetricComplete (F.metric b)) |
| 212 | (hRic : ∀ t ∈ Icc a b, ∀ x : M, ∀ v : TangentSpace (𝓡 n) x, |
| 213 | 0 ≤ (F.connection t).ricci x v v) |
| 214 | (O : M) {K : Set M} |
| 215 | (hfinite : ∀ y ∈ K, (F.metric a).edist O y ≠ ⊤) : |
| 216 | ContinuousOn |
| 217 | (fun p : ℝ × M => ((F.metric p.1).edist O p.2).toReal) |
| 218 | (Icc a b ×ˢ K) := by |
| 219 | intro p hp |
| 220 | exact (continuousWithinAt_toReal_edist_of_ricci_nonneg_of_finite hC F hJ |
| 221 | hcomplete hRic O hp.1 (hfinite p.2 hp.2)).mono |
| 222 | (Set.prod_mono (fun _ h => h) (fun _ _ => mem_univ _)) |
| 223 | |
| 224 | /-- Finiteness at the terminal slice propagates to every earlier slice in a |
| 225 | nonnegative-Ricci slab. -/ |
| 226 | theorem edist_ne_top_of_terminal_of_ricci_nonneg |
| 227 | [T3Space M] (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 228 | {a b : ℝ} (hab : a ≤ b) (hJ : Icc a b ⊆ interior J) |
| 229 | (hcomplete : MetricComplete (F.metric b)) |
| 230 | (hRic : ∀ t ∈ Icc a b, ∀ x : M, ∀ v : TangentSpace (𝓡 n) x, |
| 231 | 0 ≤ (F.connection t).ricci x v v) |
| 232 | (O q : M) (hq : (F.metric b).edist O q ≠ ⊤) |
| 233 | {t : ℝ} (ht : t ∈ Icc a b) : |
| 234 | (F.metric t).edist O q ≠ ⊤ := by |
| 235 | let R := ((F.metric b).edist O q).toReal + 1 |
| 236 | have hR : 0 < R := by |
| 237 | dsimp only [R] |
| 238 | positivity |
| 239 | have hqball : q ∈ (F.metric b).ball O R := by |
| 240 | change (F.metric b).edist O q < ENNReal.ofReal R |
| 241 | rw [← ENNReal.ofReal_toReal hq] |
| 242 | exact (ENNReal.ofReal_lt_ofReal_iff hR).mpr (by dsimp [R]; linarith) |
| 243 | have hOball : O ∈ (F.metric b).ball O R := by |
| 244 | simpa only [RiemannianMetric.ball, mem_ofPred_eq, RiemannianMetric.edist, |
| 245 | Manifold.riemannianEDist_self] using ENNReal.ofReal_pos.mpr hR |
| 246 | have hb : b ∈ Icc a b := ⟨hab, le_rfl⟩ |
| 247 | obtain ⟨C, hCnonneg, hbound⟩ := finite_exists_ricci_bound_on_compact_relative |
| 248 | hC F (F.metric b) hJ |
| 249 | ((F.metric b).isCompact_closedBall_of_metricComplete hcomplete O (3 * R)) |
| 250 | have hdist := F.edist_le_exp_mul_of_ricci_bound (convex_Icc a b) |
| 251 | (hJ.trans interior_subset) O R C hR hb ht (fun τ hτ z hz v => by |
| 252 | have hz' : (F.metric b).edist O z ≤ ENNReal.ofReal (3 * R) := hz.le |
| 253 | exact (hbound τ hτ z hz' v).trans (mul_le_mul_of_nonneg_left |
| 254 | (F.antitoneOn_metric_inner_self_of_ricci_nonneg hJ z v |
| 255 | (fun σ hσ => hRic σ hσ z v) hτ hb hτ.2) hCnonneg)) hOball hqball |
| 256 | exact ne_top_of_le_ne_top |
| 257 | (ENNReal.mul_ne_top ENNReal.ofReal_ne_top hq) hdist |
| 258 | |
| 259 | /-- Joint continuity on a terminal closed ball, with no connectedness |
| 260 | assumption on the manifold. -/ |
| 261 | theorem continuousOn_toReal_edist_on_terminal_closedBall_of_ricci_nonneg |
| 262 | [T3Space M] (hC : RicciFlowCurvatureTheory.{u}) (F : RicciFlow n M J) |
| 263 | {a b : ℝ} (hab : a ≤ b) (hJ : Icc a b ⊆ interior J) |
| 264 | (hcomplete : MetricComplete (F.metric b)) |
| 265 | (hRic : ∀ t ∈ Icc a b, ∀ x : M, ∀ v : TangentSpace (𝓡 n) x, |
| 266 | 0 ≤ (F.connection t).ricci x v v) |
| 267 | (O : M) {r : ℝ} (_hr : 0 < r) : |
| 268 | ContinuousOn |
| 269 | (fun p : ℝ × M => ((F.metric p.1).edist O p.2).toReal) |
| 270 | (Icc a b ×ˢ {q | (F.metric b).edist O q ≤ ENNReal.ofReal r}) := by |
| 271 | apply continuousOn_toReal_edist_of_ricci_nonneg_of_finite hC F hJ |
| 272 | hcomplete hRic O |
| 273 | intro y hy |
| 274 | have hy' : (F.metric b).edist O y ≤ ENNReal.ofReal r := hy |
| 275 | have hyfinite : (F.metric b).edist O y ≠ ⊤ := |
| 276 | ne_top_of_le_ne_top ENNReal.ofReal_ne_top hy' |
| 277 | exact edist_ne_top_of_terminal_of_ricci_nonneg hC F hab hJ hcomplete hRic O y |
| 278 | hyfinite ⟨le_rfl, hab⟩ |
| 279 | |
| 280 | end PoincareMT.RicciFlow |