l3lab/ntp-mathlib huggingface dataset:
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, 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
⊢ PartialHomeomorph.refl H ≈ ofSet univ (_ : IsOpen univ)

Next tactic:
simp only [mfld_simps, refl]
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := 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 : PartialHomeomorph H H),
    (∀ x ∈ e.source, ∃ s, IsOpen s ∧ x ∈ s ∧ PartialHomeomorph.restr e s ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}) →
      e ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}

Next tactic:
intro e h
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := by
    intro e h
    

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 : PartialHomeomorph H H
h : ∀ x ∈ e.source, ∃ s, IsOpen s ∧ x ∈ s ∧ PartialHomeomorph.restr e s ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}
⊢ e ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}

Next tactic:
refine' ⟨e.source, e.open_source, by simp only [mfld_simps], _⟩
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := by
    intro e h
    refine' ⟨e.source, e.open_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
e : PartialHomeomorph H H
h : ∀ x ∈ e.source, ∃ s, IsOpen s ∧ x ∈ s ∧ PartialHomeomorph.restr e s ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}
⊢ e.source = (ofSet e.source (_ : IsOpen e.source)).toPartialEquiv.source

Next tactic:
simp only [mfld_simps]
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := by
    intro e h
    refine' ⟨e.source, e.open_source, by simp only [mfld_simps], _⟩
    

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 : PartialHomeomorph H H
h : ∀ x ∈ e.source, ∃ s, IsOpen s ∧ x ∈ s ∧ PartialHomeomorph.restr e s ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}
⊢ EqOn (↑e) (↑(ofSet e.source (_ : IsOpen e.source))) e.source

Next tactic:
intro x hx
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := by
    intro e h
    refine' ⟨e.source, e.open_source, by simp only [mfld_simps], _⟩
    intro x hx
    

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 : PartialHomeomorph H H
h : ∀ x ∈ e.source, ∃ s, IsOpen s ∧ x ∈ s ∧ PartialHomeomorph.restr e s ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}
x : H
hx : x ∈ e.source
⊢ ↑e x = ↑(ofSet e.source (_ : IsOpen e.source)) x

Next tactic:
rcases h x hx with ⟨s, hs, hxs, s', hs', hes'⟩
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := by
    intro e h
    refine' ⟨e.source, e.open_source, by simp only [mfld_simps], _⟩
    intro x hx
    rcases h x hx with ⟨s, hs, hxs, s', hs', hes'⟩
    

Proof state:
case intro.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 : PartialHomeomorph H H
h : ∀ x ∈ e.source, ∃ s, IsOpen s ∧ x ∈ s ∧ PartialHomeomorph.restr e s ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}
x : H
hx : x ∈ e.source
s : Set H
hs : IsOpen s
hxs : x ∈ s
s' : Set H
hs' : IsOpen s'
hes' : PartialHomeomorph.restr e s ≈ ofSet s' hs'
⊢ ↑e x = ↑(ofSet e.source (_ : IsOpen e.source)) x

Next tactic:
have hes : x ∈ (e.restr s).source := by
      rw [e.restr_source]
      refine' ⟨hx, _⟩
      rw [hs.interior_eq]
      exact hxs
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := by
    intro e h
    refine' ⟨e.source, e.open_source, by simp only [mfld_simps], _⟩
    intro x hx
    rcases h x hx with ⟨s, hs, hxs, s', hs', hes'⟩
    have hes : x ∈ (e.restr s).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
e : PartialHomeomorph H H
h : ∀ x ∈ e.source, ∃ s, IsOpen s ∧ x ∈ s ∧ PartialHomeomorph.restr e s ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}
x : H
hx : x ∈ e.source
s : Set H
hs : IsOpen s
hxs : x ∈ s
s' : Set H
hs' : IsOpen s'
hes' : PartialHomeomorph.restr e s ≈ ofSet s' hs'
⊢ x ∈ (PartialHomeomorph.restr e s).toPartialEquiv.source

Next tactic:
rw [e.restr_source]
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := by
    intro e h
    refine' ⟨e.source, e.open_source, by simp only [mfld_simps], _⟩
    intro x hx
    rcases h x hx with ⟨s, hs, hxs, s', hs', hes'⟩
    have hes : x ∈ (e.restr s).source := by
      rw [e.restr_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
e : PartialHomeomorph H H
h : ∀ x ∈ e.source, ∃ s, IsOpen s ∧ x ∈ s ∧ PartialHomeomorph.restr e s ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}
x : H
hx : x ∈ e.source
s : Set H
hs : IsOpen s
hxs : x ∈ s
s' : Set H
hs' : IsOpen s'
hes' : PartialHomeomorph.restr e s ≈ ofSet s' hs'
⊢ x ∈ e.source ∩ interior s

Next tactic:
refine' ⟨hx, _⟩
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := by
    intro e h
    refine' ⟨e.source, e.open_source, by simp only [mfld_simps], _⟩
    intro x hx
    rcases h x hx with ⟨s, hs, hxs, s', hs', hes'⟩
    have hes : x ∈ (e.restr s).source := by
      rw [e.restr_source]
      refine' ⟨hx, _⟩
      

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 : PartialHomeomorph H H
h : ∀ x ∈ e.source, ∃ s, IsOpen s ∧ x ∈ s ∧ PartialHomeomorph.restr e s ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}
x : H
hx : x ∈ e.source
s : Set H
hs : IsOpen s
hxs : x ∈ s
s' : Set H
hs' : IsOpen s'
hes' : PartialHomeomorph.restr e s ≈ ofSet s' hs'
⊢ x ∈ interior s

Next tactic:
rw [hs.interior_eq]
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := by
    intro e h
    refine' ⟨e.source, e.open_source, by simp only [mfld_simps], _⟩
    intro x hx
    rcases h x hx with ⟨s, hs, hxs, s', hs', hes'⟩
    have hes : x ∈ (e.restr s).source := by
      rw [e.restr_source]
      refine' ⟨hx, _⟩
      rw [hs.interior_eq]
      

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 : PartialHomeomorph H H
h : ∀ x ∈ e.source, ∃ s, IsOpen s ∧ x ∈ s ∧ PartialHomeomorph.restr e s ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}
x : H
hx : x ∈ e.source
s : Set H
hs : IsOpen s
hxs : x ∈ s
s' : Set H
hs' : IsOpen s'
hes' : PartialHomeomorph.restr e s ≈ ofSet s' hs'
⊢ x ∈ s

Next tactic:
exact hxs
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := by
    intro e h
    refine' ⟨e.source, e.open_source, by simp only [mfld_simps], _⟩
    intro x hx
    rcases h x hx with ⟨s, hs, hxs, s', hs', hes'⟩
    have hes : x ∈ (e.restr s).source := by
      rw [e.restr_source]
      refine' ⟨hx, _⟩
      rw [hs.interior_eq]
      exact hxs
    

Proof state:
case intro.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 : PartialHomeomorph H H
h : ∀ x ∈ e.source, ∃ s, IsOpen s ∧ x ∈ s ∧ PartialHomeomorph.restr e s ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}
x : H
hx : x ∈ e.source
s : Set H
hs : IsOpen s
hxs : x ∈ s
s' : Set H
hs' : IsOpen s'
hes' : PartialHomeomorph.restr e s ≈ ofSet s' hs'
hes : x ∈ (PartialHomeomorph.restr e s).toPartialEquiv.source
⊢ ↑e x = ↑(ofSet e.source (_ : IsOpen e.source)) x

Next tactic:
simpa only [mfld_simps] using PartialHomeomorph.EqOnSource.eqOn hes' hes
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := by
    intro e h
    refine' ⟨e.source, e.open_source, by simp only [mfld_simps], _⟩
    intro x hx
    rcases h x hx with ⟨s, hs, hxs, s', hs', hes'⟩
    have hes : x ∈ (e.restr s).source := by
      rw [e.restr_source]
      refine' ⟨hx, _⟩
      rw [hs.interior_eq]
      exact hxs
    simpa only [mfld_simps] using PartialHomeomorph.EqOnSource.eqOn hes' hes
  eq_on_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
⊢ ∀ (e e' : PartialHomeomorph H H),
    e ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h} → e' ≈ e → e' ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}

Next tactic:
rintro e e' ⟨s, hs, hse⟩ hee'
/-- 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]
    exact PartialHomeomorph.EqOnSource.symm' hse
  id_mem' := ⟨univ, isOpen_univ, by simp only [mfld_simps, refl]⟩
  locality' := by
    intro e h
    refine' ⟨e.source, e.open_source, by simp only [mfld_simps], _⟩
    intro x hx
    rcases h x hx with ⟨s, hs, hxs, s', hs', hes'⟩
    have hes : x ∈ (e.restr s).source := by
      rw [e.restr_source]
      refine' ⟨hx, _⟩
      rw [hs.interior_eq]
      exact hxs
    simpa only [mfld_simps] using PartialHomeomorph.EqOnSource.eqOn hes' hes
  eq_on_source' := by
    rintro e e' ⟨s, hs, hse⟩ hee'
    

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 e' : PartialHomeomorph H H
s : Set H
hs : IsOpen s
hse : e ≈ ofSet s hs
hee' : e' ≈ e
⊢ e' ∈ {e | ∃ s, ∃ (h : IsOpen s), e ≈ ofSet s h}

Next tactic:
exact ⟨s, hs, Setoid.trans hee' hse⟩
/-- The trivial restriction-closed groupoid is indeed `ClosedUnderRestriction`. -/
instance closedUnderRestriction_idRestrGroupoid : ClosedUnderRestriction (@idRestrGroupoid H _) :=
  ⟨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 : PartialHomeomorph H H},
    e ∈ idRestrGroupoid → ∀ (s : Set H), IsOpen s → PartialHomeomorph.restr e s ∈ idRestrGroupoid

Next tactic:
rintro e ⟨s', hs', he⟩ s hs
/-- The trivial restriction-closed groupoid is indeed `ClosedUnderRestriction`. -/
instance closedUnderRestriction_idRestrGroupoid : ClosedUnderRestriction (@idRestrGroupoid H _) :=
  ⟨by
    rintro e ⟨s', hs', he⟩ 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'
he : e ≈ ofSet s' hs'
s : Set H
hs : IsOpen s
⊢ PartialHomeomorph.restr e s ∈ idRestrGroupoid

Next tactic:
use s' ∩ s, IsOpen.inter hs' hs
/-- The trivial restriction-closed groupoid is indeed `ClosedUnderRestriction`. -/
instance closedUnderRestriction_idRestrGroupoid : ClosedUnderRestriction (@idRestrGroupoid H _) :=
  ⟨by
    rintro e ⟨s', hs', he⟩ s hs
    use s' ∩ s, IsOpen.inter hs' hs
    

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

Next tactic:
refine' Setoid.trans (PartialHomeomorph.EqOnSource.restr he s) _
/-- The trivial restriction-closed groupoid is indeed `ClosedUnderRestriction`. -/
instance closedUnderRestriction_idRestrGroupoid : ClosedUnderRestriction (@idRestrGroupoid H _) :=
  ⟨by
    rintro e ⟨s', hs', he⟩ s hs
    use s' ∩ s, IsOpen.inter hs' hs
    refine' Setoid.trans (PartialHomeomorph.EqOnSource.restr he s) _
    

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

Next tactic:
exact ⟨by simp only [hs.interior_eq, mfld_simps], by simp only [mfld_simps, eqOn_refl]⟩
/-- The trivial restriction-closed groupoid is indeed `ClosedUnderRestriction`. -/
instance closedUnderRestriction_idRestrGroupoid : ClosedUnderRestriction (@idRestrGroupoid H _) :=
  ⟨by
    rintro e ⟨s', hs', he⟩ s hs
    use s' ∩ s, IsOpen.inter hs' hs
    refine' Setoid.trans (PartialHomeomorph.EqOnSource.restr he s) _
    exact ⟨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 : PartialHomeomorph H H
s' : Set H
hs' : IsOpen s'
he : e ≈ ofSet s' hs'
s : Set H
hs : IsOpen s
⊢ (PartialHomeomorph.restr (ofSet s' hs') s).toPartialEquiv.source =
    (ofSet (s' ∩ s) (_ : IsOpen (s' ∩ s))).toPartialEquiv.source

Next tactic:
simp only [hs.interior_eq, mfld_simps]
/-- The trivial restriction-closed groupoid is indeed `ClosedUnderRestriction`. -/
instance closedUnderRestriction_idRestrGroupoid : ClosedUnderRestriction (@idRestrGroupoid H _) :=
  ⟨by
    rintro e ⟨s', hs', he⟩ s hs
    use s' ∩ s, IsOpen.inter hs' hs
    refine' Setoid.trans (PartialHomeomorph.EqOnSource.restr he s) _
    exact ⟨by simp only [hs.interior_eq, mfld_simps], 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 : PartialHomeomorph H H
s' : Set H
hs' : IsOpen s'
he : e ≈ ofSet s' hs'
s : Set H
hs : IsOpen s
⊢ EqOn (↑(PartialHomeomorph.restr (ofSet s' hs') s)) (↑(ofSet (s' ∩ s) (_ : IsOpen (s' ∩ s))))
    (PartialHomeomorph.restr (ofSet s' hs') s).toPartialEquiv.source

Next tactic:
simp only [mfld_simps, eqOn_refl]
/-- A groupoid is closed under restriction if and only if it contains the trivial restriction-closed
groupoid. -/
theorem closedUnderRestriction_iff_id_le (G : StructureGroupoid H) :
    ClosedUnderRestriction G ↔ idRestrGroupoid ≤ G := 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
G : StructureGroupoid H
⊢ ClosedUnderRestriction G ↔ idRestrGroupoid ≤ G

Next tactic:
constructor
/-- A groupoid is closed under restriction if and only if it contains the trivial restriction-closed
groupoid. -/
theorem closedUnderRestriction_iff_id_le (G : StructureGroupoid H) :
    ClosedUnderRestriction G ↔ idRestrGroupoid ≤ G := by
  constructor
  · 

Proof state:
case mp
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
G : StructureGroupoid H
⊢ ClosedUnderRestriction G → idRestrGroupoid ≤ G

Next tactic:
intro _i
/-- A groupoid is closed under restriction if and only if it contains the trivial restriction-closed
groupoid. -/
theorem closedUnderRestriction_iff_id_le (G : StructureGroupoid H) :
    ClosedUnderRestriction G ↔ idRestrGroupoid ≤ G := by
  constructor
  · intro _i
    

Proof state:
case mp
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
G : StructureGroupoid H
_i : ClosedUnderRestriction G
⊢ idRestrGroupoid ≤ G

Next tactic:
apply StructureGroupoid.le_iff.mpr
/-- A groupoid is closed under restriction if and only if it contains the trivial restriction-closed
groupoid. -/
theorem closedUnderRestriction_iff_id_le (G : StructureGroupoid H) :
    ClosedUnderRestriction G ↔ idRestrGroupoid ≤ G := by
  constructor
  · intro _i
    apply StructureGroupoid.le_iff.mpr
    

Proof state:
case mp
H : Type u
H' : Type u_1
M : Type u_2
M' : Type u_3
M'' : Type u_4
inst✝ : TopologicalSpace H
G : StructureGroupoid H
_i : ClosedUnderRestriction G
⊢ ∀ e ∈ idRestrGroupoid, e ∈ G

Next tactic:
rintro e ⟨s, hs, hes⟩