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 Mathlib.Topology.Connected.Clopen |
| 2 | |
| 3 | /-! |
| 4 | # Opposite sides of a two-piece boundary collar |
| 5 | |
| 6 | The topological step used for Morgan--Tian Definition 9.72 and Remark |
| 7 | 9.73, pp. 230-231. Two connected pieces covering a neighborhood off a |
| 8 | closed set's full frontier must occupy opposite sides when the closed |
| 9 | set has nonempty interior and is proper in a preconnected ambient space. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set |
| 15 | |
| 16 | namespace Poincare.Topology |
| 17 | |
| 18 | variable {X : Type*} [TopologicalSpace X] |
| 19 | |
| 20 | /-- A connected set avoiding the frontier of a closed set stays on one |
| 21 | side. The boundary-neck argument in Definition 9.72, pp. 230-231. -/ |
| 22 | theorem subset_interior_or_compl_of_disjoint_frontier |
| 23 | {K V : Set X} (hK : IsClosed K) (hV : IsPreconnected V) |
| 24 | (havoid : Disjoint V (frontier K)) : V ⊆ interior K ∨ V ⊆ Kᶜ := by |
| 25 | apply IsPreconnected.subset_or_subset isOpen_interior hK.isOpen_compl |
| 26 | (disjoint_compl_right.mono_left interior_subset) _ hV |
| 27 | intro x hx |
| 28 | by_cases hxK : x ∈ K |
| 29 | · left |
| 30 | by_contra hnot |
| 31 | exact Set.disjoint_left.mp havoid hx |
| 32 | ((mem_frontier_iff_notMem_interior hxK).mpr hnot) |
| 33 | · exact Or.inr hxK |
| 34 | |
| 35 | /-- The two connected pieces of a full boundary collar lie on opposite |
| 36 | sides of a proper closed set with nonempty interior. This supplies the |
| 37 | orientation needed in Definition 9.72 and Remark 9.73, pp. 230-231. -/ |
| 38 | theorem opposite_sides_of_frontier_cover [PreconnectedSpace X] |
| 39 | {K U V W : Set X} (hK : IsClosed K) (hU : IsOpen U) |
| 40 | (hinterior : (interior K).Nonempty) (hproper : K ≠ univ) |
| 41 | (hboundary : frontier K ⊆ U) (hcover : U ⊆ V ∪ frontier K ∪ W) |
| 42 | (hV : IsPreconnected V) (hW : IsPreconnected W) |
| 43 | (hVB : Disjoint V (frontier K)) (hWB : Disjoint W (frontier K)) : |
| 44 | (V ⊆ interior K ∧ W ⊆ Kᶜ) ∨ (V ⊆ Kᶜ ∧ W ⊆ interior K) := by |
| 45 | have hfrontier : (frontier K).Nonempty := nonempty_frontier_iff.mpr |
| 46 | ⟨hinterior.mono interior_subset, hproper⟩ |
| 47 | have hbothInside (hVK : V ⊆ interior K) (hWK : W ⊆ interior K) : False := by |
| 48 | have hUK : U ⊆ K := by |
| 49 | intro x hx |
| 50 | rcases hcover hx with (hx | hx) | hx |
| 51 | · exact interior_subset (hVK hx) |
| 52 | · exact hK.frontier_subset hx |
| 53 | · exact interior_subset (hWK hx) |
| 54 | obtain ⟨x, hx⟩ := hfrontier |
| 55 | exact hx.2 (interior_maximal hUK hU (hboundary hx)) |
| 56 | have hbothOutside (hVK : V ⊆ Kᶜ) (hWK : W ⊆ Kᶜ) : False := by |
| 57 | have hdisjoint : Disjoint U (interior K) := by |
| 58 | apply Set.disjoint_left.mpr |
| 59 | intro x hx hxK |
| 60 | rcases hcover hx with (hx | hx) | hx |
| 61 | · exact hVK hx (interior_subset hxK) |
| 62 | · exact hx.2 hxK |
| 63 | · exact hWK hx (interior_subset hxK) |
| 64 | have hinteriorProper : interior K ≠ univ := by |
| 65 | intro h |
| 66 | exact hproper (eq_univ_of_univ_subset (h ▸ interior_subset)) |
| 67 | obtain ⟨x, hx⟩ := nonempty_frontier_iff.mpr ⟨hinterior, hinteriorProper⟩ |
| 68 | exact Set.disjoint_left.mp (hdisjoint.closure_right hU) |
| 69 | (hboundary (frontier_interior_subset hx)) (frontier_subset_closure hx) |
| 70 | rcases subset_interior_or_compl_of_disjoint_frontier hK hV hVB with hVK | hVK |
| 71 | · rcases subset_interior_or_compl_of_disjoint_frontier hK hW hWB with hWK | hWK |
| 72 | · exact (hbothInside hVK hWK).elim |
| 73 | · exact Or.inl ⟨hVK, hWK⟩ |
| 74 | · rcases subset_interior_or_compl_of_disjoint_frontier hK hW hWB with hWK | hWK |
| 75 | · exact Or.inr ⟨hVK, hWK⟩ |
| 76 | · exact (hbothOutside hVK hWK).elim |
| 77 | |
| 78 | end Poincare.Topology |