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.Surgery.StandardCap.Uniqueness.TerminalBlowup.ScalarReciprocalGradient |
| 2 | import PoincareLib.Geometry.Riemannian.Measure.HausdorffDensity.LocalDistance |
| 3 | import Mathlib.Topology.Order.IntermediateValue |
| 4 | |
| 5 | /-! |
| 6 | # Guarded scalar control on an actual spatial ball |
| 7 | |
| 8 | Morgan--Tian Lemma 11.2, pp. 268-269, used on p. 393. |
| 9 | Between the last lower-threshold crossing and the first upper-threshold |
| 10 | crossing of a short actual metric path, the canonical gradient bound is |
| 11 | available at every differentiated point. Integration rules out the |
| 12 | crossing. No globally positive scalar or completeness is assumed. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | -- The distance theorem uses the actual metric norm and the real tangent fiber. |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Manifold |
| 20 | open scoped Manifold ContDiff Bundle ENNReal NNReal Topology |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.Proofs.M46 |
| 25 | |
| 26 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 27 | normedSpaceTangentSpaceVectorSpace |
| 28 | |
| 29 | variable {M : Type u} [TopologicalSpace M] |
| 30 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 31 | |
| 32 | private theorem scalar_edist_le_length |
| 33 | (g : RiemannianMetric 3 M) (D : LeviCivitaData g) |
| 34 | (hreg : ContMDiff (𝓡 3) (𝓘(ℝ, ℝ)) ∞ D.scalarCurvature) |
| 35 | {a b K : ℝ} (hab : a ≤ b) (hK : 0 ≤ K) |
| 36 | {gamma : ℝ → M} (hgamma : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 3) 1 gamma (Icc a b)) |
| 37 | (hgrad : ∀ s ∈ Icc a b, ∀ v : TangentSpace (𝓡 3) (gamma s), |
| 38 | g.inner (gamma s) v v = 1 → |
| 39 | |mvfderiv (𝓡 3) D.scalarCurvature (gamma s) v| ≤ K) : |
| 40 | edist (D.scalarCurvature (gamma a)) (D.scalarCurvature (gamma b)) ≤ |
| 41 | ENNReal.ofReal K * g.pathELength gamma a b := by |
| 42 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 43 | ⟨g.toRiemannianMetric⟩ |
| 44 | let r : ℝ →ᴬ[ℝ] ℝ := ContinuousAffineMap.lineMap a b |
| 45 | have hrange : MapsTo r (Icc 0 1) (Icc a b) := by |
| 46 | rw [mapsTo_iff_image_subset, show (r : ℝ → ℝ) = AffineMap.lineMap a b from rfl, |
| 47 | ← segment_eq_image_lineMap, segment_eq_Icc hab] |
| 48 | have hcomp : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 3) 1 (gamma ∘ r) (Icc 0 1) := |
| 49 | hgamma.comp r.contDiff.contMDiff.contMDiffOn hrange |
| 50 | have hlength : g.pathELength (gamma ∘ r) 0 1 = g.pathELength gamma a b := by |
| 51 | change Manifold.pathELength (𝓡 3) (gamma ∘ r) 0 1 = |
| 52 | Manifold.pathELength (𝓡 3) gamma a b |
| 53 | have h := Manifold.pathELength_comp_of_monotoneOn (I := 𝓡 3) |
| 54 | (γ := gamma) (f := r) zero_le_one |
| 55 | ((AffineMap.lineMap_mono hab).monotoneOn (Icc 0 1)) r.differentiableOn |
| 56 | (by simpa [r, ContinuousAffineMap.coe_lineMap_eq] using |
| 57 | hgamma.mdifferentiableOn one_ne_zero) |
| 58 | simpa [r, ContinuousAffineMap.coe_lineMap_eq] using h |
| 59 | have hnorm (z : M) (hz : z ∈ gamma '' Icc a b) : |
| 60 | ‖mfderiv (𝓡 3) (𝓘(ℝ, ℝ)) D.scalarCurvature z‖ ≤ K := by |
| 61 | obtain ⟨s, hs, rfl⟩ := hz |
| 62 | apply ContinuousLinearMap.opNorm_le_bound _ hK |
| 63 | intro v |
| 64 | have h := D.scalar_directional_bound_of_unit_bound (gamma s) (hgrad s hs) v |
| 65 | have hv : g.tangentNorm (gamma s) v = ‖v‖ := by |
| 66 | rw [norm_eq_sqrt_real_inner] |
| 67 | rfl |
| 68 | have hn : ‖mfderiv (𝓡 3) (𝓘(ℝ, ℝ)) D.scalarCurvature (gamma s) v‖ = |
| 69 | |mvfderiv (𝓡 3) D.scalarCurvature (gamma s) v| := by |
| 70 | change ‖mvfderiv (𝓡 3) D.scalarCurvature (gamma s) v‖ = _ |
| 71 | exact Real.norm_eq_abs _ |
| 72 | rw [hn] |
| 73 | simpa only [hv] using h |
| 74 | let K' : ℝ≥0 := ⟨K, hK⟩ |
| 75 | have hKcoe : (K' : ℝ≥0∞) = ENNReal.ofReal K := ENNReal.coe_nnreal_eq K' |
| 76 | have hbound (z : M) (hz : z ∈ gamma '' Icc a b) : |
| 77 | ‖mfderiv (𝓡 3) (𝓘(ℝ, ℝ)) D.scalarCurvature z‖ₑ ≤ (K' : ℝ≥0∞) := by |
| 78 | rw [hKcoe, ← ofReal_norm] |
| 79 | exact ENNReal.ofReal_le_ofReal (hnorm z hz) |
| 80 | have h := Poincare.edist_le_mul_pathELength_of_mfderiv_le |
| 81 | (fun z (_hz : z ∈ gamma '' Icc a b) => (hreg z).of_le (by simp)) hbound hcomp |
| 82 | (fun s hs => ⟨r s, hrange hs, rfl⟩) |
| 83 | change edist (D.scalarCurvature (gamma (r 0))) (D.scalarCurvature (gamma (r 1))) ≤ |
| 84 | (K' : ℝ≥0∞) * g.pathELength (gamma ∘ r) 0 1 at h |
| 85 | rw [hlength, hKcoe] at h |
| 86 | simpa only [r, ContinuousAffineMap.coe_lineMap_eq, AffineMap.lineMap_apply_zero, |
| 87 | AffineMap.lineMap_apply_one] using h |
| 88 | |
| 89 | /-- An actual spatial ball has scalar at most twice the center threshold. |
| 90 | The gradient assumption is needed only within that ball and above the |
| 91 | threshold, Lemma 11.2, pp. 268-269. -/ |
| 92 | theorem scalar_le_two_inv_sq_on_ball |
| 93 | (g : RiemannianMetric 3 M) (D : LeviCivitaData g) |
| 94 | (hreg : ContMDiff (𝓡 3) (𝓘(ℝ, ℝ)) ∞ D.scalarCurvature) |
| 95 | {B r : ℝ} (hB : 0 < B) (hr : 0 < r) (x : M) |
| 96 | (hcenter : D.scalarCurvature x ≤ r⁻¹ ^ 2) |
| 97 | (hgrad : ∀ z ∈ g.ball x (r / (8 * B)), r⁻¹ ^ 2 ≤ D.scalarCurvature z → |
| 98 | ∀ v : TangentSpace (𝓡 3) z, g.inner z v v = 1 → |
| 99 | |mvfderiv (𝓡 3) D.scalarCurvature z v| ≤ |
| 100 | B * D.scalarCurvature z ^ (3 / 2 : ℝ)) : |
| 101 | ∀ y ∈ g.ball x (r / (8 * B)), D.scalarCurvature y ≤ 2 * r⁻¹ ^ 2 := by |
| 102 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 103 | ⟨g.toRiemannianMetric⟩ |
| 104 | intro y hy |
| 105 | by_contra hbad |
| 106 | have hhigh : 2 * r⁻¹ ^ 2 < D.scalarCurvature y := lt_of_not_ge hbad |
| 107 | have hq : 0 < r⁻¹ := inv_pos.mpr hr |
| 108 | have hq2 : 0 < r⁻¹ ^ 2 := sq_pos_of_pos hq |
| 109 | obtain ⟨gamma, hzero, hone, hgamma, hlength⟩ := |
| 110 | Manifold.exists_lt_of_riemannianEDist_lt hy |
| 111 | let f (s : ℝ) := D.scalarCurvature (gamma s) |
| 112 | have hcont : ContinuousOn f (Icc 0 1) := |
| 113 | hreg.continuous.comp_continuousOn hgamma.continuousOn |
| 114 | have hball (s : ℝ) (hs : s ∈ Icc 0 1) : gamma s ∈ g.ball x (r / (8 * B)) := by |
| 115 | exact ((Manifold.riemannianEDist_le_pathELength |
| 116 | (hgamma.mono (Icc_subset_Icc le_rfl hs.2)) hzero rfl hs.1).trans |
| 117 | (Manifold.pathELength_mono le_rfl hs.2)).trans_lt hlength |
| 118 | have hupperClosed : IsClosed (Icc (0 : ℝ) 1 ∩ f ⁻¹' Ici (2 * r⁻¹ ^ 2)) := |
| 119 | hcont.preimage_isClosed_of_isClosed isClosed_Icc isClosed_Ici |
| 120 | obtain ⟨b, hb, hfirst⟩ := |
| 121 | (isCompact_Icc.of_isClosed_subset hupperClosed inter_subset_left).exists_isLeast |
| 122 | ⟨1, ⟨⟨zero_le_one, le_rfl⟩, by |
| 123 | change 2 * r⁻¹ ^ 2 ≤ f 1 |
| 124 | simpa only [f, hone] using hhigh.le⟩⟩ |
| 125 | have hbpos : 0 < b := by |
| 126 | apply lt_of_le_of_ne hb.1.1 |
| 127 | intro heq |
| 128 | have h : 2 * r⁻¹ ^ 2 ≤ f b := hb.2 |
| 129 | rw [← heq, show f 0 = D.scalarCurvature x by simp only [f, hzero]] at h |
| 130 | linarith |
| 131 | have hbvalue : f b = 2 * r⁻¹ ^ 2 := by |
| 132 | obtain ⟨s, hs, hfs⟩ := intermediate_value_Icc hbpos.le |
| 133 | (hcont.mono (Icc_subset_Icc le_rfl hb.1.2)) |
| 134 | ⟨by simpa only [f, hzero] using hcenter.trans (by linarith : r⁻¹ ^ 2 ≤ 2 * r⁻¹ ^ 2), |
| 135 | hb.2⟩ |
| 136 | have hbs : b ≤ s := hfirst ⟨⟨hs.1, hs.2.trans hb.1.2⟩, hfs.ge⟩ |
| 137 | simpa only [le_antisymm hbs hs.2] using hfs |
| 138 | have hlowerClosed : IsClosed (Icc (0 : ℝ) b ∩ f ⁻¹' Iic (r⁻¹ ^ 2)) := |
| 139 | (hcont.mono (Icc_subset_Icc le_rfl hb.1.2)).preimage_isClosed_of_isClosed |
| 140 | isClosed_Icc isClosed_Iic |
| 141 | obtain ⟨a, ha, hlast⟩ := |
| 142 | (isCompact_Icc.of_isClosed_subset hlowerClosed inter_subset_left).exists_isGreatest |
| 143 | ⟨0, ⟨⟨le_rfl, hbpos.le⟩, by |
| 144 | change f 0 ≤ r⁻¹ ^ 2 |
| 145 | simpa only [f, hzero] using hcenter⟩⟩ |
| 146 | have hab : a < b := by |
| 147 | apply lt_of_le_of_ne ha.1.2 |
| 148 | intro heq |
| 149 | have h : f a ≤ r⁻¹ ^ 2 := ha.2 |
| 150 | rw [heq, hbvalue] at h |
| 151 | linarith |
| 152 | have havalue : f a = r⁻¹ ^ 2 := by |
| 153 | obtain ⟨s, hs, hfs⟩ := intermediate_value_Icc hab.le |
| 154 | (hcont.mono (Icc_subset_Icc ha.1.1 hb.1.2)) |
| 155 | ⟨ha.2, by rw [hbvalue]; linarith⟩ |
| 156 | have hsa : s ≤ a := hlast ⟨⟨ha.1.1.trans hs.1, hs.2⟩, hfs.le⟩ |
| 157 | simpa only [le_antisymm hsa hs.1] using hfs |
| 158 | have hband (s : ℝ) (hs : s ∈ Icc a b) : r⁻¹ ^ 2 ≤ f s ∧ f s ≤ 2 * r⁻¹ ^ 2 := by |
| 159 | constructor |
| 160 | · by_cases hsa : s = a |
| 161 | · simp only [hsa, havalue, le_refl] |
| 162 | have has : a < s := lt_of_le_of_ne hs.1 (Ne.symm hsa) |
| 163 | by_contra hlo |
| 164 | exact not_le_of_gt has (hlast ⟨⟨ha.1.1.trans hs.1, hs.2⟩, (lt_of_not_ge hlo).le⟩) |
| 165 | · by_cases hsb : s = b |
| 166 | · simp only [hsb, hbvalue, le_refl] |
| 167 | have hsb' : s < b := lt_of_le_of_ne hs.2 hsb |
| 168 | by_contra hhi |
| 169 | exact not_le_of_gt hsb' |
| 170 | (hfirst ⟨⟨ha.1.1.trans hs.1, hs.2.trans hb.1.2⟩, (lt_of_not_ge hhi).le⟩) |
| 171 | have hdiff (s : ℝ) (hs : s ∈ Icc a b) |
| 172 | (v : TangentSpace (𝓡 3) (gamma s)) (hv : g.inner (gamma s) v v = 1) : |
| 173 | |mvfderiv (𝓡 3) D.scalarCurvature (gamma s) v| ≤ 4 * B * r⁻¹ ^ 3 := by |
| 174 | obtain ⟨hlo, hhi⟩ := hband s hs |
| 175 | have hfpos : 0 < f s := hq2.trans_le hlo |
| 176 | have hsqrt : Real.sqrt (f s) ≤ 2 * r⁻¹ := |
| 177 | (Real.sqrt_le_iff).mpr ⟨by positivity, by nlinarith [sq_nonneg r⁻¹]⟩ |
| 178 | have hp : f s ^ (3 / 2 : ℝ) ≤ 4 * r⁻¹ ^ 3 := by |
| 179 | rw [show (3 / 2 : ℝ) = 1 + (1 / 2 : ℝ) by norm_num, |
| 180 | Real.rpow_add hfpos, Real.rpow_one, ← Real.sqrt_eq_rpow] |
| 181 | have h := mul_le_mul hhi hsqrt (Real.sqrt_nonneg _) (by positivity : 0 ≤ 2 * r⁻¹ ^ 2) |
| 182 | nlinarith |
| 183 | have h := (hgrad (gamma s) (hball s ⟨ha.1.1.trans hs.1, hs.2.trans hb.1.2⟩) |
| 184 | hlo v hv).trans (mul_le_mul_of_nonneg_left hp hB.le) |
| 185 | nlinarith |
| 186 | have hdist := scalar_edist_le_length g D hreg hab.le (by positivity : 0 ≤ 4 * B * r⁻¹ ^ 3) |
| 187 | (hgamma.mono (Icc_subset_Icc ha.1.1 hb.1.2)) hdiff |
| 188 | change edist (f a) (f b) ≤ _ at hdist |
| 189 | rw [havalue, hbvalue] at hdist |
| 190 | have hmono : g.pathELength gamma a b ≤ g.pathELength gamma 0 1 := |
| 191 | Manifold.pathELength_mono ha.1.1 hb.1.2 |
| 192 | have hstrict := ENNReal.mul_lt_mul_right |
| 193 | (ne_of_gt (ENNReal.ofReal_pos.mpr (by positivity : 0 < 4 * B * r⁻¹ ^ 3))) |
| 194 | ENNReal.ofReal_ne_top hlength |
| 195 | have heq : ENNReal.ofReal (4 * B * r⁻¹ ^ 3) * ENNReal.ofReal (r / (8 * B)) = |
| 196 | ENNReal.ofReal (r⁻¹ ^ 2 / 2) := by |
| 197 | rw [← ENNReal.ofReal_mul (by positivity : 0 ≤ 4 * B * r⁻¹ ^ 3)] |
| 198 | congr 1 |
| 199 | field_simp |
| 200 | ring |
| 201 | have hsmall := (hdist.trans (mul_le_mul_right hmono _)).trans_lt (hstrict.trans_eq heq) |
| 202 | rw [edist_dist, Real.dist_eq, show r⁻¹ ^ 2 - 2 * r⁻¹ ^ 2 = -(r⁻¹ ^ 2) by ring, |
| 203 | abs_neg, abs_of_pos hq2] at hsmall |
| 204 | have hsmallReal := (ENNReal.ofReal_lt_ofReal_iff (by positivity : 0 < r⁻¹ ^ 2 / 2)).mp hsmall |
| 205 | linarith |
| 206 | |
| 207 | end PoincareMT.Proofs.M46 |