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.Surgery.StandardCap.Persistence.Analysis.ODE.ODEFirstVariation |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Persistence.Analysis.Compactness.CompactSmoothConvergence |
| 3 | |
| 4 | /-! |
| 5 | # The full linear first variational equation |
| 6 | |
| 7 | The whole parameter derivative is retained as a continuous linear map. |
| 8 | Its actual time derivative is identified by the checked directional |
| 9 | variation equation. Compact smooth field convergence is preserved by |
| 10 | the augmentation. Morgan--Tian, Claim 16.6, pp. 371-372; see derivation 22. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped ContDiff Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | section LinearVariation |
| 22 | |
| 23 | variable {E P : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 24 | [NormedAddCommGroup P] [NormedSpace ℝ P] |
| 25 | |
| 26 | /-- The autonomous field for a trajectory and its full linear |
| 27 | parameter derivative. -/ |
| 28 | noncomputable def linearVariationalField (F : E → E) (z : E × (P →L[ℝ] E)) : |
| 29 | E × (P →L[ℝ] E) := (F z.1, (fderiv ℝ F z.1).comp z.2) |
| 30 | |
| 31 | /-- The actual trajectory and its derivative with respect to the |
| 32 | spatial parameter, before imposing the ODE. -/ |
| 33 | noncomputable def linearVariation (γ : P × ℝ → E) (z : P × ℝ) : E × (P →L[ℝ] E) := |
| 34 | (γ z, fderiv ℝ (fun p => γ (p, z.2)) z.1) |
| 35 | |
| 36 | /-- A smooth field has a smooth full variational field. -/ |
| 37 | theorem ContDiff.linearVariationalField {F : E → E} (hF : ContDiff ℝ ∞ F) : |
| 38 | ContDiff ℝ ∞ (linearVariationalField (P := P) F) := |
| 39 | (hF.comp contDiff_fst).prodMk |
| 40 | (((hF.fderiv_right (m := ∞) (by simp)).comp contDiff_fst).clm_comp contDiff_snd) |
| 41 | |
| 42 | /-- Local smoothness of a field at the actual phase suffices for |
| 43 | local smoothness of its full variational field. -/ |
| 44 | theorem ContDiffAt.linearVariationalField {F : E → E} {z : E × (P →L[ℝ] E)} |
| 45 | (hF : ContDiffAt ℝ ∞ F z.1) : |
| 46 | ContDiffAt ℝ ∞ (linearVariationalField F) z := |
| 47 | (hF.comp z contDiffAt_fst).prodMk |
| 48 | (((hF.fderiv_right (by simp)).comp z contDiffAt_fst).clm_comp contDiffAt_snd) |
| 49 | |
| 50 | /-- The full parameter derivative inherits joint smoothness from the |
| 51 | actual solution family, by the spatial slice chain rule. -/ |
| 52 | theorem ContDiffAt.linearVariation {γ : P × ℝ → E} {z : P × ℝ} |
| 53 | (hγ : ContDiffAt ℝ ∞ γ z) : ContDiffAt ℝ ∞ (linearVariation γ) z := by |
| 54 | have hfull : ContDiffAt ℝ ∞ |
| 55 | (fun w => (γ w, (fderiv ℝ γ w).comp (ContinuousLinearMap.inl ℝ P ℝ))) z := |
| 56 | hγ.prodMk ((hγ.fderiv_right (m := ∞) (by simp)).clm_comp contDiffAt_const) |
| 57 | have hnear : ∀ᶠ w in 𝓝 z, DifferentiableAt ℝ γ w := |
| 58 | ((hγ.of_le (by simp : (1 : WithTop ℕ∞) ≤ ∞)).eventually (by decide)).mono |
| 59 | fun _ hw => hw.differentiableAt one_ne_zero |
| 60 | apply hfull.congr_of_eventuallyEq |
| 61 | filter_upwards [hnear] with w hw |
| 62 | refine Prod.ext rfl ?_ |
| 63 | have hinc : HasFDerivAt (fun q : P => (q, w.2)) (ContinuousLinearMap.inl ℝ P ℝ) w.1 := |
| 64 | (hasFDerivAt_id w.1).prodMk (hasFDerivAt_const w.2 w.1) |
| 65 | exact (hw.hasFDerivAt.comp w.1 hinc).fderiv |
| 66 | |
| 67 | /-- Actual full first variations satisfy their augmented ODE. Smoothness |
| 68 | gives the linear-map derivative, and evaluation identifies it in every |
| 69 | direction by the already proved mixed-derivative equation. -/ |
| 70 | theorem hasDerivAt_linearVariation |
| 71 | {F : E → E} {γ : P × ℝ → E} {p : P} {t : ℝ} |
| 72 | (hγ : ContDiffAt ℝ ∞ γ (p, t)) |
| 73 | (hode : ∀ᶠ q in 𝓝 p, HasDerivAt (fun s => γ (q, s)) (F (γ (q, t))) t) |
| 74 | (hF : DifferentiableAt ℝ F (γ (p, t))) : |
| 75 | HasDerivAt (fun s => linearVariation γ (p, s)) |
| 76 | (linearVariationalField F (linearVariation γ (p, t))) t := by |
| 77 | let J : ℝ → P →L[ℝ] E := fun s => fderiv ℝ (fun q => γ (q, s)) p |
| 78 | have hJs : ContDiffAt ℝ ∞ J t := |
| 79 | (hγ.linearVariation.comp t (contDiffAt_const.prodMk contDiffAt_id)).snd |
| 80 | have hJ : HasDerivAt J (deriv J t) t := (hJs.differentiableAt (by simp)).hasDerivAt |
| 81 | have hder : deriv J t = (fderiv ℝ F (γ (p, t))).comp (J t) := by |
| 82 | ext v |
| 83 | have heval := hJ.clm_apply (hasDerivAt_const t v) |
| 84 | have hactual := (hasDerivAt_first_variation hγ hode hF v).snd |
| 85 | have heq := heval.unique hactual |
| 86 | simpa only [ContinuousLinearMap.map_zero, add_zero, firstVariationalField, |
| 87 | ContinuousLinearMap.comp_apply, J] using heq |
| 88 | exact hode.self_of_nhds.prodMk (hJ.congr_deriv hder) |
| 89 | |
| 90 | end LinearVariation |
| 91 | |
| 92 | /-- Full linear augmentation preserves compact smooth field |
| 93 | convergence, including every higher jet needed for repeating the |
| 94 | variational equation. -/ |
| 95 | theorem CompactSmoothConvergenceOn.linearVariationalField |
| 96 | {E P : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] |
| 97 | [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] |
| 98 | {ι : Type*} {l : Filter ι} {Fseq : ι → E → E} {F : E → E} |
| 99 | (h : CompactSmoothConvergenceOn Fseq F l univ) : |
| 100 | CompactSmoothConvergenceOn (fun i => linearVariationalField (P := P) (Fseq i)) |
| 101 | (linearVariationalField F) l univ := by |
| 102 | let X := E × (P →L[ℝ] E) |
| 103 | let L := ContinuousLinearMap.fst ℝ E (P →L[ℝ] E) |
| 104 | have hpair : CompactSmoothConvergenceOn |
| 105 | (fun i (z : X) => (Fseq i z.1, _root_.fderiv ℝ (Fseq i) z.1)) |
| 106 | (fun z : X => (F z.1, _root_.fderiv ℝ F z.1)) l univ := by |
| 107 | simpa only [preimage_univ, Function.comp_def, X, L, ContinuousLinearMap.coe_fst'] using |
| 108 | (h.prodMk h.fderiv).comp_continuousLinearMap L |
| 109 | have hlin : CompactSmoothConvergenceOn |
| 110 | (fun _ : ι => (Prod.snd : X → P →L[ℝ] E)) Prod.snd l univ := |
| 111 | CompactSmoothConvergenceOn.constant isOpen_univ contDiff_snd.contDiffOn |
| 112 | let H (z : (E × (E →L[ℝ] E)) × (P →L[ℝ] E)) : X := (z.1.1, z.1.2.comp z.2) |
| 113 | have hH : ContDiff ℝ ∞ H := by |
| 114 | exact (contDiff_fst.comp contDiff_fst).prodMk |
| 115 | ((contDiff_snd.comp contDiff_fst).clm_comp contDiff_snd) |
| 116 | exact (hpair.prodMk hlin).comp_smooth isOpen_univ hH.contDiffOn (fun _ _ => mem_univ _) |