import Mathlib import OAI.Geometry.BallPacking.Forms.QuadricInfinityPrimitive import OAI.Geometry.BallPacking.Forms.ManifoldFormTransport namespace OAI noncomputable section namespace PackingSufficiencySupport.Hamiltonian section open scoped ContDiff Manifold Topology open Set Function Manifold variable {F E V : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup V] [NormedSpace ℝ V] {M : Type*} [TopologicalSpace M] [ChartedSpace E M] [IsManifold π“˜(ℝ,E) ∞ M] def globalHorizontalCoupling (Ξ© : V β†’L[ℝ] V β†’L[ℝ] ℝ) (Ξ“ : V β†’ ManifoldOneForm E M) : ManifoldTwoForm (E Γ— V) (M Γ— V) := fun x => Ξ©.bilinearComp (ContinuousLinearMap.snd ℝ E V) (ContinuousLinearMap.snd ℝ E V)+ manifoldExteriorOneForm (productHorizontalLift Ξ“) x theorem globalHorizontalCoupling_pullback {Ξ© : V β†’L[ℝ] V β†’L[ℝ] ℝ} {Ξ“ : V β†’ ManifoldOneForm E M} (hΞ“ : SmoothOneFormFamily Ξ“) {g : F β†’ M} {x : F Γ— V} (hg : ContMDiffAt π“˜(ℝ,F) π“˜(ℝ,E) ∞ g x.1) : (globalHorizontalCoupling Ξ© Ξ“ (flatProductMap g x)).bilinearComp ((mfderiv π“˜(ℝ,F) π“˜(ℝ,E) g x.1).prodMap (ContinuousLinearMap.id ℝ V)) ((mfderiv π“˜(ℝ,F) π“˜(ℝ,E) g x.1).prodMap (ContinuousLinearMap.id ℝ V))= Ξ©.bilinearComp (ContinuousLinearMap.snd ℝ F V) (ContinuousLinearMap.snd ℝ F V)+ euclideanExteriorOneForm (fun y => euclideanPullbackOneForm (fun _ => productHorizontalLift Ξ“) (flatProductMap g) (0,y)) x := by rw [productHorizontalLift_exterior_pullback hΞ“ hg] apply ContinuousLinearMap.ext intro v apply ContinuousLinearMap.ext intro w rfl theorem globalHorizontalCoupling_isInvertible_coordinates {Ξ© : V β†’L[ℝ] V β†’L[ℝ] ℝ} {Ξ“ : V β†’ ManifoldOneForm E M} (hΞ“ : SmoothOneFormFamily Ξ“) {g : F β†’ M} {x : F Γ— V} (hg : ContMDiffAt π“˜(ℝ,F) π“˜(ℝ,E) ∞ g x.1) (c : F ≃L[ℝ] E) (hc : (c : F β†’L[ℝ] E)=mfderiv π“˜(ℝ,F) π“˜(ℝ,E) g x.1) (h : (Ξ©.bilinearComp (ContinuousLinearMap.snd ℝ F V) (ContinuousLinearMap.snd ℝ F V)+ euclideanExteriorOneForm (fun y => euclideanPullbackOneForm (fun _ => productHorizontalLift Ξ“) (flatProductMap g) (0,y)) x).IsInvertible) : (globalHorizontalCoupling Ξ© Ξ“ (flatProductMap g x)).IsInvertible := by apply (bilinearComp_equiv_isInvertible_iff (c.prodCongr (ContinuousLinearEquiv.refl ℝ V))).mp have he : ((c.prodCongr (ContinuousLinearEquiv.refl ℝ V)) : (F Γ— V) β†’L[ℝ] E Γ— V)= (mfderiv π“˜(ℝ,F) π“˜(ℝ,E) g x.1).prodMap (ContinuousLinearMap.id ℝ V) := by change (c : F β†’L[ℝ] E).prodMap (ContinuousLinearMap.id ℝ V)=_ rw [hc] rfl rw [he,globalHorizontalCoupling_pullback hΞ“ hg] exact h end section open scoped ContDiff Manifold Topology open Set Function Manifold variable {P E : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [NormedAddCommGroup E] [NormedSpace ℝ E] {M : Type*} [TopologicalSpace M] [ChartedSpace E M] structure IsPrimitiveFamily (Ξ© : P β†’ ManifoldTwoForm E M) (Ξ± : P β†’ ManifoldOneForm E M) : Prop where smooth : SmoothOneFormFamily Ξ± exterior : βˆ€ p c y, y ∈ (extChartAt π“˜(ℝ,E) c).target β†’ euclideanExteriorOneForm (chartOneForm (Ξ± p) c) y = chartTwoForm (Ξ© p) c y namespace IsPrimitiveFamily theorem zero : IsPrimitiveFamily (0 : P β†’ ManifoldTwoForm E M) 0 := by constructor Β· intro c simpa only [Pi.zero_apply,chartOneForm_zero] using (contDiffOn_const : ContDiffOn ℝ ∞ (fun _ : P Γ— E => (0 : E β†’L[ℝ] ℝ)) _) Β· intro p c y _ change euclideanExteriorOneForm (chartOneForm 0 c) y = chartTwoForm 0 c y rw [show chartOneForm (0 : ManifoldOneForm E M) c = fun _ => 0 from funext fun z => chartOneForm_zero c z] simp only [chartTwoForm_zero,euclideanExteriorOneForm,fderiv_const_apply,ContinuousLinearMap.flip_zero] exact sub_self (0 : E β†’L[ℝ] E β†’L[ℝ] ℝ) theorem add {Ξ© Ξ› : P β†’ ManifoldTwoForm E M} {Ξ± Ξ² : P β†’ ManifoldOneForm E M} (hΞ± : IsPrimitiveFamily Ξ© Ξ±) (hΞ² : IsPrimitiveFamily Ξ› Ξ²) : IsPrimitiveFamily (Ξ©+Ξ›) (Ξ±+Ξ²) := by constructor Β· intro c simpa only [Pi.add_apply,chartOneForm_add] using (hΞ±.smooth c).add (hΞ².smooth c) Β· intro p c y hy simp only [Pi.add_apply,chartTwoForm_add] rw [show chartOneForm (Ξ± p + Ξ² p) c = chartOneForm (Ξ± p) c + chartOneForm (Ξ² p) c from funext fun z => chartOneForm_add _ _ c z] rw [euclideanExteriorOneForm_add ((hΞ±.smooth.spatial_smooth p c hy).differentiableAt (by simp)) ((hΞ².smooth.spatial_smooth p c hy).differentiableAt (by simp)),hΞ±.exterior p c y hy,hΞ².exterior p c y hy] theorem smul {Ξ© : P β†’ ManifoldTwoForm E M} {Ξ± : P β†’ ManifoldOneForm E M} (hΞ± : IsPrimitiveFamily Ξ© Ξ±) {f : P β†’ ℝ} (hf : ContDiff ℝ ∞ f) : IsPrimitiveFamily (fun p => f p β€’ Ξ© p) (fun p => f p β€’ Ξ± p) := by constructor Β· intro c simpa only [chartOneForm_smul,Function.comp_apply,Pi.smul_def'] using (hf.comp contDiff_fst).contDiffOn.smul (hΞ±.smooth c) Β· intro p c y hy simp only [chartTwoForm_smul] rw [show chartOneForm (f p β€’ Ξ± p) c = f p β€’ chartOneForm (Ξ± p) c from funext fun z => chartOneForm_smul _ _ c z] rw [euclideanExteriorOneForm_smul _ ((hΞ±.smooth.spatial_smooth p c hy).differentiableAt (by simp)), hΞ±.exterior p c y hy] theorem sum {I : Type*} (s : Finset I) {Ξ© : I β†’ P β†’ ManifoldTwoForm E M} {Ξ± : I β†’ P β†’ ManifoldOneForm E M} (hΞ± : βˆ€ i ∈ s, IsPrimitiveFamily (Ξ© i) (Ξ± i)) : IsPrimitiveFamily (βˆ‘ i ∈ s, Ξ© i) (βˆ‘ i ∈ s, Ξ± i) := by classical induction s using Finset.induction_on with | empty => simpa only [Finset.sum_empty] using zero (P := P) (E := E) (M := M) | @insert i s hi ih => rw [Finset.sum_insert hi,Finset.sum_insert hi] exact (hΞ± i (Finset.mem_insert_self i s)).add (ih (fun j hj => hΞ± j (Finset.mem_insert_of_mem hj))) theorem const_slice {Q : Type*} [NormedAddCommGroup Q] [NormedSpace ℝ Q] {Ξ© : Q β†’ ManifoldTwoForm E M} {Ξ± : Q β†’ ManifoldOneForm E M} (hΞ± : IsPrimitiveFamily Ξ© Ξ±) (q : Q) : IsPrimitiveFamily (fun _ : P => Ξ© q) (fun _ : P => Ξ± q) := by constructor Β· intro c apply (hΞ±.smooth c).comp (f := fun t : P Γ— E => (q,t.2)) (contDiffOn_const.prodMk contDiffOn_snd) exact fun t ht => ⟨mem_univ _,ht.2⟩ Β· intro _ c y hy exact hΞ±.exterior q c y hy end IsPrimitiveFamily end section open scoped ContDiff variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] def pathSpatialExterior (Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ) (p : ℝ Γ— E) : E β†’L[ℝ] E β†’L[ℝ] ℝ := (fderiv ℝ Ξ“ p).comp (ContinuousLinearMap.inr ℝ ℝ E) - ((fderiv ℝ Ξ“ p).comp (ContinuousLinearMap.inr ℝ ℝ E)).flip def pathTimePrimitive (Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ) (p : ℝ Γ— E) : E β†’L[ℝ] ℝ := fderiv ℝ Ξ“ p (1,0) @[simp] theorem pathSpatialExterior_apply (Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ) (p : ℝ Γ— E) (v w : E) : pathSpatialExterior Ξ“ p v w = fderiv ℝ Ξ“ p (0,v) w - fderiv ℝ Ξ“ p (0,w) v := rfl @[fun_prop] theorem pathSpatialExterior_smooth {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} (hΞ“ : ContDiff ℝ ∞ Ξ“) : ContDiff ℝ ∞ (pathSpatialExterior Ξ“) := by have hd : ContDiff ℝ ∞ (fun p => (fderiv ℝ Ξ“ p).comp (ContinuousLinearMap.inr ℝ ℝ E)) := (hΞ“.fderiv_right (by simp)).clm_comp contDiff_const have hflip : ContDiff ℝ ∞ (fun L : E β†’L[ℝ] E β†’L[ℝ] ℝ => L.flip) := LinearIsometryEquiv.contDiff (π•œ := ℝ) (n := ∞) (E := E β†’L[ℝ] E β†’L[ℝ] ℝ) (F := E β†’L[ℝ] E β†’L[ℝ] ℝ) (ContinuousLinearMap.flipβ‚—α΅’ ℝ E E ℝ) exact hd.sub (hflip.comp hd) @[fun_prop] theorem pathTimePrimitive_smooth {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} (hΞ“ : ContDiff ℝ ∞ Ξ“) : ContDiff ℝ ∞ (pathTimePrimitive Ξ“) := (hΞ“.fderiv_right (by simp)).clm_apply contDiff_const theorem fderiv_evaluation_const {P F G : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup G] [NormedSpace ℝ G] {g : P β†’ F β†’L[ℝ] G} {p : P} (hg : DifferentiableAt ℝ g p) (u : P) (v : F) : fderiv ℝ (fun q => g q v) p u = fderiv ℝ g p u v := by rw [(hg.hasFDerivAt.clm_apply (hasFDerivAt_const v p)).fderiv] simp theorem pathSpatialExterior_fderiv {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} (hΞ“ : ContDiff ℝ ∞ Ξ“) (p u : ℝ Γ— E) (v w : E) : fderiv ℝ (pathSpatialExterior Ξ“) p u v w = fderiv ℝ (fderiv ℝ Ξ“) p u (0,v) w - fderiv ℝ (fderiv ℝ Ξ“) p u (0,w) v := by have hD := (hΞ“.fderiv_right (m := ∞) (by simp)).differentiable (by simp) p have hΞ© := (pathSpatialExterior_smooth hΞ“).differentiable (by simp) p rw [←fderiv_evaluation_const hΞ© u v, ←fderiv_evaluation_const (hΞ©.clm_apply (differentiableAt_const v)) u w] simp only [pathSpatialExterior_apply] change fderiv ℝ ((fun q => fderiv ℝ Ξ“ q (0,v) w)-(fun q => fderiv ℝ Ξ“ q (0,w) v)) p u = _ rw [fderiv_sub (hD.clm_apply (differentiableAt_const (0,v)) |>.clm_apply (differentiableAt_const w)) (hD.clm_apply (differentiableAt_const (0,w)) |>.clm_apply (differentiableAt_const v))] simp only [sub_apply,fderiv_evaluation_const (hD.clm_apply (differentiableAt_const (0,v))), fderiv_evaluation_const (hD.clm_apply (differentiableAt_const (0,w))),fderiv_evaluation_const hD] theorem pathTimePrimitive_fderiv {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} (hΞ“ : ContDiff ℝ ∞ Ξ“) (p u : ℝ Γ— E) (v : E) : fderiv ℝ (pathTimePrimitive Ξ“) p u v = fderiv ℝ (fderiv ℝ Ξ“) p u (1,0) v := by have hD := (hΞ“.fderiv_right (m := ∞) (by simp)).differentiable (by simp) p rw [←fderiv_evaluation_const ((pathTimePrimitive_smooth hΞ“).differentiable (by simp) p)] simp only [pathTimePrimitive,fderiv_evaluation_const (hD.clm_apply (differentiableAt_const (1,0))), fderiv_evaluation_const hD] theorem exact_path_time_equation {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} (hΞ“ : ContDiff ℝ ∞ Ξ“) (p : ℝ Γ— E) (v w : E) : fderiv ℝ (pathSpatialExterior Ξ“) p (1,0) v w = fderiv ℝ (pathTimePrimitive Ξ“) p (0,v) w - fderiv ℝ (pathTimePrimitive Ξ“) p (0,w) v := by have hs := (hΞ“.contDiffAt (x := p)).isSymmSndFDerivAt (by rw [minSmoothness_of_isRCLikeNormedField] change ((2 : β„•βˆž) : WithTop β„•βˆž) ≀ ↑(⊀ : β„•βˆž) exact WithTop.coe_le_coe.mpr le_top) simp only [pathSpatialExterior_fderiv hΞ“,pathTimePrimitive_fderiv hΞ“] rw [hs.eq (1,0) (0,v),hs.eq (1,0) (0,w)] theorem exact_path_closed {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} (hΞ“ : ContDiff ℝ ∞ Ξ“) (p : ℝ Γ— E) (u v w : E) : fderiv ℝ (pathSpatialExterior Ξ“) p (0,u) v w - fderiv ℝ (pathSpatialExterior Ξ“) p (0,v) u w + fderiv ℝ (pathSpatialExterior Ξ“) p (0,w) u v = 0 := by have hs := (hΞ“.contDiffAt (x := p)).isSymmSndFDerivAt (by rw [minSmoothness_of_isRCLikeNormedField] change ((2 : β„•βˆž) : WithTop β„•βˆž) ≀ ↑(⊀ : β„•βˆž) exact WithTop.coe_le_coe.mpr le_top) simp only [pathSpatialExterior_fderiv hΞ“] rw [hs.eq (0,u) (0,v),hs.eq (0,u) (0,w),hs.eq (0,v) (0,w)] ring @[fun_prop] theorem pathSpatialExterior_smoothAt {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} {p : ℝ Γ— E} (hΞ“ : ContDiffAt ℝ ∞ Ξ“ p) : ContDiffAt ℝ ∞ (pathSpatialExterior Ξ“) p := by have hd : ContDiffAt ℝ ∞ (fun q => (fderiv ℝ Ξ“ q).comp (ContinuousLinearMap.inr ℝ ℝ E)) p := (hΞ“.fderiv_right (by simp)).clm_comp contDiffAt_const have hflip : ContDiff ℝ ∞ (fun L : E β†’L[ℝ] E β†’L[ℝ] ℝ => L.flip) := LinearIsometryEquiv.contDiff (π•œ := ℝ) (n := ∞) (E := E β†’L[ℝ] E β†’L[ℝ] ℝ) (F := E β†’L[ℝ] E β†’L[ℝ] ℝ) (ContinuousLinearMap.flipβ‚—α΅’ ℝ E E ℝ) exact hd.sub (hflip.contDiffAt.comp p hd) @[fun_prop] theorem pathTimePrimitive_smoothAt {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} {p : ℝ Γ— E} (hΞ“ : ContDiffAt ℝ ∞ Ξ“ p) : ContDiffAt ℝ ∞ (pathTimePrimitive Ξ“) p := (hΞ“.fderiv_right (by simp)).clm_apply contDiffAt_const theorem pathSpatialExterior_fderivAt {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} {p : ℝ Γ— E} (hΞ“ : ContDiffAt ℝ ∞ Ξ“ p) (u : ℝ Γ— E) (v w : E) : fderiv ℝ (pathSpatialExterior Ξ“) p u v w = fderiv ℝ (fderiv ℝ Ξ“) p u (0,v) w - fderiv ℝ (fderiv ℝ Ξ“) p u (0,w) v := by have hD := (hΞ“.fderiv_right (m := ∞) (by simp)).differentiableAt (by simp) have hΞ© := (pathSpatialExterior_smoothAt hΞ“).differentiableAt (by simp) rw [←fderiv_evaluation_const hΞ© u v, ←fderiv_evaluation_const (hΞ©.clm_apply (differentiableAt_const v)) u w] simp only [pathSpatialExterior_apply] change fderiv ℝ ((fun q => fderiv ℝ Ξ“ q (0,v) w)-(fun q => fderiv ℝ Ξ“ q (0,w) v)) p u = _ rw [fderiv_sub (hD.clm_apply (differentiableAt_const (0,v)) |>.clm_apply (differentiableAt_const w)) (hD.clm_apply (differentiableAt_const (0,w)) |>.clm_apply (differentiableAt_const v))] simp only [sub_apply,fderiv_evaluation_const (hD.clm_apply (differentiableAt_const (0,v))), fderiv_evaluation_const (hD.clm_apply (differentiableAt_const (0,w))),fderiv_evaluation_const hD] theorem pathTimePrimitive_fderivAt {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} {p : ℝ Γ— E} (hΞ“ : ContDiffAt ℝ ∞ Ξ“ p) (u : ℝ Γ— E) (v : E) : fderiv ℝ (pathTimePrimitive Ξ“) p u v = fderiv ℝ (fderiv ℝ Ξ“) p u (1,0) v := by have hD := (hΞ“.fderiv_right (m := ∞) (by simp)).differentiableAt (by simp) rw [←fderiv_evaluation_const ((pathTimePrimitive_smoothAt hΞ“).differentiableAt (by simp))] simp only [pathTimePrimitive,fderiv_evaluation_const (hD.clm_apply (differentiableAt_const (1,0))), fderiv_evaluation_const hD] theorem exact_path_time_equationAt {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} {p : ℝ Γ— E} (hΞ“ : ContDiffAt ℝ ∞ Ξ“ p) (v w : E) : fderiv ℝ (pathSpatialExterior Ξ“) p (1,0) v w = fderiv ℝ (pathTimePrimitive Ξ“) p (0,v) w - fderiv ℝ (pathTimePrimitive Ξ“) p (0,w) v := by have hs := hΞ“.isSymmSndFDerivAt (by rw [minSmoothness_of_isRCLikeNormedField] change ((2 : β„•βˆž) : WithTop β„•βˆž) ≀ ↑(⊀ : β„•βˆž) exact WithTop.coe_le_coe.mpr le_top) simp only [pathSpatialExterior_fderivAt hΞ“,pathTimePrimitive_fderivAt hΞ“] rw [hs.eq (1,0) (0,v),hs.eq (1,0) (0,w)] theorem exact_path_closedAt {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} {p : ℝ Γ— E} (hΞ“ : ContDiffAt ℝ ∞ Ξ“ p) (u v w : E) : fderiv ℝ (pathSpatialExterior Ξ“) p (0,u) v w - fderiv ℝ (pathSpatialExterior Ξ“) p (0,v) u w + fderiv ℝ (pathSpatialExterior Ξ“) p (0,w) u v = 0 := by have hs := hΞ“.isSymmSndFDerivAt (by rw [minSmoothness_of_isRCLikeNormedField] change ((2 : β„•βˆž) : WithTop β„•βˆž) ≀ ↑(⊀ : β„•βˆž) exact WithTop.coe_le_coe.mpr le_top) simp only [pathSpatialExterior_fderivAt hΞ“] rw [hs.eq (0,u) (0,v),hs.eq (0,u) (0,w),hs.eq (0,v) (0,w)] ring end section open scoped ContDiff Manifold Topology open Set Function Manifold variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {M : Type*} [TopologicalSpace M] [ChartedSpace E M] [IsManifold π“˜(ℝ,E) ∞ M] def manifoldTimePrimitive (Ξ“ : ℝ β†’ ManifoldOneForm E M) (t : ℝ) : ManifoldOneForm E M := fun x => deriv (fun s => Ξ“ s x) t theorem chartOneForm_reconstruct_target {Ξ± : ManifoldOneForm E M} {c : M} {y : E} (hy : y ∈ (extChartAt π“˜(ℝ,E) c).target) : (chartOneForm Ξ± c y).comp (chartDifferential c ((extChartAt π“˜(ℝ,E) c).symm y)) = Ξ± ((extChartAt π“˜(ℝ,E) c).symm y) := by have hC : (chartDifferential (E := E) c ((extChartAt π“˜(ℝ,E) c).symm y)).IsInvertible := by convert! isInvertible_mfderiv_extChartAt (I := π“˜(ℝ,E)) ((extChartAt π“˜(ℝ,E) c).map_target hy) using 1 ext v exact congrArg (Ξ± ((extChartAt π“˜(ℝ,E) c).symm y)) (hC.inverse_apply_self v) theorem manifoldTimePrimitive_chart {Ξ“ : ℝ β†’ ManifoldOneForm E M} (hΞ“ : SmoothOneFormFamily Ξ“) {c : M} {t : ℝ} {y : E} (hy : y ∈ (extChartAt π“˜(ℝ,E) c).target) : chartOneForm (manifoldTimePrimitive Ξ“ t) c y = pathTimePrimitive (fun q : ℝ Γ— E => chartOneForm (Ξ“ q.1) c q.2) (t,y) := by let F : ℝ Γ— E β†’ E β†’L[ℝ] ℝ := fun q => chartOneForm (Ξ“ q.1) c q.2 let x := (extChartAt π“˜(ℝ,E) c).symm y have hF : ContDiffAt ℝ ∞ F (t,y) := (hΞ“ c).contDiffAt ((isOpen_univ.prod (isOpen_extChartAt_target c)).mem_nhds (show (t,y) ∈ univ Γ—Λ’ (extChartAt π“˜(ℝ,E) c).target from ⟨mem_univ t,hy⟩)) have hdf : HasFDerivAt F (fderiv ℝ F (t,y)) (t,y) := (hF.differentiableAt (by simp)).hasFDerivAt have hinc : HasDerivAt (fun s : ℝ => (s,y)) (1,0) t := (hasDerivAt_id t).prodMk (hasDerivAt_const t y) have hd : HasDerivAt (fun s => F (s,y)) (pathTimePrimitive F (t,y)) t := by have hh := hdf.comp_hasDerivAt t hinc simpa only [Function.comp_def,pathTimePrimitive] using hh have he : (fun s => (F (s,y)).comp (chartDifferential c x)) = fun s => Ξ“ s x := by funext s exact chartOneForm_reconstruct_target hy have hdn := hd.clm_comp (hasDerivAt_const t (chartDifferential c x)) rw [he] at hdn have hC : (chartDifferential (E := E) c x).IsInvertible := by convert! isInvertible_mfderiv_extChartAt (I := π“˜(ℝ,E)) ((extChartAt π“˜(ℝ,E) c).map_target hy) using 1 have hdne : deriv (fun s => Ξ“ s x) t = (pathTimePrimitive F (t,y)).comp (chartDifferential c x) := by simpa only [ContinuousLinearMap.comp_zero,add_zero] using hdn.deriv unfold chartOneForm manifoldTimePrimitive change (deriv (fun s => Ξ“ s x) t).comp (chartDifferential c x).inverse = _ rw [hdne] apply ContinuousLinearMap.ext intro v change pathTimePrimitive F (t,y) ((chartDifferential c x) ((chartDifferential c x).inverse v)) = pathTimePrimitive F (t,y) v exact congrArg (pathTimePrimitive F (t,y)) (hC.self_apply_inverse v) theorem pathSpatialExterior_eq_slice {Ξ“ : ℝ Γ— E β†’ E β†’L[ℝ] ℝ} {p : ℝ Γ— E} (hΞ“ : DifferentiableAt ℝ Ξ“ p) : pathSpatialExterior Ξ“ p = euclideanExteriorOneForm (fun y => Ξ“ (p.1,y)) p.2 := by have hi : HasFDerivAt (fun y : E => (p.1,y)) ((0 : E β†’L[ℝ] ℝ).prod (ContinuousLinearMap.id ℝ E)) p.2 := (hasFDerivAt_const p.1 p.2).prodMk (hasFDerivAt_id p.2) have hh : HasFDerivAt Ξ“ (fderiv ℝ Ξ“ p) (p.1,p.2) := hΞ“.hasFDerivAt have hd := (hh.comp p.2 hi).fderiv change fderiv ℝ (fun y => Ξ“ (p.1,y)) p.2 = _ at hd unfold euclideanExteriorOneForm rw [hd] rfl theorem manifoldExteriorOneForm_path_chart {Ξ“ : ℝ β†’ ManifoldOneForm E M} (hΞ“ : SmoothOneFormFamily Ξ“) {c : M} {t : ℝ} {y : E} (hy : y ∈ (extChartAt π“˜(ℝ,E) c).target) : chartTwoForm (manifoldExteriorOneForm (Ξ“ t)) c y = pathSpatialExterior (fun q : ℝ Γ— E => chartOneForm (Ξ“ q.1) c q.2) (t,y) := by rw [manifoldExteriorOneForm_chart (fun b z hz => (hΞ“.spatial_smooth t b hz).contDiffWithinAt) hy] exact (pathSpatialExterior_eq_slice ((hΞ“ c).contDiffAt ((isOpen_univ.prod (isOpen_extChartAt_target c)).mem_nhds (show (t,y) ∈ univ Γ—Λ’ (extChartAt π“˜(ℝ,E) c).target from ⟨mem_univ t,hy⟩)) |>.differentiableAt (by simp))).symm theorem manifoldExteriorOneForm_path_smooth {Ξ“ : ℝ β†’ ManifoldOneForm E M} (hΞ“ : SmoothOneFormFamily Ξ“) : SmoothTwoFormFamily (fun t => manifoldExteriorOneForm (Ξ“ t)) := by intro c p hp have hn := (isOpen_univ.prod (isOpen_extChartAt_target (I := π“˜(ℝ,E)) c)).mem_nhds hp apply ((pathSpatialExterior_smoothAt ((hΞ“ c).contDiffAt hn)).congr_of_eventuallyEq ?_).contDiffWithinAt filter_upwards [hn] with q hq exact manifoldExteriorOneForm_path_chart hΞ“ hq.2 theorem manifoldTimePrimitive_smooth {Ξ“ : ℝ β†’ ManifoldOneForm E M} (hΞ“ : SmoothOneFormFamily Ξ“) : SmoothOneFormFamily (manifoldTimePrimitive Ξ“) := by intro c p hp have hn := (isOpen_univ.prod (isOpen_extChartAt_target (I := π“˜(ℝ,E)) c)).mem_nhds hp apply ((pathTimePrimitive_smoothAt ((hΞ“ c).contDiffAt hn)).congr_of_eventuallyEq ?_).contDiffWithinAt filter_upwards [hn] with q hq exact manifoldTimePrimitive_chart hΞ“ hq.2 end section open scoped ContDiff Manifold Topology open Set Function Manifold variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {M : Type*} [TopologicalSpace M] [ChartedSpace E M] def manifoldWedge (Ξ± Ξ² : ManifoldOneForm E M) : ManifoldTwoForm E M := fun z => (Ξ± z).smulRight (Ξ² z)-(Ξ² z).smulRight (Ξ± z) @[simp] theorem manifoldWedge_apply (Ξ± Ξ² : ManifoldOneForm E M) (z : M) (v w : E) : manifoldWedge Ξ± Ξ² z v w=Ξ± z v*Ξ² z w-Ξ² z v*Ξ± z w := rfl theorem manifoldWedge_skew (Ξ± Ξ² : ManifoldOneForm E M) (z : M) (v w : E) : manifoldWedge Ξ± Ξ² z v w= -manifoldWedge Ξ± Ξ² z w v := by simp only [manifoldWedge_apply] ring theorem chartTwoForm_wedge (Ξ± Ξ² : ManifoldOneForm E M) (c : M) (y : E) : chartTwoForm (manifoldWedge Ξ± Ξ²) c y = (chartOneForm Ξ± c y).smulRight (chartOneForm Ξ² c y)- (chartOneForm Ξ² c y).smulRight (chartOneForm Ξ± c y) := by ext v w rfl theorem manifoldWedge_smooth {Ξ± Ξ² : ManifoldOneForm E M} (hΞ± : βˆ€ c,ContDiffOn ℝ ∞ (chartOneForm Ξ± c) (extChartAt π“˜(ℝ,E) c).target) (hΞ² : βˆ€ c,ContDiffOn ℝ ∞ (chartOneForm Ξ² c) (extChartAt π“˜(ℝ,E) c).target) : SmoothTwoForm (manifoldWedge Ξ± Ξ²) := by intro c have he : chartTwoForm (manifoldWedge Ξ± Ξ²) c = fun y => (chartOneForm Ξ± c y).smulRight (chartOneForm Ξ² c y)- (chartOneForm Ξ² c y).smulRight (chartOneForm Ξ± c y) := funext (chartTwoForm_wedge Ξ± Ξ² c) rw [he] exact ((hΞ± c).smulRight (hΞ² c)).sub ((hΞ² c).smulRight (hΞ± c)) end section open scoped ContDiff Manifold Topology open Set Function Manifold variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {M : Type*} [TopologicalSpace M] [ChartedSpace E M] [IsManifold π“˜(ℝ,E) ∞ M] def manifoldScalarDifferential (f : M β†’ ℝ) : ManifoldOneForm E M := mfderiv π“˜(ℝ,E) π“˜(ℝ,ℝ) f theorem manifoldScalarDifferential_chart {f : M β†’ ℝ} (hf : ContMDiff π“˜(ℝ,E) π“˜(ℝ,ℝ) ∞ f) {c : M} {y : E} (hy : y ∈ (extChartAt π“˜(ℝ,E) c).target) : chartOneForm (manifoldScalarDifferential f) c y= fderiv ℝ (f ∘ (extChartAt π“˜(ℝ,E) c).symm) y := by have hi := (contMDiffOn_extChartAt_symm (I := π“˜(ℝ,E)) (n := ∞) c).contMDiffAt ((isOpen_extChartAt_target (I := π“˜(ℝ,E)) c).mem_nhds hy) have hd := mfderiv_comp y (hf.mdifferentiableAt (by simp)) (hi.mdifferentiableAt (by simp)) rw [mfderiv_eq_fderiv] at hd rw [chartOneForm,chartDifferential_inverse hy] exact hd.symm theorem manifoldScalar_chart_smooth {f : M β†’ ℝ} (hf : ContMDiff π“˜(ℝ,E) π“˜(ℝ,ℝ) ∞ f) (c : M) : ContDiffOn ℝ ∞ (f ∘ (extChartAt π“˜(ℝ,E) c).symm) (extChartAt π“˜(ℝ,E) c).target := (hf.comp_contMDiffOn (contMDiffOn_extChartAt_symm (I := π“˜(ℝ,E)) (n := ∞) c)).contDiffOn theorem manifoldScalarDifferential_smooth {f : M β†’ ℝ} (hf : ContMDiff π“˜(ℝ,E) π“˜(ℝ,ℝ) ∞ f) (c : M) : ContDiffOn ℝ ∞ (chartOneForm (manifoldScalarDifferential f) c) (extChartAt π“˜(ℝ,E) c).target := by intro y hy have hs := (manifoldScalar_chart_smooth hf c).contDiffAt ((isOpen_extChartAt_target (I := π“˜(ℝ,E)) c).mem_nhds hy) have he : chartOneForm (manifoldScalarDifferential f) c =αΆ [𝓝 y] fderiv ℝ (f ∘ (extChartAt π“˜(ℝ,E) c).symm) := by filter_upwards [(isOpen_extChartAt_target (I := π“˜(ℝ,E)) c).mem_nhds hy] with z hz exact manifoldScalarDifferential_chart hf hz exact ((hs.fderiv_right (by simp)).congr_of_eventuallyEq he).contDiffWithinAt theorem manifoldScalarDifferential_closed {f : M β†’ ℝ} (hf : ContMDiff π“˜(ℝ,E) π“˜(ℝ,ℝ) ∞ f) (x : M) : manifoldExteriorOneForm (manifoldScalarDifferential (E := E) f) x=0 := by have hx : extChartAt π“˜(ℝ,E) x x∈(extChartAt π“˜(ℝ,E) x).target := (extChartAt π“˜(ℝ,E) x).map_source (mem_extChartAt_source x) have hn := (isOpen_extChartAt_target (I := π“˜(ℝ,E)) x).mem_nhds hx have hs := (manifoldScalar_chart_smooth hf x).contDiffAt hn have he : chartOneForm (manifoldScalarDifferential f) x =αΆ [𝓝 (extChartAt π“˜(ℝ,E) x x)] fderiv ℝ (f ∘ (extChartAt π“˜(ℝ,E) x).symm) := by filter_upwards [hn] with z hz exact manifoldScalarDifferential_chart hf hz apply ContinuousLinearMap.ext intro u apply ContinuousLinearMap.ext intro v change fderiv ℝ (chartOneForm (manifoldScalarDifferential f) x) (extChartAt π“˜(ℝ,E) x x) (chartDifferential x x u) (chartDifferential x x v)- fderiv ℝ (chartOneForm (manifoldScalarDifferential f) x) (extChartAt π“˜(ℝ,E) x x) (chartDifferential x x v) (chartDifferential x x u)=0 rw [he.fderiv_eq] exact sub_eq_zero.mpr ((hs.isSymmSndFDerivAt (by rw [minSmoothness_of_isRCLikeNormedField] change ((2 : β„•βˆž) : WithTop β„•βˆž) ≀ ↑(⊀ : β„•βˆž) exact WithTop.coe_le_coe.mpr le_top)).eq _ _) omit [IsManifold π“˜(ℝ,E) ∞ M] in theorem manifoldScalarDifferential_support (f : M β†’ ℝ) : support (manifoldScalarDifferential (E := E) f) βŠ† tsupport f := by intro x hx by_contra hn have he : f =αΆ [𝓝 x] fun _ => (0:ℝ) := by filter_upwards [isClosed_closure.isOpen_compl.mem_nhds hn] with y hy exact notMem_support.mp (fun hs => hy (subset_closure hs)) apply hx exact he.mfderiv_eq.trans (by rw [mfderiv_const,ContinuousLinearMap.comp_zero] rfl) end open scoped ContDiff Manifold Topology open Set Function Manifold variable {P E : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [NormedAddCommGroup E] [NormedSpace ℝ E] {M : Type*} [TopologicalSpace M] [ChartedSpace E M] [IsManifold π“˜(ℝ,E) ∞ M] omit [IsManifold π“˜(ℝ,E) ∞ M] in @[simp] theorem chartOneForm_sub (Ξ± Ξ² : ManifoldOneForm E M) (c : M) (y : E) : chartOneForm (Ξ±-Ξ²) c y=chartOneForm Ξ± c y-chartOneForm Ξ² c y := by apply ContinuousLinearMap.ext intro v rfl def glueManifoldOneForm (U : Set M) (Ξ± Ξ² : ManifoldOneForm E M) : ManifoldOneForm E M := Ξ² + extendManifoldOneForm U (Ξ±-Ξ²) omit [TopologicalSpace M] [ChartedSpace E M] [IsManifold π“˜(ℝ,E) ∞ M] in @[simp] theorem glueManifoldOneForm_inside {U : Set M} (Ξ± Ξ² : ManifoldOneForm E M) {x : M} (hx : x ∈ U) : glueManifoldOneForm U Ξ± Ξ² x=Ξ± x := by simp [glueManifoldOneForm,extendManifoldOneForm_inside hx] omit [TopologicalSpace M] [ChartedSpace E M] [IsManifold π“˜(ℝ,E) ∞ M] in @[simp] theorem glueManifoldOneForm_outside {U : Set M} (Ξ± Ξ² : ManifoldOneForm E M) {x : M} (hx : x βˆ‰ U) : glueManifoldOneForm U Ξ± Ξ² x=Ξ² x := by simp [glueManifoldOneForm,extendManifoldOneForm_outside hx] omit [TopologicalSpace M] [ChartedSpace E M] [IsManifold π“˜(ℝ,E) ∞ M] in theorem glueManifoldOneForm_off_support {U K : Set M} (Ξ± Ξ² : ManifoldOneForm E M) (hmatch : βˆ€ x ∈ U, x βˆ‰ K β†’ Ξ± x=Ξ² x) {x : M} (hx : x βˆ‰ K) : glueManifoldOneForm U Ξ± Ξ² x=Ξ² x := by by_cases hu : x ∈ U Β· rw [glueManifoldOneForm_inside Ξ± Ξ² hu,hmatch x hu hx] Β· exact glueManifoldOneForm_outside Ξ± Ξ² hu theorem glueManifoldOneForm_smooth {U K : Set M} (hU : IsOpen U) (hK : IsClosed K) (hKU : K βŠ† U) {Ξ± Ξ² : P β†’ ManifoldOneForm E M} (hΞ± : βˆ€ c, ContDiffOn ℝ ∞ (fun q : P Γ— E => chartOneForm (Ξ± q.1) c q.2) (univ Γ—Λ’ ((extChartAt π“˜(ℝ,E) c).target ∩ (extChartAt π“˜(ℝ,E) c).symm ⁻¹' U))) (hΞ² : SmoothOneFormFamily Ξ²) (hmatch : βˆ€ p x, x ∈ U β†’ x βˆ‰ K β†’ Ξ± p x=Ξ² p x) : SmoothOneFormFamily (fun p => glueManifoldOneForm U (Ξ± p) (Ξ² p)) := by have hs := extendManifoldOneForm_smooth hU hK hKU (Ξ± := fun p => Ξ± p-Ξ² p) (fun c => by simp only [chartOneForm_sub] exact (hΞ± c).sub ((hΞ² c).mono (fun _ hq => ⟨hq.1,hq.2.1⟩))) (fun p x hu hx => sub_eq_zero.mpr (hmatch p x hu hx)) intro c simpa only [glueManifoldOneForm,chartOneForm_add] using (hΞ² c).add (hs c) theorem glueManifoldOneForm_exterior {U K : Set M} (hU : IsOpen U) (hK : IsClosed K) (Ξ± Ξ² : ManifoldOneForm E M) (hmatch : βˆ€ x ∈ U, x βˆ‰ K β†’ Ξ± x=Ξ² x) : (βˆ€ x ∈ U, manifoldExteriorOneForm (glueManifoldOneForm U Ξ± Ξ²) x=manifoldExteriorOneForm Ξ± x) ∧ (βˆ€ x, x βˆ‰ K β†’ manifoldExteriorOneForm (glueManifoldOneForm U Ξ± Ξ²) x=manifoldExteriorOneForm Ξ² x) := by constructor Β· intro x hx apply manifoldExteriorOneForm_congr_of_eventuallyEq filter_upwards [hU.mem_nhds hx] with y hy exact glueManifoldOneForm_inside Ξ± Ξ² hy Β· intro x hx apply manifoldExteriorOneForm_congr_of_eventuallyEq filter_upwards [hK.isOpen_compl.mem_nhds hx] with y hy exact glueManifoldOneForm_off_support Ξ± Ξ² hmatch hy omit [TopologicalSpace M] [ChartedSpace E M] [IsManifold π“˜(ℝ,E) ∞ M] in theorem glueManifoldOneForm_time {U K : Set M} (Ξ± Ξ² : ℝ β†’ ManifoldOneForm E M) (hmatch : βˆ€ t x, x ∈ U β†’ x βˆ‰ K β†’ Ξ± t x=Ξ² t x) (t : ℝ) : (βˆ€ x ∈ U, manifoldTimePrimitive (fun s => glueManifoldOneForm U (Ξ± s) (Ξ² s)) t x= manifoldTimePrimitive Ξ± t x) ∧ (βˆ€ x, x βˆ‰ K β†’ manifoldTimePrimitive (fun s => glueManifoldOneForm U (Ξ± s) (Ξ² s)) t x= manifoldTimePrimitive Ξ² t x) := by constructor Β· intro x hx unfold manifoldTimePrimitive congr 1 funext s exact glueManifoldOneForm_inside (Ξ± s) (Ξ² s) hx Β· intro x hx unfold manifoldTimePrimitive congr 1 funext s exact glueManifoldOneForm_off_support (Ξ± s) (Ξ² s) (hmatch s) hx omit [TopologicalSpace M] [ChartedSpace E M] [IsManifold π“˜(ℝ,E) ∞ M] in theorem glueManifoldOneForm_initial {U : Set M} {Ξ± Ξ² : ℝ β†’ ManifoldOneForm E M} (hzero : βˆ€ x ∈ U, Ξ± 0 x=Ξ² 0 x) : glueManifoldOneForm U (Ξ± 0) (Ξ² 0)=Ξ² 0 := by funext x by_cases hx : x ∈ U Β· rw [glueManifoldOneForm_inside _ _ hx,hzero x hx] Β· exact glueManifoldOneForm_outside _ _ hx end PackingSufficiencySupport.Hamiltonian end end OAI