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.Radius |
| 2 | import PoincareLib.Geometry.RicciFlow.Compactness.GeometricLimit.Overlap.Coverage |
| 3 | |
| 4 | /-! |
| 5 | # The metric induced by source-chart distance limits |
| 6 | |
| 7 | The extracted distances descend to the overlap quotient. Local source-ball |
| 8 | coverage identifies the resulting metric topology with the quotient topology. |
| 9 | This metric is not yet identified with the path distance of the glued metric. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | open Set Filter Metric |
| 14 | open scoped Topology NNReal |
| 15 | |
| 16 | namespace PoincareMT.ChartDistance |
| 17 | |
| 18 | variable {ι : Type*} {X : ι → Type*} [∀ i, MetricSpace (X i)] |
| 19 | {M : ℕ → Type*} [∀ k, MetricSpace (M k)] |
| 20 | {e : ∀ k i, X i → M k} {D : ∀ i j, C(X i × X j, ℝ)} |
| 21 | (hD : ∀ i j x y, Tendsto (fun k => dist (e k i x) (e k j y)) atTop |
| 22 | (𝓝 (D i j (x, y)))) |
| 23 | (O : Poincare.Gluing.OverlapSystem X) |
| 24 | (hrel : ∀ i j (x : X i) (y : X j), O.Rel ⟨i, x⟩ ⟨j, y⟩ ↔ D i j (x, y) = 0) |
| 25 | |
| 26 | noncomputable def quotientDistance : Quotient O.setoid → Quotient O.setoid → ℝ := |
| 27 | Quotient.lift₂ (fun a b : Σ i, X i => D a.1 b.1 (a.2, b.2)) (by |
| 28 | intro a b a' b' ha hb |
| 29 | have hab := (hrel a.1 a'.1 a.2 a'.2).mp ha |
| 30 | have hbb := (hrel b.1 b'.1 b.2 b'.2).mp hb |
| 31 | exact (eq_of_zero_right hD a.2 hbb).trans |
| 32 | ((comm hD _ _ _ _).trans ((eq_of_zero_right hD b'.2 hab).trans |
| 33 | (comm hD _ _ _ _)))) |
| 34 | |
| 35 | @[simp] theorem quotientDistance_include (i j : ι) (x : X i) (y : X j) : |
| 36 | quotientDistance hD O hrel (O.include i x) (O.include j y) = D i j (x, y) := rfl |
| 37 | |
| 38 | theorem quotientDistance_self (q : Quotient O.setoid) : |
| 39 | quotientDistance hD O hrel q q = 0 := by |
| 40 | induction q using Quotient.inductionOn with |
| 41 | | h a => exact self hD a.1 a.2 |
| 42 | |
| 43 | theorem quotientDistance_comm (q r : Quotient O.setoid) : |
| 44 | quotientDistance hD O hrel q r = quotientDistance hD O hrel r q := by |
| 45 | induction q using Quotient.inductionOn with |
| 46 | | h a => |
| 47 | induction r using Quotient.inductionOn with |
| 48 | | h b => exact comm hD a.1 b.1 a.2 b.2 |
| 49 | |
| 50 | theorem quotientDistance_triangle (q r s : Quotient O.setoid) : |
| 51 | quotientDistance hD O hrel q s ≤ |
| 52 | quotientDistance hD O hrel q r + quotientDistance hD O hrel r s := by |
| 53 | induction q using Quotient.inductionOn with |
| 54 | | h a => |
| 55 | induction r using Quotient.inductionOn with |
| 56 | | h b => |
| 57 | induction s using Quotient.inductionOn with |
| 58 | | h c => exact triangle hD a.1 b.1 c.1 a.2 b.2 c.2 |
| 59 | |
| 60 | theorem quotientDistance_eq_zero_iff (q r : Quotient O.setoid) : |
| 61 | quotientDistance hD O hrel q r = 0 ↔ q = r := by |
| 62 | induction q using Quotient.inductionOn with |
| 63 | | h a => |
| 64 | induction r using Quotient.inductionOn with |
| 65 | | h b => |
| 66 | exact ⟨fun h => Quotient.sound ((hrel a.1 b.1 a.2 b.2).mpr h), |
| 67 | fun h => (hrel a.1 b.1 a.2 b.2).mp (Quotient.exact h)⟩ |
| 68 | |
| 69 | theorem quotientDistance_continuous_right (q : Quotient O.setoid) : |
| 70 | Continuous (quotientDistance hD O hrel q) := by |
| 71 | induction q using Quotient.inductionOn with |
| 72 | | h a => exact (quotientRadius hD O hrel a.2).continuous |
| 73 | |
| 74 | include hD hrel in |
| 75 | theorem include_mem_compact_image_of_distance_lt |
| 76 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 77 | (c : ι → ℝ) (hc : ∀ i, 0 < c i) |
| 78 | (hlower : ∀ k i x y, c i * dist x y ≤ dist (e k i x) (e k i y)) |
| 79 | (hopen : ∀ k i, Topology.IsOpenEmbedding (e k i)) |
| 80 | (hconn : ∀ k (p : M k) r, IsPreconnected (ball p r)) |
| 81 | {i j : ι} {x : X i} {y : X j} {r : ℝ} (hr : 0 < r) |
| 82 | (hK : IsCompact (closedBall x r)) (hd : D i j (x, y) < c i * r) : |
| 83 | O.include j y ∈ O.include i '' closedBall x r := by |
| 84 | have himage : ∀ᶠ k in atTop, e k j y ∈ e k i '' closedBall x r := by |
| 85 | filter_upwards [(hD i j x y).eventually (gt_mem_nhds hd)] with k hk |
| 86 | apply image_mono ball_subset_closedBall |
| 87 | apply ball_subset_image_of_lower_bound (hopen k i) hr hK |
| 88 | (fun z => hlower k i z x) (hconn k _ _) (hc i) |
| 89 | simpa only [mem_ball, dist_comm] using hk |
| 90 | obtain ⟨z, hz, hzero⟩ := exists_zero_of_eventually_mem_image hD L he hK |
| 91 | ⟨x, mem_closedBall_self hr.le⟩ himage |
| 92 | exact ⟨z, hz, (Quotient.sound ((hrel j i y z).mpr hzero)).symm⟩ |
| 93 | |
| 94 | theorem isOpen_iff_quotientDistance |
| 95 | [∀ i, LocallyCompactSpace (X i)] |
| 96 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 97 | (c : ι → ℝ) (hc : ∀ i, 0 < c i) |
| 98 | (hlower : ∀ k i x y, c i * dist x y ≤ dist (e k i x) (e k i y)) |
| 99 | (hopen : ∀ k i, Topology.IsOpenEmbedding (e k i)) |
| 100 | (hconn : ∀ k (p : M k) r, IsPreconnected (ball p r)) |
| 101 | (S : Set (Quotient O.setoid)) : |
| 102 | IsOpen S ↔ ∀ q ∈ S, ∃ ε > 0, ∀ z, |
| 103 | quotientDistance hD O hrel q z < ε → z ∈ S := by |
| 104 | constructor |
| 105 | · intro hS q hq |
| 106 | induction q using Quotient.inductionOn with |
| 107 | | h a => |
| 108 | obtain ⟨r, hr, hrS⟩ := Metric.isOpen_iff.mp |
| 109 | (hS.preimage (O.include_isOpenEmbedding a.1).continuous) a.2 hq |
| 110 | obtain ⟨R, hR, hK⟩ := exists_isCompact_closedBall a.2 |
| 111 | let s := min r R / 2 |
| 112 | have hs : 0 < s := half_pos (lt_min hr hR) |
| 113 | have hsr : s < r := lt_of_lt_of_le (half_lt_self (lt_min hr hR)) (min_le_left _ _) |
| 114 | have hsR : s ≤ R := (half_le_self (le_of_lt (lt_min hr hR))).trans (min_le_right _ _) |
| 115 | refine ⟨c a.1 * s, mul_pos (hc a.1) hs, ?_⟩ |
| 116 | intro z hz |
| 117 | induction z using Quotient.inductionOn with |
| 118 | | h b => |
| 119 | obtain ⟨x, hx, heq⟩ := include_mem_compact_image_of_distance_lt hD O hrel L he |
| 120 | c hc hlower hopen hconn hs |
| 121 | (hK.of_isClosed_subset isClosed_closedBall (closedBall_subset_closedBall hsR)) hz |
| 122 | change O.include b.1 b.2 ∈ S |
| 123 | rw [← heq] |
| 124 | exact hrS (lt_of_le_of_lt hx hsr) |
| 125 | · intro h |
| 126 | apply isOpen_iff_mem_nhds.mpr |
| 127 | intro q hq |
| 128 | obtain ⟨ε, hε, hsub⟩ := h q hq |
| 129 | have hball : {z | quotientDistance hD O hrel q z < ε} ∈ 𝓝 q := |
| 130 | (isOpen_lt (quotientDistance_continuous_right hD O hrel q) continuous_const).mem_nhds |
| 131 | (by simpa only [mem_ofPred_eq, quotientDistance_self] using hε) |
| 132 | exact mem_of_superset hball hsub |
| 133 | |
| 134 | /-- The distance-limit metric carries exactly the existing quotient topology. -/ |
| 135 | @[instance_reducible] noncomputable def quotientMetricSpace |
| 136 | [∀ i, LocallyCompactSpace (X i)] |
| 137 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 138 | (c : ι → ℝ) (hc : ∀ i, 0 < c i) |
| 139 | (hlower : ∀ k i x y, c i * dist x y ≤ dist (e k i x) (e k i y)) |
| 140 | (hopen : ∀ k i, Topology.IsOpenEmbedding (e k i)) |
| 141 | (hconn : ∀ k (p : M k) r, IsPreconnected (ball p r)) : |
| 142 | MetricSpace (Quotient O.setoid) := |
| 143 | MetricSpace.ofDistTopology (quotientDistance hD O hrel) |
| 144 | (quotientDistance_self hD O hrel) (quotientDistance_comm hD O hrel) |
| 145 | (quotientDistance_triangle hD O hrel) |
| 146 | (isOpen_iff_quotientDistance hD O hrel L he c hc hlower hopen hconn) |
| 147 | (fun q r => (quotientDistance_eq_zero_iff hD O hrel q r).mp) |
| 148 | |
| 149 | theorem quotientMetricSpace_proper |
| 150 | [∀ i, LocallyCompactSpace (X i)] |
| 151 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 152 | (c : ι → ℝ) (hc : ∀ i, 0 < c i) |
| 153 | (hlower : ∀ k i x y, c i * dist x y ≤ dist (e k i x) (e k i y)) |
| 154 | (hopen : ∀ k i, Topology.IsOpenEmbedding (e k i)) |
| 155 | (hconn : ∀ k (p : M k) r, IsPreconnected (ball p r)) |
| 156 | {i₀ : ι} (p : X i₀) |
| 157 | (hcover : ∀ R : ℝ, 0 < R → ∃ s : Finset ι, ∃ K : ∀ j, Set (X j), |
| 158 | (∀ j ∈ s, IsCompact (K j)) ∧ |
| 159 | ∀ᶠ k in atTop, ball (e k i₀ p) R ⊆ ⋃ j ∈ s, e k j '' K j) : |
| 160 | letI := quotientMetricSpace hD O hrel L he c hc hlower hopen hconn |
| 161 | ProperSpace (Quotient O.setoid) := by |
| 162 | let := quotientMetricSpace hD O hrel L he c hc hlower hopen hconn |
| 163 | have hcompact (r : ℝ) : IsCompact {q | quotientRadius hD O hrel p q ≤ r} := by |
| 164 | let R := max r 0 + 1 |
| 165 | have hR : 0 < R := by dsimp [R]; positivity |
| 166 | obtain ⟨s, K, hK, hcov⟩ := hcover R hR |
| 167 | exact isCompact_radius_sublevel_of_source_ball_cover hD O hrel L he s K hK p |
| 168 | (lt_of_le_of_lt (le_max_left _ _) (lt_add_one _)) hcov |
| 169 | constructor |
| 170 | intro q r |
| 171 | apply (hcompact (dist (O.include i₀ p) q + r)).of_isClosed_subset isClosed_closedBall |
| 172 | intro z hz |
| 173 | change dist (O.include i₀ p) z ≤ dist (O.include i₀ p) q + r |
| 174 | have hz' : dist q z ≤ r := by simpa only [mem_closedBall, dist_comm] using hz |
| 175 | exact (dist_triangle _ q _).trans (add_le_add le_rfl hz') |
| 176 | |
| 177 | end PoincareMT.ChartDistance |