l3lab/ntp-mathlib huggingface dataset:
/-- The composition of structomorphisms is a structomorphism. -/
def Structomorph.trans (e : Structomorph G M M') (e' : Structomorph G M' M'') :
    Structomorph G M M'' :=
  { Homeomorph.trans e.toHomeomorph e'.toHomeomorph with
    mem_groupoid := by
      /- Let c and c' be two charts in M and M''. We want to show that e' ∘ e is smooth in these
      charts, around any point x. For this, let y = e (c⁻¹ x), and consider a chart g around y.
      Then g ∘ e ∘ c⁻¹ and c' ∘ e' ∘ g⁻¹ are both smooth as e and e' are structomorphisms, so
      their composition is smooth, and it coincides with c' ∘ e' ∘ e ∘ c⁻¹ around x. -/
      intro c c' hc hc'
      refine' G.locality fun x hx ↦ _
      let f₁ := e.toHomeomorph.toPartialHomeomorph
      let f₂ := e'.toHomeomorph.toPartialHomeomorph
      let f := (e.toHomeomorph.trans e'.toHomeomorph).toPartialHomeomorph
      have feq : f = f₁ ≫ₕ f₂ := Homeomorph.trans_toPartialHomeomorph _ _
      -- define the atlas g around y
      let y := (c.symm ≫ₕ f₁) x
      let g := chartAt (H := H) y
      have hg₁ := chart_mem_atlas (H := H) y
      have hg₂ := mem_chart_source (H := H) y
      let s := (c.symm ≫ₕ f₁).source ∩ c.symm ≫ₕ f₁ ⁻¹' g.source
      have open_s : IsOpen s := by
        apply (c.symm ≫ₕ f₁).continuousOn_toFun.isOpen_inter_preimage <;> apply open_source
      

Proof state:
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace M'
inst✝² : TopologicalSpace M''
G : StructureGroupoid H
inst✝¹ : ChartedSpace H M'
inst✝ : ChartedSpace H M''
e : Structomorph G M M'
e' : Structomorph G M' M''
src✝ : M ≃ₜ M'' := Homeomorph.trans e.toHomeomorph e'.toHomeomorph
c : PartialHomeomorph M H
c' : PartialHomeomorph M'' H
hc : c ∈ atlas H M
hc' : c' ∈ atlas H M''
x : H
hx :
  x ∈
    (PartialHomeomorph.symm c ≫ₕ
          Homeomorph.toPartialHomeomorph (Homeomorph.mk src✝.toEquiv) ≫ₕ c').toPartialEquiv.source
f₁ : PartialHomeomorph M M' := Homeomorph.toPartialHomeomorph e.toHomeomorph
f₂ : PartialHomeomorph M' M'' := Homeomorph.toPartialHomeomorph e'.toHomeomorph
f : PartialHomeomorph M M'' := Homeomorph.toPartialHomeomorph (Homeomorph.trans e.toHomeomorph e'.toHomeomorph)
feq : f = f₁ ≫ₕ f₂
y : M' := ↑(PartialHomeomorph.symm c ≫ₕ f₁) x
g : PartialHomeomorph M' H := chartAt H y
hg₁ : chartAt H y ∈ atlas H M'
hg₂ : y ∈ (chartAt H y).toPartialEquiv.source
s : Set H := (PartialHomeomorph.symm c ≫ₕ f₁).toPartialEquiv.source ∩ ↑(PartialHomeomorph.symm c ≫ₕ f₁) ⁻¹' g.source
open_s : IsOpen s
⊢ ∃ s,
    IsOpen s ∧
      x ∈ s ∧
        PartialHomeomorph.restr
            (PartialHomeomorph.symm c ≫ₕ Homeomorph.toPartialHomeomorph (Homeomorph.mk src✝.toEquiv) ≫ₕ c') s ∈
          G

Next tactic:
have : x ∈ s := by
        constructor
        · simp only [trans_source, preimage_univ, inter_univ, Homeomorph.toPartialHomeomorph_source]
          rw [trans_source] at hx
          exact hx.1
        · exact hg₂
/-- The composition of structomorphisms is a structomorphism. -/
def Structomorph.trans (e : Structomorph G M M') (e' : Structomorph G M' M'') :
    Structomorph G M M'' :=
  { Homeomorph.trans e.toHomeomorph e'.toHomeomorph with
    mem_groupoid := by
      /- Let c and c' be two charts in M and M''. We want to show that e' ∘ e is smooth in these
      charts, around any point x. For this, let y = e (c⁻¹ x), and consider a chart g around y.
      Then g ∘ e ∘ c⁻¹ and c' ∘ e' ∘ g⁻¹ are both smooth as e and e' are structomorphisms, so
      their composition is smooth, and it coincides with c' ∘ e' ∘ e ∘ c⁻¹ around x. -/
      intro c c' hc hc'
      refine' G.locality fun x hx ↦ _
      let f₁ := e.toHomeomorph.toPartialHomeomorph
      let f₂ := e'.toHomeomorph.toPartialHomeomorph
      let f := (e.toHomeomorph.trans e'.toHomeomorph).toPartialHomeomorph
      have feq : f = f₁ ≫ₕ f₂ := Homeomorph.trans_toPartialHomeomorph _ _
      -- define the atlas g around y
      let y := (c.symm ≫ₕ f₁) x
      let g := chartAt (H := H) y
      have hg₁ := chart_mem_atlas (H := H) y
      have hg₂ := mem_chart_source (H := H) y
      let s := (c.symm ≫ₕ f₁).source ∩ c.symm ≫ₕ f₁ ⁻¹' g.source
      have open_s : IsOpen s := by
        apply (c.symm ≫ₕ f₁).continuousOn_toFun.isOpen_inter_preimage <;> apply open_source
      have : x ∈ s := by
        

Proof state:
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace M'
inst✝² : TopologicalSpace M''
G : StructureGroupoid H
inst✝¹ : ChartedSpace H M'
inst✝ : ChartedSpace H M''
e : Structomorph G M M'
e' : Structomorph G M' M''
src✝ : M ≃ₜ M'' := Homeomorph.trans e.toHomeomorph e'.toHomeomorph
c : PartialHomeomorph M H
c' : PartialHomeomorph M'' H
hc : c ∈ atlas H M
hc' : c' ∈ atlas H M''
x : H
hx :
  x ∈
    (PartialHomeomorph.symm c ≫ₕ
          Homeomorph.toPartialHomeomorph (Homeomorph.mk src✝.toEquiv) ≫ₕ c').toPartialEquiv.source
f₁ : PartialHomeomorph M M' := Homeomorph.toPartialHomeomorph e.toHomeomorph
f₂ : PartialHomeomorph M' M'' := Homeomorph.toPartialHomeomorph e'.toHomeomorph
f : PartialHomeomorph M M'' := Homeomorph.toPartialHomeomorph (Homeomorph.trans e.toHomeomorph e'.toHomeomorph)
feq : f = f₁ ≫ₕ f₂
y : M' := ↑(PartialHomeomorph.symm c ≫ₕ f₁) x
g : PartialHomeomorph M' H := chartAt H y
hg₁ : chartAt H y ∈ atlas H M'
hg₂ : y ∈ (chartAt H y).toPartialEquiv.source
s : Set H := (PartialHomeomorph.symm c ≫ₕ f₁).toPartialEquiv.source ∩ ↑(PartialHomeomorph.symm c ≫ₕ f₁) ⁻¹' g.source
open_s : IsOpen s
⊢ x ∈ s

Next tactic:
constructor
/-- The composition of structomorphisms is a structomorphism. -/
def Structomorph.trans (e : Structomorph G M M') (e' : Structomorph G M' M'') :
    Structomorph G M M'' :=
  { Homeomorph.trans e.toHomeomorph e'.toHomeomorph with
    mem_groupoid := by
      /- Let c and c' be two charts in M and M''. We want to show that e' ∘ e is smooth in these
      charts, around any point x. For this, let y = e (c⁻¹ x), and consider a chart g around y.
      Then g ∘ e ∘ c⁻¹ and c' ∘ e' ∘ g⁻¹ are both smooth as e and e' are structomorphisms, so
      their composition is smooth, and it coincides with c' ∘ e' ∘ e ∘ c⁻¹ around x. -/
      intro c c' hc hc'
      refine' G.locality fun x hx ↦ _
      let f₁ := e.toHomeomorph.toPartialHomeomorph
      let f₂ := e'.toHomeomorph.toPartialHomeomorph
      let f := (e.toHomeomorph.trans e'.toHomeomorph).toPartialHomeomorph
      have feq : f = f₁ ≫ₕ f₂ := Homeomorph.trans_toPartialHomeomorph _ _
      -- define the atlas g around y
      let y := (c.symm ≫ₕ f₁) x
      let g := chartAt (H := H) y
      have hg₁ := chart_mem_atlas (H := H) y
      have hg₂ := mem_chart_source (H := H) y
      let s := (c.symm ≫ₕ f₁).source ∩ c.symm ≫ₕ f₁ ⁻¹' g.source
      have open_s : IsOpen s := by
        apply (c.symm ≫ₕ f₁).continuousOn_toFun.isOpen_inter_preimage <;> apply open_source
      have : x ∈ s := by
        constructor
        · 

Proof state:
case left
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace M'
inst✝² : TopologicalSpace M''
G : StructureGroupoid H
inst✝¹ : ChartedSpace H M'
inst✝ : ChartedSpace H M''
e : Structomorph G M M'
e' : Structomorph G M' M''
src✝ : M ≃ₜ M'' := Homeomorph.trans e.toHomeomorph e'.toHomeomorph
c : PartialHomeomorph M H
c' : PartialHomeomorph M'' H
hc : c ∈ atlas H M
hc' : c' ∈ atlas H M''
x : H
hx :
  x ∈
    (PartialHomeomorph.symm c ≫ₕ
          Homeomorph.toPartialHomeomorph (Homeomorph.mk src✝.toEquiv) ≫ₕ c').toPartialEquiv.source
f₁ : PartialHomeomorph M M' := Homeomorph.toPartialHomeomorph e.toHomeomorph
f₂ : PartialHomeomorph M' M'' := Homeomorph.toPartialHomeomorph e'.toHomeomorph
f : PartialHomeomorph M M'' := Homeomorph.toPartialHomeomorph (Homeomorph.trans e.toHomeomorph e'.toHomeomorph)
feq : f = f₁ ≫ₕ f₂
y : M' := ↑(PartialHomeomorph.symm c ≫ₕ f₁) x
g : PartialHomeomorph M' H := chartAt H y
hg₁ : chartAt H y ∈ atlas H M'
hg₂ : y ∈ (chartAt H y).toPartialEquiv.source
s : Set H := (PartialHomeomorph.symm c ≫ₕ f₁).toPartialEquiv.source ∩ ↑(PartialHomeomorph.symm c ≫ₕ f₁) ⁻¹' g.source
open_s : IsOpen s
⊢ x ∈ (PartialHomeomorph.symm c ≫ₕ f₁).toPartialEquiv.source

Next tactic:
simp only [trans_source, preimage_univ, inter_univ, Homeomorph.toPartialHomeomorph_source]
/-- The composition of structomorphisms is a structomorphism. -/
def Structomorph.trans (e : Structomorph G M M') (e' : Structomorph G M' M'') :
    Structomorph G M M'' :=
  { Homeomorph.trans e.toHomeomorph e'.toHomeomorph with
    mem_groupoid := by
      /- Let c and c' be two charts in M and M''. We want to show that e' ∘ e is smooth in these
      charts, around any point x. For this, let y = e (c⁻¹ x), and consider a chart g around y.
      Then g ∘ e ∘ c⁻¹ and c' ∘ e' ∘ g⁻¹ are both smooth as e and e' are structomorphisms, so
      their composition is smooth, and it coincides with c' ∘ e' ∘ e ∘ c⁻¹ around x. -/
      intro c c' hc hc'
      refine' G.locality fun x hx ↦ _
      let f₁ := e.toHomeomorph.toPartialHomeomorph
      let f₂ := e'.toHomeomorph.toPartialHomeomorph
      let f := (e.toHomeomorph.trans e'.toHomeomorph).toPartialHomeomorph
      have feq : f = f₁ ≫ₕ f₂ := Homeomorph.trans_toPartialHomeomorph _ _
      -- define the atlas g around y
      let y := (c.symm ≫ₕ f₁) x
      let g := chartAt (H := H) y
      have hg₁ := chart_mem_atlas (H := H) y
      have hg₂ := mem_chart_source (H := H) y
      let s := (c.symm ≫ₕ f₁).source ∩ c.symm ≫ₕ f₁ ⁻¹' g.source
      have open_s : IsOpen s := by
        apply (c.symm ≫ₕ f₁).continuousOn_toFun.isOpen_inter_preimage <;> apply open_source
      have : x ∈ s := by
        constructor
        · simp only [trans_source, preimage_univ, inter_univ, Homeomorph.toPartialHomeomorph_source]
          

Proof state:
case left
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace M'
inst✝² : TopologicalSpace M''
G : StructureGroupoid H
inst✝¹ : ChartedSpace H M'
inst✝ : ChartedSpace H M''
e : Structomorph G M M'
e' : Structomorph G M' M''
src✝ : M ≃ₜ M'' := Homeomorph.trans e.toHomeomorph e'.toHomeomorph
c : PartialHomeomorph M H
c' : PartialHomeomorph M'' H
hc : c ∈ atlas H M
hc' : c' ∈ atlas H M''
x : H
hx :
  x ∈
    (PartialHomeomorph.symm c ≫ₕ
          Homeomorph.toPartialHomeomorph (Homeomorph.mk src✝.toEquiv) ≫ₕ c').toPartialEquiv.source
f₁ : PartialHomeomorph M M' := Homeomorph.toPartialHomeomorph e.toHomeomorph
f₂ : PartialHomeomorph M' M'' := Homeomorph.toPartialHomeomorph e'.toHomeomorph
f : PartialHomeomorph M M'' := Homeomorph.toPartialHomeomorph (Homeomorph.trans e.toHomeomorph e'.toHomeomorph)
feq : f = f₁ ≫ₕ f₂
y : M' := ↑(PartialHomeomorph.symm c ≫ₕ f₁) x
g : PartialHomeomorph M' H := chartAt H y
hg₁ : chartAt H y ∈ atlas H M'
hg₂ : y ∈ (chartAt H y).toPartialEquiv.source
s : Set H := (PartialHomeomorph.symm c ≫ₕ f₁).toPartialEquiv.source ∩ ↑(PartialHomeomorph.symm c ≫ₕ f₁) ⁻¹' g.source
open_s : IsOpen s
⊢ x ∈ (PartialHomeomorph.symm c).toPartialEquiv.source

Next tactic:
rw [trans_source] at hx
/-- The composition of structomorphisms is a structomorphism. -/
def Structomorph.trans (e : Structomorph G M M') (e' : Structomorph G M' M'') :
    Structomorph G M M'' :=
  { Homeomorph.trans e.toHomeomorph e'.toHomeomorph with
    mem_groupoid := by
      /- Let c and c' be two charts in M and M''. We want to show that e' ∘ e is smooth in these
      charts, around any point x. For this, let y = e (c⁻¹ x), and consider a chart g around y.
      Then g ∘ e ∘ c⁻¹ and c' ∘ e' ∘ g⁻¹ are both smooth as e and e' are structomorphisms, so
      their composition is smooth, and it coincides with c' ∘ e' ∘ e ∘ c⁻¹ around x. -/
      intro c c' hc hc'
      refine' G.locality fun x hx ↦ _
      let f₁ := e.toHomeomorph.toPartialHomeomorph
      let f₂ := e'.toHomeomorph.toPartialHomeomorph
      let f := (e.toHomeomorph.trans e'.toHomeomorph).toPartialHomeomorph
      have feq : f = f₁ ≫ₕ f₂ := Homeomorph.trans_toPartialHomeomorph _ _
      -- define the atlas g around y
      let y := (c.symm ≫ₕ f₁) x
      let g := chartAt (H := H) y
      have hg₁ := chart_mem_atlas (H := H) y
      have hg₂ := mem_chart_source (H := H) y
      let s := (c.symm ≫ₕ f₁).source ∩ c.symm ≫ₕ f₁ ⁻¹' g.source
      have open_s : IsOpen s := by
        apply (c.symm ≫ₕ f₁).continuousOn_toFun.isOpen_inter_preimage <;> apply open_source
      have : x ∈ s := by
        constructor
        · simp only [trans_source, preimage_univ, inter_univ, Homeomorph.toPartialHomeomorph_source]
          rw [trans_source] at hx
          

Proof state:
case left
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace M'
inst✝² : TopologicalSpace M''
G : StructureGroupoid H
inst✝¹ : ChartedSpace H M'
inst✝ : ChartedSpace H M''
e : Structomorph G M M'
e' : Structomorph G M' M''
src✝ : M ≃ₜ M'' := Homeomorph.trans e.toHomeomorph e'.toHomeomorph
c : PartialHomeomorph M H
c' : PartialHomeomorph M'' H
hc : c ∈ atlas H M
hc' : c' ∈ atlas H M''
x : H
hx :
  x ∈
    (PartialHomeomorph.symm c).toPartialEquiv.source ∩
      ↑(PartialHomeomorph.symm c) ⁻¹'
        (Homeomorph.toPartialHomeomorph (Homeomorph.mk src✝.toEquiv) ≫ₕ c').toPartialEquiv.source
f₁ : PartialHomeomorph M M' := Homeomorph.toPartialHomeomorph e.toHomeomorph
f₂ : PartialHomeomorph M' M'' := Homeomorph.toPartialHomeomorph e'.toHomeomorph
f : PartialHomeomorph M M'' := Homeomorph.toPartialHomeomorph (Homeomorph.trans e.toHomeomorph e'.toHomeomorph)
feq : f = f₁ ≫ₕ f₂
y : M' := ↑(PartialHomeomorph.symm c ≫ₕ f₁) x
g : PartialHomeomorph M' H := chartAt H y
hg₁ : chartAt H y ∈ atlas H M'
hg₂ : y ∈ (chartAt H y).toPartialEquiv.source
s : Set H := (PartialHomeomorph.symm c ≫ₕ f₁).toPartialEquiv.source ∩ ↑(PartialHomeomorph.symm c ≫ₕ f₁) ⁻¹' g.source
open_s : IsOpen s
⊢ x ∈ (PartialHomeomorph.symm c).toPartialEquiv.source

Next tactic:
exact hx.1
/-- The composition of structomorphisms is a structomorphism. -/
def Structomorph.trans (e : Structomorph G M M') (e' : Structomorph G M' M'') :
    Structomorph G M M'' :=
  { Homeomorph.trans e.toHomeomorph e'.toHomeomorph with
    mem_groupoid := by
      /- Let c and c' be two charts in M and M''. We want to show that e' ∘ e is smooth in these
      charts, around any point x. For this, let y = e (c⁻¹ x), and consider a chart g around y.
      Then g ∘ e ∘ c⁻¹ and c' ∘ e' ∘ g⁻¹ are both smooth as e and e' are structomorphisms, so
      their composition is smooth, and it coincides with c' ∘ e' ∘ e ∘ c⁻¹ around x. -/
      intro c c' hc hc'
      refine' G.locality fun x hx ↦ _
      let f₁ := e.toHomeomorph.toPartialHomeomorph
      let f₂ := e'.toHomeomorph.toPartialHomeomorph
      let f := (e.toHomeomorph.trans e'.toHomeomorph).toPartialHomeomorph
      have feq : f = f₁ ≫ₕ f₂ := Homeomorph.trans_toPartialHomeomorph _ _
      -- define the atlas g around y
      let y := (c.symm ≫ₕ f₁) x
      let g := chartAt (H := H) y
      have hg₁ := chart_mem_atlas (H := H) y
      have hg₂ := mem_chart_source (H := H) y
      let s := (c.symm ≫ₕ f₁).source ∩ c.symm ≫ₕ f₁ ⁻¹' g.source
      have open_s : IsOpen s := by
        apply (c.symm ≫ₕ f₁).continuousOn_toFun.isOpen_inter_preimage <;> apply open_source
      have : x ∈ s := by
        constructor
        · simp only [trans_source, preimage_univ, inter_univ, Homeomorph.toPartialHomeomorph_source]
          rw [trans_source] at hx
          exact hx.1
        · 

Proof state:
case right
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace M'
inst✝² : TopologicalSpace M''
G : StructureGroupoid H
inst✝¹ : ChartedSpace H M'
inst✝ : ChartedSpace H M''
e : Structomorph G M M'
e' : Structomorph G M' M''
src✝ : M ≃ₜ M'' := Homeomorph.trans e.toHomeomorph e'.toHomeomorph
c : PartialHomeomorph M H
c' : PartialHomeomorph M'' H
hc : c ∈ atlas H M
hc' : c' ∈ atlas H M''
x : H
hx :
  x ∈
    (PartialHomeomorph.symm c ≫ₕ
          Homeomorph.toPartialHomeomorph (Homeomorph.mk src✝.toEquiv) ≫ₕ c').toPartialEquiv.source
f₁ : PartialHomeomorph M M' := Homeomorph.toPartialHomeomorph e.toHomeomorph
f₂ : PartialHomeomorph M' M'' := Homeomorph.toPartialHomeomorph e'.toHomeomorph
f : PartialHomeomorph M M'' := Homeomorph.toPartialHomeomorph (Homeomorph.trans e.toHomeomorph e'.toHomeomorph)
feq : f = f₁ ≫ₕ f₂
y : M' := ↑(PartialHomeomorph.symm c ≫ₕ f₁) x
g : PartialHomeomorph M' H := chartAt H y
hg₁ : chartAt H y ∈ atlas H M'
hg₂ : y ∈ (chartAt H y).toPartialEquiv.source
s : Set H := (PartialHomeomorph.symm c ≫ₕ f₁).toPartialEquiv.source ∩ ↑(PartialHomeomorph.symm c ≫ₕ f₁) ⁻¹' g.source
open_s : IsOpen s
⊢ x ∈ ↑(PartialHomeomorph.symm c ≫ₕ f₁) ⁻¹' g.source

Next tactic:
exact hg₂
/-- The composition of structomorphisms is a structomorphism. -/
def Structomorph.trans (e : Structomorph G M M') (e' : Structomorph G M' M'') :
    Structomorph G M M'' :=
  { Homeomorph.trans e.toHomeomorph e'.toHomeomorph with
    mem_groupoid := by
      /- Let c and c' be two charts in M and M''. We want to show that e' ∘ e is smooth in these
      charts, around any point x. For this, let y = e (c⁻¹ x), and consider a chart g around y.
      Then g ∘ e ∘ c⁻¹ and c' ∘ e' ∘ g⁻¹ are both smooth as e and e' are structomorphisms, so
      their composition is smooth, and it coincides with c' ∘ e' ∘ e ∘ c⁻¹ around x. -/
      intro c c' hc hc'
      refine' G.locality fun x hx ↦ _
      let f₁ := e.toHomeomorph.toPartialHomeomorph
      let f₂ := e'.toHomeomorph.toPartialHomeomorph
      let f := (e.toHomeomorph.trans e'.toHomeomorph).toPartialHomeomorph
      have feq : f = f₁ ≫ₕ f₂ := Homeomorph.trans_toPartialHomeomorph _ _
      -- define the atlas g around y
      let y := (c.symm ≫ₕ f₁) x
      let g := chartAt (H := H) y
      have hg₁ := chart_mem_atlas (H := H) y
      have hg₂ := mem_chart_source (H := H) y
      let s := (c.symm ≫ₕ f₁).source ∩ c.symm ≫ₕ f₁ ⁻¹' g.source
      have open_s : IsOpen s := by
        apply (c.symm ≫ₕ f₁).continuousOn_toFun.isOpen_inter_preimage <;> apply open_source
      have : x ∈ s := by
        constructor
        · simp only [trans_source, preimage_univ, inter_univ, Homeomorph.toPartialHomeomorph_source]
          rw [trans_source] at hx
          exact hx.1
        · exact hg₂
      

Proof state:
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace M'
inst✝² : TopologicalSpace M''
G : StructureGroupoid H
inst✝¹ : ChartedSpace H M'
inst✝ : ChartedSpace H M''
e : Structomorph G M M'
e' : Structomorph G M' M''
src✝ : M ≃ₜ M'' := Homeomorph.trans e.toHomeomorph e'.toHomeomorph
c : PartialHomeomorph M H
c' : PartialHomeomorph M'' H
hc : c ∈ atlas H M
hc' : c' ∈ atlas H M''
x : H
hx :
  x ∈
    (PartialHomeomorph.symm c ≫ₕ
          Homeomorph.toPartialHomeomorph (Homeomorph.mk src✝.toEquiv) ≫ₕ c').toPartialEquiv.source
f₁ : PartialHomeomorph M M' := Homeomorph.toPartialHomeomorph e.toHomeomorph
f₂ : PartialHomeomorph M' M'' := Homeomorph.toPartialHomeomorph e'.toHomeomorph
f : PartialHomeomorph M M'' := Homeomorph.toPartialHomeomorph (Homeomorph.trans e.toHomeomorph e'.toHomeomorph)
feq : f = f₁ ≫ₕ f₂
y : M' := ↑(PartialHomeomorph.symm c ≫ₕ f₁) x
g : PartialHomeomorph M' H := chartAt H y
hg₁ : chartAt H y ∈ atlas H M'
hg₂ : y ∈ (chartAt H y).toPartialEquiv.source
s : Set H := (PartialHomeomorph.symm c ≫ₕ f₁).toPartialEquiv.source ∩ ↑(PartialHomeomorph.symm c ≫ₕ f₁) ⁻¹' g.source
open_s : IsOpen s
this : x ∈ s
⊢ ∃ s,
    IsOpen s ∧
      x ∈ s ∧
        PartialHomeomorph.restr
            (PartialHomeomorph.symm c ≫ₕ Homeomorph.toPartialHomeomorph (Homeomorph.mk src✝.toEquiv) ≫ₕ c') s ∈
          G

Next tactic:
refine' ⟨s, open_s, this, _⟩
/-- The composition of structomorphisms is a structomorphism. -/
def Structomorph.trans (e : Structomorph G M M') (e' : Structomorph G M' M'') :
    Structomorph G M M'' :=
  { Homeomorph.trans e.toHomeomorph e'.toHomeomorph with
    mem_groupoid := by
      /- Let c and c' be two charts in M and M''. We want to show that e' ∘ e is smooth in these
      charts, around any point x. For this, let y = e (c⁻¹ x), and consider a chart g around y.
      Then g ∘ e ∘ c⁻¹ and c' ∘ e' ∘ g⁻¹ are both smooth as e and e' are structomorphisms, so
      their composition is smooth, and it coincides with c' ∘ e' ∘ e ∘ c⁻¹ around x. -/
      intro c c' hc hc'
      refine' G.locality fun x hx ↦ _
      let f₁ := e.toHomeomorph.toPartialHomeomorph
      let f₂ := e'.toHomeomorph.toPartialHomeomorph
      let f := (e.toHomeomorph.trans e'.toHomeomorph).toPartialHomeomorph
      have feq : f = f₁ ≫ₕ f₂ := Homeomorph.trans_toPartialHomeomorph _ _
      -- define the atlas g around y
      let y := (c.symm ≫ₕ f₁) x
      let g := chartAt (H := H) y
      have hg₁ := chart_mem_atlas (H := H) y
      have hg₂ := mem_chart_source (H := H) y
      let s := (c.symm ≫ₕ f₁).source ∩ c.symm ≫ₕ f₁ ⁻¹' g.source
      have open_s : IsOpen s := by
        apply (c.symm ≫ₕ f₁).continuousOn_toFun.isOpen_inter_preimage <;> apply open_source
      have : x ∈ s := by
        constructor
        · simp only [trans_source, preimage_univ, inter_univ, Homeomorph.toPartialHomeomorph_source]
          rw [trans_source] at hx
          exact hx.1
        · exact hg₂
      refine' ⟨s, open_s, this, _⟩
      

Proof state:
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace M'
inst✝² : TopologicalSpace M''
G : StructureGroupoid H
inst✝¹ : ChartedSpace H M'
inst✝ : ChartedSpace H M''
e : Structomorph G M M'
e' : Structomorph G M' M''
src✝ : M ≃ₜ M'' := Homeomorph.trans e.toHomeomorph e'.toHomeomorph
c : PartialHomeomorph M H
c' : PartialHomeomorph M'' H
hc : c ∈ atlas H M
hc' : c' ∈ atlas H M''
x : H
hx :
  x ∈
    (PartialHomeomorph.symm c ≫ₕ
          Homeomorph.toPartialHomeomorph (Homeomorph.mk src✝.toEquiv) ≫ₕ c').toPartialEquiv.source
f₁ : PartialHomeomorph M M' := Homeomorph.toPartialHomeomorph e.toHomeomorph
f₂ : PartialHomeomorph M' M'' := Homeomorph.toPartialHomeomorph e'.toHomeomorph
f : PartialHomeomorph M M'' := Homeomorph.toPartialHomeomorph (Homeomorph.trans e.toHomeomorph e'.toHomeomorph)
feq : f = f₁ ≫ₕ f₂
y : M' := ↑(PartialHomeomorph.symm c ≫ₕ f₁) x
g : PartialHomeomorph M' H := chartAt H y
hg₁ : chartAt H y ∈ atlas H M'
hg₂ : y ∈ (chartAt H y).toPartialEquiv.source
s : Set H := (PartialHomeomorph.symm c ≫ₕ f₁).toPartialEquiv.source ∩ ↑(PartialHomeomorph.symm c ≫ₕ f₁) ⁻¹' g.source
open_s : IsOpen s
this : x ∈ s
⊢ PartialHomeomorph.restr
      (PartialHomeomorph.symm c ≫ₕ Homeomorph.toPartialHomeomorph (Homeomorph.mk src✝.toEquiv) ≫ₕ c') s ∈
    G

Next tactic:
let F₁ := (c.symm ≫ₕ f₁ ≫ₕ g) ≫ₕ g.symm ≫ₕ f₂ ≫ₕ c'
theorem ext_iff : (∀ i j, M i j = N i j) ↔ M = N :=
  ⟨fun h => funext fun i => funext <| h i, fun h => by 

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
inst✝³ : Fintype l
inst✝² : Fintype m
inst✝¹ : Fintype n
inst✝ : Fintype o
α : m → n → Type v
M N : DMatrix m n α
h : M = N
⊢ ∀ (i : m) (j : n), M i j = N i j

Next tactic:
simp [h]
@[simp]
theorem map_map {M : DMatrix m n α} {β : m → n → Type w} {γ : m → n → Type z}
    {f : ∀ ⦃i j⦄, α i j → β i j} {g : ∀ ⦃i j⦄, β i j → γ i j} :
    (M.map f).map g = M.map fun i j x => g (f x) := by 

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
inst✝³ : Fintype l
inst✝² : Fintype m
inst✝¹ : Fintype n
inst✝ : Fintype o
α : m → n → Type v
M : DMatrix m n α
β : m → n → Type w
γ : m → n → Type z
f : ⦃i : m⦄ → ⦃j : n⦄ → α i j → β i j
g : ⦃i : m⦄ → ⦃j : n⦄ → β i j → γ i j
⊢ map (map M f) g = map M fun i j x => g (f x)

Next tactic:
ext