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.Analysis.Paths.PathLengthAnchors |
| 3 | |
| 4 | /-! |
| 5 | # Exact-length path extensions inside a captured ball |
| 6 | |
| 7 | Morgan--Tian Claim 10.6, printed p. 252, needs a finite extension from a |
| 8 | regular point. If an ambient ball is contained in a region and a C1 path |
| 9 | ends outside that region, any sufficiently short prescribed length from a |
| 10 | nearby path point is attained before the endpoint. The entire subarc stays |
| 11 | in the ball. The backward version treats the other original endpoint. |
| 12 | See `proof-work/tasks/M28/derivations/70-regular-minimizer-extension.md`. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.M28 |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | |
| 27 | /-- A path ending outside a captured ball's region admits an exact-length |
| 28 | forward subarc in that ball, provided the initial error plus its length is |
| 29 | less than the radius (Claim 10.6; M28 derivation 70). -/ |
| 30 | theorem exists_pathELength_right_anchor_in_ball |
| 31 | (g : RiemannianMetric n M) {U : Set M} {x : M} |
| 32 | {delta e L a b : ℝ} {γ : ℝ → M} |
| 33 | (hab : a < b) |
| 34 | (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 γ (Icc a b)) |
| 35 | (he : 0 ≤ e) (hL : 0 < L) (hbudget : e + L < delta) |
| 36 | (hstart : g.edist x (γ a) ≤ ENNReal.ofReal e) |
| 37 | (hend : γ b ∉ U) (hcapture : g.ball x delta ⊆ U) : |
| 38 | ∃ t ∈ Ioo a b, g.pathELength γ a t = ENNReal.ofReal L ∧ |
| 39 | MapsTo γ (Icc a t) (g.ball x delta) := by |
| 40 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 41 | ⟨g.toRiemannianMetric⟩ |
| 42 | have hdelta : 0 < delta := (add_pos_of_nonneg_of_pos he hL).trans hbudget |
| 43 | have hsum : ENNReal.ofReal e + ENNReal.ofReal L < ENNReal.ofReal delta := by |
| 44 | rw [← ENNReal.ofReal_add he hL.le] |
| 45 | exact (ENNReal.ofReal_lt_ofReal_iff hdelta).mpr hbudget |
| 46 | have hroom : ENNReal.ofReal L < g.pathELength γ a b := by |
| 47 | by_contra hnot |
| 48 | have hlen : g.pathELength γ a b ≤ ENNReal.ofReal L := le_of_not_gt hnot |
| 49 | have hdist : g.edist (γ a) (γ b) ≤ g.pathELength γ a b := |
| 50 | Manifold.riemannianEDist_le_pathELength hγ rfl rfl hab.le |
| 51 | have htriangle : g.edist x (γ b) ≤ g.edist x (γ a) + g.edist (γ a) (γ b) := |
| 52 | Manifold.riemannianEDist_triangle |
| 53 | exact hend (hcapture ((htriangle.trans |
| 54 | (add_le_add hstart (hdist.trans hlen))).trans_lt hsum)) |
| 55 | obtain ⟨t, ht, hlength⟩ := exists_pathELength_right_anchor g hab hγ hL hroom |
| 56 | refine ⟨t, ht, hlength, ?_⟩ |
| 57 | intro s hs |
| 58 | have hsmooth := hγ.mono (Icc_subset_Icc le_rfl (hs.2.trans ht.2.le)) |
| 59 | have hdist : g.edist (γ a) (γ s) ≤ g.pathELength γ a s := |
| 60 | Manifold.riemannianEDist_le_pathELength hsmooth rfl rfl hs.1 |
| 61 | have hsub : g.pathELength γ a s ≤ g.pathELength γ a t := |
| 62 | Manifold.pathELength_mono le_rfl hs.2 |
| 63 | have htriangle : g.edist x (γ s) ≤ g.edist x (γ a) + g.edist (γ a) (γ s) := |
| 64 | Manifold.riemannianEDist_triangle |
| 65 | change g.edist x (γ s) < ENNReal.ofReal delta |
| 66 | exact (htriangle.trans (add_le_add hstart |
| 67 | (hdist.trans (hsub.trans_eq hlength)))).trans_lt hsum |
| 68 | |
| 69 | /-- The backward exact-length extension in a captured ambient ball. No |
| 70 | orientation or positive-speed assumption is required (Claim 10.6; M28 |
| 71 | derivation 70). -/ |
| 72 | theorem exists_pathELength_left_anchor_in_ball |
| 73 | (g : RiemannianMetric n M) {U : Set M} {x : M} |
| 74 | {delta e L a b : ℝ} {γ : ℝ → M} |
| 75 | (hab : a < b) |
| 76 | (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 γ (Icc a b)) |
| 77 | (he : 0 ≤ e) (hL : 0 < L) (hbudget : e + L < delta) |
| 78 | (hstart : g.edist x (γ b) ≤ ENNReal.ofReal e) |
| 79 | (hend : γ a ∉ U) (hcapture : g.ball x delta ⊆ U) : |
| 80 | ∃ t ∈ Ioo a b, g.pathELength γ t b = ENNReal.ofReal L ∧ |
| 81 | MapsTo γ (Icc t b) (g.ball x delta) := by |
| 82 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 83 | ⟨g.toRiemannianMetric⟩ |
| 84 | have hdelta : 0 < delta := (add_pos_of_nonneg_of_pos he hL).trans hbudget |
| 85 | have hsum : ENNReal.ofReal e + ENNReal.ofReal L < ENNReal.ofReal delta := by |
| 86 | rw [← ENNReal.ofReal_add he hL.le] |
| 87 | exact (ENNReal.ofReal_lt_ofReal_iff hdelta).mpr hbudget |
| 88 | have hroom : ENNReal.ofReal L < g.pathELength γ a b := by |
| 89 | by_contra hnot |
| 90 | have hlen : g.pathELength γ a b ≤ ENNReal.ofReal L := le_of_not_gt hnot |
| 91 | have hdist : g.edist (γ b) (γ a) ≤ g.pathELength γ a b := by |
| 92 | change Manifold.riemannianEDist (𝓡 n) (γ b) (γ a) ≤ _ |
| 93 | rw [Manifold.riemannianEDist_comm] |
| 94 | exact Manifold.riemannianEDist_le_pathELength hγ rfl rfl hab.le |
| 95 | have htriangle : g.edist x (γ a) ≤ g.edist x (γ b) + g.edist (γ b) (γ a) := |
| 96 | Manifold.riemannianEDist_triangle |
| 97 | exact hend (hcapture ((htriangle.trans |
| 98 | (add_le_add hstart (hdist.trans hlen))).trans_lt hsum)) |
| 99 | obtain ⟨t, ht, hlength⟩ := exists_pathELength_left_anchor g hab hγ hL hroom |
| 100 | refine ⟨t, ht, hlength, ?_⟩ |
| 101 | intro s hs |
| 102 | have hsmooth := hγ.mono (Icc_subset_Icc (ht.1.le.trans hs.1) le_rfl) |
| 103 | have hdist : g.edist (γ b) (γ s) ≤ g.pathELength γ s b := by |
| 104 | change Manifold.riemannianEDist (𝓡 n) (γ b) (γ s) ≤ _ |
| 105 | rw [Manifold.riemannianEDist_comm] |
| 106 | exact Manifold.riemannianEDist_le_pathELength hsmooth rfl rfl hs.2 |
| 107 | have hsub : g.pathELength γ s b ≤ g.pathELength γ t b := |
| 108 | Manifold.pathELength_mono hs.1 le_rfl |
| 109 | have htriangle : g.edist x (γ s) ≤ g.edist x (γ b) + g.edist (γ b) (γ s) := |
| 110 | Manifold.riemannianEDist_triangle |
| 111 | change g.edist x (γ s) < ENNReal.ofReal delta |
| 112 | exact (htriangle.trans (add_le_add hstart |
| 113 | (hdist.trans (hsub.trans_eq hlength)))).trans_lt hsum |
| 114 | |
| 115 | end PoincareMT.M28 |