import Mathlib import OAI.Analysis.BiholderTransport.Coordinates.ChartGradientMap namespace OAI noncomputable section open Set Filter Manifold Bundle open scoped Topology ContDiff namespace WeakMTWTransport variable {n : โ„•} {M : Type*} [MetricSpace M] [CompactSpace M] [Nonempty M] [ChartedSpace (Model n) M] [IsManifold ๐“˜(โ„,Model n) โˆž M] [RiemannianBundle (fun x : M => TangentSpace ๐“˜(โ„,Model n) x)] [IsContMDiffRiemannianBundle ๐“˜(โ„,Model n) โˆž (Model n) (fun x : M => TangentSpace ๐“˜(โ„,Model n) x)] [IsRiemannianManifold ๐“˜(โ„,Model n) M] abbrev Phase (n:โ„•) := Model n ร— (Model n โ†’L[โ„] โ„) def phaseRaise (a:M) (q:Phase n) : Model n ร— Model n := (q.1,(riemannianCoordinateMetric a q.1).inverse q.2) def phaseLower (a:M) (q:Model n ร— Model n) : Phase n := (q.1,riemannianCoordinateMetric a q.1 q.2) def coordinatePhaseFlow (a:M) (q:โ„ร—Phase n) : Phase n := let ฯ‡ := extChartAt (๐“˜(โ„,Model n).prod ๐“˜(โ„,Model n)) (โŸจa,0โŸฉ:TangentBundle ๐“˜(โ„,Model n) M) phaseLower a (ฯ‡ (sprayFlow (-q.1) (ฯ‡.symm (phaseRaise a q.2)))) omit [CompactSpace M] [Nonempty M] [IsRiemannianManifold ๐“˜(โ„,Model n) M] in lemma phaseLower_contDiffAt {a:M} {q:Model n ร— Model n} (hq:q.1โˆˆ(extChartAt ๐“˜(โ„,Model n) a).target) : ContDiffAt โ„ โˆž (phaseLower a) q := by have hg := (contDiffOn_riemannianCoordinateMetric (E := Model n) a).contDiffAt ((isOpen_extChartAt_target a).mem_nhds hq) exact contDiffAt_fst.prodMk ((hg.comp q contDiffAt_fst).clm_apply contDiffAt_snd) omit [CompactSpace M] [Nonempty M] [IsContMDiffRiemannianBundle ๐“˜(โ„,Model n) โˆž (Model n) (fun x : M => TangentSpace ๐“˜(โ„,Model n) x)] [IsRiemannianManifold ๐“˜(โ„,Model n) M] in lemma phaseLower_raise {a:M} {q:Phase n} (hq:q.1โˆˆ(extChartAt ๐“˜(โ„,Model n) a).target) : phaseLower a (phaseRaise a q)=q := by exact Prod.ext rfl ((riemannianCoordinateMetric_isInvertible hq).self_apply_inverse q.2) omit [Nonempty M] [IsRiemannianManifold ๐“˜(โ„,Model n) M] in lemma coordinatePhaseFlow_zero {a:M} {q:Phase n} (hq:q.1โˆˆ(extChartAt ๐“˜(โ„,Model n) a).target) : coordinatePhaseFlow a (0,q)=q := by let ฯ‡ := extChartAt (๐“˜(โ„,Model n).prod ๐“˜(โ„,Model n)) (โŸจa,0โŸฉ:TangentBundle ๐“˜(โ„,Model n) M) have ht:phaseRaise a qโˆˆฯ‡.target := (tangent_chart_target_iff _ _).mpr hq dsimp only [coordinatePhaseFlow] rw [neg_zero,sprayFlow_zero,ฯ‡.right_inv ht] exact phaseLower_raise hq omit [Nonempty M] [IsRiemannianManifold ๐“˜(โ„,Model n) M] in lemma coordinatePhaseFlow_contDiffAt {a:M} {q:Phase n} (hq:q.1โˆˆ(extChartAt ๐“˜(โ„,Model n) a).target) : ContDiffAt โ„ โˆž (coordinatePhaseFlow a) (0,q) := by let ฯ‡ := extChartAt (๐“˜(โ„,Model n).prod ๐“˜(โ„,Model n)) (โŸจa,0โŸฉ:TangentBundle ๐“˜(โ„,Model n) M) have ht:phaseRaise a qโˆˆฯ‡.target := (tangent_chart_target_iff _ _).mpr hq have hi := (contMDiffOn_extChartAt_symm (n := โˆž) (โŸจa,0โŸฉ:TangentBundle ๐“˜(โ„,Model n) M)).contMDiffAt ((isOpen_extChartAt_target _).mem_nhds ht) have hr:ContDiffAt โ„ โˆž (phaseRaise a) q := coordinateRaise_contDiffAt hq have hinput := hi.comp (f:=fun p:โ„ร—Phase n=>phaseRaise a p.2) (0,q) (hr.comp (0,q) contDiffAt_snd).contMDiffAt have hf := contMDiff_sprayFlow.contMDiffAt.comp (f:=fun p:โ„ร—Phase n=> (-p.1,ฯ‡.symm (phaseRaise a p.2))) (0,q) (contDiffAt_fst.neg.contMDiffAt.prodMk hinput) have he:sprayFlow (-(0:โ„)) (ฯ‡.symm (phaseRaise a q))=ฯ‡.symm (phaseRaise a q) := by rw [neg_zero,sprayFlow_zero] have hc:ContMDiffAt (๐“˜(โ„,Model n).prod ๐“˜(โ„,Model n)) ๐“˜(โ„,Model n ร— Model n) โˆž ฯ‡ (sprayFlow (-(0:โ„)) (ฯ‡.symm (phaseRaise a q))) := by rw [he] exact contMDiffAt_extChartAt' (by simpa only [ฯ‡,extChartAt_source] using ฯ‡.map_target ht) have hout := (hc.comp (f:=fun p:โ„ร—Phase n=> sprayFlow (-p.1) (ฯ‡.symm (phaseRaise a p.2))) (0,q) hf).contDiffAt have hbase:(ฯ‡ (sprayFlow (-(0:โ„)) (ฯ‡.symm (phaseRaise a q)))).1โˆˆ (extChartAt ๐“˜(โ„,Model n) a).target := by rw [he,ฯ‡.right_inv ht]; exact hq exact (phaseLower_contDiffAt hbase).comp (0,q) hout omit [Nonempty M] [IsRiemannianManifold ๐“˜(โ„,Model n) M] in lemma coordinatePhaseFlow_derivative_limit {a:M} {q:Phase n} (hq:q.1โˆˆ(extChartAt ๐“˜(โ„,Model n) a).target) : Tendsto (fun p:โ„ร—Phase n=>fderiv โ„ (fun v=>coordinatePhaseFlow a (p.1,v)) p.2) (๐“ (0,q)) (๐“ (ContinuousLinearMap.id โ„ (Phase n))) := by have hd := ContDiffAt.partial_snd_fderiv (f:=fun t v=>coordinatePhaseFlow a (t,v)) (coordinatePhaseFlow_contDiffAt hq) have he:(fun v:Phase n=>coordinatePhaseFlow a (0,v))=แถ [๐“ q] id := by filter_upwards [continuousAt_fst.preimage_mem_nhds ((isOpen_extChartAt_target a).mem_nhds hq)] with v hv exact coordinatePhaseFlow_zero hv have hev:fderiv โ„ (fun v=>coordinatePhaseFlow a (0,v)) q=ContinuousLinearMap.id โ„ (Phase n) := by rw [he.fderiv_eq,fderiv_id] simpa only [hev] using hd.continuousAt.tendsto end WeakMTWTransport end end OAI