import Mathlib.Geometry.Manifold.ContMDiffMFDeriv import Mathlib.Geometry.Manifold.Instances.Real import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ContDiff import Mathlib.Analysis.InnerProductSpace.PiL2 /-! # Openness at a nonsingular smooth point For a map between Euclidean manifolds without boundary, an invertible derivative and local smoothness imply equality of the image and target neighborhood filters. The proof applies the Euclidean inverse function theorem in the preferred charts. -/ set_option autoImplicit false open Set Filter open scoped Manifold ContDiff Topology namespace Poincare variable {n : โ„•} {M N : Type*} [TopologicalSpace M] [TopologicalSpace N] [ChartedSpace (EuclideanSpace โ„ (Fin n)) M] [ChartedSpace (EuclideanSpace โ„ (Fin n)) N] [IsManifold (๐“ก n) โˆž M] [IsManifold (๐“ก n) โˆž N] set_option backward.isDefEq.respectTransparency false in theorem map_nhds_eq_of_contMDiffAt_mfderiv_bijective {f : M โ†’ N} {x : M} (hf : ContMDiffAt (๐“ก n) (๐“ก n) โˆž f x) (hbij : Function.Bijective (mfderiv (๐“ก n) (๐“ก n) f x)) : map f (๐“ x) = ๐“ (f x) := by let c := extChartAt (๐“ก n) x let d := extChartAt (๐“ก n) (f x) let F := writtenInExtChartAt (๐“ก n) (๐“ก n) x f have hF : ContDiffAt โ„ 1 F (c x) := by simpa [F, c, writtenInExtChartAt, contDiffWithinAt_univ] using (contMDiffAt_iff.mp (hf.of_le (by simp : (1 : โ„•โˆžฯ‰) โ‰ค โˆž))).2 have hderiv : mfderiv (๐“ก n) (๐“ก n) f x = fderiv โ„ F (c x) := by rw [mfderiv, if_pos (hf.mdifferentiableAt (by simp))] simp [F, c] have hFbij : Function.Bijective (fderiv โ„ F (c x)) := by rwa [hderiv] at hbij let e := ContinuousLinearEquiv.ofBijective (fderiv โ„ F (c x)) (LinearMap.ker_eq_bot.mpr hFbij.1) (LinearMap.range_eq_top.mpr hFbij.2) have hstrict : HasStrictFDerivAt F (e : EuclideanSpace โ„ (Fin n) โ†’L[โ„] EuclideanSpace โ„ (Fin n)) (c x) := hF.hasStrictFDerivAt' (hF.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 := ๐“ก n) x have hdmap : map d.symm (๐“ (d (f x))) = ๐“ (f x) := by simpa [d] using map_extChartAt_symm_nhdsWithin_range (I := ๐“ก n) (f x) have hfc : Tendsto (f โˆ˜ c.symm) (๐“ (c x)) (๐“ (f x)) := hf.continuousAt.tendsto.comp hcmap.le have heq : d.symm โˆ˜ F =แถ [๐“ (c x)] f โˆ˜ c.symm := by filter_upwards [hfc.eventually ((isOpen_extChartAt_source (I := ๐“ก n) (f x)).mem_nhds (mem_extChartAt_source (I := ๐“ก n) (f x)))] with y hy exact d.left_inv hy have hFx : F (c x) = d (f x) := by simp [F, c, d, writtenInExtChartAt] calc map f (๐“ x) = map (f โˆ˜ c.symm) (๐“ (c x)) := by rw [โ† map_map, hcmap] _ = map (d.symm โˆ˜ F) (๐“ (c x)) := map_congr heq.symm _ = map d.symm (map F (๐“ (c x))) := (map_map ..).symm _ = map d.symm (๐“ (F (c x))) := by rw [hstrict.map_nhds_eq_of_equiv] _ = ๐“ (f x) := by rw [hFx, hdmap] end Poincare