The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V03. Sets, finite structures and big operators

Mathlib.Data.Finset.NAry

97 declarations. Mathlib docs · Source

N-ary images of finsets

This file defines Finset.image₂, the binary image of finsets. This is the finset version of Set.image2. This is mostly useful to define pointwise operations.

Notes

This file is very similar to Mathlib/Data/Set/NAry.lean, Mathlib/Order/Filter/NAry.lean and Mathlib/Data/Option/NAry.lean. Please keep them in sync.

We do not define Finset.image₃ as its only purpose would be to prove properties of Finset.image₂ and Set.image2 already fulfills this task.

Algebraic replacement rules

A collection of lemmas to transfer associativity, commutativity, distributivity, ... of operations to the associativity, commutativity, distributivity, ... of Finset.image₂ of those operations.

The proof pattern is image₂_lemma operation_lemma. For example, image₂_comm mul_comm proves that image₂ (*) f g = image₂ (*) g f in a CommSemigroup.

def Finset.image₂ E1 #

{α : Type u_1} → {β : Type u_3} → {γ : Type u_5} → [DecidableEq γ] → (α → β → γ) → Finset α → Finset β → Finset γ

The image of a binary function f : α → β → γ as a function Finset α → Finset β → Finset γ. Mathematically this should be thought of as the image of the corresponding function α × β → γ.

theorem Finset.mem_image₂ E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {c : γ}, c ∈ Finset.image₂ f s t ↔ ∃ a ∈ s, ∃ b ∈ t, f a b = c

theorem Finset.coe_image₂ E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] (f : α → β → γ) (s : Finset α) (t : Finset β),
  ↑(Finset.image₂ f s t) = Set.image2 f ↑s ↑t

theorem Finset.card_image₂_le E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] (f : α → β → γ) (s : Finset α) (t : Finset β),
  (Finset.image₂ f s t).card ≤ s.card * t.card

theorem Finset.card_image₂_iff E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β},
  (Finset.image₂ f s t).card = s.card * t.card ↔ Set.InjOn (fun x ↦ f x.1 x.2) (↑s ×ˢ ↑t)

theorem Finset.card_image₂ E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ},
  Function.Injective2 f → ∀ (s : Finset α) (t : Finset β), (Finset.image₂ f s t).card = s.card * t.card

theorem Finset.mem_image₂_of_mem E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {a : α} {b : β}, a ∈ s → b ∈ t → f a b ∈ Finset.image₂ f s t

theorem Finset.mem_image₂_iff E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {a : α} {b : β}, Function.Injective2 f → (f a b ∈ Finset.image₂ f s t ↔ a ∈ s ∧ b ∈ t)

theorem Finset.image₂_subset E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s s' : Finset α}
  {t t' : Finset β}, s ⊆ s' → t ⊆ t' → Finset.image₂ f s t ⊆ Finset.image₂ f s' t'

theorem Finset.image₂_subset_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t t' : Finset β},
  t ⊆ t' → Finset.image₂ f s t ⊆ Finset.image₂ f s t'

theorem Finset.image₂_subset_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s s' : Finset α} {t : Finset β},
  s ⊆ s' → Finset.image₂ f s t ⊆ Finset.image₂ f s' t

theorem Finset.image_subset_image₂_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {b : β}, b ∈ t → Finset.image (fun a ↦ f a b) s ⊆ Finset.image₂ f s t

theorem Finset.image_subset_image₂_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {a : α}, a ∈ s → Finset.image (fun b ↦ f a b) t ⊆ Finset.image₂ f s t

theorem Finset.forall_mem_image₂ E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {p : γ → Prop}, (∀ z ∈ Finset.image₂ f s t, p z) ↔ ∀ x ∈ s, ∀ y ∈ t, p (f x y)

theorem Finset.exists_mem_image₂ E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {p : γ → Prop}, (∃ z ∈ Finset.image₂ f s t, p z) ↔ ∃ x ∈ s, ∃ y ∈ t, p (f x y)

theorem Finset.image₂_subset_iff E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {u : Finset γ}, Finset.image₂ f s t ⊆ u ↔ ∀ x ∈ s, ∀ y ∈ t, f x y ∈ u

theorem Finset.image₂_subset_iff_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {u : Finset γ}, Finset.image₂ f s t ⊆ u ↔ ∀ a ∈ s, Finset.image (fun b ↦ f a b) t ⊆ u

theorem Finset.image₂_subset_iff_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {u : Finset γ}, Finset.image₂ f s t ⊆ u ↔ ∀ b ∈ t, Finset.image (fun a ↦ f a b) s ⊆ u

theorem Finset.image₂_nonempty_iff E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β},
  (Finset.image₂ f s t).Nonempty ↔ s.Nonempty ∧ t.Nonempty

theorem Finset.Nonempty.image₂ E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β},
  s.Nonempty → t.Nonempty → (Finset.image₂ f s t).Nonempty

theorem Finset.Nonempty.of_image₂_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β},
  (Finset.image₂ f s t).Nonempty → s.Nonempty

theorem Finset.Nonempty.of_image₂_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β},
  (Finset.image₂ f s t).Nonempty → t.Nonempty

theorem Finset.image₂_empty_left E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {t : Finset β},
  Finset.image₂ f ∅ t = ∅

theorem Finset.image₂_empty_right E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α},
  Finset.image₂ f s ∅ = ∅

theorem Finset.image₂_eq_empty_iff E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β},
  Finset.image₂ f s t = ∅ ↔ s = ∅ ∨ t = ∅

theorem Finset.image₂_singleton_left E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {t : Finset β} {a : α},
  Finset.image₂ f {a} t = Finset.image (fun b ↦ f a b) t

theorem Finset.image₂_singleton_right E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {b : β},
  Finset.image₂ f s {b} = Finset.image (fun a ↦ f a b) s

theorem Finset.image₂_singleton_left' E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {t : Finset β} {a : α},
  Finset.image₂ f {a} t = Finset.image (f a) t

theorem Finset.image₂_singleton E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {a : α} {b : β},
  Finset.image₂ f {a} {b} = {f a b}

theorem Finset.image₂_union_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s s' : Finset α} {t : Finset β}
  [inst_1 : DecidableEq α], Finset.image₂ f (s ∪ s') t = Finset.image₂ f s t ∪ Finset.image₂ f s' t

theorem Finset.image₂_union_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t t' : Finset β}
  [inst_1 : DecidableEq β], Finset.image₂ f s (t ∪ t') = Finset.image₂ f s t ∪ Finset.image₂ f s t'

theorem Finset.image₂_insert_left E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {a : α} [inst_1 : DecidableEq α],
  Finset.image₂ f (insert a s) t = Finset.image (fun b ↦ f a b) t ∪ Finset.image₂ f s t

theorem Finset.image₂_insert_right E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {b : β} [inst_1 : DecidableEq β],
  Finset.image₂ f s (insert b t) = Finset.image (fun a ↦ f a b) s ∪ Finset.image₂ f s t

theorem Finset.image₂_inter_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s s' : Finset α} {t : Finset β}
  [inst_1 : DecidableEq α],
  Function.Injective2 f → Finset.image₂ f (s ∩ s') t = Finset.image₂ f s t ∩ Finset.image₂ f s' t

theorem Finset.image₂_inter_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t t' : Finset β}
  [inst_1 : DecidableEq β],
  Function.Injective2 f → Finset.image₂ f s (t ∩ t') = Finset.image₂ f s t ∩ Finset.image₂ f s t'

theorem Finset.image₂_inter_subset_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s s' : Finset α} {t : Finset β}
  [inst_1 : DecidableEq α], Finset.image₂ f (s ∩ s') t ⊆ Finset.image₂ f s t ∩ Finset.image₂ f s' t

theorem Finset.image₂_inter_subset_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t t' : Finset β}
  [inst_1 : DecidableEq β], Finset.image₂ f s (t ∩ t') ⊆ Finset.image₂ f s t ∩ Finset.image₂ f s t'

theorem Finset.image₂_congr E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f f' : α → β → γ} {s : Finset α} {t : Finset β},
  (∀ a ∈ s, ∀ b ∈ t, f a b = f' a b) → Finset.image₂ f s t = Finset.image₂ f' s t

theorem Finset.image₂_congr' E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f f' : α → β → γ} {s : Finset α} {t : Finset β},
  (∀ (a : α) (b : β), f a b = f' a b) → Finset.image₂ f s t = Finset.image₂ f' s t

A common special case of image₂_congr

theorem Finset.card_image₂_singleton_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} (t : Finset β) {a : α},
  Function.Injective (f a) → (Finset.image₂ f {a} t).card = t.card

theorem Finset.card_image₂_singleton_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} (s : Finset α) {b : β},
  (Function.Injective fun a ↦ f a b) → (Finset.image₂ f s {b}).card = s.card

theorem Finset.image₂_singleton_inter E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {a : α} [inst_1 : DecidableEq β]
  (t₁ t₂ : Finset β),
  Function.Injective (f a) → Finset.image₂ f {a} (t₁ ∩ t₂) = Finset.image₂ f {a} t₁ ∩ Finset.image₂ f {a} t₂

theorem Finset.image₂_inter_singleton E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {b : β} [inst_1 : DecidableEq α]
  (s₁ s₂ : Finset α),
  (Function.Injective fun a ↦ f a b) → Finset.image₂ f (s₁ ∩ s₂) {b} = Finset.image₂ f s₁ {b} ∩ Finset.image₂ f s₂ {b}

theorem Finset.card_le_card_image₂_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} (t : Finset β) {a : α}
  {s : Finset α}, a ∈ s → Function.Injective (f a) → t.card ≤ (Finset.image₂ f s t).card

theorem Finset.card_le_card_image₂_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} (s : Finset α) {b : β}
  {t : Finset β}, b ∈ t → (Function.Injective fun x ↦ f x b) → s.card ≤ (Finset.image₂ f s t).card

theorem Finset.biUnion_image_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β},
  (s.biUnion fun a ↦ Finset.image (f a) t) = Finset.image₂ f s t

theorem Finset.biUnion_image_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β},
  (t.biUnion fun b ↦ Finset.image (fun a ↦ f a b) s) = Finset.image₂ f s t

theorem Finset.image_image₂ E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {s : Finset α} {t : Finset β}
  [inst_1 : DecidableEq δ] (f : α → β → γ) (g : γ → δ),
  Finset.image g (Finset.image₂ f s t) = Finset.image₂ (fun a b ↦ g (f a b)) s t

theorem Finset.image₂_image_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {s : Finset α} {t : Finset β}
  [inst_1 : DecidableEq δ] (f : γ → β → δ) (g : α → γ),
  Finset.image₂ f (Finset.image g s) t = Finset.image₂ (fun a b ↦ f (g a) b) s t

theorem Finset.image₂_image_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {s : Finset α} {t : Finset β}
  [inst_1 : DecidableEq δ] (f : α → γ → δ) (g : β → γ),
  Finset.image₂ f s (Finset.image g t) = Finset.image₂ (fun a b ↦ f a (g b)) s t

theorem Finset.image₂_mk_eq_product E0 #

∀ {α : Type u_1} {β : Type u_3} [inst : DecidableEq α] [inst_1 : DecidableEq β] (s : Finset α) (t : Finset β),
  Finset.image₂ Prod.mk s t = s ×ˢ t

theorem Finset.image₂_curry E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] (f : α × β → γ) (s : Finset α) (t : Finset β),
  Finset.image₂ (Function.curry f) s t = Finset.image f (s ×ˢ t)

theorem Finset.image_uncurry_product E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] (f : α → β → γ) (s : Finset α) (t : Finset β),
  Finset.image (Function.uncurry f) (s ×ˢ t) = Finset.image₂ f s t

theorem Finset.image₂_swap E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] (f : α → β → γ) (s : Finset α) (t : Finset β),
  Finset.image₂ f s t = Finset.image₂ (fun a b ↦ f b a) t s

theorem Finset.image₂_left E0 #

∀ {α : Type u_1} {β : Type u_3} {s : Finset α} {t : Finset β} [inst : DecidableEq α],
  t.Nonempty → Finset.image₂ (fun x x_1 ↦ x) s t = s

theorem Finset.image₂_right E0 #

∀ {α : Type u_1} {β : Type u_3} {s : Finset α} {t : Finset β} [inst : DecidableEq β],
  s.Nonempty → Finset.image₂ (fun x y ↦ y) s t = t

theorem Finset.image₂_assoc E1 #

∀ {α : Type u_1} {β : Type u_3} {δ : Type u_7} {ε : Type u_9} {ε' : Type u_10} [inst : DecidableEq ε]
  [inst_1 : DecidableEq ε'] {s : Finset α} {t : Finset β} [inst_2 : DecidableEq δ] {γ : Type u_14} {u : Finset γ}
  {f : δ → γ → ε} {g : α → β → δ} {f' : α → ε' → ε} {g' : β → γ → ε'},
  (∀ (a : α) (b : β) (c : γ), f (g a b) c = f' a (g' b c)) →
    Finset.image₂ f (Finset.image₂ g s t) u = Finset.image₂ f' s (Finset.image₂ g' t u)

theorem Finset.image₂_comm E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  {g : β → α → γ}, (∀ (a : α) (b : β), f a b = g b a) → Finset.image₂ f s t = Finset.image₂ g t s

theorem Finset.image₂_left_comm E1 #

∀ {α : Type u_1} {β : Type u_3} {δ : Type u_7} {δ' : Type u_8} {ε : Type u_9} [inst : DecidableEq δ']
  [inst_1 : DecidableEq ε] {s : Finset α} {t : Finset β} [inst_2 : DecidableEq δ] {γ : Type u_14} {u : Finset γ}
  {f : α → δ → ε} {g : β → γ → δ} {f' : α → γ → δ'} {g' : β → δ' → ε},
  (∀ (a : α) (b : β) (c : γ), f a (g b c) = g' b (f' a c)) →
    Finset.image₂ f s (Finset.image₂ g t u) = Finset.image₂ g' t (Finset.image₂ f' s u)

theorem Finset.image₂_right_comm E1 #

∀ {α : Type u_1} {β : Type u_3} {δ : Type u_7} {δ' : Type u_8} {ε : Type u_9} [inst : DecidableEq δ']
  [inst_1 : DecidableEq ε] {s : Finset α} {t : Finset β} [inst_2 : DecidableEq δ] {γ : Type u_14} {u : Finset γ}
  {f : δ → γ → ε} {g : α → β → δ} {f' : α → γ → δ'} {g' : δ' → β → ε},
  (∀ (a : α) (b : β) (c : γ), f (g a b) c = g' (f' a c) b) →
    Finset.image₂ f (Finset.image₂ g s t) u = Finset.image₂ g' (Finset.image₂ f' s u) t

theorem Finset.image₂_image₂_image₂_comm E1 #

∀ {α : Type u_1} {β : Type u_3} {ε : Type u_9} {ε' : Type u_10} {ζ : Type u_11} {ζ' : Type u_12} {ν : Type u_13}
  [inst : DecidableEq ε] [inst_1 : DecidableEq ε'] {s : Finset α} {t : Finset β} {γ : Type u_14} {δ : Type u_15}
  {u : Finset γ} {v : Finset δ} [inst_2 : DecidableEq ζ] [inst_3 : DecidableEq ζ'] [inst_4 : DecidableEq ν]
  {f : ε → ζ → ν} {g : α → β → ε} {h : γ → δ → ζ} {f' : ε' → ζ' → ν} {g' : α → γ → ε'} {h' : β → δ → ζ'},
  (∀ (a : α) (b : β) (c : γ) (d : δ), f (g a b) (h c d) = f' (g' a c) (h' b d)) →
    Finset.image₂ f (Finset.image₂ g s t) (Finset.image₂ h u v) =
      Finset.image₂ f' (Finset.image₂ g' s u) (Finset.image₂ h' t v)

theorem Finset.image_image₂_distrib E1 #

∀ {α : Type u_1} {α' : Type u_2} {β : Type u_3} {β' : Type u_4} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq α']
  [inst_1 : DecidableEq β'] [inst_2 : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  [inst_3 : DecidableEq δ] {g : γ → δ} {f' : α' → β' → δ} {g₁ : α → α'} {g₂ : β → β'},
  (∀ (a : α) (b : β), g (f a b) = f' (g₁ a) (g₂ b)) →
    Finset.image g (Finset.image₂ f s t) = Finset.image₂ f' (Finset.image g₁ s) (Finset.image g₂ t)

theorem Finset.image_image₂_distrib_left E1 #

∀ {α : Type u_1} {α' : Type u_2} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq α']
  [inst_1 : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β} [inst_2 : DecidableEq δ] {g : γ → δ}
  {f' : α' → β → δ} {g' : α → α'},
  (∀ (a : α) (b : β), g (f a b) = f' (g' a) b) →
    Finset.image g (Finset.image₂ f s t) = Finset.image₂ f' (Finset.image g' s) t

Symmetric statement to Finset.image₂_image_left_comm.

theorem Finset.image_image₂_distrib_right E1 #

∀ {α : Type u_1} {β : Type u_3} {β' : Type u_4} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq β']
  [inst_1 : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β} [inst_2 : DecidableEq δ] {g : γ → δ}
  {f' : α → β' → δ} {g' : β → β'},
  (∀ (a : α) (b : β), g (f a b) = f' a (g' b)) →
    Finset.image g (Finset.image₂ f s t) = Finset.image₂ f' s (Finset.image g' t)

Symmetric statement to Finset.image_image₂_right_comm.

theorem Finset.image₂_image_left_comm E1 #

∀ {α : Type u_1} {α' : Type u_2} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq α']
  [inst_1 : DecidableEq γ] {s : Finset α} {t : Finset β} [inst_2 : DecidableEq δ] {f : α' → β → γ} {g : α → α'}
  {f' : α → β → δ} {g' : δ → γ},
  (∀ (a : α) (b : β), f (g a) b = g' (f' a b)) →
    Finset.image₂ f (Finset.image g s) t = Finset.image g' (Finset.image₂ f' s t)

Symmetric statement to Finset.image_image₂_distrib_left.

theorem Finset.image_image₂_right_comm E1 #

∀ {α : Type u_1} {β : Type u_3} {β' : Type u_4} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq β']
  [inst_1 : DecidableEq γ] {s : Finset α} {t : Finset β} [inst_2 : DecidableEq δ] {f : α → β' → γ} {g : β → β'}
  {f' : α → β → δ} {g' : δ → γ},
  (∀ (a : α) (b : β), f a (g b) = g' (f' a b)) →
    Finset.image₂ f s (Finset.image g t) = Finset.image g' (Finset.image₂ f' s t)

Symmetric statement to Finset.image_image₂_distrib_right.

theorem Finset.image₂_distrib_subset_left E1 #

∀ {α : Type u_1} {β : Type u_3} {β' : Type u_4} {γ' : Type u_6} {δ : Type u_7} {ε : Type u_9} [inst : DecidableEq β']
  [inst_1 : DecidableEq γ'] [inst_2 : DecidableEq ε] {s : Finset α} {t : Finset β} [inst_3 : DecidableEq δ]
  {γ : Type u_14} {u : Finset γ} {f : α → δ → ε} {g : β → γ → δ} {f₁ : α → β → β'} {f₂ : α → γ → γ'} {g' : β' → γ' → ε},
  (∀ (a : α) (b : β) (c : γ), f a (g b c) = g' (f₁ a b) (f₂ a c)) →
    Finset.image₂ f s (Finset.image₂ g t u) ⊆ Finset.image₂ g' (Finset.image₂ f₁ s t) (Finset.image₂ f₂ s u)

The other direction does not hold because of the s-s cross terms on the RHS.

theorem Finset.image₂_distrib_subset_right E1 #

∀ {α : Type u_1} {α' : Type u_2} {β : Type u_3} {β' : Type u_4} {δ : Type u_7} {ε : Type u_9} [inst : DecidableEq α']
  [inst_1 : DecidableEq β'] [inst_2 : DecidableEq ε] {s : Finset α} {t : Finset β} [inst_3 : DecidableEq δ]
  {γ : Type u_14} {u : Finset γ} {f : δ → γ → ε} {g : α → β → δ} {f₁ : α → γ → α'} {f₂ : β → γ → β'} {g' : α' → β' → ε},
  (∀ (a : α) (b : β) (c : γ), f (g a b) c = g' (f₁ a c) (f₂ b c)) →
    Finset.image₂ f (Finset.image₂ g s t) u ⊆ Finset.image₂ g' (Finset.image₂ f₁ s u) (Finset.image₂ f₂ t u)

The other direction does not hold because of the u-u cross terms on the RHS.

theorem Finset.image_image₂_antidistrib E1 #

∀ {α : Type u_1} {α' : Type u_2} {β : Type u_3} {β' : Type u_4} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq α']
  [inst_1 : DecidableEq β'] [inst_2 : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β}
  [inst_3 : DecidableEq δ] {g : γ → δ} {f' : β' → α' → δ} {g₁ : β → β'} {g₂ : α → α'},
  (∀ (a : α) (b : β), g (f a b) = f' (g₁ b) (g₂ a)) →
    Finset.image g (Finset.image₂ f s t) = Finset.image₂ f' (Finset.image g₁ t) (Finset.image g₂ s)

theorem Finset.image_image₂_antidistrib_left E1 #

∀ {α : Type u_1} {β : Type u_3} {β' : Type u_4} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq β']
  [inst_1 : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β} [inst_2 : DecidableEq δ] {g : γ → δ}
  {f' : β' → α → δ} {g' : β → β'},
  (∀ (a : α) (b : β), g (f a b) = f' (g' b) a) →
    Finset.image g (Finset.image₂ f s t) = Finset.image₂ f' (Finset.image g' t) s

Symmetric statement to Finset.image₂_image_left_anticomm.

theorem Finset.image_image₂_antidistrib_right E1 #

∀ {α : Type u_1} {α' : Type u_2} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq α']
  [inst_1 : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β} [inst_2 : DecidableEq δ] {g : γ → δ}
  {f' : β → α' → δ} {g' : α → α'},
  (∀ (a : α) (b : β), g (f a b) = f' b (g' a)) →
    Finset.image g (Finset.image₂ f s t) = Finset.image₂ f' t (Finset.image g' s)

Symmetric statement to Finset.image_image₂_right_anticomm.

theorem Finset.image₂_image_left_anticomm E1 #

∀ {α : Type u_1} {α' : Type u_2} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq α']
  [inst_1 : DecidableEq γ] {s : Finset α} {t : Finset β} [inst_2 : DecidableEq δ] {f : α' → β → γ} {g : α → α'}
  {f' : β → α → δ} {g' : δ → γ},
  (∀ (a : α) (b : β), f (g a) b = g' (f' b a)) →
    Finset.image₂ f (Finset.image g s) t = Finset.image g' (Finset.image₂ f' t s)

Symmetric statement to Finset.image_image₂_antidistrib_left.

theorem Finset.image_image₂_right_anticomm E1 #

∀ {α : Type u_1} {β : Type u_3} {β' : Type u_4} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq β']
  [inst_1 : DecidableEq γ] {s : Finset α} {t : Finset β} [inst_2 : DecidableEq δ] {f : α → β' → γ} {g : β → β'}
  {f' : β → α → δ} {g' : δ → γ},
  (∀ (a : α) (b : β), f a (g b) = g' (f' b a)) →
    Finset.image₂ f s (Finset.image g t) = Finset.image g' (Finset.image₂ f' t s)

Symmetric statement to Finset.image_image₂_antidistrib_right.

theorem Finset.image₂_left_identity E1 #

∀ {α : Type u_1} {γ : Type u_5} [inst : DecidableEq γ] {f : α → γ → γ} {a : α},
  (∀ (b : γ), f a b = b) → ∀ (t : Finset γ), Finset.image₂ f {a} t = t

If a is a left identity for f : α → β → β, then {a} is a left identity for Finset.image₂ f.

theorem Finset.image₂_right_identity E1 #

∀ {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : γ → β → γ} {b : β},
  (∀ (a : γ), f a b = a) → ∀ (s : Finset γ), Finset.image₂ f s {b} = s

If b is a right identity for f : α → β → α, then {b} is a right identity for Finset.image₂ f.

theorem Finset.card_dvd_card_image₂_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β},
  (∀ a ∈ s, Function.Injective (f a)) →
    ((fun a ↦ Finset.image (f a) t) '' ↑s).PairwiseDisjoint id → t.card ∣ (Finset.image₂ f s t).card

If each partial application of f is injective, and images of s under those partial applications are disjoint (but not necessarily distinct!), then the size of t divides the size of Finset.image₂ f s t.

theorem Finset.card_dvd_card_image₂_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α} {t : Finset β},
  (∀ b ∈ t, Function.Injective fun a ↦ f a b) →
    ((fun b ↦ Finset.image (fun a ↦ f a b) s) '' ↑t).PairwiseDisjoint id → s.card ∣ (Finset.image₂ f s t).card

If each partial application of f is injective, and images of t under those partial applications are disjoint (but not necessarily distinct!), then the size of s divides the size of Finset.image₂ f s t.

theorem Finset.subset_set_image₂ E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {u : Finset γ} {s : Set α}
  {t : Set β}, ↑u ⊆ Set.image2 f s t → ∃ s' t', ↑s' ⊆ s ∧ ↑t' ⊆ t ∧ u ⊆ Finset.image₂ f s' t'

If a Finset is a subset of the image of two Sets under a binary operation, then it is a subset of the Finset.image₂ of two Finset subsets of these Sets.

theorem Finset.image₂_inter_union_subset_union E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s s' : Finset α}
  {t t' : Finset β} [inst_1 : DecidableEq α] [inst_2 : DecidableEq β],
  Finset.image₂ f (s ∩ s') (t ∪ t') ⊆ Finset.image₂ f s t ∪ Finset.image₂ f s' t'

theorem Finset.image₂_union_inter_subset_union E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {f : α → β → γ} {s s' : Finset α}
  {t t' : Finset β} [inst_1 : DecidableEq α] [inst_2 : DecidableEq β],
  Finset.image₂ f (s ∪ s') (t ∩ t') ⊆ Finset.image₂ f s t ∪ Finset.image₂ f s' t'

theorem Finset.image₂_inter_union_subset E1 #

∀ {α : Type u_1} {β : Type u_3} [inst : DecidableEq α] [inst_1 : DecidableEq β] {f : α → α → β} {s t : Finset α},
  (∀ (a b : α), f a b = f b a) → Finset.image₂ f (s ∩ t) (s ∪ t) ⊆ Finset.image₂ f s t

theorem Finset.image₂_union_inter_subset E1 #

∀ {α : Type u_1} {β : Type u_3} [inst : DecidableEq α] [inst_1 : DecidableEq β] {f : α → α → β} {s t : Finset α},
  (∀ (a b : α), f a b = f b a) → Finset.image₂ f (s ∪ t) (s ∩ t) ⊆ Finset.image₂ f s t

theorem Finset.sup'_image₂_le E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α}
  {t : Finset β} [inst_1 : SemilatticeSup δ] {g : γ → δ} {a : δ} (h : (Finset.image₂ f s t).Nonempty),
  (Finset.image₂ f s t).sup' h g ≤ a ↔ ∀ x ∈ s, ∀ y ∈ t, g (f x y) ≤ a

theorem Finset.sup'_image₂_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α}
  {t : Finset β} [inst_1 : SemilatticeSup δ] (g : γ → δ) (h : (Finset.image₂ f s t).Nonempty),
  (Finset.image₂ f s t).sup' h g = s.sup' ⋯ fun x ↦ t.sup' ⋯ fun x_1 ↦ g (f x x_1)

theorem Finset.sup'_image₂_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α}
  {t : Finset β} [inst_1 : SemilatticeSup δ] (g : γ → δ) (h : (Finset.image₂ f s t).Nonempty),
  (Finset.image₂ f s t).sup' h g = t.sup' ⋯ fun y ↦ s.sup' ⋯ fun x ↦ g (f x y)

theorem Finset.sup_image₂_le E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α}
  {t : Finset β} [inst_1 : SemilatticeSup δ] [inst_2 : OrderBot δ] {g : γ → δ} {a : δ},
  (Finset.image₂ f s t).sup g ≤ a ↔ ∀ x ∈ s, ∀ y ∈ t, g (f x y) ≤ a

theorem Finset.sup_image₂_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {f : α → β → γ} (s : Finset α)
  (t : Finset β) [inst_1 : SemilatticeSup δ] [inst_2 : OrderBot δ] (g : γ → δ),
  (Finset.image₂ f s t).sup g = s.sup fun x ↦ t.sup fun x_1 ↦ g (f x x_1)

theorem Finset.sup_image₂_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {f : α → β → γ} (s : Finset α)
  (t : Finset β) [inst_1 : SemilatticeSup δ] [inst_2 : OrderBot δ] (g : γ → δ),
  (Finset.image₂ f s t).sup g = t.sup fun y ↦ s.sup fun x ↦ g (f x y)

theorem Finset.le_inf'_image₂ E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α}
  {t : Finset β} [inst_1 : SemilatticeInf δ] {g : γ → δ} {a : δ} (h : (Finset.image₂ f s t).Nonempty),
  a ≤ (Finset.image₂ f s t).inf' h g ↔ ∀ x ∈ s, ∀ y ∈ t, a ≤ g (f x y)

theorem Finset.inf'_image₂_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α}
  {t : Finset β} [inst_1 : SemilatticeInf δ] (g : γ → δ) (h : (Finset.image₂ f s t).Nonempty),
  (Finset.image₂ f s t).inf' h g = s.inf' ⋯ fun x ↦ t.inf' ⋯ fun x_1 ↦ g (f x x_1)

theorem Finset.inf'_image₂_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α}
  {t : Finset β} [inst_1 : SemilatticeInf δ] (g : γ → δ) (h : (Finset.image₂ f s t).Nonempty),
  (Finset.image₂ f s t).inf' h g = t.inf' ⋯ fun y ↦ s.inf' ⋯ fun x ↦ g (f x y)

theorem Finset.le_inf_image₂ E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {f : α → β → γ} {s : Finset α}
  {t : Finset β} [inst_1 : SemilatticeInf δ] [inst_2 : OrderTop δ] {g : γ → δ} {a : δ},
  a ≤ (Finset.image₂ f s t).inf g ↔ ∀ x ∈ s, ∀ y ∈ t, a ≤ g (f x y)

theorem Finset.inf_image₂_left E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {f : α → β → γ} (s : Finset α)
  (t : Finset β) [inst_1 : SemilatticeInf δ] [inst_2 : OrderTop δ] (g : γ → δ),
  (Finset.image₂ f s t).inf g = s.inf fun x ↦ t.inf (g ∘ f x)

theorem Finset.inf_image₂_right E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} {δ : Type u_7} [inst : DecidableEq γ] {f : α → β → γ} (s : Finset α)
  (t : Finset β) [inst_1 : SemilatticeInf δ] [inst_2 : OrderTop δ] (g : γ → δ),
  (Finset.image₂ f s t).inf g = t.inf fun y ↦ s.inf fun x ↦ g (f x y)

theorem Fintype.piFinset_image₂ E1 #

∀ {ι : Type u_14} {α : ι → Type u_15} {β : ι → Type u_16} {γ : ι → Type u_17} [inst : DecidableEq ι]
  [inst_1 : Fintype ι] [inst_2 : (i : ι) → DecidableEq (γ i)] (f : (i : ι) → α i → β i → γ i)
  (s : (i : ι) → Finset (α i)) (t : (i : ι) → Finset (β i)),
  (Fintype.piFinset fun i ↦ Finset.image₂ (f i) (s i) (t i)) =
    Finset.image₂ (fun a b i ↦ f i (a i) (b i)) (Fintype.piFinset s) (Fintype.piFinset t)

theorem Set.toFinset_image2 E0 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] (f : α → β → γ) (s : Set α) (t : Set β)
  [inst_1 : Fintype ↑s] [inst_2 : Fintype ↑t] [inst_3 : Fintype ↑(Set.image2 f s t)],
  (Set.image2 f s t).toFinset = Finset.image₂ f s.toFinset t.toFinset

theorem Set.Finite.toFinset_image2 E1 #

∀ {α : Type u_1} {β : Type u_3} {γ : Type u_5} [inst : DecidableEq γ] {s : Set α} {t : Set β} (f : α → β → γ)
  (hs : s.Finite) (ht : t.Finite) (hf : optParam (Set.image2 f s t).Finite ⋯),
  hf.toFinset = Finset.image₂ f hs.toFinset ht.toFinset