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.Comparison.Compatibility.SourceNames |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Closed.CurvatureJetIdentification |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Embedded.CurvatureJetSpatial |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C2.TraceEmbeddingBounds |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C2.TracePeriodicCurvature |
| 6 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C2.Locality |
| 7 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Mixed.EmbeddingHessian |
| 8 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Periodic.DerivativeFilterLimit |
| 9 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Integral.Continuity |
| 10 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Integral.Periodicity |
| 11 | import Mathlib.Topology.Separation.Basic |
| 12 | import Mathlib.Topology.Order.ProjIcc |
| 13 | |
| 14 | /-! |
| 15 | # Terminal closure of the actual intrinsic curvature jets |
| 16 | |
| 17 | Uniform spatial bounds give full one-sided derivative limits. The actual |
| 18 | closed C2 slice then identifies every recursively constructed endpoint |
| 19 | jet. MT2007 Claim 19.1, p. 437, and Lemma 19.24, pp. 454-455; |
| 20 | `2026-09-22-terminal-curvature-jet-closure.md`. |
| 21 | -/ |
| 22 | |
| 23 | set_option autoImplicit false |
| 24 | set_option backward.isDefEq.respectTransparency false |
| 25 | |
| 26 | open Set Filter |
| 27 | open scoped Manifold ContDiff Bundle Topology NNReal |
| 28 | |
| 29 | universe u v |
| 30 | |
| 31 | namespace PoincareMT.M63 |
| 32 | |
| 33 | variable {n : Nat} {M : Type u} [TopologicalSpace M] |
| 34 | [ChartedSpace (EuclideanSpace Real (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 35 | {ι : Type v} [Fintype ι] {a b : Real} |
| 36 | |
| 37 | local notation "W" => EuclideanSpace Real ι |
| 38 | local notation "X" => C(AddCircle curvePeriod, W) |
| 39 | local notation "XR" => C(AddCircle curvePeriod, Real) |
| 40 | |
| 41 | /-- Actual bounds on one smooth open tail close all spatial curvature |
| 42 | jets at its included C2 endpoint, including the ambient final time. |
| 43 | MT2007 Claim 19.1, p. 437; terminal curvature-jet closure derivation. -/ |
| 44 | theorem exists_terminal_embeddedCurvatureJets |
| 45 | [T2Space M] (F : RicciFlow n M (Icc a b)) |
| 46 | (hcompact : IsCompact (univ : Set M)) |
| 47 | {alpha tau S : Real} (haa : a ≤ alpha) (hat : alpha < tau) |
| 48 | (htS : tau < S) (hSb : S ≤ b) |
| 49 | {e : M → W} (he : ContMDiff (𝓡 n) 𝓘(Real, W) ∞ e) |
| 50 | {U : Set W} (hU : IsOpen U) (heU : range e ⊆ U) |
| 51 | {ρ : W → M} (hρ : ContMDiffOn 𝓘(Real, W) (𝓡 n) ∞ ρ U) |
| 52 | (hρe : ∀ p, ρ (e p) = p) |
| 53 | {c : Real → Real → M} |
| 54 | (hc : M63SmoothShrinkingCurveOn F c (Icc alpha S)) |
| 55 | (hjets : ∀ i : Nat, ∃ K : Real, 0 ≤ K ∧ |
| 56 | ∀ t ∈ Ioo tau S, ∀ x : Real, |
| 57 | (F.metric t).tangentNorm (c x t) (m63CurvatureJet F c i t x) ≤ K) |
| 58 | (hgradient : ∃ G : Real, 0 ≤ G ∧ |
| 59 | ∀ t ∈ Ioo tau S, ∀ x : Real, |deriv (curveSpeed F c t) x| ≤ G) : |
| 60 | ∃ η : Nat → C(Icc tau S, X), |
| 61 | (∀ i (t : Icc tau S) (x : Real), |
| 62 | η i t (x : AddCircle curvePeriod) = |
| 63 | mfderiv (𝓡 n) 𝓘(Real, W) e (c x t) (m63CurvatureJet F c i t x)) ∧ |
| 64 | (∀ i (t : Icc tau S) (x : Real), |
| 65 | HasDerivAt (fun y : Real => η i t (y : AddCircle curvePeriod)) |
| 66 | (curveSpeed F c t x • |
| 67 | (HAdd.hAdd (α := W) (β := W) (γ := W) |
| 68 | (η (i + 1) t (x : AddCircle curvePeriod)) |
| 69 | (coordinateHessian (F.connection t) e (c x t) |
| 70 | (spatialUnitTangent F c t x) (m63CurvatureJet F c i t x)))) x) ∧ |
| 71 | (∀ i (t : Icc tau S), |
| 72 | ContMDiff 𝓘(Real, Real) ((𝓡 n).prod (𝓡 n)) 1 |
| 73 | (fun x => (⟨c x t, m63CurvatureJet F c i t x⟩ : TangentBundle (𝓡 n) M))) ∧ |
| 74 | ∀ i, ContinuousOn |
| 75 | (fun z : Real × Real => |
| 76 | (⟨c z.1 z.2, m63CurvatureJet F c i z.2 z.1⟩ : TangentBundle (𝓡 n) M)) |
| 77 | (univ ×ˢ Icc tau S) := by |
| 78 | classical |
| 79 | let : Fact (0 < curvePeriod) := ⟨Real.two_pi_pos⟩ |
| 80 | have haS : alpha < S := hat.trans htS |
| 81 | have hsubF : Icc alpha S ⊆ Icc a b := Icc_subset_Icc haa hSb |
| 82 | let F0 := m63RestrictClosedFlow F alpha S hsubF haS |
| 83 | have hc0 : M62ShrinkingCurve F0 c := |
| 84 | m63SmoothRestriction hc alpha S Subset.rfl haS |
| 85 | have hjet0 (i : Nat) (t x : Real) : |
| 86 | m63CurvatureJet F0 c i t x = m63CurvatureJet F c i t x := by |
| 87 | induction i generalizing x with |
| 88 | | zero => rfl |
| 89 | | succ i ih => |
| 90 | change m62SpatialDerivative F c t (fun y => m63CurvatureJet F0 c i t y) x = |
| 91 | m62SpatialDerivative F c t (fun y => m63CurvatureJet F c i t y) x |
| 92 | rw [show (fun y => m63CurvatureJet F0 c i t y) = |
| 93 | (fun y => m63CurvatureJet F c i t y) from funext ih] |
| 94 | let C := Icc tau S |
| 95 | let Path := C(C, X) |
| 96 | let endTime : C := ⟨S, htS.le, le_rfl⟩ |
| 97 | let pi : Real → C := projIcc tau S htS.le |
| 98 | have hpi (t : Real) (ht : t ∈ C) : pi t = ⟨t, ht⟩ := projIcc_of_mem htS.le ht |
| 99 | have hC : C ⊆ Icc alpha S := Icc_subset_Icc_left hat.le |
| 100 | have htime (t : Real) (ht : t ∈ Ico tau S) : t ∈ Ioo alpha S := |
| 101 | ⟨hat.trans_le ht.1, ht.2⟩ |
| 102 | let A : Nat → Real × Real → W := fun i z => |
| 103 | mfderiv (𝓡 n) 𝓘(Real, W) e (c z.1 z.2) (m63CurvatureJet F0 c i z.2 z.1) |
| 104 | let Ω : Set (Real × Real) := univ ×ˢ Ioo alpha S |
| 105 | have hΩ : IsOpen Ω := isOpen_univ.prod isOpen_Ioo |
| 106 | have hpush : ContMDiff ((𝓡 n).prod (𝓡 n)) 𝓘(Real, W) ∞ |
| 107 | (fun p : TangentBundle (𝓡 n) M => (mfderiv (𝓡 n) 𝓘(Real, W) e p.1 p.2 : W)) := |
| 108 | (contMDiff_snd_tangentBundle_modelSpace (n := ∞) W 𝓘(Real, W)).comp |
| 109 | (he.contMDiff_tangentMap (by simp)) |
| 110 | have hA (i : Nat) : ContDiffOn Real ∞ (A i) Ω := |
| 111 | (hpush.comp_contMDiffOn (curvatureJet_joint_contMDiff F0 c hc0 i)).contDiffOn |
| 112 | have hdx (i : Nat) (t : Real) (ht : t ∈ Ico tau S) (x : Real) : |
| 113 | HasDerivAt (fun y => A i (y, t)) (M08.coordinatePartialS (A i) (x, t)) x := |
| 114 | M08.coordinateSlice_fst_hasDerivAt (A i) (p := (x, t)) |
| 115 | (((hA i).contDiffAt (hΩ.mem_nhds ⟨mem_univ _, htime t ht⟩)).differentiableAt |
| 116 | (by simp)) |
| 117 | have descend (J : Set Real) (f : Real × Real → W) |
| 118 | (hf : ContinuousOn f (univ ×ˢ J)) |
| 119 | (hp : ∀ t ∈ J, Function.Periodic (fun x => f (x, t)) curvePeriod) : |
| 120 | ∃ g : Real → X, ContinuousOn g J ∧ |
| 121 | ∀ t ∈ J, ∀ x : Real, g t (x : AddCircle curvePeriod) = f (x, t) := by |
| 122 | let g : Real → X := fun t => if ht : t ∈ J then |
| 123 | ⟨(hp t ht).lift, |
| 124 | (QuotientAddGroup.isQuotientMap_mk (AddSubgroup.zmultiples curvePeriod)).continuous_iff.mpr |
| 125 | (hf.comp_continuous (continuous_id.prodMk continuous_const) |
| 126 | (fun _ => ⟨mem_univ _, ht⟩))⟩ else 0 |
| 127 | have hg (t : Real) (ht : t ∈ J) (x : Real) : |
| 128 | g t (x : AddCircle curvePeriod) = f (x, t) := by |
| 129 | simp only [g, dif_pos ht, ContinuousMap.coe_mk, Function.Periodic.lift_coe] |
| 130 | refine ⟨g, continuousOn_iff_continuous_domRestrict.mpr ?_, hg⟩ |
| 131 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 132 | have hquot : IsOpenQuotientMap |
| 133 | (fun p : J × Real => (p.1, (p.2 : AddCircle curvePeriod))) := |
| 134 | IsOpenQuotientMap.id.prodMap QuotientAddGroup.isOpenQuotientMap_mk |
| 135 | apply hquot.continuous_comp_iff.mp |
| 136 | exact (hf.comp_continuous |
| 137 | (continuous_snd.prodMk (continuous_subtype_val.comp continuous_fst)) |
| 138 | (fun p => ⟨mem_univ _, p.1.2⟩)).congr (fun p => (hg p.1 p.1.2 p.2).symm) |
| 139 | have hderivper {f : Real → W} (hp : Function.Periodic f curvePeriod) : |
| 140 | Function.Periodic (deriv f) curvePeriod := by |
| 141 | intro x |
| 142 | rw [← deriv_comp_add_const] |
| 143 | exact congrArg (fun g : Real → W => deriv g x) (funext hp) |
| 144 | have hdata := c2ShrinkingCurve_embedded_closed_data (m63C2_of_m62 hc0) he |
| 145 | have hrper (t : Real) (ht : t ∈ Icc alpha S) : |
| 146 | Function.Periodic (fun x => e (c x t)) curvePeriod := |
| 147 | fun x => congrArg e (hc0.periodic t ht x) |
| 148 | obtain ⟨r0, hr0, hrrep⟩ := descend C (fun z => e (c z.1 z.2)) |
| 149 | (hdata.2.2.1.mono (prod_mono Subset.rfl hC)) (fun t ht => hrper t (hC ht)) |
| 150 | let r : Path := ⟨fun t => r0 t, hr0.domRestrict⟩ |
| 151 | have hspeedC := M62.speed_continuousOn F0 c hc0 |
| 152 | have hvpos (t : Real) (ht : t ∈ Icc alpha S) (x : Real) : |
| 153 | 0 < curveSpeed F0 c t x := M62.speed_pos F0 c hc0 ht x |
| 154 | let sigma0 : Real × Real → W := fun z => |
| 155 | (curveSpeed F0 c z.2 z.1)⁻¹ • deriv (fun y => e (c y z.2)) z.1 |
| 156 | have hsigma0 : ContinuousOn sigma0 (univ ×ˢ Icc alpha S) := |
| 157 | (hspeedC.inv₀ (fun z hz => (hvpos z.2 hz.2 z.1).ne')).smul hdata.2.2.2.1 |
| 158 | have hsigmarep (t : Real) (ht : t ∈ Icc alpha S) (x : Real) : |
| 159 | sigma0 (x, t) = mfderiv (𝓡 n) 𝓘(Real, W) e (c x t) |
| 160 | (spatialUnitTangent F0 c t x) := by |
| 161 | dsimp only [sigma0] |
| 162 | rw [(hdata.2.1 t ht x).deriv, spatialUnitTangent, map_smul] |
| 163 | have hsigmaper (t : Real) (ht : t ∈ C) : |
| 164 | Function.Periodic (fun x => sigma0 (x, t)) curvePeriod := by |
| 165 | intro x |
| 166 | dsimp only [sigma0] |
| 167 | rw [M62.speed_periodic F0 c hc0 (hC ht) x, hderivper (hrper t (hC ht)) x] |
| 168 | obtain ⟨s0, hs0, hsrep⟩ := descend C sigma0 |
| 169 | (hsigma0.mono (prod_mono Subset.rfl hC)) hsigmaper |
| 170 | let sigma : Path := ⟨fun t => s0 t, hs0.domRestrict⟩ |
| 171 | obtain ⟨hHper, hHcont, _hHsmooth⟩ := embeddedCurvature_closed_periodic_data F0 c haS hc0 he |
| 172 | obtain ⟨h0, hh0, hHrep⟩ := descend C (A 0) |
| 173 | (hHcont.mono (prod_mono Subset.rfl hC)) (fun t ht => hHper t (hC ht)) |
| 174 | let H : Path := ⟨fun t => h0 t, hh0.domRestrict⟩ |
| 175 | let v : C(C, XR) := ⟨fun t => |
| 176 | ⟨(M62.speed_periodic F0 c hc0 (hC t.property)).lift, |
| 177 | (QuotientAddGroup.isQuotientMap_mk (AddSubgroup.zmultiples curvePeriod)).continuous_iff.mpr |
| 178 | (hspeedC.comp_continuous (continuous_id.prodMk continuous_const) |
| 179 | (fun _ => ⟨mem_univ _, hC t.property⟩))⟩, by |
| 180 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 181 | have hquot : IsOpenQuotientMap |
| 182 | (fun p : C × Real => (p.1, (p.2 : AddCircle curvePeriod))) := |
| 183 | IsOpenQuotientMap.id.prodMap QuotientAddGroup.isOpenQuotientMap_mk |
| 184 | apply hquot.continuous_comp_iff.mp |
| 185 | change Continuous (fun p : C × Real => |
| 186 | (M62.speed_periodic F0 c hc0 (hC p.1.property)).lift (p.2 : AddCircle curvePeriod)) |
| 187 | simpa only [Function.Periodic.lift_coe, Function.comp_def] using! |
| 188 | hspeedC.comp_continuous |
| 189 | (continuous_snd.prodMk (continuous_subtype_val.comp continuous_fst)) |
| 190 | (fun p => ⟨mem_univ _, hC p.1.2⟩)⟩ |
| 191 | have hvrep (t : C) (x : Real) : v t (x : AddCircle curvePeriod) = curveSpeed F0 c t x := by |
| 192 | change (M62.speed_periodic F0 c hc0 (hC t.property)).lift (x : AddCircle curvePeriod) = _ |
| 193 | exact Function.Periodic.lift_coe _ x |
| 194 | have hvpositive (t : C) (z : AddCircle curvePeriod) : 0 < v t z := by |
| 195 | obtain ⟨x, rfl⟩ := QuotientAddGroup.mk_surjective z |
| 196 | rw [hvrep] |
| 197 | exact hvpos t (hC t.property) x |
| 198 | let iv : C(C, XR) := ⟨fun t => ⟨fun z => (v t z)⁻¹, |
| 199 | (v t).continuous.inv₀ (fun z => (hvpositive t z).ne')⟩, by |
| 200 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 201 | exact v.uncurry.continuous.inv₀ (fun z => (hvpositive z.1 z.2).ne')⟩ |
| 202 | let V : Real := ‖v‖ |
| 203 | have hV : 0 ≤ V := norm_nonneg v |
| 204 | have hvbound (t : C) (x : Real) : curveSpeed F0 c t x ≤ V := by |
| 205 | rw [← hvrep] |
| 206 | exact (le_abs_self _).trans ((ContinuousMap.norm_coe_le_norm (v t) |
| 207 | (x : AddCircle curvePeriod)).trans (ContinuousMap.norm_coe_le_norm v t)) |
| 208 | obtain ⟨E1, E2, E3, ⟨hE1, hE2, hE3⟩, hE⟩ := |
| 209 | exists_uniform_embedding_derivative_bounds F hcompact he |
| 210 | choose K hK hKbound using hjets |
| 211 | obtain ⟨G, hG, hGbound⟩ := hgradient |
| 212 | let bound (i : Nat) := G * (E2 * K i + E1 * K (i + 1)) + |
| 213 | V ^ 2 * (E3 * K i + E2 * K 0 * K i + 2 * E2 * K (i + 1) + E1 * K (i + 2)) |
| 214 | have hbound (i : Nat) : 0 ≤ bound i := by |
| 215 | dsimp only [bound] |
| 216 | exact add_nonneg |
| 217 | (mul_nonneg hG (add_nonneg (mul_nonneg hE2 (hK i)) |
| 218 | (mul_nonneg hE1 (hK (i + 1))))) |
| 219 | (mul_nonneg (sq_nonneg V) |
| 220 | (add_nonneg (add_nonneg (add_nonneg (mul_nonneg hE3 (hK i)) |
| 221 | (mul_nonneg (mul_nonneg hE2 (hK 0)) (hK i))) |
| 222 | (mul_nonneg (mul_nonneg (by norm_num) hE2) (hK (i + 1)))) |
| 223 | (mul_nonneg hE1 (hK (i + 2))))) |
| 224 | have hsecond (i : Nat) (t : Real) (ht : t ∈ Ioo tau S) (x : Real) : |
| 225 | ‖deriv (deriv (fun y => A i (y, t))) x‖ ≤ bound i := by |
| 226 | have ht0 : t ∈ Ioo alpha S := ⟨hat.trans ht.1, ht.2⟩ |
| 227 | have htf : t ∈ Icc a b := hsubF (Ioo_subset_Icc_self ht0) |
| 228 | have hb := embeddedCurvatureJet_second_spatial_derivative_bound F0 c hc0 he i ht0 x |
| 229 | hE1 hE2 hE3 (fun Z => (hE t htf (c x t) Z 0 0).1) |
| 230 | (fun Z Q => (hE t htf (c x t) Z Q 0).2.1) |
| 231 | (fun Z Q P => (hE t htf (c x t) Z Q P).2.2) |
| 232 | have hv : curveSpeed F0 c t x ≤ V := hvbound ⟨t, ht.1.le, ht.2.le⟩ x |
| 233 | have hv0 : 0 ≤ curveSpeed F0 c t x := (hvpos t (Ioo_subset_Icc_self ht0) x).le |
| 234 | have hkb (k : Nat) : (F0.metric t).tangentNorm (c x t) |
| 235 | (m63CurvatureJet F0 c k t x) ≤ K k := by |
| 236 | rw [hjet0] |
| 237 | exact hKbound k t ht x |
| 238 | have hk : m62Curvature F0 c t x ≤ K 0 := hkb 0 |
| 239 | have hk0 : 0 ≤ m62Curvature F0 c t x := Real.sqrt_nonneg _ |
| 240 | have hni (k : Nat) : 0 ≤ (F0.metric t).tangentNorm (c x t) |
| 241 | (m63CurvatureJet F0 c k t x) := Real.sqrt_nonneg _ |
| 242 | have hE2K0 : 0 ≤ E2 * K 0 := mul_nonneg hE2 (hK 0) |
| 243 | have hlin : 0 ≤ E2 * (F0.metric t).tangentNorm (c x t) |
| 244 | (m63CurvatureJet F0 c i t x) + E1 * (F0.metric t).tangentNorm (c x t) |
| 245 | (m63CurvatureJet F0 c (i + 1) t x) := |
| 246 | add_nonneg (mul_nonneg hE2 (hni i)) (mul_nonneg hE1 (hni (i + 1))) |
| 247 | have hquad : 0 ≤ E3 * (F0.metric t).tangentNorm (c x t) |
| 248 | (m63CurvatureJet F0 c i t x) + E2 * m62Curvature F0 c t x * |
| 249 | (F0.metric t).tangentNorm (c x t) (m63CurvatureJet F0 c i t x) + |
| 250 | 2 * E2 * (F0.metric t).tangentNorm (c x t) (m63CurvatureJet F0 c (i + 1) t x) + |
| 251 | E1 * (F0.metric t).tangentNorm (c x t) (m63CurvatureJet F0 c (i + 2) t x) := |
| 252 | add_nonneg (add_nonneg (add_nonneg (mul_nonneg hE3 (hni i)) |
| 253 | (mul_nonneg (mul_nonneg hE2 hk0) (hni i))) |
| 254 | (mul_nonneg (mul_nonneg (by norm_num) hE2) (hni (i + 1)))) |
| 255 | (mul_nonneg hE1 (hni (i + 2))) |
| 256 | apply hb.trans |
| 257 | dsimp only [bound] |
| 258 | gcongr <;> first |
| 259 | | exact hlin |
| 260 | | exact hquad |
| 261 | | exact hni i |
| 262 | | exact hGbound t ht x |
| 263 | | exact hv |
| 264 | | exact hk |
| 265 | | exact hkb i |
| 266 | | exact hkb (i + 1) |
| 267 | | exact hkb (i + 2) |
| 268 | let B := fun (t : Real) (z p q : W) => coordinateHessian (F0.connection t) e (ρ z) |
| 269 | (mfderiv 𝓘(Real, W) (𝓡 n) ρ z p) (mfderiv 𝓘(Real, W) (𝓡 n) ρ z q) |
| 270 | have hBC : ContinuousOn |
| 271 | (fun z : (Real × W) × (W × W) => B z.1.1 z.1.2 z.2.1 z.2.2) |
| 272 | ((Icc alpha S ×ˢ U) ×ˢ univ) := |
| 273 | (flow_coordinateHessian_mixed_pullback_contDiffOn F0 he hU hρ).continuousOn |
| 274 | have hrU (t : C) (z : AddCircle curvePeriod) : r t z ∈ U := by |
| 275 | obtain ⟨x, rfl⟩ := QuotientAddGroup.mk_surjective z |
| 276 | rw [show r t (x : AddCircle curvePeriod) = e (c x t) from hrrep t t.property x] |
| 277 | exact heU (mem_range_self _) |
| 278 | let mulV (q : XR × X) : X := |
| 279 | ⟨fun z => q.1 z • q.2 z, q.1.continuous.smul q.2.continuous⟩ |
| 280 | have hmulV : Continuous mulV := by |
| 281 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 282 | change Continuous (fun p : (XR × X) × AddCircle curvePeriod => p.1.1 p.2 • p.1.2 p.2) |
| 283 | have hfirst : Continuous (fun p : (XR × X) × AddCircle curvePeriod => p.1.1 p.2) := |
| 284 | continuous_fst.fst.eval continuous_snd |
| 285 | have hsecond : Continuous (fun p : (XR × X) × AddCircle curvePeriod => p.1.2 p.2) := |
| 286 | continuous_fst.snd.eval continuous_snd |
| 287 | exact hfirst.smul hsecond |
| 288 | have hleft := (smooth_retraction_differentials he hU heU hρ hρe).2.2 |
| 289 | let T := Ioo tau S |
| 290 | let l : Filter T := Filter.comap (Subtype.val : T → Real) (𝓝[<] S) |
| 291 | have hrange : range (Subtype.val : T → Real) ∈ 𝓝[<] S := by |
| 292 | simpa only [Subtype.range_coe] using Ioo_mem_nhdsLT htS |
| 293 | let : l.NeBot := (inferInstance : (𝓝[<] S).NeBot).comap_of_range_mem hrange |
| 294 | let : l.IsCountablyGenerated := inferInstance |
| 295 | let inc : T → C := fun t => ⟨t, t.2.1.le, t.2.2.le⟩ |
| 296 | have hinc : Tendsto inc l (𝓝 endTime) := by |
| 297 | apply tendsto_subtype_rng.mpr |
| 298 | exact (tendsto_comap : Tendsto (Subtype.val : T → Real) l (𝓝[<] S)).mono_right |
| 299 | nhdsWithin_le_nhds |
| 300 | have hpiLim : Tendsto pi (𝓝[<] S) (𝓝 endTime) := by |
| 301 | have hp : Tendsto pi (𝓝 S) (𝓝 (pi S)) := continuous_projIcc.tendsto S |
| 302 | simpa only [pi, projIcc_of_mem htS.le (show S ∈ C from ⟨htS.le, le_rfl⟩)] using |
| 303 | hp.mono_left nhdsWithin_le_nhds |
| 304 | let State (i : Nat) := {q : Path // ∀ (t : C), (t : Real) < S → ∀ x : Real, |
| 305 | q t (x : AddCircle curvePeriod) = A i (x, t)} |
| 306 | have step (i : Nat) (Q : State i) : ∃ Q' : State (i + 1), |
| 307 | ∀ (t : C) (x : Real), HasDerivAt (fun y : Real => Q.1 t (y : AddCircle curvePeriod)) |
| 308 | (v t (x : AddCircle curvePeriod) • |
| 309 | (Q'.1 t (x : AddCircle curvePeriod) + B t (r t (x : AddCircle curvePeriod)) |
| 310 | (sigma t (x : AddCircle curvePeriod)) (Q.1 t (x : AddCircle curvePeriod)))) x := by |
| 311 | let DX := M08.coordinatePartialS (A i) |
| 312 | have hDX : ContDiffOn Real ∞ DX Ω := M08.coordinatePartialS_contDiffOn hΩ (A i) (hA i) |
| 313 | have hXeq (t : Real) (ht : t ∈ Ico tau S) : |
| 314 | (fun x => DX (x, t)) = deriv (fun x => A i (x, t)) := |
| 315 | funext fun x => (hdx i t ht x).deriv.symm |
| 316 | have hper (t : Real) (ht : t ∈ Ico tau S) : |
| 317 | Function.Periodic (fun x => DX (x, t)) curvePeriod := by |
| 318 | rw [hXeq t ht] |
| 319 | apply hderivper |
| 320 | intro x |
| 321 | change A i (x + curvePeriod, t) = A i (x, t) |
| 322 | erw [← Q.2 ⟨t, ht.1, ht.2.le⟩ ht.2 (x + curvePeriod), |
| 323 | ← Q.2 ⟨t, ht.1, ht.2.le⟩ ht.2 x, AddCircle.coe_add_period] |
| 324 | obtain ⟨df, hdf, hdfrep⟩ := descend (Ico tau S) DX |
| 325 | (hDX.continuousOn.mono (fun z hz => ⟨mem_univ _, htime z.2 hz.2⟩)) hper |
| 326 | have hder (t : T) (x : Real) : HasDerivAt |
| 327 | (fun y : Real => Q.1 (inc t) (y : AddCircle curvePeriod)) |
| 328 | (df t (x : AddCircle curvePeriod)) x := by |
| 329 | rw [hdfrep t ⟨t.2.1.le, t.2.2⟩] |
| 330 | exact (hdx i t ⟨t.2.1.le, t.2.2⟩ x).congr_of_eventuallyEq |
| 331 | (Eventually.of_forall (Q.2 (inc t) t.2.2)) |
| 332 | have hLip (t : T) : LipschitzWith (⟨bound i, hbound i⟩ : NNReal) |
| 333 | (fun x : Real => df t (x : AddCircle curvePeriod)) := by |
| 334 | have hs : ContDiff Real ∞ (fun x => DX (x, t)) := |
| 335 | hDX.comp_contDiff (contDiff_id.prodMk contDiff_const) |
| 336 | (fun _ => ⟨mem_univ _, htime t ⟨t.2.1.le, t.2.2⟩⟩) |
| 337 | have heq : (fun x : Real => df t (x : AddCircle curvePeriod)) = |
| 338 | fun x => DX (x, t) := funext (hdfrep t ⟨t.2.1.le, t.2.2⟩) |
| 339 | rw [heq] |
| 340 | apply lipschitzWith_of_nnnorm_deriv_le (hs.differentiable (by simp)) |
| 341 | intro x |
| 342 | change ‖deriv (fun y => DX (y, t)) x‖ ≤ bound i |
| 343 | rw [hXeq t ⟨t.2.1.le, t.2.2⟩] |
| 344 | exact hsecond i t t.property x |
| 345 | obtain ⟨dg, hdg, hderg⟩ := exists_periodic_derivative_limit_along_filter l |
| 346 | (fun t => Q.1 (inc t)) (fun t => df t) (Q.1 endTime) hder hLip |
| 347 | (Q.1.continuous.tendsto endTime |>.comp hinc) |
| 348 | have hdgReal : Tendsto df (𝓝[<] S) (𝓝 dg) := |
| 349 | (tendsto_comap'_iff hrange).mp hdg |
| 350 | let coefficientInput : C × AddCircle curvePeriod → (Real × W) × (W × W) := |
| 351 | fun z => ((z.1.1, r z.1 z.2), (sigma z.1 z.2, Q.1 z.1 z.2)) |
| 352 | have hinput : Continuous coefficientInput := |
| 353 | ((continuous_subtype_val.comp continuous_fst).prodMk r.uncurry.continuous).prodMk |
| 354 | (sigma.uncurry.continuous.prodMk Q.1.uncurry.continuous) |
| 355 | let Bq : Path := (⟨fun z => B z.1 (r z.1 z.2) (sigma z.1 z.2) (Q.1 z.1 z.2), |
| 356 | hBC.comp_continuous (f := coefficientInput) hinput |
| 357 | (fun z => ⟨⟨hC z.1.2, hrU z.1 z.2⟩, mem_univ _⟩)⟩ : |
| 358 | C(C × AddCircle curvePeriod, W)).curry |
| 359 | let fn : Real → X := fun t => mulV (iv (pi t), df t) - Bq (pi t) |
| 360 | let gn : X := mulV (iv endTime, dg) - Bq endTime |
| 361 | have hfn : ContinuousOn fn (Ico tau S) := |
| 362 | (hmulV.comp_continuousOn |
| 363 | ((iv.continuous.comp continuous_projIcc).continuousOn.prodMk hdf)).sub |
| 364 | (Bq.continuous.comp continuous_projIcc).continuousOn |
| 365 | have hfnLim : Tendsto fn (𝓝[<] S) (𝓝 gn) := |
| 366 | ((hmulV.tendsto _).comp |
| 367 | (((iv.continuous.tendsto endTime).comp hpiLim).prodMk_nhds hdgReal)).sub |
| 368 | ((Bq.continuous.tendsto endTime).comp hpiLim) |
| 369 | have hupdate : ContinuousOn (Function.update fn S gn) C := by |
| 370 | rw [continuousOn_update_iff, Icc_sdiff_right] |
| 371 | refine ⟨hfn, fun _ => ?_⟩ |
| 372 | rwa [nhdsWithin_Ico_eq_nhdsLT htS] |
| 373 | let qnext : Path := ⟨fun t => Function.update fn S gn t, hupdate.domRestrict⟩ |
| 374 | have hBactual (t : C) (ht : (t : Real) < S) (x : Real) : |
| 375 | B t (r t (x : AddCircle curvePeriod)) (sigma t (x : AddCircle curvePeriod)) |
| 376 | (Q.1 t (x : AddCircle curvePeriod)) = |
| 377 | coordinateHessian (F0.connection t) e (c x t) |
| 378 | (spatialUnitTangent F0 c t x) (m63CurvatureJet F0 c i t x) := by |
| 379 | dsimp only [B] |
| 380 | rw [show r t (x : AddCircle curvePeriod) = e (c x t) from hrrep t t.property x, |
| 381 | show sigma t (x : AddCircle curvePeriod) = |
| 382 | mfderiv (𝓡 n) 𝓘(Real, W) e (c x t) (spatialUnitTangent F0 c t x) from |
| 383 | (hsrep t t.property x).trans (hsigmarep t (hC t.property) x), Q.2 t ht x] |
| 384 | dsimp only [A] |
| 385 | erw [hleft (c x t) (spatialUnitTangent F0 c t x), |
| 386 | hleft (c x t) (m63CurvatureJet F0 c i t x), hρe (c x t)] |
| 387 | have hdfnext (t : C) (ht : (t : Real) < S) (x : Real) : |
| 388 | df t (x : AddCircle curvePeriod) = v t (x : AddCircle curvePeriod) • |
| 389 | (A (i + 1) (x, t) + B t (r t (x : AddCircle curvePeriod)) |
| 390 | (sigma t (x : AddCircle curvePeriod)) (Q.1 t (x : AddCircle curvePeriod))) := by |
| 391 | rw [hdfrep t ⟨t.2.1, ht⟩, hvrep, hBactual t ht] |
| 392 | exact (hdx i t ⟨t.2.1, ht⟩ x).unique |
| 393 | (hasDerivAt_embeddedCurvatureJet_spatial F0 c hc0 he i |
| 394 | (htime t ⟨t.2.1, ht⟩) x) |
| 395 | have hnextrep (t : C) (ht : (t : Real) < S) (x : Real) : |
| 396 | qnext t (x : AddCircle curvePeriod) = A (i + 1) (x, t) := by |
| 397 | change Function.update fn S gn t (x : AddCircle curvePeriod) = _ |
| 398 | rw [Function.update_of_ne ht.ne] |
| 399 | change (v (pi t) (x : AddCircle curvePeriod))⁻¹ • df t (x : AddCircle curvePeriod) - |
| 400 | B (pi t) (r (pi t) (x : AddCircle curvePeriod)) |
| 401 | (sigma (pi t) (x : AddCircle curvePeriod)) (Q.1 (pi t) (x : AddCircle curvePeriod)) = _ |
| 402 | rw [hpi t t.property, hdfnext t ht, smul_smul, |
| 403 | inv_mul_cancel₀ (hvpositive t (x : AddCircle curvePeriod)).ne', one_smul, |
| 404 | add_sub_cancel_right] |
| 405 | refine ⟨⟨qnext, hnextrep⟩, ?_⟩ |
| 406 | intro t x |
| 407 | by_cases ht : (t : Real) = S |
| 408 | · have hte : t = endTime := Subtype.ext ht |
| 409 | subst t |
| 410 | apply (hderg x).congr_deriv |
| 411 | change dg (x : AddCircle curvePeriod) = v endTime (x : AddCircle curvePeriod) • |
| 412 | (Function.update fn S gn S (x : AddCircle curvePeriod) + |
| 413 | B S (r endTime (x : AddCircle curvePeriod)) (sigma endTime (x : AddCircle curvePeriod)) |
| 414 | (Q.1 endTime (x : AddCircle curvePeriod))) |
| 415 | rw [Function.update_self] |
| 416 | change dg (x : AddCircle curvePeriod) = v endTime (x : AddCircle curvePeriod) • |
| 417 | ((v endTime (x : AddCircle curvePeriod))⁻¹ • dg (x : AddCircle curvePeriod) - |
| 418 | B S (r endTime (x : AddCircle curvePeriod)) (sigma endTime (x : AddCircle curvePeriod)) |
| 419 | (Q.1 endTime (x : AddCircle curvePeriod)) + |
| 420 | B S (r endTime (x : AddCircle curvePeriod)) (sigma endTime (x : AddCircle curvePeriod)) |
| 421 | (Q.1 endTime (x : AddCircle curvePeriod))) |
| 422 | rw [sub_add_cancel, smul_smul, |
| 423 | mul_inv_cancel₀ (hvpositive endTime (x : AddCircle curvePeriod)).ne', one_smul] |
| 424 | · have hlt : (t : Real) < S := lt_of_le_of_ne t.2.2 ht |
| 425 | rw [hnextrep t hlt, hvrep, hBactual t hlt] |
| 426 | exact (hasDerivAt_embeddedCurvatureJet_spatial F0 c hc0 he i |
| 427 | (htime t ⟨t.2.1, hlt⟩) x).congr_of_eventuallyEq |
| 428 | (Eventually.of_forall (Q.2 t hlt)) |
| 429 | choose next hnext using step |
| 430 | let initial : State 0 := ⟨H, fun t _ x => hHrep t t.property x⟩ |
| 431 | let seq : (i : Nat) → State i := fun i => Nat.rec (motive := State) initial |
| 432 | (fun j q => next j q) i |
| 433 | let η : Nat → Path := fun i => (seq i).1 |
| 434 | have hrec (i : Nat) (t : C) (x : Real) : |
| 435 | HasDerivAt (fun y : Real => η i t (y : AddCircle curvePeriod)) |
| 436 | (v t (x : AddCircle curvePeriod) • |
| 437 | (η (i + 1) t (x : AddCircle curvePeriod) + B t (r t (x : AddCircle curvePeriod)) |
| 438 | (sigma t (x : AddCircle curvePeriod)) (η i t (x : AddCircle curvePeriod)))) x := |
| 439 | hnext i (seq i) t x |
| 440 | have hid := curvatureJet_identification_of_embedded_recurrences F0 hat htS le_rfl |
| 441 | he hU heU hρ hρe (c2_restrict (m63C2_of_m62 hc0) hC) η |
| 442 | (fun t x => hHrep t t.property x) (by |
| 443 | intro i t x |
| 444 | have hd := hrec i t x |
| 445 | rw [hvrep, show r t (x : AddCircle curvePeriod) = e (c x t) from hrrep t t.property x, |
| 446 | show sigma t (x : AddCircle curvePeriod) = |
| 447 | mfderiv (𝓡 n) 𝓘(Real, W) e (c x t) (spatialUnitTangent F0 c t x) from |
| 448 | (hsrep t t.property x).trans (hsigmarep t (hC t.property) x)] at hd |
| 449 | exact hd) |
| 450 | refine ⟨η, ?_, ?_, ?_, ?_⟩ |
| 451 | · simpa only [hjet0] using hid.1 |
| 452 | · intro i t x |
| 453 | have hd := hrec i t x |
| 454 | have hb : B t (r t (x : AddCircle curvePeriod)) (sigma t (x : AddCircle curvePeriod)) |
| 455 | (η i t (x : AddCircle curvePeriod)) = |
| 456 | coordinateHessian (F0.connection t) e (c x t) |
| 457 | (spatialUnitTangent F0 c t x) (m63CurvatureJet F0 c i t x) := by |
| 458 | dsimp only [B] |
| 459 | rw [show r t (x : AddCircle curvePeriod) = e (c x t) from hrrep t t.property x, |
| 460 | show sigma t (x : AddCircle curvePeriod) = |
| 461 | mfderiv (𝓡 n) 𝓘(Real, W) e (c x t) (spatialUnitTangent F0 c t x) from |
| 462 | (hsrep t t.property x).trans (hsigmarep t (hC t.property) x), hid.1 i t x] |
| 463 | erw [hleft (c x t) (spatialUnitTangent F0 c t x), |
| 464 | hleft (c x t) (m63CurvatureJet F0 c i t x), hρe (c x t)] |
| 465 | rw [hvrep, hb] at hd |
| 466 | change HasDerivAt (fun y : Real => η i t (y : AddCircle curvePeriod)) |
| 467 | (curveSpeed F c t x • (η (i + 1) t (x : AddCircle curvePeriod) + |
| 468 | coordinateHessian (F.connection t) e (c x t) |
| 469 | (spatialUnitTangent F c t x) (m63CurvatureJet F0 c i t x))) x at hd |
| 470 | simpa only [hjet0] using hd |
| 471 | · simpa only [hjet0] using hid.2.1 |
| 472 | · simpa only [hjet0] using hid.2.2 |
| 473 | |
| 474 | end PoincareMT.M63 |