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
        

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 v : Set H
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
hg : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) g v
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
⊢ (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I))
    (g ∘ f) (u ∩ f ⁻¹' v)

Next tactic:
have : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
/-- 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 

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 v : Set H
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
hg : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) g v
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
⊢ ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)

Next tactic:
ext x
/-- 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; 

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
f g : H → H
u v : Set H
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
hg : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) g v
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
x : E
⊢ (↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I)) x =
    ((↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) x

Next tactic:
simp
/-- 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
        

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 v : Set H
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
hg : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) g v
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
this :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
⊢ (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I))
    (g ∘ f) (u ∩ f ⁻¹' v)

Next tactic:
simp only [this]
/-- 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]
        

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 v : Set H
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
hg : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) g v
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
this :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
⊢ ContDiffOn 𝕜 n ((↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I))
    (↑(ModelWithCorners.symm I) ⁻¹' (u ∩ f ⁻¹' v) ∩ range ↑I)

Next tactic:
refine hg.comp (hf.mono ?_) ?_
/-- 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 ?_) ?_
        · 

Proof state:
case refine_1
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 v : Set H
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
hg : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) g v
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
this :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
⊢ ↑(ModelWithCorners.symm I) ⁻¹' (u ∩ f ⁻¹' v) ∩ range ↑I ⊆ ↑(ModelWithCorners.symm I) ⁻¹' u ∩ range ↑I

Next tactic:
rintro x ⟨hx1, hx2⟩
/-- 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⟩
          

Proof state:
case refine_1.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 v : Set H
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
hg : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) g v
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
this :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
x : E
hx1 : x ∈ ↑(ModelWithCorners.symm I) ⁻¹' (u ∩ f ⁻¹' v)
hx2 : x ∈ range ↑I
⊢ x ∈ ↑(ModelWithCorners.symm I) ⁻¹' u ∩ range ↑I

Next tactic:
exact ⟨hx1.1, hx2⟩
/-- 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⟩
        · 

Proof state:
case refine_2
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 v : Set H
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
hg : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) g v
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
this :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
⊢ ↑(ModelWithCorners.symm I) ⁻¹' (u ∩ f ⁻¹' v) ∩ range ↑I ⊆
    ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) ⁻¹' (↑(ModelWithCorners.symm I) ⁻¹' v ∩ range ↑I)

Next tactic:
rintro x ⟨hx1, _⟩
/-- 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, _⟩
          

Proof state:
case refine_2.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 v : Set H
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
hg : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) g v
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
this :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
x : E
hx1 : x ∈ ↑(ModelWithCorners.symm I) ⁻¹' (u ∩ f ⁻¹' v)
right✝ : x ∈ range ↑I
⊢ x ∈ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) ⁻¹' (↑(ModelWithCorners.symm I) ⁻¹' v ∩ range ↑I)

Next tactic:
simp only [mfld_simps] at hx1 ⊢
/-- 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 ⊢
          

Proof state:
case refine_2.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 v : Set H
hf : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u
hg : (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) g v
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
this :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
x : E
right✝ : x ∈ range ↑I
hx1 : ↑(ModelWithCorners.symm I) x ∈ u ∧ f (↑(ModelWithCorners.symm I) x) ∈ v
⊢ f (↑(ModelWithCorners.symm I) x) ∈ v

Next tactic:
exact hx1.2
/-- 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
        

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
⊢ (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) id
    univ

Next tactic:
apply ContDiffOn.congr contDiff_id.contDiffOn
/-- 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
        

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
⊢ ∀ x ∈ ↑(ModelWithCorners.symm I) ⁻¹' univ ∩ range ↑I, (↑I ∘ id ∘ ↑(ModelWithCorners.symm I)) x = id x

Next tactic:
rintro x ⟨_, hx2⟩
/-- 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⟩
        

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
x : E
left✝ : x ∈ ↑(ModelWithCorners.symm I) ⁻¹' univ
hx2 : x ∈ range ↑I
⊢ (↑I ∘ id ∘ ↑(ModelWithCorners.symm I)) x = id x

Next tactic:
rcases mem_range.1 hx2 with ⟨y, hy⟩
/-- 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⟩
        

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
x : E
left✝ : x ∈ ↑(ModelWithCorners.symm I) ⁻¹' univ
hx2 : x ∈ range ↑I
y : H
hy : ↑I y = x
⊢ (↑I ∘ id ∘ ↑(ModelWithCorners.symm I)) x = id x

Next tactic:
rw [← hy]
/-- 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]
        

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
x : E
left✝ : x ∈ ↑(ModelWithCorners.symm I) ⁻¹' univ
hx2 : x ∈ range ↑I
y : H
hy : ↑I y = x
⊢ (↑I ∘ id ∘ ↑(ModelWithCorners.symm I)) (↑I y) = id (↑I y)

Next tactic:
simp only [mfld_simps]
/-- 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
        

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 : H✝ → H✝
u : Set H✝
x✝ : IsOpen u
H :
  ∀ x ∈ u,
    ∃ v,
      IsOpen v ∧
        x ∈ v ∧
          (fun f s =>
              ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I))
            f (u ∩ v)
⊢ (fun f s => ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)) f u

Next tactic:
apply contDiffOn_of_locally_contDiffOn
/-- 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
        

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
f : H✝ → H✝
u : Set H✝
x✝ : IsOpen u
H :
  ∀ x ∈ u,
    ∃ v,
      IsOpen v ∧
        x ∈ v ∧
          (fun f s =>
              ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I))
            f (u ∩ v)
⊢ ∀ x ∈ ↑(ModelWithCorners.symm I) ⁻¹' u ∩ range ↑I,
    ∃ u_1,
      IsOpen u_1 ∧
        x ∈ u_1 ∧
          ContDiffOn 𝕜 n (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u ∩ range ↑I ∩ u_1)

Next tactic:
rintro y ⟨hy1, hy2⟩