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.Tensor.LocalCenteredHessian |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Differential.SecondDerivativeComposition |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Fields.ChartFieldDerivative |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.VelocityRestriction |
| 5 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.ChartVelocity |
| 6 | |
| 7 | /-! |
| 8 | # The fixed-slice covariant Hessian chain rule |
| 9 | |
| 10 | The arbitrary actual velocity extension determines the acceleration. |
| 11 | Its coordinate connection term cancels the frozen Hessian correction. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option maxSynthPendingDepth 3 |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | open Filter |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.ReducedLength |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 26 | [IsManifold (𝓡 n) ∞ M] |
| 27 | |
| 28 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 29 | |
| 30 | set_option maxHeartbeats 1000000 in |
| 31 | -- Both derivatives use the same centered chart and actual extension witness. |
| 32 | set_option backward.isDefEq.respectTransparency false in |
| 33 | theorem secondDeriv_comp_eq_hessian_add_acceleration {J : Set ℝ} |
| 34 | (F : RicciFlow n M J) (t0 : ℝ) (γ : ℝ → M) (I : Set ℝ) |
| 35 | (hI : IsOpen I) (hγ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ γ I) |
| 36 | (H : ParametricAlongCurveExtensionOn (n := n) I γ (curveVelocityWithin γ I)) |
| 37 | (s : ℝ) (hs : s ∈ I) (f : M → ℝ) (O : Set M) (hO : IsOpen O) |
| 38 | (hpO : γ s ∈ O) (hf : ContMDiffOn (𝓡 n) (𝓘(ℝ, ℝ)) ∞ f O) : |
| 39 | deriv (deriv (fun r ↦ f (γ r))) s = |
| 40 | (F.connection t0).hessian f (γ s) (curveVelocity γ s) (curveVelocity γ s) + |
| 41 | mvfderiv (𝓡 n) f (γ s) |
| 42 | (pullbackCovariantDerivative F (fun _ ↦ t0) γ (curveVelocityWithin γ I) I H s) := by |
| 43 | let p := γ s |
| 44 | let e := chartAt E p |
| 45 | let W := I ∩ γ ⁻¹' e.source |
| 46 | have hW : IsOpen W := hγ.continuousOn.isOpen_inter_preimage hI e.open_source |
| 47 | have hsW : s ∈ W := ⟨hs, mem_chart_source E p⟩ |
| 48 | let y : ℝ → E := fun r ↦ e (γ r) |
| 49 | have hy : ContDiffOn ℝ ∞ y W := |
| 50 | (contMDiffOn_chart.comp (hγ.mono Set.inter_subset_left) (fun r hr ↦ hr.2)).contDiffOn |
| 51 | have hdy : ContDiffOn ℝ ∞ (deriv y) W := hy.deriv_of_isOpen hW (by simp) |
| 52 | have hγd (r : ℝ) (hr : r ∈ I) : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) γ r := |
| 53 | (hγ.contMDiffAt (hI.mem_nhds hr)).mdifferentiableAt (by simp) |
| 54 | have hyd (r : ℝ) (hr : r ∈ W) : HasDerivAt y (deriv y r) r := |
| 55 | ((hy.contDiffAt (hW.mem_nhds hr)).differentiableAt (by simp)).hasDerivAt |
| 56 | have hrep : ∀ r ∈ I ∩ W, |
| 57 | chartVectorField p (deriv y r) (γ r) = curveVelocityWithin (n := n) γ I r := by |
| 58 | intro r hr |
| 59 | exact (chartVectorField_coordinate_velocity p γ r (deriv y r) hr.2.2 |
| 60 | (hγd r hr.1) (hyd r hr.2)).trans |
| 61 | (curveVelocityWithin_eq_curveVelocity γ I r (hI.uniqueDiffOn r hr.1) (hγd r hr.1)).symm |
| 62 | have hys : deriv y s = curveVelocity (n := n) γ s := by |
| 63 | have h := (hasDerivAt_chart_curve p γ s hsW.2 (hγd s hs)).deriv |
| 64 | change deriv y s = mfderiv (𝓡 n) (𝓡 n) e p (curveVelocity γ s) at h |
| 65 | rw [show e = chartAt E p from rfl, mfderiv_chartAt_self] at h |
| 66 | exact h |
| 67 | have hvel := curveVelocityWithin_eq_curveVelocity γ I s (hI.uniqueDiffOn s hs) (hγd s hs) |
| 68 | have hpull := pullbackCovariantDerivative_chart_field_local F (fun _ ↦ t0) p γ |
| 69 | (curveVelocityWithin (n := n) γ I) I W H s hs hW hsW (hI.uniqueDiffOn s hs) |
| 70 | (hγd s hs) (deriv y) hdy (fun r hr ↦ hr.2.2) hrep (deriv (deriv y) s) |
| 71 | (((hdy.contDiffAt (hW.mem_nhds hsW)).differentiableAt (by simp)).hasDerivAt) |
| 72 | rw [hvel, hys] at hpull |
| 73 | change pullbackCovariantDerivative F (fun _ ↦ t0) γ (curveVelocityWithin γ I) I H s = |
| 74 | chartVectorField p (deriv (deriv y) s) p + |
| 75 | (F.connection t0).connection (chartVectorField p (curveVelocity γ s)) p |
| 76 | (curveVelocity γ s) at hpull |
| 77 | rw [chartVectorField_self] at hpull |
| 78 | let V := e.target ∩ e.symm ⁻¹' O |
| 79 | have he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target := contMDiffOn_chart_symm |
| 80 | have hV : IsOpen V := he.continuousOn.isOpen_inter_preimage e.open_target hO |
| 81 | have hpV : e p ∈ V := ⟨e.map_source (mem_chart_source E p), by |
| 82 | change e.symm (e p) ∈ O |
| 83 | rwa [e.left_inv (mem_chart_source E p)]⟩ |
| 84 | let φ : E → ℝ := fun z ↦ f (e.symm z) |
| 85 | have hφ : ContDiffOn ℝ ∞ φ V := |
| 86 | (hf.comp (he.mono Set.inter_subset_left) (fun z hz ↦ hz.2)).contDiffOn |
| 87 | have hφat : ContDiffAt ℝ ∞ φ (e p) := hφ.contDiffAt (hV.mem_nhds hpV) |
| 88 | have heq : f =ᶠ[𝓝 p] (fun q ↦ φ (e q)) := by |
| 89 | filter_upwards [e.open_source.mem_nhds (mem_chart_source E p)] with q hq |
| 90 | exact congrArg f (e.left_inv hq).symm |
| 91 | have hfirst (v : E) : mvfderiv (𝓡 n) f p v = fderiv ℝ φ (e p) v := |
| 92 | mvfderiv_centeredChart_of_eventuallyEq p f φ |
| 93 | (hφat.differentiableAt (by simp)) heq v |
| 94 | have hDφ : DifferentiableAt ℝ (fderiv ℝ φ) (e p) := |
| 95 | (hφat.fderiv_right (m := ∞) (by simp)).differentiableAt (by simp) |
| 96 | have heval (v : E) : fderiv ℝ (fun z ↦ fderiv ℝ φ z v) (e p) v = |
| 97 | fderiv ℝ (fderiv ℝ φ) (e p) v v := by |
| 98 | simpa using congrArg (fun L : E →L[ℝ] ℝ ↦ L v) |
| 99 | (hDφ.hasFDerivAt.clm_apply (hasFDerivAt_const v (e p))).fderiv |
| 100 | have hH := hessian_centeredCoordinates_local (F.connection t0) f p O hO hpO hf |
| 101 | (curveVelocity γ s) (curveVelocity γ s) |
| 102 | change (F.connection t0).hessian f p (curveVelocity γ s) (curveVelocity γ s) = |
| 103 | fderiv ℝ (fun z ↦ fderiv ℝ φ z (curveVelocity γ s)) (e p) (curveVelocity γ s) - |
| 104 | fderiv ℝ φ (e p) ((F.connection t0).connection |
| 105 | (chartVectorField p (curveVelocity γ s)) p (curveVelocity γ s)) at hH |
| 106 | rw [heval] at hH |
| 107 | have hcurve : (fun r ↦ f (γ r)) =ᶠ[𝓝 s] (fun r ↦ φ (y r)) := by |
| 108 | filter_upwards [hW.mem_nhds hsW] with r hr |
| 109 | exact congrArg f (e.left_inv hr.2).symm |
| 110 | rw [hcurve.deriv.deriv_eq, secondDeriv_comp φ y s hφat (hy.contDiffAt (hW.mem_nhds hsW)), |
| 111 | hys, hH, hfirst, hpull, map_add] |
| 112 | ring |
| 113 | |
| 114 | end PoincareMT.ReducedLength |