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.CurveShortening.Ramp.Approximation.Local.SmoothMinimizingInterpolator |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.PolygonApproximation.Side.Geodesic |
| 3 | |
| 4 | /-! |
| 5 | # Local uniqueness on the full closed unit interval |
| 6 | |
| 7 | The joint coordinate endpoint inverse determines every sufficiently short |
| 8 | affine geodesic by its endpoints and minimizing initial speed. Intrinsic |
| 9 | initial-value uniqueness propagates the identity through the closed interval, |
| 10 | so no common extension beyond the two endpoints is required. |
| 11 | |
| 12 | Morgan--Tian context: Section 19.4, Definition 19.18 and Claims 19.19-19.22, printed pp. |
| 13 | 450-453. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Metric Filter |
| 20 | open scoped Manifold ContDiff Topology ENNReal Bundle |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | open M63 |
| 27 | |
| 28 | /-- Sufficiently short minimizing unit-interval geodesics with the same endpoints agree on |
| 29 | the closed interval. Source: Auxiliary step for MT Definition 19.18 and Claims 19.19/19.22, |
| 30 | pp. 450-453; project construction in |
| 31 | `proof-work/tasks/M64/reports/2026-09-23-static-polygon.md`. -/ |
| 32 | theorem m64_exists_local_unit_geodesic_uniqueness |
| 33 | {n : ℕ} {M : Type u} [TopologicalSpace M] [T2Space M] |
| 34 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 35 | (g : RiemannianMetric n M) (p0 : M) : |
| 36 | ∃ O : Set M, IsOpen O ∧ p0 ∈ O ∧ |
| 37 | ∀ p ∈ O, ∀ q ∈ O, ∀ gamma eta : ℝ → M, |
| 38 | g.IsGeodesicOn gamma (Icc (0 : ℝ) 1) → |
| 39 | g.IsGeodesicOn eta (Icc (0 : ℝ) 1) → |
| 40 | gamma 0 = p → eta 0 = p → gamma 1 = q → eta 1 = q → |
| 41 | g.tangentNorm (gamma 0) (curveVelocity gamma 0) = (g.edist p q).toReal → |
| 42 | g.tangentNorm (eta 0) (curveVelocity eta 0) = (g.edist p q).toReal → |
| 43 | EqOn gamma eta (Icc (0 : ℝ) 1) := by |
| 44 | classical |
| 45 | let : LocallyCompactSpace M := ChartedSpace.locallyCompactSpace |
| 46 | (EuclideanSpace ℝ (Fin n)) M |
| 47 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 48 | ⟨g.toRiemannianMetric⟩ |
| 49 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 50 | (TangentSpace (𝓡 n) : M → Type _) := |
| 51 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 52 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 n) M |
| 53 | let E := EuclideanSpace ℝ (Fin n) |
| 54 | let c := extChartAt (𝓡 n) p0 |
| 55 | let x0 : E := c p0 |
| 56 | let B : E → E →L[ℝ] E →L[ℝ] ℝ := g.pullbackCoefficients c.symm |
| 57 | have hc0 : p0 ∈ c.source := mem_extChartAt_source p0 |
| 58 | have hx0 : x0 ∈ c.target := c.map_source hc0 |
| 59 | have hcopen : IsOpen c.source := isOpen_extChartAt_source p0 |
| 60 | have htopen : IsOpen c.target := isOpen_extChartAt_target p0 |
| 61 | have hB : ContDiffOn ℝ ∞ B c.target := g.contDiffOn_chartCoefficients p0 |
| 62 | obtain ⟨e, he0, he00, _hsource, _htarget, _he, hei, hefirst, |
| 63 | Gamma, hGamma, hspec⟩ := |
| 64 | exists_joint_coordinate_exponential_inverse htopen hB |
| 65 | (fun y hy => g.isInvertible_chartCoefficients p0 hy) |
| 66 | (fun y _ v w => g.symm _ _ _) hx0 |
| 67 | obtain ⟨eta, heta, hetaSub⟩ := Metric.mem_nhds_iff.mp (e.open_source.mem_nhds he0) |
| 68 | have hbox {y v : E} (hy : y ∈ ball x0 eta) (hv : v ∈ ball 0 eta) : |
| 69 | (y, v) ∈ e.source := by |
| 70 | apply hetaSub |
| 71 | simpa only [Metric.mem_ball, Prod.dist_eq, max_lt_iff] using And.intro hy hv |
| 72 | let curve : (E × E) → ℝ → M := fun z t => c.symm (Gamma (z, t)).1 |
| 73 | have hcurve (z : E × E) (hz : z ∈ e.source) : |
| 74 | g.IsGeodesicOn (curve z) (Ioo (-2 : ℝ) 2) := by |
| 75 | apply g.isGeodesicOn_chart_curve p0 isOpen_Ioo |
| 76 | (q := fun t => (Gamma (z, t)).1) (w := fun t => (Gamma (z, t)).2) |
| 77 | intro t ht |
| 78 | have hd := (hspec z hz).2.2 t ht |
| 79 | refine ⟨hd.1, ?_, ?_⟩ |
| 80 | · simpa [coordinateGeodesicField] using hd.2.hasFDerivAt.fst.hasDerivAt |
| 81 | · simpa +instances [B, c, coordinateGeodesicField] using! |
| 82 | hd.2.hasFDerivAt.snd.hasDerivAt |
| 83 | have hcurve0 (z : E × E) (hz : z ∈ e.source) : |
| 84 | curve z 0 = c.symm z.1 := by |
| 85 | dsimp only [curve] |
| 86 | rw [(hspec z hz).1] |
| 87 | have hcurve1 (z : E × E) (hz : z ∈ e.source) : |
| 88 | curve z 1 = c.symm (e z).2 := by |
| 89 | dsimp only [curve] |
| 90 | rw [(hspec z hz).2.1] |
| 91 | have hcurveDeriv (z : E × E) (hz : z ∈ e.source) : |
| 92 | HasDerivAt (fun t => c (curve z t)) z.2 0 := by |
| 93 | have hd : HasDerivAt (fun t => (Gamma (z, t)).1) z.2 0 := by |
| 94 | simpa [(hspec z hz).1, coordinateGeodesicField] using |
| 95 | ((hspec z hz).2.2 0 (by norm_num)).2.hasFDerivAt.fst.hasDerivAt |
| 96 | have heq : (fun t => c (curve z t)) =ᶠ[𝓝 0] fun t => (Gamma (z, t)).1 := by |
| 97 | filter_upwards [isOpen_Ioo.mem_nhds (show (0 : ℝ) ∈ Ioo (-2) 2 by norm_num)] |
| 98 | with t ht |
| 99 | exact c.right_inv ((hspec z hz).2.2 t ht).1 |
| 100 | exact hd.congr_of_eventuallyEq heq |
| 101 | -- A fixed pulled-back norm controls every nearby genuine initial velocity. |
| 102 | have hcSymm : ContMDiffAt (𝓡 n) (𝓡 n) ∞ c.symm x0 := |
| 103 | (contMDiffOn_extChartAt_symm (I := 𝓡 n) (n := ∞) p0).contMDiffAt |
| 104 | (htopen.mem_nhds hx0) |
| 105 | have hcinj : Function.Injective (mfderiv (𝓡 n) (𝓡 n) c.symm x0) := by |
| 106 | simpa only [c, modelWithCornersSelf_coe, range_id, mfderivWithin_univ] using |
| 107 | (isInvertible_mfderivWithin_extChartAt_symm (I := 𝓡 n) (x := p0) hx0).injective |
| 108 | obtain ⟨A, hA, _hdet⟩ := g.exists_frozenPullbackEquiv hcinj |
| 109 | have hnear := g.eventually_pullbackNorm_bounds hcSymm A hA |
| 110 | (ε := (1 / 2 : ℝ)) (by norm_num) (by norm_num) |
| 111 | obtain ⟨V, hVsub, hVopen, hV0⟩ := _root_.mem_nhds_iff.mp hnear |
| 112 | let C : ℝ := 2 * (‖A.symm.toContinuousLinearMap‖ + 1) |
| 113 | have hC : 0 < C := by dsimp [C]; positivity |
| 114 | have hnorm (y : E) (hy : y ∈ V) (v : E) : |
| 115 | ‖v‖ ≤ C * g.tangentNorm (c.symm y) (mfderiv (𝓡 n) (𝓡 n) c.symm y v) := by |
| 116 | have hlo := (hVsub hy v).1 |
| 117 | have hN : 0 ≤ g.tangentNorm (c.symm y) |
| 118 | (mfderiv (𝓡 n) (𝓡 n) c.symm y v) := Real.sqrt_nonneg _ |
| 119 | have hhalf : ‖A v‖ ≤ 2 * g.tangentNorm (c.symm y) |
| 120 | (mfderiv (𝓡 n) (𝓡 n) c.symm y v) := by linarith |
| 121 | calc |
| 122 | ‖v‖ = ‖A.symm (A v)‖ := by rw [A.symm_apply_apply] |
| 123 | _ ≤ ‖A.symm.toContinuousLinearMap‖ * ‖A v‖ := |
| 124 | A.symm.toContinuousLinearMap.le_opNorm (A v) |
| 125 | _ ≤ ‖A.symm.toContinuousLinearMap‖ * |
| 126 | (2 * g.tangentNorm (c.symm y) (mfderiv (𝓡 n) (𝓡 n) c.symm y v)) := |
| 127 | mul_le_mul_of_nonneg_left hhalf (norm_nonneg _) |
| 128 | _ ≤ C * g.tangentNorm (c.symm y) (mfderiv (𝓡 n) (𝓡 n) c.symm y v) := by |
| 129 | dsimp only [C] |
| 130 | nlinarith |
| 131 | have hcAt : ContinuousAt (fun p : M => c p) p0 := |
| 132 | continuousAt_extChartAt (I := 𝓡 n) p0 |
| 133 | have hcc : ContinuousAt (fun pq : M × M => (c pq.1, c pq.2)) (p0, p0) := |
| 134 | (hcAt.comp continuousAt_fst).prodMk (hcAt.comp continuousAt_snd) |
| 135 | have het : (x0, x0) ∈ e.target := he00 ▸ e.map_source he0 |
| 136 | obtain ⟨U1, U2, hU1, hpU1, hU2, hpU2, hUV⟩ := |
| 137 | mem_nhds_prod_iff'.mp (hcc.preimage_mem_nhds (e.open_target.mem_nhds het)) |
| 138 | have hsmall : {p : M | p ∈ c.source ∧ c p ∈ ball x0 eta ∧ c p ∈ V} ∈ 𝓝 p0 := |
| 139 | inter_mem (hcopen.mem_nhds hc0) |
| 140 | (hcAt.preimage_mem_nhds |
| 141 | (inter_mem (isOpen_ball.mem_nhds (mem_ball_self heta)) (hVopen.mem_nhds hV0))) |
| 142 | obtain ⟨W, hWsub, hWopen, hpW⟩ := _root_.mem_nhds_iff.mp hsmall |
| 143 | let delta : ℝ := min 1 (eta / C) / 4 |
| 144 | have hdelta : 0 < delta := div_pos (lt_min zero_lt_one (div_pos heta hC)) (by norm_num) |
| 145 | have hd1 : 2 * delta < 1 := by |
| 146 | have hh := min_le_left (1 : ℝ) (eta / C) |
| 147 | dsimp only [delta] |
| 148 | linarith |
| 149 | have hdeta : C * (2 * delta) < eta := by |
| 150 | have hh := mul_le_mul_of_nonneg_left (min_le_right (1 : ℝ) (eta / C)) hC.le |
| 151 | have hdiv : C * (eta / C) = eta := by field_simp [hC.ne'] |
| 152 | rw [hdiv] at hh |
| 153 | dsimp only [delta] |
| 154 | nlinarith |
| 155 | let O : Set M := (U1 ∩ U2) ∩ (W ∩ g.ball p0 delta) |
| 156 | have hballOpen : IsOpen (g.ball p0 delta) := by |
| 157 | have heq : g.ball p0 delta = Metric.eball p0 (ENNReal.ofReal delta) := by |
| 158 | ext p |
| 159 | change (g.edist p0 p < ENNReal.ofReal delta) ↔ |
| 160 | (g.edist p p0 < ENNReal.ofReal delta) |
| 161 | rw [show g.edist p0 p = g.edist p p0 from Manifold.riemannianEDist_comm] |
| 162 | rw [heq] |
| 163 | exact Metric.isOpen_eball |
| 164 | have hOopen : IsOpen O := (hU1.inter hU2).inter (hWopen.inter hballOpen) |
| 165 | have hpO : p0 ∈ O := by |
| 166 | refine ⟨⟨hpU1, hpU2⟩, hpW, ?_⟩ |
| 167 | change g.edist p0 p0 < ENNReal.ofReal delta |
| 168 | simpa only [RiemannianMetric.edist, Manifold.riemannianEDist_self] using |
| 169 | ENNReal.ofReal_pos.mpr hdelta |
| 170 | have hOsource {p : M} (hp : p ∈ O) : p ∈ c.source := (hWsub hp.2.1).1 |
| 171 | have hOcoord {p : M} (hp : p ∈ O) : c p ∈ ball x0 eta := (hWsub hp.2.1).2.1 |
| 172 | have hOV {p : M} (hp : p ∈ O) : c p ∈ V := (hWsub hp.2.1).2.2 |
| 173 | have hpqTarget {p q : M} (hp : p ∈ O) (hq : q ∈ O) : |
| 174 | (c p, c q) ∈ e.target := |
| 175 | hUV (show (p, q) ∈ U1 ×ˢ U2 from ⟨hp.1.1, hq.1.2⟩) |
| 176 | have hpqSmall {p q : M} (hp : p ∈ O) (hq : q ∈ O) : |
| 177 | g.edist p q < ENNReal.ofReal 1 ∧ C * (g.edist p q).toReal < eta := by |
| 178 | have hdist : g.edist p q < ENNReal.ofReal (2 * delta) := by |
| 179 | calc |
| 180 | g.edist p q ≤ g.edist p p0 + g.edist p0 q := |
| 181 | Manifold.riemannianEDist_triangle |
| 182 | _ < ENNReal.ofReal delta + ENNReal.ofReal delta := ENNReal.add_lt_add |
| 183 | (by |
| 184 | rw [show g.edist p p0 = g.edist p0 p from Manifold.riemannianEDist_comm] |
| 185 | exact hp.2.2) hq.2.2 |
| 186 | _ = ENNReal.ofReal (2 * delta) := by |
| 187 | rw [← ENNReal.ofReal_add hdelta.le hdelta.le] |
| 188 | congr 1 |
| 189 | ring |
| 190 | refine ⟨hdist.trans ((ENNReal.ofReal_lt_ofReal_iff (by norm_num)).mpr hd1), ?_⟩ |
| 191 | exact (mul_lt_mul_of_pos_left (ENNReal.toReal_lt_of_lt_ofReal hdist) hC).trans hdeta |
| 192 | let Z : M × M → E × E := fun pq => e.symm (c pq.1, c pq.2) |
| 193 | let H : ℝ × (M × M) → M := fun w => curve (Z w.2) w.1 |
| 194 | -- Actual chart velocities are bounded by intrinsic speeds in the fixed chart. |
| 195 | have hvelocity {gamma : ℝ → M} |
| 196 | (hgamma : g.IsGeodesicOn gamma (Icc (0 : ℝ) 1)) |
| 197 | {p : M} (hp : p ∈ O) (hstart : gamma 0 = p) : |
| 198 | ‖deriv (fun t => c (gamma t)) 0‖ ≤ |
| 199 | C * g.tangentNorm (gamma 0) |
| 200 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) gamma 0 1) := by |
| 201 | have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by norm_num |
| 202 | have hsrc : gamma 0 ∈ c.source := by simpa only [hstart] using hOsource hp |
| 203 | have hd := (hgamma.hasDerivAt_chart_at h0 p0 hsrc).1 |
| 204 | have heq : gamma =ᶠ[𝓝 0] fun t => c.symm (c (gamma t)) := by |
| 205 | filter_upwards [(hgamma.contMDiffAt h0).continuousAt.preimage_mem_nhds |
| 206 | (hcopen.mem_nhds hsrc)] with t ht |
| 207 | exact (c.left_inv ht).symm |
| 208 | have hmetric : g.tangentNorm (gamma 0) |
| 209 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) gamma 0 1) = |
| 210 | g.tangentNorm (c.symm (c p)) |
| 211 | (mfderiv (𝓡 n) (𝓡 n) c.symm (c p) |
| 212 | (deriv (fun t => c (gamma t)) 0)) := by |
| 213 | rw [← hstart] |
| 214 | conv_lhs => rw [heq.mfderiv_eq, heq.self_of_nhds] |
| 215 | have hh := g.tangentNorm_chart_curve p0 hd (c.map_source hsrc) |
| 216 | simpa +instances only [c, RiemannianMetric.tangentNorm, |
| 217 | RiemannianMetric.pullbackCoefficients, ContinuousLinearMap.bilinearComp_apply] using! hh |
| 218 | rw [hmetric] |
| 219 | exact hnorm _ (hOV hp) _ |
| 220 | -- Closed-interval intrinsic uniqueness identifies the actual inverse input. |
| 221 | have hmatch {p q : M} (hp : p ∈ O) (hq : q ∈ O) |
| 222 | {gamma : ℝ → M} (hgamma : g.IsGeodesicOn gamma (Icc (0 : ℝ) 1)) |
| 223 | (hstart : gamma 0 = p) (hfinish : gamma 1 = q) |
| 224 | (hspeed : g.tangentNorm (gamma 0) |
| 225 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) gamma 0 1) = (g.edist p q).toReal) : |
| 226 | ∀ t ∈ Icc (0 : ℝ) 1, gamma =ᶠ[𝓝 t] fun t => H (t, p, q) := by |
| 227 | let v : E := deriv (fun t => c (gamma t)) 0 |
| 228 | have hv : v ∈ ball (0 : E) eta := by |
| 229 | have hh := hvelocity hgamma hp hstart |
| 230 | rw [hspeed] at hh |
| 231 | simpa only [Metric.mem_ball, dist_zero_right] using hh.trans_lt (hpqSmall hp hq).2 |
| 232 | have hz : (c p, v) ∈ e.source := hbox (hOcoord hp) hv |
| 233 | have heq0 : gamma 0 = curve (c p, v) 0 := by |
| 234 | rw [hstart, hcurve0 _ hz, c.left_inv (hOsource hp)] |
| 235 | have hder0 : deriv (fun t => c (gamma t)) 0 = |
| 236 | deriv (fun t => c (curve (c p, v) t)) 0 := (hcurveDeriv _ hz).deriv.symm |
| 237 | have hgeq := hgamma.eq_nhds_on_of_initial_data |
| 238 | (show g.IsGeodesicOn (curve (c p, v)) (Icc (0 : ℝ) 1) from |
| 239 | fun t ht => hcurve _ hz t ⟨by linarith [ht.1], by linarith [ht.2]⟩) |
| 240 | (convex_Icc (0 : ℝ) 1).isPreconnected (t₀ := 0) (by norm_num) p0 |
| 241 | (by simpa only [hstart] using hOsource hp) heq0 hder0 |
| 242 | have hend : curve (c p, v) 1 = q := |
| 243 | (hgeq 1 (by norm_num)).self_of_nhds.symm.trans hfinish |
| 244 | have hcoordEnd : (e (c p, v)).2 = c q := by |
| 245 | have hh := congrArg c hend |
| 246 | rw [hcurve1 _ hz] at hh |
| 247 | have ht : (e (c p, v)).2 ∈ c.target := by |
| 248 | rw [← (hspec _ hz).2.1] |
| 249 | exact ((hspec _ hz).2.2 1 (by norm_num)).1 |
| 250 | rwa [c.right_inv ht] at hh |
| 251 | have hepair : e (c p, v) = (c p, c q) := |
| 252 | Prod.ext (hefirst _ hz) hcoordEnd |
| 253 | have hinput : Z (p, q) = (c p, v) := by |
| 254 | change e.symm (c p, c q) = (c p, v) |
| 255 | rw [← hepair, e.left_inv hz] |
| 256 | intro t ht |
| 257 | simpa only [H, hinput] using hgeq t ht |
| 258 | refine ⟨O, hOopen, hpO, ?_⟩ |
| 259 | intro p hp q hq gamma eta hgamma0' heta0' hgamma0 heta0 hgamma1 heta1 hsGamma hsEta t ht |
| 260 | exact ((hmatch hp hq hgamma0' hgamma0 hgamma1 hsGamma t ht).self_of_nhds).trans |
| 261 | ((hmatch hp hq heta0' heta0 heta1 hsEta t ht).self_of_nhds).symm |
| 262 | |
| 263 | end PoincareMT |