l3lab/ntp-mathlib huggingface dataset:
/-- Given a model with corners `(E, H)`, we define the groupoid of analytic transformations of `H`
as the maps that are analytic and map interior to interior when read in `E` through `I`. We also
explicitly define that they are `C^∞` on the whole domain, since we are only requiring
analyticity on the interior of the domain. -/
def analyticGroupoid : StructureGroupoid H :=
  (contDiffGroupoid ∞ I) ⊓ Pregroupoid.groupoid
    { property := fun f s => AnalyticOn 𝕜 (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ interior (range I)) ∧
        (I.symm ⁻¹' s ∩ interior (range I)).image (I ∘ f ∘ I.symm) ⊆ interior (range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        simp only [] at hf hg ⊢
        have comp : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        apply And.intro
        · simp only [comp, preimage_inter]
          refine hg.left.comp (hf.left.mono ?_) ?_
          · simp only [subset_inter_iff, inter_subset_right]
            rw [inter_assoc]
            simp
          · intro x hx
            apply And.intro
            · 

Proof state:
case left.refine_2.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
f g : H → H
u v : Set H
hf :
  AnalyticOn 𝕜 (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ∧
    ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
hg :
  AnalyticOn 𝕜 (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ∧
    ↑I ∘ g ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
comp :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
x : E
hx : x ∈ ↑(ModelWithCorners.symm I) ⁻¹' u ∩ ↑(ModelWithCorners.symm I) ⁻¹' (f ⁻¹' v) ∩ interior (range ↑I)
⊢ (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) x ∈ ↑(ModelWithCorners.symm I) ⁻¹' v

Next tactic:
rw [mem_preimage, comp_apply, I.left_inv]
/-- Given a model with corners `(E, H)`, we define the groupoid of analytic transformations of `H`
as the maps that are analytic and map interior to interior when read in `E` through `I`. We also
explicitly define that they are `C^∞` on the whole domain, since we are only requiring
analyticity on the interior of the domain. -/
def analyticGroupoid : StructureGroupoid H :=
  (contDiffGroupoid ∞ I) ⊓ Pregroupoid.groupoid
    { property := fun f s => AnalyticOn 𝕜 (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ interior (range I)) ∧
        (I.symm ⁻¹' s ∩ interior (range I)).image (I ∘ f ∘ I.symm) ⊆ interior (range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        simp only [] at hf hg ⊢
        have comp : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        apply And.intro
        · simp only [comp, preimage_inter]
          refine hg.left.comp (hf.left.mono ?_) ?_
          · simp only [subset_inter_iff, inter_subset_right]
            rw [inter_assoc]
            simp
          · intro x hx
            apply And.intro
            · rw [mem_preimage, comp_apply, I.left_inv]
              

Proof state:
case left.refine_2.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
f g : H → H
u v : Set H
hf :
  AnalyticOn 𝕜 (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ∧
    ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
hg :
  AnalyticOn 𝕜 (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ∧
    ↑I ∘ g ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
comp :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
x : E
hx : x ∈ ↑(ModelWithCorners.symm I) ⁻¹' u ∩ ↑(ModelWithCorners.symm I) ⁻¹' (f ⁻¹' v) ∩ interior (range ↑I)
⊢ (f ∘ ↑(ModelWithCorners.symm I)) x ∈ v

Next tactic:
exact hx.left.right
/-- Given a model with corners `(E, H)`, we define the groupoid of analytic transformations of `H`
as the maps that are analytic and map interior to interior when read in `E` through `I`. We also
explicitly define that they are `C^∞` on the whole domain, since we are only requiring
analyticity on the interior of the domain. -/
def analyticGroupoid : StructureGroupoid H :=
  (contDiffGroupoid ∞ I) ⊓ Pregroupoid.groupoid
    { property := fun f s => AnalyticOn 𝕜 (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ interior (range I)) ∧
        (I.symm ⁻¹' s ∩ interior (range I)).image (I ∘ f ∘ I.symm) ⊆ interior (range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        simp only [] at hf hg ⊢
        have comp : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        apply And.intro
        · simp only [comp, preimage_inter]
          refine hg.left.comp (hf.left.mono ?_) ?_
          · simp only [subset_inter_iff, inter_subset_right]
            rw [inter_assoc]
            simp
          · intro x hx
            apply And.intro
            · rw [mem_preimage, comp_apply, I.left_inv]
              exact hx.left.right
            · 

Proof state:
case left.refine_2.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
f g : H → H
u v : Set H
hf :
  AnalyticOn 𝕜 (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ∧
    ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
hg :
  AnalyticOn 𝕜 (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ∧
    ↑I ∘ g ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
comp :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
x : E
hx : x ∈ ↑(ModelWithCorners.symm I) ⁻¹' u ∩ ↑(ModelWithCorners.symm I) ⁻¹' (f ⁻¹' v) ∩ interior (range ↑I)
⊢ (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) x ∈ interior (range ↑I)

Next tactic:
apply hf.right
/-- Given a model with corners `(E, H)`, we define the groupoid of analytic transformations of `H`
as the maps that are analytic and map interior to interior when read in `E` through `I`. We also
explicitly define that they are `C^∞` on the whole domain, since we are only requiring
analyticity on the interior of the domain. -/
def analyticGroupoid : StructureGroupoid H :=
  (contDiffGroupoid ∞ I) ⊓ Pregroupoid.groupoid
    { property := fun f s => AnalyticOn 𝕜 (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ interior (range I)) ∧
        (I.symm ⁻¹' s ∩ interior (range I)).image (I ∘ f ∘ I.symm) ⊆ interior (range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        simp only [] at hf hg ⊢
        have comp : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        apply And.intro
        · simp only [comp, preimage_inter]
          refine hg.left.comp (hf.left.mono ?_) ?_
          · simp only [subset_inter_iff, inter_subset_right]
            rw [inter_assoc]
            simp
          · intro x hx
            apply And.intro
            · rw [mem_preimage, comp_apply, I.left_inv]
              exact hx.left.right
            · apply hf.right
              

Proof state:
case left.refine_2.right.a
𝕜 : 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 :
  AnalyticOn 𝕜 (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ∧
    ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
hg :
  AnalyticOn 𝕜 (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ∧
    ↑I ∘ g ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
comp :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
x : E
hx : x ∈ ↑(ModelWithCorners.symm I) ⁻¹' u ∩ ↑(ModelWithCorners.symm I) ⁻¹' (f ⁻¹' v) ∩ interior (range ↑I)
⊢ (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) x ∈
    ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I))

Next tactic:
rw [mem_image]
/-- Given a model with corners `(E, H)`, we define the groupoid of analytic transformations of `H`
as the maps that are analytic and map interior to interior when read in `E` through `I`. We also
explicitly define that they are `C^∞` on the whole domain, since we are only requiring
analyticity on the interior of the domain. -/
def analyticGroupoid : StructureGroupoid H :=
  (contDiffGroupoid ∞ I) ⊓ Pregroupoid.groupoid
    { property := fun f s => AnalyticOn 𝕜 (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ interior (range I)) ∧
        (I.symm ⁻¹' s ∩ interior (range I)).image (I ∘ f ∘ I.symm) ⊆ interior (range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        simp only [] at hf hg ⊢
        have comp : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        apply And.intro
        · simp only [comp, preimage_inter]
          refine hg.left.comp (hf.left.mono ?_) ?_
          · simp only [subset_inter_iff, inter_subset_right]
            rw [inter_assoc]
            simp
          · intro x hx
            apply And.intro
            · rw [mem_preimage, comp_apply, I.left_inv]
              exact hx.left.right
            · apply hf.right
              rw [mem_image]
              

Proof state:
case left.refine_2.right.a
𝕜 : 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 :
  AnalyticOn 𝕜 (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ∧
    ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
hg :
  AnalyticOn 𝕜 (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ∧
    ↑I ∘ g ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
comp :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
x : E
hx : x ∈ ↑(ModelWithCorners.symm I) ⁻¹' u ∩ ↑(ModelWithCorners.symm I) ⁻¹' (f ⁻¹' v) ∩ interior (range ↑I)
⊢ ∃ x_1 ∈ ↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I),
    (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) x_1 = (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) x

Next tactic:
exact ⟨x, ⟨⟨hx.left.left, hx.right⟩, rfl⟩⟩
/-- Given a model with corners `(E, H)`, we define the groupoid of analytic transformations of `H`
as the maps that are analytic and map interior to interior when read in `E` through `I`. We also
explicitly define that they are `C^∞` on the whole domain, since we are only requiring
analyticity on the interior of the domain. -/
def analyticGroupoid : StructureGroupoid H :=
  (contDiffGroupoid ∞ I) ⊓ Pregroupoid.groupoid
    { property := fun f s => AnalyticOn 𝕜 (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ interior (range I)) ∧
        (I.symm ⁻¹' s ∩ interior (range I)).image (I ∘ f ∘ I.symm) ⊆ interior (range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        simp only [] at hf hg ⊢
        have comp : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        apply And.intro
        · simp only [comp, preimage_inter]
          refine hg.left.comp (hf.left.mono ?_) ?_
          · simp only [subset_inter_iff, inter_subset_right]
            rw [inter_assoc]
            simp
          · intro x hx
            apply And.intro
            · rw [mem_preimage, comp_apply, I.left_inv]
              exact hx.left.right
            · apply hf.right
              rw [mem_image]
              exact ⟨x, ⟨⟨hx.left.left, hx.right⟩, rfl⟩⟩
        · 

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
f g : H → H
u v : Set H
hf :
  AnalyticOn 𝕜 (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ∧
    ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
hg :
  AnalyticOn 𝕜 (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ∧
    ↑I ∘ g ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
comp :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
⊢ ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' (u ∩ f ⁻¹' v) ∩ interior (range ↑I)) ⊆
    interior (range ↑I)

Next tactic:
simp only [comp]
/-- Given a model with corners `(E, H)`, we define the groupoid of analytic transformations of `H`
as the maps that are analytic and map interior to interior when read in `E` through `I`. We also
explicitly define that they are `C^∞` on the whole domain, since we are only requiring
analyticity on the interior of the domain. -/
def analyticGroupoid : StructureGroupoid H :=
  (contDiffGroupoid ∞ I) ⊓ Pregroupoid.groupoid
    { property := fun f s => AnalyticOn 𝕜 (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ interior (range I)) ∧
        (I.symm ⁻¹' s ∩ interior (range I)).image (I ∘ f ∘ I.symm) ⊆ interior (range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        simp only [] at hf hg ⊢
        have comp : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        apply And.intro
        · simp only [comp, preimage_inter]
          refine hg.left.comp (hf.left.mono ?_) ?_
          · simp only [subset_inter_iff, inter_subset_right]
            rw [inter_assoc]
            simp
          · intro x hx
            apply And.intro
            · rw [mem_preimage, comp_apply, I.left_inv]
              exact hx.left.right
            · apply hf.right
              rw [mem_image]
              exact ⟨x, ⟨⟨hx.left.left, hx.right⟩, rfl⟩⟩
        · simp only [comp]
          

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
f g : H → H
u v : Set H
hf :
  AnalyticOn 𝕜 (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ∧
    ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
hg :
  AnalyticOn 𝕜 (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ∧
    ↑I ∘ g ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
comp :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
⊢ (fun a => ((↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) a) ''
      (↑(ModelWithCorners.symm I) ⁻¹' (u ∩ f ⁻¹' v) ∩ interior (range ↑I)) ⊆
    interior (range ↑I)

Next tactic:
rw [image_comp]
/-- Given a model with corners `(E, H)`, we define the groupoid of analytic transformations of `H`
as the maps that are analytic and map interior to interior when read in `E` through `I`. We also
explicitly define that they are `C^∞` on the whole domain, since we are only requiring
analyticity on the interior of the domain. -/
def analyticGroupoid : StructureGroupoid H :=
  (contDiffGroupoid ∞ I) ⊓ Pregroupoid.groupoid
    { property := fun f s => AnalyticOn 𝕜 (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ interior (range I)) ∧
        (I.symm ⁻¹' s ∩ interior (range I)).image (I ∘ f ∘ I.symm) ⊆ interior (range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        simp only [] at hf hg ⊢
        have comp : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        apply And.intro
        · simp only [comp, preimage_inter]
          refine hg.left.comp (hf.left.mono ?_) ?_
          · simp only [subset_inter_iff, inter_subset_right]
            rw [inter_assoc]
            simp
          · intro x hx
            apply And.intro
            · rw [mem_preimage, comp_apply, I.left_inv]
              exact hx.left.right
            · apply hf.right
              rw [mem_image]
              exact ⟨x, ⟨⟨hx.left.left, hx.right⟩, rfl⟩⟩
        · simp only [comp]
          rw [image_comp]
          

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
f g : H → H
u v : Set H
hf :
  AnalyticOn 𝕜 (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ∧
    ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
hg :
  AnalyticOn 𝕜 (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ∧
    ↑I ∘ g ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
comp :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
⊢ ↑I ∘ g ∘ ↑(ModelWithCorners.symm I) ''
      (↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' (u ∩ f ⁻¹' v) ∩ interior (range ↑I))) ⊆
    interior (range ↑I)

Next tactic:
intro x hx
/-- Given a model with corners `(E, H)`, we define the groupoid of analytic transformations of `H`
as the maps that are analytic and map interior to interior when read in `E` through `I`. We also
explicitly define that they are `C^∞` on the whole domain, since we are only requiring
analyticity on the interior of the domain. -/
def analyticGroupoid : StructureGroupoid H :=
  (contDiffGroupoid ∞ I) ⊓ Pregroupoid.groupoid
    { property := fun f s => AnalyticOn 𝕜 (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ interior (range I)) ∧
        (I.symm ⁻¹' s ∩ interior (range I)).image (I ∘ f ∘ I.symm) ⊆ interior (range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        simp only [] at hf hg ⊢
        have comp : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        apply And.intro
        · simp only [comp, preimage_inter]
          refine hg.left.comp (hf.left.mono ?_) ?_
          · simp only [subset_inter_iff, inter_subset_right]
            rw [inter_assoc]
            simp
          · intro x hx
            apply And.intro
            · rw [mem_preimage, comp_apply, I.left_inv]
              exact hx.left.right
            · apply hf.right
              rw [mem_image]
              exact ⟨x, ⟨⟨hx.left.left, hx.right⟩, rfl⟩⟩
        · simp only [comp]
          rw [image_comp]
          intro x hx
          

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
f g : H → H
u v : Set H
hf :
  AnalyticOn 𝕜 (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ∧
    ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
hg :
  AnalyticOn 𝕜 (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ∧
    ↑I ∘ g ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
comp :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
x : E
hx :
  x ∈
    ↑I ∘ g ∘ ↑(ModelWithCorners.symm I) ''
      (↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' (u ∩ f ⁻¹' v) ∩ interior (range ↑I)))
⊢ x ∈ interior (range ↑I)

Next tactic:
rw [mem_image] at hx
/-- Given a model with corners `(E, H)`, we define the groupoid of analytic transformations of `H`
as the maps that are analytic and map interior to interior when read in `E` through `I`. We also
explicitly define that they are `C^∞` on the whole domain, since we are only requiring
analyticity on the interior of the domain. -/
def analyticGroupoid : StructureGroupoid H :=
  (contDiffGroupoid ∞ I) ⊓ Pregroupoid.groupoid
    { property := fun f s => AnalyticOn 𝕜 (I ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ interior (range I)) ∧
        (I.symm ⁻¹' s ∩ interior (range I)).image (I ∘ f ∘ I.symm) ⊆ interior (range I)
      comp := fun {f g u v} hf hg _ _ _ => by
        simp only [] at hf hg ⊢
        have comp : I ∘ (g ∘ f) ∘ I.symm = (I ∘ g ∘ I.symm) ∘ I ∘ f ∘ I.symm := by ext x; simp
        apply And.intro
        · simp only [comp, preimage_inter]
          refine hg.left.comp (hf.left.mono ?_) ?_
          · simp only [subset_inter_iff, inter_subset_right]
            rw [inter_assoc]
            simp
          · intro x hx
            apply And.intro
            · rw [mem_preimage, comp_apply, I.left_inv]
              exact hx.left.right
            · apply hf.right
              rw [mem_image]
              exact ⟨x, ⟨⟨hx.left.left, hx.right⟩, rfl⟩⟩
        · simp only [comp]
          rw [image_comp]
          intro x hx
          rw [mem_image] at hx
          

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
f g : H → H
u v : Set H
hf :
  AnalyticOn 𝕜 (↑I ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ∧
    ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' u ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
hg :
  AnalyticOn 𝕜 (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ∧
    ↑I ∘ g ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' v ∩ interior (range ↑I)) ⊆
      interior (range ↑I)
x✝² : IsOpen u
x✝¹ : IsOpen v
x✝ : IsOpen (u ∩ f ⁻¹' v)
comp :
  ↑I ∘ (g ∘ f) ∘ ↑(ModelWithCorners.symm I) =
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) ∘ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I)
x : E
hx :
  ∃ x_1 ∈ ↑I ∘ f ∘ ↑(ModelWithCorners.symm I) '' (↑(ModelWithCorners.symm I) ⁻¹' (u ∩ f ⁻¹' v) ∩ interior (range ↑I)),
    (↑I ∘ g ∘ ↑(ModelWithCorners.symm I)) x_1 = x
⊢ x ∈ interior (range ↑I)

Next tactic:
rcases hx with ⟨x', hx'⟩