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.FiniteComponents |
| 2 | |
| 3 | /-! |
| 4 | # Nested components meeting a noncompact remainder |
| 5 | |
| 6 | At each exhaustion stage choose a complementary component whose trace on |
| 7 | the given set still escapes every compact set. The successive components |
| 8 | are nested, giving the exact data of an end that keeps meeting that set. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open Set |
| 14 | |
| 15 | namespace Poincare.Topology |
| 16 | |
| 17 | variable {X : Type*} [TopologicalSpace X] [T2Space X] |
| 18 | [LocallyConnectedSpace X] [PreconnectedSpace X] |
| 19 | |
| 20 | /-- A set escaping all compact subsets determines a nested sequence of |
| 21 | complementary components, each still having an escaping trace on that set. -/ |
| 22 | theorem exists_nested_unbounded_component_traces (K : CompactExhaustion X) |
| 23 | {A : Set X} (hA : ∀ L : Set X, IsCompact L → ¬ A ⊆ L) : |
| 24 | ∃ p : ℕ → X, (∀ n, p n ∈ (K n)ᶜ) ∧ |
| 25 | Antitone (fun n => connectedComponentIn (K n)ᶜ (p n)) ∧ |
| 26 | ∀ n, ∀ L : Set X, IsCompact L → |
| 27 | ¬ A ∩ connectedComponentIn (K n)ᶜ (p n) ⊆ L := by |
| 28 | classical |
| 29 | let State (n : ℕ) := {p : X // p ∈ (K n)ᶜ ∧ |
| 30 | ∀ L : Set X, IsCompact L → ¬ A ∩ connectedComponentIn (K n)ᶜ p ⊆ L} |
| 31 | have hstep (n : ℕ) (p : State n) : |
| 32 | ∃ q : State (n + 1), connectedComponentIn (K (n + 1))ᶜ q.val ⊆ |
| 33 | connectedComponentIn (K n)ᶜ p.val := by |
| 34 | obtain ⟨q, hq, htrace⟩ := exists_unbounded_component_trace K p.property.2 (n + 1) |
| 35 | have hne : ((A ∩ connectedComponentIn (K n)ᶜ p.val) ∩ |
| 36 | connectedComponentIn (K (n + 1))ᶜ q).Nonempty := by |
| 37 | apply nonempty_iff_ne_empty.mpr |
| 38 | intro heq |
| 39 | exact htrace ∅ isCompact_empty (heq ▸ subset_rfl) |
| 40 | obtain ⟨y, ⟨_, hyp⟩, hyq⟩ := hne |
| 41 | have hmono : connectedComponentIn (K (n + 1))ᶜ q ⊆ |
| 42 | connectedComponentIn (K n)ᶜ q := |
| 43 | connectedComponentIn_mono q (compl_subset_compl.mpr (K.subset_succ n)) |
| 44 | have heq : connectedComponentIn (K n)ᶜ q = connectedComponentIn (K n)ᶜ p.val := |
| 45 | (connectedComponentIn_eq (hmono hyq)).trans (connectedComponentIn_eq hyp).symm |
| 46 | have hsub : connectedComponentIn (K (n + 1))ᶜ q ⊆ |
| 47 | connectedComponentIn (K n)ᶜ p.val := heq ▸ hmono |
| 48 | refine ⟨⟨q, hq, ?_⟩, hsub⟩ |
| 49 | intro L hL hAL |
| 50 | exact htrace L hL (fun x hx => hAL ⟨hx.1.1, hx.2⟩) |
| 51 | obtain ⟨p₀, hp₀, htrace₀⟩ := exists_unbounded_component_trace K hA 0 |
| 52 | let p : (n : ℕ) → State n := Nat.rec ⟨p₀, hp₀, htrace₀⟩ |
| 53 | (fun n prev => Classical.choose (hstep n prev)) |
| 54 | refine ⟨fun n => (p n).val, fun n => (p n).property.1, ?_, |
| 55 | fun n => (p n).property.2⟩ |
| 56 | apply antitone_nat_of_succ_le |
| 57 | intro n |
| 58 | exact Classical.choose_spec (hstep n (p n)) |
| 59 | |
| 60 | end Poincare.Topology |