l3lab/ntp-mathlib huggingface dataset:
@[to_additive]
noncomputable instance colimitGroup : Group (G.{v, u} F) :=
  { colimitInv.{v, u} F, (G.{v, u} F).str with
    mul_left_inv := fun x => by
      refine Quot.inductionOn x ?_; clear x; 

Proof state:
J : Type v
inst✝¹ : SmallCategory J
inst✝ : IsFiltered J
F : J ⥤ GroupCat
src✝¹ : Inv ↑(G F) := colimitInv F
src✝ : Monoid ↑(G F) := (G F).str
⊢ ∀ (a : (j : J) × ((F ⋙ forget₂ GroupCat MonCat) ⋙ forget MonCat).obj j),
    (Quot.mk (Types.Quot.Rel ((F ⋙ forget₂ GroupCat MonCat) ⋙ forget MonCat)) a)⁻¹ *
        Quot.mk (Types.Quot.Rel ((F ⋙ forget₂ GroupCat MonCat) ⋙ forget MonCat)) a =
      1

Next tactic:
intro x
@[to_additive]
noncomputable instance colimitGroup : Group (G.{v, u} F) :=
  { colimitInv.{v, u} F, (G.{v, u} F).str with
    mul_left_inv := fun x => by
      refine Quot.inductionOn x ?_; clear x; intro x
      

Proof state:
J : Type v
inst✝¹ : SmallCategory J
inst✝ : IsFiltered J
F : J ⥤ GroupCat
src✝¹ : Inv ↑(G F) := colimitInv F
src✝ : Monoid ↑(G F) := (G F).str
x : (j : J) × ((F ⋙ forget₂ GroupCat MonCat) ⋙ forget MonCat).obj j
⊢ (Quot.mk (Types.Quot.Rel ((F ⋙ forget₂ GroupCat MonCat) ⋙ forget MonCat)) x)⁻¹ *
      Quot.mk (Types.Quot.Rel ((F ⋙ forget₂ GroupCat MonCat) ⋙ forget MonCat)) x =
    1

Next tactic:
cases' x with j x
@[to_additive]
noncomputable instance colimitGroup : Group (G.{v, u} F) :=
  { colimitInv.{v, u} F, (G.{v, u} F).str with
    mul_left_inv := fun x => by
      refine Quot.inductionOn x ?_; clear x; intro x
      cases' x with j x
      

Proof state:
case mk
J : Type v
inst✝¹ : SmallCategory J
inst✝ : IsFiltered J
F : J ⥤ GroupCat
src✝¹ : Inv ↑(G F) := colimitInv F
src✝ : Monoid ↑(G F) := (G F).str
j : J
x : ((F ⋙ forget₂ GroupCat MonCat) ⋙ forget MonCat).obj j
⊢ (Quot.mk (Types.Quot.Rel ((F ⋙ forget₂ GroupCat MonCat) ⋙ forget MonCat)) { fst := j, snd := x })⁻¹ *
      Quot.mk (Types.Quot.Rel ((F ⋙ forget₂ GroupCat MonCat) ⋙ forget MonCat)) { fst := j, snd := x } =
    1

Next tactic:
erw [colimit_inv_mk_eq,
        colimit_mul_mk_eq (F ⋙ forget₂ GroupCat MonCat.{max v u}) ⟨j, _⟩ ⟨j, _⟩ j (𝟙 j) (𝟙 j),
        colimit_one_eq (F ⋙ forget₂ GroupCat MonCat.{max v u}) j]
@[to_additive]
noncomputable instance colimitGroup : Group (G.{v, u} F) :=
  { colimitInv.{v, u} F, (G.{v, u} F).str with
    mul_left_inv := fun x => by
      refine Quot.inductionOn x ?_; clear x; intro x
      cases' x with j x
      erw [colimit_inv_mk_eq,
        colimit_mul_mk_eq (F ⋙ forget₂ GroupCat MonCat.{max v u}) ⟨j, _⟩ ⟨j, _⟩ j (𝟙 j) (𝟙 j),
        colimit_one_eq (F ⋙ forget₂ GroupCat MonCat.{max v u}) j]
      

Proof state:
case mk
J : Type v
inst✝¹ : SmallCategory J
inst✝ : IsFiltered J
F : J ⥤ GroupCat
src✝¹ : Inv ↑(G F) := colimitInv F
src✝ : Monoid ↑(G F) := (G F).str
j : J
x : ((F ⋙ forget₂ GroupCat MonCat) ⋙ forget MonCat).obj j
⊢ MonCat.FilteredColimits.M.mk (F ⋙ forget₂ GroupCat MonCat)
      { fst := j,
        snd :=
          ((F ⋙ forget₂ GroupCat MonCat).map (𝟙 j)) { fst := j, snd := { fst := j, snd := x }.snd⁻¹ }.snd *
            ((F ⋙ forget₂ GroupCat MonCat).map (𝟙 j)) { fst := j, snd := x }.snd } =
    MonCat.FilteredColimits.M.mk (F ⋙ forget₂ GroupCat MonCat) { fst := j, snd := 1 }

Next tactic:
dsimp
@[to_additive]
noncomputable instance colimitGroup : Group (G.{v, u} F) :=
  { colimitInv.{v, u} F, (G.{v, u} F).str with
    mul_left_inv := fun x => by
      refine Quot.inductionOn x ?_; clear x; intro x
      cases' x with j x
      erw [colimit_inv_mk_eq,
        colimit_mul_mk_eq (F ⋙ forget₂ GroupCat MonCat.{max v u}) ⟨j, _⟩ ⟨j, _⟩ j (𝟙 j) (𝟙 j),
        colimit_one_eq (F ⋙ forget₂ GroupCat MonCat.{max v u}) j]
      dsimp
      

Proof state:
case mk
J : Type v
inst✝¹ : SmallCategory J
inst✝ : IsFiltered J
F : J ⥤ GroupCat
src✝¹ : Inv ↑(G F) := colimitInv F
src✝ : Monoid ↑(G F) := (G F).str
j : J
x : ((F ⋙ forget₂ GroupCat MonCat) ⋙ forget MonCat).obj j
⊢ MonCat.FilteredColimits.M.mk (F ⋙ forget₂ GroupCat MonCat)
      { fst := j,
        snd := ((forget₂ GroupCat MonCat).map (F.map (𝟙 j))) x⁻¹ * ((forget₂ GroupCat MonCat).map (F.map (𝟙 j))) x } =
    MonCat.FilteredColimits.M.mk (F ⋙ forget₂ GroupCat MonCat) { fst := j, snd := 1 }

Next tactic:
erw [CategoryTheory.Functor.map_id, mul_left_inv]
theorem Set.restrictPreimage_inducing (s : Set β) (h : Inducing f) :
    Inducing (s.restrictPreimage f) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
h : Inducing f
⊢ Inducing (restrictPreimage s f)

Next tactic:
simp_rw [inducing_subtype_val.inducing_iff, inducing_iff_nhds, restrictPreimage,
    MapsTo.coe_restrict, restrict_eq, ← @Filter.comap_comap _ _ _ _ _ f, Function.comp_apply] at h ⊢
theorem Set.restrictPreimage_inducing (s : Set β) (h : Inducing f) :
    Inducing (s.restrictPreimage f) := by
  simp_rw [inducing_subtype_val.inducing_iff, inducing_iff_nhds, restrictPreimage,
    MapsTo.coe_restrict, restrict_eq, ← @Filter.comap_comap _ _ _ _ _ f, Function.comp_apply] at h ⊢
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
h : ∀ (a : α), 𝓝 a = comap f (𝓝 (f a))
⊢ ∀ (a : ↑(f ⁻¹' s)), 𝓝 a = comap Subtype.val (comap f (𝓝 (f ↑a)))

Next tactic:
intro a
theorem Set.restrictPreimage_inducing (s : Set β) (h : Inducing f) :
    Inducing (s.restrictPreimage f) := by
  simp_rw [inducing_subtype_val.inducing_iff, inducing_iff_nhds, restrictPreimage,
    MapsTo.coe_restrict, restrict_eq, ← @Filter.comap_comap _ _ _ _ _ f, Function.comp_apply] at h ⊢
  intro a
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
h : ∀ (a : α), 𝓝 a = comap f (𝓝 (f a))
a : ↑(f ⁻¹' s)
⊢ 𝓝 a = comap Subtype.val (comap f (𝓝 (f ↑a)))

Next tactic:
rw [← h, ← inducing_subtype_val.nhds_eq_comap]
theorem Set.restrictPreimage_isClosedMap (s : Set β) (H : IsClosedMap f) :
    IsClosedMap (s.restrictPreimage f) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : IsClosedMap f
⊢ IsClosedMap (restrictPreimage s f)

Next tactic:
rintro t ⟨u, hu, e⟩
theorem Set.restrictPreimage_isClosedMap (s : Set β) (H : IsClosedMap f) :
    IsClosedMap (s.restrictPreimage f) := by
  rintro t ⟨u, hu, e⟩
  

Proof state:
case mk.intro.intro
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : IsClosedMap f
t : Set ↑(f ⁻¹' s)
u : Set α
hu : IsOpen u
e : Subtype.val ⁻¹' u = tᶜ
⊢ IsClosed (restrictPreimage s f '' t)

Next tactic:
refine' ⟨⟨_, (H _ (IsOpen.isClosed_compl hu)).1, _⟩⟩
theorem Set.restrictPreimage_isClosedMap (s : Set β) (H : IsClosedMap f) :
    IsClosedMap (s.restrictPreimage f) := by
  rintro t ⟨u, hu, e⟩
  refine' ⟨⟨_, (H _ (IsOpen.isClosed_compl hu)).1, _⟩⟩
  

Proof state:
case mk.intro.intro
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : IsClosedMap f
t : Set ↑(f ⁻¹' s)
u : Set α
hu : IsOpen u
e : Subtype.val ⁻¹' u = tᶜ
⊢ Subtype.val ⁻¹' (f '' uᶜ)ᶜ = (restrictPreimage s f '' t)ᶜ

Next tactic:
rw [← (congr_arg HasCompl.compl e).trans (compl_compl t)]
theorem Set.restrictPreimage_isClosedMap (s : Set β) (H : IsClosedMap f) :
    IsClosedMap (s.restrictPreimage f) := by
  rintro t ⟨u, hu, e⟩
  refine' ⟨⟨_, (H _ (IsOpen.isClosed_compl hu)).1, _⟩⟩
  rw [← (congr_arg HasCompl.compl e).trans (compl_compl t)]
  

Proof state:
case mk.intro.intro
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : IsClosedMap f
t : Set ↑(f ⁻¹' s)
u : Set α
hu : IsOpen u
e : Subtype.val ⁻¹' u = tᶜ
⊢ Subtype.val ⁻¹' (f '' uᶜ)ᶜ = (restrictPreimage s f '' (Subtype.val ⁻¹' u)ᶜ)ᶜ

Next tactic:
simp only [Set.preimage_compl, compl_inj_iff]
theorem Set.restrictPreimage_isClosedMap (s : Set β) (H : IsClosedMap f) :
    IsClosedMap (s.restrictPreimage f) := by
  rintro t ⟨u, hu, e⟩
  refine' ⟨⟨_, (H _ (IsOpen.isClosed_compl hu)).1, _⟩⟩
  rw [← (congr_arg HasCompl.compl e).trans (compl_compl t)]
  simp only [Set.preimage_compl, compl_inj_iff]
  

Proof state:
case mk.intro.intro
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : IsClosedMap f
t : Set ↑(f ⁻¹' s)
u : Set α
hu : IsOpen u
e : Subtype.val ⁻¹' u = tᶜ
⊢ Subtype.val ⁻¹' (f '' uᶜ) = restrictPreimage s f '' (Subtype.val ⁻¹' u)ᶜ

Next tactic:
ext ⟨x, hx⟩
theorem Set.restrictPreimage_isClosedMap (s : Set β) (H : IsClosedMap f) :
    IsClosedMap (s.restrictPreimage f) := by
  rintro t ⟨u, hu, e⟩
  refine' ⟨⟨_, (H _ (IsOpen.isClosed_compl hu)).1, _⟩⟩
  rw [← (congr_arg HasCompl.compl e).trans (compl_compl t)]
  simp only [Set.preimage_compl, compl_inj_iff]
  ext ⟨x, hx⟩
  

Proof state:
case mk.intro.intro.h.mk
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : IsClosedMap f
t : Set ↑(f ⁻¹' s)
u : Set α
hu : IsOpen u
e : Subtype.val ⁻¹' u = tᶜ
x : β
hx : x ∈ s
⊢ { val := x, property := hx } ∈ Subtype.val ⁻¹' (f '' uᶜ) ↔
    { val := x, property := hx } ∈ restrictPreimage s f '' (Subtype.val ⁻¹' u)ᶜ

Next tactic:
suffices (∃ y, y ∉ u ∧ f y = x) ↔ ∃ y, y ∉ u ∧ f y ∈ s ∧ f y = x by
    simpa [Set.restrictPreimage, ← Subtype.coe_inj]
theorem Set.restrictPreimage_isClosedMap (s : Set β) (H : IsClosedMap f) :
    IsClosedMap (s.restrictPreimage f) := by
  rintro t ⟨u, hu, e⟩
  refine' ⟨⟨_, (H _ (IsOpen.isClosed_compl hu)).1, _⟩⟩
  rw [← (congr_arg HasCompl.compl e).trans (compl_compl t)]
  simp only [Set.preimage_compl, compl_inj_iff]
  ext ⟨x, hx⟩
  suffices (∃ y, y ∉ u ∧ f y = x) ↔ ∃ y, y ∉ u ∧ f y ∈ s ∧ f y = x by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : IsClosedMap f
t : Set ↑(f ⁻¹' s)
u : Set α
hu : IsOpen u
e : Subtype.val ⁻¹' u = tᶜ
x : β
hx : x ∈ s
this : (∃ y ∉ u, f y = x) ↔ ∃ y ∉ u, f y ∈ s ∧ f y = x
⊢ { val := x, property := hx } ∈ Subtype.val ⁻¹' (f '' uᶜ) ↔
    { val := x, property := hx } ∈ restrictPreimage s f '' (Subtype.val ⁻¹' u)ᶜ

Next tactic:
simpa [Set.restrictPreimage, ← Subtype.coe_inj]
theorem Set.restrictPreimage_isClosedMap (s : Set β) (H : IsClosedMap f) :
    IsClosedMap (s.restrictPreimage f) := by
  rintro t ⟨u, hu, e⟩
  refine' ⟨⟨_, (H _ (IsOpen.isClosed_compl hu)).1, _⟩⟩
  rw [← (congr_arg HasCompl.compl e).trans (compl_compl t)]
  simp only [Set.preimage_compl, compl_inj_iff]
  ext ⟨x, hx⟩
  suffices (∃ y, y ∉ u ∧ f y = x) ↔ ∃ y, y ∉ u ∧ f y ∈ s ∧ f y = x by
    simpa [Set.restrictPreimage, ← Subtype.coe_inj]
  

Proof state:
case mk.intro.intro.h.mk
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : IsClosedMap f
t : Set ↑(f ⁻¹' s)
u : Set α
hu : IsOpen u
e : Subtype.val ⁻¹' u = tᶜ
x : β
hx : x ∈ s
⊢ (∃ y ∉ u, f y = x) ↔ ∃ y ∉ u, f y ∈ s ∧ f y = x

Next tactic:
exact ⟨fun ⟨a, b, c⟩ => ⟨a, b, c.symm ▸ hx, c⟩, fun ⟨a, b, _, c⟩ => ⟨a, b, c⟩⟩
theorem isOpen_iff_inter_of_iSup_eq_top (s : Set β) : IsOpen s ↔ ∀ i, IsOpen (s ∩ U i) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
⊢ IsOpen s ↔ ∀ (i : ι), IsOpen (s ∩ ↑(U i))

Next tactic:
constructor
theorem isOpen_iff_inter_of_iSup_eq_top (s : Set β) : IsOpen s ↔ ∀ i, IsOpen (s ∩ U i) := by
  constructor
  · 

Proof state:
case mp
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
⊢ IsOpen s → ∀ (i : ι), IsOpen (s ∩ ↑(U i))

Next tactic:
exact fun H i => H.inter (U i).2
theorem isOpen_iff_inter_of_iSup_eq_top (s : Set β) : IsOpen s ↔ ∀ i, IsOpen (s ∩ U i) := by
  constructor
  · exact fun H i => H.inter (U i).2
  · 

Proof state:
case mpr
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
⊢ (∀ (i : ι), IsOpen (s ∩ ↑(U i))) → IsOpen s

Next tactic:
intro H
theorem isOpen_iff_inter_of_iSup_eq_top (s : Set β) : IsOpen s ↔ ∀ i, IsOpen (s ∩ U i) := by
  constructor
  · exact fun H i => H.inter (U i).2
  · intro H
    

Proof state:
case mpr
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : ∀ (i : ι), IsOpen (s ∩ ↑(U i))
⊢ IsOpen s

Next tactic:
have : ⋃ i, (U i : Set β) = Set.univ := by
      convert congr_arg (SetLike.coe) hU
      simp
theorem isOpen_iff_inter_of_iSup_eq_top (s : Set β) : IsOpen s ↔ ∀ i, IsOpen (s ∩ U i) := by
  constructor
  · exact fun H i => H.inter (U i).2
  · intro H
    have : ⋃ i, (U i : Set β) = Set.univ := by
      

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : ∀ (i : ι), IsOpen (s ∩ ↑(U i))
⊢ ⋃ i, ↑(U i) = univ

Next tactic:
convert congr_arg (SetLike.coe) hU
theorem isOpen_iff_inter_of_iSup_eq_top (s : Set β) : IsOpen s ↔ ∀ i, IsOpen (s ∩ U i) := by
  constructor
  · exact fun H i => H.inter (U i).2
  · intro H
    have : ⋃ i, (U i : Set β) = Set.univ := by
      convert congr_arg (SetLike.coe) hU
      

Proof state:
case h.e'_2
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : ∀ (i : ι), IsOpen (s ∩ ↑(U i))
⊢ ⋃ i, ↑(U i) = ↑(iSup U)

Next tactic:
simp
theorem isOpen_iff_inter_of_iSup_eq_top (s : Set β) : IsOpen s ↔ ∀ i, IsOpen (s ∩ U i) := by
  constructor
  · exact fun H i => H.inter (U i).2
  · intro H
    have : ⋃ i, (U i : Set β) = Set.univ := by
      convert congr_arg (SetLike.coe) hU
      simp
    

Proof state:
case mpr
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : ∀ (i : ι), IsOpen (s ∩ ↑(U i))
this : ⋃ i, ↑(U i) = univ
⊢ IsOpen s

Next tactic:
rw [← s.inter_univ, ← this, Set.inter_iUnion]
theorem isOpen_iff_inter_of_iSup_eq_top (s : Set β) : IsOpen s ↔ ∀ i, IsOpen (s ∩ U i) := by
  constructor
  · exact fun H i => H.inter (U i).2
  · intro H
    have : ⋃ i, (U i : Set β) = Set.univ := by
      convert congr_arg (SetLike.coe) hU
      simp
    rw [← s.inter_univ, ← this, Set.inter_iUnion]
    

Proof state:
case mpr
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
H : ∀ (i : ι), IsOpen (s ∩ ↑(U i))
this : ⋃ i, ↑(U i) = univ
⊢ IsOpen (⋃ i, s ∩ ↑(U i))

Next tactic:
exact isOpen_iUnion H
theorem isOpen_iff_coe_preimage_of_iSup_eq_top (s : Set β) :
    IsOpen s ↔ ∀ i, IsOpen ((↑) ⁻¹' s : Set (U i)) := by
  -- Porting note: rewrote to avoid ´simp´ issues
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
⊢ IsOpen s ↔ ∀ (i : ι), IsOpen (Subtype.val ⁻¹' s)

Next tactic:
rw [isOpen_iff_inter_of_iSup_eq_top hU s]
theorem isOpen_iff_coe_preimage_of_iSup_eq_top (s : Set β) :
    IsOpen s ↔ ∀ i, IsOpen ((↑) ⁻¹' s : Set (U i)) := by
  -- Porting note: rewrote to avoid ´simp´ issues
  rw [isOpen_iff_inter_of_iSup_eq_top hU s]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
⊢ (∀ (i : ι), IsOpen (s ∩ ↑(U i))) ↔ ∀ (i : ι), IsOpen (Subtype.val ⁻¹' s)

Next tactic:
refine forall_congr' fun i => ?_
theorem isOpen_iff_coe_preimage_of_iSup_eq_top (s : Set β) :
    IsOpen s ↔ ∀ i, IsOpen ((↑) ⁻¹' s : Set (U i)) := by
  -- Porting note: rewrote to avoid ´simp´ issues
  rw [isOpen_iff_inter_of_iSup_eq_top hU s]
  refine forall_congr' fun i => ?_
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
i : ι
⊢ IsOpen (s ∩ ↑(U i)) ↔ IsOpen (Subtype.val ⁻¹' s)

Next tactic:
rw [(U _).2.openEmbedding_subtype_val.open_iff_image_open]
theorem isOpen_iff_coe_preimage_of_iSup_eq_top (s : Set β) :
    IsOpen s ↔ ∀ i, IsOpen ((↑) ⁻¹' s : Set (U i)) := by
  -- Porting note: rewrote to avoid ´simp´ issues
  rw [isOpen_iff_inter_of_iSup_eq_top hU s]
  refine forall_congr' fun i => ?_
  rw [(U _).2.openEmbedding_subtype_val.open_iff_image_open]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
i : ι
⊢ IsOpen (s ∩ ↑(U i)) ↔ IsOpen (Subtype.val '' (Subtype.val ⁻¹' s))

Next tactic:
erw [Set.image_preimage_eq_inter_range]
theorem isOpen_iff_coe_preimage_of_iSup_eq_top (s : Set β) :
    IsOpen s ↔ ∀ i, IsOpen ((↑) ⁻¹' s : Set (U i)) := by
  -- Porting note: rewrote to avoid ´simp´ issues
  rw [isOpen_iff_inter_of_iSup_eq_top hU s]
  refine forall_congr' fun i => ?_
  rw [(U _).2.openEmbedding_subtype_val.open_iff_image_open]
  erw [Set.image_preimage_eq_inter_range]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
i : ι
⊢ IsOpen (s ∩ ↑(U i)) ↔ IsOpen (s ∩ range Subtype.val)

Next tactic:
rw [Subtype.range_coe, Opens.carrier_eq_coe]
theorem isClosed_iff_coe_preimage_of_iSup_eq_top (s : Set β) :
    IsClosed s ↔ ∀ i, IsClosed ((↑) ⁻¹' s : Set (U i)) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
s : Set β
⊢ IsClosed s ↔ ∀ (i : ι), IsClosed (Subtype.val ⁻¹' s)

Next tactic:
simpa using isOpen_iff_coe_preimage_of_iSup_eq_top hU sᶜ
theorem isClosedMap_iff_isClosedMap_of_iSup_eq_top :
    IsClosedMap f ↔ ∀ i, IsClosedMap ((U i).1.restrictPreimage f) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
⊢ IsClosedMap f ↔ ∀ (i : ι), IsClosedMap (restrictPreimage (U i).carrier f)

Next tactic:
refine' ⟨fun h i => Set.restrictPreimage_isClosedMap _ h, _⟩
theorem isClosedMap_iff_isClosedMap_of_iSup_eq_top :
    IsClosedMap f ↔ ∀ i, IsClosedMap ((U i).1.restrictPreimage f) := by
  refine' ⟨fun h i => Set.restrictPreimage_isClosedMap _ h, _⟩
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
⊢ (∀ (i : ι), IsClosedMap (restrictPreimage (U i).carrier f)) → IsClosedMap f

Next tactic:
rintro H s hs
theorem isClosedMap_iff_isClosedMap_of_iSup_eq_top :
    IsClosedMap f ↔ ∀ i, IsClosedMap ((U i).1.restrictPreimage f) := by
  refine' ⟨fun h i => Set.restrictPreimage_isClosedMap _ h, _⟩
  rintro H s hs
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
H : ∀ (i : ι), IsClosedMap (restrictPreimage (U i).carrier f)
s : Set α
hs : IsClosed s
⊢ IsClosed (f '' s)

Next tactic:
rw [isClosed_iff_coe_preimage_of_iSup_eq_top hU]
theorem isClosedMap_iff_isClosedMap_of_iSup_eq_top :
    IsClosedMap f ↔ ∀ i, IsClosedMap ((U i).1.restrictPreimage f) := by
  refine' ⟨fun h i => Set.restrictPreimage_isClosedMap _ h, _⟩
  rintro H s hs
  rw [isClosed_iff_coe_preimage_of_iSup_eq_top hU]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
H : ∀ (i : ι), IsClosedMap (restrictPreimage (U i).carrier f)
s : Set α
hs : IsClosed s
⊢ ∀ (i : ι), IsClosed (Subtype.val ⁻¹' (f '' s))

Next tactic:
intro i
theorem isClosedMap_iff_isClosedMap_of_iSup_eq_top :
    IsClosedMap f ↔ ∀ i, IsClosedMap ((U i).1.restrictPreimage f) := by
  refine' ⟨fun h i => Set.restrictPreimage_isClosedMap _ h, _⟩
  rintro H s hs
  rw [isClosed_iff_coe_preimage_of_iSup_eq_top hU]
  intro i
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
H : ∀ (i : ι), IsClosedMap (restrictPreimage (U i).carrier f)
s : Set α
hs : IsClosed s
i : ι
⊢ IsClosed (Subtype.val ⁻¹' (f '' s))

Next tactic:
convert H i _ ⟨⟨_, hs.1, eq_compl_comm.mpr rfl⟩⟩
theorem isClosedMap_iff_isClosedMap_of_iSup_eq_top :
    IsClosedMap f ↔ ∀ i, IsClosedMap ((U i).1.restrictPreimage f) := by
  refine' ⟨fun h i => Set.restrictPreimage_isClosedMap _ h, _⟩
  rintro H s hs
  rw [isClosed_iff_coe_preimage_of_iSup_eq_top hU]
  intro i
  convert H i _ ⟨⟨_, hs.1, eq_compl_comm.mpr rfl⟩⟩
  

Proof state:
case h.e'_3.h
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
H : ∀ (i : ι), IsClosedMap (restrictPreimage (U i).carrier f)
s : Set α
hs : IsClosed s
i : ι
e_1✝ : ↥(U i) = ↑(U i).carrier
⊢ Subtype.val ⁻¹' (f '' s) = restrictPreimage (U i).carrier f '' (Subtype.val ⁻¹' sᶜ)ᶜ

Next tactic:
ext ⟨x, hx⟩
theorem isClosedMap_iff_isClosedMap_of_iSup_eq_top :
    IsClosedMap f ↔ ∀ i, IsClosedMap ((U i).1.restrictPreimage f) := by
  refine' ⟨fun h i => Set.restrictPreimage_isClosedMap _ h, _⟩
  rintro H s hs
  rw [isClosed_iff_coe_preimage_of_iSup_eq_top hU]
  intro i
  convert H i _ ⟨⟨_, hs.1, eq_compl_comm.mpr rfl⟩⟩
  ext ⟨x, hx⟩
  

Proof state:
case h.e'_3.h.h.mk
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
H : ∀ (i : ι), IsClosedMap (restrictPreimage (U i).carrier f)
s : Set α
hs : IsClosed s
i : ι
e_1✝ : ↥(U i) = ↑(U i).carrier
x : β
hx : x ∈ U i
⊢ { val := x, property := hx } ∈ Subtype.val ⁻¹' (f '' s) ↔
    { val := x, property := hx } ∈ restrictPreimage (U i).carrier f '' (Subtype.val ⁻¹' sᶜ)ᶜ

Next tactic:
suffices (∃ y, y ∈ s ∧ f y = x) ↔ ∃ y, y ∈ s ∧ f y ∈ U i ∧ f y = x by
    simpa [Set.restrictPreimage, ← Subtype.coe_inj]
theorem isClosedMap_iff_isClosedMap_of_iSup_eq_top :
    IsClosedMap f ↔ ∀ i, IsClosedMap ((U i).1.restrictPreimage f) := by
  refine' ⟨fun h i => Set.restrictPreimage_isClosedMap _ h, _⟩
  rintro H s hs
  rw [isClosed_iff_coe_preimage_of_iSup_eq_top hU]
  intro i
  convert H i _ ⟨⟨_, hs.1, eq_compl_comm.mpr rfl⟩⟩
  ext ⟨x, hx⟩
  suffices (∃ y, y ∈ s ∧ f y = x) ↔ ∃ y, y ∈ s ∧ f y ∈ U i ∧ f y = x by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
f : α → β
s✝ : Set β
ι : Type u_3
U : ι → Opens β
hU : iSup U = ⊤
H : ∀ (i : ι), IsClosedMap (restrictPreimage (U i).carrier f)
s : Set α
hs : IsClosed s
i : ι
e_1✝ : ↥(U i) = ↑(U i).carrier
x : β
hx : x ∈ U i
this : (∃ y ∈ s, f y = x) ↔ ∃ y ∈ s, f y ∈ U i ∧ f y = x
⊢ { val := x, property := hx } ∈ Subtype.val ⁻¹' (f '' s) ↔
    { val := x, property := hx } ∈ restrictPreimage (U i).carrier f '' (Subtype.val ⁻¹' sᶜ)ᶜ

Next tactic:
simpa [Set.restrictPreimage, ← Subtype.coe_inj]