l3lab/ntp-mathlib huggingface dataset:
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := 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
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
⊢ property PG (↑e) e.source

Next tactic:
refine' PG.locality e.open_source fun x xu ↦ _
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      

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
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
x : H
xu : x ∈ e.source
⊢ ∃ v, IsOpen v ∧ x ∈ v ∧ property PG (↑e) (e.source ∩ v)

Next tactic:
rcases he x xu with ⟨s, s_open, xs, hs⟩
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      rcases he x xu with ⟨s, s_open, xs, hs⟩
      

Proof state:
case left.intro.intro.intro
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
x : H
xu : x ∈ e.source
s : Set H
s_open : IsOpen s
xs : x ∈ s
hs : PartialHomeomorph.restr e s ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
⊢ ∃ v, IsOpen v ∧ x ∈ v ∧ property PG (↑e) (e.source ∩ v)

Next tactic:
refine' ⟨s, s_open, xs, _⟩
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      rcases he x xu with ⟨s, s_open, xs, hs⟩
      refine' ⟨s, s_open, xs, _⟩
      

Proof state:
case left.intro.intro.intro
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
x : H
xu : x ∈ e.source
s : Set H
s_open : IsOpen s
xs : x ∈ s
hs : PartialHomeomorph.restr e s ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
⊢ property PG (↑e) (e.source ∩ s)

Next tactic:
convert hs.1 using 1
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      rcases he x xu with ⟨s, s_open, xs, hs⟩
      refine' ⟨s, s_open, xs, _⟩
      convert hs.1 using 1
      

Proof state:
case h.e'_5
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
x : H
xu : x ∈ e.source
s : Set H
s_open : IsOpen s
xs : x ∈ s
hs : PartialHomeomorph.restr e s ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
⊢ e.source ∩ s = (PartialHomeomorph.restr e s).toPartialEquiv.source

Next tactic:
dsimp [PartialHomeomorph.restr]
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      rcases he x xu with ⟨s, s_open, xs, hs⟩
      refine' ⟨s, s_open, xs, _⟩
      convert hs.1 using 1
      dsimp [PartialHomeomorph.restr]
      

Proof state:
case h.e'_5
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
x : H
xu : x ∈ e.source
s : Set H
s_open : IsOpen s
xs : x ∈ s
hs : PartialHomeomorph.restr e s ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
⊢ e.source ∩ s = e.source ∩ interior s

Next tactic:
rw [s_open.interior_eq]
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      rcases he x xu with ⟨s, s_open, xs, hs⟩
      refine' ⟨s, s_open, xs, _⟩
      convert hs.1 using 1
      dsimp [PartialHomeomorph.restr]
      rw [s_open.interior_eq]
    · 

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
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
⊢ property PG (↑(PartialHomeomorph.symm e)) e.target

Next tactic:
refine' PG.locality e.open_target fun x xu ↦ _
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      rcases he x xu with ⟨s, s_open, xs, hs⟩
      refine' ⟨s, s_open, xs, _⟩
      convert hs.1 using 1
      dsimp [PartialHomeomorph.restr]
      rw [s_open.interior_eq]
    · refine' PG.locality e.open_target fun x xu ↦ _
      

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
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
x : H
xu : x ∈ e.target
⊢ ∃ v, IsOpen v ∧ x ∈ v ∧ property PG (↑(PartialHomeomorph.symm e)) (e.target ∩ v)

Next tactic:
rcases he (e.symm x) (e.map_target xu) with ⟨s, s_open, xs, hs⟩
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      rcases he x xu with ⟨s, s_open, xs, hs⟩
      refine' ⟨s, s_open, xs, _⟩
      convert hs.1 using 1
      dsimp [PartialHomeomorph.restr]
      rw [s_open.interior_eq]
    · refine' PG.locality e.open_target fun x xu ↦ _
      rcases he (e.symm x) (e.map_target xu) with ⟨s, s_open, xs, hs⟩
      

Proof state:
case right.intro.intro.intro
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
x : H
xu : x ∈ e.target
s : Set H
s_open : IsOpen s
xs : ↑(PartialHomeomorph.symm e) x ∈ s
hs : PartialHomeomorph.restr e s ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
⊢ ∃ v, IsOpen v ∧ x ∈ v ∧ property PG (↑(PartialHomeomorph.symm e)) (e.target ∩ v)

Next tactic:
refine' ⟨e.target ∩ e.symm ⁻¹' s, _, ⟨xu, xs⟩, _⟩
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      rcases he x xu with ⟨s, s_open, xs, hs⟩
      refine' ⟨s, s_open, xs, _⟩
      convert hs.1 using 1
      dsimp [PartialHomeomorph.restr]
      rw [s_open.interior_eq]
    · refine' PG.locality e.open_target fun x xu ↦ _
      rcases he (e.symm x) (e.map_target xu) with ⟨s, s_open, xs, hs⟩
      refine' ⟨e.target ∩ e.symm ⁻¹' s, _, ⟨xu, xs⟩, _⟩
      · 

Proof state:
case right.intro.intro.intro.refine'_1
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
x : H
xu : x ∈ e.target
s : Set H
s_open : IsOpen s
xs : ↑(PartialHomeomorph.symm e) x ∈ s
hs : PartialHomeomorph.restr e s ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
⊢ IsOpen (e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' s)

Next tactic:
exact ContinuousOn.isOpen_inter_preimage e.continuousOn_invFun e.open_target s_open
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      rcases he x xu with ⟨s, s_open, xs, hs⟩
      refine' ⟨s, s_open, xs, _⟩
      convert hs.1 using 1
      dsimp [PartialHomeomorph.restr]
      rw [s_open.interior_eq]
    · refine' PG.locality e.open_target fun x xu ↦ _
      rcases he (e.symm x) (e.map_target xu) with ⟨s, s_open, xs, hs⟩
      refine' ⟨e.target ∩ e.symm ⁻¹' s, _, ⟨xu, xs⟩, _⟩
      · exact ContinuousOn.isOpen_inter_preimage e.continuousOn_invFun e.open_target s_open
      · 

Proof state:
case right.intro.intro.intro.refine'_2
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
x : H
xu : x ∈ e.target
s : Set H
s_open : IsOpen s
xs : ↑(PartialHomeomorph.symm e) x ∈ s
hs : PartialHomeomorph.restr e s ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
⊢ property PG (↑(PartialHomeomorph.symm e)) (e.target ∩ (e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' s))

Next tactic:
rw [← inter_assoc, inter_self]
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      rcases he x xu with ⟨s, s_open, xs, hs⟩
      refine' ⟨s, s_open, xs, _⟩
      convert hs.1 using 1
      dsimp [PartialHomeomorph.restr]
      rw [s_open.interior_eq]
    · refine' PG.locality e.open_target fun x xu ↦ _
      rcases he (e.symm x) (e.map_target xu) with ⟨s, s_open, xs, hs⟩
      refine' ⟨e.target ∩ e.symm ⁻¹' s, _, ⟨xu, xs⟩, _⟩
      · exact ContinuousOn.isOpen_inter_preimage e.continuousOn_invFun e.open_target s_open
      · rw [← inter_assoc, inter_self]
        

Proof state:
case right.intro.intro.intro.refine'_2
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
x : H
xu : x ∈ e.target
s : Set H
s_open : IsOpen s
xs : ↑(PartialHomeomorph.symm e) x ∈ s
hs : PartialHomeomorph.restr e s ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
⊢ property PG (↑(PartialHomeomorph.symm e)) (e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' s)

Next tactic:
convert hs.2 using 1
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      rcases he x xu with ⟨s, s_open, xs, hs⟩
      refine' ⟨s, s_open, xs, _⟩
      convert hs.1 using 1
      dsimp [PartialHomeomorph.restr]
      rw [s_open.interior_eq]
    · refine' PG.locality e.open_target fun x xu ↦ _
      rcases he (e.symm x) (e.map_target xu) with ⟨s, s_open, xs, hs⟩
      refine' ⟨e.target ∩ e.symm ⁻¹' s, _, ⟨xu, xs⟩, _⟩
      · exact ContinuousOn.isOpen_inter_preimage e.continuousOn_invFun e.open_target s_open
      · rw [← inter_assoc, inter_self]
        convert hs.2 using 1
        

Proof state:
case h.e'_5
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
x : H
xu : x ∈ e.target
s : Set H
s_open : IsOpen s
xs : ↑(PartialHomeomorph.symm e) x ∈ s
hs : PartialHomeomorph.restr e s ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
⊢ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' s = (PartialHomeomorph.restr e s).toPartialEquiv.target

Next tactic:
dsimp [PartialHomeomorph.restr]
/-- Construct a groupoid of local homeos for which the map and its inverse have some property,
from a pregroupoid asserting that this property is stable under composition. -/
def Pregroupoid.groupoid (PG : Pregroupoid H) : StructureGroupoid H where
  members := { e : PartialHomeomorph H H | PG.property e e.source ∧ PG.property e.symm e.target }
  trans' e e' he he' := by
    constructor
    · apply PG.comp he.1 he'.1 e.open_source e'.open_source
      apply e.continuousOn_toFun.isOpen_inter_preimage e.open_source e'.open_source
    · apply PG.comp he'.2 he.2 e'.open_target e.open_target
      apply e'.continuousOn_invFun.isOpen_inter_preimage e'.open_target e.open_target
  symm' e he := ⟨he.2, he.1⟩
  id_mem' := ⟨PG.id_mem, PG.id_mem⟩
  locality' e he := by
    constructor
    · refine' PG.locality e.open_source fun x xu ↦ _
      rcases he x xu with ⟨s, s_open, xs, hs⟩
      refine' ⟨s, s_open, xs, _⟩
      convert hs.1 using 1
      dsimp [PartialHomeomorph.restr]
      rw [s_open.interior_eq]
    · refine' PG.locality e.open_target fun x xu ↦ _
      rcases he (e.symm x) (e.map_target xu) with ⟨s, s_open, xs, hs⟩
      refine' ⟨e.target ∩ e.symm ⁻¹' s, _, ⟨xu, xs⟩, _⟩
      · exact ContinuousOn.isOpen_inter_preimage e.continuousOn_invFun e.open_target s_open
      · rw [← inter_assoc, inter_self]
        convert hs.2 using 1
        dsimp [PartialHomeomorph.restr]
        

Proof state:
case h.e'_5
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
PG : Pregroupoid H
e : PartialHomeomorph H H
he :
  ∀ x ∈ e.source,
    ∃ s,
      IsOpen s ∧
        x ∈ s ∧
          PartialHomeomorph.restr e s ∈
            {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
x : H
xu : x ∈ e.target
s : Set H
s_open : IsOpen s
xs : ↑(PartialHomeomorph.symm e) x ∈ s
hs : PartialHomeomorph.restr e s ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
⊢ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' s = e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' interior s

Next tactic:
rw [s_open.interior_eq]