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.Ramp.Analysis.Closed.TimeOpenStateSubstitution |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Compact.PathComposition |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Compact.PathDerivative |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.ODE.Paths.ClosedPathPrimitive |
| 5 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 6 | import Mathlib.Analysis.SpecialFunctions.ExpDeriv |
| 7 | |
| 8 | /-! |
| 9 | # Spatial smoothness of the same normalized closed-time paths |
| 10 | |
| 11 | Actual spatial recurrences and a spatially constant anchored speed |
| 12 | give every finite order in the closed-time path norm. MT2007 Claim |
| 13 | 19.1, p. 437, and Lemma 19.6, pp. 441-442; |
| 14 | `2026-09-22-fixed-label-path-bootstrap.md`. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open Set PoincareMT.M63 |
| 20 | open scoped Topology ContDiff intervalIntegral |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 25 | [FiniteDimensional ℝ E] {tau s : ℝ} |
| 26 | |
| 27 | /-- The actual normalized recurrence family is smooth as closed-time |
| 28 | paths in the spatial parameter. No prior smoothness of the speed or |
| 29 | time derivative of a jet is assumed. MT2007 Claim 19.1, p. 437; |
| 30 | fixed-label path bootstrap derivation. -/ |
| 31 | theorem exists_contDiff_pathFamily_of_normalized_spatial_recurrences |
| 32 | (hts : tau < s) {U : Set E} (hU : IsOpen U) |
| 33 | (A : (ℝ × E) × (E × E) → ℝ) (B : (ℝ × E) × (E × E) → E) |
| 34 | (hA : ContDiffOn ℝ ∞ A ((Icc tau s ×ˢ U) ×ˢ univ)) |
| 35 | (hB : ContDiffOn ℝ ∞ B ((Icc tau s ×ˢ U) ×ˢ univ)) |
| 36 | (q : ℝ → ℝ → E) (v : ℝ → ℝ → ℝ) (r : ℕ → ℝ → ℝ → E) (v0 : ℝ) |
| 37 | (hq : ContinuousOn (fun z : ℝ × ℝ => q z.1 z.2) (univ ×ˢ Icc tau s)) |
| 38 | (hr : ∀ i, ContinuousOn (fun z : ℝ × ℝ => r i z.1 z.2) (univ ×ˢ Icc tau s)) |
| 39 | (hguard : ∀ x, ∀ t ∈ Icc tau s, q x t ∈ U) |
| 40 | (hv : ∀ x, ∀ t ∈ Icc tau s, v x t = v0 * Real.exp |
| 41 | (-∫ u in tau..t, A ((u, q x u), (r 0 x u, r 1 x u)))) |
| 42 | (hqder : ∀ t ∈ Icc tau s, ∀ x, |
| 43 | HasDerivAt (fun y => q y t) (v x t • r 0 x t) x) |
| 44 | (hrder : ∀ i, ∀ t ∈ Icc tau s, ∀ x, HasDerivAt (fun y => r i y t) |
| 45 | (v x t • (B ((t, q x t), (r 0 x t, r i x t)) + r (i + 1) x t)) x) : |
| 46 | ∃ (Q : ℝ → C(Icc tau s, E)) (V : ℝ → C(Icc tau s, ℝ)) |
| 47 | (R : ℕ → ℝ → C(Icc tau s, E)), |
| 48 | (∀ x (t : Icc tau s), Q x t = q x t) ∧ |
| 49 | (∀ x (t : Icc tau s), V x t = v x t) ∧ |
| 50 | (∀ i x (t : Icc tau s), R i x t = r i x t) ∧ |
| 51 | ContDiff ℝ ∞ Q ∧ ContDiff ℝ ∞ V ∧ ∀ i, ContDiff ℝ ∞ (R i) := by |
| 52 | let C := Icc tau s |
| 53 | let Q : ℝ → C(C, E) := fun x => ⟨fun t => q x t, |
| 54 | hq.comp_continuous (continuous_const.prodMk continuous_subtype_val) |
| 55 | (fun t => ⟨mem_univ _, t.property⟩)⟩ |
| 56 | let R : ℕ → ℝ → C(C, E) := fun i x => ⟨fun t => r i x t, |
| 57 | (hr i).comp_continuous (continuous_const.prodMk continuous_subtype_val) |
| 58 | (fun t => ⟨mem_univ _, t.property⟩)⟩ |
| 59 | have hQc : Continuous Q := ContinuousMap.continuous_of_continuous_uncurry Q |
| 60 | (hq.comp_continuous (f := fun z : ℝ × C => (z.1, z.2.val)) |
| 61 | (continuous_fst.prodMk (continuous_subtype_val.comp continuous_snd)) |
| 62 | (fun z => ⟨mem_univ _, z.2.property⟩)) |
| 63 | have hRc (i : ℕ) : Continuous (R i) := ContinuousMap.continuous_of_continuous_uncurry (R i) |
| 64 | ((hr i).comp_continuous (f := fun z : ℝ × C => (z.1, z.2.val)) |
| 65 | (continuous_fst.prodMk (continuous_subtype_val.comp continuous_snd)) |
| 66 | (fun z => ⟨mem_univ _, z.2.property⟩)) |
| 67 | let O : Set (E × (E × E)) := U ×ˢ univ |
| 68 | let A' : ℝ × (E × (E × E)) → ℝ := fun z => A ((z.1, z.2.1), z.2.2) |
| 69 | let B' : ℝ × (E × (E × E)) → E := fun z => B ((z.1, z.2.1), z.2.2) |
| 70 | have hpair : ContDiff ℝ ∞ |
| 71 | (fun z : ℝ × (E × (E × E)) => ((z.1, z.2.1), z.2.2)) := by fun_prop |
| 72 | have hA' : ContDiffOn ℝ ∞ A' (C ×ˢ O) := |
| 73 | hA.comp hpair.contDiffOn (fun z hz => ⟨⟨hz.1, hz.2.1⟩, mem_univ _⟩) |
| 74 | have hB' : ContDiffOn ℝ ∞ B' (C ×ˢ O) := |
| 75 | hB.comp hpair.contDiffOn (fun z hz => ⟨⟨hz.1, hz.2.1⟩, mem_univ _⟩) |
| 76 | obtain ⟨PhiA, hPhiA, hPhiAval⟩ := exists_contDiffOn_closedTime_pathSubstitution |
| 77 | (uniqueDiffOn_Icc hts) (hU.prod isOpen_univ) A' hA' |
| 78 | obtain ⟨PhiB, hPhiB, hPhiBval⟩ := exists_contDiffOn_closedTime_pathSubstitution |
| 79 | (uniqueDiffOn_Icc hts) (hU.prod isOpen_univ) B' hB' |
| 80 | let Lq : E →L[ℝ] E × (E × E) := ContinuousLinearMap.inl ℝ E (E × E) |
| 81 | let Lp : E →L[ℝ] E × (E × E) := |
| 82 | (ContinuousLinearMap.inr ℝ E (E × E)).comp (ContinuousLinearMap.inl ℝ E E) |
| 83 | let Lh : E →L[ℝ] E × (E × E) := |
| 84 | (ContinuousLinearMap.inr ℝ E (E × E)).comp (ContinuousLinearMap.inr ℝ E E) |
| 85 | let J : ℕ → ℝ → C(C, E × (E × E)) := fun i x => |
| 86 | Lq.compLeftContinuous ℝ C (Q x) + Lp.compLeftContinuous ℝ C (R 0 x) + |
| 87 | Lh.compLeftContinuous ℝ C (R i x) |
| 88 | have hJval (i : ℕ) (x : ℝ) (t : C) : |
| 89 | J i x t = (q x t, (r 0 x t, r i x t)) := by |
| 90 | change ((q x t, (0, 0)) : E × (E × E)) + |
| 91 | ((0, (r 0 x t, 0)) : E × (E × E)) + |
| 92 | ((0, (0, r i x t)) : E × (E × E)) = _ |
| 93 | simp only [Prod.mk_add_mk, zero_add, add_zero] |
| 94 | have hJguard (i : ℕ) (x : ℝ) : range (J i x) ⊆ O := by |
| 95 | rintro z ⟨t, rfl⟩ |
| 96 | rw [hJval] |
| 97 | exact ⟨hguard x t t.property, mem_univ _⟩ |
| 98 | let aPath : ℝ → C(C, ℝ) := fun x => PhiA (J 1 x) |
| 99 | let bPath : ℕ → ℝ → C(C, E) := fun i x => PhiB (J i x) |
| 100 | have haVal (x : ℝ) (t : C) : |
| 101 | aPath x t = A ((t.val, q x t), (r 0 x t, r 1 x t)) := by |
| 102 | rw [hPhiAval (J 1 x) (hJguard 1 x) t] |
| 103 | change A ((t.val, (J 1 x t).1), (J 1 x t).2) = _ |
| 104 | rw [hJval] |
| 105 | have hbVal (i : ℕ) (x : ℝ) (t : C) : |
| 106 | bPath i x t = B ((t.val, q x t), (r 0 x t, r i x t)) := by |
| 107 | rw [hPhiBval (J i x) (hJguard i x) t] |
| 108 | change B ((t.val, (J i x t).1), (J i x t).2) = _ |
| 109 | rw [hJval] |
| 110 | let P : C(C, ℝ) →L[ℝ] C(C, ℝ) := |
| 111 | PoincareMT.M14.closedPathPrimitive ⟨tau, le_rfl, hts.le⟩ |
| 112 | let eExp : C(ℝ, ℝ) := ⟨Real.exp, Real.continuous_exp⟩ |
| 113 | let V : ℝ → C(C, ℝ) := fun x => v0 • eExp.comp (-P (aPath x)) |
| 114 | have hExp : ContDiff ℝ ∞ (fun f : C(C, ℝ) => eExp.comp f) := |
| 115 | contDiff_postcomp_independent_universes C eExp Real.contDiff_exp |
| 116 | have hVval (x : ℝ) (t : C) : V x t = v x t := by |
| 117 | have hInt : P (aPath x) t = |
| 118 | ∫ u in tau..t.val, A ((u, q x u), (r 0 x u, r 1 x u)) := by |
| 119 | rw [PoincareMT.M14.closedPathPrimitive_apply] |
| 120 | apply intervalIntegral.integral_congr |
| 121 | intro u hu |
| 122 | have hut : u ∈ Icc tau t.val := by simpa only [uIcc_of_le t.property.1] using hu |
| 123 | have huC : u ∈ Icc tau s := ⟨hut.1, hut.2.trans t.property.2⟩ |
| 124 | change aPath x (projIcc tau s hts.le u) = A ((u, q x u), (r 0 x u, r 1 x u)) |
| 125 | rw [projIcc_of_mem _ huC] |
| 126 | exact haVal x ⟨u, huC⟩ |
| 127 | change v0 * Real.exp (-P (aPath x) t) = v x t |
| 128 | rw [hInt, hv x t t.property] |
| 129 | let scalarAction : C(ℝ × E, E) := |
| 130 | ⟨fun z => z.1 • z.2, continuous_fst.smul continuous_snd⟩ |
| 131 | have hAction : ContDiff ℝ ∞ |
| 132 | (fun f : C(C, ℝ × E) => scalarAction.comp f) := |
| 133 | contDiff_postcomp_independent_universes C scalarAction (contDiff_fst.smul contDiff_snd) |
| 134 | let SMul : C(C, ℝ) → C(C, E) → C(C, E) := fun f g => |
| 135 | ⟨fun t => f t • g t, f.continuous.smul g.continuous⟩ |
| 136 | have hSMul {k : ℕ∞} {f : ℝ → C(C, ℝ)} {g : ℝ → C(C, E)} |
| 137 | (hf : ContDiff ℝ k f) (hg : ContDiff ℝ k g) : |
| 138 | ContDiff ℝ k (fun x => SMul (f x) (g x)) := by |
| 139 | have hk : (k : ℕ∞ω) ≤ ∞ := by exact_mod_cast (le_top : k ≤ ⊤) |
| 140 | have hp := ((ContinuousLinearMap.inl ℝ ℝ E).compLeftContinuous ℝ C).contDiff.comp hf |
| 141 | have hq' := ((ContinuousLinearMap.inr ℝ ℝ E).compLeftContinuous ℝ C).contDiff.comp hg |
| 142 | convert (hAction.of_le hk).comp (hp.add hq') using 1 |
| 143 | funext x |
| 144 | apply ContinuousMap.ext |
| 145 | intro t |
| 146 | change f x t • g x t = ((f x t, (0 : E)) + (0, g x t)).1 • |
| 147 | ((f x t, (0 : E)) + (0, g x t)).2 |
| 148 | simp only [Prod.mk_add_mk, add_zero, zero_add] |
| 149 | have hregular (k : ℕ∞) (hQ : ContDiff ℝ k Q) |
| 150 | (hR : ∀ i, ContDiff ℝ k (R i)) : |
| 151 | ContDiff ℝ k V ∧ ∀ i, ContDiff ℝ k (bPath i) := by |
| 152 | have hk : (k : ℕ∞ω) ≤ ∞ := by exact_mod_cast (le_top : k ≤ ⊤) |
| 153 | have hJ (i : ℕ) : ContDiff ℝ k (J i) := |
| 154 | (((Lq.compLeftContinuous ℝ C).contDiff.comp hQ).add |
| 155 | ((Lp.compLeftContinuous ℝ C).contDiff.comp (hR 0))).add |
| 156 | ((Lh.compLeftContinuous ℝ C).contDiff.comp (hR i)) |
| 157 | have ha : ContDiff ℝ k aPath := |
| 158 | (hPhiA.of_le hk).comp_contDiff (hJ 1) (hJguard 1) |
| 159 | have hb (i : ℕ) : ContDiff ℝ k (bPath i) := |
| 160 | (hPhiB.of_le hk).comp_contDiff (hJ i) (hJguard i) |
| 161 | exact ⟨((hExp.of_le hk).comp ((P.contDiff.comp ha).neg)).const_smul v0, hb⟩ |
| 162 | have upgrade (m : ℕ) {f df : ℝ → C(C, E)} (hdf : ContDiff ℝ m df) |
| 163 | (hd : ∀ x, HasDerivAt f (df x) x) : ContDiff ℝ (m + 1) f := by |
| 164 | refine contDiff_succ_iff_deriv.mpr ⟨fun x => (hd x).differentiableAt, by simp, ?_⟩ |
| 165 | have heq : deriv f = df := funext fun x => (hd x).deriv |
| 166 | rwa [heq] |
| 167 | have hfinite : ∀ m : ℕ, ContDiff ℝ m Q ∧ ∀ i, ContDiff ℝ m (R i) := by |
| 168 | intro m |
| 169 | induction m with |
| 170 | | zero => exact ⟨contDiff_zero.mpr hQc, fun i => contDiff_zero.mpr (hRc i)⟩ |
| 171 | | succ m ih => |
| 172 | have hreg := hregular (m : ℕ∞) ih.1 ih.2 |
| 173 | let Dq : ℝ → C(C, E) := fun x => SMul (V x) (R 0 x) |
| 174 | let Dr : ℕ → ℝ → C(C, E) := fun i x => |
| 175 | SMul (V x) (bPath i x + R (i + 1) x) |
| 176 | have hDq : ContDiff ℝ m Dq := hSMul hreg.1 (ih.2 0) |
| 177 | have hDr (i : ℕ) : ContDiff ℝ m (Dr i) := |
| 178 | hSMul hreg.1 ((hreg.2 i).add (ih.2 (i + 1))) |
| 179 | have hqd (x : ℝ) : HasDerivAt Q (Dq x) x := by |
| 180 | apply hasDerivAt_compact_curry isOpen_univ Q Dq (mem_univ x) hDq.continuous.continuousAt |
| 181 | intro y _hy t |
| 182 | change HasDerivAt (fun z => q z t.val) (V y t • r 0 y t.val) y |
| 183 | rw [hVval] |
| 184 | exact hqder t t.property y |
| 185 | have hrd (i : ℕ) (x : ℝ) : HasDerivAt (R i) (Dr i x) x := by |
| 186 | apply hasDerivAt_compact_curry isOpen_univ (R i) (Dr i) (mem_univ x) |
| 187 | (hDr i).continuous.continuousAt |
| 188 | intro y _hy t |
| 189 | change HasDerivAt (fun z => r i z t.val) |
| 190 | (V y t • (bPath i y t + r (i + 1) y t.val)) y |
| 191 | rw [hVval, hbVal] |
| 192 | exact hrder i t t.property y |
| 193 | exact ⟨upgrade m hDq hqd, fun i => upgrade m (hDr i) (hrd i)⟩ |
| 194 | have hQ : ContDiff ℝ ∞ Q := contDiff_infty.mpr fun m => (hfinite m).1 |
| 195 | have hR (i : ℕ) : ContDiff ℝ ∞ (R i) := contDiff_infty.mpr fun m => (hfinite m).2 i |
| 196 | exact ⟨Q, V, R, fun _ _ => rfl, hVval, fun _ _ _ => rfl, |
| 197 | hQ, (hregular ⊤ hQ hR).1, hR⟩ |