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.Curvature.Calculus.Fields.KoszulPairing |
| 2 | import PoincareLib.Geometry.RicciFlow.Curvature.Calculus.Tensors.TensorDerivativeFields |
| 3 | |
| 4 | /-! Adapted from Mapher06/Poincare-MorganTian, `PoincareMT/Proofs/M04/ConnectionDifference.lean`, |
| 5 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. See the curvature import record under |
| 6 | `references/ricci-flow/mapher/curvature/`. -/ |
| 7 | |
| 8 | /-! |
| 9 | # Finite metric variation of the supplied connection |
| 10 | |
| 11 | Metric compatibility and torsion give the finite counterpart of Topping, |
| 12 | Proposition 2.3.1, printed pp.28 and 32-33, before differentiating in time. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.RicciFlowAnalysis |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | |
| 26 | set_option backward.isDefEq.respectTransparency false in |
| 27 | theorem connection_difference_pairing |
| 28 | {g0 g1 : RiemannianMetric n M} (D0 : LeviCivitaData g0) (D1 : LeviCivitaData g1) |
| 29 | {X Y Z : (y : M) → TangentSpace (𝓡 n) y} {x : M} |
| 30 | (hX : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 31 | (T% X) x) |
| 32 | (hY : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 33 | (T% Y) x) |
| 34 | (hZ : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 35 | (T% Z) x) : |
| 36 | let H : CovariantTensorEvaluation n M 2 := |
| 37 | fun y v ↦ g1.inner y (v 0) (v 1) - g0.inner y (v 0) (v 1) |
| 38 | 2 * g1.inner x (D1.connection Y x (X x) - D0.connection Y x (X x)) (Z x) = |
| 39 | covariantTensorDerivativeOnFields D0 H ![X, Y, Z] x + |
| 40 | covariantTensorDerivativeOnFields D0 H ![Y, X, Z] x - |
| 41 | covariantTensorDerivativeOnFields D0 H ![Z, X, Y] x := by |
| 42 | let H : CovariantTensorEvaluation n M 2 := |
| 43 | fun y v ↦ g1.inner y (v 0) (v 1) - g0.inner y (v 0) (v 1) |
| 44 | let A (P Q : (y : M) → TangentSpace (𝓡 n) y) := |
| 45 | D1.connection Q x (P x) - D0.connection Q x (P x) |
| 46 | change 2 * g1.inner x (A X Y) (Z x) = |
| 47 | covariantTensorDerivativeOnFields D0 H ![X, Y, Z] x + |
| 48 | covariantTensorDerivativeOnFields D0 H ![Y, X, Z] x - |
| 49 | covariantTensorDerivativeOnFields D0 H ![Z, X, Y] x |
| 50 | have hsym {P Q : (y : M) → TangentSpace (𝓡 n) y} |
| 51 | (hP : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 52 | (T% P) x) |
| 53 | (hQ : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 54 | (T% Q) x) : A P Q = A Q P := by |
| 55 | apply sub_eq_zero.mp |
| 56 | calc |
| 57 | A P Q - A Q P = |
| 58 | (D1.connection Q x (P x) - D1.connection P x (Q x)) - |
| 59 | (D0.connection Q x (P x) - D0.connection P x (Q x)) := by |
| 60 | dsimp only [A] |
| 61 | abel |
| 62 | _ = 0 := by rw [connection_commutator D1 hP hQ, |
| 63 | connection_commutator D0 hP hQ, sub_self] |
| 64 | have hpair (g : RiemannianMetric n M) {P Q : (y : M) → TangentSpace (𝓡 n) y} |
| 65 | (hP : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 66 | (T% P) x) |
| 67 | (hQ : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 68 | (T% Q) x) : |
| 69 | MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) (fun y ↦ g.inner y (P y) (Q y)) x := by |
| 70 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 71 | ⟨g.toRiemannianMetric⟩ |
| 72 | exact hP.inner_bundle hQ |
| 73 | have hC (P : (y : M) → TangentSpace (𝓡 n) y) |
| 74 | {Q R : (y : M) → TangentSpace (𝓡 n) y} |
| 75 | (hQ : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 76 | (T% Q) x) |
| 77 | (hR : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 78 | (T% R) x) : |
| 79 | covariantTensorDerivativeOnFields D0 H ![P, Q, R] x = |
| 80 | g1.inner x (A P Q) (R x) + g1.inner x (Q x) (A P R) := by |
| 81 | simp only [covariantTensorDerivativeOnFields, Fin.sum_univ_succ] |
| 82 | change mvfderiv (𝓡 n) |
| 83 | (fun y ↦ g1.inner y (Q y) (R y) - g0.inner y (Q y) (R y)) x (P x) - |
| 84 | ((g1.inner x (D0.connection Q x (P x)) (R x) - |
| 85 | g0.inner x (D0.connection Q x (P x)) (R x)) + |
| 86 | ((g1.inner x (Q x) (D0.connection R x (P x)) - |
| 87 | g0.inner x (Q x) (D0.connection R x (P x))) + 0)) = _ |
| 88 | erw [mvfderiv_sub (hpair g1 hQ hR) (hpair g0 hQ hR)] |
| 89 | simp only [sub_apply] |
| 90 | rw [metric_derivative_pairing D1 P hQ hR, metric_derivative_pairing D0 P hQ hR] |
| 91 | simp only [A, map_sub, sub_apply] |
| 92 | ring |
| 93 | rw [hC X hY hZ, hC Y hX hZ, hC Z hX hY, |
| 94 | hsym hY hX, hsym hZ hX, hsym hZ hY, |
| 95 | g1.symm x (Y x) (A X Z)] |
| 96 | ring |
| 97 | |
| 98 | end PoincareMT.RicciFlowAnalysis |
| 99 |