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.Topology.Gluing.Basic |
| 2 | import PoincareLib.Geometry.RicciFlow.Compactness.GeometricLimit.Overlap.UniformDistance |
| 3 | import Mathlib.Topology.Compactness.LocallyCompact |
| 4 | |
| 5 | /-! |
| 6 | # Compact representatives of quotient sets |
| 7 | |
| 8 | Compact closed subsets of an overlap quotient have finitely many compact |
| 9 | coordinate representatives. Local uniform distance convergence is therefore |
| 10 | uniform over these representatives, with one threshold for the whole set. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | open Set Filter |
| 15 | open scoped Topology |
| 16 | |
| 17 | namespace PoincareMT.ChartDistance |
| 18 | |
| 19 | variable {ι : Type*} {X : ι → Type*} [∀ i, TopologicalSpace (X i)] |
| 20 | |
| 21 | theorem exists_finite_compact_representatives |
| 22 | [∀ i, WeaklyLocallyCompactSpace (X i)] (O : Poincare.Gluing.OverlapSystem X) |
| 23 | {Q : Set (Quotient O.setoid)} (hQ : IsCompact Q) (hQc : IsClosed Q) : |
| 24 | ∃ s : Finset (Σ i, X i), ∃ K : ∀ a : Σ i, X i, Set (X a.1), |
| 25 | (∀ a ∈ s, IsCompact (K a)) ∧ (⋃ a ∈ s, O.include a.1 '' K a) = Q := by |
| 26 | classical |
| 27 | choose K hK hKn using fun a : Σ i, X i => exists_compact_mem_nhds a.2 |
| 28 | let V := fun a : Σ i, X i => O.include a.1 '' interior (K a) |
| 29 | have hVo (a) : IsOpen (V a) := O.include_isOpenMap a.1 _ isOpen_interior |
| 30 | have hcover : Q ⊆ ⋃ a, V a := by |
| 31 | intro q _ |
| 32 | induction q using Quotient.inductionOn with |
| 33 | | h a => |
| 34 | exact mem_iUnion.mpr ⟨a, mem_image_of_mem _ (mem_interior_iff_mem_nhds.mpr (hKn a))⟩ |
| 35 | obtain ⟨s, hs⟩ := hQ.elim_finite_subcover V hVo hcover |
| 36 | refine ⟨s, fun a => K a ∩ O.include a.1 ⁻¹' Q, ?_, ?_⟩ |
| 37 | · intro a _ |
| 38 | exact (hK a).inter_right (hQc.preimage (O.include_isOpenEmbedding a.1).continuous) |
| 39 | · apply Subset.antisymm |
| 40 | · intro q hq |
| 41 | obtain ⟨a, _, x, hx, rfl⟩ := by |
| 42 | simpa only [mem_iUnion, exists_prop, mem_image] using hq |
| 43 | exact hx.2 |
| 44 | · intro q hq |
| 45 | obtain ⟨a, ha, x, hx, rfl⟩ := by |
| 46 | simpa only [mem_iUnion, exists_prop, mem_image, V] using hs hq |
| 47 | exact mem_iUnion.mpr ⟨a, mem_iUnion.mpr ⟨ha, x, ⟨interior_subset hx, hq⟩, rfl⟩⟩ |
| 48 | |
| 49 | variable {M : ℕ → Type*} [∀ k, PseudoMetricSpace (M k)] |
| 50 | {e : ∀ k i, X i → M k} {D : ∀ i j, X i × X j → ℝ} |
| 51 | (hD : ∀ i j, TendstoLocallyUniformly |
| 52 | (fun k (p : X i × X j) => dist (e k i p.1) (e k j p.2)) (D i j) atTop) |
| 53 | |
| 54 | include hD |
| 55 | |
| 56 | theorem eventually_base_dist_sub_limit_lt_on_representatives |
| 57 | {i₀ : ι} (p : X i₀) (s : Finset (Σ i, X i)) |
| 58 | (K : ∀ a : Σ i, X i, Set (X a.1)) (hK : ∀ a ∈ s, IsCompact (K a)) |
| 59 | {ε : ℝ} (hε : 0 < ε) : |
| 60 | ∀ᶠ k in atTop, ∀ a ∈ s, ∀ x ∈ K a, |
| 61 | |dist (e k i₀ p) (e k a.1 x) - D i₀ a.1 (p, x)| < ε := by |
| 62 | have h := fun a ha => eventually_dist_sub_limit_lt_on_compact hD |
| 63 | ({p} ×ˢ K a) (isCompact_singleton.prod (hK a ha)) hε |
| 64 | filter_upwards [s.eventually_all.mpr h] with k hk a ha x hx |
| 65 | exact hk a ha (p, x) ⟨mem_singleton p, hx⟩ |
| 66 | |
| 67 | end PoincareMT.ChartDistance |