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.Tube.NeckGeometry.NeckSpherePaths |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.IntrinsicGeometry.IntrinsicOpenMetric |
| 4 | import Mathlib.Data.Finset.Card |
| 5 | |
| 6 | /-! |
| 7 | # Uniform packing of actual central spheres |
| 8 | |
| 9 | A finite cover of the fixed standard sphere is chosen before the neck. |
| 10 | Actual coordinate-image paths transfer that cover to the original open |
| 11 | region with the proved factor-four length comparison. |
| 12 | Source: Morgan--Tian Lemma 10.27, p. 261; M28 derivation 155. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.M28 |
| 24 | |
| 25 | /-- Compactness of the one fixed model produces finitely many centers |
| 26 | joined to every model point by an actual C1 path of the requested |
| 27 | length. No ambient manifold or neck is supplied yet. Derivation 155. -/ |
| 28 | theorem exists_standardSphere_small_path_cover {tau : ℝ} (htau : 0 < tau) : |
| 29 | ∃ F : Finset UnitTwoSphere, ∀ q : UnitTwoSphere, ∃ z ∈ F, |
| 30 | ∃ gamma : ℝ → UnitTwoSphere, gamma 0 = q ∧ gamma 1 = z ∧ |
| 31 | ContMDiff 𝓘(ℝ, ℝ) (𝓡 2) 1 gamma ∧ |
| 32 | standardSphereMetric.pathELength gamma 0 1 < ENNReal.ofReal tau := by |
| 33 | classical |
| 34 | have hs : IsConnected (Metric.sphere (0 : EuclideanSpace ℝ (Fin 3)) 1) := |
| 35 | isConnected_sphere (by rw [← Module.finrank_eq_rank]; norm_num) _ (by norm_num) |
| 36 | let : ConnectedSpace UnitTwoSphere := Subtype.connectedSpace hs |
| 37 | let : Bundle.RiemannianBundle |
| 38 | (TangentSpace (𝓡 2) : UnitTwoSphere → Type _) := |
| 39 | ⟨standardSphereMetric.toRiemannianMetric⟩ |
| 40 | let O : UnitTwoSphere → Set UnitTwoSphere := |
| 41 | fun z => {q | (standardSphereMetric.edist z q).toReal < tau} |
| 42 | have hopen (z : UnitTwoSphere) : IsOpen (O z) := |
| 43 | isOpen_lt (standardSphereMetric.continuous_toReal_edist z) continuous_const |
| 44 | have hcover : (univ : Set UnitTwoSphere) ⊆ ⋃ z, O z := by |
| 45 | intro q _hq |
| 46 | refine mem_iUnion.mpr ⟨q, ?_⟩ |
| 47 | change (standardSphereMetric.edist q q).toReal < tau |
| 48 | have hzero : standardSphereMetric.edist q q = 0 := Manifold.riemannianEDist_self |
| 49 | simpa only [hzero, ENNReal.toReal_zero] using htau |
| 50 | obtain ⟨F, hF⟩ := isCompact_univ.elim_finite_subcover O hopen hcover |
| 51 | refine ⟨F, ?_⟩ |
| 52 | intro q |
| 53 | obtain ⟨z, hzF, hq⟩ := mem_iUnion₂.mp (hF (mem_univ q)) |
| 54 | have hdist : standardSphereMetric.edist q z < ENNReal.ofReal tau := by |
| 55 | apply (ENNReal.toReal_lt_toReal (standardSphereMetric.edist_ne_top q z) |
| 56 | ENNReal.ofReal_ne_top).mp |
| 57 | rw [ENNReal.toReal_ofReal htau.le] |
| 58 | have hcomm : standardSphereMetric.edist q z = standardSphereMetric.edist z q := |
| 59 | Manifold.riemannianEDist_comm |
| 60 | rw [hcomm] |
| 61 | exact hq |
| 62 | obtain ⟨gamma, h0, h1, hgamma, hlength, _hflat0, _hflat1⟩ := |
| 63 | Manifold.exists_lt_locally_constant_of_riemannianEDist_lt hdist zero_lt_one |
| 64 | exact ⟨z, hzF, gamma, h0, h1, hgamma, hlength⟩ |
| 65 | |
| 66 | private theorem intrinsicEDist_coordinate_sphere_path_lt |
| 67 | {M : Type u} [TopologicalSpace M] |
| 68 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 69 | {g : RiemannianMetric 3 M} (N : EpsilonNeck g) |
| 70 | {V : Set M} (hSV : N.central_sphere ⊆ V) |
| 71 | {p q : UnitTwoSphere} {tau : ℝ} |
| 72 | {gamma : ℝ → UnitTwoSphere} (h0 : gamma 0 = p) (h1 : gamma 1 = q) |
| 73 | (hgamma : ContMDiff 𝓘(ℝ, ℝ) (𝓡 2) 1 gamma) |
| 74 | (hlength : standardSphereMetric.pathELength gamma 0 1 < ENNReal.ofReal tau) : |
| 75 | intrinsicEDist g V (N.coordinate_map (p, 0)) (N.coordinate_map (q, 0)) < |
| 76 | ENNReal.ofReal (4 * N.scale * tau) := by |
| 77 | have hzero : (0 : ℝ) ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ := |
| 78 | ⟨neg_neg_of_pos (inv_pos.mpr N.epsilon_pos), inv_pos.mpr N.epsilon_pos⟩ |
| 79 | let sigma : ℝ → M := fun t => N.coordinate_map (gamma t, 0) |
| 80 | have hsmooth : ContMDiff 𝓘(ℝ, ℝ) (𝓡 3) 1 sigma := by |
| 81 | rw [← contMDiffOn_univ] |
| 82 | apply (N.coordinate_map_smooth.of_le (by simp)).comp |
| 83 | · exact (hgamma.prodMk contMDiff_const).contMDiffOn |
| 84 | · intro t _ht |
| 85 | exact ⟨mem_univ _, hzero⟩ |
| 86 | have hmap : MapsTo sigma (Icc (0 : ℝ) 1) V := by |
| 87 | intro t _ht |
| 88 | apply hSV |
| 89 | rw [N.central_sphere_eq] |
| 90 | exact ⟨(gamma t, 0), ⟨mem_univ _, rfl⟩, rfl⟩ |
| 91 | have hle := intrinsicEDist_le_pathELength g zero_le_one hsmooth.contMDiffOn hmap |
| 92 | have hscale : 0 < 4 * N.scale := mul_pos (by norm_num) N.scale_pos |
| 93 | have hbound := (coordinate_sphere_pathELength_le N hgamma hzero 0 1).trans_lt |
| 94 | (ENNReal.mul_lt_mul_right (ne_of_gt (ENNReal.ofReal_pos.mpr hscale)) |
| 95 | ENNReal.ofReal_ne_top hlength) |
| 96 | have hbound' : g.pathELength sigma 0 1 < ENNReal.ofReal (4 * N.scale * tau) := by |
| 97 | simpa only [sigma, ← ENNReal.ofReal_mul hscale.le] using hbound |
| 98 | have hfinal := hle.trans_lt hbound' |
| 99 | simpa only [sigma, h0, h1] using hfinal |
| 100 | |
| 101 | /-- A packing number chosen solely from the fixed model works for every |
| 102 | actual neck central sphere inside any open region. Distances use that |
| 103 | region's actual pullback metric, via sphere-valued competitors. |
| 104 | Source: Lemma 10.27, p. 261; M28 derivation 155. -/ |
| 105 | theorem exists_central_sphere_packing_number {eta : ℝ} (heta : 0 < eta) : |
| 106 | ∃ K : ℕ, 1 ≤ K ∧ |
| 107 | ∀ (M : Type u) [TopologicalSpace M] |
| 108 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 109 | (g : RiemannianMetric 3 M) (N : EpsilonNeck g) |
| 110 | (U : TopologicalSpace.Opens M), N.central_sphere ⊆ (U : Set M) → |
| 111 | ∀ x : Fin (K + 1) → U, (∀ j, (x j : M) ∈ N.central_sphere) → |
| 112 | ∃ i j : Fin (K + 1), i ≠ j ∧ |
| 113 | (intrinsicOpenMetric g U).edist (x i) (x j) < |
| 114 | ENNReal.ofReal (eta * N.scale) := by |
| 115 | classical |
| 116 | let tau : ℝ := eta / 16 |
| 117 | have htau : 0 < tau := div_pos heta (by norm_num) |
| 118 | obtain ⟨F, hcover⟩ := exists_standardSphere_small_path_cover htau |
| 119 | let K : ℕ := F.card + 1 |
| 120 | refine ⟨K, by dsimp only [K]; omega, ?_⟩ |
| 121 | intro M _ _ _ g N U hSU x hx |
| 122 | let gU := intrinsicOpenMetric g U |
| 123 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : U → Type _) := |
| 124 | ⟨gU.toRiemannianMetric⟩ |
| 125 | have hcoords (j : Fin (K + 1)) : |
| 126 | ∃ q : UnitTwoSphere, N.coordinate_map (q, 0) = (x j : M) := by |
| 127 | have h := hx j |
| 128 | rw [N.central_sphere_eq] at h |
| 129 | obtain ⟨⟨q, s⟩, ⟨_hq, hs⟩, hq⟩ := h |
| 130 | have hs0 : s = 0 := hs |
| 131 | subst s |
| 132 | exact ⟨q, hq⟩ |
| 133 | choose q hq using hcoords |
| 134 | choose z hz gamma h0 h1 hgamma hlength using fun j => hcover (q j) |
| 135 | have hcard : F.card < (Finset.univ : Finset (Fin (K + 1))).card := by |
| 136 | simp only [Finset.card_univ, Fintype.card_fin, K] |
| 137 | omega |
| 138 | obtain ⟨i, _hi, j, _hj, hij, heq⟩ := |
| 139 | Finset.exists_ne_map_eq_of_card_lt_of_maps_to (f := z) hcard |
| 140 | (fun j (_hj : j ∈ (Finset.univ : Finset (Fin (K + 1)))) => hz j) |
| 141 | have hzS : N.coordinate_map (z i, 0) ∈ N.central_sphere := by |
| 142 | rw [N.central_sphere_eq] |
| 143 | exact ⟨(z i, 0), ⟨mem_univ _, rfl⟩, rfl⟩ |
| 144 | let center : U := ⟨N.coordinate_map (z i, 0), hSU hzS⟩ |
| 145 | let B : ℝ := 4 * N.scale * tau |
| 146 | have hB : 0 ≤ B := (mul_pos (mul_pos (by norm_num) N.scale_pos) htau).le |
| 147 | have hleft : gU.edist (x i) center < ENNReal.ofReal B := by |
| 148 | rw [intrinsicOpenMetric_edist] |
| 149 | change intrinsicEDist g (U : Set M) (x i : M) (N.coordinate_map (z i, 0)) < _ |
| 150 | rw [← hq i] |
| 151 | exact intrinsicEDist_coordinate_sphere_path_lt N hSU |
| 152 | (h0 i) (h1 i) (hgamma i) (hlength i) |
| 153 | have hright : gU.edist (x j) center < ENNReal.ofReal B := by |
| 154 | rw [intrinsicOpenMetric_edist] |
| 155 | change intrinsicEDist g (U : Set M) (x j : M) (N.coordinate_map (z i, 0)) < _ |
| 156 | rw [← hq j, heq] |
| 157 | exact intrinsicEDist_coordinate_sphere_path_lt N hSU |
| 158 | (h0 j) (h1 j) (hgamma j) (hlength j) |
| 159 | have htriangle : gU.edist (x i) (x j) ≤ |
| 160 | gU.edist (x i) center + gU.edist (x j) center := by |
| 161 | have hcomm : gU.edist center (x j) = gU.edist (x j) center := |
| 162 | Manifold.riemannianEDist_comm |
| 163 | simpa only [hcomm] using |
| 164 | (show gU.edist (x i) (x j) ≤ gU.edist (x i) center + gU.edist center (x j) from |
| 165 | Manifold.riemannianEDist_triangle) |
| 166 | refine ⟨i, j, hij, ?_⟩ |
| 167 | have hsum := htriangle.trans_lt (ENNReal.add_lt_add hleft hright) |
| 168 | rw [← ENNReal.ofReal_add hB hB] at hsum |
| 169 | apply hsum.trans_le |
| 170 | apply ENNReal.ofReal_le_ofReal |
| 171 | have hpos : 0 < eta * N.scale := mul_pos heta N.scale_pos |
| 172 | dsimp only [B, tau] |
| 173 | nlinarith only [hpos] |
| 174 | |
| 175 | end PoincareMT.M28 |