import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.SourceNames.ReducedLength import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.SourceNames.Realization import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.Manifold.OpenSubsetChart import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.LocalCenteredHessian import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Differential.SecondDerivativeComposition /-! # The actual Hessian chain rule on an open spatial subset The centered Hessian and scalar second-derivative chain rule retain the same connection correction. This is the coordinate step in Morgan-Tian Proposition 6.33 and Lemma 6.40, pp. 120-121, 126-127. -/ set_option autoImplicit false -- The tangent fibers of an open subset have their ambient model coordinates. set_option backward.isDefEq.respectTransparency false open Set Filter open scoped Manifold ContDiff Topology namespace PoincareMT.M14 variable {n : โ„•} (U : TopologicalSpace.Opens (EuclideanSpace โ„ (Fin n))) /-- Centered chart fields are the actual constant ambient fields on an open spatial subset, Lemma 6.40, pp. 126-127. -/ theorem openSubset_chartVectorField (x y : U) (v : EuclideanSpace โ„ (Fin n)) : Proofs.M09.chartVectorField x v y = v := by change (mfderiv (๐“ก n) (๐“ก n) (Subtype.val : U โ†’ EuclideanSpace โ„ (Fin n)) y).inverse v = v rw [Proofs.M11.mfderiv_openSubtype_val] change (ContinuousLinearMap.id โ„ (EuclideanSpace โ„ (Fin n))).inverse v = v simp /-- The second derivative along a smooth spatial curve is the actual Hessian plus the scalar differential on its coordinate acceleration, Proposition 6.33 and Lemma 6.40, pp. 120-121, 126-127. -/ theorem openSubset_secondDeriv_comp {g : RiemannianMetric n U} (D : LeviCivitaData g) (f : U โ†’ โ„) (O : Set U) (hO : IsOpen O) (hf : ContMDiffOn (๐“ก n) (๐“˜(โ„, โ„)) โˆž f O) (y : โ„ โ†’ U) {s : โ„} (hy : ContMDiffAt (๐“˜(โ„, โ„)) (๐“ก n) โˆž y s) (hp : y s โˆˆ O) : deriv (deriv (fun r => f (y r))) s = D.hessian f (y s) (deriv (fun r => (y r).val) s) (deriv (fun r => (y r).val) s) + mvfderiv (๐“ก n) f (y s) (deriv (deriv (fun r => (y r).val)) s + (show EuclideanSpace โ„ (Fin n) from D.connection (fun _ : U => deriv (fun r => (y r).val) s) (y s) (deriv (fun r => (y r).val) s))) := by let p := y s let e := chartAt (EuclideanSpace โ„ (Fin n)) p let q : โ„ โ†’ EuclideanSpace โ„ (Fin n) := fun r => (y r).val let ฯ† : EuclideanSpace โ„ (Fin n) โ†’ โ„ := fun z => f (e.symm z) have hฯ† : ContDiffAt โ„ โˆž ฯ† p.val := by have he : ContMDiffAt (๐“ก n) (๐“ก n) โˆž e.symm p.val := contMDiffOn_chart_symm.contMDiffAt (e.open_target.mem_nhds (by rw [U.chartAt_target_eq] exact p.property)) have hp' : e.symm p.val โˆˆ O := by rw [U.chartAt_symm_apply_val] exact hp exact ((hf.contMDiffAt (hO.mem_nhds hp')).comp p.val he).contDiffAt have hq : ContDiffAt โ„ โˆž q s := (contMDiff_subtype_val.contMDiffAt.comp s hy).contDiffAt have heq : f =แถ [๐“ p] (fun z => ฯ† (e z)) := Eventually.of_forall (fun z => by dsimp only [ฯ†, e] rw [U.chartAt_apply_eq_val, U.chartAt_symm_apply_val]) have hfirst (v : EuclideanSpace โ„ (Fin n)) : mvfderiv (๐“ก n) f p v = fderiv โ„ ฯ† p.val v := Proofs.M09.mvfderiv_centeredChart_of_eventuallyEq p f ฯ† (hฯ†.differentiableAt (by simp)) heq v have hH := Proofs.M09.hessian_centeredCoordinates_local D f p O hO hp hf (deriv q s) (deriv q s) have hconst : Proofs.M09.chartVectorField p (deriv q s) = fun _ : U => deriv q s := funext (fun z => openSubset_chartVectorField U p z _) have hDฯ† := ((hฯ†.fderiv_right (m := โˆž) (by simp)).differentiableAt (by simp)).hasFDerivAt have heval : fderiv โ„ (fun z => fderiv โ„ ฯ† z (deriv q s)) p.val (deriv q s) = fderiv โ„ (fderiv โ„ ฯ†) p.val (deriv q s) (deriv q s) := by simpa using congrArg (fun L => L (deriv q s)) (hDฯ†.clm_apply (hasFDerivAt_const (deriv q s) p.val)).fderiv change D.hessian f p (deriv q s) (deriv q s) = fderiv โ„ (fun z => fderiv โ„ ฯ† z (deriv q s)) p.val (deriv q s) - fderiv โ„ ฯ† p.val (D.connection (Proofs.M09.chartVectorField p (deriv q s)) p (deriv q s)) at hH rw [heval, hconst] at hH have hcomp : (fun r => f (y r)) = fun r => ฯ† (q r) := funext (fun r => by dsimp only [ฯ†, q, e] rw [U.chartAt_symm_apply_val]) rw [hcomp, Proofs.M09.secondDeriv_comp ฯ† q s hฯ† hq] change _ = D.hessian f p (deriv q s) (deriv q s) + mvfderiv (๐“ก n) f p (deriv (deriv q) s + (show EuclideanSpace โ„ (Fin n) from D.connection (fun _ : U => deriv q s) p (deriv q s))) rw [hH, hfirst, map_add] ring end PoincareMT.M14