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.Moving.CurveEnergy |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Pullback.ParameterFirstJet |
| 3 | |
| 4 | /-! Actual time velocities and spatial first jets for a smooth |
| 5 | motion with differentiable parameters. Source: MT Lemma 19.15, |
| 6 | pp. 447-449; finite-conormal-variation derivation. -/ |
| 7 | |
| 8 | noncomputable section |
| 9 | set_option autoImplicit false |
| 10 | set_option warningAsError true |
| 11 | set_option backward.isDefEq.respectTransparency false |
| 12 | |
| 13 | open Set 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 | /-- The genuine time velocity of a smooth motion is a smooth tangent-bundle map on its open |
| 23 | parameter domain. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 24 | project derivation |
| 25 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 26 | theorem m64ParameterMotion_timeVelocity_contMDiffAt |
| 27 | {Phi : ℝ × E → M} {O : Set (ℝ × E)} (hO : IsOpen O) |
| 28 | (hPhi : ContMDiffOn 𝓘(ℝ, ℝ × E) (𝓡 n) ∞ Phi O) |
| 29 | {q : ℝ × E} (hq : q ∈ O) : |
| 30 | ContMDiffAt 𝓘(ℝ, ℝ × E) ((𝓡 n).prod (𝓡 n)) ∞ |
| 31 | (fun w : ℝ × E => (⟨Phi w, curveVelocity (fun s => Phi (s, w.2)) w.1⟩ : |
| 32 | TangentBundle (𝓡 n) M)) q := by |
| 33 | have hqreg := hPhi.contMDiffAt (hO.mem_nhds hq) |
| 34 | have hvec : ContMDiffAt 𝓘(ℝ, ℝ × E) |
| 35 | ((𝓘(ℝ, ℝ × E)).prod 𝓘(ℝ, ℝ × E)) ∞ |
| 36 | (fun w : ℝ × E => (⟨w, (1, 0)⟩ : TangentBundle 𝓘(ℝ, ℝ × E) (ℝ × E))) q := by |
| 37 | rw [contMDiffAt_totalSpace] |
| 38 | exact ⟨contMDiffAt_id, by simpa using contMDiffAt_const (c := ((1 : ℝ), (0 : E)))⟩ |
| 39 | have hpush := (hqreg.mfderiv_const (m := ∞) (by simp)).clm_apply_of_inCoordinates |
| 40 | hvec hqreg |
| 41 | apply hpush.congr_of_eventuallyEq |
| 42 | filter_upwards [hO.mem_nhds hq] with w hw |
| 43 | have hline := hasFDerivAt_prodMk_left (𝕜 := ℝ) w.1 w.2 |
| 44 | have hchain := mfderiv_comp_apply w.1 |
| 45 | ((hPhi.contMDiffAt (hO.mem_nhds hw)).mdifferentiableAt (by simp)) |
| 46 | hline.differentiableAt.mdifferentiableAt (1 : ℝ) |
| 47 | rw [mfderiv_eq_fderiv, hline.fderiv] at hchain |
| 48 | exact congrArg (fun v : TangentSpace (𝓡 n) (Phi w) => |
| 49 | (⟨Phi w, v⟩ : TangentBundle (𝓡 n) M)) hchain |
| 50 | |
| 51 | omit [IsManifold (𝓡 n) ∞ M] in |
| 52 | /-- The actual spatial velocity of a motion uses only the value and first derivative of its |
| 53 | parameter curve. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 54 | project derivation |
| 55 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 56 | theorem m64ParameterMotion_spatial_velocity |
| 57 | {Phi : ℝ × E → M} {h : ℝ → E} {t x : ℝ} |
| 58 | (hPhi : MDifferentiableAt 𝓘(ℝ, ℝ × E) (𝓡 n) Phi (t, h x)) |
| 59 | (hh : DifferentiableAt ℝ h x) : |
| 60 | curveVelocity (n := n) (fun y => Phi (t, h y)) x = |
| 61 | mfderiv 𝓘(ℝ, ℝ × E) (𝓡 n) Phi (t, h x) (0, deriv h x) := by |
| 62 | have harg := (hasDerivAt_const x t).prodMk hh.hasDerivAt |
| 63 | have hd : mfderiv 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ × E) (fun y => (t, h y)) x 1 = |
| 64 | (0, deriv h x) := by |
| 65 | rw [mfderiv_eq_fderiv, harg.hasFDerivAt.fderiv] |
| 66 | exact ContinuousLinearMap.toSpanSingleton_apply_one ℝ _ |
| 67 | have hc := mfderiv_comp_apply x hPhi harg.differentiableAt.mdifferentiableAt (1 : ℝ) |
| 68 | rw [hd] at hc |
| 69 | exact hc |
| 70 | |
| 71 | end PoincareMT |