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.Compactness.GeometricLimit.Overlap.CompactCoverage |
| 2 | import PoincareLib.Topology.Exhaustion |
| 3 | import PoincareLib.Geometry.RicciFlow.Compactness.GeometricLimit.Overlap.Connectedness |
| 4 | |
| 5 | /-! |
| 6 | # Radius functions on distance-limit quotients |
| 7 | |
| 8 | Distance from the chosen source basepoint descends through the zero-distance |
| 9 | relation. Eventual finite covers of source balls give compact sublevel sets |
| 10 | and a relatively compact open exhaustion of the quotient. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | open Set Filter Metric |
| 15 | open scoped Topology NNReal |
| 16 | |
| 17 | namespace PoincareMT.ChartDistance |
| 18 | |
| 19 | variable {ι : Type*} {X : ι → Type*} [∀ i, MetricSpace (X i)] |
| 20 | {M : ℕ → Type*} [∀ k, MetricSpace (M k)] |
| 21 | {e : ∀ k i, X i → M k} {D : ∀ i j, C(X i × X j, ℝ)} |
| 22 | (hD : ∀ i j x y, Tendsto (fun k => dist (e k i x) (e k j y)) atTop |
| 23 | (𝓝 (D i j (x, y)))) |
| 24 | (O : Poincare.Gluing.OverlapSystem X) |
| 25 | (hrel : ∀ i j (x : X i) (y : X j), O.Rel ⟨i, x⟩ ⟨j, y⟩ ↔ D i j (x, y) = 0) |
| 26 | |
| 27 | include hD in |
| 28 | theorem eq_of_zero_right {i j l : ι} (p : X i) {x : X j} {y : X l} |
| 29 | (hxy : D j l (x, y) = 0) : D i j (p, x) = D i l (p, y) := by |
| 30 | apply le_antisymm |
| 31 | · have hrev : D l j (y, x) = 0 := (comm hD l j y x).trans hxy |
| 32 | simpa only [hrev, add_zero] using triangle hD i l j p y x |
| 33 | · simpa only [hxy, add_zero] using triangle hD i j l p x y |
| 34 | |
| 35 | /-- Source distance from a fixed chart point, descended to the overlap quotient. -/ |
| 36 | noncomputable def quotientRadius {i₀ : ι} (p : X i₀) : C(Quotient O.setoid, ℝ) where |
| 37 | toFun := Quotient.lift (fun x : Σ i, X i => D i₀ x.1 (p, x.2)) |
| 38 | (fun a b hab => eq_of_zero_right hD p ((hrel a.1 b.1 a.2 b.2).mp hab)) |
| 39 | continuous_toFun := continuous_quot_lift _ (continuous_sigma_iff.mpr fun i => |
| 40 | (D i₀ i).continuous.comp (continuous_const.prodMk continuous_id)) |
| 41 | |
| 42 | @[simp] theorem quotientRadius_include {i₀ : ι} (p : X i₀) (i : ι) (x : X i) : |
| 43 | quotientRadius hD O hrel p (O.include i x) = D i₀ i (p, x) := rfl |
| 44 | |
| 45 | theorem quotientRadius_nonneg {i₀ : ι} (p : X i₀) (q : Quotient O.setoid) : |
| 46 | 0 ≤ quotientRadius hD O hrel p q := by |
| 47 | induction q using Quotient.inductionOn with |
| 48 | | h x => exact nonneg hD i₀ x.1 p x.2 |
| 49 | |
| 50 | @[simp] theorem quotientRadius_base {i₀ : ι} (p : X i₀) : |
| 51 | quotientRadius hD O hrel p (O.include i₀ p) = 0 := self hD i₀ p |
| 52 | |
| 53 | theorem isCompact_radius_sublevel_of_source_ball_cover |
| 54 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 55 | (s : Finset ι) (K : ∀ j, Set (X j)) (hK : ∀ j ∈ s, IsCompact (K j)) |
| 56 | {i₀ : ι} (p : X i₀) {r R : ℝ} (hr : r < R) |
| 57 | (hcover : ∀ᶠ k in atTop, ball (e k i₀ p) R ⊆ ⋃ j ∈ s, e k j '' K j) : |
| 58 | IsCompact {q | quotientRadius hD O hrel p q ≤ r} := by |
| 59 | obtain ⟨hcompact, hcontains⟩ := |
| 60 | compact_cover_of_eventual_source_ball_cover hD L he O hrel s K hK p R hcover |
| 61 | apply hcompact.of_isClosed_subset |
| 62 | (isClosed_le (quotientRadius hD O hrel p).continuous continuous_const) |
| 63 | intro q hq |
| 64 | induction q using Quotient.inductionOn with |
| 65 | | h x => exact hcontains x.1 x.2 (lt_of_le_of_lt hq hr) |
| 66 | |
| 67 | theorem exists_precompact_radius_exhaustion |
| 68 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 69 | {i₀ : ι} (p : X i₀) |
| 70 | (hcover : ∀ R : ℝ, 0 < R → ∃ s : Finset ι, ∃ K : ∀ j, Set (X j), |
| 71 | (∀ j ∈ s, IsCompact (K j)) ∧ |
| 72 | ∀ᶠ k in atTop, ball (e k i₀ p) R ⊆ ⋃ j ∈ s, e k j '' K j) : |
| 73 | ∃ V : ℕ → Set (Quotient O.setoid), |
| 74 | (∀ j, V j = {q | quotientRadius hD O hrel p q < (j : ℝ) + 1}) ∧ |
| 75 | (∀ j, IsOpen (V j)) ∧ (∀ j, O.include i₀ p ∈ V j) ∧ |
| 76 | (∀ j, IsCompact (closure (V j))) ∧ |
| 77 | (∀ j, closure (V j) ⊆ V (j + 1)) ∧ (⋃ j, V j) = univ := by |
| 78 | let ρ := quotientRadius hD O hrel p |
| 79 | let V : ℕ → Set (Quotient O.setoid) := fun j => {q | ρ q < (j : ℝ) + 1} |
| 80 | have hclosure (j : ℕ) : closure (V j) ⊆ {q | ρ q ≤ (j : ℝ) + 1} := |
| 81 | (isClosed_le ρ.continuous continuous_const).closure_subset_iff.mpr |
| 82 | (fun q h => show ρ q ≤ (j : ℝ) + 1 from le_of_lt h) |
| 83 | have hc (j : ℕ) : IsCompact {q | ρ q ≤ (j : ℝ) + 1} := by |
| 84 | obtain ⟨s, K, hK, hcov⟩ := hcover ((j : ℝ) + 2) (by positivity) |
| 85 | exact isCompact_radius_sublevel_of_source_ball_cover hD O hrel L he s K hK p |
| 86 | (by linarith) hcov |
| 87 | refine ⟨V, fun _ => rfl, fun _ => isOpen_lt ρ.continuous continuous_const, |
| 88 | ?_, ?_, ?_, ?_⟩ |
| 89 | · intro j |
| 90 | change quotientRadius hD O hrel p (O.include i₀ p) < (j : ℝ) + 1 |
| 91 | rw [quotientRadius_base] |
| 92 | positivity |
| 93 | · intro j |
| 94 | exact (hc j).of_isClosed_subset isClosed_closure (hclosure j) |
| 95 | · intro j q hq |
| 96 | have h : ρ q ≤ (j : ℝ) + 1 := hclosure j hq |
| 97 | change ρ q < ((j + 1 : ℕ) : ℝ) + 1 |
| 98 | push_cast |
| 99 | linarith |
| 100 | · apply eq_univ_of_forall |
| 101 | intro q |
| 102 | obtain ⟨j, hj⟩ := exists_nat_gt (ρ q) |
| 103 | exact mem_iUnion.mpr ⟨j, show ρ q < (j : ℝ) + 1 by linarith⟩ |
| 104 | |
| 105 | private theorem frontier_component_subset {Y : Type*} [TopologicalSpace Y] |
| 106 | [LocallyConnectedSpace Y] {V : Set Y} (hV : IsOpen V) (p : Y) : |
| 107 | frontier (connectedComponentIn V p) ⊆ frontier V := by |
| 108 | intro q hq |
| 109 | refine ⟨closure_mono (connectedComponentIn_subset V p) hq.1, ?_⟩ |
| 110 | rw [hV.interior_eq] |
| 111 | intro hqV |
| 112 | have hqC : q ∈ connectedComponentIn V q := mem_connectedComponentIn hqV |
| 113 | obtain ⟨y, hyq, hyp⟩ := mem_closure_iff_nhds.mp hq.1 |
| 114 | (connectedComponentIn V q) (hV.connectedComponentIn.mem_nhds hqC) |
| 115 | have heq : connectedComponentIn V q = connectedComponentIn V p := |
| 116 | (connectedComponentIn_eq hyq).trans (connectedComponentIn_eq hyp).symm |
| 117 | apply hq.2 |
| 118 | rw [hV.connectedComponentIn.interior_eq] |
| 119 | exact heq ▸ hqC |
| 120 | |
| 121 | /-- Taking basepoint components preserves the radius boundary levels. -/ |
| 122 | theorem exists_connected_radius_exhaustion |
| 123 | [PreconnectedSpace (Quotient O.setoid)] [LocallyConnectedSpace (Quotient O.setoid)] |
| 124 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 125 | {i₀ : ι} (p : X i₀) |
| 126 | (hcover : ∀ R : ℝ, 0 < R → ∃ s : Finset ι, ∃ K : ∀ j, Set (X j), |
| 127 | (∀ j ∈ s, IsCompact (K j)) ∧ |
| 128 | ∀ᶠ k in atTop, ball (e k i₀ p) R ⊆ ⋃ j ∈ s, e k j '' K j) : |
| 129 | ∃ V : ℕ → Set (Quotient O.setoid), |
| 130 | (∀ j, IsOpen (V j)) ∧ (∀ j, IsConnected (V j)) ∧ |
| 131 | (∀ j, O.include i₀ p ∈ V j) ∧ (∀ j, IsCompact (closure (V j))) ∧ |
| 132 | (∀ j, closure (V j) ⊆ V (j + 1)) ∧ (⋃ j, V j) = univ ∧ |
| 133 | ∀ j q, q ∈ frontier (V j) → quotientRadius hD O hrel p q = (j : ℝ) + 1 := by |
| 134 | obtain ⟨U, hUeq, hUopen, hUp, hUc, hUstep, hUcover⟩ := |
| 135 | exists_precompact_radius_exhaustion hD O hrel L he p hcover |
| 136 | let b := O.include i₀ p |
| 137 | have hUmono : Monotone U := monotone_nat_of_le_succ fun j => |
| 138 | subset_closure.trans (hUstep j) |
| 139 | refine ⟨fun j => connectedComponentIn (U j) b, |
| 140 | fun j => (hUopen j).connectedComponentIn, |
| 141 | fun j => isConnected_connectedComponentIn_iff.mpr (hUp j), |
| 142 | fun j => mem_connectedComponentIn (hUp j), ?_, ?_, |
| 143 | Poincare.iUnion_connectedComponentIn_eq_univ U hUopen hUmono hUcover b, ?_⟩ |
| 144 | · intro j |
| 145 | exact (hUc j).of_isClosed_subset isClosed_closure |
| 146 | (closure_mono (connectedComponentIn_subset _ _)) |
| 147 | · intro j |
| 148 | exact isPreconnected_connectedComponentIn.closure.subset_connectedComponentIn |
| 149 | (subset_closure (mem_connectedComponentIn (hUp j))) |
| 150 | ((closure_mono (connectedComponentIn_subset _ _)).trans (hUstep j)) |
| 151 | · intro j q hq |
| 152 | have hqU := frontier_component_subset (hUopen j) b hq |
| 153 | rw [hUeq j] at hqU |
| 154 | exact frontier_lt_subset_eq (quotientRadius hD O hrel p).continuous |
| 155 | continuous_const hqU |
| 156 | |
| 157 | /-- The source ball covers construct the connected quotient and the chosen |
| 158 | exhaustion, with no separate quotient connectedness hypothesis. -/ |
| 159 | theorem exists_connected_exhaustion_of_source_ball_covers |
| 160 | [∀ i, LocallyConnectedSpace (X i)] |
| 161 | (hlocal : ∀ i j, TendstoLocallyUniformly |
| 162 | (fun k (p : X i × X j) => dist (e k i p.1) (e k j p.2)) (D i j) atTop) |
| 163 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 164 | (hconn : ∀ k (p : M k) r, IsPreconnected (ball p r)) |
| 165 | {i₀ : ι} (p : X i₀) |
| 166 | (hcover : ∀ R : ℝ, 0 < R → ∃ s : Finset ι, ∃ K : ∀ j, Set (X j), |
| 167 | (∀ j ∈ s, IsCompact (K j)) ∧ |
| 168 | ∀ᶠ k in atTop, ball (e k i₀ p) R ⊆ ⋃ j ∈ s, e k j '' K j) : |
| 169 | ConnectedSpace (Quotient O.setoid) ∧ |
| 170 | ∃ V : ℕ → Set (Quotient O.setoid), |
| 171 | (∀ j, IsOpen (V j)) ∧ (∀ j, IsConnected (V j)) ∧ |
| 172 | (∀ j, O.include i₀ p ∈ V j) ∧ (∀ j, IsCompact (closure (V j))) ∧ |
| 173 | (∀ j, closure (V j) ⊆ V (j + 1)) ∧ (⋃ j, V j) = univ ∧ |
| 174 | ∀ j q, q ∈ frontier (V j) → quotientRadius hD O hrel p q = (j : ℝ) + 1 := by |
| 175 | let : PreconnectedSpace (Quotient O.setoid) := |
| 176 | quotient_preconnected_of_source_ball_covers hlocal O hrel L he hconn p hcover |
| 177 | let : LocallyConnectedSpace (Quotient O.setoid) := quotient_locallyConnected_of_charts O |
| 178 | let : Nonempty (Quotient O.setoid) := ⟨O.include i₀ p⟩ |
| 179 | exact ⟨⟨⟨O.include i₀ p⟩⟩, exists_connected_radius_exhaustion hD O hrel L he p hcover⟩ |
| 180 | |
| 181 | end PoincareMT.ChartDistance |