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.CurveShortening.Comparison.AnnularEvolution.Finite.ParameterVelocity |
| 2 | |
| 3 | /-! The actual half-energy variation with differentiable spatial |
| 4 | parameters follows from its affine first jet. Source: MT Lemma |
| 5 | 19.15, pp. 447-449; finite-conormal-variation derivation. -/ |
| 6 | |
| 7 | noncomputable section |
| 8 | set_option autoImplicit false |
| 9 | set_option warningAsError true |
| 10 | set_option backward.isDefEq.respectTransparency false |
| 11 | |
| 12 | open Set Filter Bundle |
| 13 | open scoped Manifold ContDiff Topology |
| 14 | |
| 15 | namespace PoincareMT |
| 16 | |
| 17 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 18 | {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 19 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 20 | |
| 21 | /-- The time derivative of spatial half-energy needs only one derivative of the parameter |
| 22 | path. Its coefficient is the genuine spatial covariant derivative of the actual time |
| 23 | velocity. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project |
| 24 | derivation |
| 25 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 26 | theorem m64ParameterMotion_half_energy_hasDerivAt |
| 27 | {g : RiemannianMetric n M} (D : LeviCivitaData g) |
| 28 | {Phi : ℝ × E → M} {O : Set (ℝ × E)} (hO : IsOpen O) |
| 29 | (hPhi : ContMDiffOn 𝓘(ℝ, ℝ × E) (𝓡 n) ∞ Phi O) |
| 30 | {h : ℝ → E} {t x : ℝ} (hh : DifferentiableAt ℝ h x) (hp : (t, h x) ∈ O) : |
| 31 | HasDerivAt |
| 32 | (fun s => (1 / 2 : ℝ) * g.inner (Phi (s, h x)) |
| 33 | (curveVelocity (fun y => Phi (s, h y)) x) |
| 34 | (curveVelocity (fun y => Phi (s, h y)) x)) |
| 35 | (g.inner (Phi (t, h x)) |
| 36 | (rampHorizontalCovariantDerivative D (fun y => Phi (t, h y)) |
| 37 | (fun y => curveVelocity (fun s => Phi (s, h y)) t) x) |
| 38 | (curveVelocity (fun y => Phi (t, h y)) x)) t := by |
| 39 | let H := fun y : ℝ => h x + (y - x) • deriv h x |
| 40 | have hHx : H x = h x := by simp [H] |
| 41 | have hH : HasDerivAt H (deriv h x) x := by |
| 42 | simpa only [H, id_eq, one_smul] using! |
| 43 | (((hasDerivAt_id x).sub_const x).smul_const (deriv h x)).const_add (h x) |
| 44 | have hHs : ContDiff ℝ ∞ H := by dsimp only [H]; fun_prop |
| 45 | let j := fun q : ℝ × ℝ => (q.1, H q.2) |
| 46 | have hj : ContMDiff 𝓘(ℝ, ℝ × ℝ) 𝓘(ℝ, ℝ × E) ∞ j := |
| 47 | (contDiff_fst.prodMk (hHs.comp contDiff_snd)).contMDiff |
| 48 | have hW : IsOpen (j ⁻¹' O) := hO.preimage hj.continuous |
| 49 | have hproxy : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n) ∞ |
| 50 | (fun q : ℝ × ℝ => Phi (q.1, H q.2)) (j ⁻¹' O) := |
| 51 | hPhi.comp hj.contMDiffOn (fun _ hq => hq) |
| 52 | have htx : (t, x) ∈ j ⁻¹' O := by simpa only [mem_preimage, j, hHx] using hp |
| 53 | have hvel (s : ℝ) (hs : (s, h x) ∈ O) : |
| 54 | curveVelocity (n := n) (fun y => Phi (s, H y)) x = |
| 55 | curveVelocity (fun y => Phi (s, h y)) x := by |
| 56 | have hsreg := (hPhi.contMDiffAt (hO.mem_nhds hs)).mdifferentiableAt (by simp) |
| 57 | rw [m64ParameterMotion_spatial_velocity (hHx.symm ▸ hsreg) hH.differentiableAt, |
| 58 | m64ParameterMotion_spatial_velocity hsreg hh, hHx, hH.deriv] |
| 59 | have hpoint := hPhi.contMDiffAt (hO.mem_nhds hp) |
| 60 | have hslice : ContMDiffAt 𝓘(ℝ, E) 𝓘(ℝ, ℝ × E) ∞ |
| 61 | (fun q : E => (t, q)) (h x) := (contDiffAt_const.prodMk contDiffAt_id).contMDiffAt |
| 62 | have hV := (m64ParameterMotion_timeVelocity_contMDiffAt hO hPhi hp).comp (h x) hslice |
| 63 | have hjet := m64Pullback_covariantDerivative_eq_affine_parameter D hh |
| 64 | (f := fun q => Phi (t, q)) (Y := fun q => curveVelocity (fun s => Phi (s, q)) t) |
| 65 | ((hpoint.comp (h x) hslice).mdifferentiableAt (by simp)) |
| 66 | (hV.mdifferentiableAt (by simp)) |
| 67 | have henergy := m64MovingCurve_half_energy_hasDerivAt D |
| 68 | (c := fun s y => Phi (s, H y)) hW hproxy htx |
| 69 | have heq : (fun s => (1 / 2 : ℝ) * g.inner (Phi (s, h x)) |
| 70 | (curveVelocity (fun y => Phi (s, h y)) x) |
| 71 | (curveVelocity (fun y => Phi (s, h y)) x)) =ᶠ[𝓝 t] |
| 72 | (fun s => (1 / 2 : ℝ) * g.inner (Phi (s, H x)) |
| 73 | (curveVelocity (fun y => Phi (s, H y)) x) |
| 74 | (curveVelocity (fun y => Phi (s, H y)) x)) := by |
| 75 | filter_upwards [(continuous_id.prodMk continuous_const).continuousAt |
| 76 | (hO.mem_nhds hp)] with s hs |
| 77 | rw [hHx, hvel s hs] |
| 78 | apply (henergy.congr_of_eventuallyEq heq).congr_deriv |
| 79 | have hdata : |
| 80 | (Phi (t, H x), |
| 81 | (rampHorizontalCovariantDerivative D (fun y => Phi (t, H y)) |
| 82 | (fun y => curveVelocity (fun s => Phi (s, H y)) t) x : EuclideanSpace ℝ (Fin n)), |
| 83 | (curveVelocity (fun y => Phi (t, H y)) x : EuclideanSpace ℝ (Fin n))) = |
| 84 | (Phi (t, h x), |
| 85 | (rampHorizontalCovariantDerivative D (fun y => Phi (t, h y)) |
| 86 | (fun y => curveVelocity (fun s => Phi (s, h y)) t) x : EuclideanSpace ℝ (Fin n)), |
| 87 | (curveVelocity (fun y => Phi (t, h y)) x : EuclideanSpace ℝ (Fin n))) := |
| 88 | Prod.ext (congrArg (fun q => Phi (t, q)) hHx) (Prod.ext hjet.symm (hvel t hp)) |
| 89 | exact congrArg (fun q : M × EuclideanSpace ℝ (Fin n) × EuclideanSpace ℝ (Fin n) => |
| 90 | g.inner q.1 q.2.1 q.2.2) hdata |
| 91 | |
| 92 | /-- The finite-parameter energy derivative is the derivative of the actual current minus the |
| 93 | actual base-curve acceleration pairing. The base velocity has its own derivative witness; no |
| 94 | second derivative of the parameter path is assumed. Source: Morgan--Tian (2007), Lemma 19.15 |
| 95 | and Corollary 19.16, pp. 447-449; project derivation |
| 96 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 97 | theorem m64ParameterMotion_energy_derivative_eq_divergence |
| 98 | {g : RiemannianMetric n M} (D : LeviCivitaData g) |
| 99 | {Phi : ℝ × E → M} {O : Set (ℝ × E)} (hO : IsOpen O) |
| 100 | (hPhi : ContMDiffOn 𝓘(ℝ, ℝ × E) (𝓡 n) ∞ Phi O) |
| 101 | {h : ℝ → E} {t x : ℝ} (hh : DifferentiableAt ℝ h x) (hp : (t, h x) ∈ O) |
| 102 | (hX : MDifferentiableAt 𝓘(ℝ, ℝ) ((𝓡 n).prod (𝓡 n)) (fun y => |
| 103 | (⟨Phi (t, h y), curveVelocity (fun z => Phi (t, h z)) y⟩ : |
| 104 | TangentBundle (𝓡 n) M)) x) : |
| 105 | deriv (fun s => (1 / 2 : ℝ) * g.inner (Phi (s, h x)) |
| 106 | (curveVelocity (fun y => Phi (s, h y)) x) |
| 107 | (curveVelocity (fun y => Phi (s, h y)) x)) t = |
| 108 | deriv (fun y => g.inner (Phi (t, h y)) |
| 109 | (curveVelocity (fun s => Phi (s, h y)) t) |
| 110 | (curveVelocity (fun z => Phi (t, h z)) y)) x - |
| 111 | g.inner (Phi (t, h x)) (curveVelocity (fun s => Phi (s, h x)) t) |
| 112 | (rampHorizontalCovariantDerivative D (fun y => Phi (t, h y)) |
| 113 | (fun y => curveVelocity (fun z => Phi (t, h z)) y) x) := by |
| 114 | have harg := (hasDerivAt_const x t).prodMk hh.hasDerivAt |
| 115 | have hc := ((hPhi.contMDiffAt (hO.mem_nhds hp)).mdifferentiableAt (by simp)).comp x |
| 116 | harg.differentiableAt.mdifferentiableAt |
| 117 | have hV := ((m64ParameterMotion_timeVelocity_contMDiffAt hO hPhi hp).mdifferentiableAt |
| 118 | (by simp)).comp x harg.differentiableAt.mdifferentiableAt |
| 119 | have hpair := M62.hasDerivAt_metric_pairing D |
| 120 | (γ := fun y => Phi (t, h y)) |
| 121 | (Y := fun y => curveVelocity (fun s => Phi (s, h y)) t) |
| 122 | (Z := fun y => curveVelocity (fun z => Phi (t, h z)) y) hc hV hX |
| 123 | have henergy := m64ParameterMotion_half_energy_hasDerivAt D hO hPhi hh hp |
| 124 | rw [henergy.deriv, hpair.deriv] |
| 125 | ring |
| 126 | |
| 127 | end PoincareMT |