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.CapGeometry.CapRecutBoundary |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Persistence.CapTopology.NeckCollar |
| 4 | import Mathlib.Topology.Order.Compact |
| 5 | |
| 6 | /-!+# Actual neck subarcs of cap excursions |
| 7 | |
| 8 | Morgan--Tian Claim 10.4, pp. 249-250, and the relative shortening argument |
| 9 | in Corollary A.8, p. 501. A path from the actual central sphere to the |
| 10 | closed core contains an actual closed-neck subarc joining two prescribed |
| 11 | coordinate spheres. Compact first and last hitting sets select the subarc; |
| 12 | the original path need not stay in the cap. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped Manifold ContDiff Bundle Topology |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | private theorem path_enters_open_frontier {X : Type*} [TopologicalSpace X] |
| 23 | {U : Set X} (hU : IsOpen U) {γ : ℝ → X} {a b : ℝ} (hab : a ≤ b) |
| 24 | (hγ : ContinuousOn γ (Icc a b)) (ha : γ a ∉ U) (hb : γ b ∈ U) : |
| 25 | ∃ t ∈ Icc a b, γ t ∈ frontier U := by |
| 26 | have hconn : IsPreconnected (γ '' Icc a b) := |
| 27 | isPreconnected_Icc.image γ hγ |
| 28 | by_contra hcross |
| 29 | push Not at hcross |
| 30 | have hsubset : γ '' Icc a b ⊆ U := by |
| 31 | apply hconn.subset_of_closure_inter_subset hU |
| 32 | ⟨γ b, ⟨b, right_mem_Icc.mpr hab, rfl⟩, hb⟩ |
| 33 | rintro x ⟨hxcl, t, ht, rfl⟩ |
| 34 | by_contra hxnot |
| 35 | exact hcross t ht (hU.frontier_eq.symm ▸ And.intro hxcl hxnot) |
| 36 | exact ha (hsubset ⟨a, left_mem_Icc.mpr hab, rfl⟩) |
| 37 | |
| 38 | namespace PoincareMT.CapCertificate |
| 39 | |
| 40 | variable {M : Type u} [TopologicalSpace M] |
| 41 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 42 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 43 | [T2Space M] [T3Space M] {g : RiemannianMetric 3 M} |
| 44 | |
| 45 | /-- A continuous path from the central sphere into the closed core has an |
| 46 | actual subarc in the closed end-neck slab `[q,0]`, with the exact endpoint |
| 47 | heights. No containment hypothesis is imposed on the original path. -/ |
| 48 | theorem exists_incoming_neck_subarc (N : CapCertificate g) {q : ℝ} |
| 49 | (hqlo : -N.epsilon⁻¹ < q) (hq : q < 0) |
| 50 | {γ : ℝ → M} {a b : ℝ} (hab : a ≤ b) |
| 51 | (hγ : ContinuousOn γ (Icc a b)) |
| 52 | (ha : γ a ∈ N.end_neck.central_sphere) (hb : γ b ∈ N.closed_core) : |
| 53 | ∃ v u : ℝ, a ≤ v ∧ v < u ∧ u ≤ b ∧ |
| 54 | γ v ∈ N.end_neck.central_sphere ∧ |
| 55 | γ u ∈ N.end_neck.coordinate_map '' (univ ×ˢ ({q} : Set ℝ)) ∧ |
| 56 | MapsTo γ (Icc v u) |
| 57 | (N.end_neck.coordinate_map '' (univ ×ˢ Icc q 0)) := by |
| 58 | let Wq : Set M := N.closed_core ∪ N.end_neck.region (-N.epsilon⁻¹) q |
| 59 | let W0 : Set M := N.closed_core ∪ N.end_neck.region (-N.epsilon⁻¹) 0 |
| 60 | have h0hi : 0 < N.epsilon⁻¹ := inv_pos.mpr N.epsilon_pos |
| 61 | have h0lo : -N.epsilon⁻¹ < 0 := neg_neg_of_pos h0hi |
| 62 | have hqhi : q < N.epsilon⁻¹ := hq.trans h0hi |
| 63 | have hWq : IsOpen Wq := N.isOpen_recut hqlo hqhi |
| 64 | have hW0 : IsOpen W0 := N.isOpen_recut h0lo h0hi |
| 65 | have hfrontq : frontier Wq = |
| 66 | N.end_neck.coordinate_map '' (univ ×ˢ ({q} : Set ℝ)) := |
| 67 | N.frontier_innerRecut hqlo hqhi |
| 68 | have hfront0 : frontier W0 = N.end_neck.central_sphere := by |
| 69 | rw [N.end_neck.central_sphere_eq] |
| 70 | exact N.frontier_innerRecut h0lo h0hi |
| 71 | have haN : γ a ∈ N.end_neck.carrier := N.end_neck.central_sphere_subset ha |
| 72 | have ha0 : (N.end_neck.coordinate_inverse (γ a)).2 = 0 := |
| 73 | (N.end_neck.mem_central_sphere_iff_of_mem_carrier haN).mp ha |
| 74 | have haWq : γ a ∉ Wq := by |
| 75 | rintro (hcore | hregion) |
| 76 | · rw [N.closed_core_eq_complement_end] at hcore |
| 77 | exact hcore.2 haN |
| 78 | · have hlt := hregion.2.2 |
| 79 | rw [ha0] at hlt |
| 80 | exact (not_lt_of_ge hq.le) hlt |
| 81 | obtain ⟨t₀, ht₀, hfront₀⟩ := |
| 82 | path_enters_open_frontier hWq hab hγ haWq (Or.inl hb) |
| 83 | let Kq : Set ℝ := Icc a b ∩ γ ⁻¹' frontier Wq |
| 84 | have hKq : IsCompact Kq := isCompact_Icc.of_isClosed_subset |
| 85 | (hγ.preimage_isClosed_of_isClosed isClosed_Icc isClosed_frontier) inter_subset_left |
| 86 | obtain ⟨u, hu, huleast⟩ := hKq.exists_isLeast ⟨t₀, ht₀, hfront₀⟩ |
| 87 | have huq : γ u ∈ N.end_neck.coordinate_map '' (univ ×ˢ ({q} : Set ℝ)) := |
| 88 | hfrontq ▸ hu.2 |
| 89 | obtain ⟨z, hz, hzγ⟩ := huq |
| 90 | have hzq : z.2 = q := hz.2 |
| 91 | have hzN : z.2 ∈ Ioo (-N.end_neck.epsilon⁻¹) N.end_neck.epsilon⁻¹ := by |
| 92 | rw [N.end_neck_epsilon, hzq] |
| 93 | exact ⟨hqlo, hqhi⟩ |
| 94 | have huN : γ u ∈ N.end_neck.carrier := |
| 95 | hzγ ▸ N.end_neck.coordinate_map_mem_of_axial z hzN |
| 96 | have huheight : (N.end_neck.coordinate_inverse (γ u)).2 = q := by |
| 97 | rw [← hzγ, N.end_neck.coordinate_inverse_coordinate_map_of_axial z hzN] |
| 98 | exact hzq |
| 99 | have huW0 : γ u ∈ W0 := Or.inr ⟨huN, by rw [huheight]; exact ⟨hqlo, hq⟩⟩ |
| 100 | have huNotFront0 : γ u ∉ frontier W0 := by |
| 101 | intro h |
| 102 | exact (hW0.frontier_eq ▸ h).2 huW0 |
| 103 | let K0 : Set ℝ := Icc a u ∩ γ ⁻¹' frontier W0 |
| 104 | have hγau : ContinuousOn γ (Icc a u) := |
| 105 | hγ.mono (Icc_subset_Icc le_rfl hu.1.2) |
| 106 | have hK0 : IsCompact K0 := isCompact_Icc.of_isClosed_subset |
| 107 | (hγau.preimage_isClosed_of_isClosed isClosed_Icc isClosed_frontier) inter_subset_left |
| 108 | obtain ⟨v, hv, hvgreatest⟩ := hK0.exists_isGreatest |
| 109 | ⟨a, left_mem_Icc.mpr hu.1.1, hfront0.symm ▸ ha⟩ |
| 110 | have hvu : v < u := lt_of_le_of_ne hv.1.2 (by |
| 111 | intro heq |
| 112 | exact huNotFront0 (heq ▸ hv.2)) |
| 113 | refine ⟨v, u, hv.1.1, hvu, hu.1.2, hfront0 ▸ hv.2, |
| 114 | ⟨z, hz, hzγ⟩, ?_⟩ |
| 115 | intro t ht |
| 116 | have htab : t ∈ Icc a b := ⟨hv.1.1.trans ht.1, ht.2.trans hu.1.2⟩ |
| 117 | have htNotWq : γ t ∉ Wq := by |
| 118 | intro htWq |
| 119 | have htu : t < u := lt_of_le_of_ne ht.2 (by |
| 120 | intro heq |
| 121 | exact (hWq.frontier_eq ▸ hu.2).2 (heq ▸ htWq)) |
| 122 | obtain ⟨s, hs, hsfront⟩ := path_enters_open_frontier hWq htab.1 |
| 123 | (hγ.mono (Icc_subset_Icc le_rfl htab.2)) haWq htWq |
| 124 | have hus : u ≤ s := huleast ⟨⟨hs.1, hs.2.trans htab.2⟩, hsfront⟩ |
| 125 | exact (not_lt_of_ge (hus.trans hs.2)) htu |
| 126 | have htClosure : γ t ∈ closure W0 := by |
| 127 | by_contra htout |
| 128 | have hvt : v < t := lt_of_le_of_ne ht.1 (by |
| 129 | intro heq |
| 130 | exact htout (heq ▸ frontier_subset_closure hv.2)) |
| 131 | obtain ⟨s, hs, hsfront⟩ := path_enters_open_frontier hW0 ht.2 |
| 132 | (hγ.mono (Icc_subset_Icc htab.1 hu.1.2)) |
| 133 | (fun htW0 => htout (subset_closure htW0)) huW0 |
| 134 | have hsv : s ≤ v := hvgreatest ⟨⟨htab.1.trans hs.1, hs.2⟩, hsfront⟩ |
| 135 | exact (not_lt_of_ge hsv) (hvt.trans_le hs.1) |
| 136 | have htcap : γ t ∈ N.carrier := |
| 137 | (N.open_precompact_recut h0lo h0hi).2.2 htClosure |
| 138 | have htN : γ t ∈ N.end_neck.carrier := by |
| 139 | by_contra htNotN |
| 140 | apply htNotWq |
| 141 | apply Or.inl |
| 142 | rw [N.closed_core_eq_complement_end] |
| 143 | exact ⟨htcap, htNotN⟩ |
| 144 | have htlo : -N.epsilon⁻¹ < (N.end_neck.coordinate_inverse (γ t)).2 := by |
| 145 | simpa only [N.end_neck_epsilon] using |
| 146 | (N.end_neck.coordinate_inverse_mem (γ t) htN).2.1 |
| 147 | have htq : q ≤ (N.end_neck.coordinate_inverse (γ t)).2 := by |
| 148 | by_contra h |
| 149 | exact htNotWq (Or.inr ⟨htN, htlo, lt_of_not_ge h⟩) |
| 150 | have htzero : (N.end_neck.coordinate_inverse (γ t)).2 ≤ 0 := by |
| 151 | rw [closure_eq_self_union_frontier] at htClosure |
| 152 | rcases htClosure with htW0 | htfront |
| 153 | · rcases htW0 with htcore | htregion |
| 154 | · exact False.elim (htNotWq (Or.inl htcore)) |
| 155 | · exact htregion.2.2.le |
| 156 | · exact ((N.end_neck.mem_central_sphere_iff_of_mem_carrier htN).mp (hfront0 ▸ htfront)).le |
| 157 | exact ⟨N.end_neck.coordinate_inverse (γ t), ⟨mem_univ _, htq, htzero⟩, |
| 158 | N.end_neck.coordinate_map_coordinate_inverse htN⟩ |
| 159 | |
| 160 | end PoincareMT.CapCertificate |