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.MetricMonotonicity |
| 3 | import PoincareLib.Geometry.RicciFlow.Harnack.Noncompact.DirectionEvaluation |
| 4 | import PoincareLib.Geometry.RicciFlow.MetricComparison |
| 5 | import PoincareLib.Geometry.Riemannian.Distance.Basic |
| 6 | import PoincareLib.Geometry.Riemannian.Distance.CompleteBalls |
| 7 | import PoincareLib.Geometry.Riemannian.Curvature.IntrinsicCalculus |
| 8 | |
| 9 | /-! |
| 10 | # Joint continuity of distance under nonnegative Ricci curvature |
| 11 | |
| 12 | Earlier metric balls lie in a compact ball of a complete terminal slice. |
| 13 | Compactness bounds the Ricci quadratic form there, so the local metric |
| 14 | comparison gives a two-sided distance estimate and joint continuity. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter Bundle |
| 21 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.RicciFlow |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 29 | {J : Set ℝ} |
| 30 | |
| 31 | private theorem continuousAt_ricci_tangent_evaluation |
| 32 | (F : RicciFlow n M J) (hTensor : ∀ t, (F.connection t).CurvatureTensorCalculus) |
| 33 | (q : ℝ × TangentBundle (𝓡 n) M) (hq : q.1 ∈ interior J) : |
| 34 | ContinuousAt (fun z : ℝ × TangentBundle (𝓡 n) M => |
| 35 | (F.connection z.1).ricci z.2.1 z.2.2 z.2.2) q := by |
| 36 | apply Poincare.RicciFlow.Harnack.continuousAt_tensor_family_evaluation |
| 37 | (q := q) (t := Prod.fst) (x := fun z => z.2.1) |
| 38 | (T := fun t => (F.connection t).ricciEvaluation) |
| 39 | (fun t => (hTensor t).2.1) |
| 40 | (X := fun z (_ : Fin 2) => z.2.2) |
| 41 | · intro O hO hx X hX |
| 42 | exact (F.contMDiffAt_ricci_fields hq |
| 43 | ((hX 0).contMDiffAt (hO.mem_nhds hx)) |
| 44 | ((hX 1).contMDiffAt (hO.mem_nhds hx))).continuousAt |
| 45 | · exact continuousAt_fst |
| 46 | · exact (FiberBundle.continuous_proj (EuclideanSpace ℝ (Fin n)) |
| 47 | (TangentSpace (𝓡 n))).continuousAt.comp continuousAt_snd |
| 48 | · intro i |
| 49 | exact continuousAt_snd |
| 50 | |
| 51 | private theorem exists_ricci_bound_on_compact_relative |
| 52 | [T3Space M] (F : RicciFlow n M J) |
| 53 | (hTensor : ∀ t, (F.connection t).CurvatureTensorCalculus) |
| 54 | (g : RiemannianMetric n M) {a b : ℝ} (hJ : Icc a b ⊆ interior J) |
| 55 | {K : Set M} (hK : IsCompact K) : |
| 56 | ∃ C : ℝ, 0 ≤ C ∧ ∀ t ∈ Icc a b, ∀ x ∈ K, |
| 57 | ∀ v : TangentSpace (𝓡 n) x, |
| 58 | |(F.connection t).ricci x v v| ≤ C * g.inner x v v := by |
| 59 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 60 | ⟨g.toRiemannianMetric⟩ |
| 61 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 62 | (TangentSpace (𝓡 n) : M → Type _) := |
| 63 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 64 | let : LocallyCompactSpace M := ChartedSpace.locallyCompactSpace |
| 65 | (EuclideanSpace ℝ (Fin n)) M |
| 66 | let S : Set (TangentBundle (𝓡 n) M) := {q | q.1 ∈ K ∧ ‖q.2‖ = 1} |
| 67 | have hS : IsCompact S := Poincare.VectorBundle.isCompact_sphere_over hK 1 |
| 68 | have hcont : ContinuousOn (fun z : ℝ × TangentBundle (𝓡 n) M => |
| 69 | (F.connection z.1).ricci z.2.1 z.2.2 z.2.2) (Icc a b ×ˢ S) := |
| 70 | fun q hq => (continuousAt_ricci_tangent_evaluation F hTensor q (hJ hq.1)).continuousWithinAt |
| 71 | obtain ⟨C, hCbound⟩ := (isCompact_Icc.prod hS).exists_bound_of_continuousOn hcont |
| 72 | refine ⟨max C 0, le_max_right _ _, ?_⟩ |
| 73 | intro t ht x hx v |
| 74 | obtain ⟨R, hR⟩ := (hTensor t).2.1.1 x |
| 75 | have hscale (c : ℝ) (w : TangentSpace (𝓡 n) x) : |
| 76 | (F.connection t).ricci x (c • w) (c • w) = |
| 77 | c ^ 2 * (F.connection t).ricci x w w := by |
| 78 | have h := R.map_smul_univ (fun _ : Fin 2 => c) (fun _ => w) |
| 79 | simp_rw [← hR] at h |
| 80 | simpa [LeviCivitaData.ricciEvaluation, Fin.prod_univ_two, pow_two] using h |
| 81 | by_cases hv : v = 0 |
| 82 | · subst v |
| 83 | have hz := hscale 0 (0 : TangentSpace (𝓡 n) x) |
| 84 | simpa using hz |
| 85 | have hn : ‖v‖ ≠ 0 := norm_ne_zero_iff.mpr hv |
| 86 | let w := ‖v‖⁻¹ • v |
| 87 | have hw : ‖w‖ = 1 := by |
| 88 | simp [w, norm_smul, norm_inv, inv_mul_cancel₀ hn] |
| 89 | have hbound := hCbound (t, ⟨x, w⟩) ⟨ht, hx, hw⟩ |
| 90 | have hbound' : |(F.connection t).ricci x w w| ≤ C := by |
| 91 | simpa only [Real.norm_eq_abs] using hbound |
| 92 | have hvw : v = ‖v‖ • w := by simp [w, smul_smul, mul_inv_cancel₀ hn] |
| 93 | have hnorm : ‖v‖ ^ 2 = g.inner x v v := (real_inner_self_eq_norm_sq v).symm |
| 94 | calc |
| 95 | |(F.connection t).ricci x v v| = |
| 96 | ‖v‖ ^ 2 * |(F.connection t).ricci x w w| := by |
| 97 | conv_lhs => rw [hvw, hscale] |
| 98 | rw [abs_mul, abs_of_nonneg (sq_nonneg _)] |
| 99 | _ ≤ ‖v‖ ^ 2 * max C 0 := mul_le_mul_of_nonneg_left |
| 100 | (hbound'.trans (le_max_left C 0)) |
| 101 | (sq_nonneg _) |
| 102 | _ = max C 0 * g.inner x v v := by rw [hnorm]; ring |
| 103 | |
| 104 | private theorem exists_local_distance_exp_comparison |
| 105 | [T3Space M] [PreconnectedSpace M] |
| 106 | (F : RicciFlow n M J) (hTensor : ∀ t, (F.connection t).CurvatureTensorCalculus) |
| 107 | {a b : ℝ} (hJ : Icc a b ⊆ interior J) |
| 108 | (hcomplete : MetricComplete (F.metric b)) |
| 109 | (hRic : ∀ t ∈ Icc a b, ∀ x : M, ∀ v : TangentSpace (𝓡 n) x, |
| 110 | 0 ≤ (F.connection t).ricci x v v) |
| 111 | (O : M) {r : ℝ} (hr : 0 < r) : |
| 112 | ∃ C : ℝ, 0 ≤ C ∧ ∀ s ∈ Icc a b, ∀ t ∈ Icc a b, |
| 113 | ∀ y ∈ (F.metric a).ball O r, |
| 114 | ((F.metric t).edist O y).toReal ≤ Real.exp (C * |t - s|) * |
| 115 | ((F.metric s).edist O y).toReal := by |
| 116 | obtain ⟨C, hCnonneg, hbound⟩ := exists_ricci_bound_on_compact_relative F hTensor |
| 117 | (F.metric b) hJ |
| 118 | ((F.metric b).isCompact_closedBall_of_metricComplete hcomplete O (3 * r)) |
| 119 | refine ⟨C, hCnonneg, ?_⟩ |
| 120 | intro s hs t ht y hy |
| 121 | have hab : a ≤ b := hs.1.trans hs.2 |
| 122 | have ha : a ∈ Icc a b := ⟨le_rfl, hab⟩ |
| 123 | have hb : b ∈ Icc a b := ⟨hab, le_rfl⟩ |
| 124 | have hy' : y ∈ (F.metric s).ball O r := |
| 125 | F.ball_subset_ball_of_ricci_nonneg hJ O r ha hs hs.1 |
| 126 | (fun τ hτ z _ v => hRic τ hτ z v) hy |
| 127 | have hO : O ∈ (F.metric s).ball O r := by |
| 128 | simpa only [RiemannianMetric.ball, mem_ofPred_eq, RiemannianMetric.edist, |
| 129 | Manifold.riemannianEDist_self] using ENNReal.ofReal_pos.mpr hr |
| 130 | have hdist := F.edist_le_exp_mul_of_ricci_bound (convex_Icc a b) |
| 131 | (hJ.trans interior_subset) O r C hr hs ht (fun τ hτ z hz v => by |
| 132 | have hz' : (F.metric b).edist O z ≤ ENNReal.ofReal (3 * r) := |
| 133 | (F.ball_subset_ball_of_ricci_nonneg hJ O (3 * r) hs hb hs.2 |
| 134 | (fun q hq w _ u => hRic q hq w u) hz).le |
| 135 | exact (hbound τ hτ z hz' v).trans (mul_le_mul_of_nonneg_left |
| 136 | (F.antitoneOn_metric_inner_self_of_ricci_nonneg hJ z v |
| 137 | (fun q hq => hRic q hq z v) hτ hb hτ.2) hCnonneg)) hO hy' |
| 138 | have hfinite : ENNReal.ofReal (Real.exp (C * |t - s|)) * |
| 139 | (F.metric s).edist O y ≠ ⊤ := |
| 140 | ENNReal.mul_ne_top ENNReal.ofReal_ne_top ((F.metric s).edist_ne_top O y) |
| 141 | simpa only [ENNReal.toReal_mul, ENNReal.toReal_ofReal (Real.exp_nonneg _)] using |
| 142 | ENNReal.toReal_mono hfinite hdist |
| 143 | |
| 144 | /-- Distances are jointly continuous on a compact interior time interval |
| 145 | under nonnegative Ricci curvature. Only the terminal metric must be complete. -/ |
| 146 | private theorem continuousOn_toReal_edist_of_ricci_nonneg_aux |
| 147 | [T3Space M] [PreconnectedSpace M] |
| 148 | (F : RicciFlow n M J) (hTensor : ∀ t, (F.connection t).CurvatureTensorCalculus) |
| 149 | {a b : ℝ} (hJ : Icc a b ⊆ interior J) |
| 150 | (hcomplete : MetricComplete (F.metric b)) |
| 151 | (hRic : ∀ t ∈ Icc a b, ∀ x : M, ∀ v : TangentSpace (𝓡 n) x, |
| 152 | 0 ≤ (F.connection t).ricci x v v) |
| 153 | (O : M) : |
| 154 | ContinuousOn (fun p : ℝ × M => ((F.metric p.1).edist O p.2).toReal) |
| 155 | (Icc a b ×ˢ univ) := by |
| 156 | intro p hp |
| 157 | let r := ((F.metric a).edist O p.2).toReal + 1 |
| 158 | have hr : 0 < r := by dsimp only [r]; positivity |
| 159 | have hpball : ((F.metric a).edist O p.2).toReal < r := lt_add_one _ |
| 160 | obtain ⟨C, _, hcompare⟩ := exists_local_distance_exp_comparison F hTensor hJ hcomplete hRic O hr |
| 161 | have hnear : ∀ᶠ q : ℝ × M in 𝓝 p, q.2 ∈ (F.metric a).ball O r := by |
| 162 | have hh := (((F.metric a).continuous_toReal_edist O).comp continuous_snd).continuousAt |
| 163 | |>.eventually_lt_const hpball |
| 164 | filter_upwards [hh] with q hq |
| 165 | change (F.metric a).edist O q.2 < ENNReal.ofReal r |
| 166 | rw [← ENNReal.ofReal_toReal ((F.metric a).edist_ne_top O q.2)] |
| 167 | exact (ENNReal.ofReal_lt_ofReal_iff hr).mpr hq |
| 168 | let D : ℝ × M → ℝ := fun q => ((F.metric p.1).edist O q.2).toReal |
| 169 | let E : ℝ × M → ℝ := fun q => Real.exp (C * |q.1 - p.1|) |
| 170 | have hD : Continuous D := ((F.metric p.1).continuous_toReal_edist O).comp continuous_snd |
| 171 | have hE : Continuous E := by dsimp only [E]; fun_prop |
| 172 | have hupper : Tendsto (fun q => E q * D q) (𝓝[Icc a b ×ˢ univ] p) |
| 173 | (𝓝 (((F.metric p.1).edist O p.2).toReal)) := by |
| 174 | convert ((hE.mul hD).continuousAt (x := p)).tendsto.mono_left |
| 175 | (nhdsWithin_le_nhds : 𝓝[Icc a b ×ˢ univ] p ≤ 𝓝 p) using 1 <;> |
| 176 | first | rfl | simp [E, D] |
| 177 | have hlower : Tendsto (fun q => (E q)⁻¹ * D q) (𝓝[Icc a b ×ˢ univ] p) |
| 178 | (𝓝 (((F.metric p.1).edist O p.2).toReal)) := by |
| 179 | convert ((hE.continuousAt.inv₀ (Real.exp_ne_zero _)).mul hD.continuousAt).tendsto.mono_left |
| 180 | (nhdsWithin_le_nhds : 𝓝[Icc a b ×ˢ univ] p ≤ 𝓝 p) using 1 <;> |
| 181 | first | rfl | simp [E, D] |
| 182 | apply tendsto_of_tendsto_of_tendsto_of_le_of_le' hlower hupper |
| 183 | · filter_upwards [self_mem_nhdsWithin, hnear.filter_mono nhdsWithin_le_nhds] with q hq hqy |
| 184 | apply (inv_mul_le_iff₀ (Real.exp_pos _)).mpr |
| 185 | simpa only [E, D, abs_sub_comm p.1 q.1] using |
| 186 | hcompare q.1 hq.1 p.1 hp.1 q.2 hqy |
| 187 | · filter_upwards [self_mem_nhdsWithin, hnear.filter_mono nhdsWithin_le_nhds] with q hq hqy |
| 188 | exact hcompare p.1 hp.1 q.1 hq.1 q.2 hqy |
| 189 | |
| 190 | /-- Joint continuity of distance from a fixed point under nonnegative |
| 191 | Ricci curvature, using the supplied curvature theory. -/ |
| 192 | theorem continuousOn_toReal_edist_of_ricci_nonneg |
| 193 | [T3Space M] [PreconnectedSpace M] |
| 194 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 195 | {a b : ℝ} (hJ : Icc a b ⊆ interior J) |
| 196 | (hcomplete : MetricComplete (F.metric b)) |
| 197 | (hRic : ∀ t ∈ Icc a b, ∀ x : M, ∀ v : TangentSpace (𝓡 n) x, |
| 198 | 0 ≤ (F.connection t).ricci x v v) |
| 199 | (O : M) : |
| 200 | ContinuousOn (fun p : ℝ × M => ((F.metric p.1).edist O p.2).toReal) |
| 201 | (Icc a b ×ˢ univ) := |
| 202 | continuousOn_toReal_edist_of_ricci_nonneg_aux F |
| 203 | (fun t => hC.tensor_calculus n M (F.metric t) (F.connection t)) hJ hcomplete hRic O |
| 204 | |
| 205 | /-- The intrinsic tensor calculus gives distance continuity without a |
| 206 | separate curvature-theory service. -/ |
| 207 | theorem continuousOn_toReal_edist_of_ricci_nonneg_intrinsic |
| 208 | [T3Space M] [PreconnectedSpace M] |
| 209 | (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) : |
| 215 | ContinuousOn (fun p : ℝ × M => ((F.metric p.1).edist O p.2).toReal) |
| 216 | (Icc a b ×ˢ univ) := |
| 217 | continuousOn_toReal_edist_of_ricci_nonneg_aux F |
| 218 | (fun t => (F.connection t).intrinsicCurvatureTensorCalculus) hJ hcomplete hRic O |
| 219 | |
| 220 | end PoincareMT.RicciFlow |