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.Analysis.Calculus.MixedDerivatives |
| 2 | import PoincareLib.Geometry.Manifold.VectorField.Derivation |
| 3 | import Mathlib.Geometry.Manifold.ContMDiffMFDeriv |
| 4 | |
| 5 | /-! # Interchanging time and spatial differentiation on a manifold -/ |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | open scoped Manifold ContDiff Topology |
| 11 | open Set Filter |
| 12 | |
| 13 | namespace Poincare.Manifold |
| 14 | |
| 15 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 16 | {H : Type*} [TopologicalSpace H] {I : ModelWithCorners ℝ E H} |
| 17 | {M : Type*} [TopologicalSpace M] [ChartedSpace H M] [IsManifold I ∞ M] |
| 18 | [I.Boundaryless] |
| 19 | |
| 20 | omit [I.Boundaryless] in |
| 21 | /-- The partial time derivative of a smooth spacetime scalar is smooth. -/ |
| 22 | lemma contMDiffAt_deriv_time |
| 23 | {f : ℝ × M → ℝ} {t : ℝ} {x : M} |
| 24 | (hf : ContMDiffAt (𝓘(ℝ, ℝ).prod I) 𝓘(ℝ, ℝ) ∞ f (t, x)) : |
| 25 | ContMDiffAt (𝓘(ℝ, ℝ).prod I) 𝓘(ℝ, ℝ) ∞ |
| 26 | (fun p : ℝ × M => deriv (fun s => f (s, p.2)) p.1) (t, x) := by |
| 27 | have hc : ContMDiffAt ((𝓘(ℝ, ℝ).prod I).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) ∞ |
| 28 | (fun p : (ℝ × M) × ℝ => f (p.2, p.1.2)) ((t, x), t) := |
| 29 | hf.comp_of_eq (contMDiffAt_snd.prodMk |
| 30 | (contMDiffAt_snd.comp ((t, x), t) contMDiffAt_fst)) rfl |
| 31 | have hd := hc.mfderiv (fun p s => f (s, p.2)) Prod.fst |
| 32 | contMDiffAt_fst (m := ∞) (by simp) |
| 33 | have h := hd.clm_apply (contMDiffAt_const (c := (1 : ℝ))) |
| 34 | convert h using 1 |
| 35 | funext p |
| 36 | rw [inTangentCoordinates_model_space] |
| 37 | simp only [mfderiv_eq_fderiv, deriv] |
| 38 | |
| 39 | /-- Chart transport of equality of mixed derivatives. -/ |
| 40 | lemma hasDerivAt_mvfderiv_time |
| 41 | {f : ℝ × M → ℝ} {df : M → ℝ} {t : ℝ} {x : M} |
| 42 | (hf : ContMDiffAt (𝓘(ℝ, ℝ).prod I) 𝓘(ℝ, ℝ) ∞ f (t, x)) |
| 43 | (hdf : ∀ y, HasDerivAt (fun s => f (s, y)) (df y) t) (v : TangentSpace I x) : |
| 44 | HasDerivAt (fun s => mvfderiv I (fun y => f (s, y)) x v) |
| 45 | (mvfderiv I df x v) t := by |
| 46 | have hdfx : MDifferentiableAt I 𝓘(ℝ, ℝ) df x := by |
| 47 | have h := (contMDiffAt_deriv_time hf).comp x (contMDiffAt_const.prodMk contMDiffAt_id) |
| 48 | have he : (fun y => deriv (fun s => f (s, y)) t) = df := |
| 49 | funext fun y => (hdf y).deriv |
| 50 | change ContMDiffAt I 𝓘(ℝ, ℝ) ∞ (fun y => deriv (fun s => f (s, y)) t) x at h |
| 51 | rw [he] at h |
| 52 | exact h.mdifferentiableAt (by simp) |
| 53 | let e := extChartAt I x |
| 54 | have hx : e.symm (e x) = x := e.left_inv (mem_extChartAt_source x) |
| 55 | have hs : ContMDiffAt 𝓘(ℝ, E) I ∞ e.symm (e x) := |
| 56 | (contMDiffOn_extChartAt_symm x).contMDiffAt |
| 57 | ((isOpen_extChartAt_target x).mem_nhds (mem_extChartAt_target x)) |
| 58 | have hc : ContDiffAt ℝ ∞ (fun p : ℝ × E => f (p.1, e.symm p.2)) (t, e x) := by |
| 59 | have hp : ContMDiffAt (𝓘(ℝ, ℝ).prod 𝓘(ℝ, E)) (𝓘(ℝ, ℝ).prod I) ∞ |
| 60 | (fun p : ℝ × E => (p.1, e.symm p.2)) (t, e x) := |
| 61 | contMDiffAt_fst.prodMk (hs.comp (t, e x) contMDiffAt_snd) |
| 62 | have h := hf.comp_of_eq hp (by simp [hx]) |
| 63 | simp +instances only [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] at h |
| 64 | exact h.contDiffAt |
| 65 | let w : E := (mfderiv 𝓘(ℝ, E) I e.symm (e x)).inverse v |
| 66 | have hi := VectorField.isInvertible_mfderiv_extChartAt_symm |
| 67 | (I := I) (p := x) (mem_extChartAt_target x) |
| 68 | have h := Analysis.hasDerivAt_fderiv_time hc (fun z => hdf (e.symm z)) w |
| 69 | have hd : fderiv ℝ (df ∘ e.symm) (e x) w = mvfderiv I df x v := by |
| 70 | have h := VectorField.fderiv_comp_extChartAt_symm |
| 71 | (I := I) (f := df) (p := x) (by simpa only [e] using (hx.symm ▸ hdfx)) |
| 72 | (mem_extChartAt_target x) w |
| 73 | change fderiv ℝ (df ∘ e.symm) (e x) w = |
| 74 | mfderiv I 𝓘(ℝ, ℝ) df (e.symm (e x)) (mfderiv 𝓘(ℝ, E) I e.symm (e x) w) at h |
| 75 | dsimp only [w] at h |
| 76 | rw [hi.self_apply_inverse, hx] at h |
| 77 | exact h |
| 78 | apply (h.congr_deriv hd).congr_of_eventuallyEq |
| 79 | have hevent : ∀ᶠ s in 𝓝 t, MDifferentiableAt I 𝓘(ℝ, ℝ) (fun y => f (s, y)) x := by |
| 80 | have hnear := ((contMDiffAt_iff_contMDiffAt_nhds (by simp)).mp |
| 81 | (hf.of_le (show (1 : WithTop ℕ∞) ≤ ∞ from WithTop.coe_le_coe.mpr le_top))) |
| 82 | have htime : Tendsto (fun s : ℝ => (s, x)) (𝓝 t) (𝓝 (t, x)) := |
| 83 | continuousAt_id.prodMk continuousAt_const |
| 84 | filter_upwards [htime.eventually hnear] with s hs |
| 85 | exact (hs.comp x (contMDiffAt_const.prodMk contMDiffAt_id)).mdifferentiableAt (by simp) |
| 86 | filter_upwards [hevent] with s hs |
| 87 | have h := VectorField.fderiv_comp_extChartAt_symm |
| 88 | (I := I) (f := fun y => f (s, y)) (p := x) (by simpa only [e] using (hx.symm ▸ hs)) |
| 89 | (mem_extChartAt_target x) w |
| 90 | change fderiv ℝ ((fun y => f (s, y)) ∘ e.symm) (e x) w = |
| 91 | mfderiv I 𝓘(ℝ, ℝ) (fun y => f (s, y)) (e.symm (e x)) |
| 92 | (mfderiv 𝓘(ℝ, E) I e.symm (e x) w) at h |
| 93 | dsimp only [w] at h |
| 94 | rw [hi.self_apply_inverse, hx] at h |
| 95 | exact h.symm |
| 96 | |
| 97 | end Poincare.Manifold |