/-- An element of the atlas in a charted space without topology becomes a local homeomorphism
for the topology constructed from this atlas. The `localHomeomorph` version is given in this
definition. -/
protected def localHomeomorph (e : PartialEquiv M H) (he : e ∈ c.atlas) :
    @PartialHomeomorph M H c.toTopologicalSpace _ :=
  { c.toTopologicalSpace, e with
    open_source := by convert c.open_source' he
    open_target := by convert c.open_target he
    continuousOn_toFun := by
      letI : TopologicalSpace M := c.toTopologicalSpace
      rw [continuousOn_open_iff (c.open_source' he)]
      intro s s_open
      rw [inter_comm]
      apply TopologicalSpace.GenerateOpen.basic
      simp only [exists_prop, mem_iUnion, mem_singleton_iff]
      exact ⟨e, he, ⟨s, s_open, rfl⟩⟩
    continuousOn_invFun := by
      letI : TopologicalSpace M := c.toTopologicalSpace
      apply continuousOn_isOpen_of_generateFrom
      intro t ht
      simp only [exists_prop, mem_iUnion, mem_singleton_iff] at ht
      rcases ht with ⟨e', e'_atlas, s, s_open, ts⟩
      rw [ts]
      let f := e.symm.trans e'
      have : IsOpen (f ⁻¹' s ∩ f.source) := by
        simpa [inter_comm] using (continuousOn_open_iff (c.open_source e e' he e'_atlas)).1
          (c.continuousOn_toFun e e' he e'_atlas) s s_open
      have A : e' ∘ e.symm ⁻¹' s ∩ (e.target ∩ e.symm ⁻¹' e'.source) =
          e.target ∩ (e' ∘ e.symm ⁻¹' s ∩ e.symm ⁻¹' e'.source) := by
        rw [← inter_assoc, ← inter_assoc]
        congr 1
        exact inter_comm _ _
      

Proof state:
case h.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
c : ChartedSpaceCore H M
e✝ e : PartialEquiv M H
he : e ∈ c.atlas
src✝ : TopologicalSpace M := ChartedSpaceCore.toTopologicalSpace c
this✝ : TopologicalSpace M := ChartedSpaceCore.toTopologicalSpace c
t : Set M
e' : PartialEquiv M H
e'_atlas : e' ∈ c.atlas
s : Set H
s_open : IsOpen s
ts : t = ↑e' ⁻¹' s ∩ e'.source
f : PartialEquiv H H := PartialEquiv.symm e ≫ e'
this : IsOpen (↑f ⁻¹' s ∩ f.source)
A :
  ↑e' ∘ ↑(PartialEquiv.symm e) ⁻¹' s ∩ (e.target ∩ ↑(PartialEquiv.symm e) ⁻¹' e'.source) =
    e.target ∩ (↑e' ∘ ↑(PartialEquiv.symm e) ⁻¹' s ∩ ↑(PartialEquiv.symm e) ⁻¹' e'.source)
⊢ IsOpen
    ({ toFun := ↑e, invFun := e.invFun, source := e.source, target := e.target,
          map_source' := (_ : ∀ ⦃x : M⦄, x ∈ e.source → ↑e x ∈ e.target),
          map_target' := (_ : ∀ ⦃x : H⦄, x ∈ e.target → PartialEquiv.invFun e x ∈ e.source),
          left_inv' := (_ : ∀ ⦃x : M⦄, x ∈ e.source → PartialEquiv.invFun e (↑e x) = x),
          right_inv' := (_ : ∀ ⦃x : H⦄, x ∈ e.target → ↑e (PartialEquiv.invFun e x) = x) }.target ∩
      { toFun := ↑e, invFun := e.invFun, source := e.source, target := e.target,
            map_source' := (_ : ∀ ⦃x : M⦄, x ∈ e.source → ↑e x ∈ e.target),
            map_target' := (_ : ∀ ⦃x : H⦄, x ∈ e.target → PartialEquiv.invFun e x ∈ e.source),
            left_inv' := (_ : ∀ ⦃x : M⦄, x ∈ e.source → PartialEquiv.invFun e (↑e x) = x),
            right_inv' := (_ : ∀ ⦃x : H⦄, x ∈ e.target → ↑e (PartialEquiv.invFun e x) = x) }.invFun ⁻¹'
        (↑e' ⁻¹' s ∩ e'.source))

Next tactic:
simpa [PartialEquiv.trans_source, preimage_inter, preimage_comp.symm, A] using this