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.Surgery.Metric.Construction.MetricCombination |
| 2 | import Mathlib.Geometry.Manifold.ContMDiffMFDeriv |
| 3 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic |
| 4 | |
| 5 | /-! |
| 6 | # Metric speed and C1 path length |
| 7 | |
| 8 | The speed of a C1 path is continuous for the displayed smooth metric. |
| 9 | Its real integral on an ordered compact interval agrees with the frozen |
| 10 | extended-length functional. These facts also apply to paths through the |
| 11 | standard cap tip. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle ENNReal |
| 17 | open MeasureTheory |
| 18 | |
| 19 | namespace PoincareMT.MetricSurgery |
| 20 | |
| 21 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 23 | |
| 24 | noncomputable def metricPathSpeed (g : RiemannianMetric n M) (gamma : ℝ → M) |
| 25 | (t : ℝ) : ℝ := |
| 26 | g.tangentNorm (gamma t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) gamma t 1) |
| 27 | |
| 28 | theorem metricPathSpeed_nonneg (g : RiemannianMetric n M) (gamma : ℝ → M) (t : ℝ) : |
| 29 | 0 ≤ metricPathSpeed g gamma t := Real.sqrt_nonneg _ |
| 30 | |
| 31 | theorem metricPathSpeed_continuous (g : RiemannianMetric n M) {gamma : ℝ → M} |
| 32 | (hgamma : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 1 gamma) : |
| 33 | Continuous (metricPathSpeed g gamma) := by |
| 34 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 35 | ⟨g.toRiemannianMetric⟩ |
| 36 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 37 | (TangentSpace (𝓡 n) : M → Type _) := |
| 38 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 39 | have hunit : ContMDiff 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ).tangent ∞ (fun t : ℝ => |
| 40 | (⟨t, (1 : ℝ)⟩ : TangentBundle 𝓘(ℝ, ℝ) ℝ)) := |
| 41 | contMDiff_vectorSpace_iff_contDiff.mpr contDiff_const |
| 42 | have hv : Continuous (fun t : ℝ => |
| 43 | (⟨gamma t, mfderiv 𝓘(ℝ, ℝ) (𝓡 n) gamma t 1⟩ : TangentBundle (𝓡 n) M)) := |
| 44 | (hgamma.continuous_tangentMap le_rfl).comp hunit.continuous |
| 45 | exact (hv.inner_bundle hv).sqrt |
| 46 | |
| 47 | theorem pathELength_eq_integral_speed (g : RiemannianMetric n M) {gamma : ℝ → M} |
| 48 | (hgamma : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 1 gamma) {a b : ℝ} (hab : a ≤ b) : |
| 49 | g.pathELength gamma a b = ENNReal.ofReal (∫ t in a..b, metricPathSpeed g gamma t) := by |
| 50 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 51 | ⟨g.toRiemannianMetric⟩ |
| 52 | change Manifold.pathELength (𝓡 n) gamma a b = _ |
| 53 | rw [Manifold.pathELength_eq_lintegral_mfderiv_Icc] |
| 54 | calc |
| 55 | _ = ∫⁻ t in Set.Icc a b, ENNReal.ofReal (metricPathSpeed g gamma t) := by |
| 56 | apply setLIntegral_congr_fun measurableSet_Icc |
| 57 | intro t _ |
| 58 | dsimp only |
| 59 | erw [← ofReal_norm, norm_eq_sqrt_real_inner] |
| 60 | rfl |
| 61 | _ = ENNReal.ofReal (∫ t in Set.Icc a b, metricPathSpeed g gamma t) := by |
| 62 | symm |
| 63 | exact ofReal_integral_eq_lintegral_ofReal |
| 64 | (metricPathSpeed_continuous g hgamma).integrableOn_Icc |
| 65 | (Filter.Eventually.of_forall (metricPathSpeed_nonneg g gamma)) |
| 66 | _ = _ := by |
| 67 | rw [intervalIntegral.integral_of_le hab, integral_Icc_eq_integral_Ioc] |
| 68 | |
| 69 | end PoincareMT.MetricSurgery |