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.Riemannian.Connection |
| 3 | import Mathlib.Geometry.Manifold.Riemannian.PathELength |
| 4 | |
| 5 | /-! |
| 6 | # An additive distance margin from mandatory path crossings |
| 7 | |
| 8 | Split each competing path at a crossing, replace its suffix by a short |
| 9 | path to the tested point, and retain the difference of the two costs. |
| 10 | The argument uses extended distances throughout and needs no minimizing |
| 11 | path or completeness. Source: Morgan--Tian Claim 10.8, p. 254; |
| 12 | M28 derivations 86 and 123. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped Manifold ContDiff Bundle ENNReal |
| 19 | |
| 20 | namespace PoincareMT.RiemannianMetric |
| 21 | |
| 22 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | |
| 25 | /-- Splitting every competitor at a mandatory crossing bounds the tested |
| 26 | distance plus the escape cost by the endpoint distance plus the shortcut |
| 27 | cost. No ordering of the costs or finite endpoint distance is required. |
| 28 | Source: Claim 10.8, p. 254; M28 derivation 134, shrinking the whole tail. -/ |
| 29 | theorem edist_add_escape_le_add_shortcut_of_path_crossing |
| 30 | (g : RiemannianMetric n M) |
| 31 | {b p x : M} {S : Set M} {c e : ℝ≥0∞} |
| 32 | (hcross : ∀ gamma : ℝ → M, gamma 0 = b → gamma 1 = p → |
| 33 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 gamma (Icc (0 : ℝ) 1) → |
| 34 | ∃ t ∈ Icc (0 : ℝ) 1, gamma t ∈ S) |
| 35 | (hescape : ∀ y ∈ S, e ≤ g.edist y p) |
| 36 | (hshort : ∀ y ∈ S, g.edist y x ≤ c) : |
| 37 | g.edist b x + e ≤ g.edist b p + c := by |
| 38 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 39 | ⟨g.toRiemannianMetric⟩ |
| 40 | apply ENNReal.le_of_forall_pos_le_add |
| 41 | intro eta heta _ |
| 42 | by_cases hp : g.edist b p = ⊤ |
| 43 | · simp only [hp, top_add, le_top] |
| 44 | obtain ⟨gamma, h0, h1, hgamma, hlength⟩ := |
| 45 | Manifold.exists_lt_of_riemannianEDist_lt |
| 46 | (ENNReal.lt_add_right hp (ENNReal.coe_ne_zero.mpr heta.ne')) |
| 47 | obtain ⟨t, ht, htS⟩ := hcross gamma h0 h1 hgamma |
| 48 | have hprefix : g.edist b (gamma t) ≤ g.pathELength gamma 0 t := |
| 49 | Manifold.riemannianEDist_le_pathELength |
| 50 | (hgamma.mono (Icc_subset_Icc le_rfl ht.2)) h0 rfl ht.1 |
| 51 | have hsuffix : g.edist (gamma t) p ≤ g.pathELength gamma t 1 := |
| 52 | Manifold.riemannianEDist_le_pathELength |
| 53 | (hgamma.mono (Icc_subset_Icc ht.1 le_rfl)) rfl h1 ht.2 |
| 54 | calc |
| 55 | g.edist b x + e ≤ |
| 56 | (g.pathELength gamma 0 t + c) + g.pathELength gamma t 1 := |
| 57 | add_le_add |
| 58 | (Manifold.riemannianEDist_triangle.trans (add_le_add hprefix (hshort _ htS))) |
| 59 | ((hescape _ htS).trans hsuffix) |
| 60 | _ = (g.pathELength gamma 0 t + g.pathELength gamma t 1) + c := by ac_rfl |
| 61 | _ = g.pathELength gamma 0 1 + c := by |
| 62 | rw [show g.pathELength gamma 0 t + g.pathELength gamma t 1 = |
| 63 | g.pathELength gamma 0 1 from Manifold.pathELength_add ht.1 ht.2] |
| 64 | _ ≤ (g.edist b p + eta) + c := add_le_add hlength.le le_rfl |
| 65 | _ = (g.edist b p + c) + eta := by ac_rfl |
| 66 | |
| 67 | /-- A mandatory crossing with an escape cost exceeding the shortcut |
| 68 | cost yields an additive Riemannian distance margin. Only the finite |
| 69 | shortcut cost is cancelled, so infinite endpoint distances are allowed. |
| 70 | Source: Claim 10.8, p. 254; M28 derivations 86 and 123. -/ |
| 71 | theorem edist_add_le_of_path_crossing (g : RiemannianMetric n M) |
| 72 | {b p x : M} {S : Set M} {c e delta : ℝ≥0∞} (hc : c ≠ ⊤) |
| 73 | (hgap : c + delta ≤ e) |
| 74 | (hcross : ∀ gamma : ℝ → M, gamma 0 = b → gamma 1 = p → |
| 75 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 gamma (Icc (0 : ℝ) 1) → |
| 76 | ∃ t ∈ Icc (0 : ℝ) 1, gamma t ∈ S) |
| 77 | (hescape : ∀ y ∈ S, e ≤ g.edist y p) |
| 78 | (hshort : ∀ y ∈ S, g.edist y x ≤ c) : |
| 79 | g.edist b x + delta ≤ g.edist b p := by |
| 80 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 81 | ⟨g.toRiemannianMetric⟩ |
| 82 | apply le_of_forall_gt_imp_ge_of_dense |
| 83 | intro R hR |
| 84 | obtain ⟨gamma, h0, h1, hgamma, hlength⟩ := |
| 85 | Manifold.exists_lt_of_riemannianEDist_lt hR |
| 86 | obtain ⟨t, ht, htS⟩ := hcross gamma h0 h1 hgamma |
| 87 | have hprefix : g.edist b (gamma t) ≤ g.pathELength gamma 0 t := |
| 88 | Manifold.riemannianEDist_le_pathELength |
| 89 | (hgamma.mono (Icc_subset_Icc le_rfl ht.2)) h0 rfl ht.1 |
| 90 | have hsuffix : g.edist (gamma t) p ≤ g.pathELength gamma t 1 := |
| 91 | Manifold.riemannianEDist_le_pathELength |
| 92 | (hgamma.mono (Icc_subset_Icc ht.1 le_rfl)) rfl h1 ht.2 |
| 93 | have hshortcut : g.edist b x ≤ g.pathELength gamma 0 t + c := |
| 94 | Manifold.riemannianEDist_triangle.trans (add_le_add hprefix (hshort _ htS)) |
| 95 | have hsum : g.edist b x + (c + delta) ≤ g.pathELength gamma 0 1 + c := by |
| 96 | calc |
| 97 | _ ≤ g.edist b x + e := add_le_add le_rfl hgap |
| 98 | _ ≤ (g.pathELength gamma 0 t + c) + g.pathELength gamma t 1 := |
| 99 | add_le_add hshortcut ((hescape _ htS).trans hsuffix) |
| 100 | _ = (g.pathELength gamma 0 t + g.pathELength gamma t 1) + c := by ac_rfl |
| 101 | _ = _ := by rw [show g.pathELength gamma 0 t + g.pathELength gamma t 1 = |
| 102 | g.pathELength gamma 0 1 from Manifold.pathELength_add ht.1 ht.2] |
| 103 | apply ENNReal.le_of_add_le_add_right hc |
| 104 | calc |
| 105 | (g.edist b x + delta) + c = g.edist b x + (c + delta) := by ac_rfl |
| 106 | _ ≤ g.pathELength gamma 0 1 + c := hsum |
| 107 | _ ≤ R + c := add_le_add hlength.le le_rfl |
| 108 | |
| 109 | end PoincareMT.RiemannianMetric |