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.Generalized.BoundedDistance.GeometryImports |
| 2 | import Mathlib.Topology.Connected.LocallyPathConnected |
| 3 | import Mathlib.Topology.Compactness.Compact |
| 4 | import Mathlib.Order.Filter.AtTopBot.Basic |
| 5 | |
| 6 | /-! |
| 7 | # Component membership under guarded exhaustion maps |
| 8 | |
| 9 | Membership in a full component is constant on every preconnected subset. |
| 10 | Opposite eventual image labels therefore forbid a path in a fixed sphere |
| 11 | complement when the path and sphere fit in one injectivity domain. This is |
| 12 | the topological transfer in Morgan--Tian Proposition 10.7, pp. 253-254; |
| 13 | M28 derivation 114. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Topology |
| 20 | |
| 21 | /-- A preconnected set inside an ambient set has one membership label for |
| 22 | any full connected component. Explicit endpoint membership handles empty |
| 23 | sets without a nonemptiness convention. Source: M28 derivation 114. -/ |
| 24 | theorem IsPreconnected.mem_iff_of_connectedComponentIn_eq |
| 25 | {X : Type*} [TopologicalSpace X] {A U F : Set X} |
| 26 | (hA : IsPreconnected A) (hAU : A ⊆ U) |
| 27 | (hF : ∀ z ∈ F, _root_.connectedComponentIn U z = F) |
| 28 | {x y : X} (hx : x ∈ A) (hy : y ∈ A) : x ∈ F ↔ y ∈ F := by |
| 29 | constructor |
| 30 | · intro hxF |
| 31 | exact hF x hxF ▸ hA.subset_connectedComponentIn hx hAU hy |
| 32 | · intro hyF |
| 33 | exact hF y hyF ▸ hA.subset_connectedComponentIn hy hAU hx |
| 34 | |
| 35 | /-- A fixed path gives one eventual tail on which its endpoints have the |
| 36 | same membership in every full image-complement component. The tail is |
| 37 | chosen before the tested component. All maps are restricted to one common |
| 38 | valid stage. Source: Proposition 10.7, pp. 253-254; M28 derivation 114. -/ |
| 39 | theorem JoinedIn.eventually_component_mem_iff |
| 40 | {X : Type*} [TopologicalSpace X] {Y : ℕ → Type*} |
| 41 | [∀ k, TopologicalSpace (Y k)] |
| 42 | (V : ℕ → Set X) (hopen : ∀ k, IsOpen (V k)) (hmono : Monotone V) |
| 43 | (hcover : (⋃ k, V k) = univ) {S : Set X} {j : ℕ} (hS : S ⊆ V j) |
| 44 | (e : ∀ k, X → Y k) (T : ∀ k, Set (Y k)) |
| 45 | (hcont : ∀ k, ContinuousOn (e k) (V k)) |
| 46 | (hinj : ∀ k, InjOn (e k) (V k)) |
| 47 | (hmap : ∀ k, MapsTo (e k) (V k) (T k)) {x₀ x₁ : X} |
| 48 | (hpath : JoinedIn Sᶜ x₀ x₁) : |
| 49 | ∀ᶠ k in atTop, ∀ F : Set (Y k), |
| 50 | (∀ z ∈ F, connectedComponentIn (T k \ e k '' S) z = F) → |
| 51 | (e k x₀ ∈ F ↔ e k x₁ ∈ F) := by |
| 52 | obtain ⟨γ, hγ⟩ := hpath |
| 53 | have hcompact : IsCompact (range γ) := isCompact_range γ.continuous |
| 54 | obtain ⟨l, hl⟩ := hcompact.elim_directed_cover V hopen (by rw [hcover]; exact subset_univ _) |
| 55 | hmono.directed_le |
| 56 | filter_upwards [eventually_ge_atTop (max j l)] with k hk |
| 57 | intro F hF |
| 58 | have hSK : S ⊆ V k := hS.trans (hmono ((le_max_left _ _).trans hk)) |
| 59 | have hK : range γ ⊆ V k := hl.trans (hmono ((le_max_right _ _).trans hk)) |
| 60 | have himage : e k '' range γ ⊆ T k \ e k '' S := by |
| 61 | rintro _ ⟨x, hx, rfl⟩ |
| 62 | refine ⟨hmap k (hK hx), ?_⟩ |
| 63 | rintro ⟨z, hz, heq⟩ |
| 64 | have hzx : z = x := hinj k (hSK hz) (hK hx) heq |
| 65 | obtain ⟨t, rfl⟩ := hx |
| 66 | exact hγ t (hzx ▸ hz) |
| 67 | have hconnected : IsPreconnected (e k '' range γ) := |
| 68 | (isPreconnected_range γ.continuous).image (e k) ((hcont k).mono hK) |
| 69 | have hx₀ : e k x₀ ∈ e k '' range γ := |
| 70 | mem_image_of_mem _ ⟨0, γ.source⟩ |
| 71 | have hx₁ : e k x₁ ∈ e k '' range γ := |
| 72 | mem_image_of_mem _ ⟨1, γ.target⟩ |
| 73 | exact hconnected.mem_iff_of_connectedComponentIn_eq himage hF hx₀ hx₁ |
| 74 | |
| 75 | /-- A compact path cannot join points with opposite eventual component |
| 76 | labels under maps continuous and injective on an increasing open |
| 77 | exhaustion. The target spaces may vary, and the total maps are never used |
| 78 | outside their stated domains. Source: Proposition 10.7; derivation 114. -/ |
| 79 | theorem not_joinedIn_of_eventually_opposite_component_labels |
| 80 | {X : Type*} [TopologicalSpace X] {Y : ℕ → Type*} |
| 81 | [∀ k, TopologicalSpace (Y k)] |
| 82 | (V : ℕ → Set X) (hopen : ∀ k, IsOpen (V k)) (hmono : Monotone V) |
| 83 | (hcover : (⋃ k, V k) = univ) {S : Set X} {j : ℕ} (hS : S ⊆ V j) |
| 84 | (e : ∀ k, X → Y k) (T : ∀ k, Set (Y k)) |
| 85 | (hcont : ∀ k, ContinuousOn (e k) (V k)) |
| 86 | (hinj : ∀ k, InjOn (e k) (V k)) |
| 87 | (hmap : ∀ k, MapsTo (e k) (V k) (T k)) {x₀ x₁ : X} |
| 88 | (hlabels : ∀ᶠ k in atTop, ∃ F : Set (Y k), |
| 89 | (∀ z ∈ F, connectedComponentIn (T k \ e k '' S) z = F) ∧ |
| 90 | (e k x₀ ∈ F ↔ e k x₁ ∉ F)) : |
| 91 | ¬ JoinedIn Sᶜ x₀ x₁ := by |
| 92 | intro hpath |
| 93 | have htail := hpath.eventually_component_mem_iff V hopen hmono hcover hS e T hcont hinj hmap |
| 94 | obtain ⟨k, hk, F, hF, hopposite⟩ := (htail.and hlabels).exists |
| 95 | have hsame := hk F hF |
| 96 | tauto |