import PoincareLib.Geometry.CurveShortening.Comparison.Compatibility.SourceNames import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.C1.MixedDerivative import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C1.ChartPullback import Mathlib.Analysis.Calculus.ContDiff.Deriv /-! # Covariant commutation with a C1 time velocity The actual time equation supplies the mixed derivative needed for torsion cancellation and time differentiation of the spatial velocity. MT2007 Claim 19.1, p. 437, and Lemma 19.6, pp. 441-442; `2026-09-22-fixed-label-c2-speed-evolution.md`, statement 2. -/ set_option autoImplicit false set_option backward.isDefEq.respectTransparency false open Set Filter open scoped Manifold ContDiff Bundle Topology universe u namespace PoincareMT.M63 open Proofs.M09 variable {n : โ„•} {M : Type u} [TopologicalSpace M] [ChartedSpace (EuclideanSpace โ„ (Fin n)) M] [IsManifold (๐“ก n) โˆž M] local notation "E" => EuclideanSpace โ„ (Fin n) /-- A C1 actual time velocity gives a genuine time derivative of the spatial velocity and the selected connection's torsion identity. MT2007 Lemma 19.6, pp. 441-442; fixed-label C2 speed evolution, statement 2. Joint C2 regularity is not assumed. -/ theorem pullback_velocity_commute_of_time_velocity_c1 {g : RiemannianMetric n M} (D : LeviCivitaData g) (c : โ„ โ†’ โ„ โ†’ M) {Omega : Set (โ„ ร— โ„)} (hOmega : IsOpen Omega) (hc : ContMDiffOn ๐“˜(โ„, โ„ ร— โ„) (๐“ก n) 1 (fun z : โ„ ร— โ„ => c z.1 z.2) Omega) (hT : ContMDiffOn ๐“˜(โ„, โ„ ร— โ„) ((๐“ก n).prod (๐“ก n)) 1 (fun z : โ„ ร— โ„ => (โŸจc z.1 z.2, curveVelocity (fun s => c z.1 s) z.2โŸฉ : TangentBundle (๐“ก n) M)) Omega) {x t : โ„} (hxt : (x, t) โˆˆ Omega) : MDifferentiableAt ๐“˜(โ„, โ„) ((๐“ก n).prod (๐“ก n)) (fun s => (โŸจc x s, curveVelocity (fun y => c y s) xโŸฉ : TangentBundle (๐“ก n) M)) t โˆง rampHorizontalCovariantDerivative D (fun s => c x s) (fun s => curveVelocity (fun y => c y s) x) t = rampHorizontalCovariantDerivative D (fun y => c y t) (fun y => curveVelocity (fun s => c y s) t) x := by let p := c x t let e := chartAt E p let U := Omega โˆฉ (fun z : โ„ ร— โ„ => c z.1 z.2) โปยน' e.source have hU : IsOpen U := hc.continuousOn.isOpen_inter_preimage hOmega e.open_source have hbase : c x t โˆˆ e.source := mem_chart_source E p have hz : (x, t) โˆˆ U := โŸจhxt, hbaseโŸฉ let q : โ„ ร— โ„ โ†’ E := fun z => e (c z.1 z.2) let R : โ„ ร— โ„ โ†’ E := fun z => mfderiv (๐“ก n) (๐“ก n) e (c z.1 z.2) (curveVelocity (fun s => c z.1 s) z.2) have hq : ContDiffOn โ„ 1 q U := (contMDiffOn_chart.comp (hc.mono inter_subset_left) (fun z hz => hz.2)).contDiffOn have hchart : ContMDiffOn (๐“ก n) (๐“ก n) 2 e e.source := contMDiffOn_chart have hpush := (hchart.contMDiffOn_tangentMapWithin (m := 1) (by norm_num) e.open_source.uniqueMDiffOn).comp (hT.mono inter_subset_left) (fun z hz => hz.2) have hR : ContDiffOn โ„ 1 R U := by have h := ((contMDiff_snd_tangentBundle_modelSpace (n := 1) E (๐“ก n)).comp_contMDiffOn hpush).contDiffOn apply h.congr intro z hz change mfderiv (๐“ก n) (๐“ก n) e (c z.1 z.2) (curveVelocity (fun s => c z.1 s) z.2) = mfderivWithin (๐“ก n) (๐“ก n) e e.source (c z.1 z.2) (curveVelocity (fun s => c z.1 s) z.2) rw [mfderivWithin_of_isOpen e.open_source hz.2] have hcAt (z : โ„ ร— โ„) (hz : z โˆˆ U) : MDifferentiableAt ๐“˜(โ„, โ„ ร— โ„) (๐“ก n) (fun z : โ„ ร— โ„ => c z.1 z.2) z := (hc.contMDiffAt (hOmega.mem_nhds hz.1)).mdifferentiableAt (by norm_num) have hfst (z : โ„ ร— โ„) : MDifferentiableAt ๐“˜(โ„, โ„) ๐“˜(โ„, โ„ ร— โ„) (fun y : โ„ => (y, z.2)) z.1 := (differentiableAt_id.prodMk (differentiableAt_const z.2)).mdifferentiableAt have hsnd (z : โ„ ร— โ„) : MDifferentiableAt ๐“˜(โ„, โ„) ๐“˜(โ„, โ„ ร— โ„) (fun s : โ„ => (z.1, s)) z.2 := ((differentiableAt_const z.1).prodMk differentiableAt_id).mdifferentiableAt have htime (z : โ„ ร— โ„) (hz : z โˆˆ U) : HasDerivAt (fun s => q (z.1, s)) (R z) z.2 := hasDerivAt_chart_curve p (fun s => c z.1 s) z.2 hz.2 (by simpa only [Function.comp_def] using (hcAt z hz).comp z.2 (hsnd z)) have hspace (z : โ„ ร— โ„) (hz : z โˆˆ U) : DifferentiableAt โ„ (fun y => q (y, z.2)) z.1 := by have hdq : DifferentiableAt โ„ q z := (hq.contDiffAt (hU.mem_nhds hz)).differentiableAt (by norm_num) have hline : DifferentiableAt โ„ (fun y : โ„ => (y, z.2)) z.1 := differentiableAt_id.prodMk (differentiableAt_const z.2) exact hdq.comp z.1 (g := q) (f := fun y : โ„ => (y, z.2)) hline have hX (z : โ„ ร— โ„) (hz : z โˆˆ U) : chartVectorField p (deriv (fun y => q (y, z.2)) z.1) (c z.1 z.2) = curveVelocity (fun y => c y z.2) z.1 := chartVectorField_coordinate_velocity p (fun y => c y z.2) z.1 _ hz.2 (by simpa only [Function.comp_def] using (hcAt z hz).comp z.1 (hfst z)) (hspace z hz).hasDerivAt have hY (z : โ„ ร— โ„) (hz : z โˆˆ U) : chartVectorField p (R z) (c z.1 z.2) = curveVelocity (fun s => c z.1 s) z.2 := chartVectorField_coordinate_velocity p (fun s => c z.1 s) z.2 _ hz.2 (by simpa only [Function.comp_def] using (hcAt z hz).comp z.2 (hsnd z)) (htime z hz) let V : Set โ„ := (fun s : โ„ => (x, s)) โปยน' U let W : Set โ„ := (fun y : โ„ => (y, t)) โปยน' U have hV : IsOpen V := hU.preimage (continuous_const.prodMk continuous_id) have hW : IsOpen W := hU.preimage (continuous_id.prodMk continuous_const) let v : โ„ โ†’ E := fun s => deriv (fun y => q (y, s)) x let w : โ„ โ†’ E := fun y => R (y, t) have hdv (s : โ„) (hs : s โˆˆ V) : HasDerivAt v (fderiv โ„ R (x, s) (1, 0)) s := hasDerivAt_spatialDeriv_of_time_equation hU hq hR htime hs have hv : ContDiffOn โ„ 1 v V := by apply (contDiffOn_succ_iff_deriv_of_isOpen (n := 0) hV).mpr refine โŸจfun s hs => (hdv s hs).differentiableAt.differentiableWithinAt, by simp, ?_โŸฉ apply contDiffOn_zero.mpr have hRx : ContinuousOn (fun z : โ„ ร— โ„ => fderiv โ„ R z (1, 0)) U := ((hR.fderiv_of_isOpen hU (m := 0) (by norm_num)).clm_apply (contDiffOn_const (c := ((1 : โ„), (0 : โ„))))).continuousOn have hcont := hRx.comp (s := V) (f := fun s : โ„ => (x, s)) (continuous_const.prodMk continuous_id).continuousOn (fun _ hs => hs) exact hcont.congr (fun s hs => (hdv s hs).deriv) have hw : ContDiffOn โ„ 1 w W := hR.comp (contDiffOn_id.prodMk contDiffOn_const) (fun _ hy => hy) have hcTime : ContMDiffOn ๐“˜(โ„, โ„) (๐“ก n) 1 (fun s => c x s) V := (hc.mono inter_subset_left).comp (contDiff_const.prodMk contDiff_id).contMDiff.contMDiffOn (fun _ hs => hs) have hXtime : ContMDiffOn ๐“˜(โ„, โ„) ((๐“ก n).prod (๐“ก n)) 1 (fun s => (โŸจc x s, curveVelocity (fun y => c y s) xโŸฉ : TangentBundle (๐“ก n) M)) V := by have h := (chartVectorField_param_contMDiff_one p v V hv).comp (contMDiffOn_id.prodMk hcTime) (fun s hs => โŸจhs, hs.2โŸฉ) apply h.congr intro s hs exact congrArg (Bundle.TotalSpace.mk' E (c x s)) (hX (x, s) hs).symm refine โŸจ(hXtime.contMDiffAt (hV.mem_nhds hz)).mdifferentiableAt (by norm_num), ?_โŸฉ have hleft : rampHorizontalCovariantDerivative D (fun s => c x s) (fun s => curveVelocity (fun y => c y s) x) t = chartVectorField p (deriv v t) (c x t) + D.connection (chartVectorField p (v t)) (c x t) (curveVelocity (fun s => c x s) t) := by calc _ = rampHorizontalCovariantDerivative D (fun s => c x s) (fun s => chartVectorField p (v s) (c x s)) t := M62.pullback_congr D (ฮณ := fun s => c x s) (Y := fun s => curveVelocity (fun y => c y s) x) (Z := fun s => chartVectorField p (v s) (c x s)) (by filter_upwards [hV.mem_nhds hz] with s hs exact (hX (x, s) hs).symm) _ = _ := pullback_chart_field_of_contDiff_one D p (gamma := fun s => c x s) (x := t) (by simpa only [Function.comp_def] using (hcAt (x, t) hz).comp t (hsnd (x, t))) hbase hV hz v hv have hright : rampHorizontalCovariantDerivative D (fun y => c y t) (fun y => curveVelocity (fun s => c y s) t) x = chartVectorField p (deriv w x) (c x t) + D.connection (chartVectorField p (w x)) (c x t) (curveVelocity (fun y => c y t) x) := by calc _ = rampHorizontalCovariantDerivative D (fun y => c y t) (fun y => chartVectorField p (w y) (c y t)) x := M62.pullback_congr D (ฮณ := fun y => c y t) (Y := fun y => curveVelocity (fun s => c y s) t) (Z := fun y => chartVectorField p (w y) (c y t)) (by filter_upwards [hW.mem_nhds hz] with y hy exact (hY (y, t) hy).symm) _ = _ := pullback_chart_field_of_contDiff_one D p (gamma := fun y => c y t) (x := x) (by simpa only [Function.comp_def] using (hcAt (x, t) hz).comp x (hfst (x, t))) hbase hW hz w hw have hdw : HasDerivAt w (fderiv โ„ R (x, t) (1, 0)) x := by have hdR : DifferentiableAt โ„ R (x, t) := (hR.contDiffAt (hU.mem_nhds hz)).differentiableAt (by norm_num) exact M08.coordinateSlice_fst_hasDerivAt R hdR have hfield (z : E) := ((chartVectorField_smooth p z).contMDiffAt (e.open_source.mem_nhds hbase)).mdifferentiableAt (by simp) have htor := D.connection.torsion_eq_zero_iff.mp D.torsion_eq_zero (hfield (w x)) (hfield (v t)) rw [chartVectorField_bracket p (w x) (v t) (c x t) hbase] at htor have hconn := sub_eq_zero.mp htor rw [hleft, hright, (hdv t hz).deriv, hdw.deriv, โ† hY (x, t) hz, โ† hX (x, t) hz] exact congrArg (_ + ยท) hconn end PoincareMT.M63