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.Analysis.Parabolic.LowerSupportComparison |
| 2 | import PoincareLib.Geometry.RicciFlow.Harnack.Noncompact.CurvatureControl.ScalarContactFinite |
| 3 | import PoincareLib.Geometry.RicciFlow.Harnack.Noncompact.CurvatureControl.Distance.FiniteContinuity |
| 4 | import PoincareLib.Geometry.Riemannian.Curvature.Scalar.Bounds |
| 5 | |
| 6 | /-! |
| 7 | # Distance-localized scalar comparison |
| 8 | |
| 9 | Nonnegative Ricci curvature confines the moving cutoff to a compact terminal |
| 10 | ball. The actual scalar contact supports and joint distance continuity then |
| 11 | give exponential comparison for the distance-localized scalar curvature. |
| 12 | The reviewed statement and proof are in `notes/scalar-localized-comparison.md`. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | set_option maxHeartbeats 800000 |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped Manifold ContDiff Topology Bundle |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.RicciFlow |
| 26 | |
| 27 | /-- A scalar upper bound on moving balls gives an exponential estimate for |
| 28 | scalar curvature multiplied by a smooth decreasing distance cutoff. -/ |
| 29 | theorem distance_cutoff_mul_scalarCurvature_le_exp_of_finite |
| 30 | {m : ℕ} {M : Type u} [TopologicalSpace M] [T3Space M] |
| 31 | [ChartedSpace (EuclideanSpace ℝ (Fin (m + 1))) M] |
| 32 | [IsManifold (𝓡 (m + 1)) ∞ M] {J : Set ℝ} |
| 33 | (hTheory : RicciFlowCurvatureTheory.{u}) (F : RicciFlow (m + 1) M J) |
| 34 | {a b δ d₀ Q U0 scale A B C : ℝ} |
| 35 | (hJ : Icc a b ⊆ interior J) (hm : 0 < m) |
| 36 | (hcomplete : ∀ t ∈ Icc a b, MetricComplete (F.metric t)) |
| 37 | (hRic : ∀ t ∈ Icc a b, ∀ x : M, |
| 38 | ∀ v : TangentSpace (𝓡 (m + 1)) x, 0 ≤ (F.connection t).ricci x v v) |
| 39 | (p : M) (hδ : 0 < δ) (hd₀ : 0 ≤ d₀) (hQ₀ : 0 < Q) |
| 40 | (hU0 : 0 ≤ U0) (hscale : 0 < scale) |
| 41 | {χ : ℝ → ℝ} (hχ : ContDiff ℝ ∞ χ) (hanti : Antitone χ) |
| 42 | (hχrange : ∀ z, χ z ∈ Icc (0 : ℝ) 1) |
| 43 | (hflat : ∀ z, z ≤ 1 → χ z = 1) |
| 44 | (hzero : ∀ z, 2 ≤ z → χ z = 0) |
| 45 | (hA₀ : 0 ≤ A) (hB₀ : 0 ≤ B) (hC₀ : 0 ≤ C) |
| 46 | (hA : ∀ z, deriv χ z ^ 2 ≤ A * χ z) |
| 47 | (hB : ∀ z, -B ≤ deriv (deriv χ) z) |
| 48 | (hC : ∀ z, -C ≤ deriv χ z) |
| 49 | (hQ : ∀ t ∈ Icc a b, ∀ x ∈ (F.metric t).ball p (d₀ + 2 * δ), |
| 50 | (F.connection t).scalarCurvature x ≤ Q) |
| 51 | (hinit : ∀ x ∈ (F.metric a).ball p (d₀ + 2 * δ), |
| 52 | (F.connection a).scalarCurvature x ≤ U0) : |
| 53 | let Aheat := C * (4 * ((m + 1 : ℕ) : ℝ) * scale + 8 * Q / scale) / δ + |
| 54 | (B + 2 * A + 2 * (m : ℝ) * C) / δ ^ 2 |
| 55 | ∀ t ∈ Icc a b, ∀ x : M, (F.metric t).edist p x ≠ ⊤ → |
| 56 | χ ((((F.metric t).edist p x).toReal - d₀) / δ) * |
| 57 | (F.connection t).scalarCurvature x ≤ |
| 58 | Real.exp (2 * Q * (t - a)) * (U0 + Aheat / 2) - Aheat / 2 := by |
| 59 | let H := C * (4 * ((m + 1 : ℕ) : ℝ) * scale + 8 * Q / scale) / δ + |
| 60 | (B + 2 * A + 2 * (m : ℝ) * C) / δ ^ 2 |
| 61 | change ∀ t ∈ Icc a b, ∀ x : M, (F.metric t).edist p x ≠ ⊤ → |
| 62 | _ ≤ Real.exp (2 * Q * (t - a)) * (U0 + H / 2) - H / 2 |
| 63 | intro t ht x hxfinite |
| 64 | have ha : a ∈ Icc a b := ⟨le_rfl, ht.1.trans ht.2⟩ |
| 65 | have hb : b ∈ Icc a b := ⟨ht.1.trans ht.2, le_rfl⟩ |
| 66 | have hH : 0 ≤ H := by dsimp only [H]; positivity |
| 67 | let r := d₀ + 2 * δ |
| 68 | have hr : 0 < r := by dsimp only [r]; positivity |
| 69 | let K : Set M := {y | (F.metric b).edist p y ≤ ENNReal.ofReal r} |
| 70 | let f : M → ℝ → ℝ := fun y s => |
| 71 | χ ((((F.metric s).edist p y).toReal - d₀) / δ) * (F.connection s).scalarCurvature y |
| 72 | have hR (s : ℝ) (hs : s ∈ Icc a b) (y : M) : |
| 73 | 0 ≤ (F.connection s).scalarCurvature y := |
| 74 | Finset.sum_nonneg (fun _ _ => hRic s hs y _) |
| 75 | have hmem (s : ℝ) (y : M) |
| 76 | (hyfinite : (F.metric s).edist p y ≠ ⊤) |
| 77 | (hne : χ ((((F.metric s).edist p y).toReal - d₀) / δ) ≠ 0) : |
| 78 | y ∈ (F.metric s).ball p r := by |
| 79 | have harg : (((F.metric s).edist p y).toReal - d₀) / δ < 2 := |
| 80 | lt_of_not_ge (fun hh => hne (hzero _ hh)) |
| 81 | have hdist : ((F.metric s).edist p y).toReal < r := by |
| 82 | have hh := (div_lt_iff₀ hδ).mp harg |
| 83 | dsimp only [r] |
| 84 | linarith |
| 85 | change (F.metric s).edist p y < ENNReal.ofReal r |
| 86 | rw [← ENNReal.ofReal_toReal hyfinite] |
| 87 | exact (ENNReal.ofReal_lt_ofReal_iff hr).mpr hdist |
| 88 | have hinto (s : ℝ) (hs : s ∈ Icc a b) : |
| 89 | (F.metric s).ball p r ⊆ (F.metric b).ball p r := |
| 90 | F.ball_subset_ball_of_ricci_nonneg hJ p r hs hb hs.2 |
| 91 | (fun τ hτ y _ v => hRic τ hτ y v) |
| 92 | have hballK : (F.metric b).ball p r ⊆ K := fun y hy => |
| 93 | (show (F.metric b).edist p y < ENNReal.ofReal r from hy).le |
| 94 | have hcompact : IsCompact K := |
| 95 | (F.metric b).isCompact_closedBall_of_metricComplete (hcomplete b hb) p r |
| 96 | let : CompactSpace K := isCompact_iff_compactSpace.mp hcompact |
| 97 | have hfiniteOn (s : ℝ) (hs : s ∈ Icc a b) (y : M) (hy : y ∈ K) : |
| 98 | (F.metric s).edist p y ≠ ⊤ := |
| 99 | F.edist_ne_top_of_terminal_of_ricci_nonneg hTheory ha.2 hJ (hcomplete b hb) |
| 100 | hRic p y (ne_top_of_le_ne_top ENNReal.ofReal_ne_top hy) hs |
| 101 | have hdistcont := F.continuousOn_toReal_edist_on_terminal_closedBall_of_ricci_nonneg |
| 102 | hTheory ha.2 hJ (hcomplete b hb) hRic p hr |
| 103 | have hscalarcont : ContinuousOn |
| 104 | (fun z : ℝ × M => (F.connection z.1).scalarCurvature z.2) (Icc a b ×ˢ univ) := |
| 105 | (hTheory.scalar_regular (m + 1) M J F).continuousOn.mono |
| 106 | (fun z hz => ⟨interior_subset (hJ hz.1), trivial⟩) |
| 107 | have hfcont : ContinuousOn (fun z : ℝ × M => f z.2 z.1) (Icc a b ×ˢ K) := |
| 108 | (hχ.continuous.comp_continuousOn |
| 109 | ((hdistcont.sub continuousOn_const).div_const δ)).mul |
| 110 | (hscalarcont.mono (Set.prod_mono Subset.rfl (subset_univ K))) |
| 111 | have hrestricted : ContinuousOn (fun z : K × ℝ => f z.1 z.2) (univ ×ˢ Icc a b) := |
| 112 | hfcont.comp |
| 113 | ((continuous_snd.prodMk (continuous_subtype_val.comp continuous_fst)).continuousOn) |
| 114 | (fun z hz => ⟨hz.2, z.1.property⟩) |
| 115 | have hinitK (y : K) : f y a ≤ U0 := by |
| 116 | by_cases hz : χ ((((F.metric a).edist p y).toReal - d₀) / δ) = 0 |
| 117 | · simpa only [f, hz, zero_mul] using hU0 |
| 118 | · exact (mul_le_of_le_one_left (hR a ha y) (hχrange _).2).trans |
| 119 | (hinit y (hmem a y (hfiniteOn a ha y y.property) hz)) |
| 120 | have hcompare := Poincare.Parabolic.le_exp_of_lower_support_deriv_le |
| 121 | (u := fun y : K => f y) (K := 2 * Q) (B := Q * H) (by positivity) |
| 122 | (mul_nonneg hQ₀.le hH) hU0 hrestricted hinitK (by |
| 123 | intro rate q s _ hs hpos hmax |
| 124 | have hs' : s ∈ Icc a b := ⟨hs.1.le, hs.2⟩ |
| 125 | have hqball : (q : M) ∈ (F.metric s).ball p r := |
| 126 | hmem s q (hfiniteOn s hs' q q.property) (by |
| 127 | intro hz |
| 128 | simp only [f, hz, zero_mul, lt_self_iff_false] at hpos) |
| 129 | have hqterminal := hinto s hs' hqball |
| 130 | have hopen : IsOpen ((F.metric b).ball p r) := by |
| 131 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 (m + 1)) : M → Type _) := |
| 132 | ⟨(F.metric b).toRiemannianMetric⟩ |
| 133 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin (m + 1))) |
| 134 | (TangentSpace (𝓡 (m + 1)) : M → Type _) := |
| 135 | ⟨⟨(F.metric b).inner, (F.metric b).toContinuousRiemannianMetric.continuous, |
| 136 | fun _ _ _ => rfl⟩⟩ |
| 137 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 (m + 1)) M |
| 138 | change IsOpen {y : M | edist p y < ENNReal.ofReal r} |
| 139 | exact isOpen_lt (continuous_const.edist continuous_id) continuous_const |
| 140 | have hnear : ∀ᶠ y in 𝓝 (q : M), y ∈ (F.metric b).ball p r := |
| 141 | hopen.mem_nhds hqterminal |
| 142 | have hlocal : IsLocalMax (fun y => f y s) (q : M) := by |
| 143 | filter_upwards [hnear] with y hyball |
| 144 | have hweighted := hmax (a := (⟨y, hballK hyball⟩, s)) ⟨trivial, hs'⟩ |
| 145 | have hunweighted := (mul_le_mul_iff_right₀ |
| 146 | (Real.exp_pos (-rate * (s - a)))).mp hweighted |
| 147 | linarith |
| 148 | have hupper : ∀ y ∈ (F.metric s).ball p r, |
| 149 | ∀ v : TangentSpace (𝓡 (m + 1)) y, |
| 150 | (F.connection s).ricci y v v ≤ Q * (F.metric s).inner y v v := by |
| 151 | intro y hy v |
| 152 | exact ((F.connection s).ricci_le_scalarCurvature_mul_inner_of_nonneg |
| 153 | y (hRic s hs' y) v).trans |
| 154 | (mul_le_mul_of_nonneg_right (hQ s hs' y hy) (by |
| 155 | by_cases hv : v = 0 |
| 156 | · simp only [hv, map_zero] |
| 157 | exact le_rfl |
| 158 | · exact ((F.metric s).pos y v hv).le)) |
| 159 | exact F.exists_lower_time_support_distance_cutoff_scalarCurvature_all_points_of_finite |
| 160 | hTheory (hJ hs') hm (hcomplete s hs') (hRic s hs') hQ₀.le hscale p q |
| 161 | hqball hupper (fun τ hτ v => hRic τ ⟨hτ.1, hτ.2.trans hs.2⟩ q v) |
| 162 | hχ hanti (fun z => (hχrange z).1) hδ hflat hd₀ hA₀ hB₀ hC₀ hA hB hC |
| 163 | (hQ s hs' q hqball) hpos hlocal) |
| 164 | have hdivide : Q * H / (2 * Q) = H / 2 := by field_simp |
| 165 | by_cases hx : x ∈ K |
| 166 | · simpa only [hdivide] using hcompare ⟨x, hx⟩ t ht |
| 167 | · have hzeroAt : χ ((((F.metric t).edist p x).toReal - d₀) / δ) = 0 := by |
| 168 | by_contra hne |
| 169 | exact hx (hballK (hinto t ht (hmem t x hxfinite hne))) |
| 170 | rw [hzeroAt, zero_mul] |
| 171 | have hexp : 1 ≤ Real.exp (2 * Q * (t - a)) := |
| 172 | Real.one_le_exp_iff.mpr (mul_nonneg (by positivity) (sub_nonneg.mpr ht.1)) |
| 173 | nlinarith [mul_nonneg (sub_nonneg.mpr hexp) (show 0 ≤ U0 + H / 2 by positivity)] |
| 174 | |
| 175 | /-- On a connected manifold the finite-distance scalar comparison applies at |
| 176 | every point. -/ |
| 177 | theorem distance_cutoff_mul_scalarCurvature_le_exp |
| 178 | {m : ℕ} {M : Type u} [TopologicalSpace M] [T3Space M] [ConnectedSpace M] |
| 179 | [ChartedSpace (EuclideanSpace ℝ (Fin (m + 1))) M] |
| 180 | [IsManifold (𝓡 (m + 1)) ∞ M] {J : Set ℝ} |
| 181 | (hTheory : RicciFlowCurvatureTheory.{u}) (F : RicciFlow (m + 1) M J) |
| 182 | {a b δ d₀ Q U0 scale A B C : ℝ} |
| 183 | (hJ : Icc a b ⊆ interior J) (hm : 0 < m) |
| 184 | (hcomplete : ∀ t ∈ Icc a b, MetricComplete (F.metric t)) |
| 185 | (hRic : ∀ t ∈ Icc a b, ∀ x : M, |
| 186 | ∀ v : TangentSpace (𝓡 (m + 1)) x, 0 ≤ (F.connection t).ricci x v v) |
| 187 | (p : M) (hδ : 0 < δ) (hd₀ : 0 ≤ d₀) (hQ₀ : 0 < Q) |
| 188 | (hU0 : 0 ≤ U0) (hscale : 0 < scale) |
| 189 | {χ : ℝ → ℝ} (hχ : ContDiff ℝ ∞ χ) (hanti : Antitone χ) |
| 190 | (hχrange : ∀ z, χ z ∈ Icc (0 : ℝ) 1) |
| 191 | (hflat : ∀ z, z ≤ 1 → χ z = 1) |
| 192 | (hzero : ∀ z, 2 ≤ z → χ z = 0) |
| 193 | (hA₀ : 0 ≤ A) (hB₀ : 0 ≤ B) (hC₀ : 0 ≤ C) |
| 194 | (hA : ∀ z, deriv χ z ^ 2 ≤ A * χ z) |
| 195 | (hB : ∀ z, -B ≤ deriv (deriv χ) z) |
| 196 | (hC : ∀ z, -C ≤ deriv χ z) |
| 197 | (hQ : ∀ t ∈ Icc a b, ∀ x ∈ (F.metric t).ball p (d₀ + 2 * δ), |
| 198 | (F.connection t).scalarCurvature x ≤ Q) |
| 199 | (hinit : ∀ x ∈ (F.metric a).ball p (d₀ + 2 * δ), |
| 200 | (F.connection a).scalarCurvature x ≤ U0) : |
| 201 | let Aheat := C * (4 * ((m + 1 : ℕ) : ℝ) * scale + 8 * Q / scale) / δ + |
| 202 | (B + 2 * A + 2 * (m : ℝ) * C) / δ ^ 2 |
| 203 | ∀ t ∈ Icc a b, ∀ x : M, |
| 204 | χ ((((F.metric t).edist p x).toReal - d₀) / δ) * |
| 205 | (F.connection t).scalarCurvature x ≤ |
| 206 | Real.exp (2 * Q * (t - a)) * (U0 + Aheat / 2) - Aheat / 2 := by |
| 207 | dsimp only |
| 208 | intro t ht x |
| 209 | exact F.distance_cutoff_mul_scalarCurvature_le_exp_of_finite hTheory hJ hm hcomplete |
| 210 | hRic p hδ hd₀ hQ₀ hU0 hscale hχ hanti hχrange hflat hzero hA₀ hB₀ hC₀ |
| 211 | hA hB hC hQ hinit t ht x ((F.metric t).edist_ne_top p x) |
| 212 | |
| 213 | end PoincareMT.RicciFlow |