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.SquareEnergy |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Path.MetricCompactness |
| 3 | import Mathlib.MeasureTheory.Function.L2Space |
| 4 | import Mathlib.Topology.MetricSpace.Equicontinuity |
| 5 | |
| 6 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/PathEnergy.lean` at |
| 7 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 8 | |
| 9 | |
| 10 | /-! |
| 11 | # The common modulus of finite-energy paths |
| 12 | |
| 13 | The estimate is proved on interior subintervals and extended by continuity. |
| 14 | No endpoint derivative is required. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open scoped Manifold ContDiff Bundle intervalIntegral Topology ENNReal |
| 21 | open MeasureTheory Set Filter |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.LGeometry |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 29 | [IsManifold (𝓡 n) ∞ M] [ConnectedSpace M] [T3Space M] |
| 30 | |
| 31 | noncomputable abbrev referenceMetricSpace (g : RiemannianMetric n M) : MetricSpace M := |
| 32 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 33 | ⟨g.toRiemannianMetric⟩ |
| 34 | letI : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 35 | (TangentSpace (𝓡 n) : M → Type _) := |
| 36 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ ↦ rfl⟩⟩ |
| 37 | letI : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 n) M |
| 38 | EMetricSpace.toMetricSpace (finiteEdistMetric g) |
| 39 | |
| 40 | theorem referenceMetricSpace_complete (g : RiemannianMetric n M) |
| 41 | (hg : MetricComplete g) : |
| 42 | letI : MetricSpace M := referenceMetricSpace g |
| 43 | CompleteSpace M := by |
| 44 | exact hg |
| 45 | |
| 46 | private theorem sqrt_integral_bound {q : ℝ → ℝ} {s t : ℝ} |
| 47 | (hst : s ≤ t) (hq : ContinuousOn q (Icc s t)) (hnonneg : ∀ r, 0 ≤ q r) : |
| 48 | (∫ r in Icc s t, Real.sqrt (q r)) ≤ |
| 49 | Real.sqrt (∫ r in s..t, q r) * Real.sqrt (t - s) := by |
| 50 | have hsq : MemLp (fun r ↦ Real.sqrt (q r)) 2 (volume.restrict (Icc s t)) := by |
| 51 | apply (memLp_two_iff_integrable_sq |
| 52 | ((Real.continuous_sqrt.comp_continuousOn hq).aestronglyMeasurable |
| 53 | measurableSet_Icc)).mpr |
| 54 | simpa only [Function.comp_apply, Real.sq_sqrt (hnonneg _)] using |
| 55 | (show Integrable (fun r ↦ q r) (volume.restrict (Icc s t)) from hq.integrableOn_Icc) |
| 56 | have h := integral_mul_le_Lp_mul_Lq_of_nonneg Real.HolderConjugate.two_two |
| 57 | (ae_of_all _ (fun r ↦ Real.sqrt_nonneg (q r))) |
| 58 | (ae_of_all _ (fun _ ↦ (zero_le_one : (0 : ℝ) ≤ 1))) |
| 59 | (by simpa using hsq) (memLp_const (1 : ℝ)) |
| 60 | simpa only [mul_one, Real.rpow_two, Real.sq_sqrt (hnonneg _), one_pow, |
| 61 | ← Real.sqrt_eq_rpow, setIntegral_const, smul_eq_mul, mul_one, |
| 62 | Real.volume_real_Icc_of_le hst, integral_Icc_eq_integral_Ioc, |
| 63 | ← intervalIntegral.integral_of_le hst] using h |
| 64 | |
| 65 | /-- A reference energy bound controls all increments, including endpoint increments. -/ |
| 66 | theorem dist_le_sqrt_energy (g : RiemannianMetric n M) {α : ℝ → M} |
| 67 | {a b C : ℝ} (hab : a < b) (hα : ContinuousOn α (Icc a b)) |
| 68 | (hreg : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) 1 α (Ioo a b)) |
| 69 | (hE : IntervalIntegrable (referenceSpeedSq g α) volume a b) |
| 70 | (hbound : (∫ r in a..b, referenceSpeedSq g α r) ≤ C) : |
| 71 | letI : MetricSpace M := referenceMetricSpace g |
| 72 | ∀ s ∈ Icc a b, ∀ t ∈ Icc a b, |
| 73 | dist (α s) (α t) ≤ Real.sqrt C * Real.sqrt |t - s| := by |
| 74 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 75 | ⟨g.toRiemannianMetric⟩ |
| 76 | letI : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 77 | (TangentSpace (𝓡 n) : M → Type _) := |
| 78 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ ↦ rfl⟩⟩ |
| 79 | letI : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 n) M |
| 80 | letI : MetricSpace M := EMetricSpace.toMetricSpace (finiteEdistMetric g) |
| 81 | have hordered (s t : ℝ) (hs : s ∈ Ioo a b) (ht : t ∈ Ioo a b) (hst : s ≤ t) : |
| 82 | dist (α s) (α t) ≤ Real.sqrt C * Real.sqrt (t - s) := by |
| 83 | have hsub : Icc s t ⊆ Ioo a b := Icc_subset_Ioo hs.1 ht.2 |
| 84 | have hq := (referenceSpeedSq_continuousOn g isOpen_Ioo hreg).mono hsub |
| 85 | have hsqrt : ContinuousOn (fun r ↦ Real.sqrt (referenceSpeedSq g α r)) (Icc s t) := |
| 86 | Real.continuous_sqrt.comp_continuousOn hq |
| 87 | have hlength : Manifold.pathELength (𝓡 n) α s t = |
| 88 | ENNReal.ofReal (∫ r in Icc s t, Real.sqrt (referenceSpeedSq g α r)) := by |
| 89 | rw [Manifold.pathELength_eq_lintegral_mfderiv_Icc, |
| 90 | ofReal_integral_eq_lintegral_ofReal hsqrt.integrableOn_Icc |
| 91 | (ae_of_all _ (fun r ↦ Real.sqrt_nonneg _))] |
| 92 | apply lintegral_congr |
| 93 | intro r |
| 94 | rw [← ofReal_norm, norm_eq_sqrt_real_inner] |
| 95 | rfl |
| 96 | have hdist : dist (α s) (α t) ≤ |
| 97 | ∫ r in Icc s t, Real.sqrt (referenceSpeedSq g α r) := by |
| 98 | apply (edist_le_ofReal (integral_nonneg (fun r ↦ Real.sqrt_nonneg _))).mp |
| 99 | change Manifold.riemannianEDist (𝓡 n) (α s) (α t) ≤ _ |
| 100 | rw [← hlength] |
| 101 | exact Manifold.riemannianEDist_le_pathELength (hreg.mono hsub) rfl rfl hst |
| 102 | have hpart : (∫ r in s..t, referenceSpeedSq g α r) ≤ C := |
| 103 | (intervalIntegral.integral_mono_interval hs.1.le hst ht.2.le |
| 104 | (ae_of_all _ (referenceSpeedSq_nonneg g α)) hE).trans hbound |
| 105 | exact hdist.trans ((sqrt_integral_bound hst hq (referenceSpeedSq_nonneg g α)).trans |
| 106 | (mul_le_mul_of_nonneg_right (Real.sqrt_le_sqrt hpart) (Real.sqrt_nonneg _))) |
| 107 | have hopen (s : ℝ) (hs : s ∈ Ioo a b) (t : ℝ) (ht : t ∈ Ioo a b) : |
| 108 | dist (α s) (α t) ≤ Real.sqrt C * Real.sqrt |t - s| := by |
| 109 | rcases le_total s t with hst | hts |
| 110 | · simpa only [abs_of_nonneg (sub_nonneg.mpr hst)] using hordered s t hs ht hst |
| 111 | · simpa only [dist_comm, abs_sub_comm, abs_of_nonneg (sub_nonneg.mpr hts)] using |
| 112 | hordered t s ht hs hts |
| 113 | have hleft (s : ℝ) (hs : s ∈ Icc a b) (t : ℝ) (ht : t ∈ Ioo a b) : |
| 114 | dist (α s) (α t) ≤ Real.sqrt C * Real.sqrt |t - s| := by |
| 115 | apply le_on_closure (fun r hr ↦ hopen r hr t ht) |
| 116 | · simpa only [closure_Ioo hab.ne, Function.comp_def] using |
| 117 | continuous_dist.comp_continuousOn (hα.prodMk continuousOn_const) |
| 118 | · exact (continuous_const.mul |
| 119 | (Real.continuous_sqrt.comp (continuous_const.sub continuous_id).abs)).continuousOn |
| 120 | · simpa only [closure_Ioo hab.ne] using hs |
| 121 | intro s hs t ht |
| 122 | apply le_on_closure (fun r hr ↦ hleft s hs r hr) |
| 123 | · simpa only [closure_Ioo hab.ne, Function.comp_def] using |
| 124 | continuous_dist.comp_continuousOn (continuousOn_const.prodMk hα) |
| 125 | · exact (continuous_const.mul |
| 126 | (Real.continuous_sqrt.comp (continuous_id.sub continuous_const).abs)).continuousOn |
| 127 | · simpa only [closure_Ioo hab.ne] using ht |
| 128 | |
| 129 | end PoincareMT.LGeometry |