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.Uniqueness.Imports |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Basic |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.Operations |
| 4 | import Mathlib.Analysis.Calculus.ContDiff.FTaylorSeries |
| 5 | import Mathlib.Analysis.Calculus.TangentCone.Prod |
| 6 | |
| 7 | /-! |
| 8 | # Spatial derivatives at an included time endpoint |
| 9 | |
| 10 | The spatial inclusion v -> (0,v) restricts every spacetime jet without |
| 11 | increasing its norm. Used for the terminal metric convergence in |
| 12 | Morgan-Tian Theorem 12.28, pp. 323-324, and Theorem 11.8. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped ContDiff Topology Pointwise |
| 19 | |
| 20 | variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 21 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 22 | |
| 23 | /-- Restricting a smooth function on a time-space product to its |
| 24 | included time zero retains precisely the spatial slots of every jet. |
| 25 | This applies to one-sided time intervals with unique derivatives. -/ |
| 26 | theorem iteratedFDeriv_zero_slice_of_contDiffOn |
| 27 | {J : Set ℝ} {U : Set E} {f : ℝ × E → F} |
| 28 | (hJ : UniqueDiffOn ℝ J) (hzero : (0 : ℝ) ∈ J) (hU : IsOpen U) |
| 29 | (hf : ContDiffOn ℝ ∞ f (J ×ˢ U)) {x : E} (hx : x ∈ U) (r : ℕ) : |
| 30 | iteratedFDeriv ℝ r (fun y => f (0, y)) x = |
| 31 | (iteratedFDerivWithin ℝ r f (J ×ˢ U) (0, x)).compContinuousLinearMap |
| 32 | (fun _ => ContinuousLinearMap.inr ℝ ℝ E) := by |
| 33 | let L := ContinuousLinearMap.inr ℝ ℝ E |
| 34 | have hpre : L ⁻¹' (J ×ˢ U) = U := by |
| 35 | ext y |
| 36 | simp only [mem_preimage, mem_prod, L, ContinuousLinearMap.inr_apply, hzero, true_and] |
| 37 | have hpre_unique : UniqueDiffOn ℝ (L ⁻¹' (J ×ˢ U)) := hpre.symm ▸ hU.uniqueDiffOn |
| 38 | have hcomp := L.iteratedFDerivWithin_comp_right hf (hJ.prod hU.uniqueDiffOn) |
| 39 | hpre_unique ⟨hzero, hx⟩ (i := r) (by exact_mod_cast le_top (a := (r : ℕ∞))) |
| 40 | rw [hpre, iteratedFDerivWithin_of_isOpen (𝕜 := ℝ) r hU hx] at hcomp |
| 41 | exact hcomp |
| 42 | |
| 43 | /-- Translating the included time before restricting spatial slots gives |
| 44 | the same identity at every time, including either boundary of an interval. |
| 45 | Used for the strong-neck time slab in Morgan-Tian Theorem 12.28. -/ |
| 46 | theorem iteratedFDeriv_time_slice_of_contDiffOn |
| 47 | {J : Set ℝ} {U : Set E} {f : ℝ × E → F} |
| 48 | (hJ : UniqueDiffOn ℝ J) {u : ℝ} (hu : u ∈ J) (hU : IsOpen U) |
| 49 | (hf : ContDiffOn ℝ ∞ f (J ×ˢ U)) {x : E} (hx : x ∈ U) (r : ℕ) : |
| 50 | iteratedFDeriv ℝ r (fun y => f (u, y)) x = |
| 51 | (iteratedFDerivWithin ℝ r f (J ×ˢ U) (u, x)).compContinuousLinearMap |
| 52 | (fun _ => ContinuousLinearMap.inr ℝ ℝ E) := by |
| 53 | let K : Set ℝ := (fun t => t - u) '' J |
| 54 | have hK : UniqueDiffOn ℝ K := hJ.image |
| 55 | (fun t _ => ((hasFDerivAt_id t).sub_const u).hasFDerivWithinAt) |
| 56 | (fun _ _ => Function.surjective_id.denseRange) |
| 57 | have hzero : (0 : ℝ) ∈ K := ⟨u, hu, sub_self u⟩ |
| 58 | have hmap : MapsTo (fun p : ℝ × E => (u, 0) + p) (K ×ˢ U) (J ×ˢ U) := by |
| 59 | rintro p ⟨⟨t, ht, htp⟩, hp⟩ |
| 60 | refine ⟨?_, ?_⟩ |
| 61 | · change u + p.1 ∈ J |
| 62 | rw [← htp] |
| 63 | simpa only [add_sub_cancel] using ht |
| 64 | · simpa only [Prod.snd_add, zero_add] using hp |
| 65 | have hshift : (u, (0 : E)) +ᵥ (K ×ˢ U) = J ×ˢ U := by |
| 66 | change (fun p : ℝ × E => (u, 0) + p) '' (K ×ˢ U) = J ×ˢ U |
| 67 | apply Subset.antisymm (image_subset_iff.mpr hmap) |
| 68 | intro p hp |
| 69 | refine ⟨(p.1 - u, p.2), ⟨⟨p.1, hp.1, rfl⟩, hp.2⟩, ?_⟩ |
| 70 | ext <;> simp [add_sub_cancel] |
| 71 | have hs := hf.comp (contDiff_const.add contDiff_id).contDiffOn hmap |
| 72 | have hslice := iteratedFDeriv_zero_slice_of_contDiffOn hK hzero hU hs hx r |
| 73 | dsimp only [Function.comp_def, id_eq] at hslice |
| 74 | rw [iteratedFDerivWithin_comp_add_left, hshift] at hslice |
| 75 | simpa only [Function.comp_def, Prod.mk_add_mk, add_zero, zero_add] using hslice |
| 76 | |
| 77 | /-- The spatial jets vary continuously within the retained time-space |
| 78 | domain, including its time endpoints. Used at moving neck centers in |
| 79 | Morgan-Tian Theorem 12.28. -/ |
| 80 | theorem continuousOn_spatial_jet_of_contDiffOn |
| 81 | {J : Set ℝ} {U : Set E} {f : ℝ × E → F} |
| 82 | (hJ : UniqueDiffOn ℝ J) (hU : IsOpen U) |
| 83 | (hf : ContDiffOn ℝ ∞ f (J ×ˢ U)) (r : ℕ) : |
| 84 | ContinuousOn (fun p : ℝ × E => iteratedFDeriv ℝ r (fun y => f (p.1, y)) p.2) |
| 85 | (J ×ˢ U) := by |
| 86 | have hc := hf.continuousOn_iteratedFDerivWithin |
| 87 | (show (r : ℕ∞ω) ≤ ∞ by exact_mod_cast le_top (a := (r : ℕ∞))) |
| 88 | (hJ.prod hU.uniqueDiffOn) |
| 89 | have hlinear := (ContinuousMultilinearMap.compContinuousLinearMapL |
| 90 | (F := F) (fun _ : Fin r => ContinuousLinearMap.inr ℝ ℝ E)).continuous |
| 91 | apply (hlinear.comp_continuousOn hc).congr |
| 92 | intro p hp |
| 93 | exact iteratedFDeriv_time_slice_of_contDiffOn hJ hp.1 hU hf hp.2 r |
| 94 | |
| 95 | /-- Spatial jet errors at time zero are bounded by the full |
| 96 | within-domain spacetime jet errors, even when the two time domains differ. -/ |
| 97 | theorem norm_spatial_jet_sub_le_spacetime_jet_sub |
| 98 | {J K : Set ℝ} {U : Set E} {f g : ℝ × E → F} |
| 99 | (hJ : UniqueDiffOn ℝ J) (hK : UniqueDiffOn ℝ K) |
| 100 | (hzeroJ : (0 : ℝ) ∈ J) (hzeroK : (0 : ℝ) ∈ K) (hU : IsOpen U) |
| 101 | (hf : ContDiffOn ℝ ∞ f (J ×ˢ U)) (hg : ContDiffOn ℝ ∞ g (K ×ˢ U)) |
| 102 | {x : E} (hx : x ∈ U) (r : ℕ) : |
| 103 | ‖iteratedFDeriv ℝ r (fun y => f (0, y)) x - |
| 104 | iteratedFDeriv ℝ r (fun y => g (0, y)) x‖ ≤ |
| 105 | ‖iteratedFDerivWithin ℝ r f (J ×ˢ U) (0, x) - |
| 106 | iteratedFDerivWithin ℝ r g (K ×ˢ U) (0, x)‖ := by |
| 107 | rw [iteratedFDeriv_zero_slice_of_contDiffOn hJ hzeroJ hU hf hx, |
| 108 | iteratedFDeriv_zero_slice_of_contDiffOn hK hzeroK hU hg hx] |
| 109 | let L := ContinuousLinearMap.inr ℝ ℝ E |
| 110 | let B := iteratedFDerivWithin ℝ r f (J ×ˢ U) (0, x) - |
| 111 | iteratedFDerivWithin ℝ r g (K ×ˢ U) (0, x) |
| 112 | change ‖B.compContinuousLinearMap (fun _ => L)‖ ≤ ‖B‖ |
| 113 | exact (B.norm_compContinuousLinearMap_le (fun _ => L)).trans |
| 114 | ((mul_le_mul_of_nonneg_left (Finset.prod_le_one |
| 115 | (fun _ _ => norm_nonneg _) (fun _ _ => ContinuousLinearMap.norm_inr_le_one ℝ ℝ E)) |
| 116 | (norm_nonneg B)).trans_eq (mul_one _)) |