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.CurveShortening.Comparison.Compatibility.SourceNames |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.C2.SecondDerivComposition |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Coordinate.GaugeEquation |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Embedding.HessianVector |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C2.GaugeWitnesses |
| 6 | |
| 7 | /-! |
| 8 | # Actual embedded acceleration of a C2 spatial slice |
| 9 | |
| 10 | The chart Hessian and covariant acceleration have cancelling Christoffel |
| 11 | terms. The actual curvature formula then separates the embedded second |
| 12 | derivative from its tangential component. MT2007 Claim 19.1, p. 437, |
| 13 | and Lemma 19.6, pp. 441-442; C2 ambient acceleration derivation of |
| 14 | 2026-09-22, statements 2-3. All identities are purely spatial. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped Manifold ContDiff Bundle Topology |
| 22 | |
| 23 | universe u v |
| 24 | |
| 25 | namespace PoincareMT.M63 |
| 26 | |
| 27 | open Proofs.M09 |
| 28 | |
| 29 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 30 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 31 | {ι : Type v} [Fintype ι] |
| 32 | |
| 33 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 34 | local notation "W" => EuclideanSpace ℝ ι |
| 35 | |
| 36 | /-- The actual second derivative of a smooth spatial map along a C2 |
| 37 | curve is its selected-connection Hessian plus pushed covariant |
| 38 | acceleration. Zero velocity is allowed. MT2007 Claim 19.1, p. 437; |
| 39 | C2 ambient acceleration derivation, statement 2. -/ |
| 40 | theorem secondDeriv_embedding_eq_hessian_add_acceleration |
| 41 | {g : RiemannianMetric n M} (D : LeviCivitaData g) {e : M → W} |
| 42 | (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) {gamma : ℝ → M} |
| 43 | (hgamma : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 gamma) (x : ℝ) : |
| 44 | deriv (deriv (fun y => e (gamma y))) x = |
| 45 | HAdd.hAdd (α := W) (β := W) (γ := W) |
| 46 | (coordinateHessian D e (gamma x) (curveVelocity gamma x) (curveVelocity gamma x)) |
| 47 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma x) |
| 48 | (rampHorizontalCovariantDerivative D gamma (fun y => curveVelocity gamma y) x)) := by |
| 49 | let p := gamma x |
| 50 | let c := chartAt E p |
| 51 | let U := gamma ⁻¹' c.source |
| 52 | let z : ℝ → E := fun y => c (gamma y) |
| 53 | let f : E → W := e ∘ c.symm |
| 54 | have hU : IsOpen U := c.open_source.preimage hgamma.continuous |
| 55 | have hx : x ∈ U := mem_chart_source E p |
| 56 | have hmap : MapsTo gamma U c.source := fun _ hy => hy |
| 57 | have hz : ContDiffOn ℝ 2 z U := |
| 58 | (contMDiffOn_chart.comp hgamma.contMDiffOn hmap).contDiffOn |
| 59 | have hf : ContDiffOn ℝ ∞ f c.target := |
| 60 | (he.comp_contMDiffOn (contMDiffOn_chart_symm (I := 𝓡 n) (x := p))).contDiffOn |
| 61 | have htarget : z x ∈ c.target := c.map_source hx |
| 62 | have hbase : c.symm (z x) = gamma x := c.left_inv hx |
| 63 | have hvel : chartVectorField p (deriv z x) (gamma x) = curveVelocity gamma x := |
| 64 | chartVectorField_coordinate_velocity p gamma x (deriv z x) hx |
| 65 | ((hgamma x).mdifferentiableAt (by norm_num)) |
| 66 | (((hz.contDiffAt (hU.mem_nhds hx)).differentiableAt (by norm_num)).hasDerivAt) |
| 67 | have hacc := pullback_velocity_eq_chart_acceleration D p hU hgamma.contMDiffOn hmap hx |
| 68 | have hhess := coordinateHessian_eq_chart D he p (gamma x) hx (deriv z x) (deriv z x) |
| 69 | dsimp only at hacc hhess |
| 70 | rw [hvel] at hhess |
| 71 | have hpush (v : E) : |
| 72 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma x) (chartVectorField p v (gamma x)) = |
| 73 | fderiv ℝ f (z x) v := by |
| 74 | have hchain := mfderiv_comp (z x) (he.mdifferentiable (by simp)).mdifferentiableAt |
| 75 | ((mdifferentiable_chart (I := 𝓡 n) p).mdifferentiableAt_symm htarget) |
| 76 | rw [mfderiv_eq_fderiv] at hchain |
| 77 | have hv := congrArg (fun L : E →L[ℝ] W => L v) hchain |
| 78 | change fderiv ℝ f (z x) v = |
| 79 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c.symm (z x)) |
| 80 | (mfderiv (𝓡 n) (𝓡 n) c.symm (z x) v) at hv |
| 81 | rw [← chartVectorField_at_inverse p v (z x) htarget, hbase] at hv |
| 82 | exact hv.symm |
| 83 | have hlocal : (fun y => e (gamma y)) =ᶠ[𝓝 x] (fun y => f (z y)) := by |
| 84 | filter_upwards [hU.mem_nhds hx] with y hy |
| 85 | dsimp only [f, z, Function.comp_def] |
| 86 | rw [c.left_inv hy] |
| 87 | have hsecond := secondDeriv_comp_of_contDiffAt_two f z x |
| 88 | ((hf.contDiffAt (c.open_target.mem_nhds htarget)).of_le |
| 89 | (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)) |
| 90 | (hz.contDiffAt (hU.mem_nhds hx)) |
| 91 | rw [hlocal.deriv.deriv_eq, hsecond, hhess, hacc, hpush, map_add] |
| 92 | abel |
| 93 | |
| 94 | variable {a b : ℝ} |
| 95 | |
| 96 | /-- An arbitrary C2 immersed slice has the actual embedded curvature |
| 97 | formula with the speed-cubed tangential coefficient. No time equation |
| 98 | or endpoint time derivative is needed. MT2007 Lemma 19.6, pp. 441-442; |
| 99 | C2 ambient acceleration derivation, statement 3. -/ |
| 100 | theorem embedded_curvature_eq_acceleration_sub_tangent |
| 101 | (F : RicciFlow n M (Icc a b)) {e : M → W} |
| 102 | (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) (q : ℝ → ℝ → M) {t : ℝ} |
| 103 | (hspace : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 (fun y => q y t)) |
| 104 | (himm : ∀ y, curveVelocity (n := n) (fun z => q z t) y ≠ 0) (x : ℝ) : |
| 105 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t) (m62CurvatureVector F q t x) = |
| 106 | (curveSpeed F q t x ^ 2)⁻¹ • |
| 107 | (deriv (deriv (fun y => e (q y t))) x - |
| 108 | coordinateHessian (F.connection t) e (q x t) |
| 109 | (curveVelocity (fun y => q y t) x) (curveVelocity (fun y => q y t) x)) - |
| 110 | (deriv (curveSpeed F q t) x / curveSpeed F q t x ^ 3) • |
| 111 | deriv (fun y => e (q y t)) x := by |
| 112 | have hX := ((spatial_velocity_contMDiff_of_c2 hspace) x).mdifferentiableAt (by simp) |
| 113 | have hv := ((speed_contDiff_of_c2 F q hspace himm).differentiable (by simp) x).hasDerivAt |
| 114 | have hne : curveSpeed F q t x ≠ 0 := |
| 115 | (Real.sqrt_pos.mpr ((F.metric t).pos _ _ (himm x))).ne' |
| 116 | have hacc := secondDeriv_embedding_eq_hessian_add_acceleration (F.connection t) he hspace x |
| 117 | have hpushacc : |
| 118 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t) |
| 119 | (rampHorizontalCovariantDerivative (F.connection t) (fun y => q y t) |
| 120 | (fun y => curveVelocity (fun z => q z t) y) x) = |
| 121 | deriv (deriv (fun y => e (q y t))) x - |
| 122 | coordinateHessian (F.connection t) e (q x t) |
| 123 | (curveVelocity (fun y => q y t) x) (curveVelocity (fun y => q y t) x) := by |
| 124 | rw [hacc] |
| 125 | abel |
| 126 | have hpushvel : mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t) |
| 127 | (curveVelocity (fun y => q y t) x) = deriv (fun y => e (q y t)) x := by |
| 128 | have hchain : fderiv ℝ (fun y => e (q y t)) x = |
| 129 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t)).comp |
| 130 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) (fun y => q y t) x) := by |
| 131 | rw [← mfderiv_eq_fderiv] |
| 132 | exact mfderiv_comp x (he.mdifferentiable (by simp)).mdifferentiableAt |
| 133 | ((hspace x).mdifferentiableAt (by norm_num)) |
| 134 | exact (congrArg (fun L : ℝ →L[ℝ] W => L 1) hchain).symm |
| 135 | rw [curvatureVector_eq_acceleration_sub_tangent F q hX hv hne, |
| 136 | map_sub, map_smul, map_smul, hpushacc, hpushvel] |
| 137 | |
| 138 | end PoincareMT.M63 |