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.Generalized.ReducedGeometry.Measure.Jacobian.ExponentialGramHessian |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Measure.Jacobian.ExponentialGramPath |
| 3 | import Mathlib.Analysis.Calculus.Deriv.Pi |
| 4 | |
| 5 | /-! |
| 6 | # Differentiating the actual exponential Gram matrix |
| 7 | |
| 8 | The short-prefix endpoint identity gives the diagonal derivative. |
| 9 | A longer surviving prefix supplies an ordinary derivative at an |
| 10 | interior time, identified by uniqueness with the closed short-prefix |
| 11 | derivative. Morgan-Tian Proposition 6.81, equations (6.19)-(6.21), |
| 12 | pp. 145-146. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | -- Canonical Jacobi data retain the supplied square path and its horizontal fibers. |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set |
| 20 | open scoped Manifold ContDiff Bundle Matrix.Norms.Elementwise |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.M14 |
| 25 | |
| 26 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 27 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 28 | {T : ℝ} {x : G.Point} |
| 29 | |
| 30 | private theorem ricci_hessian_pair_heq {q r : G.Point} (h : q = r) {τ : ℝ} |
| 31 | (hq : G.spacetime.timeFunction q = T - τ) (hr : G.spacetime.timeFunction r = T - τ) |
| 32 | (f : G.Point → ℝ) {U : G.Horizontal q} {V : G.Horizontal r} (hV : HEq U V) : |
| 33 | horizontalRicci G.leafwise q U U + M14ReducedLengthHessianPairing G ⟨q, hq⟩ f U U = |
| 34 | horizontalRicci G.leafwise r V V + M14ReducedLengthHessianPairing G ⟨r, hr⟩ f V V := by |
| 35 | cases h |
| 36 | cases hV |
| 37 | rfl |
| 38 | |
| 39 | /-- A diagonal actual Gram entry has its exact Ricci-plus-Hessian |
| 40 | derivative at the closed regular endpoint, Proposition 6.81, |
| 41 | equation (6.19), p. 145. -/ |
| 42 | theorem exponentialGram_diagonal_hasDerivWithinAt |
| 43 | (hCoordinates : M12MetricPredecessors.{0} n) |
| 44 | (hM04 : RicciFlowCurvatureTheory.{0}) (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 45 | (E : M14ExponentialFamily G T x) (v : Fin n → G.Horizontal x) |
| 46 | {Z : G.Horizontal x} {s : ℝ} (hs : (Z, s) ∈ E.domain) (hpos : 0 < s) |
| 47 | (hz : (Z, s) ∈ M14JointDomain G E) (i : Fin n) : |
| 48 | HasDerivWithinAt (fun r => exponentialGram E v Z r i i) |
| 49 | (4 * s * (horizontalRicci G.leafwise (E.gamma Z s) |
| 50 | (E.differential Z s hs (v i)) (E.differential Z s hs (v i)) + |
| 51 | M14ReducedLengthHessianPairing G ⟨E.gamma Z s, E.clock Z s hs⟩ |
| 52 | (M14ReducedLengthAt G T 0 x) |
| 53 | (E.differential Z s hs (v i)) (E.differential Z s hs (v i)))) |
| 54 | (M14SqrtParameterInterval 0 (s ^ 2)) s := by |
| 55 | let R := E.square_path Z s hs hpos |
| 56 | let Q : M14JacobiFieldData G R.curve (M14SqrtParameterInterval 0 (s ^ 2)) := |
| 57 | initialValuePath_differentialData hM04 hM12 |
| 58 | (exponentialInitialValuePath E Z s hs hpos) (v i) |
| 59 | have hsC : s ∈ M14SqrtParameterInterval 0 (s ^ 2) := by |
| 60 | simpa only [M14SqrtParameterInterval, Real.sqrt_zero, Real.sqrt_sq hpos.le] using |
| 61 | (show s ∈ Icc 0 s from ⟨hpos.le, le_rfl⟩) |
| 62 | have hpoint := exponential_square_curve_eq E Z hs hpos hsC |
| 63 | have hq := R.curve_time s hsC |
| 64 | have hd := squareRoot_covariantDerivative_metric_product R Q.extension Q.extension hsC |
| 65 | change HasDerivWithinAt |
| 66 | (fun r => G.spacetime.horizontalMetric.inner (R.curve r) (Q.field r) (Q.field r)) |
| 67 | (G.spacetime.horizontalMetric.inner (R.curve s) (M14JacobiFirstDerivative Q s) (Q.field s) + |
| 68 | G.spacetime.horizontalMetric.inner (R.curve s) (Q.field s) (M14JacobiFirstDerivative Q s) + |
| 69 | 4 * s * horizontalRicci G.leafwise (R.curve s) (Q.field s) (Q.field s)) _ s at hd |
| 70 | rw [G.spacetime.horizontalMetric.symm (R.curve s) (Q.field s)] at hd |
| 71 | have hh := exponentialJacobi_boundary_eq_hessian hCoordinates hM04 hM12 E |
| 72 | hs hpos hz hpoint hq (v i) |
| 73 | change G.spacetime.horizontalMetric.inner (R.curve s) |
| 74 | (M14JacobiFirstDerivative Q s) (Q.field s) = _ at hh |
| 75 | rw [hh] at hd |
| 76 | have hd' : HasDerivWithinAt |
| 77 | (fun r => G.spacetime.horizontalMetric.inner (R.curve r) (Q.field r) (Q.field r)) |
| 78 | (4 * s * (horizontalRicci G.leafwise (R.curve s) (Q.field s) (Q.field s) + |
| 79 | M14ReducedLengthHessianPairing G ⟨R.curve s, hq⟩ (M14ReducedLengthAt G T 0 x) |
| 80 | (Q.field s) (Q.field s))) (M14SqrtParameterInterval 0 (s ^ 2)) s := by |
| 81 | convert hd using 1 |
| 82 | ring |
| 83 | rw [ricci_hessian_pair_heq hpoint hq (E.clock Z s hs) (M14ReducedLengthAt G T 0 x) |
| 84 | (exponentialJacobiField_heq_differential hM04 hM12 E Z (v i) hs hpos hsC hs)] at hd' |
| 85 | exact hd'.congr_of_mem |
| 86 | (fun r hr => exponentialGram_eq_jacobi_pair hM04 hM12 E v hs hpos hr i i) hsC |
| 87 | |
| 88 | /-- Inside a surviving longer prefix the actual Gram matrix has an |
| 89 | ordinary derivative with the exact Ricci-plus-Hessian diagonal, |
| 90 | Proposition 6.81, equation (6.19), p. 145. -/ |
| 91 | theorem exponentialGram_hasDerivAt |
| 92 | (hCoordinates : M12MetricPredecessors.{0} n) |
| 93 | (hM04 : RicciFlowCurvatureTheory.{0}) (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 94 | (E : M14ExponentialFamily G T x) (v : Fin n → G.Horizontal x) |
| 95 | {Z : G.Horizontal x} {s b : ℝ} (hb : (Z, b) ∈ E.domain) |
| 96 | (hs : (Z, s) ∈ E.domain) (hpos : 0 < s) (hlt : s < b) |
| 97 | (hz : (Z, s) ∈ M14JointDomain G E) : |
| 98 | ∃ B : Matrix (Fin n) (Fin n) ℝ, |
| 99 | HasDerivAt (exponentialGram E v Z) B s ∧ ∀ i, B i i = |
| 100 | 4 * s * (horizontalRicci G.leafwise (E.gamma Z s) |
| 101 | (E.differential Z s hs (v i)) (E.differential Z s hs (v i)) + |
| 102 | M14ReducedLengthHessianPairing G ⟨E.gamma Z s, E.clock Z s hs⟩ |
| 103 | (M14ReducedLengthAt G T 0 x) |
| 104 | (E.differential Z s hs (v i)) (E.differential Z s hs (v i))) := by |
| 105 | have hsm := (exponentialGram_contDiffOn hM04 hM12 E v hb (hpos.trans hlt)).contDiffAt |
| 106 | (Icc_mem_nhds hpos hlt) |
| 107 | have hd := (hsm.differentiableAt (by simp)).hasDerivAt |
| 108 | refine ⟨deriv (exponentialGram E v Z) s, hd, ?_⟩ |
| 109 | intro i |
| 110 | have hdi := hasDerivAt_pi.mp (hasDerivAt_pi.mp hd i) i |
| 111 | have hwithin := exponentialGram_diagonal_hasDerivWithinAt hCoordinates hM04 hM12 E |
| 112 | v hs hpos hz i |
| 113 | have hC : UniqueDiffWithinAt ℝ (M14SqrtParameterInterval 0 (s ^ 2)) s := by |
| 114 | simpa only [M14SqrtParameterInterval, Real.sqrt_zero, Real.sqrt_sq hpos.le] using |
| 115 | (uniqueDiffOn_Icc hpos s ⟨hpos.le, le_rfl⟩) |
| 116 | exact (hdi.hasDerivWithinAt.derivWithin hC).symm.trans (hwithin.derivWithin hC) |
| 117 | |
| 118 | end PoincareMT.M14 |