import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.FrozenChartCoordinates import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.BilinearFamily import PoincareLib.Geometry.Riemannian.Tensor.Regularity /-! # Tensor derivatives throughout a fixed chart Actual frozen extensions have variable chart coefficients. The product rule cancels their derivatives against the connection corrections. -/ set_option autoImplicit false set_option maxSynthPendingDepth 3 open scoped Manifold ContDiff Bundle Topology BigOperators open Filter universe u namespace PoincareMT.ReducedLength variable {n : โ„•} {M : Type u} [TopologicalSpace M] [ChartedSpace (EuclideanSpace โ„ (Fin n)) M] [IsManifold (๐“ก n) โˆž M] local notation "E" => EuclideanSpace โ„ (Fin n) theorem mvfderiv_clm_application {V W : Type*} [NormedAddCommGroup V] [NormedSpace โ„ V] [NormedAddCommGroup W] [NormedSpace โ„ W] (B : M โ†’ V โ†’L[โ„] W) (c : M โ†’ V) (q : M) (hB : MDifferentiableAt (๐“ก n) (๐“˜(โ„, V โ†’L[โ„] W)) B q) (hc : MDifferentiableAt (๐“ก n) (๐“˜(โ„, V)) c q) (X : TangentSpace (๐“ก n) q) : mvfderiv (๐“ก n) (fun x โ†ฆ B x (c x)) q X = B q (mvfderiv (๐“ก n) c q X) + mvfderiv (๐“ก n) B q X (c q) := by let z := (B q, c q) have he := (hasFDerivAt_fst (๐•œ := โ„) (p := z)).clm_apply (hasFDerivAt_snd (๐•œ := โ„) (p := z)) have hp : HasMFDerivAt (๐“ก n) (๐“˜(โ„, (V โ†’L[โ„] W) ร— V)) (fun x โ†ฆ (B x, c x)) q ((mvfderiv (๐“ก n) B q).prod (mvfderiv (๐“ก n) c q)) := by convert! hB.hasMFDerivAt.prodMk hc.hasMFDerivAt using 1 <;> simp only [modelWithCornersSelf_prod, chartedSpaceSelf_prod] have h := he.hasMFDerivAt.comp q hp convert! congrArg (fun L : TangentSpace (๐“ก n) q โ†’L[โ„] W โ†ฆ L X) h.mfderiv using 1 noncomputable def chartTensorBilinear (T : CovariantTensorEvaluation n M 2) (hT : IsSmoothCovariantTensor T) (p q : M) : E โ†’L[โ„] E โ†’L[โ„] โ„ := bilinearOfMultilinear ((hT.1 q).choose.compLinearMap (fun _ โ†ฆ (mfderiv (๐“ก n) (๐“ก n) (chartAt E p) q).inverse.toLinearMap)) set_option backward.isDefEq.respectTransparency false in theorem chartTensorBilinear_apply (T : CovariantTensorEvaluation n M 2) (hT : IsSmoothCovariantTensor T) (p q : M) (v w : E) : chartTensorBilinear T hT p q v w = T q ![chartVectorField p v q, chartVectorField p w q] := by rw [chartTensorBilinear, bilinearOfMultilinear_apply, MultilinearMap.compLinearMap_apply, โ† (hT.1 q).choose_spec] congr 1 funext i fin_cases i <;> rfl theorem chartTensorBilinear_smooth (T : CovariantTensorEvaluation n M 2) (hT : IsSmoothCovariantTensor T) (p : M) : ContMDiffOn (๐“ก n) (๐“˜(โ„, E โ†’L[โ„] E โ†’L[โ„] โ„)) โˆž (chartTensorBilinear T hT p) (chartAt E p).source := by apply contMDiffOn_bilinear_iff.mpr intro v w have h := hT.2 (chartAt E p).source (chartAt E p).open_source (fun i โ†ฆ chartVectorField p (![v, w] i)) (fun i โ†ฆ chartVectorField_smooth p _) apply h.congr intro x _ rw [chartTensorBilinear_apply] congr 1 funext i fin_cases i <;> rfl set_option maxHeartbeats 1000000 in -- Two actual frozen-field germs are expanded and differentiated before cancellation. set_option backward.isDefEq.respectTransparency false in theorem covariantTensorDerivative_fixedChart {g : RiemannianMetric n M} (D : LeviCivitaData g) (T : CovariantTensorEvaluation n M 2) (hT : IsSmoothCovariantTensor T) (p q : M) (hq : q โˆˆ (chartAt E p).source) (X : TangentSpace (๐“ก n) q) (A : E โ†’L[โ„] E) (hA : โˆ€ v : E, D.connection (chartVectorField p v) q X = chartVectorField p (A v) q) (v w : E) : D.covariantTensorDerivative T q ![X, chartVectorField p v q, chartVectorField p w q] = mvfderiv (๐“ก n) (chartTensorBilinear T hT p) q X v w - chartTensorBilinear T hT p q (A v) w - chartTensorBilinear T hT p q v (A w) := by classical let V := chartVectorField p v q let W := chartVectorField p w q let c := frozenChartCoordinates p q V let d := frozenChartCoordinates p q W let B := chartTensorBilinear T hT p have hc := (frozenChartCoordinates_contMDiffAt p q hq V).mdifferentiableAt (by simp) have hd := (frozenChartCoordinates_contMDiffAt p q hq W).mdifferentiableAt (by simp) have hB := ((chartTensorBilinear_smooth T hT p).contMDiffAt ((chartAt E p).open_source.mem_nhds hq)).mdifferentiableAt (by simp) have hcv : c q = v := frozenChartCoordinates_at_base p q hq v have hdw : d q = w := frozenChartCoordinates_at_base p q hq w have heq : (fun x โ†ฆ T x ![FiberBundle.extend E V x, FiberBundle.extend E W x]) =แถ [๐“ q] (fun x โ†ฆ B x (c x) (d x)) := by filter_upwards [(chartAt E p).open_source.mem_nhds hq] with x hx rw [chartTensorBilinear_apply, frozenChartCoordinates_reconstruct p q x V hx, frozenChartCoordinates_reconstruct p q x W hx] have hder : mvfderiv (๐“ก n) (fun x โ†ฆ T x ![FiberBundle.extend E V x, FiberBundle.extend E W x]) q X = B q v (mvfderiv (๐“ก n) d q X) + B q (mvfderiv (๐“ก n) c q X) w + mvfderiv (๐“ก n) B q X v w := by rw [mvfderiv, heq.mfderiv_eq] change mvfderiv (๐“ก n) (fun x โ†ฆ B x (c x) (d x)) q X = _ rw [mvfderiv_clm_application (fun x โ†ฆ B x (c x)) d q (hB.clm_apply hc) hd X, mvfderiv_clm_application B c q hB hc X, hcv, hdw, ContinuousLinearMap.add_apply] ring have hup0 (a : TangentSpace (๐“ก n) q) : Function.update ![V, W] (0 : Fin 2) a = ![a, W] := by funext i fin_cases i <;> simp have hup1 (a : TangentSpace (๐“ก n) q) : Function.update ![V, W] (1 : Fin 2) a = ![V, a] := by funext i fin_cases i <;> simp have htail : (fun i : Fin 2 โ†ฆ ![X, V, W] i.succ) = ![V, W] := rfl have hfields : (fun x โ†ฆ T x (fun i : Fin 2 โ†ฆ FiberBundle.extend E (![V, W] i) x)) = (fun x โ†ฆ T x ![FiberBundle.extend E V x, FiberBundle.extend E W x]) := by funext x congr 1 funext i fin_cases i <;> rfl unfold LeviCivitaData.covariantTensorDerivative change mvfderiv (๐“ก n) (fun x โ†ฆ T x (fun i : Fin 2 โ†ฆ FiberBundle.extend E (![X, V, W] i.succ) x)) q X - (โˆ‘ i : Fin 2, T q (Function.update (fun j : Fin 2 โ†ฆ ![X, V, W] j.succ) i (D.connection (FiberBundle.extend E (![X, V, W] i.succ)) q X))) = _ simp only [Matrix.cons_val_succ] rw [hfields, Fin.sum_univ_two, hup0, hup1] simp only [Matrix.cons_val_zero, Matrix.cons_val_one] rw [connection_frozenChartCoordinates D p q hq X A hA v, connection_frozenChartCoordinates D p q hq X A hA w] rw [โ† chartTensorBilinear_apply T hT p q _ w, โ† chartTensorBilinear_apply T hT p q v _, hder] simp only [map_add, ContinuousLinearMap.add_apply] ring end PoincareMT.ReducedLength