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.CurveShortening.Connection.Algebra |
| 2 | import Mathlib.Geometry.Manifold.MFDeriv.NormedSpace |
| 3 | |
| 4 | /-! A pullback covariant derivative depends only on the first jet |
| 5 | of its parameter curve. Source: MT Lemma 19.15, pp. 447-449; |
| 6 | finite-conormal-variation derivation and the M62 frozen-frame formula. -/ |
| 7 | |
| 8 | noncomputable section |
| 9 | set_option autoImplicit false |
| 10 | set_option warningAsError true |
| 11 | set_option backward.isDefEq.respectTransparency false |
| 12 | |
| 13 | open Filter Bundle |
| 14 | open scoped Manifold ContDiff Topology |
| 15 | |
| 16 | namespace PoincareMT |
| 17 | |
| 18 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 19 | {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 20 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 21 | |
| 22 | /-- Replacing a differentiable parameter path by its actual affine first jet preserves the |
| 23 | pullback derivative of any differentiable parameter-dependent tangent field. Source: |
| 24 | Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 25 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 26 | theorem m64Pullback_covariantDerivative_eq_affine_parameter |
| 27 | {g : RiemannianMetric n M} (D : LeviCivitaData g) |
| 28 | {f : E → M} {Y : (q : E) → TangentSpace (𝓡 n) (f q)} |
| 29 | {h : ℝ → E} {x : ℝ} (hh : DifferentiableAt ℝ h x) |
| 30 | (hf : MDifferentiableAt 𝓘(ℝ, E) (𝓡 n) f (h x)) |
| 31 | (hY : MDifferentiableAt 𝓘(ℝ, E) ((𝓡 n).prod (𝓡 n)) |
| 32 | (fun q => (⟨f q, Y q⟩ : TangentBundle (𝓡 n) M)) (h x)) : |
| 33 | let H := fun y : ℝ => h x + (y - x) • deriv h x |
| 34 | rampHorizontalCovariantDerivative D (fun y => f (h y)) (fun y => Y (h y)) x = |
| 35 | rampHorizontalCovariantDerivative D (fun y => f (H y)) (fun y => Y (H y)) x := by |
| 36 | let H := fun y : ℝ => h x + (y - x) • deriv h x |
| 37 | have hHx : H x = h x := by simp [H] |
| 38 | have hH : HasDerivAt H (deriv h x) x := by |
| 39 | simpa only [H, id_eq, one_smul] using! |
| 40 | (((hasDerivAt_id x).sub_const x).smul_const (deriv h x)).const_add (h x) |
| 41 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) (f (h x)) |
| 42 | let y : E → EuclideanSpace ℝ (Fin n) := fun q => (e ⟨f q, Y q⟩).2 |
| 43 | have hy : DifferentiableAt ℝ y (h x) := by |
| 44 | rw [mdifferentiableAt_totalSpace] at hY |
| 45 | exact hY.2.differentiableAt |
| 46 | have hdy : deriv (fun z => y (h z)) x = deriv (fun z => y (H z)) x := by |
| 47 | have ha := hy.hasFDerivAt.comp_hasDerivAt x hh.hasDerivAt |
| 48 | have hb := (hHx.symm ▸ hy).hasFDerivAt.comp_hasDerivAt x hH |
| 49 | change deriv (y ∘ h) x = deriv (y ∘ H) x |
| 50 | rw [ha.deriv, hb.deriv, hHx] |
| 51 | have hvh : curveVelocity (n := n) (fun z => f (h z)) x = |
| 52 | mfderiv 𝓘(ℝ, E) (𝓡 n) f (h x) (deriv h x) := by |
| 53 | have hc := mfderiv_comp_apply x hf hh.mdifferentiableAt (1 : ℝ) |
| 54 | simpa +instances only [Function.comp_def, curveVelocity, mfderiv_eq_fderiv, deriv] |
| 55 | using! hc |
| 56 | have hvH : curveVelocity (n := n) (fun z => f (H z)) x = |
| 57 | mfderiv 𝓘(ℝ, E) (𝓡 n) f (h x) (deriv h x) := by |
| 58 | have hc := mfderiv_comp_apply x (hHx.symm ▸ hf) hH.differentiableAt.mdifferentiableAt |
| 59 | (1 : ℝ) |
| 60 | have hc' : curveVelocity (n := n) (fun z => f (H z)) x = |
| 61 | mfderiv 𝓘(ℝ, E) (𝓡 n) f (H x) (deriv H x) := by |
| 62 | simpa +instances only [Function.comp_def, curveVelocity, mfderiv_eq_fderiv, deriv] |
| 63 | using! hc |
| 64 | have hp : (H x, deriv H x) = (h x, deriv h x) := Prod.ext hHx hH.deriv |
| 65 | exact hc'.trans (congrArg (fun q : E × E => |
| 66 | (mfderiv 𝓘(ℝ, E) (𝓡 n) f q.1 q.2 : EuclideanSpace ℝ (Fin n))) hp) |
| 67 | have hright : rampHorizontalCovariantDerivative D (fun z => f (H z)) |
| 68 | (fun z => Y (H z)) x = |
| 69 | e.symmL ℝ (f (h x)) (deriv (fun z => y (H z)) x) + |
| 70 | D.connection (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (Y (h x))) |
| 71 | (f (h x)) (curveVelocity (fun z => f (H z)) x) := by |
| 72 | let C : E → EuclideanSpace ℝ (Fin n) := fun q => |
| 73 | let eq := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) (f q) |
| 74 | eq.symmL ℝ (f q) (deriv (fun z => (eq ⟨f (H z), Y (H z)⟩).2) x) + |
| 75 | D.connection (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (Y q)) |
| 76 | (f q) (curveVelocity (fun z => f (H z)) x) |
| 77 | exact congrArg C hHx |
| 78 | change rampHorizontalCovariantDerivative D (fun z => f (h z)) (fun z => Y (h z)) x = _ |
| 79 | rw [hright] |
| 80 | change e.symmL ℝ (f (h x)) (deriv (fun z => y (h z)) x) + |
| 81 | D.connection (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (Y (h x))) |
| 82 | (f (h x)) (curveVelocity (fun z => f (h z)) x) = _ |
| 83 | rw [hdy, hvh, hvH] |
| 84 | |
| 85 | end PoincareMT |