-- Mathlib/Geometry/Manifold/ContMDiff/Basic.lean
/-- If the `ChartedSpace` structure on a manifold `M` is given by an open embedding `e : M → H`,
then the inverse of `e` is `C^n`. -/
lemma contMDiffOn_isOpenEmbedding_symm [Nonempty M] :
    haveI := h.singletonChartedSpace; ContMDiffOn I I
      n (IsOpenEmbedding.toPartialHomeomorph e h).symm (range e)

Proof state:
𝕜 : Type u_1
inst✝⁵ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace 𝕜 E
H : Type u_3
inst✝² : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝¹ : TopologicalSpace M
e : M → H
h : IsOpenEmbedding e
n : WithTop ℕ∞
inst✝ : Nonempty M
this : IsManifold I ω M
⊢ ContMDiffOn I I n (↑(IsOpenEmbedding.toPartialHomeomorph e h).symm) (range e)

Tactic:
rw [@contMDiffOn_iff]

Result:
𝕜 : Type u_1
inst✝⁵ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace 𝕜 E
H : Type u_3
inst✝² : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝¹ : TopologicalSpace M
e : M → H
h : IsOpenEmbedding e
n : WithTop ℕ∞
inst✝ : Nonempty M
this : IsManifold I ω M
⊢ ContinuousOn (↑(IsOpenEmbedding.toPartialHomeomorph e h).symm) (range e) ∧
    ∀ (x : H) (y : M),
      ContDiffOn 𝕜 n (↑(extChartAt I y) ∘ ↑(IsOpenEmbedding.toPartialHomeomorph e h).symm ∘ ↑(extChartAt I x).symm)
        ((extChartAt I x).target ∩
          ↑(extChartAt I x).symm ⁻¹'
            (range e ∩ ↑(IsOpenEmbedding.toPartialHomeomorph e h).symm ⁻¹' (extChartAt I y).source))

Proof state:
case right
𝕜 : Type u_1
inst✝⁵ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace 𝕜 E
H : Type u_3
inst✝² : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝¹ : TopologicalSpace M
e : M → H
h : IsOpenEmbedding e
n : WithTop ℕ∞
inst✝ : Nonempty M
this : IsManifold I ω M
z✝ : H
hz✝ : M
z : E
hz :
  z ∈
    (extChartAt I z✝).target ∩
      ↑(extChartAt I z✝).symm ⁻¹'
        (range e ∩ ↑(IsOpenEmbedding.toPartialHomeomorph e h).symm ⁻¹' (extChartAt I hz✝).source)
⊢ ↑I (e (↑(IsOpenEmbedding.toPartialHomeomorph e h).symm (↑I.symm z))) = z

Tactic:
have : I.symm z ∈ range e := by
  rw [ModelWithCorners.symm, ← mem_preimage]
  exact hz.2.1

Result:
case right
𝕜 : Type u_1
inst✝⁵ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace 𝕜 E
H : Type u_3
inst✝² : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝¹ : TopologicalSpace M
e : M → H
h : IsOpenEmbedding e
n : WithTop ℕ∞
inst✝ : Nonempty M
this✝ : IsManifold I ω M
z✝ : H
hz✝ : M
z : E
hz :
  z ∈
    (extChartAt I z✝).target ∩
      ↑(extChartAt I z✝).symm ⁻¹'
        (range e ∩ ↑(IsOpenEmbedding.toPartialHomeomorph e h).symm ⁻¹' (extChartAt I hz✝).source)
this : ↑I.symm z ∈ range e
⊢ ↑I (e (↑(IsOpenEmbedding.toPartialHomeomorph e h).symm (↑I.symm z))) = z

Proof state:
𝕜 : Type u_1
inst✝⁵ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace 𝕜 E
H : Type u_3
inst✝² : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝¹ : TopologicalSpace M
e : M → H
h : IsOpenEmbedding e
n : WithTop ℕ∞
inst✝ : Nonempty M
this : IsManifold I ω M
z✝ : H
hz✝ : M
z : E
hz :
  z ∈
    (extChartAt I z✝).target ∩
      ↑(extChartAt I z✝).symm ⁻¹'
        (range e ∩ ↑(IsOpenEmbedding.toPartialHomeomorph e h).symm ⁻¹' (extChartAt I hz✝).source)
⊢ z ∈ ↑I.symm ⁻¹' range e

Tactic:
exact hz.2.1

Result:
no goals

Proof state:
case left
𝕜 : Type u_1
inst✝⁵ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace 𝕜 E
H : Type u_3
inst✝² : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝¹ : TopologicalSpace M
e : M → H
h : IsOpenEmbedding e
n : WithTop ℕ∞
inst✝ : Nonempty M
this : IsManifold I ω M
⊢ ContinuousOn (↑(IsOpenEmbedding.toPartialHomeomorph e h).symm) (range e)

Tactic:
rw [← h.toPartialHomeomorph_target]

Result:
case left
𝕜 : Type u_1
inst✝⁵ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace 𝕜 E
H : Type u_3
inst✝² : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝¹ : TopologicalSpace M
e : M → H
h : IsOpenEmbedding e
n : WithTop ℕ∞
inst✝ : Nonempty M
this : IsManifold I ω M
⊢ ContinuousOn (↑(IsOpenEmbedding.toPartialHomeomorph e h).symm) (IsOpenEmbedding.toPartialHomeomorph e h).target

Proof state:
𝕜 : Type u_1
inst✝⁵ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace 𝕜 E
H : Type u_3
inst✝² : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝¹ : TopologicalSpace M
e : M → H
h : IsOpenEmbedding e
n : WithTop ℕ∞
inst✝ : Nonempty M
⊢ ContMDiffOn I I n (↑(IsOpenEmbedding.toPartialHomeomorph e h).symm) (range e)

Tactic:
haveI := h.isManifold_singleton (I := I) (n := ω)

Result:
𝕜 : Type u_1
inst✝⁵ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace 𝕜 E
H : Type u_3
inst✝² : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝¹ : TopologicalSpace M
e : M → H
h : IsOpenEmbedding e
n : WithTop ℕ∞
inst✝ : Nonempty M
this : IsManifold I ω M
⊢ ContMDiffOn I I n (↑(IsOpenEmbedding.toPartialHomeomorph e h).symm) (range e)

Proof state:
case right
𝕜 : Type u_1
inst✝⁵ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace 𝕜 E
H : Type u_3
inst✝² : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝¹ : TopologicalSpace M
e : M → H
h : IsOpenEmbedding e
n : WithTop ℕ∞
inst✝ : Nonempty M
this : IsManifold I ω M
z : H
hz : M
⊢ ∀
    x ∈
      (extChartAt I z).target ∩
        ↑(extChartAt I z).symm ⁻¹'
          (range e ∩ ↑(IsOpenEmbedding.toPartialHomeomorph e h).symm ⁻¹' (extChartAt I hz).source),
    (↑(extChartAt I hz) ∘ ↑(IsOpenEmbedding.toPartialHomeomorph e h).symm ∘ ↑(extChartAt I z).symm) x = id x

Tactic:
intros z hz

Result:
case right
𝕜 : Type u_1
inst✝⁵ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace 𝕜 E
H : Type u_3
inst✝² : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝¹ : TopologicalSpace M
e : M → H
h : IsOpenEmbedding e
n : WithTop ℕ∞
inst✝ : Nonempty M
this : IsManifold I ω M
z✝ : H
hz✝ : M
z : E
hz :
  z ∈
    (extChartAt I z✝).target ∩
      ↑(extChartAt I z✝).symm ⁻¹'
        (range e ∩ ↑(IsOpenEmbedding.toPartialHomeomorph e h).symm ⁻¹' (extChartAt I hz✝).source)
⊢ (↑(extChartAt I hz✝) ∘ ↑(IsOpenEmbedding.toPartialHomeomorph e h).symm ∘ ↑(extChartAt I z✝).symm) z = id z

Proof state:
case left
𝕜 : Type u_1
inst✝⁵ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace 𝕜 E
H : Type u_3
inst✝² : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝¹ : TopologicalSpace M
e : M → H
h : IsOpenEmbedding e
n : WithTop ℕ∞
inst✝ : Nonempty M
this : IsManifold I ω M
⊢ ContinuousOn (↑(IsOpenEmbedding.toPartialHomeomorph e h).symm) (IsOpenEmbedding.toPartialHomeomorph e h).target

Tactic:
exact (h.toPartialHomeomorph e).continuousOn_symm

Result:
no goals