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.SourceGeometry.Paths.SourceMinimizingGeodesicLocal |
| 3 | |
| 4 | /-! |
| 5 | # Affine geodesics from the actual regional minimum |
| 6 | |
| 7 | Morgan--Tian Claim 10.3 and Appendix A.9. Regional and ambient distances are |
| 8 | identified only on the proved local neighborhoods. Endpoint germs extend the |
| 9 | same arclength trace, so every original source scalar cut is retained through |
| 10 | the original monotone clock. See the claim10_4 minimizing-geodesic derivation. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Manifold ContDiff Topology ENNReal Bundle |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.M28 |
| 23 | |
| 24 | variable {M : Type u} [TopologicalSpace M] [T2Space M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 26 | [IsManifold (𝓡 3) ∞ M] |
| 27 | |
| 28 | private theorem exists_geodesic_germ_of_intrinsic_metric_segment |
| 29 | (g : RiemannianMetric 3 M) (U : TopologicalSpace.Opens M) |
| 30 | {η : ℝ → M} {L : ℝ} (hL : 0 < L) |
| 31 | (hη : ContinuousOn η (Icc 0 L)) (hηU : MapsTo η (Icc 0 L) (U : Set M)) |
| 32 | (hsegment : ∀ s ∈ Icc 0 L, ∀ r ∈ Icc 0 L, |
| 33 | intrinsicEDist g (U : Set M) (η s) (η r) = ENNReal.ofReal |s - r|) |
| 34 | {t : ℝ} (ht : t ∈ Icc 0 L) : |
| 35 | ∃ ρ : ℝ, 0 < ρ ∧ ∃ ξ : ℝ → M, |
| 36 | g.IsGeodesicOn ξ {t} ∧ EqOn ξ η (Icc 0 L ∩ Ioo (t - ρ) (t + ρ)) ∧ |
| 37 | g.tangentNorm (ξ t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 3) ξ t 1) = 1 := by |
| 38 | obtain ⟨W, hW, htW, _, hdistance⟩ := |
| 39 | exists_open_intrinsic_distance_eq g U.isOpen (hηU ht) |
| 40 | have hpre : η ⁻¹' W ∈ 𝓝[Icc 0 L] t := |
| 41 | (hη t ht).preimage_mem_nhdsWithin (hW.mem_nhds htW) |
| 42 | obtain ⟨V, hV, hVsub⟩ := mem_nhdsWithin_iff_exists_mem_nhds_inter.mp hpre |
| 43 | obtain ⟨l, r, hlr, hlrV⟩ := mem_nhds_iff_exists_Ioo_subset.mp hV |
| 44 | let δ := min (t - l) (r - t) / 2 |
| 45 | have hδ : 0 < δ := div_pos (lt_min (by linarith [hlr.1]) |
| 46 | (by linarith [hlr.2])) (by norm_num) |
| 47 | have hδl : δ ≤ (t - l) / 2 := div_le_div_of_nonneg_right (min_le_left _ _) (by norm_num) |
| 48 | have hδr : δ ≤ (r - t) / 2 := div_le_div_of_nonneg_right (min_le_right _ _) (by norm_num) |
| 49 | let a := max 0 (t - δ) |
| 50 | let b := min L (t + δ) |
| 51 | have hab : a < b := by |
| 52 | apply max_lt_iff.mpr |
| 53 | exact ⟨lt_min hL (by linarith [ht.1]), |
| 54 | lt_min (by linarith [ht.2]) (by linarith)⟩ |
| 55 | have hsub : Icc a b ⊆ Icc 0 L := |
| 56 | Icc_subset_Icc (le_max_left _ _) (min_le_left _ _) |
| 57 | have hsmall (s : ℝ) (hs : s ∈ Icc a b) : η s ∈ W := by |
| 58 | apply hVsub |
| 59 | refine ⟨hlrV ?_, hsub hs⟩ |
| 60 | have hlo : t - δ ≤ s := (le_max_right _ _).trans hs.1 |
| 61 | have hhi : s ≤ t + δ := hs.2.trans (min_le_right _ _) |
| 62 | constructor <;> linarith [hlr.1, hlr.2] |
| 63 | have htlocal : t ∈ Icc a b := |
| 64 | ⟨max_le ht.1 (by linarith), le_min ht.2 (by linarith)⟩ |
| 65 | obtain ⟨ρ, hρ, ξ, hξ, heq, hspeed⟩ := exists_geodesic_germ_of_metric_segment g hab |
| 66 | (fun s hs r hr => (hdistance _ (hsmall s hs) _ (hsmall r hr)).symm.trans |
| 67 | (hsegment s (hsub hs) r (hsub hr))) htlocal |
| 68 | refine ⟨min ρ δ / 2, div_pos (lt_min hρ hδ) (by norm_num), ξ, hξ, ?_, hspeed⟩ |
| 69 | intro s hs |
| 70 | have hmρ : min ρ δ ≤ ρ := min_le_left _ _ |
| 71 | have hmδ : min ρ δ ≤ δ := min_le_right _ _ |
| 72 | have hm : 0 < min ρ δ := lt_min hρ hδ |
| 73 | apply heq |
| 74 | refine ⟨⟨max_le hs.1.1 ?_, le_min hs.1.2 ?_⟩, ?_⟩ |
| 75 | · linarith [hs.2.1] |
| 76 | · linarith [hs.2.2] |
| 77 | · constructor <;> linarith [hs.2.1, hs.2.2] |
| 78 | |
| 79 | omit [T2Space M] in |
| 80 | private theorem geodesic_germ_congr |
| 81 | {g : RiemannianMetric 3 M} {ξ ζ : ℝ → M} {t : ℝ} |
| 82 | (hξ : g.IsGeodesicOn ξ {t}) (heq : ζ =ᶠ[𝓝 t] ξ) : |
| 83 | g.IsGeodesicOn ζ {t} := by |
| 84 | intro s hs |
| 85 | have hs' : s = t := mem_singleton_iff.mp hs |
| 86 | subst s |
| 87 | obtain ⟨p, q, w, hlocal⟩ := hξ t (by simp) |
| 88 | refine ⟨p, q, w, ?_⟩ |
| 89 | filter_upwards [heq, hlocal] with u hu hlocalu |
| 90 | exact ⟨hu.trans hlocalu.1, hlocalu.2⟩ |
| 91 | |
| 92 | /-- A finite nonconstant regional metric segment extends across its two |
| 93 | endpoints as one actual affine unit-speed geodesic, agreeing on every tested |
| 94 | parameter. The extension introduces no new region or confinement hypothesis. -/ |
| 95 | theorem exists_geodesic_eq_intrinsic_metric_segment |
| 96 | (g : RiemannianMetric 3 M) (U : TopologicalSpace.Opens M) |
| 97 | {η : ℝ → M} {L : ℝ} (hL : 0 < L) |
| 98 | (hη : ContinuousOn η (Icc 0 L)) (hηU : MapsTo η (Icc 0 L) (U : Set M)) |
| 99 | (hsegment : ∀ s ∈ Icc 0 L, ∀ r ∈ Icc 0 L, |
| 100 | intrinsicEDist g (U : Set M) (η s) (η r) = ENNReal.ofReal |s - r|) : |
| 101 | ∃ ζ : ℝ → M, g.IsGeodesicOn ζ (Icc 0 L) ∧ EqOn ζ η (Icc 0 L) ∧ |
| 102 | ∀ t ∈ Icc 0 L, |
| 103 | g.tangentNorm (ζ t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 3) ζ t 1) = 1 := by |
| 104 | obtain ⟨ρ₀, hρ₀, ξ₀, hξ₀, heq₀, hspeed₀⟩ := |
| 105 | exists_geodesic_germ_of_intrinsic_metric_segment g U hL hη hηU hsegment |
| 106 | (show (0 : ℝ) ∈ Icc 0 L from ⟨le_rfl, hL.le⟩) |
| 107 | obtain ⟨ρ₁, hρ₁, ξ₁, hξ₁, heq₁, hspeed₁⟩ := |
| 108 | exists_geodesic_germ_of_intrinsic_metric_segment g U hL hη hηU hsegment |
| 109 | (show L ∈ Icc 0 L from ⟨hL.le, le_rfl⟩) |
| 110 | let ζ := fun t => if t < 0 then ξ₀ t else if L < t then ξ₁ t else η t |
| 111 | have hζeq : EqOn ζ η (Icc 0 L) := by |
| 112 | intro t ht |
| 113 | simp only [ζ, if_neg (not_lt.mpr ht.1), if_neg (not_lt.mpr ht.2)] |
| 114 | have hzero : ζ =ᶠ[𝓝 0] ξ₀ := by |
| 115 | filter_upwards [Ioo_mem_nhds (show -(min ρ₀ L) < (0 : ℝ) by |
| 116 | linarith [lt_min hρ₀ hL]) (show (0 : ℝ) < min ρ₀ L from lt_min hρ₀ hL)] |
| 117 | with t ht |
| 118 | by_cases ht0 : t < 0 |
| 119 | · simp only [ζ, if_pos ht0] |
| 120 | · have ht0' : 0 ≤ t := le_of_not_gt ht0 |
| 121 | have htL : t ≤ L := (ht.2.trans_le (min_le_right _ _)).le |
| 122 | rw [hζeq ⟨ht0', htL⟩] |
| 123 | apply (heq₀ ?_).symm |
| 124 | refine ⟨⟨ht0', htL⟩, ?_⟩ |
| 125 | constructor |
| 126 | · simp only [zero_sub] |
| 127 | linarith |
| 128 | · simpa only [zero_add] using ht.2.trans_le (min_le_left _ _) |
| 129 | have hone : ζ =ᶠ[𝓝 L] ξ₁ := by |
| 130 | filter_upwards [Ioo_mem_nhds (show L - min ρ₁ L < L by |
| 131 | linarith [lt_min hρ₁ hL]) (show L < L + min ρ₁ L by |
| 132 | linarith [lt_min hρ₁ hL])] with t ht |
| 133 | have ht0 : 0 ≤ t := by have := min_le_right ρ₁ L; linarith [ht.1] |
| 134 | by_cases hLt : L < t |
| 135 | · simp only [ζ, if_neg (not_lt.mpr ht0), if_pos hLt] |
| 136 | · have htL : t ≤ L := le_of_not_gt hLt |
| 137 | rw [hζeq ⟨ht0, htL⟩] |
| 138 | apply (heq₁ ?_).symm |
| 139 | refine ⟨⟨ht0, htL⟩, ?_⟩ |
| 140 | have := min_le_left ρ₁ L |
| 141 | constructor <;> linarith [ht.1, ht.2] |
| 142 | have hgerms (t : ℝ) (ht : t ∈ Icc 0 L) : |
| 143 | ∃ ξ : ℝ → M, g.IsGeodesicOn ξ {t} ∧ ζ =ᶠ[𝓝 t] ξ ∧ |
| 144 | g.tangentNorm (ξ t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 3) ξ t 1) = 1 := by |
| 145 | rcases eq_or_lt_of_le ht.1 with h | ht0 |
| 146 | · subst t |
| 147 | exact ⟨ξ₀, hξ₀, hzero, hspeed₀⟩ |
| 148 | rcases eq_or_lt_of_le ht.2 with h | htL |
| 149 | · subst t |
| 150 | exact ⟨ξ₁, hξ₁, hone, hspeed₁⟩ |
| 151 | obtain ⟨ρ, hρ, ξ, hξ, heq, hspeed⟩ := |
| 152 | exists_geodesic_germ_of_intrinsic_metric_segment g U hL hη hηU hsegment ht |
| 153 | refine ⟨ξ, hξ, ?_, hspeed⟩ |
| 154 | filter_upwards [Ioo_mem_nhds ht0 htL, |
| 155 | Ioo_mem_nhds (show t - ρ < t by linarith) (show t < t + ρ by linarith)] |
| 156 | with s hs hnear |
| 157 | exact (hζeq ⟨hs.1.le, hs.2.le⟩).trans (heq ⟨⟨hs.1.le, hs.2.le⟩, hnear⟩).symm |
| 158 | refine ⟨ζ, ?_, hζeq, ?_⟩ |
| 159 | · intro t ht |
| 160 | obtain ⟨ξ, hξ, heq, _⟩ := hgerms t ht |
| 161 | exact geodesic_germ_congr hξ heq t (by simp) |
| 162 | · intro t ht |
| 163 | obtain ⟨ξ, _, heq, hspeed⟩ := hgerms t ht |
| 164 | rw [heq.mfderiv_eq, heq.self_of_nhds] |
| 165 | exact hspeed |
| 166 | |
| 167 | /-- The actual finite nonconstant C1 regional minimum admits an affine |
| 168 | unit-speed parametrization preserving its full trace, endpoints and scalar-cut |
| 169 | clock. Its regional distance formula is exact on every subsegment. -/ |
| 170 | theorem exists_intrinsic_unit_geodesic_minimizer |
| 171 | (g : RiemannianMetric 3 M) (U : TopologicalSpace.Opens M) |
| 172 | {γ : ℝ → M} (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 γ (Icc (0 : ℝ) 1)) |
| 173 | (hγU : MapsTo γ (Icc (0 : ℝ) 1) (U : Set M)) |
| 174 | (hmin : g.pathELength γ 0 1 = intrinsicEDist g (U : Set M) (γ 0) (γ 1)) |
| 175 | (hfinite : g.pathELength γ 0 1 ≠ ⊤) (hne : γ 0 ≠ γ 1) : |
| 176 | let L := (g.pathELength γ 0 1).toReal |
| 177 | ∃ ζ : ℝ → M, ∃ c : ℝ → ℝ, |
| 178 | 0 < L ∧ ζ 0 = γ 0 ∧ ζ L = γ 1 ∧ g.IsGeodesicOn ζ (Icc 0 L) ∧ |
| 179 | MapsTo ζ (Icc 0 L) (U : Set M) ∧ |
| 180 | ζ '' Icc 0 L = γ '' Icc (0 : ℝ) 1 ∧ |
| 181 | ContinuousOn c (Icc (0 : ℝ) 1) ∧ MonotoneOn c (Icc (0 : ℝ) 1) ∧ |
| 182 | c 0 = 0 ∧ c 1 = L ∧ c '' Icc (0 : ℝ) 1 = Icc 0 L ∧ |
| 183 | (∀ t ∈ Icc (0 : ℝ) 1, ζ (c t) = γ t) ∧ |
| 184 | (∀ t ∈ Icc 0 L, |
| 185 | g.tangentNorm (ζ t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 3) ζ t 1) = 1) ∧ |
| 186 | ∀ s ∈ Icc 0 L, ∀ t ∈ Icc 0 L, |
| 187 | intrinsicEDist g (U : Set M) (ζ s) (ζ t) = ENNReal.ofReal |s - t| := by |
| 188 | obtain ⟨η, c, hη0, hη1, hηcont, hηU, hηimage, _, hccont, hcmono, |
| 189 | hc0, hc1, hcimage, hread, hdist⟩ := |
| 190 | exists_intrinsic_arcLength_minimizer g U hγ hγU hmin hfinite |
| 191 | have hL : 0 < (g.pathELength γ 0 1).toReal := by |
| 192 | apply lt_of_le_of_ne ENNReal.toReal_nonneg |
| 193 | intro heq |
| 194 | rw [← heq] at hη1 |
| 195 | exact hne (hη0.symm.trans hη1) |
| 196 | obtain ⟨ζ, hζ, heq, hspeed⟩ := |
| 197 | exists_geodesic_eq_intrinsic_metric_segment g U hL hηcont hηU hdist |
| 198 | refine ⟨ζ, c, hL, (heq ⟨le_rfl, hL.le⟩).trans hη0, |
| 199 | (heq ⟨hL.le, le_rfl⟩).trans hη1, hζ, ?_, ?_, hccont, hcmono, |
| 200 | hc0, hc1, hcimage, ?_, hspeed, ?_⟩ |
| 201 | · intro t ht |
| 202 | rw [heq ht] |
| 203 | exact hηU ht |
| 204 | · exact (image_congr (fun t ht => heq ht)).trans hηimage |
| 205 | · intro t ht |
| 206 | have hct : c t ∈ Icc 0 (g.pathELength γ 0 1).toReal := by |
| 207 | rw [← hcimage] |
| 208 | exact mem_image_of_mem c ht |
| 209 | exact (heq hct).trans (hread t ht) |
| 210 | · intro s hs t ht |
| 211 | rw [heq hs, heq ht] |
| 212 | exact hdist s hs t ht |
| 213 | |
| 214 | end PoincareMT.M28 |