import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Jacobi.Index.IndexPairAlgebra import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Regularity.ChartEulerEquation /-! Adapted from Mapher `PoincareMT/Proofs/M08/IndexContinuity.lean` at `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ set_option autoImplicit false set_option backward.isDefEq.respectTransparency false noncomputable section open Set Filter Topology open scoped Manifold ContDiff Bundle universe u namespace PoincareMT.LGeometry variable {n : โ„•} {M : Type u} [TopologicalSpace M] [ChartedSpace (EuclideanSpace โ„ (Fin n)) M] [IsManifold (๐“ก n) โˆž M] local instance indexContinuityDualGroup : NormedAddCommGroup (EuclideanSpace โ„ (Fin n) โ†’L[โ„] โ„) := ContinuousLinearMap.toNormedAddCommGroup local instance indexContinuityDualSpace : NormedSpace โ„ (EuclideanSpace โ„ (Fin n) โ†’L[โ„] โ„) := ContinuousLinearMap.toNormedSpace local instance indexContinuityBilinGroup : NormedAddCommGroup (EuclideanSpace โ„ (Fin n) โ†’L[โ„] EuclideanSpace โ„ (Fin n) โ†’L[โ„] โ„) := ContinuousLinearMap.toNormedAddCommGroup local instance indexContinuityBilinSpace : NormedSpace โ„ (EuclideanSpace โ„ (Fin n) โ†’L[โ„] EuclideanSpace โ„ (Fin n) โ†’L[โ„] โ„) := ContinuousLinearMap.toNormedSpace theorem alongField_chartCoordinates_contDiffOn {C : Set โ„} (x : M) (ฮฑ : โ„ โ†’ M) (Y : โˆ€ s, TangentSpace (๐“ก n) (ฮฑ s)) (hY : ContMDiffOn (๐“˜(โ„, โ„)) ((๐“ก n).prod (๐“ก n)) โˆž (fun s โ†ฆ Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ s) (Y s)) C) (hsrc : MapsTo ฮฑ C (chartAt (EuclideanSpace โ„ (Fin n)) x).source) : ContDiffOn โ„ โˆž (fun s โ†ฆ (trivializationAt (EuclideanSpace โ„ (Fin n)) (TangentSpace (๐“ก n)) x (Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ s) (Y s))).2) C := by let e := trivializationAt (EuclideanSpace โ„ (Fin n)) (TangentSpace (๐“ก n)) x have h := e.contMDiffOn.comp hY (fun s hs โ†ฆ e.mem_source.mpr (hsrc hs)) exact ContMDiffOn.contDiffOn (fun s hs โ†ฆ (h s hs).snd) set_option maxHeartbeats 1600000 in theorem jacobiPairResidual_contDiffOn {J : Set โ„} (F : RicciFlow n M J) (hM04 : RicciFlowCurvatureTheory.{u}) (T : โ„) {a b : โ„} (hab : a < b) (htime : โˆ€ r โˆˆ Icc a b, T - r ^ 2 โˆˆ J) {U : Set โ„} (hU : IsOpen U) (hCU : Icc a b โІ U) (ฮฑ : โ„ โ†’ M) (hฮฑ : ContMDiffOn (๐“˜(โ„, โ„)) (๐“ก n) โˆž ฮฑ U) (Y P DP W : โˆ€ s, TangentSpace (๐“ก n) (ฮฑ s)) (hY : ContMDiffOn (๐“˜(โ„, โ„)) ((๐“ก n).prod (๐“ก n)) โˆž (fun s โ†ฆ Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ s) (Y s)) (Icc a b)) (hP : ContMDiffOn (๐“˜(โ„, โ„)) ((๐“ก n).prod (๐“ก n)) โˆž (fun s โ†ฆ Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ s) (P s)) (Icc a b)) (hDP : ContMDiffOn (๐“˜(โ„, โ„)) ((๐“ก n).prod (๐“ก n)) โˆž (fun s โ†ฆ Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ s) (DP s)) (Icc a b)) (hW : ContMDiffOn (๐“˜(โ„, โ„)) ((๐“ก n).prod (๐“ก n)) โˆž (fun s โ†ฆ Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ s) (W s)) (Icc a b)) : ContDiffOn โ„ โˆž (fun s โ†ฆ jacobiPairResidual F T ฮฑ (Icc a b) s (Y s) (P s) (DP s) (W s)) (Icc a b) := by intro s hs let x := ฮฑ s let N := U โˆฉ ฮฑ โปยน' (chartAt (EuclideanSpace โ„ (Fin n)) x).source let C := Icc a b โˆฉ N let e := trivializationAt (EuclideanSpace โ„ (Fin n)) (TangentSpace (๐“ก n)) x let coord := fun (H : โˆ€ r, TangentSpace (๐“ก n) (ฮฑ r)) (r : โ„) โ†ฆ (e (Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ r) (H r))).2 have hN : IsOpen N := hฮฑ.continuousOn.isOpen_inter_preimage hU (chartAt (EuclideanSpace โ„ (Fin n)) x).open_source have hsN : s โˆˆ N := โŸจhCU hs, mem_chart_source _ _โŸฉ have hsrc : MapsTo ฮฑ C (chartAt (EuclideanSpace โ„ (Fin n)) x).source := fun r hr โ†ฆ hr.2.2 have hcoord (H : โˆ€ r, TangentSpace (๐“ก n) (ฮฑ r)) (hH : ContMDiffOn (๐“˜(โ„, โ„)) ((๐“ก n).prod (๐“ก n)) โˆž (fun r โ†ฆ Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ r) (H r)) (Icc a b)) : ContDiffOn โ„ โˆž (coord H) C := alongField_chartCoordinates_contDiffOn x ฮฑ H (hH.mono inter_subset_left) hsrc have hq : ContDiffOn โ„ โˆž ((extChartAt (๐“ก n) x) โˆ˜ ฮฑ) C := chart_curve_contDiffOn x ฮฑ (hฮฑ.mono (inter_subset_right.trans inter_subset_left)) hsrc have hmap : MapsTo (fun r โ†ฆ (r, extChartAt (๐“ก n) x (ฮฑ r))) C (Icc a b ร—หข (extChartAt (๐“ก n) x).target) := by intro r hr exact โŸจhr.1, (extChartAt (๐“ก n) x).map_source (by simpa only [extChartAt_source] using hsrc hr)โŸฉ have hG := (chartActionMetric_closed_contDiffOn F T x htime).comp (f := fun r โ†ฆ (r, extChartAt (๐“ก n) x (ฮฑ r))) (contDiffOn_id.prodMk hq) hmap obtain โŸจ_, _, hK, hHโŸฉ := jacobiAlongCoefficients_contDiffOn F hM04 T x ฮฑ (uniqueDiffOn_Icc hab) htime (show C โІ Icc a b from inter_subset_left) hU (show C โІ U from inter_subset_right.trans inter_subset_left) hฮฑ hsrc have hform := (((hG.clm_apply (hcoord DP hDP)).clm_apply (hcoord W hW)).sub ((hK.clm_apply (hcoord Y hY)).clm_apply (hcoord W hW))).add ((hH.clm_apply (hcoord P hP)).clm_apply (hcoord W hW)) have hactual : ContDiffOn โ„ โˆž (fun r โ†ฆ jacobiPairResidual F T ฮฑ (Icc a b) r (Y r) (P r) (DP r) (W r)) C := by apply hform.congr intro r hr have hฮฑr := ((hฮฑ r hr.2.1).contMDiffAt (hU.mem_nhds hr.2.1)).mdifferentiableAt (by simp) have hid := jacobiPairResidual_chart F hM04 T hab htime x ฮฑ hr.1 (hsrc hr) hฮฑr (coord Y r) (coord P r) (coord DP r) (coord W r) simpa only [coord, e, Function.comp_apply, chartFrame_coordinates_at (hsrc hr)] using hid exact (contDiffWithinAt_inter (hN.mem_nhds hsN)).mp (hactual s โŸจhs, hsNโŸฉ) theorem regularizedIndexPairDensity_contDiffOn {J : Set โ„} (F : RicciFlow n M J) (hM04 : RicciFlowCurvatureTheory.{u}) (T : โ„) {a b : โ„} (hab : a < b) (htime : โˆ€ r โˆˆ Icc a b, T - r ^ 2 โˆˆ J) {U : Set โ„} (hU : IsOpen U) (hCU : Icc a b โІ U) (ฮฑ : โ„ โ†’ M) (hฮฑ : ContMDiffOn (๐“˜(โ„, โ„)) (๐“ก n) โˆž ฮฑ U) (Y W DY DW : โˆ€ s, TangentSpace (๐“ก n) (ฮฑ s)) (hY : ContMDiffOn (๐“˜(โ„, โ„)) ((๐“ก n).prod (๐“ก n)) โˆž (fun s โ†ฆ Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ s) (Y s)) (Icc a b)) (hW : ContMDiffOn (๐“˜(โ„, โ„)) ((๐“ก n).prod (๐“ก n)) โˆž (fun s โ†ฆ Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ s) (W s)) (Icc a b)) (hDY : ContMDiffOn (๐“˜(โ„, โ„)) ((๐“ก n).prod (๐“ก n)) โˆž (fun s โ†ฆ Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ s) (DY s)) (Icc a b)) (hDW : ContMDiffOn (๐“˜(โ„, โ„)) ((๐“ก n).prod (๐“ก n)) โˆž (fun s โ†ฆ Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ s) (DW s)) (Icc a b)) : ContDiffOn โ„ โˆž (fun s โ†ฆ regularizedIndexPairDensity F T ฮฑ (Icc a b) s (Y s) (W s) (DY s) (DW s)) (Icc a b) := by have hzero : ContMDiffOn (๐“˜(โ„, โ„)) ((๐“ก n).prod (๐“ก n)) โˆž (fun s โ†ฆ Bundle.TotalSpace.mk' (EuclideanSpace โ„ (Fin n)) (ฮฑ s) (0 : TangentSpace (๐“ก n) (ฮฑ s))) (Icc a b) := (Bundle.contMDiff_zeroSection โ„ (TangentSpace (๐“ก n))).comp_contMDiffOn (hฮฑ.mono hCU) have hres := jacobiPairResidual_contDiffOn F hM04 T hab htime hU hCU ฮฑ hฮฑ Y (fun _ โ†ฆ 0) (fun _ โ†ฆ 0) W hY hzero hzero hW have hpair := movingMetric_pair_contMDiffOn F (fun s โ†ฆ T - s ^ 2) ฮฑ DY DW (contDiff_const.sub (contDiff_id.pow 2)).contMDiff.contMDiffOn (hฮฑ.mono hCU) hDY hDW htime exact hpair.contDiffOn.sub hres end PoincareMT.LGeometry