l3lab/ntp-mathlib huggingface dataset:
/-- Given a model with corners `(E, H)`, we define the groupoid of `C^n` transformations of `H` as
the maps that are `C^n` when read in `E` through `I`. -/
def contDiffGroupoid : StructureGroupoid H :=
  Pregroupoid.groupoid
    { property := fun f s => ContDiffOn 𝕜 n (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        have : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        simp only [this]
        refine hg.comp (hf.mono ?_) ?_
        · rintro x ⟨hx1, hx2⟩
          exact ⟨hx1.1, hx2⟩
        · rintro x ⟨hx1, _⟩
          simp only [mfld_simps] at hx1 ⊢
          exact hx1.2
      id_mem := by
        apply ContDiffOn.congr contDiff_id.contDiffOn
        rintro x ⟨_, hx2⟩
        rcases mem_range.1 hx2 with ⟨y, hy⟩
        rw [← hy]
        simp only [mfld_simps]
      locality := fun {f u} _ H => by
        apply contDiffOn_of_locally_contDiffOn
        rintro y ⟨hy1, hy2⟩
        rcases mem_range.1 hy2 with ⟨x, hx⟩
        rw [← hx] at hy1 ⊢
        simp only [mfld_simps] at hy1 ⊢
        rcases H x hy1 with ⟨v, v_open, xv, hv⟩
        have : I.symm ⁻¹' (u ∩ v) ∩ range I = I.symm ⁻¹' u ∩ range I ∩ I.symm ⁻¹' v := by
          rw [preimage_inter, inter_assoc, inter_assoc]
          congr 1
          rw [inter_comm]
        rw [this] at hv
        exact ⟨I.symm ⁻¹' v, v_open.preimage I.continuous_symm, by simpa, hv⟩
      congr := fun {f g u} _ fg hf => by
        

Proof state:
m n : ℕ∞
𝕜 : 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
f g : H → H
u : Set H
x✝ : IsOpen u
fg : ∀ x ∈ u, g x = f x
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
⊢ (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) g u

Next tactic:
apply hf.congr
/-- Given a model with corners `(E, H)`, we define the groupoid of `C^n` transformations of `H` as
the maps that are `C^n` when read in `E` through `I`. -/
def contDiffGroupoid : StructureGroupoid H :=
  Pregroupoid.groupoid
    { property := fun f s => ContDiffOn 𝕜 n (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        have : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        simp only [this]
        refine hg.comp (hf.mono ?_) ?_
        · rintro x ⟨hx1, hx2⟩
          exact ⟨hx1.1, hx2⟩
        · rintro x ⟨hx1, _⟩
          simp only [mfld_simps] at hx1 ⊢
          exact hx1.2
      id_mem := by
        apply ContDiffOn.congr contDiff_id.contDiffOn
        rintro x ⟨_, hx2⟩
        rcases mem_range.1 hx2 with ⟨y, hy⟩
        rw [← hy]
        simp only [mfld_simps]
      locality := fun {f u} _ H => by
        apply contDiffOn_of_locally_contDiffOn
        rintro y ⟨hy1, hy2⟩
        rcases mem_range.1 hy2 with ⟨x, hx⟩
        rw [← hx] at hy1 ⊢
        simp only [mfld_simps] at hy1 ⊢
        rcases H x hy1 with ⟨v, v_open, xv, hv⟩
        have : I.symm ⁻¹' (u ∩ v) ∩ range I = I.symm ⁻¹' u ∩ range I ∩ I.symm ⁻¹' v := by
          rw [preimage_inter, inter_assoc, inter_assoc]
          congr 1
          rw [inter_comm]
        rw [this] at hv
        exact ⟨I.symm ⁻¹' v, v_open.preimage I.continuous_symm, by simpa, hv⟩
      congr := fun {f g u} _ fg hf => by
        apply hf.congr
        

Proof state:
m n : ℕ∞
𝕜 : 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
f g : H → H
u : Set H
x✝ : IsOpen u
fg : ∀ x ∈ u, g x = f x
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
⊢ ∀ x ∈ ↑(ModelWithCorners.symm I) ⁻¹' u ∩ range ↑I,
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) x = (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) x

Next tactic:
rintro y ⟨hy1, hy2⟩
/-- Given a model with corners `(E, H)`, we define the groupoid of `C^n` transformations of `H` as
the maps that are `C^n` when read in `E` through `I`. -/
def contDiffGroupoid : StructureGroupoid H :=
  Pregroupoid.groupoid
    { property := fun f s => ContDiffOn 𝕜 n (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        have : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        simp only [this]
        refine hg.comp (hf.mono ?_) ?_
        · rintro x ⟨hx1, hx2⟩
          exact ⟨hx1.1, hx2⟩
        · rintro x ⟨hx1, _⟩
          simp only [mfld_simps] at hx1 ⊢
          exact hx1.2
      id_mem := by
        apply ContDiffOn.congr contDiff_id.contDiffOn
        rintro x ⟨_, hx2⟩
        rcases mem_range.1 hx2 with ⟨y, hy⟩
        rw [← hy]
        simp only [mfld_simps]
      locality := fun {f u} _ H => by
        apply contDiffOn_of_locally_contDiffOn
        rintro y ⟨hy1, hy2⟩
        rcases mem_range.1 hy2 with ⟨x, hx⟩
        rw [← hx] at hy1 ⊢
        simp only [mfld_simps] at hy1 ⊢
        rcases H x hy1 with ⟨v, v_open, xv, hv⟩
        have : I.symm ⁻¹' (u ∩ v) ∩ range I = I.symm ⁻¹' u ∩ range I ∩ I.symm ⁻¹' v := by
          rw [preimage_inter, inter_assoc, inter_assoc]
          congr 1
          rw [inter_comm]
        rw [this] at hv
        exact ⟨I.symm ⁻¹' v, v_open.preimage I.continuous_symm, by simpa, hv⟩
      congr := fun {f g u} _ fg hf => by
        apply hf.congr
        rintro y ⟨hy1, hy2⟩
        

Proof state:
case intro
m n : ℕ∞
𝕜 : 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
f g : H → H
u : Set H
x✝ : IsOpen u
fg : ∀ x ∈ u, g x = f x
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
y : E
hy1 : y ∈ ↑(ModelWithCorners.symm I) ⁻¹' u
hy2 : y ∈ range ↑I
⊢ (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) y = (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) y

Next tactic:
rcases mem_range.1 hy2 with ⟨x, hx⟩
/-- Given a model with corners `(E, H)`, we define the groupoid of `C^n` transformations of `H` as
the maps that are `C^n` when read in `E` through `I`. -/
def contDiffGroupoid : StructureGroupoid H :=
  Pregroupoid.groupoid
    { property := fun f s => ContDiffOn 𝕜 n (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        have : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        simp only [this]
        refine hg.comp (hf.mono ?_) ?_
        · rintro x ⟨hx1, hx2⟩
          exact ⟨hx1.1, hx2⟩
        · rintro x ⟨hx1, _⟩
          simp only [mfld_simps] at hx1 ⊢
          exact hx1.2
      id_mem := by
        apply ContDiffOn.congr contDiff_id.contDiffOn
        rintro x ⟨_, hx2⟩
        rcases mem_range.1 hx2 with ⟨y, hy⟩
        rw [← hy]
        simp only [mfld_simps]
      locality := fun {f u} _ H => by
        apply contDiffOn_of_locally_contDiffOn
        rintro y ⟨hy1, hy2⟩
        rcases mem_range.1 hy2 with ⟨x, hx⟩
        rw [← hx] at hy1 ⊢
        simp only [mfld_simps] at hy1 ⊢
        rcases H x hy1 with ⟨v, v_open, xv, hv⟩
        have : I.symm ⁻¹' (u ∩ v) ∩ range I = I.symm ⁻¹' u ∩ range I ∩ I.symm ⁻¹' v := by
          rw [preimage_inter, inter_assoc, inter_assoc]
          congr 1
          rw [inter_comm]
        rw [this] at hv
        exact ⟨I.symm ⁻¹' v, v_open.preimage I.continuous_symm, by simpa, hv⟩
      congr := fun {f g u} _ fg hf => by
        apply hf.congr
        rintro y ⟨hy1, hy2⟩
        rcases mem_range.1 hy2 with ⟨x, hx⟩
        

Proof state:
case intro.intro
m n : ℕ∞
𝕜 : 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
f g : H → H
u : Set H
x✝ : IsOpen u
fg : ∀ x ∈ u, g x = f x
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
y : E
hy1 : y ∈ ↑(ModelWithCorners.symm I) ⁻¹' u
hy2 : y ∈ range ↑I
x : H
hx : ↑I x = y
⊢ (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) y = (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) y

Next tactic:
rw [← hx] at hy1 ⊢
/-- Given a model with corners `(E, H)`, we define the groupoid of `C^n` transformations of `H` as
the maps that are `C^n` when read in `E` through `I`. -/
def contDiffGroupoid : StructureGroupoid H :=
  Pregroupoid.groupoid
    { property := fun f s => ContDiffOn 𝕜 n (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        have : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        simp only [this]
        refine hg.comp (hf.mono ?_) ?_
        · rintro x ⟨hx1, hx2⟩
          exact ⟨hx1.1, hx2⟩
        · rintro x ⟨hx1, _⟩
          simp only [mfld_simps] at hx1 ⊢
          exact hx1.2
      id_mem := by
        apply ContDiffOn.congr contDiff_id.contDiffOn
        rintro x ⟨_, hx2⟩
        rcases mem_range.1 hx2 with ⟨y, hy⟩
        rw [← hy]
        simp only [mfld_simps]
      locality := fun {f u} _ H => by
        apply contDiffOn_of_locally_contDiffOn
        rintro y ⟨hy1, hy2⟩
        rcases mem_range.1 hy2 with ⟨x, hx⟩
        rw [← hx] at hy1 ⊢
        simp only [mfld_simps] at hy1 ⊢
        rcases H x hy1 with ⟨v, v_open, xv, hv⟩
        have : I.symm ⁻¹' (u ∩ v) ∩ range I = I.symm ⁻¹' u ∩ range I ∩ I.symm ⁻¹' v := by
          rw [preimage_inter, inter_assoc, inter_assoc]
          congr 1
          rw [inter_comm]
        rw [this] at hv
        exact ⟨I.symm ⁻¹' v, v_open.preimage I.continuous_symm, by simpa, hv⟩
      congr := fun {f g u} _ fg hf => by
        apply hf.congr
        rintro y ⟨hy1, hy2⟩
        rcases mem_range.1 hy2 with ⟨x, hx⟩
        rw [← hx] at hy1 ⊢
        

Proof state:
case intro.intro
m n : ℕ∞
𝕜 : 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
f g : H → H
u : Set H
x✝ : IsOpen u
fg : ∀ x ∈ u, g x = f x
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
y : E
hy2 : y ∈ range ↑I
x : H
hy1 : ↑I x ∈ ↑(ModelWithCorners.symm I) ⁻¹' u
hx : ↑I x = y
⊢ (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) (↑I x) = (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑I x)

Next tactic:
simp only [mfld_simps] at hy1 ⊢
/-- Given a model with corners `(E, H)`, we define the groupoid of `C^n` transformations of `H` as
the maps that are `C^n` when read in `E` through `I`. -/
def contDiffGroupoid : StructureGroupoid H :=
  Pregroupoid.groupoid
    { property := fun f s => ContDiffOn 𝕜 n (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        have : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        simp only [this]
        refine hg.comp (hf.mono ?_) ?_
        · rintro x ⟨hx1, hx2⟩
          exact ⟨hx1.1, hx2⟩
        · rintro x ⟨hx1, _⟩
          simp only [mfld_simps] at hx1 ⊢
          exact hx1.2
      id_mem := by
        apply ContDiffOn.congr contDiff_id.contDiffOn
        rintro x ⟨_, hx2⟩
        rcases mem_range.1 hx2 with ⟨y, hy⟩
        rw [← hy]
        simp only [mfld_simps]
      locality := fun {f u} _ H => by
        apply contDiffOn_of_locally_contDiffOn
        rintro y ⟨hy1, hy2⟩
        rcases mem_range.1 hy2 with ⟨x, hx⟩
        rw [← hx] at hy1 ⊢
        simp only [mfld_simps] at hy1 ⊢
        rcases H x hy1 with ⟨v, v_open, xv, hv⟩
        have : I.symm ⁻¹' (u ∩ v) ∩ range I = I.symm ⁻¹' u ∩ range I ∩ I.symm ⁻¹' v := by
          rw [preimage_inter, inter_assoc, inter_assoc]
          congr 1
          rw [inter_comm]
        rw [this] at hv
        exact ⟨I.symm ⁻¹' v, v_open.preimage I.continuous_symm, by simpa, hv⟩
      congr := fun {f g u} _ fg hf => by
        apply hf.congr
        rintro y ⟨hy1, hy2⟩
        rcases mem_range.1 hy2 with ⟨x, hx⟩
        rw [← hx] at hy1 ⊢
        simp only [mfld_simps] at hy1 ⊢
        

Proof state:
case intro.intro
m n : ℕ∞
𝕜 : 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
f g : H → H
u : Set H
x✝ : IsOpen u
fg : ∀ x ∈ u, g x = f x
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
y : E
hy2 : y ∈ range ↑I
x : H
hx : ↑I x = y
hy1 : x ∈ u
⊢ ↑I (g x) = ↑I (f x)

Next tactic:
rw [fg _ hy1]
/-- Inclusion of the groupoid of `C^n` local diffeos in the groupoid of `C^m` local diffeos when
`m ≤ n` -/
theorem contDiffGroupoid_le (h : m ≤ n) : contDiffGroupoid n I ≤ contDiffGroupoid m I := by
  

Proof state:
m n : ℕ∞
𝕜 : 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
h : m ≤ n
⊢ contDiffGroupoid n I ≤ contDiffGroupoid m I

Next tactic:
rw [contDiffGroupoid, contDiffGroupoid]
/-- The groupoid of `0`-times continuously differentiable maps is just the groupoid of all
local homeomorphisms -/
theorem contDiffGroupoid_zero_eq : contDiffGroupoid 0 I = continuousGroupoid H := by
  

Proof state:
m n : ℕ∞
𝕜 : 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
⊢ contDiffGroupoid 0 I = continuousGroupoid H

Next tactic:
apply le_antisymm le_top
/-- The groupoid of `0`-times continuously differentiable maps is just the groupoid of all
local homeomorphisms -/
theorem contDiffGroupoid_zero_eq : contDiffGroupoid 0 I = continuousGroupoid H := by
  apply le_antisymm le_top
  

Proof state:
m n : ℕ∞
𝕜 : 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
⊢ ⊤ ≤ contDiffGroupoid 0 I

Next tactic:
intro u _
/-- The groupoid of `0`-times continuously differentiable maps is just the groupoid of all
local homeomorphisms -/
theorem contDiffGroupoid_zero_eq : contDiffGroupoid 0 I = continuousGroupoid H := by
  apply le_antisymm le_top
  intro u _
  -- we have to check that every local homeomorphism belongs to `contDiffGroupoid 0 I`,
  -- by unfolding its definition
  

Proof state:
m n : ℕ∞
𝕜 : 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
u : PartialHomeomorph H H
a✝ : u ∈ ⊤.members
⊢ u ∈ (contDiffGroupoid 0 I).members

Next tactic:
change u ∈ contDiffGroupoid 0 I
/-- The groupoid of `0`-times continuously differentiable maps is just the groupoid of all
local homeomorphisms -/
theorem contDiffGroupoid_zero_eq : contDiffGroupoid 0 I = continuousGroupoid H := by
  apply le_antisymm le_top
  intro u _
  -- we have to check that every local homeomorphism belongs to `contDiffGroupoid 0 I`,
  -- by unfolding its definition
  change u ∈ contDiffGroupoid 0 I
  

Proof state:
m n : ℕ∞
𝕜 : 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
u : PartialHomeomorph H H
a✝ : u ∈ ⊤.members
⊢ u ∈ contDiffGroupoid 0 I

Next tactic:
rw [contDiffGroupoid, mem_groupoid_of_pregroupoid]
/-- The groupoid of `0`-times continuously differentiable maps is just the groupoid of all
local homeomorphisms -/
theorem contDiffGroupoid_zero_eq : contDiffGroupoid 0 I = continuousGroupoid H := by
  apply le_antisymm le_top
  intro u _
  -- we have to check that every local homeomorphism belongs to `contDiffGroupoid 0 I`,
  -- by unfolding its definition
  change u ∈ contDiffGroupoid 0 I
  rw [contDiffGroupoid, mem_groupoid_of_pregroupoid]
  simp only [contDiffOn_zero]
  

Proof state:
m n : ℕ∞
𝕜 : 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
u : PartialHomeomorph H H
a✝ : u ∈ ⊤.members
⊢ ContinuousOn (↑I ∘ ↑u ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u.source ∩ range ↑I) ∧
    ContinuousOn (↑I ∘ ↑(PartialHomeomorph.symm u) ∘ ↑(ModelWithCorners.symm I))
      (↑(ModelWithCorners.symm I) ⁻¹' u.target ∩ range ↑I)

Next tactic:
constructor
/-- The groupoid of `0`-times continuously differentiable maps is just the groupoid of all
local homeomorphisms -/
theorem contDiffGroupoid_zero_eq : contDiffGroupoid 0 I = continuousGroupoid H := by
  apply le_antisymm le_top
  intro u _
  -- we have to check that every local homeomorphism belongs to `contDiffGroupoid 0 I`,
  -- by unfolding its definition
  change u ∈ contDiffGroupoid 0 I
  rw [contDiffGroupoid, mem_groupoid_of_pregroupoid]
  simp only [contDiffOn_zero]
  constructor
  · 

Proof state:
case left
m n : ℕ∞
𝕜 : 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
u : PartialHomeomorph H H
a✝ : u ∈ ⊤.members
⊢ ContinuousOn (↑I ∘ ↑u ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u.source ∩ range ↑I)

Next tactic:
refine' I.continuous.comp_continuousOn (u.continuousOn.comp I.continuousOn_symm _)
/-- The groupoid of `0`-times continuously differentiable maps is just the groupoid of all
local homeomorphisms -/
theorem contDiffGroupoid_zero_eq : contDiffGroupoid 0 I = continuousGroupoid H := by
  apply le_antisymm le_top
  intro u _
  -- we have to check that every local homeomorphism belongs to `contDiffGroupoid 0 I`,
  -- by unfolding its definition
  change u ∈ contDiffGroupoid 0 I
  rw [contDiffGroupoid, mem_groupoid_of_pregroupoid]
  simp only [contDiffOn_zero]
  constructor
  · refine' I.continuous.comp_continuousOn (u.continuousOn.comp I.continuousOn_symm _)
    

Proof state:
case left
m n : ℕ∞
𝕜 : 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
u : PartialHomeomorph H H
a✝ : u ∈ ⊤.members
⊢ MapsTo (↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u.source ∩ range ↑I) u.source

Next tactic:
exact (mapsTo_preimage _ _).mono_left (inter_subset_left _ _)
/-- The groupoid of `0`-times continuously differentiable maps is just the groupoid of all
local homeomorphisms -/
theorem contDiffGroupoid_zero_eq : contDiffGroupoid 0 I = continuousGroupoid H := by
  apply le_antisymm le_top
  intro u _
  -- we have to check that every local homeomorphism belongs to `contDiffGroupoid 0 I`,
  -- by unfolding its definition
  change u ∈ contDiffGroupoid 0 I
  rw [contDiffGroupoid, mem_groupoid_of_pregroupoid]
  simp only [contDiffOn_zero]
  constructor
  · refine' I.continuous.comp_continuousOn (u.continuousOn.comp I.continuousOn_symm _)
    exact (mapsTo_preimage _ _).mono_left (inter_subset_left _ _)
  · 

Proof state:
case right
m n : ℕ∞
𝕜 : 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
u : PartialHomeomorph H H
a✝ : u ∈ ⊤.members
⊢ ContinuousOn (↑I ∘ ↑(PartialHomeomorph.symm u) ∘ ↑(ModelWithCorners.symm I))
    (↑(ModelWithCorners.symm I) ⁻¹' u.target ∩ range ↑I)

Next tactic:
refine' I.continuous.comp_continuousOn (u.symm.continuousOn.comp I.continuousOn_symm _)
/-- The groupoid of `0`-times continuously differentiable maps is just the groupoid of all
local homeomorphisms -/
theorem contDiffGroupoid_zero_eq : contDiffGroupoid 0 I = continuousGroupoid H := by
  apply le_antisymm le_top
  intro u _
  -- we have to check that every local homeomorphism belongs to `contDiffGroupoid 0 I`,
  -- by unfolding its definition
  change u ∈ contDiffGroupoid 0 I
  rw [contDiffGroupoid, mem_groupoid_of_pregroupoid]
  simp only [contDiffOn_zero]
  constructor
  · refine' I.continuous.comp_continuousOn (u.continuousOn.comp I.continuousOn_symm _)
    exact (mapsTo_preimage _ _).mono_left (inter_subset_left _ _)
  · refine' I.continuous.comp_continuousOn (u.symm.continuousOn.comp I.continuousOn_symm _)
    

Proof state:
case right
m n : ℕ∞
𝕜 : 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
u : PartialHomeomorph H H
a✝ : u ∈ ⊤.members
⊢ MapsTo (↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u.target ∩ range ↑I)
    (PartialHomeomorph.symm u).toPartialEquiv.source

Next tactic:
exact (mapsTo_preimage _ _).mono_left (inter_subset_left _ _)
/-- An identity local homeomorphism belongs to the `C^n` groupoid. -/
theorem ofSet_mem_contDiffGroupoid {s : Set H} (hs : IsOpen s) :
    PartialHomeomorph.ofSet s hs ∈ contDiffGroupoid n I := by
  

Proof state:
m n : ℕ∞
𝕜 : 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
s : Set H
hs : IsOpen s
⊢ PartialHomeomorph.ofSet s hs ∈ contDiffGroupoid n I

Next tactic:
rw [contDiffGroupoid, mem_groupoid_of_pregroupoid]
/-- An identity local homeomorphism belongs to the `C^n` groupoid. -/
theorem ofSet_mem_contDiffGroupoid {s : Set H} (hs : IsOpen s) :
    PartialHomeomorph.ofSet s hs ∈ contDiffGroupoid n I := by
  rw [contDiffGroupoid, mem_groupoid_of_pregroupoid]
  suffices h : ContDiffOn 𝕜 n (I ∘ I.symm) (I.symm ⁻¹' s ∩ range I)
  · simp [h]
  

Proof state:
case h
m n : ℕ∞
𝕜 : 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
s : Set H
hs : IsOpen s
⊢ ContDiffOn 𝕜 n (↑I ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)

Next tactic:
have : ContDiffOn 𝕜 n id (univ : Set E) := contDiff_id.contDiffOn
/-- An identity local homeomorphism belongs to the `C^n` groupoid. -/
theorem ofSet_mem_contDiffGroupoid {s : Set H} (hs : IsOpen s) :
    PartialHomeomorph.ofSet s hs ∈ contDiffGroupoid n I := by
  rw [contDiffGroupoid, mem_groupoid_of_pregroupoid]
  suffices h : ContDiffOn 𝕜 n (I ∘ I.symm) (I.symm ⁻¹' s ∩ range I)
  · simp [h]
  have : ContDiffOn 𝕜 n id (univ : Set E) := contDiff_id.contDiffOn
  

Proof state:
case h
m n : ℕ∞
𝕜 : 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
s : Set H
hs : IsOpen s
this : ContDiffOn 𝕜 n id univ
⊢ ContDiffOn 𝕜 n (↑I ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)

Next tactic:
exact this.congr_mono (fun x hx => I.right_inv hx.2) (subset_univ _)