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 | /- Adapted from Mapher `PoincareMT/Proofs/Ch01/Koszul.lean` at |
| 2 | f927d9e1f0810042766d3b5f64d3f4da02ee93cc. See |
| 3 | `references/ricci-flow/mapher/local-theory/port.json`. -/ |
| 4 | |
| 5 | import PoincareLib.Geometry.Riemannian.Connection |
| 6 | import Mathlib.Tactic.Linarith |
| 7 | import Mathlib.Tactic.Ring |
| 8 | |
| 9 | /-! |
| 10 | # Local Koszul formula and uniqueness on regular sections |
| 11 | |
| 12 | The formula follows from the metric-compatibility and torsion identities in |
| 13 | Morgan-Tian, Theorem 1.2, printed pp. 3-4. These results require differentiability |
| 14 | only at the evaluation point. They do not assert existence or equality of |
| 15 | connection operators on arbitrary nondifferentiable sections. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open scoped Manifold ContDiff Bundle |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.LeviCivitaData |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 28 | {g : RiemannianMetric n M} |
| 29 | |
| 30 | /-- Metric compatibility with the specified metric visible in the scalar derivative. -/ |
| 31 | theorem localTheory_mvfderiv_inner (D : LeviCivitaData g) |
| 32 | (X Y Z : (x : M) → TangentSpace (𝓡 n) x) {x : M} |
| 33 | (hY : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (T% Y) x) |
| 34 | (hZ : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (T% Z) x) : |
| 35 | mvfderiv (𝓡 n) (fun y ↦ g.inner y (Y y) (Z y)) x (X x) = |
| 36 | g.inner x (D.connection Y x (X x)) (Z x) + |
| 37 | g.inner x (Y x) (D.connection Z x (X x)) := by |
| 38 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 39 | ⟨g.toRiemannianMetric⟩ |
| 40 | exact D.metricCompatible.mvfderiv_inner_eq X hY hZ |
| 41 | |
| 42 | /-- The Koszul formula on vector fields differentiable at the evaluation point. -/ |
| 43 | theorem koszul (D : LeviCivitaData g) |
| 44 | (X Y Z : (x : M) → TangentSpace (𝓡 n) x) {x : M} |
| 45 | (hX : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (T% X) x) |
| 46 | (hY : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (T% Y) x) |
| 47 | (hZ : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (T% Z) x) : |
| 48 | 2 * g.inner x (D.connection Y x (X x)) (Z x) = |
| 49 | mvfderiv (𝓡 n) (fun y ↦ g.inner y (Y y) (Z y)) x (X x) + |
| 50 | mvfderiv (𝓡 n) (fun y ↦ g.inner y (Z y) (X y)) x (Y x) - |
| 51 | mvfderiv (𝓡 n) (fun y ↦ g.inner y (X y) (Y y)) x (Z x) + |
| 52 | g.inner x (VectorField.mlieBracket (𝓡 n) X Y x) (Z x) - |
| 53 | g.inner x (Y x) (VectorField.mlieBracket (𝓡 n) X Z x) - |
| 54 | g.inner x (X x) (VectorField.mlieBracket (𝓡 n) Y Z x) := by |
| 55 | rw [D.localTheory_mvfderiv_inner X Y Z hY hZ, D.localTheory_mvfderiv_inner Y Z X hZ hX, |
| 56 | D.localTheory_mvfderiv_inner Z X Y hX hY] |
| 57 | rw [← (D.connection.torsion_eq_zero_iff.mp D.torsion_eq_zero) hX hY, |
| 58 | ← (D.connection.torsion_eq_zero_iff.mp D.torsion_eq_zero) hX hZ, |
| 59 | ← (D.connection.torsion_eq_zero_iff.mp D.torsion_eq_zero) hY hZ] |
| 60 | simp only [map_sub, sub_apply] |
| 61 | rw [g.symm x (D.connection Z x (Y x)) (X x), |
| 62 | g.symm x (Z x) (D.connection X x (Y x)), |
| 63 | g.symm x (D.connection X x (Z x)) (Y x)] |
| 64 | ring |
| 65 | |
| 66 | /-- Compatible torsion-free connections agree on a section differentiable at a point. -/ |
| 67 | theorem connection_eq_at (D D' : LeviCivitaData g) |
| 68 | (Y : (x : M) → TangentSpace (𝓡 n) x) {x : M} |
| 69 | (hY : MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (T% Y) x) : |
| 70 | D.connection Y x = D'.connection Y x := by |
| 71 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 72 | ⟨g.toRiemannianMetric⟩ |
| 73 | ext u |
| 74 | apply ext_inner_right ℝ |
| 75 | intro v |
| 76 | change g.inner x (D.connection Y x u) v = g.inner x (D'.connection Y x u) v |
| 77 | have hD := D.koszul (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) u) Y |
| 78 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) v) |
| 79 | (FiberBundle.mdifferentiableAt_extend ..) hY (FiberBundle.mdifferentiableAt_extend ..) |
| 80 | have hD' := D'.koszul (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) u) Y |
| 81 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) v) |
| 82 | (FiberBundle.mdifferentiableAt_extend ..) hY (FiberBundle.mdifferentiableAt_extend ..) |
| 83 | simp only [FiberBundle.extend_apply_self] at hD hD' |
| 84 | linarith only [hD, hD'] |
| 85 | |
| 86 | end PoincareMT.LeviCivitaData |