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 | # Exhaustion traces outside every finite choice of regions |
| 5 | |
| 6 | The finite complementary-component cover also works modulo a finite union |
| 7 | of prescribed regions. Nested components outside every such finite cover |
| 8 | give an actual end which no prescribed region eventually contains. |
| 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 | theorem exists_component_trace_without_finite_cover (K : CompactExhaustion X) |
| 21 | (V : ι → Set X) {A : Set X} |
| 22 | (hA : ∀ (s : Finset ι) (L : Set X), IsCompact L → |
| 23 | ¬ A ⊆ L ∪ ⋃ i ∈ s, V i) (n : ℕ) : |
| 24 | ∃ p : X, p ∈ (K n)ᶜ ∧ |
| 25 | ∀ (s : Finset ι) (L : Set X), IsCompact L → |
| 26 | ¬ A ∩ connectedComponentIn (K n)ᶜ p ⊆ L ∪ ⋃ i ∈ s, V i := by |
| 27 | classical |
| 28 | obtain ⟨points, hp, hcover⟩ := exists_finite_component_cover_outside_compact |
| 29 | (K.isCompact n) (K.isCompact (n + 1)) (K.subset_interior_succ n) |
| 30 | by_contra h |
| 31 | push Not at h |
| 32 | choose s L hL hsub using fun p : points => h p.val (hp p.val p.property) |
| 33 | let all : Finset ι := Finset.univ.biUnion s |
| 34 | let B : Set X := K (n + 1) ∪ ⋃ p : points, L p |
| 35 | have hB : IsCompact B := (K.isCompact (n + 1)).union (isCompact_iUnion hL) |
| 36 | apply hA all B hB |
| 37 | intro x hx |
| 38 | by_cases hxK : x ∈ K (n + 1) |
| 39 | · exact Or.inl (Or.inl hxK) |
| 40 | · obtain ⟨p, hp, hxp⟩ := hcover x hxK |
| 41 | rcases hsub ⟨p, hp⟩ ⟨hx, hxp⟩ with hxL | hxV |
| 42 | · exact Or.inl (Or.inr (mem_iUnion.mpr ⟨⟨p, hp⟩, hxL⟩)) |
| 43 | · obtain ⟨i, hi, hxi⟩ := mem_iUnion₂.mp hxV |
| 44 | exact Or.inr (mem_iUnion₂.mpr ⟨i, |
| 45 | Finset.mem_biUnion.mpr ⟨⟨p, hp⟩, Finset.mem_univ _, hi⟩, hxi⟩) |
| 46 | |
| 47 | /-- Failure of every finite cover modulo a compact set persists along a |
| 48 | nested sequence of genuine complementary components. -/ |
| 49 | theorem exists_nested_component_traces_without_finite_cover |
| 50 | (K : CompactExhaustion X) (V : ι → Set X) {A : Set X} |
| 51 | (hA : ∀ (s : Finset ι) (L : Set X), IsCompact L → |
| 52 | ¬ A ⊆ L ∪ ⋃ i ∈ s, V i) : |
| 53 | ∃ p : ℕ → X, (∀ n, p n ∈ (K n)ᶜ) ∧ |
| 54 | Antitone (fun n => connectedComponentIn (K n)ᶜ (p n)) ∧ |
| 55 | ∀ n (s : Finset ι) (L : Set X), IsCompact L → |
| 56 | ¬ A ∩ connectedComponentIn (K n)ᶜ (p n) ⊆ L ∪ ⋃ i ∈ s, V i := by |
| 57 | classical |
| 58 | let State (n : ℕ) := {p : X // p ∈ (K n)ᶜ ∧ |
| 59 | ∀ (s : Finset ι) (L : Set X), IsCompact L → |
| 60 | ¬ A ∩ connectedComponentIn (K n)ᶜ p ⊆ L ∪ ⋃ i ∈ s, V i} |
| 61 | have hstep (n : ℕ) (p : State n) : |
| 62 | ∃ q : State (n + 1), connectedComponentIn (K (n + 1))ᶜ q.val ⊆ |
| 63 | connectedComponentIn (K n)ᶜ p.val := by |
| 64 | obtain ⟨q, hq, htrace⟩ := |
| 65 | exists_component_trace_without_finite_cover K V p.property.2 (n + 1) |
| 66 | have hne : ((A ∩ connectedComponentIn (K n)ᶜ p.val) ∩ |
| 67 | connectedComponentIn (K (n + 1))ᶜ q).Nonempty := by |
| 68 | apply nonempty_iff_ne_empty.mpr |
| 69 | intro heq |
| 70 | exact htrace ∅ ∅ isCompact_empty (by simp [heq]) |
| 71 | obtain ⟨y, ⟨_, hyp⟩, hyq⟩ := hne |
| 72 | have hmono : connectedComponentIn (K (n + 1))ᶜ q ⊆ |
| 73 | connectedComponentIn (K n)ᶜ q := |
| 74 | connectedComponentIn_mono q (compl_subset_compl.mpr (K.subset_succ n)) |
| 75 | have heq : connectedComponentIn (K n)ᶜ q = connectedComponentIn (K n)ᶜ p.val := |
| 76 | (connectedComponentIn_eq (hmono hyq)).trans (connectedComponentIn_eq hyp).symm |
| 77 | have hsub : connectedComponentIn (K (n + 1))ᶜ q ⊆ |
| 78 | connectedComponentIn (K n)ᶜ p.val := heq ▸ hmono |
| 79 | refine ⟨⟨q, hq, ?_⟩, hsub⟩ |
| 80 | intro s L hL hAL |
| 81 | exact htrace s L hL (fun x hx => hAL ⟨hx.1.1, hx.2⟩) |
| 82 | obtain ⟨p₀, hp₀, htrace₀⟩ := exists_component_trace_without_finite_cover K V hA 0 |
| 83 | let p : (n : ℕ) → State n := Nat.rec ⟨p₀, hp₀, htrace₀⟩ |
| 84 | (fun n prev => Classical.choose (hstep n prev)) |
| 85 | refine ⟨fun n => (p n).val, fun n => (p n).property.1, ?_, |
| 86 | fun n => (p n).property.2⟩ |
| 87 | apply antitone_nat_of_succ_le |
| 88 | intro n |
| 89 | exact Classical.choose_spec (hstep n (p n)) |
| 90 | |
| 91 | end Poincare.Topology |