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
    · 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]
        rw [s_open.interior_eq]
  eq_on_source' e e' he ee' := 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
PG : Pregroupoid H
e e' : PartialHomeomorph H H
he : e ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
ee' : e' ≈ e
⊢ e' ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}

Next tactic:
constructor
/-- 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]
        rw [s_open.interior_eq]
  eq_on_source' e e' he ee' := 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 e' : PartialHomeomorph H H
he : e ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
ee' : e' ≈ e
⊢ property PG (↑e') e'.source

Next tactic:
apply PG.congr e'.open_source ee'.2
/-- 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]
        rw [s_open.interior_eq]
  eq_on_source' e e' he ee' := by
    constructor
    · apply PG.congr e'.open_source ee'.2
      

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 e' : PartialHomeomorph H H
he : e ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
ee' : e' ≈ e
⊢ property PG (fun x => ↑e x) e'.source

Next tactic:
simp only [ee'.1, he.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
        dsimp [PartialHomeomorph.restr]
        rw [s_open.interior_eq]
  eq_on_source' e e' he ee' := by
    constructor
    · apply PG.congr e'.open_source ee'.2
      simp only [ee'.1, he.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
PG : Pregroupoid H
e e' : PartialHomeomorph H H
he : e ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
ee' : e' ≈ e
⊢ property PG (↑(PartialHomeomorph.symm e')) e'.target

Next tactic:
have A := EqOnSource.symm' ee'
/-- 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]
        rw [s_open.interior_eq]
  eq_on_source' e e' he ee' := by
    constructor
    · apply PG.congr e'.open_source ee'.2
      simp only [ee'.1, he.1]
    · have A := EqOnSource.symm' ee'
      

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 e' : PartialHomeomorph H H
he : e ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
ee' : e' ≈ e
A : PartialHomeomorph.symm e' ≈ PartialHomeomorph.symm e
⊢ property PG (↑(PartialHomeomorph.symm e')) e'.target

Next tactic:
apply PG.congr e'.symm.open_source A.2
/-- 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]
        rw [s_open.interior_eq]
  eq_on_source' e e' he ee' := by
    constructor
    · apply PG.congr e'.open_source ee'.2
      simp only [ee'.1, he.1]
    · have A := EqOnSource.symm' ee'
      apply PG.congr e'.symm.open_source A.2
      -- Porting note: was
      -- convert he.2
      -- rw [A.1]
      -- rfl
      

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 e' : PartialHomeomorph H H
he : e ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
ee' : e' ≈ e
A : PartialHomeomorph.symm e' ≈ PartialHomeomorph.symm e
⊢ property PG (fun x => ↑(PartialHomeomorph.symm e) x) (PartialHomeomorph.symm e').toPartialEquiv.source

Next tactic:
rw [A.1, symm_toPartialEquiv, PartialEquiv.symm_source]
/-- 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]
        rw [s_open.interior_eq]
  eq_on_source' e e' he ee' := by
    constructor
    · apply PG.congr e'.open_source ee'.2
      simp only [ee'.1, he.1]
    · have A := EqOnSource.symm' ee'
      apply PG.congr e'.symm.open_source A.2
      -- Porting note: was
      -- convert he.2
      -- rw [A.1]
      -- rfl
      rw [A.1, symm_toPartialEquiv, PartialEquiv.symm_source]
      

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 e' : PartialHomeomorph H H
he : e ∈ {e | property PG (↑e) e.source ∧ property PG (↑(PartialHomeomorph.symm e)) e.target}
ee' : e' ≈ e
A : PartialHomeomorph.symm e' ≈ PartialHomeomorph.symm e
⊢ property PG (fun x => ↑(PartialHomeomorph.symm e) x) e.target

Next tactic:
exact he.2
theorem groupoid_of_pregroupoid_le (PG₁ PG₂ : Pregroupoid H)
    (h : ∀ f s, PG₁.property f s → PG₂.property f s) : PG₁.groupoid ≤ PG₂.groupoid := 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
PG₁ PG₂ : Pregroupoid H
h : ∀ (f : H → H) (s : Set H), Pregroupoid.property PG₁ f s → Pregroupoid.property PG₂ f s
⊢ Pregroupoid.groupoid PG₁ ≤ Pregroupoid.groupoid PG₂

Next tactic:
refine' StructureGroupoid.le_iff.2 fun e he ↦ _
theorem groupoid_of_pregroupoid_le (PG₁ PG₂ : Pregroupoid H)
    (h : ∀ f s, PG₁.property f s → PG₂.property f s) : PG₁.groupoid ≤ PG₂.groupoid := by
  refine' StructureGroupoid.le_iff.2 fun e he ↦ _
  

Proof state:
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
PG₁ PG₂ : Pregroupoid H
h : ∀ (f : H → H) (s : Set H), Pregroupoid.property PG₁ f s → Pregroupoid.property PG₂ f s
e : PartialHomeomorph H H
he : e ∈ Pregroupoid.groupoid PG₁
⊢ e ∈ Pregroupoid.groupoid PG₂

Next tactic:
rw [mem_groupoid_of_pregroupoid] at he ⊢
theorem groupoid_of_pregroupoid_le (PG₁ PG₂ : Pregroupoid H)
    (h : ∀ f s, PG₁.property f s → PG₂.property f s) : PG₁.groupoid ≤ PG₂.groupoid := by
  refine' StructureGroupoid.le_iff.2 fun e he ↦ _
  rw [mem_groupoid_of_pregroupoid] at he ⊢
  

Proof state:
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
PG₁ PG₂ : Pregroupoid H
h : ∀ (f : H → H) (s : Set H), Pregroupoid.property PG₁ f s → Pregroupoid.property PG₂ f s
e : PartialHomeomorph H H
he : Pregroupoid.property PG₁ (↑e) e.source ∧ Pregroupoid.property PG₁ (↑(PartialHomeomorph.symm e)) e.target
⊢ Pregroupoid.property PG₂ (↑e) e.source ∧ Pregroupoid.property PG₂ (↑(PartialHomeomorph.symm e)) e.target

Next tactic:
exact ⟨h _ _ he.1, h _ _ he.2⟩
theorem mem_pregroupoid_of_eq_on_source (PG : Pregroupoid H) {e e' : PartialHomeomorph H H}
    (he' : e ≈ e') (he : PG.property e e.source) : PG.property e' e'.source := 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
PG : Pregroupoid H
e e' : PartialHomeomorph H H
he' : e ≈ e'
he : Pregroupoid.property PG (↑e) e.source
⊢ Pregroupoid.property PG (↑e') e'.source

Next tactic:
rw [← he'.1]
theorem mem_pregroupoid_of_eq_on_source (PG : Pregroupoid H) {e e' : PartialHomeomorph H H}
    (he' : e ≈ e') (he : PG.property e e.source) : PG.property e' e'.source := by
  rw [← he'.1]
  

Proof state:
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 e' : PartialHomeomorph H H
he' : e ≈ e'
he : Pregroupoid.property PG (↑e) e.source
⊢ Pregroupoid.property PG (↑e') e.source

Next tactic:
exact PG.congr e.open_source he'.eqOn.symm he
instance : CompleteLattice (StructureGroupoid H) :=
  { SetLike.instPartialOrder,
    completeLatticeOfInf _ (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
src✝ : PartialOrder (StructureGroupoid H) := SetLike.instPartialOrder
⊢ ∀ (s : Set (StructureGroupoid H)), IsGLB s (sInf s)

Next tactic:
refine' fun s =>
      ⟨fun S Ss F hF => mem_iInter₂.mp hF S Ss,
      fun T Tl F fT => mem_iInter₂.mpr (fun i his => Tl his fT)⟩
/-- The trivial restriction-closed groupoid, containing only local homeomorphisms equivalent to the
restriction of the identity to the various open subsets. -/
def idRestrGroupoid : StructureGroupoid H where
  members := { e | ∃ (s : Set H) (h : IsOpen s), e ≈ PartialHomeomorph.ofSet s h }
  trans' := 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
⊢ ∀ (e e' : PartialHomeomorph H H),
    e ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h} →
      e' ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h} → e ≫ₕ e' ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}

Next tactic:
rintro e e' ⟨s, hs, hse⟩ ⟨s', hs', hse'⟩
/-- The trivial restriction-closed groupoid, containing only local homeomorphisms equivalent to the
restriction of the identity to the various open subsets. -/
def idRestrGroupoid : StructureGroupoid H where
  members := { e | ∃ (s : Set H) (h : IsOpen s), e ≈ PartialHomeomorph.ofSet s h }
  trans' := by
    rintro e e' ⟨s, hs, hse⟩ ⟨s', hs', hse'⟩
    

Proof state:
case intro.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
e e' : PartialHomeomorph H H
s : Set H
hs : IsOpen s
hse : e ≈ ofSet s hs
s' : Set H
hs' : IsOpen s'
hse' : e' ≈ ofSet s' hs'
⊢ e ≫ₕ e' ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}

Next tactic:
refine' ⟨s ∩ s', IsOpen.inter hs hs', _⟩
/-- The trivial restriction-closed groupoid, containing only local homeomorphisms equivalent to the
restriction of the identity to the various open subsets. -/
def idRestrGroupoid : StructureGroupoid H where
  members := { e | ∃ (s : Set H) (h : IsOpen s), e ≈ PartialHomeomorph.ofSet s h }
  trans' := by
    rintro e e' ⟨s, hs, hse⟩ ⟨s', hs', hse'⟩
    refine' ⟨s ∩ s', IsOpen.inter hs hs', _⟩
    

Proof state:
case intro.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
e e' : PartialHomeomorph H H
s : Set H
hs : IsOpen s
hse : e ≈ ofSet s hs
s' : Set H
hs' : IsOpen s'
hse' : e' ≈ ofSet s' hs'
⊢ e ≫ₕ e' ≈ ofSet (s ∩ s') (_ : IsOpen (s ∩ s'))

Next tactic:
have := PartialHomeomorph.EqOnSource.trans' hse hse'
/-- The trivial restriction-closed groupoid, containing only local homeomorphisms equivalent to the
restriction of the identity to the various open subsets. -/
def idRestrGroupoid : StructureGroupoid H where
  members := { e | ∃ (s : Set H) (h : IsOpen s), e ≈ PartialHomeomorph.ofSet s h }
  trans' := by
    rintro e e' ⟨s, hs, hse⟩ ⟨s', hs', hse'⟩
    refine' ⟨s ∩ s', IsOpen.inter hs hs', _⟩
    have := PartialHomeomorph.EqOnSource.trans' hse hse'
    

Proof state:
case intro.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
e e' : PartialHomeomorph H H
s : Set H
hs : IsOpen s
hse : e ≈ ofSet s hs
s' : Set H
hs' : IsOpen s'
hse' : e' ≈ ofSet s' hs'
this : e ≫ₕ e' ≈ ofSet s hs ≫ₕ ofSet s' hs'
⊢ e ≫ₕ e' ≈ ofSet (s ∩ s') (_ : IsOpen (s ∩ s'))

Next tactic:
rwa [PartialHomeomorph.ofSet_trans_ofSet] at this
/-- The trivial restriction-closed groupoid, containing only local homeomorphisms equivalent to the
restriction of the identity to the various open subsets. -/
def idRestrGroupoid : StructureGroupoid H where
  members := { e | ∃ (s : Set H) (h : IsOpen s), e ≈ PartialHomeomorph.ofSet s h }
  trans' := by
    rintro e e' ⟨s, hs, hse⟩ ⟨s', hs', hse'⟩
    refine' ⟨s ∩ s', IsOpen.inter hs hs', _⟩
    have := PartialHomeomorph.EqOnSource.trans' hse hse'
    rwa [PartialHomeomorph.ofSet_trans_ofSet] at this
  symm' := 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
⊢ ∀ e ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h},
    PartialHomeomorph.symm e ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}

Next tactic:
rintro e ⟨s, hs, hse⟩
/-- The trivial restriction-closed groupoid, containing only local homeomorphisms equivalent to the
restriction of the identity to the various open subsets. -/
def idRestrGroupoid : StructureGroupoid H where
  members := { e | ∃ (s : Set H) (h : IsOpen s), e ≈ PartialHomeomorph.ofSet s h }
  trans' := by
    rintro e e' ⟨s, hs, hse⟩ ⟨s', hs', hse'⟩
    refine' ⟨s ∩ s', IsOpen.inter hs hs', _⟩
    have := PartialHomeomorph.EqOnSource.trans' hse hse'
    rwa [PartialHomeomorph.ofSet_trans_ofSet] at this
  symm' := by
    rintro e ⟨s, hs, hse⟩
    

Proof state:
case intro.intro
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
e : PartialHomeomorph H H
s : Set H
hs : IsOpen s
hse : e ≈ ofSet s hs
⊢ PartialHomeomorph.symm e ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}

Next tactic:
refine' ⟨s, hs, _⟩
/-- The trivial restriction-closed groupoid, containing only local homeomorphisms equivalent to the
restriction of the identity to the various open subsets. -/
def idRestrGroupoid : StructureGroupoid H where
  members := { e | ∃ (s : Set H) (h : IsOpen s), e ≈ PartialHomeomorph.ofSet s h }
  trans' := by
    rintro e e' ⟨s, hs, hse⟩ ⟨s', hs', hse'⟩
    refine' ⟨s ∩ s', IsOpen.inter hs hs', _⟩
    have := PartialHomeomorph.EqOnSource.trans' hse hse'
    rwa [PartialHomeomorph.ofSet_trans_ofSet] at this
  symm' := by
    rintro e ⟨s, hs, hse⟩
    refine' ⟨s, hs, _⟩
    

Proof state:
case intro.intro
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
e : PartialHomeomorph H H
s : Set H
hs : IsOpen s
hse : e ≈ ofSet s hs
⊢ PartialHomeomorph.symm e ≈ ofSet s hs

Next tactic:
rw [← ofSet_symm]
/-- The trivial restriction-closed groupoid, containing only local homeomorphisms equivalent to the
restriction of the identity to the various open subsets. -/
def idRestrGroupoid : StructureGroupoid H where
  members := { e | ∃ (s : Set H) (h : IsOpen s), e ≈ PartialHomeomorph.ofSet s h }
  trans' := by
    rintro e e' ⟨s, hs, hse⟩ ⟨s', hs', hse'⟩
    refine' ⟨s ∩ s', IsOpen.inter hs hs', _⟩
    have := PartialHomeomorph.EqOnSource.trans' hse hse'
    rwa [PartialHomeomorph.ofSet_trans_ofSet] at this
  symm' := by
    rintro e ⟨s, hs, hse⟩
    refine' ⟨s, hs, _⟩
    rw [← ofSet_symm]
    

Proof state:
case intro.intro
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
e : PartialHomeomorph H H
s : Set H
hs : IsOpen s
hse : e ≈ ofSet s hs
⊢ PartialHomeomorph.symm e ≈ PartialHomeomorph.symm (ofSet s hs)

Next tactic:
exact PartialHomeomorph.EqOnSource.symm' hse