import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Uniqueness.Imports import Mathlib.Geometry.Manifold.Diffeomorph /-! # Total manifold derivatives through a diffeomorphism The coordinate transfer in Morgan-Tian Theorem 12.28, pp. 323-324, uses total maps outside their neck domains. Postcomposition by a diffeomorphism preserves nondifferentiability, so the totalized chain rule also holds at those points without changing either map. -/ set_option autoImplicit false open scoped Manifold ContDiff namespace Diffeomorph variable {๐•œ : Type*} [NontriviallyNormedField ๐•œ] {Eโ‚ : Type*} [NormedAddCommGroup Eโ‚] [NormedSpace ๐•œ Eโ‚] {Eโ‚‚ : Type*} [NormedAddCommGroup Eโ‚‚] [NormedSpace ๐•œ Eโ‚‚] {Eโ‚ƒ : Type*} [NormedAddCommGroup Eโ‚ƒ] [NormedSpace ๐•œ Eโ‚ƒ] {Hโ‚ : Type*} [TopologicalSpace Hโ‚] {Hโ‚‚ : Type*} [TopologicalSpace Hโ‚‚] {Hโ‚ƒ : Type*} [TopologicalSpace Hโ‚ƒ] {Iโ‚ : ModelWithCorners ๐•œ Eโ‚ Hโ‚} {Iโ‚‚ : ModelWithCorners ๐•œ Eโ‚‚ Hโ‚‚} {Iโ‚ƒ : ModelWithCorners ๐•œ Eโ‚ƒ Hโ‚ƒ} {Mโ‚ : Type*} [TopologicalSpace Mโ‚] [ChartedSpace Hโ‚ Mโ‚] {Mโ‚‚ : Type*} [TopologicalSpace Mโ‚‚] [ChartedSpace Hโ‚‚ Mโ‚‚] {Mโ‚ƒ : Type*} [TopologicalSpace Mโ‚ƒ] [ChartedSpace Hโ‚ƒ Mโ‚ƒ] {n : โ„•โˆžฯ‰} /-- The totalized chain rule for postcomposition by a diffeomorphism. Used for the unchanged neck coordinates in Theorem 12.28, pp. 323-324. -/ theorem mfderiv_comp (e : Diffeomorph Iโ‚‚ Iโ‚ƒ Mโ‚‚ Mโ‚ƒ n) (hn : n โ‰  0) (f : Mโ‚ โ†’ Mโ‚‚) (x : Mโ‚) : mfderiv Iโ‚ Iโ‚ƒ (e โˆ˜ f) x = (mfderiv Iโ‚‚ Iโ‚ƒ e (f x)).comp (mfderiv Iโ‚ Iโ‚‚ f x) := by by_cases hf : MDifferentiableAt Iโ‚ Iโ‚‚ f x ยท exact _root_.mfderiv_comp x (e.contMDiff.mdifferentiable hn _) hf ยท have hcomp : ยฌ MDifferentiableAt Iโ‚ Iโ‚ƒ (e โˆ˜ f) x := by intro h have hback := (e.symm.contMDiff.mdifferentiable hn _).comp x h have heq : e.symm โˆ˜ (e โˆ˜ f) = f := funext (fun y => e.symm_apply_apply (f y)) rw [heq] at hback exact hf hback rw [mfderiv_zero_of_not_mdifferentiableAt hcomp, mfderiv_zero_of_not_mdifferentiableAt hf, ContinuousLinearMap.comp_zero] /-- The derivatives of a coordinate diffeomorphism and its inverse cancel even when the subsequent total map is not differentiable. Used in the actual pullback transfer of Theorem 12.28, pp. 323-324. -/ theorem mfderiv_cancel_left (e : Diffeomorph Iโ‚‚ Iโ‚ƒ Mโ‚‚ Mโ‚ƒ n) (hn : n โ‰  0) (f : Mโ‚ โ†’ Mโ‚ƒ) (x : Mโ‚) : (mfderiv Iโ‚‚ Iโ‚ƒ e (e.symm (f x))).comp (mfderiv Iโ‚ Iโ‚‚ (e.symm โˆ˜ f) x) = mfderiv Iโ‚ Iโ‚ƒ f x := by have h := e.mfderiv_comp (Iโ‚ := Iโ‚) hn (e.symm โˆ˜ f) x have heq : e โˆ˜ (e.symm โˆ˜ f) = f := funext (fun y => e.apply_symm_apply (f y)) rw [heq] at h exact h.symm end Diffeomorph