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.Generalized.BoundedDistance.GeometryImports |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.NeckGeometry.NeckCenterConnector |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.CapGeometry.CapCoreConnector |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderUniformScalar |
| 5 | |
| 6 | /-! |
| 7 | # Actual selected endpoint recentering |
| 8 | |
| 9 | Claim 10.3, pp. 248-249, and Appendix A.1-A.2, pp. 497-498. Original |
| 10 | endpoint membership in an actual selected neck or cap produces actual |
| 11 | paths in both orientations, scalar readouts and the common connector |
| 12 | budget. No connector, selected-center identity or target scalar estimate |
| 13 | is an input. See the M28 claim10_4 endpoint-recentering derivation. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open Set |
| 20 | open scoped Manifold ContDiff Topology ENNReal Bundle |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.M28 |
| 25 | |
| 26 | /-- The shared connector constant is fixed by epsilon and C before the |
| 27 | geometry (Claim 10.3; M28 endpoint-recentering derivation). -/ |
| 28 | def endpointConnectorBudget (epsilon C : ℝ) : ℝ := |
| 29 | max C 2 + 8 * standardSpherePathCeiling + 4 / epsilon |
| 30 | |
| 31 | /-- The shared connector budget is positive for the actual positive |
| 32 | epsilon (Claim 10.3; M28 endpoint-recentering derivation). -/ |
| 33 | theorem endpointConnectorBudget_pos {epsilon C : ℝ} (hepsilon : 0 < epsilon) : |
| 34 | 0 < endpointConnectorBudget epsilon C := by |
| 35 | have hB : 0 < max C 2 := lt_of_lt_of_le (by norm_num) (le_max_right C 2) |
| 36 | have hL := standardSpherePathCeiling_pos |
| 37 | have hfrac : 0 < 4 / epsilon := div_pos (by norm_num) hepsilon |
| 38 | unfold endpointConnectorBudget |
| 39 | linarith |
| 40 | |
| 41 | private theorem source_endpoint_scalar_lower {C Q R : ℝ} (hQ : 0 < Q) |
| 42 | (hsource : R = 8 * Q ∨ 32 * (max C 2) ^ 4 * Q < R) : 8 * Q ≤ R := by |
| 43 | rcases hsource with hlow | hhigh |
| 44 | · rw [hlow] |
| 45 | · have hB : 2 ≤ max C 2 := le_max_right C 2 |
| 46 | have hsq : 1 ≤ (max C 2) ^ 2 := by |
| 47 | nlinarith only [sq_nonneg (max C 2 - 1), hB] |
| 48 | have hpow : 1 ≤ (max C 2) ^ 4 := by |
| 49 | nlinarith only [sq_nonneg ((max C 2) ^ 2 - 1), hsq] |
| 50 | have hcoeff : (8 : ℝ) ≤ 32 * (max C 2) ^ 4 := by nlinarith only [hpow] |
| 51 | exact (mul_le_mul_of_nonneg_right hcoeff hQ.le).trans hhigh.le |
| 52 | |
| 53 | private theorem endpoint_scalar_readouts {C Q R S : ℝ} |
| 54 | (hupper : S ≤ max C 2 * R) (hlower : R ≤ max C 2 * S) : |
| 55 | (R = 8 * Q → S ≤ 8 * max C 2 * Q) ∧ |
| 56 | (32 * (max C 2) ^ 4 * Q < R → 32 * (max C 2) ^ 3 * Q < S) := by |
| 57 | constructor |
| 58 | · intro hR |
| 59 | calc |
| 60 | S ≤ max C 2 * R := hupper |
| 61 | _ = 8 * max C 2 * Q := by rw [hR]; ring |
| 62 | · intro hR |
| 63 | have hB : 0 < max C 2 := lt_of_lt_of_le (by norm_num) (le_max_right C 2) |
| 64 | apply (mul_lt_mul_iff_right₀ hB).mp |
| 65 | calc |
| 66 | max C 2 * (32 * (max C 2) ^ 3 * Q) = 32 * (max C 2) ^ 4 * Q := by ring |
| 67 | _ < R := hR |
| 68 | _ ≤ max C 2 * S := hlower |
| 69 | |
| 70 | private theorem exists_reverse_unit_connector |
| 71 | {M : Type u} [TopologicalSpace M] |
| 72 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 73 | [IsManifold (𝓡 3) ∞ M] (g : RiemannianMetric 3 M) |
| 74 | {U : Set M} {γ : ℝ → M} |
| 75 | (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 γ (Icc (0 : ℝ) 1)) |
| 76 | (hγU : MapsTo γ (Icc (0 : ℝ) 1) U) : |
| 77 | ∃ δ : ℝ → M, δ 0 = γ 1 ∧ δ 1 = γ 0 ∧ |
| 78 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 δ (Icc (0 : ℝ) 1) ∧ |
| 79 | MapsTo δ (Icc (0 : ℝ) 1) U ∧ |
| 80 | g.pathELength δ 0 1 = g.pathELength γ 0 1 := by |
| 81 | have hreverse : MapsTo (fun t : ℝ => 1 - t) (Icc (0 : ℝ) 1) (Icc (0 : ℝ) 1) := by |
| 82 | intro t ht |
| 83 | constructor <;> linarith only [ht.1, ht.2] |
| 84 | have hsmooth : ContMDiff 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) 1 (fun t : ℝ => 1 - t) := |
| 85 | contMDiff_const.sub contMDiff_id |
| 86 | refine ⟨γ ∘ (fun t : ℝ => 1 - t), by simp, by simp, |
| 87 | hγ.comp hsmooth.contMDiffOn hreverse, hγU.comp hreverse, ?_⟩ |
| 88 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 89 | ⟨g.toRiemannianMetric⟩ |
| 90 | change Manifold.pathELength (𝓡 3) (γ ∘ (fun t : ℝ => 1 - t)) 0 1 = |
| 91 | Manifold.pathELength (𝓡 3) γ 0 1 |
| 92 | simpa only [sub_self, sub_zero] using |
| 93 | (Manifold.pathELength_comp_of_antitoneOn (I := 𝓡 3) (γ := γ) |
| 94 | (f := fun t : ℝ => 1 - t) zero_le_one |
| 95 | (fun _ _ _ _ h => sub_le_sub_left h 1) |
| 96 | ((differentiable_const (1 : ℝ)).sub differentiable_id).differentiableOn |
| 97 | (by simpa only [sub_self, sub_zero] using hγ.mdifferentiableOn one_ne_zero)) |
| 98 | |
| 99 | /-- One universal A.2 accuracy produces both actual neck-center connector |
| 100 | orientations, scale control and adjusted endpoint scalar bounds. The C0 |
| 101 | path constructor needs no separate accuracy choice (Claim 10.3 and A.1-A.2). -/ |
| 102 | theorem exists_neck_endpoint_recentering_accuracy : |
| 103 | ∃ epsilon₀ : ℝ, 0 < epsilon₀ ∧ epsilon₀ ≤ (1 / 200 : ℝ) ∧ |
| 104 | ∀ (epsilon C : ℝ), 0 < epsilon → epsilon ≤ epsilon₀ → |
| 105 | ∀ (M : Type u) [TopologicalSpace M] |
| 106 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 107 | [IsManifold (𝓡 3) ∞ M] [T2Space M] |
| 108 | (g : RiemannianMetric 3 M) (D : LeviCivitaData g) |
| 109 | (N : EpsilonNeck g) (Q : ℝ) (p : M), |
| 110 | 0 < Q → N.epsilon = epsilon → p ∈ N.carrier → |
| 111 | (D.scalarCurvature p = 8 * Q ∨ |
| 112 | 32 * (max C 2) ^ 4 * Q < D.scalarCurvature p) → |
| 113 | 0 < D.scalarCurvature N.center ∧ |
| 114 | D.scalarCurvature N.center ≤ max C 2 * D.scalarCurvature p ∧ |
| 115 | D.scalarCurvature p ≤ max C 2 * D.scalarCurvature N.center ∧ |
| 116 | N.scale ≤ Q ^ (-1 / 2 : ℝ) ∧ |
| 117 | (D.scalarCurvature p = 8 * Q → |
| 118 | D.scalarCurvature N.center ≤ 8 * max C 2 * Q) ∧ |
| 119 | (32 * (max C 2) ^ 4 * Q < D.scalarCurvature p → |
| 120 | 32 * (max C 2) ^ 3 * Q < D.scalarCurvature N.center) ∧ |
| 121 | (∃ γ : ℝ → M, γ 0 = p ∧ γ 1 = N.center ∧ |
| 122 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 γ (Icc (0 : ℝ) 1) ∧ |
| 123 | MapsTo γ (Icc (0 : ℝ) 1) N.carrier ∧ |
| 124 | g.pathELength γ 0 1 < |
| 125 | ENNReal.ofReal (endpointConnectorBudget epsilon C * Q ^ (-1 / 2 : ℝ))) ∧ |
| 126 | (∃ γ : ℝ → M, γ 0 = N.center ∧ γ 1 = p ∧ |
| 127 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 γ (Icc (0 : ℝ) 1) ∧ |
| 128 | MapsTo γ (Icc (0 : ℝ) 1) N.carrier ∧ |
| 129 | g.pathELength γ 0 1 < |
| 130 | ENNReal.ofReal (endpointConnectorBudget epsilon C * Q ^ (-1 / 2 : ℝ))) := by |
| 131 | obtain ⟨epsilon₀, hpos, hsmall, hratio⟩ := |
| 132 | tube.exists_cylinder_scalar_ratio_accuracy.{u} |
| 133 | refine ⟨epsilon₀, hpos, hsmall, ?_⟩ |
| 134 | intro epsilon C hepsilon hsmall' M _ _ _ _ g D N Q p hQ hNepsilon hp hsource |
| 135 | have hP := source_endpoint_scalar_lower hQ hsource |
| 136 | have hPpos : 0 < D.scalarCurvature p := by linarith only [hP, hQ] |
| 137 | have hc : N.center ∈ N.carrier := N.central_sphere_subset N.center_on_central_sphere |
| 138 | have hcpos : 0 < D.scalarCurvature N.center := by |
| 139 | rw [← N.connection.scalarCurvature_eq_m28 D N.center] |
| 140 | exact N.scalar_center_pos |
| 141 | have hNsmall : N.epsilon ≤ epsilon₀ := hNepsilon ▸ hsmall' |
| 142 | have hcenter := hratio M g D N hNsmall N.center hc p hp |
| 143 | have hpoint := hratio M g D N hNsmall p hp N.center hc |
| 144 | have hupper : D.scalarCurvature N.center ≤ max C 2 * D.scalarCurvature p := |
| 145 | hcenter.trans (mul_le_mul_of_nonneg_right (le_max_right C 2) hPpos.le) |
| 146 | have hlower : D.scalarCurvature p ≤ max C 2 * D.scalarCurvature N.center := |
| 147 | hpoint.trans (mul_le_mul_of_nonneg_right (le_max_right C 2) hcpos.le) |
| 148 | have hQcenter : Q ≤ D.scalarCurvature N.center := by |
| 149 | linarith only [hQ, hP, hpoint] |
| 150 | have hscale : N.scale ≤ Q ^ (-1 / 2 : ℝ) := by |
| 151 | rw [N.scale_eq_scalar, N.connection.scalarCurvature_eq_m28 D N.center] |
| 152 | exact Real.rpow_le_rpow_of_nonpos hQ hQcenter (by norm_num) |
| 153 | have hL := standardSpherePathCeiling_pos |
| 154 | have hinv := inv_pos.mpr hepsilon |
| 155 | have hcoeff : 0 ≤ 2 * epsilon⁻¹ + 4 * standardSpherePathCeiling := by positivity |
| 156 | have hbudget : 2 * epsilon⁻¹ + 4 * standardSpherePathCeiling ≤ |
| 157 | endpointConnectorBudget epsilon C := by |
| 158 | have hB : 2 ≤ max C 2 := le_max_right C 2 |
| 159 | unfold endpointConnectorBudget |
| 160 | rw [div_eq_mul_inv] |
| 161 | linarith only [hB, hL, hinv] |
| 162 | obtain ⟨γ, hγ0, hγ1, hγ, hγN, hγlen⟩ := exists_neck_center_connector N hp |
| 163 | rw [hNepsilon] at hγlen |
| 164 | have hγbound : g.pathELength γ 0 1 < |
| 165 | ENNReal.ofReal (endpointConnectorBudget epsilon C * Q ^ (-1 / 2 : ℝ)) := by |
| 166 | apply hγlen.trans_le |
| 167 | apply ENNReal.ofReal_le_ofReal |
| 168 | exact (mul_le_mul_of_nonneg_left hscale hcoeff).trans |
| 169 | (mul_le_mul_of_nonneg_right hbudget (Real.rpow_nonneg hQ.le _)) |
| 170 | obtain ⟨δ, hδ0, hδ1, hδ, hδN, hδlen⟩ := exists_reverse_unit_connector g hγ hγN |
| 171 | obtain ⟨hlow, hhigh⟩ := endpoint_scalar_readouts (Q := Q) hupper hlower |
| 172 | refine ⟨hcpos, hupper, hlower, hscale, hlow, hhigh, |
| 173 | ⟨γ, hγ0, hγ1, hγ, hγN, hγbound⟩, |
| 174 | ⟨δ, hδ0.trans hγ1, hδ1.trans hγ0, hδ, hδN, ?_⟩⟩ |
| 175 | rw [hδlen] |
| 176 | exact hγbound |
| 177 | |
| 178 | /-- An original point in an actual selected cap produces a genuine core |
| 179 | point and both cap-valued connector orientations with the shared budget |
| 180 | and adjusted scalar readouts (Claim 10.3; Definition 9.72). -/ |
| 181 | theorem exists_cap_endpoint_recentering |
| 182 | {M : Type u} [TopologicalSpace M] |
| 183 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 184 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] [T3Space M] |
| 185 | {g : RiemannianMetric 3 M} (K : CapCertificate g) (D : LeviCivitaData g) |
| 186 | {epsilon C Q : ℝ} (hepsilon : 0 < epsilon) (hK : K.cap_constant ≤ C) |
| 187 | (hQ : 0 < Q) {p : M} (hp : p ∈ K.carrier) |
| 188 | (hsource : D.scalarCurvature p = 8 * Q ∨ |
| 189 | 32 * (max C 2) ^ 4 * Q < D.scalarCurvature p) : |
| 190 | ∃ c ∈ K.core, |
| 191 | 0 < D.scalarCurvature c ∧ |
| 192 | D.scalarCurvature c < max C 2 * D.scalarCurvature p ∧ |
| 193 | D.scalarCurvature p < max C 2 * D.scalarCurvature c ∧ |
| 194 | (D.scalarCurvature p = 8 * Q → D.scalarCurvature c ≤ 8 * max C 2 * Q) ∧ |
| 195 | (32 * (max C 2) ^ 4 * Q < D.scalarCurvature p → |
| 196 | 32 * (max C 2) ^ 3 * Q < D.scalarCurvature c) ∧ |
| 197 | (∃ γ : ℝ → M, γ 0 = p ∧ γ 1 = c ∧ |
| 198 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 γ (Icc (0 : ℝ) 1) ∧ |
| 199 | MapsTo γ (Icc (0 : ℝ) 1) K.carrier ∧ |
| 200 | g.pathELength γ 0 1 < |
| 201 | ENNReal.ofReal (endpointConnectorBudget epsilon C * Q ^ (-1 / 2 : ℝ))) ∧ |
| 202 | (∃ γ : ℝ → M, γ 0 = c ∧ γ 1 = p ∧ |
| 203 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 γ (Icc (0 : ℝ) 1) ∧ |
| 204 | MapsTo γ (Icc (0 : ℝ) 1) K.carrier ∧ |
| 205 | g.pathELength γ 0 1 < |
| 206 | ENNReal.ofReal (endpointConnectorBudget epsilon C * Q ^ (-1 / 2 : ℝ))) := by |
| 207 | have hP := source_endpoint_scalar_lower hQ hsource |
| 208 | have hQp : Q ≤ D.scalarCurvature p := by linarith only [hP, hQ] |
| 209 | obtain ⟨c, hc, hcpos, hupper, hlower, hforward, hbackward⟩ := |
| 210 | K.exists_core_connectors D (hK.trans (le_max_left C 2)) hQ hp hQp |
| 211 | have hbudget : max C 2 ≤ endpointConnectorBudget epsilon C := by |
| 212 | have hL := standardSpherePathCeiling_pos |
| 213 | have hfrac : 0 < 4 / epsilon := div_pos (by norm_num) hepsilon |
| 214 | unfold endpointConnectorBudget |
| 215 | linarith only [hL, hfrac] |
| 216 | have hceiling : ENNReal.ofReal (max C 2 * Q ^ (-1 / 2 : ℝ)) ≤ |
| 217 | ENNReal.ofReal (endpointConnectorBudget epsilon C * Q ^ (-1 / 2 : ℝ)) := |
| 218 | ENNReal.ofReal_le_ofReal |
| 219 | (mul_le_mul_of_nonneg_right hbudget (Real.rpow_nonneg hQ.le _)) |
| 220 | obtain ⟨hlow, hhigh⟩ := endpoint_scalar_readouts (Q := Q) hupper.le hlower.le |
| 221 | obtain ⟨γ, hγ0, hγ1, hγ, hγK, hγlen⟩ := hforward |
| 222 | obtain ⟨δ, hδ0, hδ1, hδ, hδK, hδlen⟩ := hbackward |
| 223 | exact ⟨c, hc, hcpos, hupper, hlower, hlow, hhigh, |
| 224 | ⟨γ, hγ0, hγ1, hγ, hγK, hγlen.trans_le hceiling⟩, |
| 225 | ⟨δ, hδ0, hδ1, hδ, hδK, hδlen.trans_le hceiling⟩⟩ |
| 226 | |
| 227 | end PoincareMT.M28 |