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.Comparison.Geometry |
| 2 | import PoincareLib.Topology.Surface.Euler.Incidence |
| 3 | |
| 4 | /-! |
| 5 | # Actual capped cells of a return region |
| 6 | |
| 7 | The coordinate faces and the closure of the exterior Jordan domain form a |
| 8 | regular closed cover of the plane. Every canonical edge midpoint belongs to |
| 9 | exactly two distinct capped cells. This supplies actual incidence for the disk |
| 10 | Euler step in Morgan--Tian Lemma 19.45, printed p. 474, and Proposition 19.35, |
| 11 | pp. 472-481. See `2026-09-25-capped-region-incidence.md` for the derivation. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Topology ContDiff Manifold |
| 19 | open PoincareMT.Topology.Surface |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | /-- The actual regional faces together with the closed exterior Jordan cell. This is the |
| 24 | capped cover used in the disk Euler step of Lemma 19.45. Source/construction: |
| 25 | proof-work/tasks/M64/derivations/2026-09-25-capped-region-incidence.md. -/ |
| 26 | def m64Intrinsic_cappedRegionCarrier {I : Type*} |
| 27 | (face : I → SmoothFace AnnulusCoordinates) (V : Set AnnulusCoordinates) : |
| 28 | Sum I Unit → Set AnnulusCoordinates := |
| 29 | Sum.elim (fun i => (face i).carrier) (fun _ => closure V) |
| 30 | |
| 31 | /-- The final coordinate faces and the exterior closure form a regular closed cover. Capping |
| 32 | does not enlarge the union of the original face frontiers. Source: the regional construction |
| 33 | for Lemma 19.45, printed p. 474. -/ |
| 34 | theorem m64Intrinsic_capped_region_cover |
| 35 | {I : Type*} [Finite I] (face : I → SmoothFace AnnulusCoordinates) |
| 36 | (C : I → OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 37 | (b : I → AffineBasis (Fin 3) ℝ AnnulusCoordinates) |
| 38 | (hsource : ∀ i, convexHull ℝ (range (b i)) ⊆ (C i).source) |
| 39 | (hcarrier : ∀ i, (face i).carrier = C i '' convexHull ℝ (range (b i))) |
| 40 | (hfront : ∀ i j, i ≠ j → |
| 41 | (face i).carrier ∩ (face j).carrier ⊆ frontier (face i).carrier) |
| 42 | {U V : Set AnnulusCoordinates} (hU : IsOpen U) (hV : IsOpen V) |
| 43 | (hdisj : Disjoint U V) (hfrontier : frontier U = frontier V) |
| 44 | (hclosure : closure U ∪ closure V = univ) |
| 45 | (hregion : (⋃ i, (face i).carrier) = closure U) : |
| 46 | (∀ a, IsClosed (m64Intrinsic_cappedRegionCarrier face V a)) ∧ |
| 47 | (∀ a, closure (interior (m64Intrinsic_cappedRegionCarrier face V a)) = |
| 48 | m64Intrinsic_cappedRegionCarrier face V a) ∧ |
| 49 | Pairwise (fun a d => Disjoint |
| 50 | (interior (m64Intrinsic_cappedRegionCarrier face V a)) |
| 51 | (interior (m64Intrinsic_cappedRegionCarrier face V d))) ∧ |
| 52 | (⋃ a, m64Intrinsic_cappedRegionCarrier face V a) = univ ∧ |
| 53 | (⋃ a, frontier (m64Intrinsic_cappedRegionCarrier face V a)) = |
| 54 | ⋃ i, frontier (face i).carrier := by |
| 55 | let A := m64Intrinsic_cappedRegionCarrier face V |
| 56 | have hfaceU (i : I) : (face i).carrier ⊆ closure U := by |
| 57 | rw [← hregion] |
| 58 | exact subset_iUnion (fun j => (face j).carrier) i |
| 59 | have hUCV : Disjoint (closure U) (interior (closure V)) := |
| 60 | ((hdisj.closure_right hU).mono_right interior_subset).closure_left isOpen_interior |
| 61 | have hUICV : Disjoint (interior (closure U)) (closure V) := |
| 62 | ((hdisj.closure_left hV).mono_left interior_subset).closure_right isOpen_interior |
| 63 | have hclosed (a : Sum I Unit) : IsClosed (A a) := by |
| 64 | cases a with |
| 65 | | inl i => exact (face i).isClosed_carrier |
| 66 | | inr u => exact isClosed_closure |
| 67 | have hregular (a : Sum I Unit) : closure (interior (A a)) = A a := by |
| 68 | cases a with |
| 69 | | inl i => |
| 70 | change closure (interior (face i).carrier) = (face i).carrier |
| 71 | rw [hcarrier] |
| 72 | exact coordinate_triangle_closure_interior (C i) (b i) (hsource i) |
| 73 | | inr u => |
| 74 | change closure (interior (closure V)) = closure V |
| 75 | exact subset_antisymm (closure_minimal interior_subset isClosed_closure) |
| 76 | (closure_mono hV.subset_interior_closure) |
| 77 | have hdisjoint : Pairwise (fun a d => Disjoint (interior (A a)) (interior (A d))) := by |
| 78 | intro a d had |
| 79 | cases a with |
| 80 | | inl i => |
| 81 | cases d with |
| 82 | | inl j => |
| 83 | exact (face i).disjoint_interiors_of_inter_subset_frontier (face j) |
| 84 | (hfront i j (fun hij => had (congrArg Sum.inl hij))) |
| 85 | | inr u => exact hUCV.mono_left (interior_subset.trans (hfaceU i)) |
| 86 | | inr u => |
| 87 | cases d with |
| 88 | | inl j => exact hUCV.symm.mono_right (interior_subset.trans (hfaceU j)) |
| 89 | | inr v => exact (had (by cases u; cases v; rfl)).elim |
| 90 | have hcover : (⋃ a, A a) = univ := by |
| 91 | apply eq_univ_of_forall |
| 92 | intro p |
| 93 | rcases (show p ∈ closure U ∪ closure V from hclosure.symm ▸ mem_univ p) with hp | hp |
| 94 | · obtain ⟨i, hi⟩ := mem_iUnion.mp (hregion.symm ▸ hp) |
| 95 | exact mem_iUnion.mpr ⟨Sum.inl i, hi⟩ |
| 96 | · exact mem_iUnion.mpr ⟨Sum.inr (), hp⟩ |
| 97 | refine ⟨hclosed, hregular, hdisjoint, hcover, ?_⟩ |
| 98 | apply subset_antisymm |
| 99 | · intro p hp |
| 100 | obtain ⟨a, ha⟩ := mem_iUnion.mp hp |
| 101 | cases a with |
| 102 | | inl i => exact mem_iUnion.mpr ⟨i, ha⟩ |
| 103 | | inr u => |
| 104 | change p ∈ frontier (closure V) at ha |
| 105 | have hpV : p ∈ closure V := isClosed_closure.frontier_subset ha |
| 106 | have hpU : p ∈ frontier U := hfrontier.symm ▸ frontier_closure_subset ha |
| 107 | obtain ⟨i, hi⟩ := mem_iUnion.mp (hregion.symm ▸ hpU.1) |
| 108 | refine mem_iUnion.mpr ⟨i, subset_closure hi, ?_⟩ |
| 109 | intro hint |
| 110 | exact disjoint_left.mp hUICV (interior_mono (hfaceU i) hint) hpV |
| 111 | · intro p hp |
| 112 | obtain ⟨i, hi⟩ := mem_iUnion.mp hp |
| 113 | exact mem_iUnion.mpr ⟨Sum.inl i, hi⟩ |
| 114 | |
| 115 | /-- Actual midpoint incidence constructs two distinct capped cells at every geometric edge. |
| 116 | No adjacent-face certificate is an input. Source: the disk Euler step for Lemma 19.45, |
| 117 | printed p. 474. -/ |
| 118 | theorem m64Intrinsic_exists_capped_region_adjacent_faces |
| 119 | {I : Type*} [Finite I] (face : I → SmoothFace AnnulusCoordinates) |
| 120 | (C : I → OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 121 | (b : I → AffineBasis (Fin 3) ℝ AnnulusCoordinates) |
| 122 | (hsource : ∀ i, convexHull ℝ (range (b i)) ⊆ (C i).source) |
| 123 | (hcarrier : ∀ i, (face i).carrier = C i '' convexHull ℝ (range (b i))) |
| 124 | (hboundary : ∀ i k, ((face i).boundary k).map = C i ∘ |
| 125 | affineChartSegment (b i (k.succAbove 0)) (b i (k.succAbove 1))) |
| 126 | (hfront : ∀ i j, i ≠ j → |
| 127 | (face i).carrier ∩ (face j).carrier ⊆ frontier (face i).carrier) |
| 128 | (hinter : ∀ i j, i ≠ j → |
| 129 | (∃ k l : Fin 3, (face i).carrier ∩ (face j).carrier = |
| 130 | ((face i).boundary k).map '' Icc (0 : ℝ) 1 ∧ |
| 131 | ((face i).boundary k).map '' Icc (0 : ℝ) 1 = |
| 132 | ((face j).boundary l).map '' Icc (0 : ℝ) 1) ∨ |
| 133 | ∃ v : Fin 3, (face i).carrier ∩ (face j).carrier ⊆ {C i (b i v)}) |
| 134 | {U V : Set AnnulusCoordinates} (hU : IsOpen U) (hV : IsOpen V) |
| 135 | (hdisj : Disjoint U V) (hfrontier : frontier U = frontier V) |
| 136 | (hclosure : closure U ∪ closure V = univ) |
| 137 | (hregion : (⋃ i, (face i).carrier) = closure U) : |
| 138 | ∃ adjacent : FaceBoundaryEdge face → (Sum I Unit) × (Sum I Unit), |
| 139 | (∀ e, (adjacent e).1 ≠ (adjacent e).2) ∧ |
| 140 | ∀ e a, (faceBoundaryEdge face e).map (1 / 2 : ℝ) ∈ |
| 141 | m64Intrinsic_cappedRegionCarrier face V a ↔ |
| 142 | a = (adjacent e).1 ∨ a = (adjacent e).2 := by |
| 143 | classical |
| 144 | let A := m64Intrinsic_cappedRegionCarrier face V |
| 145 | let K := ⋃ e, (faceBoundaryEdge face e).map '' Icc (0 : ℝ) 1 |
| 146 | let _ := Fintype.ofFinite (Sum I Unit) |
| 147 | obtain ⟨hclosed, hregular, hdisjoint, hcover, hfrontiers⟩ := |
| 148 | m64Intrinsic_capped_region_cover face C b hsource hcarrier hfront hU hV hdisj |
| 149 | hfrontier hclosure hregion |
| 150 | have hinj (i : I) (k : Fin 3) : InjOn ((face i).boundary k).map (Icc (0 : ℝ) 1) := by |
| 151 | have hne : b i (k.succAbove 1) - b i (k.succAbove 0) ≠ 0 := by |
| 152 | apply sub_ne_zero.mpr |
| 153 | intro heq |
| 154 | have h := Fin.succAbove_right_injective (p := k) ((b i).ind.injective heq) |
| 155 | norm_num at h |
| 156 | have hseg {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : |
| 157 | affineChartSegment (b i (k.succAbove 0)) (b i (k.succAbove 1)) t ∈ (C i).source := |
| 158 | hsource i (Euler.coordinate_edge_subset_hull (b i) k |
| 159 | (Euler.affineChartSegment_image _ _ ▸ mem_image_of_mem _ ht)) |
| 160 | intro t ht s hs heq |
| 161 | rw [hboundary] at heq |
| 162 | exact smul_left_injective ℝ hne (add_left_cancel ((C i).injOn (hseg ht) (hseg hs) heq)) |
| 163 | have hmeet (e d : FaceBoundaryEdge face) (hed : e ≠ d) : |
| 164 | (faceBoundaryEdge face e).map '' Icc (0 : ℝ) 1 ∩ |
| 165 | (faceBoundaryEdge face d).map '' Icc (0 : ℝ) 1 ⊆ |
| 166 | {(faceBoundaryEdge face e).map 0, (faceBoundaryEdge face e).map 1} := by |
| 167 | apply Euler.coordinate_cover_edge_meet face C b hsource hboundary hinj hinter |
| 168 | e.out.1 d.out.1 e.out.2 d.out.2 |
| 169 | intro heq |
| 170 | apply hed |
| 171 | have h := (faceBoundaryIndex_eq_iff face e.out.1 d.out.1 e.out.2 d.out.2).mpr heq |
| 172 | exact (Quotient.out_eq e).symm.trans (h.trans (Quotient.out_eq d)) |
| 173 | have hK : K = ⋃ a, frontier (A a) := by |
| 174 | rw [hfrontiers] |
| 175 | apply subset_antisymm |
| 176 | · intro p hp |
| 177 | obtain ⟨e, he⟩ := mem_iUnion.mp hp |
| 178 | exact mem_iUnion.mpr ⟨e.out.1, (face e.out.1).boundary_image_subset_frontier e.out.2 he⟩ |
| 179 | · intro p hp |
| 180 | obtain ⟨i, hi⟩ := mem_iUnion.mp hp |
| 181 | rw [(face i).boundary_carrier] at hi |
| 182 | obtain ⟨k, hk⟩ := mem_iUnion.mp hi |
| 183 | apply mem_iUnion.mpr |
| 184 | refine ⟨faceBoundaryIndex face i k, ?_⟩ |
| 185 | rw [faceBoundaryEdge_image] |
| 186 | exact hk |
| 187 | have hdense : Dense Kᶜ := by |
| 188 | rw [hK] |
| 189 | simpa only [Finset.mem_univ, iUnion_true] using |
| 190 | Poincare.Topology.dense_compl_finite_frontier_union Finset.univ A |
| 191 | (fun a _ => hclosed a) |
| 192 | have heach (e : FaceBoundaryEdge face) : ∃ a d : Sum I Unit, a ≠ d ∧ |
| 193 | ∀ f, (faceBoundaryEdge face e).map (1 / 2 : ℝ) ∈ A f ↔ f = a ∨ f = d := by |
| 194 | let q := (faceBoundaryEdge face e).map (1 / 2 : ℝ) |
| 195 | have ht : (1 / 2 : ℝ) ∈ Ioo (0 : ℝ) 1 := by norm_num |
| 196 | have hedgefront : (faceBoundaryEdge face e).map '' Icc (0 : ℝ) 1 ⊆ |
| 197 | frontier (face e.out.1).carrier := |
| 198 | (face e.out.1).boundary_image_subset_frontier e.out.2 |
| 199 | have hedgechart : (faceBoundaryEdge face e).map '' Icc (0 : ℝ) 1 ⊆ |
| 200 | (chartAt AnnulusCoordinates (face e.out.1).chart).source := |
| 201 | hedgefront.trans ((face e.out.1).isClosed_carrier.frontier_subset.trans |
| 202 | (face e.out.1).carrier_subset_chart) |
| 203 | have hqfront : q ∈ frontier (face e.out.1).carrier := |
| 204 | hedgefront ⟨1 / 2, ⟨ht.1.le, ht.2.le⟩, rfl⟩ |
| 205 | obtain ⟨W, L, R, hW, hqW, _, _, _, hL, hR, _, hpartition, hqLR⟩ := |
| 206 | exists_two_sided_edge_family_neighborhood_of_endpoint_intersections |
| 207 | (faceBoundaryEdge face) e (face e.out.1).chart (hinj e.out.1 e.out.2) |
| 208 | hedgechart (fun d hde => hmeet e d hde.symm) ht (s := univ) Filter.univ_mem |
| 209 | have hWdense : W ⊆ closure (L ∪ R) := by |
| 210 | rw [← hpartition] |
| 211 | intro z hz |
| 212 | apply mem_closure_iff.mpr |
| 213 | intro O hO hzO |
| 214 | obtain ⟨w, ⟨hwO, hwW⟩, hwK⟩ := |
| 215 | hdense.inter_open_nonempty (O ∩ W) (hO.inter hW) ⟨z, hzO, hz⟩ |
| 216 | exact ⟨w, hwO, hwW, hwK⟩ |
| 217 | have hlocal (a : Sum I Unit) : W ∩ frontier (A a) ⊆ K := by |
| 218 | intro z hz |
| 219 | rw [hK] |
| 220 | exact mem_iUnion.mpr ⟨a, hz.2⟩ |
| 221 | obtain ⟨a, d, had, _, _, hmembers⟩ := |
| 222 | Poincare.Topology.exists_exactly_two_closed_cover_members_of_two_sided_neighborhood |
| 223 | A hclosed hregular hdisjoint hcover (hW.mem_nhds hqW) hpartition |
| 224 | hL.isConnected.isPreconnected hR.isConnected.isPreconnected hL.nonempty hR.nonempty |
| 225 | hqLR.1 hqLR.2 hWdense hlocal ⟨Sum.inl e.out.1, hqfront⟩ |
| 226 | exact ⟨a, d, had, hmembers⟩ |
| 227 | choose left right hdistinct hexact using heach |
| 228 | exact ⟨fun e => (left e, right e), hdistinct, hexact⟩ |
| 229 | |
| 230 | /-- Capped cell interiors are preconnected and avoid the actual complete edge network. These |
| 231 | are the geometric inputs for Jordan coloring in the disk Euler step of Lemma 19.45, printed |
| 232 | p. 474. -/ |
| 233 | theorem m64Intrinsic_capped_region_interiors |
| 234 | {I : Type*} (face : I → SmoothFace AnnulusCoordinates) |
| 235 | (C : I → OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 236 | (b : I → AffineBasis (Fin 3) ℝ AnnulusCoordinates) |
| 237 | (hsource : ∀ i, convexHull ℝ (range (b i)) ⊆ (C i).source) |
| 238 | (hcarrier : ∀ i, (face i).carrier = C i '' convexHull ℝ (range (b i))) |
| 239 | (hfront : ∀ i j, i ≠ j → |
| 240 | (face i).carrier ∩ (face j).carrier ⊆ frontier (face i).carrier) |
| 241 | {U V : Set AnnulusCoordinates} (hU : IsOpen U) (hV : IsOpen V) |
| 242 | (hdisj : Disjoint U V) (hfrontier : frontier U = frontier V) |
| 243 | (hregion : (⋃ i, (face i).carrier) = closure U) (hVconn : IsPreconnected V) : |
| 244 | ∀ a, IsPreconnected (interior (m64Intrinsic_cappedRegionCarrier face V a)) ∧ |
| 245 | Disjoint (interior (m64Intrinsic_cappedRegionCarrier face V a)) |
| 246 | (⋃ e : FaceBoundaryEdge face, (faceBoundaryEdge face e).map '' Icc (0 : ℝ) 1) := by |
| 247 | let A := m64Intrinsic_cappedRegionCarrier face V |
| 248 | have hfaceU (i : I) : (face i).carrier ⊆ closure U := by |
| 249 | rw [← hregion] |
| 250 | exact subset_iUnion (fun j => (face j).carrier) i |
| 251 | have hUCV : Disjoint (closure U) (interior (closure V)) := |
| 252 | ((hdisj.closure_right hU).mono_right interior_subset).closure_left isOpen_interior |
| 253 | have hVint : interior (closure V) = V := by |
| 254 | apply subset_antisymm ?_ hV.subset_interior_closure |
| 255 | intro p hp |
| 256 | by_contra hpV |
| 257 | have hpf : p ∈ frontier V := |
| 258 | ⟨interior_subset hp, by simpa only [hV.interior_eq] using hpV⟩ |
| 259 | have hpU : p ∈ closure U := (hfrontier.symm ▸ hpf).1 |
| 260 | exact disjoint_left.mp hUCV hpU hp |
| 261 | have hconn (a : Sum I Unit) : IsPreconnected (interior (A a)) := by |
| 262 | cases a with |
| 263 | | inl i => |
| 264 | change IsPreconnected (interior (face i).carrier) |
| 265 | rw [hcarrier, interior_smooth_coordinate_image (C i) (hsource i)] |
| 266 | exact (convex_convexHull ℝ (range (b i))).interior.isPreconnected.image (C i) |
| 267 | ((C i).continuousOn.mono (interior_subset.trans (hsource i))) |
| 268 | | inr u => |
| 269 | change IsPreconnected (interior (closure V)) |
| 270 | rwa [hVint] |
| 271 | have havoid (a : Sum I Unit) : |
| 272 | Disjoint (interior (A a)) (⋃ i, frontier (face i).carrier) := by |
| 273 | apply disjoint_left.mpr |
| 274 | intro p hp hf |
| 275 | obtain ⟨i, hi⟩ := mem_iUnion.mp hf |
| 276 | cases a with |
| 277 | | inl j => |
| 278 | by_cases hji : j = i |
| 279 | · subst j |
| 280 | exact hi.2 hp |
| 281 | · exact (hfront j i hji ⟨interior_subset hp, |
| 282 | (face i).isClosed_carrier.frontier_subset hi⟩).2 hp |
| 283 | | inr u => |
| 284 | exact disjoint_left.mp hUCV |
| 285 | (hfaceU i ((face i).isClosed_carrier.frontier_subset hi)) hp |
| 286 | intro a |
| 287 | refine ⟨hconn a, (havoid a).mono_right ?_⟩ |
| 288 | intro p hp |
| 289 | obtain ⟨e, he⟩ := mem_iUnion.mp hp |
| 290 | exact mem_iUnion.mpr ⟨e.out.1, (face e.out.1).boundary_image_subset_frontier e.out.2 he⟩ |
| 291 | |
| 292 | end PoincareMT |