l3lab/ntp-mathlib huggingface dataset:
theorem eq_preimage_subtype_val_iff {p : α → Prop} {s : Set (Subtype p)} {t : Set α} :
    s = Subtype.val ⁻¹' t ↔ ∀ (x) (h : p x), (⟨x, h⟩ : Subtype p) ∈ s ↔ x ∈ t :=
  ⟨fun s_eq x h => by
    rw [s_eq]
    simp, fun h => ext fun ⟨x, hx⟩ => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
g : β → γ
p : α → Prop
s : Set (Subtype p)
t : Set α
h : ∀ (x : α) (h : p x), { val := x, property := h } ∈ s ↔ x ∈ t
x✝ : Subtype p
x : α
hx : p x
⊢ { val := x, property := hx } ∈ s ↔ { val := x, property := hx } ∈ Subtype.val ⁻¹' t

Next tactic:
simp [h]
@[simp] theorem preimage_singleton_true (p : α → Prop) : p ⁻¹' {True} = {a | p a} := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
g : β → γ
p : α → Prop
⊢ p ⁻¹' {True} = {a | p a}

Next tactic:
ext
@[simp] theorem preimage_singleton_true (p : α → Prop) : p ⁻¹' {True} = {a | p a} := by ext; 

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
g : β → γ
p : α → Prop
x✝ : α
⊢ x✝ ∈ p ⁻¹' {True} ↔ x✝ ∈ {a | p a}

Next tactic:
simp
@[simp] theorem preimage_singleton_false (p : α → Prop) : p ⁻¹' {False} = {a | ¬p a} := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
g : β → γ
p : α → Prop
⊢ p ⁻¹' {False} = {a | ¬p a}

Next tactic:
ext
@[simp] theorem preimage_singleton_false (p : α → Prop) : p ⁻¹' {False} = {a | ¬p a} := by ext; 

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
g : β → γ
p : α → Prop
x✝ : α
⊢ x✝ ∈ p ⁻¹' {False} ↔ x✝ ∈ {a | ¬p a}

Next tactic:
simp
theorem preimage_subtype_coe_eq_compl {s u v : Set α} (hsuv : s ⊆ u ∪ v)
    (H : s ∩ (u ∩ v) = ∅) : ((↑) : s → α) ⁻¹' u = ((↑) ⁻¹' v)ᶜ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
g : β → γ
s u v : Set α
hsuv : s ⊆ u ∪ v
H : s ∩ (u ∩ v) = ∅
⊢ Subtype.val ⁻¹' u = (Subtype.val ⁻¹' v)ᶜ

Next tactic:
ext ⟨x, x_in_s⟩
theorem preimage_subtype_coe_eq_compl {s u v : Set α} (hsuv : s ⊆ u ∪ v)
    (H : s ∩ (u ∩ v) = ∅) : ((↑) : s → α) ⁻¹' u = ((↑) ⁻¹' v)ᶜ := by
  ext ⟨x, x_in_s⟩
  

Proof state:
case h.mk
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
g : β → γ
s u v : Set α
hsuv : s ⊆ u ∪ v
H : s ∩ (u ∩ v) = ∅
x : α
x_in_s : x ∈ s
⊢ { val := x, property := x_in_s } ∈ Subtype.val ⁻¹' u ↔ { val := x, property := x_in_s } ∈ (Subtype.val ⁻¹' v)ᶜ

Next tactic:
constructor
theorem preimage_subtype_coe_eq_compl {s u v : Set α} (hsuv : s ⊆ u ∪ v)
    (H : s ∩ (u ∩ v) = ∅) : ((↑) : s → α) ⁻¹' u = ((↑) ⁻¹' v)ᶜ := by
  ext ⟨x, x_in_s⟩
  constructor
  · 

Proof state:
case h.mk.mp
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
g : β → γ
s u v : Set α
hsuv : s ⊆ u ∪ v
H : s ∩ (u ∩ v) = ∅
x : α
x_in_s : x ∈ s
⊢ { val := x, property := x_in_s } ∈ Subtype.val ⁻¹' u → { val := x, property := x_in_s } ∈ (Subtype.val ⁻¹' v)ᶜ

Next tactic:
intro x_in_u x_in_v
theorem preimage_subtype_coe_eq_compl {s u v : Set α} (hsuv : s ⊆ u ∪ v)
    (H : s ∩ (u ∩ v) = ∅) : ((↑) : s → α) ⁻¹' u = ((↑) ⁻¹' v)ᶜ := by
  ext ⟨x, x_in_s⟩
  constructor
  · intro x_in_u x_in_v
    

Proof state:
case h.mk.mp
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
g : β → γ
s u v : Set α
hsuv : s ⊆ u ∪ v
H : s ∩ (u ∩ v) = ∅
x : α
x_in_s : x ∈ s
x_in_u : { val := x, property := x_in_s } ∈ Subtype.val ⁻¹' u
x_in_v : { val := x, property := x_in_s } ∈ Subtype.val ⁻¹' v
⊢ False

Next tactic:
exact eq_empty_iff_forall_not_mem.mp H x ⟨x_in_s, ⟨x_in_u, x_in_v⟩⟩
theorem preimage_subtype_coe_eq_compl {s u v : Set α} (hsuv : s ⊆ u ∪ v)
    (H : s ∩ (u ∩ v) = ∅) : ((↑) : s → α) ⁻¹' u = ((↑) ⁻¹' v)ᶜ := by
  ext ⟨x, x_in_s⟩
  constructor
  · intro x_in_u x_in_v
    exact eq_empty_iff_forall_not_mem.mp H x ⟨x_in_s, ⟨x_in_u, x_in_v⟩⟩
  · 

Proof state:
case h.mk.mpr
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
g : β → γ
s u v : Set α
hsuv : s ⊆ u ∪ v
H : s ∩ (u ∩ v) = ∅
x : α
x_in_s : x ∈ s
⊢ { val := x, property := x_in_s } ∈ (Subtype.val ⁻¹' v)ᶜ → { val := x, property := x_in_s } ∈ Subtype.val ⁻¹' u

Next tactic:
intro hx
theorem preimage_subtype_coe_eq_compl {s u v : Set α} (hsuv : s ⊆ u ∪ v)
    (H : s ∩ (u ∩ v) = ∅) : ((↑) : s → α) ⁻¹' u = ((↑) ⁻¹' v)ᶜ := by
  ext ⟨x, x_in_s⟩
  constructor
  · intro x_in_u x_in_v
    exact eq_empty_iff_forall_not_mem.mp H x ⟨x_in_s, ⟨x_in_u, x_in_v⟩⟩
  · intro hx
    

Proof state:
case h.mk.mpr
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
g : β → γ
s u v : Set α
hsuv : s ⊆ u ∪ v
H : s ∩ (u ∩ v) = ∅
x : α
x_in_s : x ∈ s
hx : { val := x, property := x_in_s } ∈ (Subtype.val ⁻¹' v)ᶜ
⊢ { val := x, property := x_in_s } ∈ Subtype.val ⁻¹' u

Next tactic:
exact Or.elim (hsuv x_in_s) id fun hx' => hx.elim hx'
theorem ball_image_iff {f : α → β} {s : Set α} {p : β → Prop} :
    (∀ y ∈ f '' s, p y) ↔ ∀ x ∈ s, p (f x) := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f : α → β
s : Set α
p : β → Prop
⊢ (∀ y ∈ f '' s, p y) ↔ ∀ x ∈ s, p (f x)

Next tactic:
simp
theorem bex_image_iff {f : α → β} {s : Set α} {p : β → Prop} :
    (∃ y ∈ f '' s, p y) ↔ ∃ x ∈ s, p (f x) := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f : α → β
s : Set α
p : β → Prop
⊢ (∃ y ∈ f '' s, p y) ↔ ∃ x ∈ s, p (f x)

Next tactic:
simp
@[congr]
theorem image_congr {f g : α → β} {s : Set α} (h : ∀ a ∈ s, f a = g a) : f '' s = g '' s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f g : α → β
s : Set α
h : ∀ a ∈ s, f a = g a
⊢ f '' s = g '' s

Next tactic:
ext x
@[congr]
theorem image_congr {f g : α → β} {s : Set α} (h : ∀ a ∈ s, f a = g a) : f '' s = g '' s := by
  ext x
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f g : α → β
s : Set α
h : ∀ a ∈ s, f a = g a
x : β
⊢ x ∈ f '' s ↔ x ∈ g '' s

Next tactic:
rw [mem_image, mem_image]
@[congr]
theorem image_congr {f g : α → β} {s : Set α} (h : ∀ a ∈ s, f a = g a) : f '' s = g '' s := by
  ext x
  rw [mem_image, mem_image]
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f g : α → β
s : Set α
h : ∀ a ∈ s, f a = g a
x : β
⊢ (∃ x_1 ∈ s, f x_1 = x) ↔ ∃ x_1 ∈ s, g x_1 = x

Next tactic:
exact {
    mp := by
      rintro ⟨a, ha1, ha2⟩
      exact ⟨a, ⟨ha1, (h a ha1) ▸ ha2⟩⟩,
    mpr := by
      rintro ⟨a, ha1, ha2⟩
      exact ⟨a, ⟨ha1, (h a ha1) ▸ ha2⟩⟩
  }
@[congr]
theorem image_congr {f g : α → β} {s : Set α} (h : ∀ a ∈ s, f a = g a) : f '' s = g '' s := by
  ext x
  rw [mem_image, mem_image]
  exact {
    mp := by
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f g : α → β
s : Set α
h : ∀ a ∈ s, f a = g a
x : β
⊢ (∃ x_1 ∈ s, f x_1 = x) → ∃ x_1 ∈ s, g x_1 = x

Next tactic:
rintro ⟨a, ha1, ha2⟩
@[congr]
theorem image_congr {f g : α → β} {s : Set α} (h : ∀ a ∈ s, f a = g a) : f '' s = g '' s := by
  ext x
  rw [mem_image, mem_image]
  exact {
    mp := by
      rintro ⟨a, ha1, ha2⟩
      

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f g : α → β
s : Set α
h : ∀ a ∈ s, f a = g a
x : β
a : α
ha1 : a ∈ s
ha2 : f a = x
⊢ ∃ x_1 ∈ s, g x_1 = x

Next tactic:
exact ⟨a, ⟨ha1, (h a ha1) ▸ ha2⟩⟩
@[congr]
theorem image_congr {f g : α → β} {s : Set α} (h : ∀ a ∈ s, f a = g a) : f '' s = g '' s := by
  ext x
  rw [mem_image, mem_image]
  exact {
    mp := by
      rintro ⟨a, ha1, ha2⟩
      exact ⟨a, ⟨ha1, (h a ha1) ▸ ha2⟩⟩,
    mpr := by
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f g : α → β
s : Set α
h : ∀ a ∈ s, f a = g a
x : β
⊢ (∃ x_1 ∈ s, g x_1 = x) → ∃ x_1 ∈ s, f x_1 = x

Next tactic:
rintro ⟨a, ha1, ha2⟩
@[congr]
theorem image_congr {f g : α → β} {s : Set α} (h : ∀ a ∈ s, f a = g a) : f '' s = g '' s := by
  ext x
  rw [mem_image, mem_image]
  exact {
    mp := by
      rintro ⟨a, ha1, ha2⟩
      exact ⟨a, ⟨ha1, (h a ha1) ▸ ha2⟩⟩,
    mpr := by
      rintro ⟨a, ha1, ha2⟩
      

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f g : α → β
s : Set α
h : ∀ a ∈ s, f a = g a
x : β
a : α
ha1 : a ∈ s
ha2 : g a = x
⊢ ∃ x_1 ∈ s, f x_1 = x

Next tactic:
exact ⟨a, ⟨ha1, (h a ha1) ▸ ha2⟩⟩
@[gcongr]
lemma image_mono (h : s ⊆ t) : f '' s ⊆ f '' t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
s t : Set α
h : s ⊆ t
⊢ f '' s ⊆ f '' t

Next tactic:
rintro - ⟨a, ha, rfl⟩
@[gcongr]
lemma image_mono (h : s ⊆ t) : f '' s ⊆ f '' t := by
  rintro - ⟨a, ha, rfl⟩; 

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
s t : Set α
h : s ⊆ t
a : α
ha : a ∈ s
⊢ f a ∈ f '' t

Next tactic:
exact mem_image_of_mem f (h ha)
theorem image_comp_eq {g : β → γ} : image (g ∘ f) = image g ∘ image f := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
s t : Set α
g : β → γ
⊢ image (g ∘ f) = image g ∘ image f

Next tactic:
ext
theorem image_comp_eq {g : β → γ} : image (g ∘ f) = image g ∘ image f := by ext; 

Proof state:
case h.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
s t : Set α
g : β → γ
x✝¹ : Set α
x✝ : γ
⊢ x✝ ∈ g ∘ f '' x✝¹ ↔ x✝ ∈ (image g ∘ image f) x✝¹

Next tactic:
simp
theorem image_comm {β'} {f : β → γ} {g : α → β} {f' : α → β'} {g' : β' → γ}
    (h_comm : ∀ a, f (g a) = g' (f' a)) : (s.image g).image f = (s.image f').image g' := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s t : Set α
β' : Type u_6
f : β → γ
g : α → β
f' : α → β'
g' : β' → γ
h_comm : ∀ (a : α), f (g a) = g' (f' a)
⊢ f '' (g '' s) = g' '' (f' '' s)

Next tactic:
simp_rw [image_image, h_comm]
/-- Image is monotone with respect to `⊆`. See `Set.monotone_image` for the statement in
terms of `≤`. -/
@[gcongr]
theorem image_subset {a b : Set α} (f : α → β) (h : a ⊆ b) : f '' a ⊆ f '' b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s t a b : Set α
f : α → β
h : a ⊆ b
⊢ f '' a ⊆ f '' b

Next tactic:
simp only [subset_def, mem_image]
/-- Image is monotone with respect to `⊆`. See `Set.monotone_image` for the statement in
terms of `≤`. -/
@[gcongr]
theorem image_subset {a b : Set α} (f : α → β) (h : a ⊆ b) : f '' a ⊆ f '' b := by
  simp only [subset_def, mem_image]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s t a b : Set α
f : α → β
h : a ⊆ b
⊢ ∀ (x : β), (∃ x_1 ∈ a, f x_1 = x) → ∃ x_1 ∈ b, f x_1 = x

Next tactic:
exact fun x => fun ⟨w, h1, h2⟩ => ⟨w, h h1, h2⟩
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
x : β
⊢ x ∈ f '' (s ∪ t) → x ∈ f '' s ∪ f '' t

Next tactic:
rintro ⟨a, h | h, rfl⟩ <;> [left; right]
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
x : β
⊢ x ∈ f '' (s ∪ t) → x ∈ f '' s ∪ f '' t

Next tactic:
rintro ⟨a, h | h, rfl⟩
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by rintro ⟨a, h | h, rfl⟩ <;> [

Proof state:
case intro.intro.inl
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
a : α
h : a ∈ s
⊢ f a ∈ f '' s ∪ f '' t

Next tactic:
left
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by rintro ⟨a, h | h, rfl⟩ <;> [left; 

Proof state:
case intro.intro.inr
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
a : α
h : a ∈ t
⊢ f a ∈ f '' s ∪ f '' t

Next tactic:
right
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by rintro ⟨a, h | h, rfl⟩ <;> [left; right] <;> 

Proof state:
case intro.intro.inl.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
a : α
h : a ∈ s
⊢ f a ∈ f '' s

Next tactic:
exact ⟨_, h, rfl⟩
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by rintro ⟨a, h | h, rfl⟩ <;> [left; right] <;> 

Proof state:
case intro.intro.inr.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
a : α
h : a ∈ t
⊢ f a ∈ f '' t

Next tactic:
exact ⟨_, h, rfl⟩
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by rintro ⟨a, h | h, rfl⟩ <;> [left; right] <;> exact ⟨_, h, rfl⟩, by
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
x : β
⊢ x ∈ f '' s ∪ f '' t → x ∈ f '' (s ∪ t)

Next tactic:
rintro (⟨a, h, rfl⟩ | ⟨a, h, rfl⟩) <;> refine' ⟨_, _, rfl⟩ <;> [left; right]
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by rintro ⟨a, h | h, rfl⟩ <;> [left; right] <;> exact ⟨_, h, rfl⟩, by
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
x : β
⊢ x ∈ f '' s ∪ f '' t → x ∈ f '' (s ∪ t)

Next tactic:
rintro (⟨a, h, rfl⟩ | ⟨a, h, rfl⟩)
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by rintro ⟨a, h | h, rfl⟩ <;> [left; right] <;> exact ⟨_, h, rfl⟩, by
      rintro (⟨a, h, rfl⟩ | ⟨a, h, rfl⟩) <;> 

Proof state:
case inl.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
a : α
h : a ∈ s
⊢ f a ∈ f '' (s ∪ t)

Next tactic:
refine' ⟨_, _, rfl⟩
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by rintro ⟨a, h | h, rfl⟩ <;> [left; right] <;> exact ⟨_, h, rfl⟩, by
      rintro (⟨a, h, rfl⟩ | ⟨a, h, rfl⟩) <;> 

Proof state:
case inr.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
a : α
h : a ∈ t
⊢ f a ∈ f '' (s ∪ t)

Next tactic:
refine' ⟨_, _, rfl⟩
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by rintro ⟨a, h | h, rfl⟩ <;> [left; right] <;> exact ⟨_, h, rfl⟩, by
      rintro (⟨a, h, rfl⟩ | ⟨a, h, rfl⟩) <;> refine' ⟨_, _, rfl⟩ <;> [

Proof state:
case inl.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
a : α
h : a ∈ s
⊢ a ∈ s ∪ t

Next tactic:
left
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by rintro ⟨a, h | h, rfl⟩ <;> [left; right] <;> exact ⟨_, h, rfl⟩, by
      rintro (⟨a, h, rfl⟩ | ⟨a, h, rfl⟩) <;> refine' ⟨_, _, rfl⟩ <;> [left; 

Proof state:
case inr.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
a : α
h : a ∈ t
⊢ a ∈ s ∪ t

Next tactic:
right
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by rintro ⟨a, h | h, rfl⟩ <;> [left; right] <;> exact ⟨_, h, rfl⟩, by
      rintro (⟨a, h, rfl⟩ | ⟨a, h, rfl⟩) <;> refine' ⟨_, _, rfl⟩ <;> [left; right] <;> 

Proof state:
case inl.intro.intro.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
a : α
h : a ∈ s
⊢ a ∈ s

Next tactic:
exact h
theorem image_union (f : α → β) (s t : Set α) : f '' (s ∪ t) = f '' s ∪ f '' t :=
  ext fun x =>
    ⟨by rintro ⟨a, h | h, rfl⟩ <;> [left; right] <;> exact ⟨_, h, rfl⟩, by
      rintro (⟨a, h, rfl⟩ | ⟨a, h, rfl⟩) <;> refine' ⟨_, _, rfl⟩ <;> [left; right] <;> 

Proof state:
case inr.intro.intro.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
a : α
h : a ∈ t
⊢ a ∈ t

Next tactic:
exact h
@[simp]
theorem image_empty (f : α → β) : f '' ∅ = ∅ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s t : Set α
f : α → β
⊢ f '' ∅ = ∅

Next tactic:
ext
@[simp]
theorem image_empty (f : α → β) : f '' ∅ = ∅ := by
  ext
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s t : Set α
f : α → β
x✝ : β
⊢ x✝ ∈ f '' ∅ ↔ x✝ ∈ ∅

Next tactic:
simp
theorem image_inter_on {f : α → β} {s t : Set α} (h : ∀ x ∈ t, ∀ y ∈ s, f x = f y → x = y) :
    f '' (s ∩ t) = f '' s ∩ f '' t :=
  (image_inter_subset _ _ _).antisymm
    fun b ⟨⟨a₁, ha₁, h₁⟩, ⟨a₂, ha₂, h₂⟩⟩ ↦
      have : a₂ = a₁ := h _ ha₂ _ ha₁ (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t✝ : Set α
f : α → β
s t : Set α
h : ∀ x ∈ t, ∀ y ∈ s, f x = f y → x = y
b : β
x✝ : b ∈ f '' s ∩ f '' t
a₁ : α
ha₁ : a₁ ∈ s
h₁ : f a₁ = b
a₂ : α
ha₂ : a₂ ∈ t
h₂ : f a₂ = b
⊢ f a₂ = f a₁

Next tactic:
simp [*]
theorem image_univ_of_surjective {ι : Type*} {f : ι → β} (H : Surjective f) : f '' univ = univ :=
  eq_univ_of_forall <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι✝ : Sort u_4
ι' : Sort u_5
f✝ : α → β
s t : Set α
ι : Type u_6
f : ι → β
H : Surjective f
⊢ ∀ (x : β), x ∈ f '' univ

Next tactic:
simpa [image]
@[simp]
theorem image_singleton {f : α → β} {a : α} : f '' {a} = {f a} := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s t : Set α
f : α → β
a : α
⊢ f '' {a} = {f a}

Next tactic:
ext
@[simp]
theorem image_singleton {f : α → β} {a : α} : f '' {a} = {f a} := by
  ext
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s t : Set α
f : α → β
a : α
x✝ : β
⊢ x✝ ∈ f '' {a} ↔ x✝ ∈ {f a}

Next tactic:
simp [image, eq_comm]
@[simp, mfld_simps]
theorem image_eq_empty {α β} {f : α → β} {s : Set α} : f '' s = ∅ ↔ s = ∅ := by
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α✝ → β✝
s✝ t : Set α✝
α : Type u_6
β : Type u_7
f : α → β
s : Set α
⊢ f '' s = ∅ ↔ s = ∅

Next tactic:
simp only [eq_empty_iff_forall_not_mem]
@[simp, mfld_simps]
theorem image_eq_empty {α β} {f : α → β} {s : Set α} : f '' s = ∅ ↔ s = ∅ := by
  simp only [eq_empty_iff_forall_not_mem]
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α✝ → β✝
s✝ t : Set α✝
α : Type u_6
β : Type u_7
f : α → β
s : Set α
⊢ (∀ (x : β), x ∉ f '' s) ↔ ∀ (x : α), x ∉ s

Next tactic:
exact ⟨fun H a ha => H _ ⟨_, ha, rfl⟩, fun H b ⟨_, ha, _⟩ => H _ ha⟩
theorem mem_compl_image [BooleanAlgebra α] (t : α) (S : Set α) :
    t ∈ HasCompl.compl '' S ↔ tᶜ ∈ S := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
s t✝ : Set α
inst✝ : BooleanAlgebra α
t : α
S : Set α
⊢ t ∈ compl '' S ↔ tᶜ ∈ S

Next tactic:
simp [← preimage_compl_eq_image_compl]
@[simp]
theorem image_id_eq : image (id : α → α) = id := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
s t : Set α
⊢ image id = id

Next tactic:
ext
@[simp]
theorem image_id_eq : image (id : α → α) = id := by ext; 

Proof state:
case h.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
s t x✝¹ : Set α
x✝ : α
⊢ x✝ ∈ id '' x✝¹ ↔ x✝ ∈ id x✝¹

Next tactic:
simp
/-- A variant of `image_id` -/
@[simp]
theorem image_id' (s : Set α) : (fun x => x) '' s = s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
s✝ t s : Set α
⊢ (fun x => x) '' s = s

Next tactic:
ext
/-- A variant of `image_id` -/
@[simp]
theorem image_id' (s : Set α) : (fun x => x) '' s = s := by
  ext
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
s✝ t s : Set α
x✝ : α
⊢ x✝ ∈ (fun x => x) '' s ↔ x✝ ∈ s

Next tactic:
simp
theorem image_id (s : Set α) : id '' s = s := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
s✝ t s : Set α
⊢ id '' s = s

Next tactic:
simp
lemma image_iterate_eq {f : α → α} {n : ℕ} : image (f^[n]) = (image f)^[n] := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s t : Set α
f : α → α
n : ℕ
⊢ image f^[n] = (image f)^[n]

Next tactic:
induction' n with n ih
lemma image_iterate_eq {f : α → α} {n : ℕ} : image (f^[n]) = (image f)^[n] := by
  induction' n with n ih; · 

Proof state:
case zero
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s t : Set α
f : α → α
⊢ image f^[Nat.zero] = (image f)^[Nat.zero]

Next tactic:
simp
lemma image_iterate_eq {f : α → α} {n : ℕ} : image (f^[n]) = (image f)^[n] := by
  induction' n with n ih; · simp
  

Proof state:
case succ
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s t : Set α
f : α → α
n : ℕ
ih : image f^[n] = (image f)^[n]
⊢ image f^[Nat.succ n] = (image f)^[Nat.succ n]

Next tactic:
rw [iterate_succ', iterate_succ',← ih, image_comp_eq]
theorem compl_compl_image [BooleanAlgebra α] (S : Set α) :
    HasCompl.compl '' (HasCompl.compl '' S) = S := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f : α → β
s t : Set α
inst✝ : BooleanAlgebra α
S : Set α
⊢ compl '' (compl '' S) = S

Next tactic:
rw [← image_comp, compl_comp_compl, image_id]
theorem image_insert_eq {f : α → β} {a : α} {s : Set α} :
    f '' insert a s = insert (f a) (f '' s) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f : α → β
a : α
s : Set α
⊢ f '' insert a s = insert (f a) (f '' s)

Next tactic:
ext
theorem image_insert_eq {f : α → β} {a : α} {s : Set α} :
    f '' insert a s = insert (f a) (f '' s) := by
  ext
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f : α → β
a : α
s : Set α
x✝ : β
⊢ x✝ ∈ f '' insert a s ↔ x✝ ∈ insert (f a) (f '' s)

Next tactic:
simp [and_or_left, exists_or, eq_comm, or_comm, and_comm]
theorem image_pair (f : α → β) (a b : α) : f '' {a, b} = {f a, f b} := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s t : Set α
f : α → β
a b : α
⊢ f '' {a, b} = {f a, f b}

Next tactic:
simp only [image_insert_eq, image_singleton]
theorem mem_image_iff_of_inverse {f : α → β} {g : β → α} {b : β} {s : Set α} (h₁ : LeftInverse g f)
    (h₂ : RightInverse g f) : b ∈ f '' s ↔ g b ∈ s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f : α → β
g : β → α
b : β
s : Set α
h₁ : LeftInverse g f
h₂ : Function.RightInverse g f
⊢ b ∈ f '' s ↔ g b ∈ s

Next tactic:
rw [image_eq_preimage_of_inverse h₁ h₂]
theorem mem_image_iff_of_inverse {f : α → β} {g : β → α} {b : β} {s : Set α} (h₁ : LeftInverse g f)
    (h₂ : RightInverse g f) : b ∈ f '' s ↔ g b ∈ s := by
  rw [image_eq_preimage_of_inverse h₁ h₂]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f : α → β
g : β → α
b : β
s : Set α
h₁ : LeftInverse g f
h₂ : Function.RightInverse g f
⊢ b ∈ g ⁻¹' s ↔ g b ∈ s

Next tactic:
rfl
theorem image_compl_subset {f : α → β} {s : Set α} (H : Injective f) : f '' sᶜ ⊆ (f '' s)ᶜ :=
  Disjoint.subset_compl_left <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
ι' : Sort u_5
f✝ : α → β
s✝ t : Set α
f : α → β
s : Set α
H : Injective f
⊢ Disjoint (f '' s) (f '' sᶜ)

Next tactic:
simp [disjoint_iff_inf_le, ← image_inter H]