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.Harnack.Basic |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.CompactRadial |
| 3 | import Mathlib.Topology.Order.IntermediateValue |
| 4 | |
| 5 | /-! |
| 6 | # Compact balls for the selected complete Riemannian metric |
| 7 | |
| 8 | The metric conversion preserves the original topology and the exact |
| 9 | Riemannian uniformity. Short C1 paths supply approximate radial projection; |
| 10 | the complete locally compact argument then gives compact ball closures. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.ReducedLength |
| 20 | |
| 21 | theorem connected_edist_ne_top {X : Type*} [EMetricSpace X] [ConnectedSpace X] |
| 22 | (x y : X) : edist x y ≠ ⊤ := by |
| 23 | have hball : Metric.eball x ⊤ = Set.univ := |
| 24 | IsClopen.eq_univ ⟨Metric.isClosed_eball_top, Metric.isOpen_eball⟩ |
| 25 | ⟨x, Metric.mem_eball_self (by simp)⟩ |
| 26 | have hy : y ∈ Metric.eball x ⊤ := by rw [hball]; trivial |
| 27 | apply ne_of_lt |
| 28 | simpa only [Metric.mem_eball, edist_comm] using hy |
| 29 | |
| 30 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 31 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 32 | [IsManifold (𝓡 n) ∞ M] [T3Space M] [ConnectedSpace M] |
| 33 | |
| 34 | @[reducible] noncomputable def selectedMetricSpace (g : RiemannianMetric n M) : MetricSpace M := |
| 35 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 36 | ⟨g.toRiemannianMetric⟩ |
| 37 | letI : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 38 | (TangentSpace (𝓡 n) : M → Type _) := |
| 39 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ ↦ rfl⟩⟩ |
| 40 | letI : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 n) M |
| 41 | EMetricSpace.toMetricSpace connected_edist_ne_top |
| 42 | |
| 43 | theorem selectedMetricSpace_edist (g : RiemannianMetric n M) (x y : M) : |
| 44 | letI : MetricSpace M := selectedMetricSpace g |
| 45 | edist x y = g.edist x y := rfl |
| 46 | |
| 47 | theorem selectedMetricSpace_complete (g : RiemannianMetric n M) (hcomplete : MetricComplete g) : |
| 48 | letI : MetricSpace M := selectedMetricSpace g |
| 49 | CompleteSpace M := hcomplete |
| 50 | |
| 51 | theorem selectedMetricSpace_radial_projection (g : RiemannianMetric n M) : |
| 52 | letI : MetricSpace M := selectedMetricSpace g |
| 53 | ∀ (x : M) (R r ε : ℝ), 0 ≤ r → r ≤ R → 0 < ε → |
| 54 | Metric.closedBall x R ⊆ Metric.thickening (R - r + ε) (Metric.closedBall x r) := by |
| 55 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 56 | ⟨g.toRiemannianMetric⟩ |
| 57 | letI : MetricSpace M := selectedMetricSpace g |
| 58 | have hed (a b : M) : Manifold.riemannianEDist (𝓡 n) a b = ENNReal.ofReal (dist a b) := |
| 59 | edist_dist a b |
| 60 | intro x R r ε hr hrR hε y hy |
| 61 | have hδ : 0 < R - r + ε := by linarith |
| 62 | by_cases hsmall : dist x y ≤ r |
| 63 | · apply Metric.mem_thickening_iff.mpr |
| 64 | refine ⟨y, ?_, ?_⟩ |
| 65 | · simpa only [Metric.mem_closedBall, dist_comm] using hsmall |
| 66 | · simpa only [dist_self] using hδ |
| 67 | have hrxy : r < dist x y := lt_of_not_ge hsmall |
| 68 | have hshort : Manifold.riemannianEDist (𝓡 n) x y < |
| 69 | ENNReal.ofReal (dist x y + ε) := by |
| 70 | rw [hed] |
| 71 | exact (ENNReal.ofReal_lt_ofReal_iff (by linarith [dist_nonneg (x := x) (y := y)])).mpr |
| 72 | (by linarith) |
| 73 | obtain ⟨γ, hγ0, hγ1, hγ, hlength⟩ := Manifold.exists_lt_of_riemannianEDist_lt hshort |
| 74 | have hcont : ContinuousOn (fun t ↦ dist x (γ t)) (Set.Icc 0 1) := |
| 75 | continuous_dist.comp_continuousOn (continuousOn_const.prodMk hγ.continuousOn) |
| 76 | have hrange : r ∈ Set.Icc (dist x (γ 0)) (dist x (γ 1)) := by |
| 77 | simpa only [Set.mem_Icc, hγ0, hγ1, dist_self] using And.intro hr hrxy.le |
| 78 | obtain ⟨s, hs, hdist⟩ := intermediate_value_Icc zero_le_one hcont hrange |
| 79 | change dist x (γ s) = r at hdist |
| 80 | have hp := Manifold.riemannianEDist_le_pathELength |
| 81 | (hγ.mono (Set.Icc_subset_Icc le_rfl hs.2)) hγ0 rfl hs.1 |
| 82 | have htail := Manifold.riemannianEDist_le_pathELength |
| 83 | (hγ.mono (Set.Icc_subset_Icc hs.1 le_rfl)) rfl hγ1 hs.2 |
| 84 | rw [hed, hdist] at hp |
| 85 | rw [hed] at htail |
| 86 | have hsum : ENNReal.ofReal (r + dist (γ s) y) < ENNReal.ofReal (dist x y + ε) := by |
| 87 | rw [ENNReal.ofReal_add hr dist_nonneg] |
| 88 | exact (add_le_add hp htail).trans_lt |
| 89 | ((Manifold.pathELength_add hs.1 hs.2).trans_lt hlength) |
| 90 | have hsum' : r + dist (γ s) y < dist x y + ε := |
| 91 | (ENNReal.ofReal_lt_ofReal_iff (by linarith [dist_nonneg (x := x) (y := y)])).mp hsum |
| 92 | apply Metric.mem_thickening_iff.mpr |
| 93 | refine ⟨γ s, ?_, ?_⟩ |
| 94 | · change dist (γ s) x ≤ r |
| 95 | rw [dist_comm, hdist] |
| 96 | · have hy' : dist x y ≤ R := by simpa only [Metric.mem_closedBall, dist_comm] using hy |
| 97 | rw [dist_comm] |
| 98 | linarith |
| 99 | |
| 100 | theorem selectedMetricSpace_proper (g : RiemannianMetric n M) (hcomplete : MetricComplete g) : |
| 101 | letI : MetricSpace M := selectedMetricSpace g |
| 102 | ProperSpace M := by |
| 103 | letI : MetricSpace M := selectedMetricSpace g |
| 104 | letI : CompleteSpace M := selectedMetricSpace_complete g hcomplete |
| 105 | letI : LocallyCompactSpace M := ChartedSpace.locallyCompactSpace (EuclideanSpace ℝ (Fin n)) M |
| 106 | exact properSpace_of_approximate_radial_projection (selectedMetricSpace_radial_projection g) |
| 107 | |
| 108 | theorem isCompact_closure_metric_ball (g : RiemannianMetric n M) |
| 109 | (hcomplete : MetricComplete g) (p : M) (r : ℝ) : IsCompact (closure (g.ball p r)) := by |
| 110 | letI : MetricSpace M := selectedMetricSpace g |
| 111 | letI : ProperSpace M := selectedMetricSpace_proper g hcomplete |
| 112 | have hball : g.ball p r = Metric.ball p r := by |
| 113 | have he : g.ball p r = Metric.eball p (ENNReal.ofReal r) := by |
| 114 | ext y |
| 115 | change g.edist p y < ENNReal.ofReal r ↔ edist y p < ENNReal.ofReal r |
| 116 | rw [← selectedMetricSpace_edist g p y, edist_comm] |
| 117 | exact he.trans Metric.eball_ofReal |
| 118 | rw [hball] |
| 119 | exact (isCompact_closedBall p r).of_isClosed_subset isClosed_closure |
| 120 | Metric.closure_ball_subset_closedBall |
| 121 | |
| 122 | end PoincareMT.ReducedLength |