import PoincareLib.Geometry.Manifold.InverseFunction.SmoothInverse import Mathlib.Geometry.Manifold.Diffeomorph /-! # Smooth inverses between different Euclidean model spaces The chart proof of the inverse function theorem applies to distinct model spaces. This includes the product model for a height and a sphere direction. -/ noncomputable section set_option autoImplicit false set_option backward.isDefEq.respectTransparency false open Set Filter open scoped Manifold ContDiff Topology namespace Poincare.Geometry.Manifold variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace โ„ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace โ„ F] [CompleteSpace F] {M N : Type*} [TopologicalSpace M] [TopologicalSpace N] [ChartedSpace E M] [ChartedSpace F N] /-- An invertible differential gives equality of neighborhood filters, for boundaryless manifolds modeled on possibly distinct Banach spaces. -/ theorem map_nhds_eq_of_contMDiffAt_bijective_mfderiv_modelSpaces {f : M โ†’ N} {x : M} (hf : ContMDiffAt ๐“˜(โ„, E) ๐“˜(โ„, F) โˆž f x) (hbij : Function.Bijective (mfderiv ๐“˜(โ„, E) ๐“˜(โ„, F) f x)) : map f (๐“ x) = ๐“ (f x) := by let c := extChartAt ๐“˜(โ„, E) x let d := extChartAt ๐“˜(โ„, F) (f x) let A := writtenInExtChartAt ๐“˜(โ„, E) ๐“˜(โ„, F) x f have hA : ContDiffAt โ„ 1 A (c x) := by simpa [A, c, writtenInExtChartAt, contDiffWithinAt_univ] using (contMDiffAt_iff.mp (hf.of_le (by simp : (1 : โ„•โˆžฯ‰) โ‰ค โˆž))).2 have hderiv : mfderiv ๐“˜(โ„, E) ๐“˜(โ„, F) f x = fderiv โ„ A (c x) := by rw [mfderiv, if_pos (hf.mdifferentiableAt (by simp))] simp [A, c] have hAbij : Function.Bijective (fderiv โ„ A (c x)) := by rwa [hderiv] at hbij let L := ContinuousLinearEquiv.ofBijective (fderiv โ„ A (c x)) (LinearMap.ker_eq_bot.mpr hAbij.1) (LinearMap.range_eq_top.mpr hAbij.2) have hstrict : HasStrictFDerivAt A (L : E โ†’L[โ„] F) (c x) := hA.hasStrictFDerivAt' (hA.differentiableAt (by norm_num)).hasFDerivAt (by norm_num) have hcmap : map c.symm (๐“ (c x)) = ๐“ x := by simpa [c] using map_extChartAt_symm_nhdsWithin_range (I := ๐“˜(โ„, E)) x have hdmap : map d.symm (๐“ (d (f x))) = ๐“ (f x) := by simpa [d] using map_extChartAt_symm_nhdsWithin_range (I := ๐“˜(โ„, F)) (f x) have hfc : Tendsto (f โˆ˜ c.symm) (๐“ (c x)) (๐“ (f x)) := hf.continuousAt.tendsto.comp hcmap.le have heq : d.symm โˆ˜ A =แถ [๐“ (c x)] f โˆ˜ c.symm := by filter_upwards [hfc.eventually ((isOpen_extChartAt_source (I := ๐“˜(โ„, F)) (f x)).mem_nhds (mem_extChartAt_source (I := ๐“˜(โ„, F)) (f x)))] with y hy exact d.left_inv hy have hAx : A (c x) = d (f x) := by simp [A, c, d, writtenInExtChartAt] calc map f (๐“ x) = map (f โˆ˜ c.symm) (๐“ (c x)) := by rw [โ† map_map, hcmap] _ = map (d.symm โˆ˜ A) (๐“ (c x)) := map_congr heq.symm _ = map d.symm (map A (๐“ (c x))) := (map_map ..).symm _ = map d.symm (๐“ (A (c x))) := by rw [hstrict.map_nhds_eq_of_equiv] _ = ๐“ (f x) := by rw [hAx, hdmap] variable [IsManifold ๐“˜(โ„, E) โˆž M] /-- A local left inverse is smooth at a point with bijective differential, even when the source and target use distinct identity model spaces. -/ theorem contMDiffAt_of_local_left_inverse_modelSpaces {f : M โ†’ N} {g : N โ†’ M} {x : M} (hf : ContMDiffAt ๐“˜(โ„, E) ๐“˜(โ„, F) โˆž f x) (hbij : Function.Bijective (mfderiv ๐“˜(โ„, E) ๐“˜(โ„, F) f x)) (hleft : โˆ€แถ  z in ๐“ x, g (f z) = z) : ContMDiffAt ๐“˜(โ„, F) ๐“˜(โ„, E) โˆž g (f x) := by let c := extChartAt ๐“˜(โ„, E) x let d := extChartAt ๐“˜(โ„, F) (f x) let A := writtenInExtChartAt ๐“˜(โ„, E) ๐“˜(โ„, F) x f have hA : ContDiffAt โ„ โˆž A (c x) := by simpa [A, c, writtenInExtChartAt, contDiffWithinAt_univ] using (contMDiffAt_iff.mp hf).2 have hderiv : mfderiv ๐“˜(โ„, E) ๐“˜(โ„, F) f x = fderiv โ„ A (c x) := by rw [mfderiv, if_pos (hf.mdifferentiableAt (by simp))] simp [A, c] have hAbij : Function.Bijective (fderiv โ„ A (c x)) := by rwa [hderiv] at hbij let L := ContinuousLinearEquiv.ofBijective (fderiv โ„ A (c x)) (LinearMap.ker_eq_bot.mpr hAbij.1) (LinearMap.range_eq_top.mpr hAbij.2) have hdA : HasFDerivAt A (L : E โ†’L[โ„] F) (c x) := (hA.differentiableAt (by simp)).hasFDerivAt let i := hA.localInverse hdA (by simp) have hi : ContDiffAt โ„ โˆž i (A (c x)) := hA.to_localInverse hdA (by simp) have hix : i (A (c x)) = c x := hA.localInverse_apply_image hdA (by simp) have hAx : A (c x) = d (f x) := by simp [A, c, d, writtenInExtChartAt] have hil : โˆ€แถ  z in ๐“ (c x), i (A z) = z := (hA.hasStrictFDerivAt' hdA (by simp)).eventually_left_inverse have hc : ContinuousAt c x := continuousAt_extChartAt x have heq : g =แถ [๐“ (f x)] fun y => c.symm (i (d y)) := by rw [โ† map_nhds_eq_of_contMDiffAt_bijective_mfderiv_modelSpaces hf hbij] change โˆ€แถ  z in ๐“ x, g (f z) = c.symm (i (d (f z))) filter_upwards [hleft, hc.tendsto.eventually hil, (isOpen_extChartAt_source (I := ๐“˜(โ„, E)) x).mem_nhds (mem_extChartAt_source x)] with z hz hzi hzc have hAz : A (c z) = d (f z) := by simp only [A, writtenInExtChartAt, Function.comp_apply] rw [c.left_inv hzc] rw [hz, โ† hAz, hzi, c.left_inv hzc] have hd : ContMDiffAt ๐“˜(โ„, F) ๐“˜(โ„, F) โˆž d (f x) := contMDiffAt_extChartAt have hi' : ContMDiffAt ๐“˜(โ„, F) ๐“˜(โ„, E) โˆž i (d (f x)) := by rw [โ† hAx] exact hi.contMDiffAt have hcs : ContMDiffAt ๐“˜(โ„, E) ๐“˜(โ„, E) โˆž c.symm (i (d (f x))) := by rw [โ† hAx, hix] exact (contMDiffOn_extChartAt_symm x).contMDiffAt ((isOpen_extChartAt_target (I := ๐“˜(โ„, E)) x).mem_nhds (mem_extChartAt_target x)) exact (hcs.comp (f x) (hi'.comp (f x) hd)).congr_of_eventuallyEq heq end Poincare.Geometry.Manifold