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.Basic |
| 2 | import Mathlib.Geometry.Manifold.ContMDiffMFDeriv |
| 3 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus |
| 4 | |
| 5 | /-! |
| 6 | Adapted from Mapher `PoincareMT/Proofs/M10/CurveCalculus.lean` at |
| 7 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. |
| 8 | |
| 9 | # Scalar derivatives and speed along smooth manifold curves |
| 10 | |
| 11 | These identities keep the chosen Riemannian metric and the actual manifold |
| 12 | velocity. They connect the upper-support comparison with intrinsic path |
| 13 | length in the regularity argument of Morgan-Tian Proposition 7.5. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open MeasureTheory |
| 19 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.SurgeryVolume.Measure |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | {γ : ℝ → M} {s : ℝ} |
| 28 | |
| 29 | set_option backward.isDefEq.respectTransparency false in |
| 30 | omit [IsManifold (𝓡 n) ∞ M] in |
| 31 | /-- The scalar chain rule evaluates the actual spatial differential on curve velocity. -/ |
| 32 | theorem hasDerivAt_comp_curve {f : M → ℝ} |
| 33 | (hf : MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) f (γ s)) |
| 34 | (hγ : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) γ s) : |
| 35 | HasDerivAt (f ∘ γ) (mvfderiv (𝓡 n) f (γ s) (curveVelocity γ s)) s := by |
| 36 | apply (hf.comp s hγ).differentiableAt.hasDerivAt.congr_deriv |
| 37 | change (fderiv ℝ (f ∘ γ) s) 1 = _ |
| 38 | rw [← mfderiv_eq_fderiv, mfderiv_comp s hf hγ] |
| 39 | rfl |
| 40 | |
| 41 | set_option backward.isDefEq.respectTransparency false in |
| 42 | /-- A globally C1 curve has continuous speed for the specified smooth metric. -/ |
| 43 | theorem continuous_tangentNorm_curveVelocity (g : RiemannianMetric n M) |
| 44 | (hγ : ContMDiff (𝓘(ℝ, ℝ)) (𝓡 n) 1 γ) : |
| 45 | Continuous (fun t ↦ g.tangentNorm (γ t) (curveVelocity γ t)) := by |
| 46 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 47 | ⟨g.toRiemannianMetric⟩ |
| 48 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 49 | (TangentSpace (𝓡 n) : M → Type _) := |
| 50 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ ↦ rfl⟩⟩ |
| 51 | have hsection : Continuous |
| 52 | (fun t : ℝ ↦ (⟨t, (1 : ℝ)⟩ : TangentBundle (𝓘(ℝ, ℝ)) ℝ)) := |
| 53 | (tangentBundleModelSpaceHomeomorph (𝓘(ℝ, ℝ))).symm.continuous.comp |
| 54 | (continuous_id.prodMk continuous_const) |
| 55 | have hv : Continuous (fun t ↦ |
| 56 | (⟨γ t, curveVelocity γ t⟩ : TangentBundle (𝓡 n) M)) := |
| 57 | (hγ.continuous_tangentMap le_rfl).comp hsection |
| 58 | exact Real.continuous_sqrt.comp (hv.inner_bundle hv) |
| 59 | |
| 60 | set_option backward.isDefEq.respectTransparency false in |
| 61 | /-- Path length is the nonnegative real integral of the selected-metric speed. -/ |
| 62 | theorem pathELength_eq_ofReal_integral_tangentNorm (g : RiemannianMetric n M) |
| 63 | (hγ : ContMDiff (𝓘(ℝ, ℝ)) (𝓡 n) 1 γ) {a b : ℝ} (hab : a ≤ b) : |
| 64 | g.pathELength γ a b = |
| 65 | ENNReal.ofReal (∫ t in a..b, g.tangentNorm (γ t) (curveVelocity γ t)) := by |
| 66 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 67 | ⟨g.toRiemannianMetric⟩ |
| 68 | have hspeed := continuous_tangentNorm_curveVelocity g hγ |
| 69 | have hi := hspeed.continuousOn.integrableOn_compact |
| 70 | (μ := volume) (K := Set.Icc a b) isCompact_Icc |
| 71 | delta RiemannianMetric.pathELength |
| 72 | rw [Manifold.pathELength_eq_lintegral_mfderiv_Icc, |
| 73 | intervalIntegral.integral_of_le hab, ← integral_Icc_eq_integral_Ioc] |
| 74 | rw [ofReal_integral_eq_lintegral_ofReal hi (Filter.Eventually.of_forall |
| 75 | (fun _ ↦ Real.sqrt_nonneg _))] |
| 76 | apply lintegral_congr |
| 77 | intro t |
| 78 | rw [← ofReal_norm] |
| 79 | congr 1 |
| 80 | |
| 81 | end PoincareMT.SurgeryVolume.Measure |