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.Compactness.Compact |
| 2 | import Mathlib.Topology.Separation.Hausdorff |
| 3 | |
| 4 | /-! Compactness of the fibers distinct from a locally unique chosen lift. |
| 5 | This supplies the compact minimum version of MT Claim 19.41, p. 471, |
| 6 | in short-geodesic-digons derivation, Section 7. -/ |
| 7 | |
| 8 | set_option autoImplicit false |
| 9 | |
| 10 | open Set Filter |
| 11 | open scoped Topology |
| 12 | |
| 13 | namespace PoincareMT |
| 14 | |
| 15 | /-- On compact parameter and source sets, the fibers distinct from a continuous chosen lift |
| 16 | form a compact set if the map is locally injective at every chosen lift. No global |
| 17 | injectivity is required. Source: MT Claim 19.41; short-geodesic-digons derivation, Section |
| 18 | 7. Source/construction: |
| 19 | proof-work/tasks/M64/derivations/2026-09-27-short-geodesic-digons.md, Section 7. -/ |
| 20 | theorem m64_isCompact_distinct_lift_fibers |
| 21 | {X Y Z : Type*} [TopologicalSpace X] [TopologicalSpace Y] |
| 22 | [TopologicalSpace Z] [T2Space Z] |
| 23 | {S : Set X} {T : Set Y} (hS : IsCompact S) (hT : IsCompact T) |
| 24 | {f : Y → Z} {c : X → Z} {g : X → Y} |
| 25 | (hf : ContinuousOn f T) (hc : ContinuousOn c S) (hg : ContinuousOn g S) |
| 26 | (hlift : ∀ x ∈ S, f (g x) = c x) |
| 27 | (hlocal : ∀ x ∈ S, ∃ W ∈ 𝓝 (g x), InjOn f W) : |
| 28 | IsCompact {p : X × Y | p.1 ∈ S ∧ p.2 ∈ T ∧ f p.2 = c p.1 ∧ p.2 ≠ g p.1} := by |
| 29 | let : CompactSpace S := isCompact_iff_compactSpace.mp hS |
| 30 | let : CompactSpace T := isCompact_iff_compactSpace.mp hT |
| 31 | let C : Set (S × T) := {p | f p.2 = c p.1 ∧ (p.2 : Y) ≠ g p.1} |
| 32 | have hfc : Continuous (fun p : S × T => f p.2) := |
| 33 | hf.domRestrict.comp continuous_snd |
| 34 | have hcc : Continuous (fun p : S × T => c p.1) := |
| 35 | hc.domRestrict.comp continuous_fst |
| 36 | have hgc : Continuous (fun p : S × T => g p.1) := |
| 37 | hg.domRestrict.comp continuous_fst |
| 38 | have hclosed : IsClosed C := by |
| 39 | rw [← isOpen_compl_iff, isOpen_iff_mem_nhds] |
| 40 | intro p hp |
| 41 | change ¬ (f p.2 = c p.1 ∧ (p.2 : Y) ≠ g p.1) at hp |
| 42 | by_cases he : f p.2 = c p.1 |
| 43 | · have heq : (p.2 : Y) = g p.1 := by tauto |
| 44 | obtain ⟨W, hW, hi⟩ := hlocal p.1 p.1.property |
| 45 | have hgW : ∀ᶠ q : S × T in 𝓝 p, g q.1 ∈ W := hgc.continuousAt hW |
| 46 | have hyW : ∀ᶠ q : S × T in 𝓝 p, (q.2 : Y) ∈ W := |
| 47 | (continuous_subtype_val.comp continuous_snd).continuousAt (by |
| 48 | change W ∈ 𝓝 (p.2 : Y) |
| 49 | rwa [heq]) |
| 50 | filter_upwards [hgW, hyW] with q hqg hqy |
| 51 | change ¬ (f q.2 = c q.1 ∧ (q.2 : Y) ≠ g q.1) |
| 52 | rintro ⟨hqe, hqn⟩ |
| 53 | exact hqn (hi hqy hqg (hqe.trans (hlift q.1 q.1.property).symm)) |
| 54 | · filter_upwards [(isOpen_ne_fun hfc hcc).mem_nhds he] with q hq |
| 55 | exact fun h => hq h.1 |
| 56 | have himage : (fun p : S × T => ((p.1 : X), (p.2 : Y))) '' C = |
| 57 | {p : X × Y | p.1 ∈ S ∧ p.2 ∈ T ∧ f p.2 = c p.1 ∧ p.2 ≠ g p.1} := by |
| 58 | ext p |
| 59 | constructor |
| 60 | · rintro ⟨q, hq, rfl⟩ |
| 61 | exact ⟨q.1.property, q.2.property, hq⟩ |
| 62 | · rintro ⟨hpS, hpT, hp⟩ |
| 63 | exact ⟨(⟨p.1, hpS⟩, ⟨p.2, hpT⟩), hp, rfl⟩ |
| 64 | rw [← himage] |
| 65 | exact hclosed.isCompact.image |
| 66 | ((continuous_subtype_val.comp continuous_fst).prodMk |
| 67 | (continuous_subtype_val.comp continuous_snd)) |
| 68 | |
| 69 | end PoincareMT |