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.IntrinsicGeometry.IntrinsicOpenMetric |
| 3 | import PoincareLib.Geometry.Riemannian.Distance.MinimizingGeodesic |
| 4 | |
| 5 | /-! |
| 6 | # Actual local minimizing paths inside an open region |
| 7 | |
| 8 | For the Claim 10.3 compact-confinement argument, small ambient balls have |
| 9 | compact closure inside the selected open region. Near their centers, short |
| 10 | ambient competitors stay in the region, so ambient and region distances |
| 11 | agree. The lower M07 theorem then constructs actual local minimizing paths |
| 12 | whose lengths equal the frozen region distance. No global ball is assumed. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Topology ENNReal Bundle |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.M28 |
| 24 | |
| 25 | variable {M : Type u} [TopologicalSpace M] [T2Space M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 27 | [IsManifold (𝓡 3) ∞ M] |
| 28 | |
| 29 | /-- Local compactness and the actual Riemannian topology produce a compact |
| 30 | ball closure inside any prescribed open neighborhood. -/ |
| 31 | theorem exists_precompact_ball_subset_open (g : RiemannianMetric 3 M) |
| 32 | {U : Set M} (hU : IsOpen U) {x : M} (hx : x ∈ U) : |
| 33 | ∃ R : ℝ, 0 < R ∧ IsCompact (closure (g.ball x R)) ∧ |
| 34 | closure (g.ball x R) ⊆ U := by |
| 35 | let : LocallyCompactSpace M := ChartedSpace.locallyCompactSpace |
| 36 | (EuclideanSpace ℝ (Fin 3)) M |
| 37 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 38 | ⟨g.toRiemannianMetric⟩ |
| 39 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin 3)) |
| 40 | (TangentSpace (𝓡 3) : M → Type _) := |
| 41 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 42 | obtain ⟨K, hK, hxK, hKU⟩ := exists_compact_subset hU hx |
| 43 | obtain ⟨c, hc, hball⟩ := setOfPred_riemannianEDist_lt_subset_nhds |
| 44 | (𝓡 3) (mem_interior_iff_mem_nhds.mp hxK) |
| 45 | have hballK : g.ball x (c : ℝ) ⊆ K := by |
| 46 | simpa only [RiemannianMetric.ball, RiemannianMetric.edist, |
| 47 | ENNReal.ofReal_coe_nnreal] using hball |
| 48 | have hclosure : closure (g.ball x (c : ℝ)) ⊆ K := |
| 49 | closure_minimal hballK hK.isClosed |
| 50 | exact ⟨c, hc, hK.of_isClosed_subset isClosed_closure hclosure, hclosure.trans hKU⟩ |
| 51 | |
| 52 | private theorem exists_intrinsic_ball_buffer (g : RiemannianMetric 3 M) |
| 53 | {U : Set M} (hU : IsOpen U) {x : M} (hx : x ∈ U) : |
| 54 | ∃ r : ℝ, 0 < r ∧ IsOpen (g.ball x r) ∧ x ∈ g.ball x r ∧ g.ball x r ⊆ U ∧ |
| 55 | (∀ y ∈ g.ball x r, IsCompact (closure (g.ball y (2 * r))) ∧ |
| 56 | g.ball y (2 * r) ⊆ U) ∧ |
| 57 | ∀ y ∈ g.ball x r, ∀ z ∈ g.ball x r, |
| 58 | intrinsicEDist g U y z = g.edist y z ∧ |
| 59 | g.edist y z < ENNReal.ofReal (2 * r) := by |
| 60 | let : LocallyCompactSpace M := ChartedSpace.locallyCompactSpace |
| 61 | (EuclideanSpace ℝ (Fin 3)) M |
| 62 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 63 | ⟨g.toRiemannianMetric⟩ |
| 64 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin 3)) |
| 65 | (TangentSpace (𝓡 3) : M → Type _) := |
| 66 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 67 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 3) M |
| 68 | obtain ⟨R, hR, hcompact, hRsub⟩ := exists_precompact_ball_subset_open g hU hx |
| 69 | let r := R / 4 |
| 70 | have hr : 0 < r := div_pos hR (by norm_num) |
| 71 | have h2r : 0 < 2 * r := by positivity |
| 72 | have h3rR : 3 * r < R := by dsimp [r]; linarith |
| 73 | have hcontain (y : M) (hy : y ∈ g.ball x r) : |
| 74 | g.ball y (2 * r) ⊆ g.ball x R := by |
| 75 | intro w hw |
| 76 | change edist x w < ENNReal.ofReal R |
| 77 | calc |
| 78 | edist x w ≤ edist x y + edist y w := edist_triangle x y w |
| 79 | _ < ENNReal.ofReal r + ENNReal.ofReal (2 * r) := ENNReal.add_lt_add hy hw |
| 80 | _ = ENNReal.ofReal (3 * r) := by |
| 81 | rw [← ENNReal.ofReal_add hr.le h2r.le] |
| 82 | congr 1 |
| 83 | ring |
| 84 | _ < ENNReal.ofReal R := (ENNReal.ofReal_lt_ofReal_iff hR).mpr h3rR |
| 85 | have hWopen : IsOpen (g.ball x r) := |
| 86 | isOpen_lt (continuous_const.edist continuous_id) continuous_const |
| 87 | have hxW : x ∈ g.ball x r := by |
| 88 | change edist x x < ENNReal.ofReal r |
| 89 | simpa only [edist_self] using ENNReal.ofReal_pos.mpr hr |
| 90 | have hWU : g.ball x r ⊆ U := by |
| 91 | intro y hy |
| 92 | apply hRsub |
| 93 | apply subset_closure |
| 94 | exact hy.trans_le (ENNReal.ofReal_le_ofReal (by dsimp [r]; linarith)) |
| 95 | refine ⟨r, hr, hWopen, hxW, hWU, ?_, ?_⟩ |
| 96 | · intro y hy |
| 97 | exact ⟨hcompact.of_isClosed_subset isClosed_closure (closure_mono (hcontain y hy)), |
| 98 | fun z hz => hRsub (subset_closure (hcontain y hy hz))⟩ |
| 99 | intro y hy z hz |
| 100 | have hdyz : g.edist y z < ENNReal.ofReal (2 * r) := by |
| 101 | have hyx : edist y x < ENNReal.ofReal r := by |
| 102 | change edist x y < ENNReal.ofReal r at hy |
| 103 | simpa only [edist_comm] using hy |
| 104 | calc |
| 105 | g.edist y z ≤ edist y x + edist x z := edist_triangle y x z |
| 106 | _ < ENNReal.ofReal r + ENNReal.ofReal r := |
| 107 | ENNReal.add_lt_add hyx hz |
| 108 | _ = ENNReal.ofReal (2 * r) := by |
| 109 | rw [← ENNReal.ofReal_add hr.le hr.le] |
| 110 | congr 1 |
| 111 | ring |
| 112 | refine ⟨?_, hdyz⟩ |
| 113 | apply le_antisymm |
| 114 | · apply le_of_forall_gt_imp_ge_of_dense |
| 115 | intro l hl |
| 116 | obtain ⟨α, hα0, hα1, hα, hαlen⟩ := |
| 117 | Manifold.exists_lt_of_riemannianEDist_lt (lt_min hl hdyz) |
| 118 | have hαball : MapsTo α (Icc (0 : ℝ) 1) (g.ball y (2 * r)) := by |
| 119 | simpa only [hα0] using g.mapsTo_ball_of_pathELength_lt hα |
| 120 | (hαlen.trans_le (min_le_right _ _)) |
| 121 | have hαU : MapsTo α (Icc (0 : ℝ) 1) U := |
| 122 | fun t ht => hRsub (subset_closure (hcontain y hy (hαball ht))) |
| 123 | have hinf := intrinsicEDist_le_pathELength g zero_le_one hα hαU |
| 124 | rw [hα0, hα1] at hinf |
| 125 | exact hinf.trans (hαlen.trans_le (min_le_left _ _)).le |
| 126 | · rw [intrinsicEDist] |
| 127 | apply le_sInf |
| 128 | rintro l ⟨α, hα, hα0, hα1, _, rfl⟩ |
| 129 | exact Manifold.riemannianEDist_le_pathELength hα hα0 hα1 zero_le_one |
| 130 | |
| 131 | /-- Ambient and frozen region distances agree on a genuine neighborhood |
| 132 | of every point of the open region. The equality follows from actual short |
| 133 | paths in a larger ball contained in the region. -/ |
| 134 | theorem exists_open_intrinsic_distance_eq (g : RiemannianMetric 3 M) |
| 135 | {U : Set M} (hU : IsOpen U) {x : M} (hx : x ∈ U) : |
| 136 | ∃ W : Set M, IsOpen W ∧ x ∈ W ∧ W ⊆ U ∧ |
| 137 | ∀ y ∈ W, ∀ z ∈ W, intrinsicEDist g U y z = g.edist y z := by |
| 138 | obtain ⟨r, _, hWopen, hxW, hWU, _, hpair⟩ := exists_intrinsic_ball_buffer g hU hx |
| 139 | exact ⟨g.ball x r, hWopen, hxW, hWU, fun y hy z hz => (hpair y hy z hz).1⟩ |
| 140 | |
| 141 | /-- Every point in the open region has a neighborhood whose pairs admit |
| 142 | actual region-valued C1 minimizing paths. The output equality is with the |
| 143 | frozen region infimum, derived from the same actual ball buffer. -/ |
| 144 | theorem exists_open_intrinsic_minimizing_paths (g : RiemannianMetric 3 M) |
| 145 | {U : Set M} (hU : IsOpen U) {x : M} (hx : x ∈ U) : |
| 146 | ∃ W : Set M, IsOpen W ∧ x ∈ W ∧ W ⊆ U ∧ |
| 147 | ∀ y ∈ W, ∀ z ∈ W, ∃ γ : ℝ → M, |
| 148 | γ 0 = y ∧ γ 1 = z ∧ |
| 149 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 γ (Icc (0 : ℝ) 1) ∧ |
| 150 | MapsTo γ (Icc (0 : ℝ) 1) U ∧ |
| 151 | g.pathELength γ 0 1 = intrinsicEDist g U y z := by |
| 152 | obtain ⟨r, hr, hWopen, hxW, hWU, hbuffer, hpair⟩ := |
| 153 | exists_intrinsic_ball_buffer g hU hx |
| 154 | refine ⟨g.ball x r, hWopen, hxW, hWU, ?_⟩ |
| 155 | intro y hy z hz |
| 156 | obtain ⟨hcompactY, hballU⟩ := hbuffer y hy |
| 157 | obtain ⟨hdist, hdyz⟩ := hpair y hy z hz |
| 158 | have h2r : 0 < 2 * r := by positivity |
| 159 | obtain ⟨delta, hdelta, γ, hgeo, hγ0, hγ1, hsegment⟩ := |
| 160 | g.exists_minimizing_geodesic_of_precompact_ball y z h2r hcompactY hdyz |
| 161 | have hI : Icc (0 : ℝ) 1 ⊆ Ioo (-delta) (1 + delta) := by |
| 162 | intro t ht |
| 163 | constructor <;> linarith [ht.1, ht.2] |
| 164 | have hγU : MapsTo γ (Icc (0 : ℝ) 1) U := by |
| 165 | intro t ht |
| 166 | apply hballU |
| 167 | have h := hsegment 0 (by norm_num) t ht |
| 168 | rw [hγ0, zero_sub, abs_neg, abs_of_nonneg ht.1] at h |
| 169 | have ht1 : ENNReal.ofReal t ≤ 1 := by |
| 170 | simpa only [ENNReal.ofReal_one] using ENNReal.ofReal_le_ofReal ht.2 |
| 171 | change g.edist y (γ t) < ENNReal.ofReal (2 * r) |
| 172 | calc |
| 173 | g.edist y (γ t) = ENNReal.ofReal t * g.edist y z := h |
| 174 | _ ≤ 1 * g.edist y z := mul_le_mul_left ht1 _ |
| 175 | _ = g.edist y z := one_mul _ |
| 176 | _ < ENNReal.ofReal (2 * r) := hdyz |
| 177 | refine ⟨γ, hγ0, hγ1, hgeo.contMDiffOn.mono hI, hγU, ?_⟩ |
| 178 | rw [hdist] |
| 179 | exact hgeo.pathELength_eq_of_edist_segment hdelta hγ0 hsegment |
| 180 | |
| 181 | end PoincareMT.M28 |