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.ReducedLength.Calculus.VelocityRestriction |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.GeometricChartEquation |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Action.CoordinateEnergy |
| 4 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 5 | |
| 6 | /-! |
| 7 | # Intrinsic energy differentiation for a regularized geodesic |
| 8 | |
| 9 | Each included point has a smooth coordinate neighborhood. The equation |
| 10 | restricts there, while the energy agrees on the ambient neighborhood; |
| 11 | this distinction retains a genuine derivative at interval endpoints. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option maxSynthPendingDepth 3 |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedLength |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 25 | [IsManifold (𝓡 n) ∞ M] |
| 26 | |
| 27 | local notation "V" => EuclideanSpace ℝ (Fin n) |
| 28 | |
| 29 | noncomputable def regularizedCurveEnergy {J : Set ℝ} (F : RicciFlow n M J) |
| 30 | (T : ℝ) (γ : ℝ → M) (s : ℝ) : ℝ := |
| 31 | (F.metric (T - s ^ 2)).inner (γ s) (curveVelocity γ s) (curveVelocity γ s) |
| 32 | |
| 33 | set_option backward.isDefEq.respectTransparency false in |
| 34 | theorem regularizedCurveEnergy_hasDerivAt {J : Set ℝ} (F : RicciFlow n M J) |
| 35 | (hM04 : RicciFlowCurvatureTheory.{u}) (T b : ℝ) (hb : 0 < b) |
| 36 | (hwindow : Set.Icc (T - b) T ⊆ J) |
| 37 | (γ : ℝ → M) (U I : Set ℝ) (hU : IsOpen U) (hIU : I ⊆ U) |
| 38 | (hI : UniqueDiffOn ℝ I) (hγ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ γ U) |
| 39 | (E : ParametricAlongCurveExtensionOn (n := n) I γ (curveVelocityWithin (n := n) γ I)) |
| 40 | (s : ℝ) (hs : s ∈ I) (htime : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 41 | (heq : regularizedLGeodesicEquation F T γ I E s) : |
| 42 | HasDerivAt (regularizedCurveEnergy F T γ) |
| 43 | (4 * s ^ 2 * mvfderiv (𝓡 n) (F.connection (T - s ^ 2)).scalarCurvature |
| 44 | (γ s) (curveVelocity γ s) - |
| 45 | 4 * s * (F.connection (T - s ^ 2)).ricci (γ s) |
| 46 | (curveVelocity γ s) (curveVelocity γ s)) s := by |
| 47 | let p := γ s |
| 48 | let e := chartAt V p |
| 49 | let S := U ∩ γ ⁻¹' e.source |
| 50 | have hS : IsOpen S := hγ.continuousOn.isOpen_inter_preimage hU e.open_source |
| 51 | have hsS : s ∈ S := ⟨hIU hs, mem_chart_source V p⟩ |
| 52 | let a : ℝ → V := fun r ↦ e (γ r) |
| 53 | let v : ℝ → V := deriv a |
| 54 | have hgd : ∀ r ∈ U, MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) γ r := |
| 55 | fun r hr ↦ (hγ.contMDiffAt (hU.mem_nhds hr)).mdifferentiableAt (by simp) |
| 56 | have hasmooth : ContDiffOn ℝ ∞ a S := by |
| 57 | have h : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ a S := |
| 58 | contMDiffOn_chart.comp (hγ.mono Set.inter_subset_left) (fun r hr ↦ hr.2) |
| 59 | exact h.contDiffOn |
| 60 | have hvsmooth : ContDiffOn ℝ ∞ v S := hasmooth.deriv_of_isOpen hS (by simp) |
| 61 | have had : ∀ r ∈ S, HasDerivAt a (v r) r := |
| 62 | fun r hr ↦ ((hasmooth.contDiffAt (hS.mem_nhds hr)).differentiableAt (by simp)).hasDerivAt |
| 63 | let K := I ∩ S |
| 64 | have hKI : K ⊆ I := Set.inter_subset_left |
| 65 | have hKS : K ⊆ S := Set.inter_subset_right |
| 66 | have hK : UniqueDiffOn ℝ K := hI.inter hS |
| 67 | have hsK : s ∈ K := ⟨hs, hsS⟩ |
| 68 | have hgdI : ∀ r ∈ I, MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) γ r := |
| 69 | fun r hr ↦ hgd r (hIU hr) |
| 70 | let EK := restrictVelocityExtension γ I K hKI hI hK hgdI E |
| 71 | have heK : regularizedLGeodesicEquation F T γ K EK s := |
| 72 | regularizedEquation_restrict F T γ I K hKI hI hK hgdI E s hsK heq |
| 73 | have hvd : HasDerivAt v (deriv v s) s := |
| 74 | ((hvsmooth.contDiffAt (hS.mem_nhds hsS)).differentiableAt (by simp)).hasDerivAt |
| 75 | have hw := (regularizedEquation_iff_coordinate_acceleration F hM04 T b hb hwindow |
| 76 | p γ v S K hS hKS hK hvsmooth (fun r hr ↦ hgdI r hr.1) |
| 77 | (fun r hr ↦ had r hr.2) (fun r hr ↦ hr.2.2) EK s hsK htime _ hvd).mp heK |
| 78 | have hode : HasDerivAt v |
| 79 | (regularizedCoordinatePhase (squareChartMetric F T p) (squareChartScalar F T p) |
| 80 | (s, (a s, v s))).2 s := hvd.congr_deriv hw |
| 81 | have hleft (r : ℝ) (hr : r ∈ S) : e.symm (a r) = γ r := e.left_inv hr.2 |
| 82 | have hvel (r : ℝ) (hr : r ∈ S) : |
| 83 | (mfderiv (𝓡 n) (𝓡 n) e.symm (a r) (v r) : V) = |
| 84 | (curveVelocity γ r : V) := by |
| 85 | have hc := chartVectorField_at_inverse p (v r) (a r) (e.map_source hr.2) |
| 86 | have hbase : (chartVectorField p (v r) (e.symm (a r)) : V) = |
| 87 | (chartVectorField p (v r) (γ r) : V) := |
| 88 | congrArg (fun q ↦ (chartVectorField p (v r) q : V)) (hleft r hr) |
| 89 | exact hc.symm.trans (hbase.trans |
| 90 | (chartVectorField_coordinate_velocity p γ r (v r) hr.2 (hgd r hr.1) (had r hr))) |
| 91 | have henergy : regularizedCurveEnergy F T γ =ᶠ[𝓝 s] |
| 92 | (fun r ↦ squareChartMetric F T p (r, a r) (v r) (v r)) := by |
| 93 | filter_upwards [hS.mem_nhds hsS] with r hr |
| 94 | let Q : M → V → ℝ := fun q z ↦ (F.metric (T - r ^ 2)).inner q z z |
| 95 | change Q (γ r) (curveVelocity γ r) = Q (e.symm (a r)) |
| 96 | (mfderiv (𝓡 n) (𝓡 n) e.symm (a r) (v r)) |
| 97 | exact (congrArg₂ Q (hleft r hr) (hvel r hr)).symm |
| 98 | have hd := squareChartEnergy_hasDerivAt F hM04 T b hb hwindow p a v s htime |
| 99 | (e.map_source hsS.2) (had s hsS) hode |
| 100 | have hd' := hd.congr_of_eventuallyEq henergy |
| 101 | apply hd'.congr_deriv |
| 102 | let Q : M → V → ℝ := fun q z ↦ |
| 103 | 4 * s ^ 2 * mvfderiv (𝓡 n) (F.connection (T - s ^ 2)).scalarCurvature q z - |
| 104 | 4 * s * (F.connection (T - s ^ 2)).ricci q z z |
| 105 | exact congrArg₂ Q (hleft s hsS) (hvel s hsS) |
| 106 | |
| 107 | end PoincareMT.ReducedLength |