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.Surgery.Continuation.Construction.Terminal.Ends.RetainedCompactness.NestedComponents |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.Singular.Geometry |
| 3 | |
| 4 | /-! |
| 5 | # An end meeting a noncompact terminal remainder |
| 6 | |
| 7 | The exhaustion construction gives an actual `TerminalEnd` in any terminal |
| 8 | component with a closed noncompact remainder. Consequently an open region |
| 9 | containing a late tail of every end has compact complement in that component. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set |
| 15 | open scoped Manifold ContDiff Topology |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.TerminalComponentPath |
| 20 | |
| 21 | variable {F : GeneralizedRicciFlowData.{u}} {T : ℝ} |
| 22 | {E : GeneralizedFlowExtension F T} (K : TerminalComponentPath E) |
| 23 | |
| 24 | /-- A closed noncompact subset of the actual terminal component is met by |
| 25 | every tail of some actual terminal end. -/ |
| 26 | theorem exists_end_meeting_of_not_isCompact {A : Set K.component} |
| 27 | (hclosed : IsClosed A) (hnot : ¬ IsCompact A) : |
| 28 | ∃ e : TerminalEnd K, ∀ n, (A ∩ e.tail n).Nonempty := by |
| 29 | let : LocallyConnectedSpace (E.extended.slice T).carrier := |
| 30 | ChartedSpace.locallyConnectedSpace (EuclideanSpace ℝ (Fin 3)) _ |
| 31 | let : LocallyCompactSpace (E.extended.slice T).carrier := |
| 32 | ChartedSpace.locallyCompactSpace (EuclideanSpace ℝ (Fin 3)) _ |
| 33 | have hKo : IsOpen K.component := K.component_eq.symm ▸ isOpen_connectedComponent |
| 34 | have hKc : IsClosed K.component := K.component_eq.symm ▸ isClosed_connectedComponent |
| 35 | let : LocallyConnectedSpace K.component := hKo.locallyConnectedSpace |
| 36 | let : LocallyCompactSpace K.component := hKc.locallyCompactSpace |
| 37 | let : PreconnectedSpace K.component := isPreconnected_iff_preconnectedSpace.mp |
| 38 | (K.component_eq.symm ▸ isPreconnected_connectedComponent) |
| 39 | let C : CompactExhaustion K.component := CompactExhaustion.choice K.component |
| 40 | have hA : ∀ L : Set K.component, IsCompact L → ¬ A ⊆ L := by |
| 41 | intro L hL hsub |
| 42 | exact hnot (hL.of_isClosed_subset hclosed hsub) |
| 43 | obtain ⟨p, hp, hnest, htrace⟩ := |
| 44 | Poincare.Topology.exists_nested_unbounded_component_traces C hA |
| 45 | let e : TerminalEnd K := { |
| 46 | exhaustion := C |
| 47 | tail := fun n => connectedComponentIn (C n)ᶜ (p n) |
| 48 | tail_component := fun n => ⟨p n, hp n, rfl⟩ |
| 49 | nested := hnest |
| 50 | escapes_compact := fun n L hL hsub => htrace n L hL (inter_subset_right.trans hsub) } |
| 51 | refine ⟨e, fun n => nonempty_iff_ne_empty.mpr ?_⟩ |
| 52 | intro heq |
| 53 | exact htrace n ∅ isCompact_empty (heq ▸ subset_rfl) |
| 54 | |
| 55 | /-- Deleting an open set containing a late tail of every end leaves a compact |
| 56 | subset of the terminal component. -/ |
| 57 | theorem isCompact_diff_of_end_tail_cover {V : Set (E.extended.slice T).carrier} |
| 58 | (hV : IsOpen V) |
| 59 | (hcover : ∀ e : TerminalEnd K, ∃ n, Subtype.val '' e.tail n ⊆ V) : |
| 60 | IsCompact (K.component \ V) := by |
| 61 | let A : Set K.component := Subtype.val ⁻¹' Vᶜ |
| 62 | have hA : IsClosed A := hV.isClosed_compl.preimage continuous_subtype_val |
| 63 | have hAc : IsCompact A := by |
| 64 | by_contra hnot |
| 65 | obtain ⟨e, he⟩ := K.exists_end_meeting_of_not_isCompact hA hnot |
| 66 | obtain ⟨n, hn⟩ := hcover e |
| 67 | obtain ⟨x, hxA, hx⟩ := he n |
| 68 | exact hxA (hn ⟨x, hx, rfl⟩) |
| 69 | have himage : Subtype.val '' A = K.component \ V := by |
| 70 | ext x |
| 71 | constructor |
| 72 | · rintro ⟨y, hy, rfl⟩ |
| 73 | exact ⟨y.property, hy⟩ |
| 74 | · rintro ⟨hxK, hxV⟩ |
| 75 | exact ⟨⟨x, hxK⟩, hxV, rfl⟩ |
| 76 | rw [← himage] |
| 77 | exact hAc.image continuous_subtype_val |
| 78 | |
| 79 | end PoincareMT.TerminalComponentPath |