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.MFDeriv.FDeriv |
| 3 | |
| 4 | /-! |
| 5 | # Actual curve velocities under germ equality and parameter changes |
| 6 | |
| 7 | Each formula evaluates the manifold derivative at the real unit vector, so |
| 8 | the identities can be used directly by the chart perturbation producer. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option maxSynthPendingDepth 3 |
| 13 | set_option maxHeartbeats 800000 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | |
| 17 | universe u v |
| 18 | |
| 19 | namespace PoincareMT.ReducedLengthMinimum.Variation.Geometry |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 23 | [IsManifold (𝓡 n) ∞ M] |
| 24 | |
| 25 | set_option backward.isDefEq.respectTransparency false in |
| 26 | theorem curveVelocity_congr_of_eventuallyEq {γ δ : ℝ → M} {t : ℝ} |
| 27 | (heq : γ =ᶠ[nhds t] δ) : |
| 28 | (curveVelocity (n := n) γ t : EuclideanSpace ℝ (Fin n)) = curveVelocity (n := n) δ t := by |
| 29 | have hd := heq.mfderiv_eq (I := 𝓘(ℝ, ℝ)) (I' := 𝓡 n) |
| 30 | exact congrArg (fun L : ℝ →L[ℝ] EuclideanSpace ℝ (Fin n) ↦ L 1) hd |
| 31 | |
| 32 | set_option backward.isDefEq.respectTransparency false in |
| 33 | theorem curveVelocity_comp_initial_line {E : Type v} |
| 34 | [NormedAddCommGroup E] [NormedSpace ℝ E] (f : E → M) (Z W : E) |
| 35 | (hf : MDifferentiableAt (𝓘(ℝ, E)) (𝓡 n) f Z) : |
| 36 | (curveVelocity (n := n) (fun r : ℝ ↦ f (Z + r • W)) 0 : EuclideanSpace ℝ (Fin n)) = |
| 37 | mfderiv (𝓘(ℝ, E)) (𝓡 n) f Z W := by |
| 38 | have hline : HasDerivAt (fun r : ℝ ↦ Z + r • W) W 0 := by |
| 39 | have hsmul : HasDerivAt (fun r : ℝ ↦ r • W) W 0 := by |
| 40 | simpa only [id_eq, one_smul] using (hasDerivAt_id (0 : ℝ)).smul_const W |
| 41 | exact hsmul.const_add Z |
| 42 | have hvalue : (mfderiv (𝓘(ℝ, ℝ)) (𝓘(ℝ, E)) (fun r : ℝ ↦ Z + r • W) 0) 1 = W := by |
| 43 | exact (congrArg (fun L : ℝ →L[ℝ] E ↦ L 1) |
| 44 | (mfderiv_eq_fderiv (f := fun r : ℝ ↦ Z + r • W) (x := 0))).trans |
| 45 | ((congrArg (fun L : ℝ →L[ℝ] E ↦ L 1) hline.hasFDerivAt.fderiv).trans |
| 46 | (ContinuousLinearMap.toSpanSingleton_apply_one ℝ W)) |
| 47 | have hf' : MDifferentiableAt (𝓘(ℝ, E)) (𝓡 n) f (Z + (0 : ℝ) • W) := by |
| 48 | simpa only [zero_smul, add_zero] using hf |
| 49 | have hcomp := congrArg (fun L : ℝ →L[ℝ] EuclideanSpace ℝ (Fin n) ↦ L 1) |
| 50 | (mfderiv_comp (f := fun r : ℝ ↦ Z + r • W) (g := f) |
| 51 | 0 hf' hline.hasFDerivAt.hasMFDerivAt.mdifferentiableAt) |
| 52 | have hresult := hcomp.trans (congrArg |
| 53 | (fun v : E ↦ mfderiv (𝓘(ℝ, E)) (𝓡 n) f (Z + (0 : ℝ) • W) v) hvalue) |
| 54 | have hpoint := congrArg (fun L : E →L[ℝ] EuclideanSpace ℝ (Fin n) ↦ L W) |
| 55 | (mfderiv_congr_point (I := 𝓘(ℝ, E)) (I' := 𝓡 n) (f := f) |
| 56 | (show Z + (0 : ℝ) • W = Z by simp)) |
| 57 | exact hresult.trans hpoint |
| 58 | |
| 59 | set_option backward.isDefEq.respectTransparency false in |
| 60 | theorem curveVelocity_comp_square (α : ℝ → M) (s : ℝ) |
| 61 | (hα : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) α (s ^ 2)) : |
| 62 | curveVelocity (n := n) (fun r ↦ α (r ^ 2)) s = |
| 63 | (2 * s) • curveVelocity (n := n) α (s ^ 2) := by |
| 64 | have hsq : HasDerivAt (fun r : ℝ ↦ r ^ 2) (2 * s) s := by |
| 65 | simpa using hasDerivAt_pow 2 s |
| 66 | have hvalue : (mfderiv (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) (fun r : ℝ ↦ r ^ 2) s) 1 = 2 * s := by |
| 67 | exact (congrArg (fun L : ℝ →L[ℝ] ℝ ↦ L 1) |
| 68 | (mfderiv_eq_fderiv (f := fun r : ℝ ↦ r ^ 2) (x := s))).trans |
| 69 | ((congrArg (fun L : ℝ →L[ℝ] ℝ ↦ L 1) hsq.hasFDerivAt.fderiv).trans |
| 70 | (ContinuousLinearMap.toSpanSingleton_apply_one ℝ (2 * s))) |
| 71 | let L : ℝ →L[ℝ] TangentSpace (𝓡 n) (α (s ^ 2)) := |
| 72 | mfderiv (𝓘(ℝ, ℝ)) (𝓡 n) α (s ^ 2) |
| 73 | have hcomp := congrArg (fun A : ℝ →L[ℝ] TangentSpace (𝓡 n) (α (s ^ 2)) ↦ A 1) |
| 74 | (mfderiv_comp (f := fun r : ℝ ↦ r ^ 2) (g := α) |
| 75 | s hα hsq.hasFDerivAt.hasMFDerivAt.mdifferentiableAt) |
| 76 | have hlin : L (2 * s) = (2 * s) • L 1 := by |
| 77 | simpa only [smul_eq_mul, mul_one] using L.map_smul (2 * s) (1 : ℝ) |
| 78 | exact hcomp.trans ((congrArg L hvalue).trans hlin) |
| 79 | |
| 80 | end PoincareMT.ReducedLengthMinimum.Variation.Geometry |