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.IntrinsicGeometry.IntrinsicMetricSpace |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.SourceGeometry.Paths.SourceMinimizingGeodesicAssembly |
| 4 | import PoincareLib.Geometry.Riemannian.Comparison.Volume.Conjugate.Realization.Junction |
| 5 | |
| 6 | /-! |
| 7 | # Smoothness of actual rays in the original recut metric |
| 8 | |
| 9 | Proper finite metric prefixes have smooth affine representatives with |
| 10 | endpoint germs. The arbitrary total ray itself is geodesic and smooth |
| 11 | only on its open parameter interval. All distances use the same actual |
| 12 | intrinsic metric on the open recut. No completeness is assumed. |
| 13 | Source: Morgan--Tian Claims 10.13-10.14 and Corollary 10.15, pp. 256-258; |
| 14 | M28 derivation 145. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | set_option autoImplicit false |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | |
| 21 | open Set Filter |
| 22 | open scoped Manifold ContDiff Topology ENNReal Bundle |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | namespace PoincareMT.M28 |
| 27 | |
| 28 | variable {M : Type u} [TopologicalSpace M] [T2Space M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 30 | [IsManifold (𝓡 3) ∞ M] |
| 31 | |
| 32 | omit [T2Space M] in |
| 33 | private theorem intrinsicEDist_univ_eq_riemannian |
| 34 | (g : RiemannianMetric 3 M) (p q : M) : |
| 35 | intrinsicEDist g univ p q = g.edist p q := by |
| 36 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 37 | ⟨g.toRiemannianMetric⟩ |
| 38 | apply le_antisymm |
| 39 | · apply le_of_forall_gt_imp_ge_of_dense |
| 40 | intro l hl |
| 41 | obtain ⟨eta, h0, h1, heta, hlength⟩ := |
| 42 | Manifold.exists_lt_of_riemannianEDist_lt hl |
| 43 | have hle := intrinsicEDist_le_pathELength g zero_le_one heta |
| 44 | (U := univ) (fun _ _ => mem_univ _) |
| 45 | simpa only [h0, h1] using hle.trans hlength.le |
| 46 | · rw [intrinsicEDist] |
| 47 | apply le_sInf |
| 48 | rintro l ⟨eta, heta, h0, h1, _hregion, rfl⟩ |
| 49 | exact Manifold.riemannianEDist_le_pathELength heta h0 h1 zero_le_one |
| 50 | |
| 51 | /-- A finite unit-speed metric segment has a smooth affine representative |
| 52 | in the same recut, including both endpoint germs and tangent norm one. |
| 53 | Source: Claims 10.13-10.14, pp. 256-258; M28 derivation 147. -/ |
| 54 | theorem exists_geodesic_eq_intrinsic_metric_segment_real |
| 55 | (g : RiemannianMetric 3 M) (U : TopologicalSpace.Opens M) |
| 56 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) : |
| 57 | letI := intrinsicOpenMetricSpace g U hfinite |
| 58 | ∀ {L : ℝ} {eta : ℝ → U}, 0 < L → |
| 59 | ContinuousOn eta (Icc 0 L) → |
| 60 | (∀ s ∈ Icc (0 : ℝ) L, ∀ t ∈ Icc (0 : ℝ) L, |
| 61 | dist (eta s) (eta t) = |s - t|) → |
| 62 | ∃ zeta : ℝ → U, |
| 63 | (intrinsicOpenMetric g U).IsGeodesicOn zeta (Icc 0 L) ∧ |
| 64 | EqOn zeta eta (Icc 0 L) ∧ |
| 65 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) ∞ zeta (Icc 0 L) ∧ |
| 66 | ∀ t ∈ Icc 0 L, |
| 67 | (intrinsicOpenMetric g U).tangentNorm (zeta t) |
| 68 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 3) zeta t 1) = 1 := by |
| 69 | let := intrinsicOpenMetricSpace g U hfinite |
| 70 | intro L eta hL heta hdist |
| 71 | let gU := intrinsicOpenMetric g U |
| 72 | have hedist (p q : U) : gU.edist p q = ENNReal.ofReal (dist p q) := by |
| 73 | rw [intrinsicOpenMetric_edist, ← intrinsicOpenMetricSpace_edist g U hfinite, |
| 74 | edist_dist] |
| 75 | obtain ⟨zeta, hzeta, heq, hspeed⟩ := |
| 76 | exists_geodesic_eq_intrinsic_metric_segment gU (⊤ : TopologicalSpace.Opens U) |
| 77 | hL heta (fun _ _ => mem_univ _) |
| 78 | (fun s hs t ht => by |
| 79 | change intrinsicEDist gU univ (eta s) (eta t) = _ |
| 80 | rw [intrinsicEDist_univ_eq_riemannian, hedist, hdist s hs t ht]) |
| 81 | refine ⟨zeta, hzeta, heq, ?_, hspeed⟩ |
| 82 | intro t ht |
| 83 | exact (Conjugate.Realization.contMDiffAt_of_isGeodesicOn hzeta ht).contMDiffWithinAt |
| 84 | |
| 85 | /-- A scaled unit-interval metric segment has an affine smooth |
| 86 | representative with the identical closed trace. The length-zero branch |
| 87 | uses the constant geodesic. Lemma 10.21, p. 259; M28 derivation 147. -/ |
| 88 | theorem exists_geodesic_eq_intrinsic_unit_metric_segment |
| 89 | (g : RiemannianMetric 3 M) (U : TopologicalSpace.Opens M) |
| 90 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) : |
| 91 | letI := intrinsicOpenMetricSpace g U hfinite |
| 92 | ∀ {L : ℝ} {mu : ℝ → U}, 0 ≤ L → |
| 93 | ContinuousOn mu (Icc (0 : ℝ) 1) → |
| 94 | (∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, |
| 95 | dist (mu s) (mu t) = |s - t| * L) → |
| 96 | ∃ nu : ℝ → U, |
| 97 | (intrinsicOpenMetric g U).IsGeodesicOn nu (Icc 0 1) ∧ |
| 98 | EqOn nu mu (Icc 0 1) ∧ |
| 99 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) ∞ nu (Icc 0 1) := by |
| 100 | let := intrinsicOpenMetricSpace g U hfinite |
| 101 | intro L mu hL hmu hdist |
| 102 | let gU := intrinsicOpenMetric g U |
| 103 | by_cases hL0 : L = 0 |
| 104 | · refine ⟨fun _ => mu 0, Conjugate.Realization.isGeodesicOn_const gU (mu 0) _, |
| 105 | ?_, contMDiff_const.contMDiffOn⟩ |
| 106 | intro t ht |
| 107 | apply dist_eq_zero.mp |
| 108 | simpa only [hL0, mul_zero] using hdist 0 (by norm_num) t ht |
| 109 | · have hLpos : 0 < L := lt_of_le_of_ne hL (Ne.symm hL0) |
| 110 | let eta : ℝ → U := fun t => mu (t / L) |
| 111 | have hparameter (t : ℝ) (ht : t ∈ Icc (0 : ℝ) L) : |
| 112 | t / L ∈ Icc (0 : ℝ) 1 := |
| 113 | ⟨div_nonneg ht.1 hL, (div_le_one hLpos).mpr ht.2⟩ |
| 114 | have heta : ContinuousOn eta (Icc (0 : ℝ) L) := |
| 115 | hmu.comp (continuous_id.div_const L).continuousOn |
| 116 | (fun t ht => hparameter t ht) |
| 117 | have hmetric : ∀ s ∈ Icc (0 : ℝ) L, ∀ t ∈ Icc (0 : ℝ) L, |
| 118 | dist (eta s) (eta t) = |s - t| := by |
| 119 | intro s hs t ht |
| 120 | change dist (mu (s / L)) (mu (t / L)) = _ |
| 121 | rw [hdist (s / L) (hparameter s hs) (t / L) (hparameter t ht), |
| 122 | ← sub_div, abs_div, abs_of_pos hLpos, div_mul_cancel₀ _ hL0] |
| 123 | obtain ⟨zeta, hzeta, heq, _hsmooth, _hspeed⟩ := |
| 124 | exists_geodesic_eq_intrinsic_metric_segment_real g U hfinite hLpos heta hmetric |
| 125 | let nu : ℝ → U := fun s => zeta (L * s) |
| 126 | have hscaled (s : ℝ) (hs : s ∈ Icc (0 : ℝ) 1) : |
| 127 | L * s ∈ Icc (0 : ℝ) L := |
| 128 | ⟨mul_nonneg hL hs.1, by simpa only [mul_one] using |
| 129 | mul_le_mul_of_nonneg_left hs.2 hL⟩ |
| 130 | have hnu : gU.IsGeodesicOn nu (Icc 0 1) := |
| 131 | fun s hs => hzeta.comp_mul L s (hscaled s hs) |
| 132 | refine ⟨nu, hnu, ?_, ?_⟩ |
| 133 | · intro s hs |
| 134 | exact (heq (hscaled s hs)).trans (by |
| 135 | change mu (L * s / L) = mu s |
| 136 | rw [mul_div_cancel_left₀ s hL0]) |
| 137 | · intro s hs |
| 138 | exact (Conjugate.Realization.contMDiffAt_of_isGeodesicOn hnu hs).contMDiffWithinAt |
| 139 | |
| 140 | /-- Each proper closed prefix of the retained intrinsic metric ray has |
| 141 | an affine smooth unit-speed representative, agreeing at both endpoints. |
| 142 | Source: Claims 10.13-10.14, pp. 256-258; M28 derivation 145. -/ |
| 143 | theorem exists_geodesic_eq_intrinsic_metric_ray_prefix |
| 144 | (g : RiemannianMetric 3 M) (U : TopologicalSpace.Opens M) |
| 145 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) : |
| 146 | letI := intrinsicOpenMetricSpace g U hfinite |
| 147 | ∀ {a : ℝ} {gamma : ℝ → U}, |
| 148 | (∀ s ∈ Ico (0 : ℝ) a, ∀ t ∈ Ico (0 : ℝ) a, |
| 149 | dist (gamma s) (gamma t) = |s - t|) → |
| 150 | ∀ {L : ℝ}, 0 < L → L < a → |
| 151 | ∃ zeta : ℝ → U, |
| 152 | (intrinsicOpenMetric g U).IsGeodesicOn zeta (Icc 0 L) ∧ |
| 153 | EqOn zeta gamma (Icc 0 L) ∧ |
| 154 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) ∞ zeta (Icc 0 L) ∧ |
| 155 | ∀ t ∈ Icc 0 L, |
| 156 | (intrinsicOpenMetric g U).tangentNorm (zeta t) |
| 157 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 3) zeta t 1) = 1 := by |
| 158 | let := intrinsicOpenMetricSpace g U hfinite |
| 159 | intro a gamma hdist L hL hLa |
| 160 | let gU := intrinsicOpenMetric g U |
| 161 | have hisometry : Isometry (fun t : Ico (0 : ℝ) a => gamma t.1) := by |
| 162 | apply Isometry.of_dist_eq |
| 163 | intro s t |
| 164 | change dist (gamma s.1) (gamma t.1) = dist s.1 t.1 |
| 165 | simpa only [Real.dist_eq] using hdist s.1 s.2 t.1 t.2 |
| 166 | have hcontinuous : ContinuousOn gamma (Ico (0 : ℝ) a) := |
| 167 | continuousOn_iff_continuous_domRestrict.mpr hisometry.continuous |
| 168 | have hsub : Icc (0 : ℝ) L ⊆ Ico (0 : ℝ) a := |
| 169 | fun _ ht => ⟨ht.1, ht.2.trans_lt hLa⟩ |
| 170 | have hedist (p q : U) : gU.edist p q = ENNReal.ofReal (dist p q) := by |
| 171 | rw [intrinsicOpenMetric_edist, ← intrinsicOpenMetricSpace_edist g U hfinite, |
| 172 | edist_dist] |
| 173 | obtain ⟨zeta, hzeta, heq, hspeed⟩ := |
| 174 | exists_geodesic_eq_intrinsic_metric_segment gU (⊤ : TopologicalSpace.Opens U) |
| 175 | hL (hcontinuous.mono hsub) (fun _ _ => mem_univ _) |
| 176 | (fun s hs t ht => by |
| 177 | change intrinsicEDist gU univ (gamma s) (gamma t) = _ |
| 178 | rw [intrinsicEDist_univ_eq_riemannian, hedist, |
| 179 | hdist s (hsub hs) t (hsub ht)]) |
| 180 | refine ⟨zeta, hzeta, heq, ?_, hspeed⟩ |
| 181 | intro t ht |
| 182 | exact (Conjugate.Realization.contMDiffAt_of_isGeodesicOn hzeta ht).contMDiffWithinAt |
| 183 | |
| 184 | /-- The actual retained total ray is smooth and affine with tangent norm |
| 185 | one on its open interval. No regularity of its arbitrary totalization at |
| 186 | zero or beyond its missing endpoint is claimed. M28 derivation 145. -/ |
| 187 | theorem intrinsic_metric_ray_regular |
| 188 | (g : RiemannianMetric 3 M) (U : TopologicalSpace.Opens M) |
| 189 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) : |
| 190 | letI := intrinsicOpenMetricSpace g U hfinite |
| 191 | ∀ {a : ℝ} {gamma : ℝ → U}, |
| 192 | (∀ s ∈ Ico (0 : ℝ) a, ∀ t ∈ Ico (0 : ℝ) a, |
| 193 | dist (gamma s) (gamma t) = |s - t|) → |
| 194 | (intrinsicOpenMetric g U).IsGeodesicOn gamma (Ioo 0 a) ∧ |
| 195 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) ∞ gamma (Ioo 0 a) ∧ |
| 196 | ∀ t ∈ Ioo 0 a, |
| 197 | (intrinsicOpenMetric g U).tangentNorm (gamma t) |
| 198 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 3) gamma t 1) = 1 := by |
| 199 | let := intrinsicOpenMetricSpace g U hfinite |
| 200 | intro a gamma hdist |
| 201 | let gU := intrinsicOpenMetric g U |
| 202 | have hpointwise (t : ℝ) (ht : t ∈ Ioo (0 : ℝ) a) : |
| 203 | gU.IsGeodesicOn gamma {t} ∧ |
| 204 | gU.tangentNorm (gamma t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 3) gamma t 1) = 1 := by |
| 205 | let L := (t + a) / 2 |
| 206 | have hL : 0 < L := by dsimp [L]; linarith [ht.1, ht.2] |
| 207 | have hLa : L < a := by dsimp [L]; linarith [ht.2] |
| 208 | have htL : t < L := by dsimp [L]; linarith [ht.2] |
| 209 | obtain ⟨zeta, hzeta, heq, _hsmooth, hspeed⟩ := |
| 210 | exists_geodesic_eq_intrinsic_metric_ray_prefix g U hfinite hdist hL hLa |
| 211 | have hnear : gamma =ᶠ[𝓝 t] zeta := by |
| 212 | filter_upwards [Ioo_mem_nhds ht.1 htL] with s hs |
| 213 | exact (heq ⟨hs.1.le, hs.2.le⟩).symm |
| 214 | refine ⟨?_, ?_⟩ |
| 215 | · intro u hu |
| 216 | have hut : u = t := mem_singleton_iff.mp hu |
| 217 | subst u |
| 218 | obtain ⟨p, q, w, hlocal⟩ := hzeta t ⟨ht.1.le, htL.le⟩ |
| 219 | refine ⟨p, q, w, ?_⟩ |
| 220 | filter_upwards [hnear, hlocal] with s hs hlocals |
| 221 | exact ⟨hs.trans hlocals.1, hlocals.2⟩ |
| 222 | · rw [hnear.mfderiv_eq, hnear.self_of_nhds] |
| 223 | exact hspeed t ⟨ht.1.le, htL.le⟩ |
| 224 | have hgeodesic : gU.IsGeodesicOn gamma (Ioo 0 a) := |
| 225 | fun t ht => (hpointwise t ht).1 t (mem_singleton t) |
| 226 | refine ⟨hgeodesic, ?_, fun t ht => (hpointwise t ht).2⟩ |
| 227 | intro t ht |
| 228 | exact (Conjugate.Realization.contMDiffAt_of_isGeodesicOn |
| 229 | hgeodesic ht).contMDiffWithinAt |
| 230 | |
| 231 | end PoincareMT.M28 |