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 Mathlib.Analysis.Calculus.FDeriv.CompCLM |
| 2 | import Mathlib.Analysis.SpecialFunctions.Sqrt |
| 3 | |
| 4 | /-! |
| 5 | # The coordinate kinetic Lagrangian |
| 6 | |
| 7 | The genuine velocity derivative of the quadratic metric term is twice |
| 8 | the metric dual. Spatial and time derivatives retain all dependence of |
| 9 | the metric and scalar potential. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped ContDiff |
| 15 | |
| 16 | namespace PoincareMT.ReducedVolume |
| 17 | |
| 18 | variable {Y : Type*} [NormedAddCommGroup Y] [NormedSpace ℝ Y] |
| 19 | |
| 20 | /-- The actual quadratic velocity function has the expected derivative for a symmetric form. -/ |
| 21 | theorem hasFDerivAt_quadratic_of_symmetric (B : Y →L[ℝ] Y →L[ℝ] ℝ) |
| 22 | (hsym : ∀ v w : Y, B v w = B w v) (v : Y) : |
| 23 | HasFDerivAt (fun w ↦ B w w) ((2 : ℝ) • B v) v := by |
| 24 | have hd : HasFDerivAt (fun w : Y ↦ B w w) (B v + B.flip v) v := by |
| 25 | simpa only [ContinuousLinearMap.comp_id, id_eq] using |
| 26 | (B.hasFDerivAt.clm_apply (hasFDerivAt_id v)) |
| 27 | have heq : B v + B.flip v = (2 : ℝ) • B v := by |
| 28 | ext w |
| 29 | simp only [smul_apply, smul_eq_mul, add_apply, ContinuousLinearMap.flip_apply] |
| 30 | rw [hsym w v] |
| 31 | ring |
| 32 | rwa [heq] at hd |
| 33 | |
| 34 | /-- The square-root-weighted potential-plus-kinetic function in fixed coordinates. -/ |
| 35 | noncomputable def kineticLagrangian (B : Y × ℝ → Y →L[ℝ] Y →L[ℝ] ℝ) |
| 36 | (R : Y × ℝ → ℝ) (a : ℝ × Y × Y) : ℝ := |
| 37 | Real.sqrt a.1 * (R (a.2.1, a.1) + B (a.2.1, a.1) a.2.2 a.2.2) |
| 38 | |
| 39 | /-- Smooth metric and potential germs give a smooth Lagrangian at every velocity over that point. -/ |
| 40 | theorem kineticLagrangian_contDiffAt {B : Y × ℝ → Y →L[ℝ] Y →L[ℝ] ℝ} |
| 41 | {R : Y × ℝ → ℝ} {a : ℝ × Y × Y} {k : ℕ∞ω} |
| 42 | (hB : ContDiffAt ℝ k B (a.2.1, a.1)) |
| 43 | (hR : ContDiffAt ℝ k R (a.2.1, a.1)) (ht : 0 < a.1) : |
| 44 | ContDiffAt ℝ k (kineticLagrangian B R) a := by |
| 45 | have hcoords : ContDiffAt ℝ k (fun b : ℝ × Y × Y ↦ (b.2.1, b.1)) a := |
| 46 | contDiffAt_snd.fst.prodMk contDiffAt_fst |
| 47 | exact (contDiffAt_fst.sqrt ht.ne').mul ((hR.comp a hcoords).add |
| 48 | (((hB.comp a hcoords).clm_apply contDiffAt_snd.snd).clm_apply contDiffAt_snd.snd)) |
| 49 | |
| 50 | /-- The true total differential in a velocity-only direction is the coordinate momentum. -/ |
| 51 | theorem kineticLagrangian_velocity_derivative {B : Y × ℝ → Y →L[ℝ] Y →L[ℝ] ℝ} |
| 52 | {R : Y × ℝ → ℝ} {a : ℝ × Y × Y} |
| 53 | (hL : DifferentiableAt ℝ (kineticLagrangian B R) a) |
| 54 | (hsym : ∀ v w : Y, B (a.2.1, a.1) v w = B (a.2.1, a.1) w v) (w : Y) : |
| 55 | fderiv ℝ (kineticLagrangian B R) a (0, 0, w) = |
| 56 | 2 * Real.sqrt a.1 * B (a.2.1, a.1) a.2.2 w := by |
| 57 | let j : Y → ℝ × Y × Y := fun v ↦ (a.1, a.2.1, v) |
| 58 | let j' : Y →L[ℝ] ℝ × Y × Y := (0 : Y →L[ℝ] ℝ).prod |
| 59 | ((0 : Y →L[ℝ] Y).prod (ContinuousLinearMap.id ℝ Y)) |
| 60 | have hj : HasFDerivAt j j' a.2.2 := |
| 61 | (hasFDerivAt_const a.1 a.2.2).prodMk |
| 62 | ((hasFDerivAt_const a.2.1 a.2.2).prodMk (hasFDerivAt_id a.2.2)) |
| 63 | have hc := hL.hasFDerivAt.comp (f := j) a.2.2 hj |
| 64 | have hq := ((hasFDerivAt_const (R (a.2.1, a.1)) a.2.2).add |
| 65 | (hasFDerivAt_quadratic_of_symmetric (B (a.2.1, a.1)) hsym a.2.2)).const_mul |
| 66 | (Real.sqrt a.1) |
| 67 | have hcalc := congrArg (fun D : Y →L[ℝ] ℝ ↦ D w) (hc.unique hq) |
| 68 | simp only [j', ContinuousLinearMap.comp_apply, ContinuousLinearMap.prod_apply, |
| 69 | zero_apply, ContinuousLinearMap.id_apply, smul_apply, smul_eq_mul, zero_add] at hcalc |
| 70 | calc |
| 71 | _ = Real.sqrt a.1 * (2 * B (a.2.1, a.1) a.2.2 w) := hcalc |
| 72 | _ = _ := by ring |
| 73 | |
| 74 | end PoincareMT.ReducedVolume |