import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Finite.ParameterVelocity /-! The actual half-energy variation with differentiable spatial parameters follows from its affine first jet. Source: MT Lemma 19.15, pp. 447-449; finite-conormal-variation derivation. -/ noncomputable section set_option autoImplicit false set_option warningAsError true set_option backward.isDefEq.respectTransparency false open Set Filter Bundle open scoped Manifold ContDiff Topology namespace PoincareMT variable {E : Type*} [NormedAddCommGroup E] [NormedSpace โ„ E] {n : โ„•} {M : Type*} [TopologicalSpace M] [ChartedSpace (EuclideanSpace โ„ (Fin n)) M] [IsManifold (๐“ก n) โˆž M] /-- The time derivative of spatial half-energy needs only one derivative of the parameter path. Its coefficient is the genuine spatial covariant derivative of the actual time velocity. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ theorem m64ParameterMotion_half_energy_hasDerivAt {g : RiemannianMetric n M} (D : LeviCivitaData g) {Phi : โ„ ร— E โ†’ M} {O : Set (โ„ ร— E)} (hO : IsOpen O) (hPhi : ContMDiffOn ๐“˜(โ„, โ„ ร— E) (๐“ก n) โˆž Phi O) {h : โ„ โ†’ E} {t x : โ„} (hh : DifferentiableAt โ„ h x) (hp : (t, h x) โˆˆ O) : HasDerivAt (fun s => (1 / 2 : โ„) * g.inner (Phi (s, h x)) (curveVelocity (fun y => Phi (s, h y)) x) (curveVelocity (fun y => Phi (s, h y)) x)) (g.inner (Phi (t, h x)) (rampHorizontalCovariantDerivative D (fun y => Phi (t, h y)) (fun y => curveVelocity (fun s => Phi (s, h y)) t) x) (curveVelocity (fun y => Phi (t, h y)) x)) t := by let H := fun y : โ„ => h x + (y - x) โ€ข deriv h x have hHx : H x = h x := by simp [H] have hH : HasDerivAt H (deriv h x) x := by simpa only [H, id_eq, one_smul] using! (((hasDerivAt_id x).sub_const x).smul_const (deriv h x)).const_add (h x) have hHs : ContDiff โ„ โˆž H := by dsimp only [H]; fun_prop let j := fun q : โ„ ร— โ„ => (q.1, H q.2) have hj : ContMDiff ๐“˜(โ„, โ„ ร— โ„) ๐“˜(โ„, โ„ ร— E) โˆž j := (contDiff_fst.prodMk (hHs.comp contDiff_snd)).contMDiff have hW : IsOpen (j โปยน' O) := hO.preimage hj.continuous have hproxy : ContMDiffOn ๐“˜(โ„, โ„ ร— โ„) (๐“ก n) โˆž (fun q : โ„ ร— โ„ => Phi (q.1, H q.2)) (j โปยน' O) := hPhi.comp hj.contMDiffOn (fun _ hq => hq) have htx : (t, x) โˆˆ j โปยน' O := by simpa only [mem_preimage, j, hHx] using hp have hvel (s : โ„) (hs : (s, h x) โˆˆ O) : curveVelocity (n := n) (fun y => Phi (s, H y)) x = curveVelocity (fun y => Phi (s, h y)) x := by have hsreg := (hPhi.contMDiffAt (hO.mem_nhds hs)).mdifferentiableAt (by simp) rw [m64ParameterMotion_spatial_velocity (hHx.symm โ–ธ hsreg) hH.differentiableAt, m64ParameterMotion_spatial_velocity hsreg hh, hHx, hH.deriv] have hpoint := hPhi.contMDiffAt (hO.mem_nhds hp) have hslice : ContMDiffAt ๐“˜(โ„, E) ๐“˜(โ„, โ„ ร— E) โˆž (fun q : E => (t, q)) (h x) := (contDiffAt_const.prodMk contDiffAt_id).contMDiffAt have hV := (m64ParameterMotion_timeVelocity_contMDiffAt hO hPhi hp).comp (h x) hslice have hjet := m64Pullback_covariantDerivative_eq_affine_parameter D hh (f := fun q => Phi (t, q)) (Y := fun q => curveVelocity (fun s => Phi (s, q)) t) ((hpoint.comp (h x) hslice).mdifferentiableAt (by simp)) (hV.mdifferentiableAt (by simp)) have henergy := m64MovingCurve_half_energy_hasDerivAt D (c := fun s y => Phi (s, H y)) hW hproxy htx have heq : (fun s => (1 / 2 : โ„) * g.inner (Phi (s, h x)) (curveVelocity (fun y => Phi (s, h y)) x) (curveVelocity (fun y => Phi (s, h y)) x)) =แถ [๐“ t] (fun s => (1 / 2 : โ„) * g.inner (Phi (s, H x)) (curveVelocity (fun y => Phi (s, H y)) x) (curveVelocity (fun y => Phi (s, H y)) x)) := by filter_upwards [(continuous_id.prodMk continuous_const).continuousAt (hO.mem_nhds hp)] with s hs rw [hHx, hvel s hs] apply (henergy.congr_of_eventuallyEq heq).congr_deriv have hdata : (Phi (t, H x), (rampHorizontalCovariantDerivative D (fun y => Phi (t, H y)) (fun y => curveVelocity (fun s => Phi (s, H y)) t) x : EuclideanSpace โ„ (Fin n)), (curveVelocity (fun y => Phi (t, H y)) x : EuclideanSpace โ„ (Fin n))) = (Phi (t, h x), (rampHorizontalCovariantDerivative D (fun y => Phi (t, h y)) (fun y => curveVelocity (fun s => Phi (s, h y)) t) x : EuclideanSpace โ„ (Fin n)), (curveVelocity (fun y => Phi (t, h y)) x : EuclideanSpace โ„ (Fin n))) := Prod.ext (congrArg (fun q => Phi (t, q)) hHx) (Prod.ext hjet.symm (hvel t hp)) exact congrArg (fun q : M ร— EuclideanSpace โ„ (Fin n) ร— EuclideanSpace โ„ (Fin n) => g.inner q.1 q.2.1 q.2.2) hdata /-- The finite-parameter energy derivative is the derivative of the actual current minus the actual base-curve acceleration pairing. The base velocity has its own derivative witness; no second derivative of the parameter path is assumed. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ theorem m64ParameterMotion_energy_derivative_eq_divergence {g : RiemannianMetric n M} (D : LeviCivitaData g) {Phi : โ„ ร— E โ†’ M} {O : Set (โ„ ร— E)} (hO : IsOpen O) (hPhi : ContMDiffOn ๐“˜(โ„, โ„ ร— E) (๐“ก n) โˆž Phi O) {h : โ„ โ†’ E} {t x : โ„} (hh : DifferentiableAt โ„ h x) (hp : (t, h x) โˆˆ O) (hX : MDifferentiableAt ๐“˜(โ„, โ„) ((๐“ก n).prod (๐“ก n)) (fun y => (โŸจPhi (t, h y), curveVelocity (fun z => Phi (t, h z)) yโŸฉ : TangentBundle (๐“ก n) M)) x) : deriv (fun s => (1 / 2 : โ„) * g.inner (Phi (s, h x)) (curveVelocity (fun y => Phi (s, h y)) x) (curveVelocity (fun y => Phi (s, h y)) x)) t = deriv (fun y => g.inner (Phi (t, h y)) (curveVelocity (fun s => Phi (s, h y)) t) (curveVelocity (fun z => Phi (t, h z)) y)) x - g.inner (Phi (t, h x)) (curveVelocity (fun s => Phi (s, h x)) t) (rampHorizontalCovariantDerivative D (fun y => Phi (t, h y)) (fun y => curveVelocity (fun z => Phi (t, h z)) y) x) := by have harg := (hasDerivAt_const x t).prodMk hh.hasDerivAt have hc := ((hPhi.contMDiffAt (hO.mem_nhds hp)).mdifferentiableAt (by simp)).comp x harg.differentiableAt.mdifferentiableAt have hV := ((m64ParameterMotion_timeVelocity_contMDiffAt hO hPhi hp).mdifferentiableAt (by simp)).comp x harg.differentiableAt.mdifferentiableAt have hpair := M62.hasDerivAt_metric_pairing D (ฮณ := fun y => Phi (t, h y)) (Y := fun y => curveVelocity (fun s => Phi (s, h y)) t) (Z := fun y => curveVelocity (fun z => Phi (t, h z)) y) hc hV hX have henergy := m64ParameterMotion_half_energy_hasDerivAt D hO hPhi hh hp rw [henergy.deriv, hpair.deriv] ring end PoincareMT