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.Jets.UniformCompactDerivative |
| 2 | |
| 3 | /-! |
| 4 | # Compact convergence of arbitrary finite jets under composition |
| 5 | |
| 6 | The induction applies the differentiated chain rule to the compact |
| 7 | value-and-derivative image. It uses actual neighborhood identities at |
| 8 | every stage, so totalized derivatives outside the smooth domains do |
| 9 | not enter the proof. This supplies the higher variational fields for |
| 10 | 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 | /-- Zeroth-jet convergence is ordinary uniform convergence. -/ |
| 22 | theorem tendstoUniformlyOn_of_iteratedFDeriv_zero |
| 23 | {E F ι : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 24 | [NormedAddCommGroup F] [NormedSpace ℝ F] {l : Filter ι} |
| 25 | {fseq : ι → E → F} {f : E → F} {K : Set E} |
| 26 | (h : TendstoUniformlyOn (fun i => iteratedFDeriv ℝ 0 (fseq i)) |
| 27 | (iteratedFDeriv ℝ 0 f) l K) : TendstoUniformlyOn fseq f l K := by |
| 28 | simpa only [Function.comp_def, iteratedFDeriv_zero_apply] using |
| 29 | (ContinuousMultilinearMap.uniformContinuous_eval_const |
| 30 | (0 : Fin 0 → E)).comp_tendstoUniformlyOn h |
| 31 | |
| 32 | /-- The right currying isometry reconstructs the next jet from the |
| 33 | converging jets of the actual continuous linear derivative. -/ |
| 34 | theorem tendstoUniformlyOn_iteratedFDeriv_succ_of_fderiv |
| 35 | {E F ι : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 36 | [NormedAddCommGroup F] [NormedSpace ℝ F] {l : Filter ι} |
| 37 | {fseq : ι → E → F} {f : E → F} {K : Set E} {j : ℕ} |
| 38 | (h : TendstoUniformlyOn (fun i => iteratedFDeriv ℝ j (fderiv ℝ (fseq i))) |
| 39 | (iteratedFDeriv ℝ j (fderiv ℝ f)) l K) : |
| 40 | TendstoUniformlyOn (fun i => iteratedFDeriv ℝ (j + 1) (fseq i)) |
| 41 | (iteratedFDeriv ℝ (j + 1) f) l K := by |
| 42 | have hc := (continuousMultilinearCurryRightEquiv' ℝ j E F).symm.isometry.uniformContinuous |
| 43 | have hconv := hc.comp_tendstoUniformlyOn h |
| 44 | have he (g : E → F) : iteratedFDeriv ℝ (j + 1) g = |
| 45 | (continuousMultilinearCurryRightEquiv' ℝ j E F).symm ∘ |
| 46 | iteratedFDeriv ℝ j (fderiv ℝ g) := |
| 47 | funext fun _ => iteratedFDeriv_succ_eq_comp_right |
| 48 | simpa only [he] using hconv |
| 49 | |
| 50 | /-- Pairing actual smooth maps preserves uniform convergence of each |
| 51 | fixed finite jet on the same parameter set. -/ |
| 52 | theorem tendstoUniformlyOn_iteratedFDeriv_prodMk |
| 53 | {E F G ι : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 54 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 55 | [NormedAddCommGroup G] [NormedSpace ℝ G] {l : Filter ι} |
| 56 | {fseq : ι → E → F} {f : E → F} {gseq : ι → E → G} {g : E → G} {K : Set E} (j : ℕ) |
| 57 | (hf : ∀ x ∈ K, ContDiffAt ℝ ∞ f x) (hg : ∀ x ∈ K, ContDiffAt ℝ ∞ g x) |
| 58 | (hfs : ∀ᶠ i in l, ∀ x ∈ K, ContDiffAt ℝ ∞ (fseq i) x) |
| 59 | (hgs : ∀ᶠ i in l, ∀ x ∈ K, ContDiffAt ℝ ∞ (gseq i) x) |
| 60 | (hfjet : TendstoUniformlyOn (fun i => iteratedFDeriv ℝ j (fseq i)) |
| 61 | (iteratedFDeriv ℝ j f) l K) |
| 62 | (hgjet : TendstoUniformlyOn (fun i => iteratedFDeriv ℝ j (gseq i)) |
| 63 | (iteratedFDeriv ℝ j g) l K) : |
| 64 | TendstoUniformlyOn (fun i => iteratedFDeriv ℝ j (fun x => (fseq i x, gseq i x))) |
| 65 | (iteratedFDeriv ℝ j (fun x => (f x, g x))) l K := by |
| 66 | have hprod := (ContinuousMultilinearMap.prodL ℝ (fun _ : Fin j => E) F G).isometry |
| 67 | have hconv := hprod.uniformContinuous.comp_tendstoUniformlyOn (hfjet.prodMk_same hgjet) |
| 68 | apply (hconv.congr ?_).congr_right ?_ |
| 69 | · filter_upwards [hfs, hgs] with i hfi hgi |
| 70 | intro x hx |
| 71 | exact (iteratedFDeriv_prodMk (hfi x hx) (hgi x hx) (by exact_mod_cast le_top)).symm |
| 72 | · intro x hx |
| 73 | exact (iteratedFDeriv_prodMk (hf x hx) (hg x hx) (by exact_mod_cast le_top)).symm |
| 74 | |
| 75 | private theorem fderiv_comp_germ |
| 76 | {E F G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 77 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 78 | [NormedAddCommGroup G] [NormedSpace ℝ G] |
| 79 | {f : E → F} {g : F → G} {x : E} |
| 80 | (hf : ContDiffAt ℝ ∞ f x) (hg : ContDiffAt ℝ ∞ g (f x)) : |
| 81 | fderiv ℝ (g ∘ f) =ᶠ[𝓝 x] fun y => (fderiv ℝ g (f y)).comp (fderiv ℝ f y) := by |
| 82 | have hfn := (hf.of_le (by simp : (1 : WithTop ℕ∞) ≤ ∞)).eventually (by decide) |
| 83 | have hgn := (hg.of_le (by simp : (1 : WithTop ℕ∞) ≤ ∞)).eventually (by decide) |
| 84 | filter_upwards [hfn, hf.continuousAt.eventually hgn] with y hy hyg |
| 85 | exact fderiv_comp y (hyg.differentiableAt one_ne_zero) (hy.differentiableAt one_ne_zero) |
| 86 | |
| 87 | /-- Every finite derivative of a composition converges uniformly when |
| 88 | the inner jets converge on a compact set and the fixed outer map is |
| 89 | smooth on an open neighborhood of the limiting image. -/ |
| 90 | theorem tendstoUniformlyOn_iteratedFDeriv_comp_of_compact |
| 91 | (m : ℕ) {E F G : Type u} |
| 92 | [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] |
| 93 | [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] |
| 94 | [NormedAddCommGroup G] [NormedSpace ℝ G] |
| 95 | {ι : Type*} {l : Filter ι} {fseq : ι → E → F} {f : E → F} {g : F → G} |
| 96 | {K : Set E} {U : Set F} (hK : IsCompact K) (hU : IsOpen U) |
| 97 | (hf : ∀ x ∈ K, ContDiffAt ℝ ∞ f x) (hg : ContDiffOn ℝ ∞ g U) |
| 98 | (hfU : MapsTo f K U) |
| 99 | (hfs : ∀ᶠ i in l, ∀ x ∈ K, ContDiffAt ℝ ∞ (fseq i) x) |
| 100 | (hjet : ∀ j ≤ m, TendstoUniformlyOn (fun i => iteratedFDeriv ℝ j (fseq i)) |
| 101 | (iteratedFDeriv ℝ j f) l K) : |
| 102 | TendstoUniformlyOn (fun i => iteratedFDeriv ℝ m (g ∘ fseq i)) |
| 103 | (iteratedFDeriv ℝ m (g ∘ f)) l K := by |
| 104 | induction m generalizing F G with |
| 105 | | zero => |
| 106 | have hzero := tendstoUniformlyOn_of_iteratedFDeriv_zero (hjet 0 le_rfl) |
| 107 | have hvalue := hg.continuousOn.comp_tendstoUniformlyOn_of_compact_image hU |
| 108 | (hK.image_of_continuousOn (fun x hx => (hf x hx).continuousAt.continuousWithinAt)) hfU hzero |
| 109 | simpa only [iteratedFDeriv_zero_eq_comp, Function.comp_def] using |
| 110 | (continuousMultilinearCurryFin0 ℝ E G).symm.isometry.uniformContinuous.comp_tendstoUniformlyOn |
| 111 | hvalue |
| 112 | | succ m ih => |
| 113 | let J (h : E → F) (x : E) : F × (E →L[ℝ] F) := (h x, fderiv ℝ h x) |
| 114 | let H (z : F × (E →L[ℝ] F)) : E →L[ℝ] G := (fderiv ℝ g z.1).comp z.2 |
| 115 | have hJ : ∀ x ∈ K, ContDiffAt ℝ ∞ (J f) x := fun x hx => |
| 116 | (hf x hx).prodMk ((hf x hx).fderiv_right (m := ∞) (by simp)) |
| 117 | have hJs : ∀ᶠ i in l, ∀ x ∈ K, ContDiffAt ℝ ∞ (J (fseq i)) x := by |
| 118 | filter_upwards [hfs] with i hi |
| 119 | exact fun x hx => (hi x hx).prodMk ((hi x hx).fderiv_right (m := ∞) (by simp)) |
| 120 | have hH : ContDiffOn ℝ ∞ H (U ×ˢ univ) := by |
| 121 | intro z hz |
| 122 | exact ((((hg.contDiffAt (hU.mem_nhds hz.1)).fderiv_right (m := ∞) (by simp)).comp |
| 123 | z contDiffAt_fst).clm_comp contDiffAt_snd).contDiffWithinAt |
| 124 | have hJjet : ∀ j ≤ m, TendstoUniformlyOn (fun i => iteratedFDeriv ℝ j (J (fseq i))) |
| 125 | (iteratedFDeriv ℝ j (J f)) l K := by |
| 126 | intro j hj |
| 127 | apply tendstoUniformlyOn_iteratedFDeriv_prodMk j hf |
| 128 | (fun x hx => (hf x hx).fderiv_right (m := ∞) (by simp)) hfs |
| 129 | (hfs.mono fun i hi x hx => (hi x hx).fderiv_right (m := ∞) (by simp)) |
| 130 | (hjet j (hj.trans (Nat.le_succ m))) |
| 131 | exact tendstoUniformlyOn_iteratedFDeriv_fderiv |
| 132 | (hjet (j + 1) (Nat.add_le_add_right hj 1)) |
| 133 | have hconv := ih (F := F × (E →L[ℝ] F)) (G := E →L[ℝ] G) |
| 134 | (hU.prod isOpen_univ) hJ hH (fun x hx => ⟨hfU hx, mem_univ _⟩) hJs hJjet |
| 135 | have hzero := tendstoUniformlyOn_of_iteratedFDeriv_zero (hjet 0 (Nat.zero_le _)) |
| 136 | have hfit := hzero.eventually_mapsTo_of_compact_image |
| 137 | (hK.image_of_continuousOn (fun x hx => (hf x hx).continuousAt.continuousWithinAt)) hU hfU |
| 138 | have hconvD : TendstoUniformlyOn (fun i => iteratedFDeriv ℝ m (fderiv ℝ (g ∘ fseq i))) |
| 139 | (iteratedFDeriv ℝ m (fderiv ℝ (g ∘ f))) l K := by |
| 140 | apply (hconv.congr ?_).congr_right ?_ |
| 141 | · filter_upwards [hfs, hfit] with i hi him |
| 142 | intro x hx |
| 143 | exact ((fderiv_comp_germ (hi x hx) |
| 144 | (hg.contDiffAt (hU.mem_nhds (him hx)))).iteratedFDeriv ℝ m).self_of_nhds.symm |
| 145 | · intro x hx |
| 146 | exact ((fderiv_comp_germ (hf x hx) |
| 147 | (hg.contDiffAt (hU.mem_nhds (hfU hx)))).iteratedFDeriv ℝ m).self_of_nhds.symm |
| 148 | exact tendstoUniformlyOn_iteratedFDeriv_succ_of_fderiv hconvD |