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 PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.PartialLimits.RegularSets.RescaledCharts |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.PartialLimits.RegularSets.ComponentDistances |
| 4 | import Mathlib.Data.Nat.Pairing |
| 5 | |
| 6 | /-! |
| 7 | # Countable charts from actual regular-component covers |
| 8 | |
| 9 | Every finite prefix uses an available actual normal cover. Finite minima |
| 10 | and maxima give fixed distance bounds, while each intended stage retains |
| 11 | its regular-component cover and lower-regularity target. This is the |
| 12 | nonradial chart selection in Morgan--Tian Theorem 5.6, printed pp. 86-87; |
| 13 | see the regular-set diagonal derivation dated 2026-09-23. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter Metric |
| 20 | open scoped Topology NNReal Manifold ContDiff |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.M28 |
| 25 | |
| 26 | variable {n : ℕ} {M : ℕ → Type u} [∀ k, MetricSpace (M k)] |
| 27 | [∀ k, ChartedSpace (EuclideanSpace ℝ (Fin n)) (M k)] |
| 28 | [∀ k, IsManifold (𝓡 n) ∞ (M k)] |
| 29 | {g : ∀ k, RiemannianMetric n (M k)} {p : ∀ k, M k} |
| 30 | {δ R ρ : ℕ → ℝ} {N : ℕ → ℕ} |
| 31 | (cover : ∀ k j, j ≤ k → RegularNormalChartCover (g k) (p k) |
| 32 | (δ j) (R j) (ρ j) (N j)) |
| 33 | |
| 34 | private noncomputable def regularStageUnitBallMap (k j : ℕ) (hjk : j ≤ k) (l : ℕ) |
| 35 | (x : ball (0 : EuclideanSpace ℝ (Fin n)) 1) : M k := |
| 36 | (cover k j hjk).unitBallMap ⟨l % (N j + 1), Nat.mod_lt _ (Nat.succ_pos _)⟩ x |
| 37 | |
| 38 | /-- Enumerate the actual regular-component charts, using an available |
| 39 | stage at every source index. Theorem 5.6, printed pp. 86-87. -/ |
| 40 | noncomputable def regularUnitBallMap (k i : ℕ) |
| 41 | (x : ball (0 : EuclideanSpace ℝ (Fin n)) 1) : M k := |
| 42 | regularStageUnitBallMap cover k (min (Nat.unpair i).1 k) (min_le_right _ _) |
| 43 | (Nat.unpair i).2 x |
| 44 | |
| 45 | /-- Once its stage is available, an enumerated chart is the intended |
| 46 | actual normal chart. Theorem 5.6, printed pp. 86-87. -/ |
| 47 | theorem regularUnitBallMap_of_le (k i : ℕ) (hik : (Nat.unpair i).1 ≤ k) : |
| 48 | regularUnitBallMap cover k i = |
| 49 | (cover k (Nat.unpair i).1 hik).unitBallMap |
| 50 | ⟨(Nat.unpair i).2 % (N (Nat.unpair i).1 + 1), Nat.mod_lt _ (Nat.succ_pos _)⟩ := by |
| 51 | funext x |
| 52 | simp only [regularUnitBallMap, min_eq_left hik] |
| 53 | rfl |
| 54 | |
| 55 | /-- Pairing realizes every label in an available finite cover exactly. |
| 56 | Theorem 5.6, printed pp. 86-87. -/ |
| 57 | theorem regularUnitBallMap_pair (k j : ℕ) (hjk : j ≤ k) (l : Fin (N j + 1)) : |
| 58 | regularUnitBallMap cover k (Nat.pair j l) = (cover k j hjk).unitBallMap l := by |
| 59 | funext x |
| 60 | simp only [regularUnitBallMap, Nat.unpair_pair, min_eq_left hjk] |
| 61 | simp only [regularStageUnitBallMap, Nat.mod_eq_of_lt l.isLt] |
| 62 | |
| 63 | /-- The distinguished chart preserves the actual basepoint at every |
| 64 | source index. Theorem 5.6, printed pp. 86-87. -/ |
| 65 | theorem regularUnitBallMap_zero (k : ℕ) : |
| 66 | regularUnitBallMap cover k 0 ⟨0, by simp⟩ = p k := by |
| 67 | change regularUnitBallMap cover k (Nat.pair 0 (0 : Fin (N 0 + 1))) ⟨0, by simp⟩ = _ |
| 68 | rw [regularUnitBallMap_pair cover k 0 (Nat.zero_le k) (0 : Fin (N 0 + 1))] |
| 69 | simp only [RegularNormalChartCover.unitBallMap, smul_zero] |
| 70 | exact ((cover k 0 (Nat.zero_le k)).map_zero 0).trans |
| 71 | (cover k 0 (Nat.zero_le k)).centre_zero |
| 72 | |
| 73 | /-- The finite-prefix convention retains genuine local diffeomorphisms. |
| 74 | Theorem 5.6, printed pp. 86-87. -/ |
| 75 | theorem regularUnitBallMap_isLocalDiffeomorph |
| 76 | (hρ : ∀ j, 0 < ρ j) (hρR : ∀ j, ρ j / 2 ≤ R j) (k i : ℕ) : |
| 77 | letI : Nonempty (ball (0 : EuclideanSpace ℝ (Fin n)) 1) := ⟨⟨0, by simp⟩⟩ |
| 78 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) |
| 79 | (ball (0 : EuclideanSpace ℝ (Fin n)) 1) := |
| 80 | isOpen_ball.isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 81 | IsLocalDiffeomorph (𝓡 n) (𝓡 n) ∞ (regularUnitBallMap cover k i) := |
| 82 | (cover k _ (min_le_right _ _)).unitBallMap_isLocalDiffeomorph (hρ _) (hρR _) _ |
| 83 | |
| 84 | /-- Every enumerated map is an actual open embedding in its source. |
| 85 | Theorem 5.6, printed pp. 86-87. -/ |
| 86 | theorem regularUnitBallMap_isOpenEmbedding |
| 87 | (hρ : ∀ j, 0 < ρ j) (hρR : ∀ j, ρ j / 2 ≤ R j) (k i : ℕ) : |
| 88 | Topology.IsOpenEmbedding (regularUnitBallMap cover k i) := |
| 89 | (cover k _ (min_le_right _ _)).unitBallMap_isOpenEmbedding (hρ _) (hρR _) _ |
| 90 | |
| 91 | /-- Finite extrema over available prefix stages give fixed distance |
| 92 | bounds for each countable chart. Theorem 5.6, printed pp. 86-87. -/ |
| 93 | theorem regularUnitBallMap_distance_bounds |
| 94 | (hdist : ∀ k (x y : M k), edist x y = (g k).edist x y) |
| 95 | (hρ : ∀ j, 0 < ρ j) (i : ℕ) : |
| 96 | ∃ L : ℝ≥0, ∃ c : ℝ, 0 < c ∧ |
| 97 | (∀ k, LipschitzWith L (regularUnitBallMap cover k i)) ∧ |
| 98 | ∀ k x y, c * dist x y ≤ |
| 99 | dist (regularUnitBallMap cover k i x) (regularUnitBallMap cover k i y) := by |
| 100 | classical |
| 101 | let S := Finset.range ((Nat.unpair i).1 + 1) |
| 102 | have hS : S.Nonempty := ⟨0, by simp [S]⟩ |
| 103 | let upper := fun j => Real.sqrt (9 / 4 : ℝ) * (ρ j / 2) |
| 104 | let lower := fun j => Real.sqrt (1 / 4 : ℝ) * (ρ j / 2) |
| 105 | have hupper (j : ℕ) : 0 ≤ upper j := |
| 106 | mul_nonneg (Real.sqrt_nonneg _) (half_pos (hρ j)).le |
| 107 | have hlower (j : ℕ) : 0 < lower j := |
| 108 | mul_pos (Real.sqrt_pos.2 (by norm_num)) (half_pos (hρ j)) |
| 109 | let B := S.sup' hS upper |
| 110 | have hB : 0 ≤ B := (hupper 0).trans (Finset.le_sup' upper (by simp [S])) |
| 111 | let c := S.inf' hS lower |
| 112 | have hc : 0 < c := (Finset.lt_inf'_iff hS).2 (fun j _ => hlower j) |
| 113 | have hreal (k : ℕ) (x y : M k) : ((g k).edist x y).toReal = dist x y := by |
| 114 | rw [← hdist, ← dist_edist] |
| 115 | refine ⟨⟨B, hB⟩, c, hc, ?_, ?_⟩ |
| 116 | · intro k |
| 117 | have hj : min (Nat.unpair i).1 k ∈ S := |
| 118 | Finset.mem_range.mpr (Nat.lt_succ_of_le (min_le_left _ _)) |
| 119 | apply LipschitzWith.of_dist_le_mul |
| 120 | intro x y |
| 121 | have h := ((cover k _ (min_le_right _ _)).unitBallMap_distances |
| 122 | (hρ _) ⟨(Nat.unpair i).2 % (N (min (Nat.unpair i).1 k) + 1), |
| 123 | Nat.mod_lt _ (Nat.succ_pos _)⟩ x y).2 |
| 124 | rw [hreal] at h |
| 125 | exact h.trans (mul_le_mul_of_nonneg_right (Finset.le_sup' upper hj) dist_nonneg) |
| 126 | · intro k x y |
| 127 | have hj : min (Nat.unpair i).1 k ∈ S := |
| 128 | Finset.mem_range.mpr (Nat.lt_succ_of_le (min_le_left _ _)) |
| 129 | have h := ((cover k _ (min_le_right _ _)).unitBallMap_distances |
| 130 | (hρ _) ⟨(Nat.unpair i).2 % (N (min (Nat.unpair i).1 k) + 1), |
| 131 | Nat.mod_lt _ (Nat.succ_pos _)⟩ x y).1 |
| 132 | rw [hreal] at h |
| 133 | exact (mul_le_mul_of_nonneg_right (Finset.inf'_le lower hj) dist_nonneg).trans h |
| 134 | |
| 135 | /-- The finite regular-component covers bound every point of a fixed |
| 136 | countable chart from the base, including prefixes. Theorem 5.6, pp. 86-87. -/ |
| 137 | theorem regularUnitBallMap_base_distance_bound |
| 138 | (hdist : ∀ k (x y : M k), edist x y = (g k).edist x y) |
| 139 | (hρ : ∀ j, 0 < ρ j) (hρR : ∀ j, 2 * ρ j < R j) (i : ℕ) : |
| 140 | ∃ B : ℝ, ∀ k x, dist (p k) (regularUnitBallMap cover k i x) ≤ B := by |
| 141 | classical |
| 142 | let S := Finset.range ((Nat.unpair i).1 + 1) |
| 143 | have hS : S.Nonempty := ⟨0, by simp [S]⟩ |
| 144 | let bound := fun j => (ρ j / 2) * (N j + 1 : ℕ) + ρ j / 2 |
| 145 | refine ⟨S.sup' hS bound, ?_⟩ |
| 146 | intro k x |
| 147 | have hj : min (Nat.unpair i).1 k ∈ S := |
| 148 | Finset.mem_range.mpr (Nat.lt_succ_of_le (min_le_left _ _)) |
| 149 | have h := (cover k _ (min_le_right _ _)).chart_distance_le (hdist k) (hρ _) (hρR _) |
| 150 | ⟨(Nat.unpair i).2 % (N (min (Nat.unpair i).1 k) + 1), |
| 151 | Nat.mod_lt _ (Nat.succ_pos _)⟩ (NormalChartCover.rescale_mem_half_ball (hρ _) x) |
| 152 | exact h.trans (Finset.le_sup' bound hj) |
| 153 | |
| 154 | /-- Actual connected-component distance bounds give the all-index pair |
| 155 | boundedness needed for distance extraction. Theorem 5.6, pp. 86-87. -/ |
| 156 | theorem regularUnitBallMap_pairwise_bounded |
| 157 | (hdist : ∀ k (x y : M k), edist x y = (g k).edist x y) |
| 158 | (hρ : ∀ j, 0 < ρ j) (hρR : ∀ j, 2 * ρ j < R j) |
| 159 | (i j : ℕ) : |
| 160 | ∃ B : ℝ, ∀ k x y, |
| 161 | dist (regularUnitBallMap cover k i x) (regularUnitBallMap cover k j y) ≤ B := by |
| 162 | obtain ⟨A, hA⟩ := regularUnitBallMap_base_distance_bound cover hdist hρ hρR i |
| 163 | obtain ⟨B, hB⟩ := regularUnitBallMap_base_distance_bound cover hdist hρ hρR j |
| 164 | exact ⟨A + B, fun k x y => (dist_triangle_left _ _ (p k)).trans |
| 165 | (add_le_add (hA k x) (hB k y))⟩ |
| 166 | |
| 167 | /-- Each actual countable chart eventually lies entirely in its lower |
| 168 | regularity base component. The chart label and stage remain distinct. |
| 169 | Theorem 5.6, printed pp. 86-87. -/ |
| 170 | theorem regularUnitBallMap_eventually_mem_regularComponent |
| 171 | (hρ : ∀ j, 0 < ρ j) (hρR : ∀ j, ρ j / 2 ≤ R j) (i : ℕ) : |
| 172 | ∀ᶠ k in atTop, ∀ x, |
| 173 | regularUnitBallMap cover k i x ∈ |
| 174 | regularComponent (g k) (p k) (2 * δ (Nat.unpair i).1) := by |
| 175 | filter_upwards [eventually_ge_atTop (Nat.unpair i).1] with k hk x |
| 176 | rw [regularUnitBallMap_of_le cover k i hk] |
| 177 | exact (cover k _ hk).unitBallMap_mem_regularComponent (hρ _) (hρR _) _ x |
| 178 | |
| 179 | /-- Fixed compact coordinate cores cover every actual regular-component |
| 180 | stage eventually. No radial-ball covering premise is used. |
| 181 | Theorem 5.6, printed pp. 86-87. -/ |
| 182 | theorem regularUnitBallMap_compact_cover (hρ : ∀ j, 0 < ρ j) (j : ℕ) : |
| 183 | ∃ S : Finset ℕ, |
| 184 | ∃ K : ℕ → Set (ball (0 : EuclideanSpace ℝ (Fin n)) 1), |
| 185 | (∀ i ∈ S, IsCompact (K i)) ∧ |
| 186 | ∀ᶠ k in atTop, regularComponent (g k) (p k) (4 * δ j) ⊆ |
| 187 | ⋃ i ∈ S, regularUnitBallMap cover k i '' K i := by |
| 188 | classical |
| 189 | let K : Set (ball (0 : EuclideanSpace ℝ (Fin n)) 1) := |
| 190 | {x | ‖(x : EuclideanSpace ℝ (Fin n))‖ ≤ 1 / 4} |
| 191 | have hK : IsCompact K := by |
| 192 | rw [Subtype.isCompact_iff] |
| 193 | have himage : Subtype.val '' K = closedBall (0 : EuclideanSpace ℝ (Fin n)) (1 / 4) := by |
| 194 | ext x |
| 195 | constructor |
| 196 | · rintro ⟨y, hy, rfl⟩ |
| 197 | exact mem_closedBall_zero_iff.mpr hy |
| 198 | · intro hx |
| 199 | refine ⟨⟨x, mem_ball_zero_iff.mpr |
| 200 | ((mem_closedBall_zero_iff.mp hx).trans_lt (by norm_num))⟩, |
| 201 | mem_closedBall_zero_iff.mp hx, rfl⟩ |
| 202 | rw [himage] |
| 203 | exact isCompact_closedBall _ _ |
| 204 | let S := Finset.univ.image (fun l : Fin (N j + 1) => Nat.pair j l) |
| 205 | refine ⟨S, fun _ => K, fun _ _ => hK, ?_⟩ |
| 206 | filter_upwards [eventually_ge_atTop j] with k hk |
| 207 | intro y hy |
| 208 | obtain ⟨l, x, hx, hxy⟩ := mem_iUnion.mp ((cover k j hk).unitBallMap_cover (hρ j) hy) |
| 209 | refine mem_iUnion₂.mpr ⟨Nat.pair j l, Finset.mem_image.mpr |
| 210 | ⟨l, Finset.mem_univ _, rfl⟩, x, hx, ?_⟩ |
| 211 | rw [regularUnitBallMap_pair cover k j hk l] |
| 212 | exact hxy |
| 213 | |
| 214 | end PoincareMT.M28 |