import PoincareLib.Geometry.RicciFlow.Coordinates.Coefficients import PoincareLib.Geometry.RicciFlow.Soliton.Flow.SelfSimilar.Variation /-! # Evolving metrics pulled back by a time-dependent negative gradient The derivative of the actual pullback combines the Ricci-flow metric derivative with the negative gradient Lie derivative, giving minus twice Ricci curvature minus twice the Hessian. -/ set_option autoImplicit false set_option backward.isDefEq.respectTransparency false set_option maxSynthPendingDepth 8 set_option maxHeartbeats 1000000 open Set Filter VectorField open scoped Manifold ContDiff Bundle Topology namespace PoincareMT.RicciFlow variable {n : โ„•} {M : Type*} [TopologicalSpace M] [ChartedSpace (EuclideanSpace โ„ (Fin n)) M] [IsManifold (๐“ก n) โˆž M] private theorem chartCoefficients_apply_chartDifferential (g : RiemannianMetric n M) (a : M) {y : M} (hy : y โˆˆ (extChartAt (๐“ก n) a).source) (v w : TangentSpace (๐“ก n) y) : g.pullbackCoefficients (extChartAt (๐“ก n) a).symm (extChartAt (๐“ก n) a y) (mfderiv (๐“ก n) (๐“ก n) (extChartAt (๐“ก n) a) y v) (mfderiv (๐“ก n) (๐“ก n) (extChartAt (๐“ก n) a) y w) = g.inner y v w := by have hid := mfderivWithin_extChartAt_symm_comp_mfderiv_extChartAt' (I := ๐“ก n) hy simp only [ModelWithCorners.range_eq_univ, mfderivWithin_univ] at hid have hidv := congrArg (fun L => L v) hid have hidw := congrArg (fun L => L w) hid simp only [ContinuousLinearMap.comp_apply] at hidv hidw change g.inner ((extChartAt (๐“ก n) a).symm (extChartAt (๐“ก n) a y)) (mfderiv (๐“ก n) (๐“ก n) (extChartAt (๐“ก n) a).symm (extChartAt (๐“ก n) a y) (mfderiv (๐“ก n) (๐“ก n) (extChartAt (๐“ก n) a) y v)) (mfderiv (๐“ก n) (๐“ก n) (extChartAt (๐“ก n) a).symm (extChartAt (๐“ก n) a y) (mfderiv (๐“ก n) (๐“ก n) (extChartAt (๐“ก n) a) y w)) = _ rw [hidv, hidw] exact congrArg (fun z => g.inner z v w) ((extChartAt (๐“ก n) a).left_inv hy) private theorem metric_pullback_in_charts (g : RiemannianMetric n M) {ฮจ : M โ†’ M} {x : M} (hฮจ : ContMDiffAt (๐“ก n) (๐“ก n) โˆž ฮจ x) (a : M) (ha : ฮจ x โˆˆ (extChartAt (๐“ก n) a).source) (v w : TangentSpace (๐“ก n) x) : let c := extChartAt (๐“ก n) a let d := extChartAt (๐“ก n) x g.pullbackCoefficients c.symm (c (ฮจ x)) (fderiv โ„ (c โˆ˜ ฮจ โˆ˜ d.symm) (d x) v) (fderiv โ„ (c โˆ˜ ฮจ โˆ˜ d.symm) (d x) w) = g.inner (ฮจ x) (mfderiv (๐“ก n) (๐“ก n) ฮจ x v) (mfderiv (๐“ก n) (๐“ก n) ฮจ x w) := by let c := extChartAt (๐“ก n) a let d := extChartAt (๐“ก n) x have hc : MDifferentiableAt (๐“ก n) (๐“ก n) c (ฮจ x) := mdifferentiableAt_extChartAt (by simpa only [extChartAt_source] using ha) have hd : MDifferentiableAt (๐“ก n) (๐“ก n) d.symm (d x) := ((contMDiffWithinAt_extChartAt_symm_target (I := ๐“ก n) (n := โˆž) x (mem_extChartAt_target x)).contMDiffAt (extChartAt_target_mem_nhds x)).mdifferentiableAt (by simp) have hdid : mfderiv (๐“ก n) (๐“ก n) d.symm (d x) = ContinuousLinearMap.id โ„ _ := by simpa only [ModelWithCorners.range_eq_univ, mfderivWithin_univ] using (mfderivWithin_range_extChartAt_symm (I := ๐“ก n) (x := x)) have hฮจd : MDifferentiableAt (๐“ก n) (๐“ก n) ฮจ (d.symm (d x)) := by simpa only [d, extChartAt_to_inv] using hฮจ.mdifferentiableAt (by simp) have hcd : MDifferentiableAt (๐“ก n) (๐“ก n) c (ฮจ (d.symm (d x))) := by simpa only [d, extChartAt_to_inv] using hc have hderiv := mfderiv_comp (d x) hcd (hฮจd.comp (d x) hd) rw [mfderiv_comp (d x) hฮจd hd, hdid, ContinuousLinearMap.comp_id] at hderiv rw [mfderiv_eq_fderiv] at hderiv change fderiv โ„ (c โˆ˜ ฮจ โˆ˜ d.symm) (d x) = (mfderiv (๐“ก n) (๐“ก n) c (ฮจ (d.symm (d x)))).comp (mfderiv (๐“ก n) (๐“ก n) ฮจ (d.symm (d x))) at hderiv rw [show d.symm (d x) = x from extChartAt_to_inv x] at hderiv dsimp only rw [hderiv] exact chartCoefficients_apply_chartDifferential g a ha _ _ variable {J : Set โ„} (F : RicciFlow n M J) /-- Pulling the actual evolving metric back by a supplied negative-gradient family differentiates to minus twice its pulled-back Ricci tensor and Hessian. -/ theorem hasDerivAt_negativeGradient_pullback_metric (hJ : IsOpen J) {f : โ„ ร— M โ†’ โ„} {ฮฆ : โ„ โ†’ M โ†’ M} (hf : ContMDiffOn (๐“˜(โ„, โ„).prod (๐“ก n)) ๐“˜(โ„, โ„) โˆž f (J ร—หข univ)) (hs : ContMDiffOn (๐“˜(โ„, โ„).prod (๐“ก n)) (๐“ก n) โˆž (fun z : โ„ ร— M => ฮฆ z.1 z.2) (J ร—หข univ)) (hฮฆ : โˆ€ s โˆˆ J, โˆ€ y, HasMFDerivAt ๐“˜(โ„, โ„) (๐“ก n) (fun r => ฮฆ r y) s ((1 : โ„ โ†’L[โ„] โ„).smulRight (-((F.connection s).gradient (fun z => f (s, z)) (ฮฆ s y))))) {t : โ„} (ht : t โˆˆ J) (x : M) (v w : TangentSpace (๐“ก n) x) : HasDerivAt (fun s => (F.metric s).inner (ฮฆ s x) (mfderiv (๐“ก n) (๐“ก n) (ฮฆ s) x v) (mfderiv (๐“ก n) (๐“ก n) (ฮฆ s) x w)) (-2 * (F.connection t).ricci (ฮฆ t x) (mfderiv (๐“ก n) (๐“ก n) (ฮฆ t) x v) (mfderiv (๐“ก n) (๐“ก n) (ฮฆ t) x w) - 2 * (F.connection t).hessian (fun y => f (t, y)) (ฮฆ t x) (mfderiv (๐“ก n) (๐“ก n) (ฮฆ t) x v) (mfderiv (๐“ก n) (๐“ก n) (ฮฆ t) x w)) t := by let c := extChartAt (๐“ก n) (ฮฆ t x) let d := extChartAt (๐“ก n) x let q : โ„ ร— EuclideanSpace โ„ (Fin n) โ†’ EuclideanSpace โ„ (Fin n) := fun z => c (ฮฆ z.1 (d.symm z.2)) let G : EuclideanSpace โ„ (Fin n) โ†’ EuclideanSpace โ„ (Fin n) := mpullback (๐“ก n) (๐“ก n) c.symm ((F.connection t).gradient (fun y => f (t, y))) let B : โ„ ร— EuclideanSpace โ„ (Fin n) โ†’ EuclideanSpace โ„ (Fin n) โ†’L[โ„] EuclideanSpace โ„ (Fin n) โ†’L[โ„] โ„ := fun z => (F.metric z.1).pullbackCoefficients c.symm z.2 have hsAt {s : โ„} (hsJ : s โˆˆ J) (y : M) : ContMDiffAt (๐“˜(โ„, โ„).prod (๐“ก n)) (๐“ก n) โˆž (fun z : โ„ ร— M => ฮฆ z.1 z.2) (s, y) := hs.contMDiffAt ((hJ.prod isOpen_univ).mem_nhds โŸจhsJ, mem_univ yโŸฉ) have hF {s : โ„} (hsJ : s โˆˆ J) : ContMDiff (๐“ก n) (๐“ก n) โˆž (ฮฆ s) := fun y => (hsAt hsJ y).comp y (contMDiffAt_const.prodMk contMDiffAt_id) have hft : ContMDiff (๐“ก n) ๐“˜(โ„, โ„) โˆž (fun y => f (t, y)) := fun y => (hf.contMDiffAt ((hJ.prod isOpen_univ).mem_nhds โŸจht, mem_univ yโŸฉ)).comp y (contMDiffAt_const.prodMk contMDiffAt_id) have hdx : d.symm (d x) = x := extChartAt_to_inv x have hqt : q (t, d x) = c (ฮฆ t x) := by simp only [q, hdx] have hct : q (t, d x) โˆˆ c.target := by rw [hqt]; exact mem_extChartAt_target _ have hd : ContMDiffAt (๐“ก n) (๐“ก n) โˆž d.symm (d x) := (contMDiffWithinAt_extChartAt_symm_target (I := ๐“ก n) (n := โˆž) x (mem_extChartAt_target x)).contMDiffAt (extChartAt_target_mem_nhds x) have hfamily : ContMDiffAt ๐“˜(โ„, โ„ ร— EuclideanSpace โ„ (Fin n)) (๐“ก n) โˆž (fun z : โ„ ร— EuclideanSpace โ„ (Fin n) => ฮฆ z.1 (d.symm z.2)) (t, d x) := by have hp : ContMDiffAt ๐“˜(โ„, โ„ ร— EuclideanSpace โ„ (Fin n)) (๐“˜(โ„, โ„).prod (๐“ก n)) โˆž (fun z : โ„ ร— EuclideanSpace โ„ (Fin n) => (z.1, d.symm z.2)) (t, d x) := (contMDiffAt_iff_contDiffAt.mpr contDiffAt_fst).prodMk (hd.comp (t, d x) (contMDiffAt_iff_contDiffAt.mpr contDiffAt_snd)) exact (hsAt ht _).comp (t, d x) hp have hc : ContMDiffAt (๐“ก n) (๐“ก n) โˆž c (ฮฆ t (d.symm (d x))) := by rw [hdx] exact contMDiffAt_extChartAt' (mem_chart_source _ _) have hq : ContDiffAt โ„ โˆž q (t, d x) := contMDiffAt_iff_contDiffAt.mp (hc.comp (t, d x) hfamily) have hG : DifferentiableAt โ„ G (q (t, d x)) := (RiemannianMetric.contDiffAt_mpullback_gradient hft (ฮฆ t x) hct).differentiableAt (by simp) have hB : DifferentiableAt โ„ B (t, q (t, d x)) := ((F.contDiffOn_pullbackCoefficients hJ (isOpen_extChartAt_target (ฮฆ t x)) (contMDiffOn_extChartAt_symm (I := ๐“ก n) (ฮฆ t x))).contDiffAt ((hJ.prod (isOpen_extChartAt_target (ฮฆ t x))).mem_nhds โŸจht, hctโŸฉ)).differentiableAt (by simp) have hout : โˆ€แถ  y in ๐“ (d x), ฮฆ t (d.symm y) โˆˆ c.source := ((hF ht _).comp (d x) hd).continuousAt.preimage_mem_nhds ((isOpen_extChartAt_source (I := ๐“ก n) (ฮฆ t x)).mem_nhds (by simpa only [Function.comp_apply, hdx] using mem_extChartAt_source (I := ๐“ก n) (ฮฆ t x))) have htime : โˆ€แถ  y in ๐“ (d x), HasDerivAt (fun s => q (s, y)) (-G (q (t, y))) t := by filter_upwards [hout] with y hy have hc' := ((contMDiffAt_extChartAt' (I := ๐“ก n) (n := โˆž) (by simpa only [c, extChartAt_source] using hy)).mdifferentiableAt (by simp)).hasMFDerivAt have hh := hc'.comp t (hฮฆ t ht (d.symm y)) have hgrad := RiemannianMetric.mpullback_gradient_eq_chart_gradient (D := F.connection t) (f := fun z => f (t, z)) (ฮฆ t x) (c.map_source hy) change G (c (ฮฆ t (d.symm y))) = mfderiv (๐“ก n) (๐“ก n) c (c.symm (c (ฮฆ t (d.symm y)))) ((F.connection t).gradient (fun z => f (t, z)) (c.symm (c (ฮฆ t (d.symm y))))) at hgrad rw [c.left_inv hy] at hgrad change HasDerivAt (fun s => c (ฮฆ s (d.symm y))) (-G (c (ฮฆ t (d.symm y)))) t rw [hgrad, hasDerivAt_iff_hasFDerivAt, โ† hasMFDerivAt_iff_hasFDerivAt] apply hh.congr_mfderiv ext change (mfderiv (๐“ก n) (๐“ก n) c (ฮฆ t (d.symm y))) ((1 : โ„) โ€ข -((F.connection t).gradient (fun z => f (t, z)) (ฮฆ t (d.symm y)))) = (1 : โ„) โ€ข -((mfderiv (๐“ก n) (๐“ก n) c (ฮฆ t (d.symm y))) ((F.connection t).gradient (fun z => f (t, z)) (ฮฆ t (d.symm y)))) simp only [one_smul, map_neg] have hqx : DifferentiableAt โ„ (fun y => q (t, y)) (d x) := (hq.differentiableAt (by simp)).comp (d x) ((differentiableAt_const t).prodMk differentiableAt_id) have hcomp : fderiv โ„ (fun y => -G (q (t, y))) (d x) = -((fderiv โ„ G (q (t, d x))).comp (fderiv โ„ (fun y => q (t, y)) (d x))) := by rw [fderiv_fun_neg] congr 1 simpa only [Function.comp_def] using (hG.hasFDerivAt.comp (d x) hqx.hasFDerivAt).fderiv have hv := CoordinateExponential.hasDerivAt_variation hq htime v have hw := CoordinateExponential.hasDerivAt_variation hq htime w rw [hcomp] at hv hw have hBq := hB.hasFDerivAt.comp_hasDerivAt t ((hasDerivAt_id t).prodMk htime.self_of_nhds) have hm := (hBq.clm_apply hv).clm_apply hw have hspace := (hB.hasFDerivAt.comp (q (t, d x)) ((hasFDerivAt_const (c := t) _).prodMk (hasFDerivAt_id _))).fderiv have hmetric := RiemannianMetric.coordinate_gradient_metric_derivative (D := F.connection t) hft (ฮฆ t x) hct (fderiv โ„ (fun y => q (t, y)) (d x) v) (fderiv โ„ (fun y => q (t, y)) (d x) w) have hpoint : c.symm (q (t, d x)) = ฮฆ t x := by rw [hqt]; exact extChartAt_to_inv _ have hderiv : (mfderiv (๐“ก n) (๐“ก n) c.symm (q (t, d x))).comp (fderiv โ„ (fun y => q (t, y)) (d x)) = mfderiv (๐“ก n) (๐“ก n) (ฮฆ t) x := by have hcancel : c.symm โˆ˜ (fun y => q (t, y)) =แถ [๐“ (d x)] ฮฆ t โˆ˜ d.symm := by filter_upwards [hout] with y hy exact c.left_inv hy have hcs := (contMDiffWithinAt_extChartAt_symm_target (I := ๐“ก n) (n := โˆž) (ฮฆ t x) hct).contMDiffAt (extChartAt_target_mem_nhds' hct) have heq := hcancel.mfderiv_eq (I := ๐“ก n) (I' := ๐“ก n) rw [mfderiv_comp (d x) (hcs.mdifferentiableAt (by simp)) hqx.mdifferentiableAt, mfderiv_eq_fderiv] at heq rw [mfderiv_comp (d x) ((hF ht).mdifferentiable (by simp) _) (hd.mdifferentiableAt (by simp))] at heq have hdi : mfderiv (๐“ก n) (๐“ก n) d.symm (d x) = ContinuousLinearMap.id โ„ _ := by simpa only [ModelWithCorners.range_eq_univ, mfderivWithin_univ] using (mfderivWithin_range_extChartAt_symm (I := ๐“ก n) (x := x)) rw [hdi, ContinuousLinearMap.comp_id] at heq change (mfderiv (๐“ก n) (๐“ก n) c.symm (q (t, d x)) : EuclideanSpace โ„ (Fin n) โ†’L[โ„] EuclideanSpace โ„ (Fin n)).comp (fderiv โ„ (fun y => q (t, y)) (d x)) = (mfderiv (๐“ก n) (๐“ก n) (ฮฆ t) (d.symm (d x)) : EuclideanSpace โ„ (Fin n) โ†’L[โ„] EuclideanSpace โ„ (Fin n)) at heq rw [hdx] at heq exact heq have hderivv := congrArg (fun L => L v) hderiv have hderivw := congrArg (fun L => L w) hderiv simp only [ContinuousLinearMap.comp_apply] at hderivv hderivw have hBt := hB.hasFDerivAt.comp_hasDerivAt t ((hasDerivAt_id t).prodMk (hasDerivAt_const t (q (t, d x)))) have hBtvw := (hBt.clm_apply (hasDerivAt_const t (fderiv โ„ (fun y => q (t, y)) (d x) v))).clm_apply (hasDerivAt_const t (fderiv โ„ (fun y => q (t, y)) (d x) w)) have hRic := ((F.equation t ht (c.symm (q (t, d x))) (mfderiv (๐“ก n) (๐“ก n) c.symm (q (t, d x)) (fderiv โ„ (fun y => q (t, y)) (d x) v)) (mfderiv (๐“ก n) (๐“ก n) c.symm (q (t, d x)) (fderiv โ„ (fun y => q (t, y)) (d x) w))).hasDerivAt (hJ.mem_nhds ht)).unique hBtvw simp only [map_zero, add_zero] at hRic erw [hpoint, hderivv, hderivw] at hRic let H : M โ†’ EuclideanSpace โ„ (Fin n) โ†’ EuclideanSpace โ„ (Fin n) โ†’ โ„ := (F.connection t).hessian (fun y => f (t, y)) change fderiv โ„ (fun y => B (t, y)) (q (t, d x)) (G (q (t, d x))) (fderiv โ„ (fun y => q (t, y)) (d x) v) (fderiv โ„ (fun y => q (t, y)) (d x) w) + B (t, q (t, d x)) (fderiv โ„ G (q (t, d x)) (fderiv โ„ (fun y => q (t, y)) (d x) v)) (fderiv โ„ (fun y => q (t, y)) (d x) w) + B (t, q (t, d x)) (fderiv โ„ (fun y => q (t, y)) (d x) v) (fderiv โ„ G (q (t, d x)) (fderiv โ„ (fun y => q (t, y)) (d x) w)) = 2 * H (c.symm (q (t, d x))) (mfderiv (๐“ก n) (๐“ก n) c.symm (q (t, d x)) (fderiv โ„ (fun y => q (t, y)) (d x) v)) (mfderiv (๐“ก n) (๐“ก n) c.symm (q (t, d x)) (fderiv โ„ (fun y => q (t, y)) (d x) w)) at hmetric erw [hpoint, hderivv, hderivw] at hmetric have hspace' := congrArg (fun L => L (G (q (t, d x)))) hspace simp only [ContinuousLinearMap.comp_apply, ContinuousLinearMap.prod_apply, zero_apply, ContinuousLinearMap.id_apply] at hspace' have hsplit : ((1 : โ„), -G (q (t, d x))) = (1, (0 : EuclideanSpace โ„ (Fin n))) - (0, G (q (t, d x))) := by simp have hm' := hm.congr_deriv (show _ = -2 * (F.connection t).ricci (ฮฆ t x) (mfderiv (๐“ก n) (๐“ก n) (ฮฆ t) x v) (mfderiv (๐“ก n) (๐“ก n) (ฮฆ t) x w) - 2 * (F.connection t).hessian (fun y => f (t, y)) (ฮฆ t x) (mfderiv (๐“ก n) (๐“ก n) (ฮฆ t) x v) (mfderiv (๐“ก n) (๐“ก n) (ฮฆ t) x w) from by simp only [ContinuousLinearMap.comp_apply, neg_apply, map_neg, add_apply] erw [hsplit, map_sub] simp only [sub_apply] erw [โ† hspace'] dsimp only [H, Function.comp_def, id_eq] at hmetric โŠข linear_combination -hRic - hmetric) apply hm'.congr_of_eventuallyEq have htx : ContinuousAt (fun s => ฮฆ s x) t := by have hi : ContinuousAt (fun s : โ„ => (s, x)) t := continuousAt_id.prodMk continuousAt_const have h := Filter.Tendsto.comp (hsAt ht x).continuousAt hi exact h filter_upwards [hJ.mem_nhds ht, htx.preimage_mem_nhds ((isOpen_extChartAt_source (I := ๐“ก n) (ฮฆ t x)).mem_nhds (mem_extChartAt_source _))] with s hsJ hsx simpa +instances only [q, B, c, d, Function.comp_def, extChartAt_to_inv, id_eq] using (metric_pullback_in_charts (F.metric s) (hF hsJ x) (ฮฆ t x) hsx v w).symm end PoincareMT.RicciFlow