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.MetricSpace.Equicontinuity |
| 2 | import Mathlib.Topology.MetricSpace.Thickening |
| 3 | import Mathlib.Topology.Connected.Clopen |
| 4 | import Mathlib.Topology.ContinuousMap.Bounded.ArzelaAscoli |
| 5 | import Mathlib.Tactic.Linarith |
| 6 | |
| 7 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/PathTightness.lean` at |
| 8 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 9 | |
| 10 | |
| 11 | /-! |
| 12 | # Tightness of anchored path families |
| 13 | |
| 14 | Completeness and local compactness of the target, together with a common |
| 15 | modulus of continuity, suffice for tightness of paths on a compact connected |
| 16 | parameter space. Compactness of the target manifold is never assumed. |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | |
| 21 | open Set Filter Topology |
| 22 | open scoped BoundedContinuousFunction |
| 23 | |
| 24 | namespace PoincareMT.LGeometry |
| 25 | |
| 26 | private theorem compact_fiber_neighborhood {A X ι : Type*} |
| 27 | [TopologicalSpace A] [MetricSpace X] [CompleteSpace X] [LocallyCompactSpace X] |
| 28 | (f : ι → A → X) {t : A} (hf : EquicontinuousAt f t) |
| 29 | (ht : TotallyBounded (Set.range (fun i ↦ f i t))) : |
| 30 | ∃ U ∈ 𝓝 t, ∃ K : Set X, IsCompact K ∧ ∀ s ∈ U, ∀ i, f i s ∈ K := by |
| 31 | have hcompact := ht.closure.isCompact_of_isClosed isClosed_closure |
| 32 | obtain ⟨δ, hδ, hK⟩ := hcompact.exists_isCompact_cthickening |
| 33 | have hnear := Metric.equicontinuousAt_iff_right.mp hf δ hδ |
| 34 | refine ⟨{s | ∀ i, dist (f i t) (f i s) < δ}, hnear, |
| 35 | Metric.cthickening δ (closure (Set.range (fun i ↦ f i t))), hK, ?_⟩ |
| 36 | intro s hs i |
| 37 | exact Metric.mem_cthickening_of_dist_le _ (f i t) _ _ |
| 38 | (subset_closure (Set.mem_range_self i)) (by simpa only [dist_comm] using (hs i).le) |
| 39 | |
| 40 | /-- Precompactness of the fibers propagates across a connected parameter space. -/ |
| 41 | theorem totallyBounded_fibers_of_anchored {A X ι : Type*} |
| 42 | [TopologicalSpace A] [PreconnectedSpace A] |
| 43 | [MetricSpace X] [CompleteSpace X] [LocallyCompactSpace X] |
| 44 | (f : ι → A → X) (hf : Equicontinuous f) (a : A) (x : X) |
| 45 | (ha : ∀ i, f i a = x) : ∀ t, TotallyBounded (Set.range (fun i ↦ f i t)) := by |
| 46 | let P : Set A := {t | TotallyBounded (Set.range (fun i ↦ f i t))} |
| 47 | have hclosed : IsClosed P := by |
| 48 | apply isClosed_of_closure_subset |
| 49 | intro t ht |
| 50 | apply Metric.totallyBounded_iff.mpr |
| 51 | intro ε hε |
| 52 | have hnear := Metric.equicontinuousAt_iff_right.mp (hf t) (ε / 2) (half_pos hε) |
| 53 | obtain ⟨s, hsP, hst⟩ := |
| 54 | ((mem_closure_iff_frequently.mp ht).and_eventually hnear).exists |
| 55 | obtain ⟨N, hNfinite, hN⟩ := Metric.totallyBounded_iff.mp hsP (ε / 2) (half_pos hε) |
| 56 | refine ⟨N, hNfinite, ?_⟩ |
| 57 | rintro _ ⟨i, rfl⟩ |
| 58 | obtain ⟨z, hz, hiz⟩ := Set.mem_iUnion₂.mp (hN (Set.mem_range_self i)) |
| 59 | refine Set.mem_iUnion₂.mpr ⟨z, hz, ?_⟩ |
| 60 | change dist (f i t) z < ε |
| 61 | have hsum := (dist_triangle (f i t) (f i s) z).trans_lt |
| 62 | (add_lt_add (hst i) hiz) |
| 63 | simpa only [add_halves] using hsum |
| 64 | have hopen : IsOpen P := by |
| 65 | apply isOpen_iff_mem_nhds.mpr |
| 66 | intro t ht |
| 67 | obtain ⟨U, hU, K, hK, hUK⟩ := compact_fiber_neighborhood f (hf t) ht |
| 68 | apply Filter.mem_of_superset hU |
| 69 | intro s hs |
| 70 | exact hK.totallyBounded.subset (by rintro _ ⟨i, rfl⟩; exact hUK s hs i) |
| 71 | have haP : a ∈ P := by |
| 72 | apply (totallyBounded_singleton (a := x)).subset |
| 73 | rintro _ ⟨i, rfl⟩ |
| 74 | exact Set.mem_singleton_iff.mpr (ha i) |
| 75 | have hP : P = Set.univ := IsClopen.eq_univ ⟨hclosed, hopen⟩ ⟨a, haP⟩ |
| 76 | intro t |
| 77 | change t ∈ P |
| 78 | rw [hP] |
| 79 | exact Set.mem_univ t |
| 80 | |
| 81 | /-- All values of an anchored equicontinuous path family lie in one compact set. -/ |
| 82 | theorem exists_compact_range_of_anchored {A X ι : Type*} |
| 83 | [TopologicalSpace A] [CompactSpace A] [PreconnectedSpace A] |
| 84 | [MetricSpace X] [CompleteSpace X] [LocallyCompactSpace X] |
| 85 | (f : ι → A → X) (hf : Equicontinuous f) (a : A) (x : X) |
| 86 | (ha : ∀ i, f i a = x) : |
| 87 | ∃ K : Set X, IsCompact K ∧ ∀ i t, f i t ∈ K := by |
| 88 | have hfibers := totallyBounded_fibers_of_anchored f hf a x ha |
| 89 | choose U hU K hK hUK using fun t ↦ compact_fiber_neighborhood f (hf t) (hfibers t) |
| 90 | obtain ⟨S, hS⟩ := finite_cover_nhds hU |
| 91 | refine ⟨⋃ t ∈ S, K t, S.isCompact_biUnion (fun t _ ↦ hK t), ?_⟩ |
| 92 | intro i t |
| 93 | have ht : t ∈ ⋃ s ∈ S, U s := hS.symm ▸ Set.mem_univ t |
| 94 | obtain ⟨s, hs, hts⟩ := Set.mem_iUnion₂.mp ht |
| 95 | exact Set.mem_iUnion₂.mpr ⟨s, hs, hUK s t hts i⟩ |
| 96 | |
| 97 | /-- An anchored equicontinuous sequence has a uniform continuous limit along a subsequence. -/ |
| 98 | theorem exists_uniform_subsequence_of_anchored {A X : Type*} |
| 99 | [TopologicalSpace A] [CompactSpace A] [PreconnectedSpace A] |
| 100 | [MetricSpace X] [CompleteSpace X] [LocallyCompactSpace X] |
| 101 | (f : ℕ → A → X) (hf : Equicontinuous f) (a : A) (x : X) |
| 102 | (ha : ∀ i, f i a = x) : |
| 103 | ∃ g : C(A, X), ∃ φ : ℕ → ℕ, StrictMono φ ∧ |
| 104 | TendstoUniformly (fun k ↦ f (φ k)) g atTop := by |
| 105 | classical |
| 106 | obtain ⟨K, hK, hfK⟩ := exists_compact_range_of_anchored f hf a x ha |
| 107 | let F : ℕ → A →ᵇ X := fun k ↦ |
| 108 | BoundedContinuousFunction.mkOfCompact ⟨f k, hf.continuous k⟩ |
| 109 | have hF : Equicontinuous (fun g : Set.range F ↦ (g.1 : A → X)) := by |
| 110 | have h := hf.comp (fun g : Set.range F ↦ Classical.choose g.2) |
| 111 | convert h using 1 |
| 112 | funext g t |
| 113 | have hg := congrArg (fun q : A →ᵇ X ↦ q t) (Classical.choose_spec g.2) |
| 114 | exact hg.symm |
| 115 | have hcompact := BoundedContinuousFunction.arzela_ascoli K hK (Set.range F) |
| 116 | (by rintro _ t ⟨k, rfl⟩; exact hfK k t) hF |
| 117 | obtain ⟨g, _, φ, hφ, hlim⟩ := hcompact.tendsto_subseq |
| 118 | (fun k ↦ subset_closure (Set.mem_range_self k)) |
| 119 | exact ⟨g.toContinuousMap, φ, hφ, |
| 120 | BoundedContinuousFunction.tendsto_iff_tendstoUniformly.mp hlim⟩ |
| 121 | |
| 122 | end PoincareMT.LGeometry |