l3lab/ntp-mathlib huggingface dataset:
theorem disjoint_range_addRightEmbedding (a b : ℕ) :
    Disjoint (range a) (map (addRightEmbedding a) (range b)) := by
  refine' disjoint_iff_inf_le.mpr _
  intro k hk
  simp only [exists_prop, mem_range, inf_eq_inter, mem_map, addRightEmbedding, mem_inter]
    at hk
  obtain ⟨a, _, ha⟩ := hk.2
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
f : α ↪ β
s : Finset α
a✝ b k : ℕ
hk : k < a✝ ∧ ∃ a < b, { toFun := fun h => h + a✝, inj' := (_ : Injective fun x => x + a✝) } a = k
a : ℕ
left✝ : a < b
ha : { toFun := fun h => h + a✝, inj' := (_ : Injective fun x => x + a✝) } a = k
⊢ k ∈ ⊥

Next tactic:
simpa [← ha] using hk.1
theorem disjiUnion_map {s : Finset α} {t : α → Finset β} {f : β ↪ γ} {h} :
    (s.disjiUnion t h).map f =
      s.disjiUnion (fun a => (t a).map f) fun a ha b hb hab =>
        disjoint_left.mpr fun x hxa hxb => by
          

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f✝ : α ↪ β
s✝ s : Finset α
t : α → Finset β
f : β ↪ γ
h : Set.PairwiseDisjoint (↑s) t
a : α
ha : a ∈ ↑s
b : α
hb : b ∈ ↑s
hab : a ≠ b
x : γ
hxa : x ∈ (fun a => map f (t a)) a
hxb : x ∈ (fun a => map f (t a)) b
⊢ False

Next tactic:
obtain ⟨xa, hfa, rfl⟩ := mem_map.mp hxa
theorem disjiUnion_map {s : Finset α} {t : α → Finset β} {f : β ↪ γ} {h} :
    (s.disjiUnion t h).map f =
      s.disjiUnion (fun a => (t a).map f) fun a ha b hb hab =>
        disjoint_left.mpr fun x hxa hxb => by
          obtain ⟨xa, hfa, rfl⟩ := mem_map.mp hxa
          

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
f✝ : α ↪ β
s✝ s : Finset α
t : α → Finset β
f : β ↪ γ
h : Set.PairwiseDisjoint (↑s) t
a : α
ha : a ∈ ↑s
b : α
hb : b ∈ ↑s
hab : a ≠ b
xa : β
hfa : xa ∈ t a
hxa : f xa ∈ (fun a => map f (t a)) a
hxb : f xa ∈ (fun a => map f (t a)) b
⊢ False

Next tactic:
obtain ⟨xb, hfb, hfab⟩ := mem_map.mp hxb
theorem disjiUnion_map {s : Finset α} {t : α → Finset β} {f : β ↪ γ} {h} :
    (s.disjiUnion t h).map f =
      s.disjiUnion (fun a => (t a).map f) fun a ha b hb hab =>
        disjoint_left.mpr fun x hxa hxb => by
          obtain ⟨xa, hfa, rfl⟩ := mem_map.mp hxa
          obtain ⟨xb, hfb, hfab⟩ := mem_map.mp hxb
          

Proof state:
case intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
f✝ : α ↪ β
s✝ s : Finset α
t : α → Finset β
f : β ↪ γ
h : Set.PairwiseDisjoint (↑s) t
a : α
ha : a ∈ ↑s
b : α
hb : b ∈ ↑s
hab : a ≠ b
xa : β
hfa : xa ∈ t a
hxa : f xa ∈ (fun a => map f (t a)) a
hxb : f xa ∈ (fun a => map f (t a)) b
xb : β
hfb : xb ∈ t b
hfab : f xb = f xa
⊢ False

Next tactic:
obtain rfl := f.injective hfab
theorem disjiUnion_map {s : Finset α} {t : α → Finset β} {f : β ↪ γ} {h} :
    (s.disjiUnion t h).map f =
      s.disjiUnion (fun a => (t a).map f) fun a ha b hb hab =>
        disjoint_left.mpr fun x hxa hxb => by
          obtain ⟨xa, hfa, rfl⟩ := mem_map.mp hxa
          obtain ⟨xb, hfb, hfab⟩ := mem_map.mp hxb
          obtain rfl := f.injective hfab
          

Proof state:
case intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
f✝ : α ↪ β
s✝ s : Finset α
t : α → Finset β
f : β ↪ γ
h : Set.PairwiseDisjoint (↑s) t
a : α
ha : a ∈ ↑s
b : α
hb : b ∈ ↑s
hab : a ≠ b
xb : β
hfb : xb ∈ t b
hfa : xb ∈ t a
hxa : f xb ∈ (fun a => map f (t a)) a
hxb : f xb ∈ (fun a => map f (t a)) b
hfab : f xb = f xb
⊢ False

Next tactic:
exact disjoint_left.mp (h ha hb hab) hfa hfb
theorem range_add_one' (n : ℕ) :
    range (n + 1) = insert 0 ((range n).map ⟨fun i => i + 1, fun i j => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
n i j : ℕ
⊢ (fun i => i + 1) i = (fun i => i + 1) j → i = j

Next tactic:
simp
theorem range_add_one' (n : ℕ) :
    range (n + 1) = insert 0 ((range n).map ⟨fun i => i + 1, fun i j => by simp⟩) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
n : ℕ
⊢ range (n + 1) = insert 0 (map { toFun := fun i => i + 1, inj' := (_ : ∀ (i j : ℕ), i + 1 = j + 1 → i = j) } (range n))

Next tactic:
ext (⟨⟩ | ⟨n⟩)
theorem range_add_one' (n : ℕ) :
    range (n + 1) = insert 0 ((range n).map ⟨fun i => i + 1, fun i j => by simp⟩) := by
  ext (⟨⟩ | ⟨n⟩) <;> 

Proof state:
case a.zero
α : Type u_1
β : Type u_2
γ : Type u_3
n : ℕ
⊢ Nat.zero ∈ range (n + 1) ↔
    Nat.zero ∈ insert 0 (map { toFun := fun i => i + 1, inj' := (_ : ∀ (i j : ℕ), i + 1 = j + 1 → i = j) } (range n))

Next tactic:
simp [Nat.succ_eq_add_one, Nat.zero_lt_succ n]
theorem range_add_one' (n : ℕ) :
    range (n + 1) = insert 0 ((range n).map ⟨fun i => i + 1, fun i j => by simp⟩) := by
  ext (⟨⟩ | ⟨n⟩) <;> 

Proof state:
case a.succ
α : Type u_1
β : Type u_2
γ : Type u_3
n✝ n : ℕ
⊢ Nat.succ n ∈ range (n✝ + 1) ↔
    Nat.succ n ∈ insert 0 (map { toFun := fun i => i + 1, inj' := (_ : ∀ (i j : ℕ), i + 1 = j + 1 → i = j) } (range n✝))

Next tactic:
simp [Nat.succ_eq_add_one, Nat.zero_lt_succ n]
@[simp]
theorem mem_image : b ∈ s.image f ↔ ∃ a ∈ s, f a = b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
⊢ b ∈ image f s ↔ ∃ a ∈ s, f a = b

Next tactic:
simp only [mem_def, image_val, mem_dedup, Multiset.mem_map, exists_prop]
theorem forall_image {p : β → Prop} : (∀ b ∈ s.image f, p b) ↔ ∀ a ∈ s, p (f a) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
p : β → Prop
⊢ (∀ b ∈ image f s, p b) ↔ ∀ a ∈ s, p (f a)

Next tactic:
simp only [mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
theorem mem_image_const : c ∈ s.image (const α b) ↔ s.Nonempty ∧ b = c := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
⊢ c ∈ image (const α b) s ↔ Finset.Nonempty s ∧ b = c

Next tactic:
rw [mem_image]
theorem mem_image_const : c ∈ s.image (const α b) ↔ s.Nonempty ∧ b = c := by
  rw [mem_image]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
⊢ (∃ a ∈ s, const α b a = c) ↔ Finset.Nonempty s ∧ b = c

Next tactic:
simp only [exists_prop, const_apply, exists_and_right]
theorem mem_image_const : c ∈ s.image (const α b) ↔ s.Nonempty ∧ b = c := by
  rw [mem_image]
  simp only [exists_prop, const_apply, exists_and_right]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
⊢ (∃ x, x ∈ s) ∧ b = c ↔ Finset.Nonempty s ∧ b = c

Next tactic:
rfl
instance canLift (c) (p) [CanLift β α c p] :
    CanLift (Finset β) (Finset α) (image c) fun s => ∀ x ∈ s, p x where
  prf := by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c✝ : β
c : α → β
p : β → Prop
inst✝ : CanLift β α c p
⊢ ∀ (x : Finset β), (∀ x_1 ∈ x, p x_1) → ∃ y, image c y = x

Next tactic:
rintro ⟨⟨l⟩, hd : l.Nodup⟩ hl
instance canLift (c) (p) [CanLift β α c p] :
    CanLift (Finset β) (Finset α) (image c) fun s => ∀ x ∈ s, p x where
  prf := by
    rintro ⟨⟨l⟩, hd : l.Nodup⟩ hl
    

Proof state:
case mk.mk
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c✝ : β
c : α → β
p : β → Prop
inst✝ : CanLift β α c p
val✝ : Multiset β
l : List β
hd : List.Nodup l
hl : ∀ x ∈ { val := Quot.mk Setoid.r l, nodup := hd }, p x
⊢ ∃ y, image c y = { val := Quot.mk Setoid.r l, nodup := hd }

Next tactic:
lift l to List α using hl
instance canLift (c) (p) [CanLift β α c p] :
    CanLift (Finset β) (Finset α) (image c) fun s => ∀ x ∈ s, p x where
  prf := by
    rintro ⟨⟨l⟩, hd : l.Nodup⟩ hl
    lift l to List α using hl
    

Proof state:
case mk.mk.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c✝ : β
c : α → β
p : β → Prop
inst✝ : CanLift β α c p
val✝ : Multiset β
l : List α
hd : List.Nodup (List.map c l)
⊢ ∃ y, image c y = { val := Quot.mk Setoid.r (List.map c l), nodup := hd }

Next tactic:
exact ⟨⟨l, hd.of_map _⟩, ext fun a => by simp⟩
instance canLift (c) (p) [CanLift β α c p] :
    CanLift (Finset β) (Finset α) (image c) fun s => ∀ x ∈ s, p x where
  prf := by
    rintro ⟨⟨l⟩, hd : l.Nodup⟩ hl
    lift l to List α using hl
    exact ⟨⟨l, hd.of_map _⟩, ext fun a => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a✝ : α
b c✝ : β
c : α → β
p : β → Prop
inst✝ : CanLift β α c p
val✝ : Multiset β
l : List α
hd : List.Nodup (List.map c l)
a : β
⊢ a ∈ image c { val := ↑l, nodup := (_ : List.Nodup l) } ↔ a ∈ { val := Quot.mk Setoid.r (List.map c l), nodup := hd }

Next tactic:
simp
theorem image_congr (h : (s : Set α).EqOn f g) : Finset.image f s = Finset.image g s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
h : Set.EqOn f g ↑s
⊢ image f s = image g s

Next tactic:
ext
theorem image_congr (h : (s : Set α).EqOn f g) : Finset.image f s = Finset.image g s := by
  ext
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
h : Set.EqOn f g ↑s
a✝ : β
⊢ a✝ ∈ image f s ↔ a✝ ∈ image g s

Next tactic:
simp_rw [mem_image, ← bex_def]
theorem image_congr (h : (s : Set α).EqOn f g) : Finset.image f s = Finset.image g s := by
  ext
  simp_rw [mem_image, ← bex_def]
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
h : Set.EqOn f g ↑s
a✝ : β
⊢ (∃ x, ∃ (_ : x ∈ s), f x = a✝) ↔ ∃ x, ∃ (_ : x ∈ s), g x = a✝

Next tactic:
exact bex_congr fun x hx => by rw [h hx]
theorem image_congr (h : (s : Set α).EqOn f g) : Finset.image f s = Finset.image g s := by
  ext
  simp_rw [mem_image, ← bex_def]
  exact bex_congr fun x hx => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
h : Set.EqOn f g ↑s
a✝ : β
x : α
hx : x ∈ s
⊢ f x = a✝ ↔ g x = a✝

Next tactic:
rw [h hx]
theorem _root_.Function.Injective.mem_finset_image (hf : Injective f) :
    f a ∈ s.image f ↔ a ∈ s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
hf : Injective f
⊢ f a ∈ image f s ↔ a ∈ s

Next tactic:
refine' ⟨fun h => _, Finset.mem_image_of_mem f⟩
theorem _root_.Function.Injective.mem_finset_image (hf : Injective f) :
    f a ∈ s.image f ↔ a ∈ s := by
  refine' ⟨fun h => _, Finset.mem_image_of_mem f⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
hf : Injective f
h : f a ∈ image f s
⊢ a ∈ s

Next tactic:
obtain ⟨y, hy, heq⟩ := mem_image.1 h
theorem _root_.Function.Injective.mem_finset_image (hf : Injective f) :
    f a ∈ s.image f ↔ a ∈ s := by
  refine' ⟨fun h => _, Finset.mem_image_of_mem f⟩
  obtain ⟨y, hy, heq⟩ := mem_image.1 h
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
hf : Injective f
h : f a ∈ image f s
y : α
hy : y ∈ s
heq : f y = f a
⊢ a ∈ s

Next tactic:
exact hf heq ▸ hy
theorem filter_mem_image_eq_image (f : α → β) (s : Finset α) (t : Finset β) (h : ∀ x ∈ s, f x ∈ t) :
    (t.filter fun y => y ∈ s.image f) = s.image f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f✝ g : α → β
s✝ : Finset α
t✝ : Finset β
a : α
b c : β
f : α → β
s : Finset α
t : Finset β
h : ∀ x ∈ s, f x ∈ t
⊢ filter (fun y => y ∈ image f s) t = image f s

Next tactic:
ext
theorem filter_mem_image_eq_image (f : α → β) (s : Finset α) (t : Finset β) (h : ∀ x ∈ s, f x ∈ t) :
    (t.filter fun y => y ∈ s.image f) = s.image f := by
  ext
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f✝ g : α → β
s✝ : Finset α
t✝ : Finset β
a : α
b c : β
f : α → β
s : Finset α
t : Finset β
h : ∀ x ∈ s, f x ∈ t
a✝ : β
⊢ a✝ ∈ filter (fun y => y ∈ image f s) t ↔ a✝ ∈ image f s

Next tactic:
simp only [mem_filter, mem_image, decide_eq_true_eq, and_iff_right_iff_imp, forall_exists_index,
    and_imp]
theorem filter_mem_image_eq_image (f : α → β) (s : Finset α) (t : Finset β) (h : ∀ x ∈ s, f x ∈ t) :
    (t.filter fun y => y ∈ s.image f) = s.image f := by
  ext
  simp only [mem_filter, mem_image, decide_eq_true_eq, and_iff_right_iff_imp, forall_exists_index,
    and_imp]
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f✝ g : α → β
s✝ : Finset α
t✝ : Finset β
a : α
b c : β
f : α → β
s : Finset α
t : Finset β
h : ∀ x ∈ s, f x ∈ t
a✝ : β
⊢ ∀ x ∈ s, f x = a✝ → a✝ ∈ t

Next tactic:
rintro x xel rfl
theorem filter_mem_image_eq_image (f : α → β) (s : Finset α) (t : Finset β) (h : ∀ x ∈ s, f x ∈ t) :
    (t.filter fun y => y ∈ s.image f) = s.image f := by
  ext
  simp only [mem_filter, mem_image, decide_eq_true_eq, and_iff_right_iff_imp, forall_exists_index,
    and_imp]
  rintro x xel rfl
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f✝ g : α → β
s✝ : Finset α
t✝ : Finset β
a : α
b c : β
f : α → β
s : Finset α
t : Finset β
h : ∀ x ∈ s, f x ∈ t
x : α
xel : x ∈ s
⊢ f x ∈ t

Next tactic:
exact h _ xel
theorem fiber_nonempty_iff_mem_image (f : α → β) (s : Finset α) (y : β) :
    (s.filter fun x => f x = y).Nonempty ↔ y ∈ s.image f := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f✝ g : α → β
s✝ : Finset α
t : Finset β
a : α
b c : β
f : α → β
s : Finset α
y : β
⊢ Finset.Nonempty (filter (fun x => f x = y) s) ↔ y ∈ image f s

Next tactic:
simp [Finset.Nonempty]
@[simp, norm_cast]
theorem coe_image {f : α → β} : ↑(s.image f) = f '' ↑s :=
  Set.ext <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f✝ g : α → β
s : Finset α
t : Finset β
a : α
b c : β
f : α → β
⊢ ∀ (x : β), x ∈ ↑(image f s) ↔ x ∈ f '' ↑s

Next tactic:
simp only [mem_coe, mem_image, Set.mem_image, implies_true]
theorem image_toFinset [DecidableEq α] {s : Multiset α} :
    s.toFinset.image f = (s.map f).toFinset :=
  ext fun _ => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g : α → β
s✝ : Finset α
t : Finset β
a : α
b c : β
inst✝ : DecidableEq α
s : Multiset α
x✝ : β
⊢ x✝ ∈ image f (toFinset s) ↔ x✝ ∈ toFinset (Multiset.map f s)

Next tactic:
simp only [mem_image, Multiset.mem_toFinset, exists_prop, Multiset.mem_map]
@[simp]
theorem image_id [DecidableEq α] : s.image id = s :=
  ext fun _ => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
inst✝ : DecidableEq α
x✝ : α
⊢ x✝ ∈ image id s ↔ x✝ ∈ s

Next tactic:
simp only [mem_image, exists_prop, id, exists_eq_right]
theorem image_image [DecidableEq γ] {g : β → γ} : (s.image f).image g = s.image (g ∘ f) :=
  eq_of_veq <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g✝ : α → β
s : Finset α
t : Finset β
a : α
b c : β
inst✝ : DecidableEq γ
g : β → γ
⊢ (image g (image f s)).val = (image (g ∘ f) s).val

Next tactic:
simp only [image_val, dedup_map_dedup_eq, Multiset.map_map]
theorem image_comm {β'} [DecidableEq β'] [DecidableEq γ] {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
inst✝² : DecidableEq β
f✝ g✝ : α → β
s : Finset α
t : Finset β
a : α
b c : β
β' : Type u_4
inst✝¹ : DecidableEq β'
inst✝ : DecidableEq γ
f : β → γ
g : α → β
f' : α → β'
g' : β' → γ
h_comm : ∀ (a : α), f (g a) = g' (f' a)
⊢ image f (image g s) = image g' (image f' s)

Next tactic:
simp_rw [image_image, comp, h_comm]
theorem image_subset_image {s₁ s₂ : Finset α} (h : s₁ ⊆ s₂) : s₁.image f ⊆ s₂.image f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
s₁ s₂ : Finset α
h : s₁ ⊆ s₂
⊢ image f s₁ ⊆ image f s₂

Next tactic:
simp only [subset_def, image_val, subset_dedup', dedup_subset', Multiset.map_subset_map h]
theorem image_subset_iff : s.image f ⊆ t ↔ ∀ x ∈ s, f x ∈ t :=
  calc
    s.image f ⊆ t ↔ f '' ↑s ⊆ ↑t := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
⊢ image f s ⊆ t ↔ f '' ↑s ⊆ ↑t

Next tactic:
norm_cast
lemma image_injective (hf : Injective f) : Injective (image f) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
hf : Injective f
⊢ Injective (image f)

Next tactic:
simpa only [funext (map_eq_image _)] using map_injective ⟨f, hf⟩
theorem image_subset_image_iff {t : Finset α} (hf : Injective f) :
    s.image f ⊆ t.image f ↔ s ⊆ t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t✝ : Finset β
a : α
b c : β
t : Finset α
hf : Injective f
⊢ image f s ⊆ image f t ↔ s ⊆ t

Next tactic:
simp_rw [← coe_subset]
theorem image_subset_image_iff {t : Finset α} (hf : Injective f) :
    s.image f ⊆ t.image f ↔ s ⊆ t := by
  simp_rw [← coe_subset]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t✝ : Finset β
a : α
b c : β
t : Finset α
hf : Injective f
⊢ ↑(image f s) ⊆ ↑(image f t) ↔ ↑s ⊆ ↑t

Next tactic:
push_cast
theorem image_subset_image_iff {t : Finset α} (hf : Injective f) :
    s.image f ⊆ t.image f ↔ s ⊆ t := by
  simp_rw [← coe_subset]
  push_cast
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t✝ : Finset β
a : α
b c : β
t : Finset α
hf : Injective f
⊢ f '' ↑s ⊆ f '' ↑t ↔ ↑s ⊆ ↑t

Next tactic:
exact Set.image_subset_image_iff hf
lemma image_ssubset_image {t : Finset α} (hf : Injective f) : s.image f ⊂ t.image f ↔ s ⊂ t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t✝ : Finset β
a : α
b c : β
t : Finset α
hf : Injective f
⊢ image f s ⊂ image f t ↔ s ⊂ t

Next tactic:
simp_rw [← lt_iff_ssubset]
lemma image_ssubset_image {t : Finset α} (hf : Injective f) : s.image f ⊂ t.image f ↔ s ⊂ t := by
  simp_rw [← lt_iff_ssubset]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f g : α → β
s : Finset α
t✝ : Finset β
a : α
b c : β
t : Finset α
hf : Injective f
⊢ image f s < image f t ↔ s < t

Next tactic:
exact lt_iff_lt_of_le_iff_le' (image_subset_image_iff hf) (image_subset_image_iff hf)
theorem image_filter {p : β → Prop} [DecidablePred p] :
    (s.image f).filter p = (s.filter λ a ↦ p (f a)).image f :=
  ext fun b => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b✝ c : β
p : β → Prop
inst✝ : DecidablePred p
b : β
⊢ b ∈ filter p (image f s) ↔ b ∈ image f (filter (fun a => p (f a)) s)

Next tactic:
simp only [mem_filter, mem_image, exists_prop]
theorem image_filter {p : β → Prop} [DecidablePred p] :
    (s.image f).filter p = (s.filter λ a ↦ p (f a)).image f :=
  ext fun b => by
    simp only [mem_filter, mem_image, exists_prop]
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b✝ c : β
p : β → Prop
inst✝ : DecidablePred p
b : β
⊢ (∃ a ∈ s, f a = b) ∧ p b ↔ ∃ a, (a ∈ s ∧ p (f a)) ∧ f a = b

Next tactic:
exact
      ⟨by rintro ⟨⟨x, h1, rfl⟩, h2⟩; exact ⟨x, ⟨h1, h2⟩, rfl⟩,
       by rintro ⟨x, ⟨h1, h2⟩, rfl⟩; exact ⟨⟨x, h1, rfl⟩, h2⟩⟩
theorem image_filter {p : β → Prop} [DecidablePred p] :
    (s.image f).filter p = (s.filter λ a ↦ p (f a)).image f :=
  ext fun b => by
    simp only [mem_filter, mem_image, exists_prop]
    exact
      ⟨by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b✝ c : β
p : β → Prop
inst✝ : DecidablePred p
b : β
⊢ (∃ a ∈ s, f a = b) ∧ p b → ∃ a, (a ∈ s ∧ p (f a)) ∧ f a = b

Next tactic:
rintro ⟨⟨x, h1, rfl⟩, h2⟩
theorem image_filter {p : β → Prop} [DecidablePred p] :
    (s.image f).filter p = (s.filter λ a ↦ p (f a)).image f :=
  ext fun b => by
    simp only [mem_filter, mem_image, exists_prop]
    exact
      ⟨by rintro ⟨⟨x, h1, rfl⟩, h2⟩; 

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
p : β → Prop
inst✝ : DecidablePred p
x : α
h1 : x ∈ s
h2 : p (f x)
⊢ ∃ a, (a ∈ s ∧ p (f a)) ∧ f a = f x

Next tactic:
exact ⟨x, ⟨h1, h2⟩, rfl⟩
theorem image_filter {p : β → Prop} [DecidablePred p] :
    (s.image f).filter p = (s.filter λ a ↦ p (f a)).image f :=
  ext fun b => by
    simp only [mem_filter, mem_image, exists_prop]
    exact
      ⟨by rintro ⟨⟨x, h1, rfl⟩, h2⟩; exact ⟨x, ⟨h1, h2⟩, rfl⟩,
       by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b✝ c : β
p : β → Prop
inst✝ : DecidablePred p
b : β
⊢ (∃ a, (a ∈ s ∧ p (f a)) ∧ f a = b) → (∃ a ∈ s, f a = b) ∧ p b

Next tactic:
rintro ⟨x, ⟨h1, h2⟩, rfl⟩
theorem image_filter {p : β → Prop} [DecidablePred p] :
    (s.image f).filter p = (s.filter λ a ↦ p (f a)).image f :=
  ext fun b => by
    simp only [mem_filter, mem_image, exists_prop]
    exact
      ⟨by rintro ⟨⟨x, h1, rfl⟩, h2⟩; exact ⟨x, ⟨h1, h2⟩, rfl⟩,
       by rintro ⟨x, ⟨h1, h2⟩, rfl⟩; 

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f g : α → β
s : Finset α
t : Finset β
a : α
b c : β
p : β → Prop
inst✝ : DecidablePred p
x : α
h1 : x ∈ s
h2 : p (f x)
⊢ (∃ a ∈ s, f a = f x) ∧ p (f x)

Next tactic:
exact ⟨⟨x, h1, rfl⟩, h2⟩
theorem image_union [DecidableEq α] {f : α → β} (s₁ s₂ : Finset α) :
    (s₁ ∪ s₂).image f = s₁.image f ∪ s₂.image f :=
  ext fun _ => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f✝ g : α → β
s : Finset α
t : Finset β
a : α
b c : β
inst✝ : DecidableEq α
f : α → β
s₁ s₂ : Finset α
x✝ : β
⊢ x✝ ∈ image f (s₁ ∪ s₂) ↔ x✝ ∈ image f s₁ ∪ image f s₂

Next tactic:
simp only [mem_image, mem_union, exists_prop, or_and_right, exists_or]
theorem image_inter_of_injOn [DecidableEq α] {f : α → β} (s t : Finset α)
    (hf : Set.InjOn f (s ∪ t)) : (s ∩ t).image f = s.image f ∩ t.image f :=
  coe_injective <| by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f✝ g : α → β
s✝ : Finset α
t✝ : Finset β
a : α
b c : β
inst✝ : DecidableEq α
f : α → β
s t : Finset α
hf : Set.InjOn f (↑s ∪ ↑t)
⊢ ↑(image f (s ∩ t)) = ↑(image f s ∩ image f t)

Next tactic:
push_cast
theorem image_inter_of_injOn [DecidableEq α] {f : α → β} (s t : Finset α)
    (hf : Set.InjOn f (s ∪ t)) : (s ∩ t).image f = s.image f ∩ t.image f :=
  coe_injective <| by
    push_cast
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f✝ g : α → β
s✝ : Finset α
t✝ : Finset β
a : α
b c : β
inst✝ : DecidableEq α
f : α → β
s t : Finset α
hf : Set.InjOn f (↑s ∪ ↑t)
⊢ f '' (↑s ∩ ↑t) = f '' ↑s ∩ f '' ↑t

Next tactic:
exact Set.image_inter_on fun a ha b hb => hf (Or.inr ha) <| Or.inl hb
@[simp]
theorem image_singleton (f : α → β) (a : α) : image f {a} = {f a} :=
  ext fun x => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
f✝ g : α → β
s : Finset α
t : Finset β
a✝ : α
b c : β
f : α → β
a : α
x : β
⊢ x ∈ image f {a} ↔ x ∈ {f a}

Next tactic:
simpa only [mem_image, exists_prop, mem_singleton, exists_eq_left] using eq_comm
@[simp]
theorem image_insert [DecidableEq α] (f : α → β) (a : α) (s : Finset α) :
    (insert a s).image f = insert (f a) (s.image f) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
f✝ g : α → β
s✝ : Finset α
t : Finset β
a✝ : α
b c : β
inst✝ : DecidableEq α
f : α → β
a : α
s : Finset α
⊢ image f (insert a s) = insert (f a) (image f s)

Next tactic:
simp only [insert_eq, image_singleton, image_union]