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.Uniqueness.AmbientAcceleration |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Uniqueness.EmbeddedCurve |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Ambient.CurveCoefficients |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Retraction.TangentContinuity |
| 6 | import PoincareLib.Geometry.CurveShortening.Ramp.Adapters |
| 7 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Integral.Continuity |
| 8 | import PoincareLib.Geometry.RicciFlow.Curvature.Calculus.Identities.ScalarHessian |
| 9 | import Mathlib.Analysis.Calculus.UniformLimitsDeriv |
| 10 | import Mathlib.Topology.ContinuousMap.Compact |
| 11 | import Mathlib.Analysis.Normed.Group.AddCircle |
| 12 | |
| 13 | /-! |
| 14 | # Reconstruction of the actual C2 normal curve |
| 15 | |
| 16 | Limits of the actual embedded geometric fields determine the first and |
| 17 | second spatial derivatives before any limiting curve record is used. |
| 18 | The time derivative then passes through the actual full derivatives of |
| 19 | the smooth approximants. MT2007 Claim 19.1, p. 437; |
| 20 | `2026-09-22-c2-normal-limit-reconstruction.md`, statement 4. |
| 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 |
| 28 | |
| 29 | universe u v |
| 30 | |
| 31 | namespace PoincareMT.M63 |
| 32 | |
| 33 | open M62 |
| 34 | |
| 35 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 36 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 37 | {ι : Type v} [Fintype ι] {a b : ℝ} |
| 38 | |
| 39 | local notation "W" => EuclideanSpace ℝ ι |
| 40 | local notation "X" => C(AddCircle curvePeriod, W) |
| 41 | local notation "XR" => C(AddCircle curvePeriod, ℝ) |
| 42 | |
| 43 | set_option maxHeartbeats 800000 in |
| 44 | -- Dependent tangent-fiber algebra and the final C2 coordinate normalization |
| 45 | -- exceed the default budget. |
| 46 | /-- Actual five-field limits reconstruct a C2 normal solution, with |
| 47 | genuine spatial and time witnesses and a uniform initial curvature |
| 48 | trace. No joint continuity of the approximating speed gradients is |
| 49 | assumed. MT2007 Claim 19.1, p. 437; reconstruction statement 4. -/ |
| 50 | theorem normalCurve_c2_of_uniform_embedded_field_limits |
| 51 | (F : RicciFlow n M (Icc a b)) {e : M → W} |
| 52 | (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) |
| 53 | {U : Set W} (hU : IsOpen U) (heU : range e ⊆ U) {ρ : W → M} |
| 54 | (hρ : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ ρ U) (hρe : ∀ p, ρ (e p) = p) |
| 55 | (cn : ℕ → ℝ → ℝ → M) (hcn : ∀ j, M62ShrinkingCurve F (cn j)) |
| 56 | (Rn Sn Hn : ℕ → ℝ → X) (Vn Wn : ℕ → ℝ → XR) |
| 57 | (hRrep : ∀ j t, t ∈ Icc a b → ∀ x : ℝ, |
| 58 | Rn j t (x : AddCircle curvePeriod) = e (cn j x t)) |
| 59 | (hSrep : ∀ j t, t ∈ Icc a b → ∀ x : ℝ, Sn j t (x : AddCircle curvePeriod) = |
| 60 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (cn j x t) (spatialUnitTangent F (cn j) t x)) |
| 61 | (hHrep : ∀ j t, t ∈ Icc a b → ∀ x : ℝ, Hn j t (x : AddCircle curvePeriod) = |
| 62 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (cn j x t) (m62CurvatureVector F (cn j) t x)) |
| 63 | (hVrep : ∀ j t, t ∈ Icc a b → ∀ x : ℝ, |
| 64 | Vn j t (x : AddCircle curvePeriod) = curveSpeed F (cn j) t x) |
| 65 | (hWrep : ∀ j t, t ∈ Icc a b → ∀ x : ℝ, |
| 66 | Wn j t (x : AddCircle curvePeriod) = deriv (curveSpeed F (cn j) t) x) |
| 67 | (r s h : ℝ → X) (v g : ℝ → XR) |
| 68 | (hr : ContinuousOn r (Icc a b)) (hs : ContinuousOn s (Icc a b)) |
| 69 | (hh : ContinuousOn h (Icc a b)) (hv : ContinuousOn v (Icc a b)) |
| 70 | (_hg : ContinuousOn g (Icc a b)) |
| 71 | (hR : TendstoUniformlyOn Rn r atTop (Icc a b)) |
| 72 | (hS : TendstoUniformlyOn Sn s atTop (Icc a b)) |
| 73 | (hH : TendstoUniformlyOn Hn h atTop (Icc a b)) |
| 74 | (hV : TendstoUniformlyOn Vn v atTop (Icc a b)) |
| 75 | (hW : TendstoUniformlyOn Wn g atTop (Icc a b)) |
| 76 | (hrU : ∀ t ∈ Icc a b, ∀ x : ℝ, r t (x : AddCircle curvePeriod) ∈ U) |
| 77 | (hvpos : ∀ t ∈ Icc a b, ∀ x : ℝ, 0 < v t (x : AddCircle curvePeriod)) : |
| 78 | let c := fun (x t : ℝ) => ρ (r t (x : AddCircle curvePeriod)) |
| 79 | let p := fun (t x : ℝ) => v t (x : AddCircle curvePeriod) • s t (x : AddCircle curvePeriod) |
| 80 | let Z := fun (t x : ℝ) => (v t (x : AddCircle curvePeriod)) ^ 2 • |
| 81 | (h t (x : AddCircle curvePeriod) - ambientCurveLower F e ρ t |
| 82 | (r t (x : AddCircle curvePeriod)) (p t x)) + |
| 83 | g t (x : AddCircle curvePeriod) • s t (x : AddCircle curvePeriod) |
| 84 | M63C2ShrinkingCurveOn F c (Icc a b) ∧ |
| 85 | (∀ t ∈ Icc a b, ∀ x : ℝ, |
| 86 | HasDerivAt (fun y : ℝ => r t (y : AddCircle curvePeriod)) (p t x) x ∧ |
| 87 | HasDerivAt (p t) (Z t x) x ∧ curveSpeed F c t x = v t (x : AddCircle curvePeriod) ∧ |
| 88 | deriv (curveSpeed F c t) x = g t (x : AddCircle curvePeriod) ∧ |
| 89 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (m62CurvatureVector F c t x) = |
| 90 | h t (x : AddCircle curvePeriod)) ∧ |
| 91 | (∀ t ∈ Ioo a b, ∀ x : ℝ, HasDerivAt |
| 92 | (fun u => r u (x : AddCircle curvePeriod)) (h t (x : AddCircle curvePeriod)) t) ∧ |
| 93 | ∀ ε > 0, ∃ d > 0, ∀ t ∈ Icc a b, t - a < d → ∀ x : ℝ, |
| 94 | ‖HSub.hSub (α := W) (β := W) (γ := W) |
| 95 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (m62CurvatureVector F c t x)) |
| 96 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x a) (m62CurvatureVector F c a x))‖ < ε := by |
| 97 | classical |
| 98 | let : Fact (0 < curvePeriod) := ⟨by unfold curvePeriod; positivity⟩ |
| 99 | dsimp only |
| 100 | let c := fun (x t : ℝ) => ρ (r t (x : AddCircle curvePeriod)) |
| 101 | let mulC (q : XR × X) : X := |
| 102 | ⟨fun z => q.1 z • q.2 z, q.1.continuous.smul q.2.continuous⟩ |
| 103 | have hmulC : Continuous mulC := by |
| 104 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 105 | have hscalar : Continuous (fun q : (XR × X) × AddCircle curvePeriod => q.1.1 q.2) := |
| 106 | continuous_fst.fst.eval continuous_snd |
| 107 | have hvector : Continuous (fun q : (XR × X) × AddCircle curvePeriod => q.1.2 q.2) := |
| 108 | continuous_fst.snd.eval continuous_snd |
| 109 | exact hscalar.smul hvector |
| 110 | let Pn := fun j t => mulC (Vn j t, Sn j t) |
| 111 | let p := fun t => mulC (v t, s t) |
| 112 | have hp : ContinuousOn p (Icc a b) := hmulC.comp_continuousOn (hv.prodMk hs) |
| 113 | have hab : a < b := by |
| 114 | obtain ⟨u, hu, w, hw, hne⟩ := F.nontrivial |
| 115 | by_contra hnot |
| 116 | have heq : a = b := le_antisymm (hu.1.trans hu.2) (le_of_not_gt hnot) |
| 117 | apply hne |
| 118 | rw [← heq] at hu hw |
| 119 | exact (le_antisymm hu.2 hu.1).trans (le_antisymm hw.2 hw.1).symm |
| 120 | have ha : a ∈ Icc a b := ⟨le_rfl, hab.le⟩ |
| 121 | have hleft := (smooth_retraction_differentials he hU heU hρ hρe).2.2 |
| 122 | have hdata (j : ℕ) := c2ShrinkingCurve_embedded_closed_data (m63C2_of_m62 (hcn j)) he |
| 123 | have htimeData (j : ℕ) := |
| 124 | c2ShrinkingCurve_embedded_interior_equation (m63C2_of_m62 (hcn j)) he |
| 125 | have liftCont (f : ℝ → X) |
| 126 | (hf : ContinuousOn f (Icc a b)) : |
| 127 | ContinuousOn (fun z : ℝ × ℝ => f z.2 (z.1 : AddCircle curvePeriod)) |
| 128 | (univ ×ˢ Icc a b) := |
| 129 | (hf.comp continuous_snd.continuousOn (fun z hz => hz.2)).eval |
| 130 | ((AddCircle.continuous_mk' curvePeriod).comp continuous_fst).continuousOn |
| 131 | have hquot : IsOpenQuotientMap |
| 132 | (fun z : Icc a b × ℝ => (z.1, (z.2 : AddCircle curvePeriod))) := |
| 133 | IsOpenQuotientMap.id.prodMap QuotientAddGroup.isOpenQuotientMap_mk |
| 134 | have hVcont (j : ℕ) : ContinuousOn (Vn j) (Icc a b) := by |
| 135 | have hlift : ContinuousOn (fun z : ℝ × ℝ => Vn j z.2 (z.1 : AddCircle curvePeriod)) |
| 136 | (univ ×ˢ Icc a b) := |
| 137 | (speed_continuousOn F (cn j) (hcn j)).congr (fun z hz => hVrep j z.2 hz.2 z.1) |
| 138 | apply continuousOn_iff_continuous_domRestrict.mpr |
| 139 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 140 | exact hquot.continuous_comp_iff.mp |
| 141 | (hlift.comp_continuous |
| 142 | (continuous_snd.prodMk (continuous_subtype_val.comp continuous_fst)) |
| 143 | (fun z => ⟨mem_univ _, z.1.2⟩)) |
| 144 | have hScont (j : ℕ) : ContinuousOn (Sn j) (Icc a b) := by |
| 145 | have hlift : ContinuousOn (fun z : ℝ × ℝ => Sn j z.2 (z.1 : AddCircle curvePeriod)) |
| 146 | (univ ×ˢ Icc a b) := by |
| 147 | have hsp := (speed_continuousOn F (cn j) (hcn j)).inv₀ |
| 148 | (fun z hz => (speed_pos F (cn j) (hcn j) hz.2 z.1).ne') |
| 149 | apply (hsp.smul (hdata j).2.2.2.1).congr |
| 150 | intro z hz |
| 151 | change Sn j z.2 (z.1 : AddCircle curvePeriod) = |
| 152 | (curveSpeed F (cn j) z.2 z.1)⁻¹ • deriv (fun y => e (cn j y z.2)) z.1 |
| 153 | rw [((hdata j).2.1 z.2 hz.2 z.1).deriv] |
| 154 | rw [hSrep j z.2 hz.2 z.1, spatialUnitTangent, map_smul] |
| 155 | apply continuousOn_iff_continuous_domRestrict.mpr |
| 156 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 157 | exact hquot.continuous_comp_iff.mp |
| 158 | (hlift.comp_continuous |
| 159 | (continuous_snd.prodMk (continuous_subtype_val.comp continuous_fst)) |
| 160 | (fun z => ⟨mem_univ _, z.1.2⟩)) |
| 161 | let Vm (j : ℕ) : C(Icc a b, XR) := ⟨fun t => Vn j t, (hVcont j).domRestrict⟩ |
| 162 | let Sm (j : ℕ) : C(Icc a b, X) := ⟨fun t => Sn j t, (hScont j).domRestrict⟩ |
| 163 | let vm : C(Icc a b, XR) := ⟨fun t => v t, hv.domRestrict⟩ |
| 164 | let sm : C(Icc a b, X) := ⟨fun t => s t, hs.domRestrict⟩ |
| 165 | let pmul (q : C(Icc a b, XR) × C(Icc a b, X)) : C(Icc a b, X) := |
| 166 | ⟨fun t => mulC (q.1 t, q.2 t), hmulC.comp (q.1.continuous.prodMk q.2.continuous)⟩ |
| 167 | have hpmul : Continuous pmul := by |
| 168 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 169 | exact hmulC.comp ((continuous_fst.fst.eval continuous_snd).prodMk |
| 170 | (continuous_fst.snd.eval continuous_snd)) |
| 171 | have hP : TendstoUniformlyOn Pn p atTop (Icc a b) := by |
| 172 | apply (hp.tendsto_domRestrict_iff_tendstoUniformlyOn |
| 173 | (fun j => hmulC.comp_continuousOn ((hVcont j).prodMk (hScont j)))).mp |
| 174 | exact (hpmul.tendsto (vm, sm)).comp |
| 175 | (((hv.tendsto_domRestrict_iff_tendstoUniformlyOn hVcont).mpr hV).prodMk_nhds |
| 176 | ((hs.tendsto_domRestrict_iff_tendstoUniformlyOn hScont).mpr hS)) |
| 177 | have hrfix (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 178 | e (c x t) = r t (x : AddCircle curvePeriod) := by |
| 179 | have hz := (continuous_eval_const (x : AddCircle curvePeriod)).tendsto (r t) |
| 180 | |>.comp (hR.tendsto_at ht) |
| 181 | have hguard : ∀ j, Rn j t (x : AddCircle curvePeriod) ∈ U := by |
| 182 | intro j |
| 183 | rw [hRrep j t ht] |
| 184 | exact heU (mem_range_self _) |
| 185 | have hpost := ((he.continuous.comp_continuousOn hρ.continuousOn) |
| 186 | _ (hrU t ht x)).tendsto.comp |
| 187 | (tendsto_nhdsWithin_iff.mpr ⟨hz, Eventually.of_forall hguard⟩) |
| 188 | have heq : ∀ j, e (ρ (Rn j t (x : AddCircle curvePeriod))) = |
| 189 | Rn j t (x : AddCircle curvePeriod) := by |
| 190 | intro j |
| 191 | rw [hRrep j t ht, hρe] |
| 192 | exact tendsto_nhds_unique (hpost.congr' (Eventually.of_forall heq)) hz |
| 193 | have hmetric := (flow_pullback_metric_hessian_contDiffOn F hU hρ |
| 194 | (f := fun _ => 0) contMDiff_const).1.continuousOn |
| 195 | have hunit (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 196 | (F.metric t).inner (c x t) |
| 197 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (r t (x : AddCircle curvePeriod)) |
| 198 | (s t (x : AddCircle curvePeriod))) |
| 199 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (r t (x : AddCircle curvePeriod)) |
| 200 | (s t (x : AddCircle curvePeriod))) = 1 := by |
| 201 | have hRz := (continuous_eval_const (x : AddCircle curvePeriod)).tendsto (r t) |
| 202 | |>.comp (hR.tendsto_at ht) |
| 203 | have hSz := (continuous_eval_const (x : AddCircle curvePeriod)).tendsto (s t) |
| 204 | |>.comp (hS.tendsto_at ht) |
| 205 | have hguard (j : ℕ) : ((t, Rn j t (x : AddCircle curvePeriod)), |
| 206 | Sn j t (x : AddCircle curvePeriod)) ∈ ((Icc a b ×ˢ U) ×ˢ univ) := by |
| 207 | refine ⟨⟨ht, ?_⟩, mem_univ _⟩ |
| 208 | change Rn j t (x : AddCircle curvePeriod) ∈ U |
| 209 | rw [hRrep j t ht] |
| 210 | exact heU (mem_range_self _) |
| 211 | have hlim := (hmetric ((t, r t (x : AddCircle curvePeriod)), s t (x : AddCircle curvePeriod)) |
| 212 | ⟨⟨ht, hrU t ht x⟩, mem_univ _⟩).tendsto.comp |
| 213 | (tendsto_nhdsWithin_iff.mpr ⟨(tendsto_const_nhds.prodMk_nhds hRz).prodMk_nhds hSz, |
| 214 | Eventually.of_forall hguard⟩) |
| 215 | have heq (j : ℕ) : (F.metric t).inner (ρ (Rn j t (x : AddCircle curvePeriod))) |
| 216 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (Rn j t (x : AddCircle curvePeriod)) |
| 217 | (Sn j t (x : AddCircle curvePeriod))) |
| 218 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (Rn j t (x : AddCircle curvePeriod)) |
| 219 | (Sn j t (x : AddCircle curvePeriod))) = 1 := by |
| 220 | rw [hRrep j t ht, hSrep j t ht, hleft, hρe] |
| 221 | exact unitTangent_inner_self F (cn j) (hcn j) ht x |
| 222 | exact tendsto_nhds_unique (hlim.congr' (Eventually.of_forall heq)) tendsto_const_nhds |
| 223 | have hfirstn (j : ℕ) (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 224 | HasDerivAt (fun y : ℝ => Rn j t (y : AddCircle curvePeriod)) |
| 225 | (Pn j t (x : AddCircle curvePeriod)) x := by |
| 226 | have hd := (hdata j).2.1 t ht x |
| 227 | have hvel : curveVelocity (fun y => cn j y t) x = |
| 228 | curveSpeed F (cn j) t x • spatialUnitTangent F (cn j) t x := by |
| 229 | simp only [spatialUnitTangent, smul_smul, |
| 230 | mul_inv_cancel₀ (speed_pos F (cn j) (hcn j) ht x).ne', one_smul] |
| 231 | rw [hvel, map_smul] at hd |
| 232 | change HasDerivAt _ (Vn j t (x : AddCircle curvePeriod) • |
| 233 | Sn j t (x : AddCircle curvePeriod)) x |
| 234 | rw [hVrep j t ht, hSrep j t ht] |
| 235 | exact hd.congr_of_eventuallyEq (Eventually.of_forall (hRrep j t ht)) |
| 236 | have hfirst (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 237 | HasDerivAt (fun y : ℝ => r t (y : AddCircle curvePeriod)) |
| 238 | (p t (x : AddCircle curvePeriod)) x := |
| 239 | hasDerivAt_of_tendstoUniformly |
| 240 | ((ContinuousMap.tendsto_iff_tendstoUniformly.mp (hP.tendsto_at ht)).comp |
| 241 | (fun y : ℝ => (y : AddCircle curvePeriod))) |
| 242 | (Eventually.of_forall (fun j y => hfirstn j t ht y)) |
| 243 | (fun y => (continuous_eval_const (y : AddCircle curvePeriod)).tendsto (r t) |
| 244 | |>.comp (hR.tendsto_at ht)) x |
| 245 | have hrC1 (t : ℝ) (ht : t ∈ Icc a b) : |
| 246 | ContDiff ℝ 1 (fun x : ℝ => r t (x : AddCircle curvePeriod)) := by |
| 247 | apply contDiff_one_iff_hasFDerivAt.mpr |
| 248 | refine ⟨fun x => (1 : ℝ →L[ℝ] ℝ).smulRight (p t (x : AddCircle curvePeriod)), |
| 249 | (ContinuousLinearMap.smulRightL ℝ ℝ W 1).continuous.comp |
| 250 | ((p t).continuous.comp (AddCircle.continuous_mk' curvePeriod)), ?_⟩ |
| 251 | exact fun x => (hfirst t ht x).hasFDerivAt |
| 252 | have hcC1 (t : ℝ) (ht : t ∈ Icc a b) : |
| 253 | ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 1 (fun x => c x t) := |
| 254 | (hρ.of_le (by norm_num)).comp_contMDiff (hrC1 t ht).contMDiff (hrU t ht) |
| 255 | have hvel (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 256 | curveVelocity (fun y => c y t) x = |
| 257 | v t (x : AddCircle curvePeriod) • mfderiv 𝓘(ℝ, W) (𝓡 n) ρ |
| 258 | (r t (x : AddCircle curvePeriod)) (s t (x : AddCircle curvePeriod)) := by |
| 259 | have hchain := mfderiv_comp x |
| 260 | ((hρ.contMDiffAt (hU.mem_nhds (hrU t ht x))).mdifferentiableAt (by simp)) |
| 261 | (hfirst t ht x).differentiableAt.mdifferentiableAt |
| 262 | have hv := congrArg (fun L : ℝ →L[ℝ] TangentSpace (𝓡 n) (c x t) => L 1) hchain |
| 263 | rw [mfderiv_eq_fderiv, (hfirst t ht x).hasFDerivAt.fderiv] at hv |
| 264 | change curveVelocity (fun y => c y t) x = |
| 265 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (r t (x : AddCircle curvePeriod)) |
| 266 | ((1 : ℝ) • p t (x : AddCircle curvePeriod)) at hv |
| 267 | simpa only [one_smul, p, mulC, ContinuousMap.coe_mk, map_smul] using! hv |
| 268 | have himm (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 269 | (curveVelocity (fun y => c y t) x : TangentSpace (𝓡 n) (c x t)) ≠ 0 := by |
| 270 | have hv := hvel t ht x |
| 271 | rw [hv] |
| 272 | apply smul_ne_zero (hvpos t ht x).ne' |
| 273 | intro hz |
| 274 | simpa [hz] using hunit t ht x |
| 275 | have hspeed (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 276 | curveSpeed F c t x = v t (x : AddCircle curvePeriod) := by |
| 277 | change Real.sqrt ((F.metric t).inner (c x t) |
| 278 | (curveVelocity (fun y => c y t) x) (curveVelocity (fun y => c y t) x)) = _ |
| 279 | rw [hvel t ht x] |
| 280 | simp only [map_smul, smul_apply, smul_eq_mul] |
| 281 | rw [hunit t ht x] |
| 282 | simp only [mul_one] |
| 283 | rw [← pow_two, Real.sqrt_sq (hvpos t ht x).le] |
| 284 | have hspeedDeriv (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 285 | HasDerivAt (fun y : ℝ => v t (y : AddCircle curvePeriod)) |
| 286 | (g t (x : AddCircle curvePeriod)) x := by |
| 287 | apply hasDerivAt_of_tendstoUniformly |
| 288 | ((ContinuousMap.tendsto_iff_tendstoUniformly.mp (hW.tendsto_at ht)).comp |
| 289 | (fun y : ℝ => (y : AddCircle curvePeriod))) |
| 290 | (Eventually.of_forall (fun j y => ?_)) |
| 291 | (fun y => (continuous_eval_const (y : AddCircle curvePeriod)).tendsto (v t) |
| 292 | |>.comp (hV.tendsto_at ht)) x |
| 293 | change HasDerivAt (fun z : ℝ => (Vn j t) (z : AddCircle curvePeriod)) |
| 294 | ((Wn j t) (y : AddCircle curvePeriod)) y |
| 295 | rw [hWrep j t ht] |
| 296 | exact (((speed_contDiff_of_c2 F (cn j) ((m63C2_of_m62 (hcn j)).spatial_regular t ht) |
| 297 | ((hcn j).immersed t ht)).differentiable (by simp)) y).hasDerivAt.congr_of_eventuallyEq |
| 298 | (Eventually.of_forall (hVrep j t ht)) |
| 299 | have hgrad (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 300 | deriv (curveSpeed F c t) x = g t (x : AddCircle curvePeriod) := by |
| 301 | rw [show curveSpeed F c t = (fun y : ℝ => v t (y : AddCircle curvePeriod)) from |
| 302 | funext (hspeed t ht)] |
| 303 | exact (hspeedDeriv t ht x).deriv |
| 304 | have pushDeriv (q : ℝ → M) (hq : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 1 q) (x : ℝ) : |
| 305 | HasDerivAt (fun y => e (q y)) (mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x) |
| 306 | (curveVelocity q x) : W) x := by |
| 307 | have hd := |
| 308 | (((he.of_le (by norm_num)).comp hq).contDiff.differentiable (by norm_num) x).hasDerivAt |
| 309 | have hchain := mfderiv_comp x (he.mdifferentiable (by simp)).mdifferentiableAt |
| 310 | ((hq x).mdifferentiableAt (by norm_num)) |
| 311 | rw [mfderiv_eq_fderiv] at hchain |
| 312 | exact hd.congr_deriv (congrArg (fun L : ℝ →L[ℝ] W => L 1) hchain) |
| 313 | have hpush (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 314 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (curveVelocity (fun y => c y t) x) = |
| 315 | p t (x : AddCircle curvePeriod) := |
| 316 | ((pushDeriv (fun y => c y t) (hcC1 t ht) x).congr_of_eventuallyEq |
| 317 | (Eventually.of_forall (fun y => (hrfix t ht y).symm))).unique (hfirst t ht x) |
| 318 | have hpushS (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 319 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (spatialUnitTangent F c t x) = |
| 320 | s t (x : AddCircle curvePeriod) := by |
| 321 | rw [spatialUnitTangent, map_smul, hpush t ht x, hspeed t ht x] |
| 322 | simp only [p, mulC, ContinuousMap.coe_mk] |
| 323 | rw [smul_smul, inv_mul_cancel₀ (hvpos t ht x).ne', one_smul] |
| 324 | have hraw (q : ℝ → ℝ → M) {t : ℝ} |
| 325 | (hq : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 (fun y => q y t)) |
| 326 | (hqi : ∀ x, curveVelocity (n := n) (fun y => q y t) x ≠ 0) (x : ℝ) : |
| 327 | deriv (deriv (fun y => e (q y t))) x = |
| 328 | HAdd.hAdd (α := W) (β := W) (γ := W) |
| 329 | (curveSpeed F q t x ^ 2 • |
| 330 | HSub.hSub (α := W) (β := W) (γ := W) |
| 331 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t) |
| 332 | (m62CurvatureVector F q t x) : W) |
| 333 | (ambientCurveLower F e ρ t (e (q x t)) |
| 334 | (deriv (fun y => e (q y t)) x))) |
| 335 | (deriv (curveSpeed F q t) x • |
| 336 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t) |
| 337 | (spatialUnitTangent F q t x) : W)) := by |
| 338 | have hvq := (Real.sqrt_pos.mpr ((F.metric t).pos _ _ (hqi x))).ne' |
| 339 | have hspeedq : curveSpeed F q t x ≠ 0 := by |
| 340 | change Real.sqrt _ ≠ 0 |
| 341 | exact hvq |
| 342 | have hfirstq := (pushDeriv (fun y => q y t) (hq.of_le (by norm_num)) x).deriv |
| 343 | have hB : ambientCurveLower F e ρ t (e (q x t)) (deriv (fun y => e (q y t)) x) = |
| 344 | -((curveSpeed F q t x ^ 2)⁻¹ • coordinateHessian (F.connection t) e (q x t) |
| 345 | (curveVelocity (fun y => q y t) x) (curveVelocity (fun y => q y t) x)) := by |
| 346 | dsimp only [ambientCurveLower, ambientCurvePrincipal] |
| 347 | rw [hfirstq, hleft, hρe, ← speed_sq] |
| 348 | have hcurv := embedded_curvature_eq_acceleration_sub_tangent F he q hq hqi x |
| 349 | have hS : (mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t) (spatialUnitTangent F q t x) : W) = |
| 350 | (curveSpeed F q t x)⁻¹ • deriv (fun y => e (q y t)) x := by |
| 351 | rw [spatialUnitTangent, map_smul, hfirstq] |
| 352 | rw [hB] |
| 353 | ext i |
| 354 | have hi := congrArg (fun z : W => z i) hcurv |
| 355 | have hiS := congrArg (fun z : W => z i) hS |
| 356 | simp only [PiLp.add_apply, PiLp.sub_apply, PiLp.smul_apply, PiLp.neg_apply, |
| 357 | smul_eq_mul] at hi hiS ⊢ |
| 358 | change _ = curveSpeed F q t x ^ 2 * (_ - _) + |
| 359 | deriv (curveSpeed F q t) x * |
| 360 | ((mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t) |
| 361 | (spatialUnitTangent F q t x) : W).ofLp i) |
| 362 | change _ = (curveSpeed F q t x ^ 2)⁻¹ * (_ - _) - |
| 363 | (deriv (curveSpeed F q t) x / curveSpeed F q t x ^ 3) * _ at hi |
| 364 | rw [hiS] at ⊢ |
| 365 | field_simp [hvq, hspeedq] at hi hiS ⊢ |
| 366 | nlinarith [hi, hiS] |
| 367 | let Ω : Set (W × W) := {z | z.1 ∈ U ∧ mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1 z.2 ≠ 0} |
| 368 | have hguardn (j : ℕ) (t : ℝ) (ht : t ∈ Icc a b) (z : AddCircle curvePeriod) : |
| 369 | (Rn j t z, Pn j t z) ∈ Ω := by |
| 370 | obtain ⟨x, rfl⟩ := QuotientAddGroup.mk_surjective z |
| 371 | refine ⟨by rw [hRrep j t ht]; exact heU (mem_range_self _), ?_⟩ |
| 372 | let E := NormedSpace.fromTangentSpace (𝕜 := ℝ) (e (cn j x t)) |
| 373 | have hSval : |
| 374 | E.symm (Sn j t (x : AddCircle curvePeriod)) = |
| 375 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (cn j x t) |
| 376 | (spatialUnitTangent F (cn j) t x) := by |
| 377 | have hSraw := congrArg E.symm (hSrep j t ht x) |
| 378 | exact hSraw |
| 379 | change mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (Rn j t (x : AddCircle curvePeriod)) |
| 380 | (Vn j t (x : AddCircle curvePeriod) • |
| 381 | E.symm (Sn j t (x : AddCircle curvePeriod))) ≠ 0 |
| 382 | rw [hRrep j t ht, hVrep j t ht, hSval, ← map_smul, hleft, |
| 383 | spatialUnitTangent, smul_smul, mul_inv_cancel₀ (speed_pos F (cn j) (hcn j) ht x).ne', |
| 384 | one_smul] |
| 385 | exact (hcn j).immersed t ht x |
| 386 | have hguard (t : ℝ) (ht : t ∈ Icc a b) (z : AddCircle curvePeriod) : |
| 387 | (r t z, p t z) ∈ Ω := by |
| 388 | obtain ⟨x, rfl⟩ := QuotientAddGroup.mk_surjective z |
| 389 | refine ⟨hrU t ht x, ?_⟩ |
| 390 | change mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (r t (x : AddCircle curvePeriod)) |
| 391 | (v t (x : AddCircle curvePeriod) • s t (x : AddCircle curvePeriod)) ≠ 0 |
| 392 | rw [map_smul, ← hvel t ht x] |
| 393 | exact himm t ht x |
| 394 | have hpair : Continuous (fun q : X × X => q.1.prodMk q.2) := by |
| 395 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 396 | exact (continuous_fst.fst.eval continuous_snd).prodMk |
| 397 | (continuous_fst.snd.eval continuous_snd) |
| 398 | have hcoeff := (ambientCurveCoefficients_contDiffOn F he hU hρ).2.1.continuousOn |
| 399 | let Bc (t : ℝ) (ht : t ∈ Icc a b) : C(Ω, W) := |
| 400 | ⟨fun z => ambientCurveLower F e ρ t z.1.1 z.1.2, |
| 401 | hcoeff.comp_continuous |
| 402 | ((continuous_const.prodMk continuous_subtype_val.fst).prodMk continuous_subtype_val.snd) |
| 403 | (fun z => ⟨ht, z.2.1, z.2.2⟩)⟩ |
| 404 | let Zc (t : ℝ) (ht : t ∈ Icc a b) : X := |
| 405 | mulC ((v t) ^ 2, h t - (Bc t ht).comp |
| 406 | ⟨fun z => ⟨(r t z, p t z), hguard t ht z⟩, |
| 407 | ((r t).continuous.prodMk (p t).continuous).subtype_mk _⟩) + mulC (g t, s t) |
| 408 | have hsecond (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 409 | HasDerivAt (fun y : ℝ => p t (y : AddCircle curvePeriod)) |
| 410 | (Zc t ht (x : AddCircle curvePeriod)) x := by |
| 411 | let qn (j : ℕ) : C(AddCircle curvePeriod, Ω) := |
| 412 | ⟨fun z => ⟨(Rn j t z, Pn j t z), hguardn j t ht z⟩, |
| 413 | ((Rn j t).continuous.prodMk (Pn j t).continuous).subtype_mk _⟩ |
| 414 | let q : C(AddCircle curvePeriod, Ω) := |
| 415 | ⟨fun z => ⟨(r t z, p t z), hguard t ht z⟩, |
| 416 | ((r t).continuous.prodMk (p t).continuous).subtype_mk _⟩ |
| 417 | let inc : C(Ω, W × W) := ⟨Subtype.val, continuous_subtype_val⟩ |
| 418 | have hq : Tendsto qn atTop (𝓝 q) := |
| 419 | (inc.isEmbedding_postcomp Topology.IsEmbedding.subtypeVal).tendsto_nhds_iff.mpr |
| 420 | ((hpair.tendsto _).comp ((hR.tendsto_at ht).prodMk_nhds (hP.tendsto_at ht))) |
| 421 | let zn (j : ℕ) : X := mulC ((Vn j t) ^ 2, Hn j t - (Bc t ht).comp (qn j)) + |
| 422 | mulC (Wn j t, Sn j t) |
| 423 | have hz : Tendsto zn atTop (𝓝 (Zc t ht)) := |
| 424 | ((hmulC.tendsto _).comp (((hV.tendsto_at ht).pow 2).prodMk_nhds |
| 425 | ((hH.tendsto_at ht).sub ((Bc t ht).continuous_postcomp.tendsto _ |>.comp hq)))).add |
| 426 | ((hmulC.tendsto _).comp ((hW.tendsto_at ht).prodMk_nhds (hS.tendsto_at ht))) |
| 427 | apply hasDerivAt_of_tendstoUniformly |
| 428 | ((ContinuousMap.tendsto_iff_tendstoUniformly.mp hz).comp |
| 429 | (fun y : ℝ => (y : AddCircle curvePeriod))) |
| 430 | (Eventually.of_forall (fun j y => ?_)) |
| 431 | (fun y => (continuous_eval_const (y : AddCircle curvePeriod)).tendsto (p t) |
| 432 | |>.comp (hP.tendsto_at ht)) x |
| 433 | have hqspace := (m63C2_of_m62 (hcn j)).spatial_regular t ht |
| 434 | have hd := (((hdata j).1 t ht).deriv' (n := 1)).differentiable (by norm_num) y |
| 435 | have heq : (fun y : ℝ => Pn j t (y : AddCircle curvePeriod)) = |
| 436 | deriv (fun y => e (cn j y t)) := by |
| 437 | funext y |
| 438 | exact (hfirstn j t ht y).deriv.symm.trans |
| 439 | (congrArg (fun f : ℝ → W => deriv f y) (funext (hRrep j t ht))) |
| 440 | change HasDerivAt (fun y : ℝ => Pn j t (y : AddCircle curvePeriod)) _ y |
| 441 | rw [heq] |
| 442 | apply hd.hasDerivAt.congr_deriv |
| 443 | rw [hraw (cn j) hqspace ((hcn j).immersed t ht) y] |
| 444 | change _ = Vn j t (y : AddCircle curvePeriod) ^ 2 • |
| 445 | (Hn j t (y : AddCircle curvePeriod) - ambientCurveLower F e ρ t |
| 446 | (Rn j t (y : AddCircle curvePeriod)) (Pn j t (y : AddCircle curvePeriod))) + |
| 447 | Wn j t (y : AddCircle curvePeriod) • Sn j t (y : AddCircle curvePeriod) |
| 448 | rw [hVrep j t ht, hHrep j t ht, hRrep j t ht, hWrep j t ht, hSrep j t ht, |
| 449 | congrFun heq y] |
| 450 | have hpC1 (t : ℝ) (ht : t ∈ Icc a b) : |
| 451 | ContDiff ℝ 1 (fun x : ℝ => p t (x : AddCircle curvePeriod)) := by |
| 452 | apply contDiff_one_iff_hasFDerivAt.mpr |
| 453 | refine ⟨fun x => (1 : ℝ →L[ℝ] ℝ).smulRight (Zc t ht (x : AddCircle curvePeriod)), |
| 454 | (ContinuousLinearMap.smulRightL ℝ ℝ W 1).continuous.comp |
| 455 | ((Zc t ht).continuous.comp (AddCircle.continuous_mk' curvePeriod)), ?_⟩ |
| 456 | exact fun x => (hsecond t ht x).hasFDerivAt |
| 457 | have hrC2 (t : ℝ) (ht : t ∈ Icc a b) : |
| 458 | ContDiff ℝ 2 (fun x : ℝ => r t (x : AddCircle curvePeriod)) := by |
| 459 | apply (contDiff_succ_iff_hasFDerivAt (n := 1)).mpr |
| 460 | exact ⟨fun x => (1 : ℝ →L[ℝ] ℝ).smulRight (p t (x : AddCircle curvePeriod)), |
| 461 | (ContinuousLinearMap.smulRightL ℝ ℝ W 1).contDiff.comp (hpC1 t ht), |
| 462 | fun x => (hfirst t ht x).hasFDerivAt⟩ |
| 463 | have hcC2 (t : ℝ) (ht : t ∈ Icc a b) : |
| 464 | ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 (fun x => c x t) := |
| 465 | (hρ.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)).comp_contMDiff |
| 466 | (hrC2 t ht).contMDiff (hrU t ht) |
| 467 | have hcurv (t : ℝ) (ht : t ∈ Icc a b) (x : ℝ) : |
| 468 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (m62CurvatureVector F c t x) = |
| 469 | h t (x : AddCircle curvePeriod) := by |
| 470 | have hacc := hraw c (hcC2 t ht) (himm t ht) x |
| 471 | have heq : (fun y => e (c y t)) = (fun y : ℝ => r t (y : AddCircle curvePeriod)) := |
| 472 | funext (hrfix t ht) |
| 473 | have hder : deriv (fun y : ℝ => r t (y : AddCircle curvePeriod)) = |
| 474 | (fun y : ℝ => p t (y : AddCircle curvePeriod)) := funext fun y => (hfirst t ht y).deriv |
| 475 | rw [heq, hder, (hsecond t ht x).deriv, hspeed t ht x, hgrad t ht x, |
| 476 | hpushS t ht x, hrfix t ht x] at hacc |
| 477 | change (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) |
| 478 | (m62CurvatureVector F c t x) : W) = (h t (x : AddCircle curvePeriod) : W) |
| 479 | apply PiLp.ext |
| 480 | intro i |
| 481 | have hi := congrArg (fun z : W => z i) hacc |
| 482 | simp only [PiLp.add_apply, PiLp.sub_apply, PiLp.smul_apply, smul_eq_mul] at hi ⊢ |
| 483 | have hi' := add_right_cancel hi |
| 484 | have hi'' := mul_left_cancel₀ (pow_ne_zero 2 (hvpos t ht x).ne') hi' |
| 485 | change (h t (x : AddCircle curvePeriod)).ofLp i - |
| 486 | (ambientCurveLower F e ρ t (r t (x : AddCircle curvePeriod)) |
| 487 | (p t (x : AddCircle curvePeriod))).ofLp i = |
| 488 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) |
| 489 | (m62CurvatureVector F c t x) : W).ofLp i - |
| 490 | (ambientCurveLower F e ρ t (r t (x : AddCircle curvePeriod)) |
| 491 | (p t (x : AddCircle curvePeriod))).ofLp i at hi'' |
| 492 | exact (sub_left_inj.mp hi'').symm |
| 493 | have liftUniform (fn : ℕ → ℝ → X) (f : ℝ → X) |
| 494 | (hf : TendstoUniformlyOn fn f atTop (Icc a b)) : |
| 495 | TendstoUniformlyOn (fun (j : ℕ) (z : ℝ × ℝ) => fn j z.2 (z.1 : AddCircle curvePeriod)) |
| 496 | (fun z : ℝ × ℝ => f z.2 (z.1 : AddCircle curvePeriod)) atTop (univ ×ˢ Icc a b) := by |
| 497 | apply Metric.tendstoUniformlyOn_iff.mpr |
| 498 | intro ε hε |
| 499 | filter_upwards [Metric.tendstoUniformlyOn_iff.mp hf ε hε] with j hj |
| 500 | intro z hz |
| 501 | exact (ContinuousMap.dist_apply_le_dist (f := f z.2) (g := fn j z.2) |
| 502 | (z.1 : AddCircle curvePeriod)).trans_lt (hj z.2 hz.2) |
| 503 | let L1 : W →L[ℝ] ((ℝ × ℝ) →L[ℝ] W) := |
| 504 | ContinuousLinearMap.smulRightL ℝ (ℝ × ℝ) W (ContinuousLinearMap.fst ℝ ℝ ℝ) |
| 505 | let L2 : W →L[ℝ] ((ℝ × ℝ) →L[ℝ] W) := |
| 506 | ContinuousLinearMap.smulRightL ℝ (ℝ × ℝ) W (ContinuousLinearMap.snd ℝ ℝ ℝ) |
| 507 | let Dn := fun (j : ℕ) (z : ℝ × ℝ) => L1 (Pn j z.2 (z.1 : AddCircle curvePeriod)) + |
| 508 | L2 (Hn j z.2 (z.1 : AddCircle curvePeriod)) |
| 509 | let D := fun z : ℝ × ℝ => L1 (p z.2 (z.1 : AddCircle curvePeriod)) + |
| 510 | L2 (h z.2 (z.1 : AddCircle curvePeriod)) |
| 511 | let O := (univ ×ˢ Ioo a b : Set (ℝ × ℝ)) |
| 512 | have hO : IsOpen O := isOpen_univ.prod isOpen_Ioo |
| 513 | have hDlim : TendstoUniformlyOn Dn D atTop O := |
| 514 | ((L1.uniformContinuous.comp_tendstoUniformlyOn (liftUniform Pn p hP)).add |
| 515 | (L2.uniformContinuous.comp_tendstoUniformlyOn (liftUniform Hn h hH))).mono |
| 516 | (prod_mono_right Ioo_subset_Icc_self) |
| 517 | have hDcont : ContinuousOn D O := |
| 518 | ((L1.continuous.comp_continuousOn (liftCont p hp)).add |
| 519 | (L2.continuous.comp_continuousOn (liftCont h hh))).mono |
| 520 | (prod_mono_right Ioo_subset_Icc_self) |
| 521 | have hDactual (j : ℕ) (z : ℝ × ℝ) (hz : z ∈ O) : |
| 522 | HasFDerivAt (fun w : ℝ × ℝ => Rn j w.2 (w.1 : AddCircle curvePeriod)) (Dn j z) z := by |
| 523 | have hd0 := ((htimeData j).1.contDiffAt |
| 524 | ((isOpen_univ.prod isOpen_interior).mem_nhds |
| 525 | ⟨mem_univ _, by simpa only [interior_Icc] using hz.2⟩)).differentiableAt (by norm_num) |
| 526 | have hd := hd0.hasFDerivAt |
| 527 | have hdx := (hd.comp_hasDerivAt z.1 ((hasDerivAt_id z.1).prodMk |
| 528 | (hasDerivAt_const z.1 z.2))).unique (by |
| 529 | simpa +instances only [Function.comp_def, id_eq] using! |
| 530 | (hdata j).2.1 z.2 (Ioo_subset_Icc_self hz.2) z.1) |
| 531 | have hdt := (hd.comp_hasDerivAt z.2 ((hasDerivAt_const z.2 z.1).prodMk |
| 532 | (hasDerivAt_id z.2))).unique (by |
| 533 | simpa +instances only [Function.comp_def, id_eq] using! |
| 534 | ((htimeData j).2 z.2 (by simpa only [interior_Icc] using hz.2) z.1)) |
| 535 | have hdx' : fderiv ℝ (fun w : ℝ × ℝ => e (cn j w.1 w.2)) z (1, 0) = |
| 536 | Pn j z.2 (z.1 : AddCircle curvePeriod) := by |
| 537 | have hfirstj := hfirstn j z.2 (Ioo_subset_Icc_self hz.2) z.1 |
| 538 | have hhj := hfirstj.congr_of_eventuallyEq |
| 539 | (Eventually.of_forall (fun y => (hRrep j z.2 (Ioo_subset_Icc_self hz.2) y).symm)) |
| 540 | exact hdx.trans (((hdata j).2.1 z.2 (Ioo_subset_Icc_self hz.2) z.1).unique hhj) |
| 541 | have hdt' : fderiv ℝ (fun w : ℝ × ℝ => e (cn j w.1 w.2)) z (0, 1) = |
| 542 | Hn j z.2 (z.1 : AddCircle curvePeriod) := |
| 543 | hdt.trans (hHrep j z.2 (Ioo_subset_Icc_self hz.2) z.1).symm |
| 544 | have hlinear : fderiv ℝ (fun w : ℝ × ℝ => e (cn j w.1 w.2)) z = Dn j z := by |
| 545 | apply ContinuousLinearMap.ext |
| 546 | intro w |
| 547 | rw [show w = w.1 • (1, 0) + w.2 • (0, 1) by ext <;> simp] |
| 548 | simp only [map_add, map_smul, hdx', hdt'] |
| 549 | simp [Dn, L1, L2] |
| 550 | apply (hd.congr_fderiv hlinear).congr_of_eventuallyEq |
| 551 | filter_upwards [hO.mem_nhds hz] with w hw |
| 552 | exact hRrep j w.2 (Ioo_subset_Icc_self hw.2) w.1 |
| 553 | have hDlimit (z : ℝ × ℝ) (hz : z ∈ O) : |
| 554 | HasFDerivAt (fun w : ℝ × ℝ => r w.2 (w.1 : AddCircle curvePeriod)) (D z) z := |
| 555 | hasFDerivAt_of_tendstoUniformlyOn hO hDlim hDactual |
| 556 | (fun w hw => (continuous_eval_const (w.1 : AddCircle curvePeriod)).tendsto (r w.2) |
| 557 | |>.comp (hR.tendsto_at (Ioo_subset_Icc_self hw.2))) hz |
| 558 | have hrjoint : ContDiffOn ℝ 1 |
| 559 | (fun z : ℝ × ℝ => r z.2 (z.1 : AddCircle curvePeriod)) O := by |
| 560 | apply (contDiffOn_succ_iff_hasFDerivWithinAt_of_uniqueDiffOn (n := 0) |
| 561 | hO.uniqueDiffOn).mpr |
| 562 | exact ⟨by norm_num, D, contDiffOn_zero.mpr hDcont, |
| 563 | fun z hz => (hDlimit z hz).hasFDerivWithinAt⟩ |
| 564 | have htime (t : ℝ) (ht : t ∈ Ioo a b) (x : ℝ) : |
| 565 | HasDerivAt (fun u => r u (x : AddCircle curvePeriod)) |
| 566 | (h t (x : AddCircle curvePeriod)) t := by |
| 567 | have hd := (hDlimit (x, t) ⟨mem_univ _, ht⟩).comp_hasDerivAt t |
| 568 | ((hasDerivAt_const t x).prodMk (hasDerivAt_id t)) |
| 569 | simpa +instances [D, L1, L2, Function.comp_def] using! hd |
| 570 | have hcjoint : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n) 1 |
| 571 | (fun z : ℝ × ℝ => c z.1 z.2) O := |
| 572 | (hρ.of_le (by norm_num)).comp hrjoint.contMDiffOn |
| 573 | (fun z hz => hrU z.2 (Ioo_subset_Icc_self hz.2) z.1) |
| 574 | have hccont : ContinuousOn (fun z : ℝ × ℝ => c z.1 z.2) (univ ×ˢ Icc a b) := |
| 575 | hρ.continuousOn.comp (liftCont r hr) (fun z hz => hrU z.2 hz.2 z.1) |
| 576 | have hcactual : M63C2ShrinkingCurveOn F c (Icc a b) := by |
| 577 | refine ⟨Subset.rfl, ?_, hcC2, ?_, himm, hccont, ?_, ?_, ?_⟩ |
| 578 | · intro t _ x |
| 579 | simp only [c, AddCircle.coe_add_period] |
| 580 | · simpa only [interior_Icc] using hcjoint |
| 581 | · apply continuousOn_tangentSection_of_retraction_pushforward he hU heU hρ hρe |
| 582 | (fun z : ℝ × ℝ => c z.1 z.2) |
| 583 | (fun z => curveVelocity (fun y => c y z.2) z.1) hccont |
| 584 | exact (liftCont p hp).congr (fun z hz => hpush z.2 hz.2 z.1) |
| 585 | · apply continuousOn_tangentSection_of_retraction_pushforward he hU heU hρ hρe |
| 586 | (fun z : ℝ × ℝ => c z.1 z.2) |
| 587 | (fun z => m62CurvatureVector F c z.2 z.1) hccont |
| 588 | exact (liftCont h hh).congr (fun z hz => hcurv z.2 hz.2 z.1) |
| 589 | · intro t ht x |
| 590 | have ht' : t ∈ Ioo a b := by simpa only [interior_Icc] using ht |
| 591 | have hd := htime t ht' x |
| 592 | have hchain := mfderiv_comp t |
| 593 | ((hρ.contMDiffAt (hU.mem_nhds (hrU t (Ioo_subset_Icc_self ht') x))).mdifferentiableAt |
| 594 | (by simp)) hd.differentiableAt.mdifferentiableAt |
| 595 | have hval := congrArg (fun L : ℝ →L[ℝ] TangentSpace (𝓡 n) (c x t) => L 1) hchain |
| 596 | rw [mfderiv_eq_fderiv, hd.hasFDerivAt.fderiv] at hval |
| 597 | change curveVelocity (fun u => c x u) t = |
| 598 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (r t (x : AddCircle curvePeriod)) |
| 599 | ((1 : ℝ) • h t (x : AddCircle curvePeriod)) at hval |
| 600 | have hval' : curveVelocity (fun u => c x u) t = |
| 601 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (r t (x : AddCircle curvePeriod)) |
| 602 | (h t (x : AddCircle curvePeriod)) := by |
| 603 | simpa only [one_smul] using! hval |
| 604 | rw [← hcurv t (Ioo_subset_Icc_self ht') x, ← hrfix t (Ioo_subset_Icc_self ht') x, |
| 605 | hleft] at hval' |
| 606 | exact hval' |
| 607 | refine ⟨hcactual, fun t ht x => ⟨hfirst t ht x, hsecond t ht x, |
| 608 | hspeed t ht x, hgrad t ht x, hcurv t ht x⟩, htime, ?_⟩ |
| 609 | intro ε hε |
| 610 | obtain ⟨d, hd, hmod⟩ := Metric.continuousWithinAt_iff.mp (hh a ha) ε hε |
| 611 | refine ⟨d, hd, ?_⟩ |
| 612 | intro t ht htd x |
| 613 | rw [hcurv t ht x, hcurv a ha x] |
| 614 | have hdist : dist t a < d := by |
| 615 | simpa only [Real.dist_eq, abs_of_nonneg (sub_nonneg.mpr ht.1)] using htd |
| 616 | have hb := (ContinuousMap.dist_apply_le_dist (f := h t) (g := h a) |
| 617 | (x : AddCircle curvePeriod)).trans_lt (hmod ht hdist) |
| 618 | simpa only [dist_eq_norm] using! hb |
| 619 | |
| 620 | end PoincareMT.M63 |