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.Surgery.StandardCap.Persistence.Scalar.Calculus.ConnectionDifference |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Persistence.Geometry.ConnectionCurvatureDifference |
| 3 | |
| 4 | /-! |
| 5 | # The actual curvature correction for a nearby metric |
| 6 | |
| 7 | The curvature difference is the antisymmetrized covariant derivative |
| 8 | of the connection difference plus its quadratic term. Lowering and |
| 9 | the Koszul formula express its derivative in the second metric error. |
| 10 | Morgan--Tian, pp. 3-7, Definition 9.76 and Lemma 11.2; |
| 11 | see M44 derivation 31. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open scoped Manifold ContDiff Topology BigOperators |
| 18 | |
| 19 | namespace PoincareMT.M44 |
| 20 | |
| 21 | open CoordinateExponential |
| 22 | |
| 23 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 24 | |
| 25 | local notation "E" => EuclideanSpace ℝ (Fin 3) |
| 26 | |
| 27 | /-- Smoothness of the actual connection correction. Source: the |
| 28 | coordinate Koszul formula, pp. 3-4, in M44 derivation 31. -/ |
| 29 | theorem contDiff_connectionDifference (g h : RiemannianMetric 3 E) : |
| 30 | ContDiff ℝ ∞ (connectionDifference g h) := by |
| 31 | apply contDiff_iff_contDiffAt.mpr |
| 32 | intro x |
| 33 | exact (contDiffAt_christoffelBilinear (h.contDiffAt_euclideanCoefficients x) |
| 34 | (h.inner_isInvertible x)).sub |
| 35 | (contDiffAt_christoffelBilinear (g.contDiffAt_euclideanCoefficients x) |
| 36 | (g.inner_isInvertible x)) |
| 37 | |
| 38 | /-- The background covariant derivative of the actual connection |
| 39 | difference, with its output and two input corrections. Source: |
| 40 | the curvature perturbation formula on pp. 3-7, M44 derivation 31. -/ |
| 41 | noncomputable def covariantConnectionDifference (g h : RiemannianMetric 3 E) |
| 42 | (x d u v : E) : E := |
| 43 | fderiv ℝ (connectionDifference g h) x d u v + |
| 44 | christoffelBilinear g.euclideanCoefficients x d (connectionDifference g h x u v) - |
| 45 | connectionDifference g h x (christoffelBilinear g.euclideanCoefficients x d u) v - |
| 46 | connectionDifference g h x u (christoffelBilinear g.euclideanCoefficients x d v) |
| 47 | |
| 48 | /-- The actual curvature difference identity, retaining the tensor |
| 49 | slot order of the contract. Source: pp. 5-7 in M44 derivation 31. -/ |
| 50 | theorem curvature_eq_add_connectionDifference {g h : RiemannianMetric 3 E} |
| 51 | (D : LeviCivitaData g) (D' : LeviCivitaData h) (x u v w : E) : |
| 52 | (D'.curvature x u v w : E) = HAdd.hAdd (α := E) (β := E) (γ := E) (D.curvature x u v w) |
| 53 | (covariantConnectionDifference g h x u v w - |
| 54 | covariantConnectionDifference g h x v u w) + |
| 55 | (connectionDifference g h x u (connectionDifference g h x v w) - |
| 56 | connectionDifference g h x v (connectionDifference g h x u w)) := by |
| 57 | have hg := (contDiffAt_christoffelBilinear (g.contDiffAt_euclideanCoefficients x) |
| 58 | (g.inner_isInvertible x)).differentiableAt (by simp) |
| 59 | have hh := (contDiffAt_christoffelBilinear (h.contDiffAt_euclideanCoefficients x) |
| 60 | (h.inner_isInvertible x)).differentiableAt (by simp) |
| 61 | rw [← coordinateCurvature_eq_retained D', ← coordinateCurvature_eq_retained D, |
| 62 | coordinateCurvature_eq_christoffelCurvature hh, |
| 63 | coordinateCurvature_eq_christoffelCurvature hg] |
| 64 | have hs := christoffelBilinear_symm |
| 65 | ((g.contDiffAt_euclideanCoefficients x).differentiableAt (by simp)) |
| 66 | (Filter.Eventually.of_forall fun y a b => g.symm y a b) u v |
| 67 | have hdiff : fderiv ℝ (connectionDifference g h) x = |
| 68 | fderiv ℝ (christoffelBilinear h.euclideanCoefficients) x - |
| 69 | fderiv ℝ (christoffelBilinear g.euclideanCoefficients) x := fderiv_fun_sub hh hg |
| 70 | simp only [covariantConnectionDifference, hdiff, connectionDifference, |
| 71 | ConnectionVariation.christoffelCurvature] |
| 72 | convert connection_curvature_difference_algebra |
| 73 | (christoffelBilinear g.euclideanCoefficients x) |
| 74 | (christoffelBilinear h.euclideanCoefficients x) |
| 75 | (fderiv ℝ (christoffelBilinear g.euclideanCoefficients) x) |
| 76 | (fderiv ℝ (christoffelBilinear h.euclideanCoefficients) x) u v w hs using 1 |
| 77 | |
| 78 | /-- The cyclic Koszul permutation of a covariant three-tensor. |
| 79 | Source: the lowered connection formula, pp. 3-4, M44 derivation 31. -/ |
| 80 | noncomputable def koszulPermutation (T : CovariantTensorEvaluation 3 E 3) : |
| 81 | CovariantTensorEvaluation 3 E 3 := fun x v => |
| 82 | T x v + T x (v ∘ (Equiv.swap 0 1).trans (Equiv.swap 0 2)) - |
| 83 | T x (v ∘ (Equiv.swap 0 2).trans (Equiv.swap 0 1)) |
| 84 | |
| 85 | /-- Evaluation of the cyclic Koszul permutation. Source: pp. 3-4, |
| 86 | in the perturbation formula for Definition 9.76. -/ |
| 87 | theorem koszulPermutation_apply (T : CovariantTensorEvaluation 3 E 3) (x u v w : E) : |
| 88 | koszulPermutation T x ![u, v, w] = |
| 89 | T x ![u, v, w] + T x ![v, w, u] - T x ![w, u, v] := by |
| 90 | have h1 : (![u, v, w] ∘ (Equiv.swap 0 1).trans (Equiv.swap 0 2)) = ![v, w, u] := by |
| 91 | funext i |
| 92 | fin_cases i <;> simp! [Equiv.swap_apply_def, Fin.ext_iff] |
| 93 | have h2 : (![u, v, w] ∘ (Equiv.swap 0 2).trans (Equiv.swap 0 1)) = ![w, u, v] := by |
| 94 | funext i |
| 95 | fin_cases i <;> simp! [Equiv.swap_apply_def, Fin.ext_iff] |
| 96 | simp only [koszulPermutation, h1, h2] |
| 97 | |
| 98 | /-- Smoothness of the Koszul permutation. Source: the tensor-algebra |
| 99 | step in M44 derivation 31. -/ |
| 100 | theorem koszulPermutation_isSmooth {T : CovariantTensorEvaluation 3 E 3} |
| 101 | (hT : IsSmoothCovariantTensor T) : IsSmoothCovariantTensor (koszulPermutation T) := |
| 102 | (hT.add (hT.perm ((Equiv.swap 0 1).trans (Equiv.swap 0 2)))).sub |
| 103 | (hT.perm ((Equiv.swap 0 2).trans (Equiv.swap 0 1))) |
| 104 | |
| 105 | /-- Covariant differentiation preserves the three Koszul terms and |
| 106 | leaves the new derivative slot first. Source: pp. 3-7, M44 derivation 31. -/ |
| 107 | theorem covariant_koszulPermutation {g : RiemannianMetric 3 E} (D : LeviCivitaData g) |
| 108 | {T : CovariantTensorEvaluation 3 E 3} (hT : IsSmoothCovariantTensor T) |
| 109 | (x d u v w : E) : |
| 110 | D.covariantTensorDerivative (koszulPermutation T) x ![d, u, v, w] = |
| 111 | D.covariantTensorDerivative T x ![d, u, v, w] + |
| 112 | D.covariantTensorDerivative T x ![d, v, w, u] - |
| 113 | D.covariantTensorDerivative T x ![d, w, u, v] := by |
| 114 | unfold koszulPermutation |
| 115 | rw [D.covariantTensorDerivative_sub |
| 116 | (hT.add (hT.perm ((Equiv.swap 0 1).trans (Equiv.swap 0 2)))) |
| 117 | (hT.perm ((Equiv.swap 0 2).trans (Equiv.swap 0 1))), |
| 118 | D.covariantTensorDerivative_add hT |
| 119 | (hT.perm ((Equiv.swap 0 1).trans (Equiv.swap 0 2)))] |
| 120 | simp only [D.covariantTensorDerivative_reindex, Matrix.cons_val_zero] |
| 121 | have hp1 : Fin.cons d (fun i : Fin 3 => |
| 122 | (![d, u, v, w] : Fin 4 → E) |
| 123 | (((Equiv.swap 0 1).trans (Equiv.swap 0 2)) i).succ) = ![d, v, w, u] := by |
| 124 | funext i |
| 125 | fin_cases i <;> rfl |
| 126 | have hp2 : Fin.cons d (fun i : Fin 3 => |
| 127 | (![d, u, v, w] : Fin 4 → E) |
| 128 | (((Equiv.swap 0 2).trans (Equiv.swap 0 1)) i).succ) = ![d, w, u, v] := by |
| 129 | funext i |
| 130 | fin_cases i <;> rfl |
| 131 | erw [hp1, hp2] |
| 132 | |
| 133 | end PoincareMT.M44 |