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.ReducedGeometry.LGeometry.Path.PathLengthReparameterization |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Path.PathEnergy |
| 3 | import Mathlib.Topology.MetricSpace.ProperSpace |
| 4 | |
| 5 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/CompleteMetricBalls.lean` at |
| 6 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 7 | |
| 8 | |
| 9 | set_option autoImplicit false |
| 10 | set_option backward.isDefEq.respectTransparency false |
| 11 | |
| 12 | noncomputable section |
| 13 | |
| 14 | open Set Filter Topology MeasureTheory |
| 15 | open scoped Manifold ContDiff Bundle intervalIntegral ENNReal |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.LGeometry |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 23 | [ConnectedSpace M] [T3Space M] |
| 24 | |
| 25 | theorem exists_reference_lipschitz_path (g : RiemannianMetric n M) (x y : M) |
| 26 | (R : ℝ) (hR : 0 ≤ R) : |
| 27 | letI : MetricSpace M := referenceMetricSpace g |
| 28 | dist x y ≤ R → ∃ β : Icc (0 : ℝ) 1 → M, |
| 29 | β ⟨0, le_rfl, zero_le_one⟩ = x ∧ β ⟨1, zero_le_one, le_rfl⟩ = y ∧ |
| 30 | ∀ s t, dist (β s) (β t) ≤ (R + 2) * dist s t := by |
| 31 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 32 | ⟨g.toRiemannianMetric⟩ |
| 33 | letI : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 34 | (TangentSpace (𝓡 n) : M → Type _) := |
| 35 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ ↦ rfl⟩⟩ |
| 36 | letI : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 n) M |
| 37 | letI : MetricSpace M := EMetricSpace.toMetricSpace (finiteEdistMetric g) |
| 38 | intro hxy |
| 39 | have hed : Manifold.riemannianEDist (𝓡 n) x y < ENNReal.ofReal (R + 1) := by |
| 40 | change edist x y < ENNReal.ofReal (R + 1) |
| 41 | rw [edist_dist, ENNReal.ofReal_lt_ofReal_iff (by linarith : 0 < R + 1)] |
| 42 | linarith |
| 43 | obtain ⟨α, hα0, hα1, hα, hlen, _, _⟩ := |
| 44 | Manifold.exists_lt_locally_constant_of_riemannianEDist_lt hed |
| 45 | (zero_lt_one : (0 : ℝ) < 1) |
| 46 | let v := fun r ↦ Real.sqrt (referenceSpeedSq g α r) |
| 47 | have hv : Continuous v := Real.continuous_sqrt.comp |
| 48 | (continuousOn_univ.mp (referenceSpeedSq_continuousOn g isOpen_univ hα.contMDiffOn)) |
| 49 | have hn (r : ℝ) : 0 ≤ v r := Real.sqrt_nonneg _ |
| 50 | have hlength (s t : ℝ) (hst : s ≤ t) : |
| 51 | Manifold.pathELength (𝓡 n) α s t = ENNReal.ofReal (∫ r in s..t, v r) := by |
| 52 | rw [Manifold.pathELength_eq_lintegral_mfderiv_Icc, |
| 53 | intervalIntegral.integral_of_le hst, ← integral_Icc_eq_integral_Ioc, |
| 54 | ofReal_integral_eq_lintegral_ofReal hv.continuousOn.integrableOn_Icc |
| 55 | (ae_of_all _ hn)] |
| 56 | apply lintegral_congr |
| 57 | intro r |
| 58 | rw [← ofReal_norm, norm_eq_sqrt_real_inner] |
| 59 | rfl |
| 60 | have hinc (s : ℝ) (_hs : s ∈ Icc 0 1) (t : ℝ) (_ht : t ∈ Icc 0 1) (hst : s ≤ t) : |
| 61 | dist (α s) (α t) ≤ ∫ r in s..t, v r := by |
| 62 | apply (edist_le_ofReal (intervalIntegral.integral_nonneg_of_forall hst hn)).mp |
| 63 | change Manifold.riemannianEDist (𝓡 n) (α s) (α t) ≤ _ |
| 64 | rw [← hlength s t hst] |
| 65 | exact Manifold.riemannianEDist_le_pathELength hα.contMDiffOn rfl rfl hst |
| 66 | have hL : (∫ r in (0 : ℝ)..1, v r) < R + 1 := by |
| 67 | rw [hlength 0 1 zero_le_one, |
| 68 | ENNReal.ofReal_lt_ofReal_iff (by linarith : 0 < R + 1)] at hlen |
| 69 | exact hlen |
| 70 | obtain ⟨β, hβ0, hβ1, hβ⟩ := exists_lipschitz_length_reparameterization α v |
| 71 | hv.continuousOn (fun r _ ↦ hn r) hinc |
| 72 | refine ⟨β, hβ0.trans hα0, hβ1.trans hα1, ?_⟩ |
| 73 | intro s t |
| 74 | exact (hβ s t).trans (mul_le_mul_of_nonneg_right (by linarith) dist_nonneg) |
| 75 | |
| 76 | theorem referenceMetricSpace_proper (g : RiemannianMetric n M) (hg : MetricComplete g) : |
| 77 | letI : MetricSpace M := referenceMetricSpace g |
| 78 | ProperSpace M := by |
| 79 | letI : MetricSpace M := referenceMetricSpace g |
| 80 | letI : CompleteSpace M := referenceMetricSpace_complete g hg |
| 81 | letI : LocallyCompactSpace M := Manifold.locallyCompact_of_finiteDimensional (M := M) (𝓡 n) |
| 82 | refine ⟨fun x R ↦ ?_⟩ |
| 83 | by_cases hR : 0 ≤ R |
| 84 | · have hpaths (y : Metric.closedBall x R) : ∃ β : Icc (0 : ℝ) 1 → M, |
| 85 | β ⟨0, le_rfl, zero_le_one⟩ = x ∧ β ⟨1, zero_le_one, le_rfl⟩ = y ∧ |
| 86 | ∀ s t, dist (β s) (β t) ≤ (R + 2) * dist s t := |
| 87 | exists_reference_lipschitz_path g x y R hR (by |
| 88 | simpa only [Metric.mem_closedBall, dist_comm] using y.2) |
| 89 | choose f hleft hright hbound using hpaths |
| 90 | have hf : Equicontinuous f := by |
| 91 | apply UniformEquicontinuous.equicontinuous |
| 92 | apply Metric.uniformEquicontinuous_of_continuity_modulus (fun r ↦ (R + 2) * r) |
| 93 | _ f (fun s t y ↦ hbound y s t) |
| 94 | simpa only [mul_zero, id_eq] using (tendsto_const_nhds.mul (tendsto_id : Tendsto (fun r : ℝ ↦ r) (𝓝 0) (𝓝 0))) |
| 95 | letI : PreconnectedSpace (Icc (0 : ℝ) 1) := |
| 96 | isPreconnected_iff_preconnectedSpace.mp isPreconnected_Icc |
| 97 | obtain ⟨K, hK, hKf⟩ := exists_compact_range_of_anchored f hf |
| 98 | ⟨0, le_rfl, zero_le_one⟩ x hleft |
| 99 | apply hK.of_isClosed_subset Metric.isClosed_closedBall |
| 100 | intro y hy |
| 101 | have h := hKf ⟨y, hy⟩ ⟨1, zero_le_one, le_rfl⟩ |
| 102 | rwa [hright] at h |
| 103 | · rw [Metric.closedBall_of_neg (lt_of_not_ge hR)] |
| 104 | exact isCompact_empty |
| 105 | |
| 106 | theorem isCompact_closure_referenceBall (g : RiemannianMetric n M) (hg : MetricComplete g) |
| 107 | (x : M) {r : ℝ} (hr : 0 < r) : IsCompact (closure (g.ball x r)) := by |
| 108 | letI : MetricSpace M := referenceMetricSpace g |
| 109 | letI : ProperSpace M := referenceMetricSpace_proper g hg |
| 110 | apply (isCompact_closedBall x r).of_isClosed_subset isClosed_closure |
| 111 | apply closure_minimal _ Metric.isClosed_closedBall |
| 112 | intro y hy |
| 113 | change g.edist x y < ENNReal.ofReal r at hy |
| 114 | change edist x y < ENNReal.ofReal r at hy |
| 115 | rw [edist_dist, ENNReal.ofReal_lt_ofReal_iff hr] at hy |
| 116 | exact Metric.mem_closedBall.mpr (by simpa only [dist_comm] using hy.le) |
| 117 | |
| 118 | end PoincareMT.LGeometry |