Finsets in product types #
This file defines finset constructions on the product type α × β
. Beware not to confuse with the
finset.prod
operation which computes the multiplicative product.
Main declarations #
finset.product
: Turnss : finset α
,t : finset β
into their product infinset (α × β)
.finset.diag
: Fors : finset α
,s.diag
is thefinset (α × α)
of pairs(a, a)
witha ∈ s
.finset.off_diag
: Fors : finset α
,s.off_diag
is thefinset (α × α)
of pairs(a, b)
witha, b ∈ s
anda ≠ b
.
prod #
theorem
finset.subset_product
{α : Type u_1}
{β : Type u_2}
[decidable_eq α]
[decidable_eq β]
{s : finset (α × β)} :
s ⊆ (finset.image prod.fst s).product (finset.image prod.snd s)
theorem
finset.product_eq_bUnion
{α : Type u_1}
{β : Type u_2}
[decidable_eq α]
[decidable_eq β]
(s : finset α)
(t : finset β) :
s.product t = s.bUnion (λ (a : α), finset.image (λ (b : β), (a, b)) t)
theorem
finset.product_eq_bUnion_right
{α : Type u_1}
{β : Type u_2}
[decidable_eq α]
[decidable_eq β]
(s : finset α)
(t : finset β) :
s.product t = t.bUnion (λ (b : β), finset.image (λ (a : α), (a, b)) s)
@[simp]
theorem
finset.product_bUnion
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[decidable_eq γ]
(s : finset α)
(t : finset β)
(f : α × β → finset γ) :
See also finset.sup_product_left
.
theorem
finset.filter_product
{α : Type u_1}
{β : Type u_2}
{s : finset α}
{t : finset β}
(p : α → Prop)
(q : β → Prop)
[decidable_pred p]
[decidable_pred q] :
finset.filter (λ (x : α × β), p x.fst ∧ q x.snd) (s.product t) = (finset.filter p s).product (finset.filter q t)
theorem
finset.filter_product_card
{α : Type u_1}
{β : Type u_2}
(s : finset α)
(t : finset β)
(p : α → Prop)
(q : β → Prop)
[decidable_pred p]
[decidable_pred q] :
(finset.filter (λ (x : α × β), p x.fst ↔ q x.snd) (s.product t)).card = ((finset.filter p s).card) * (finset.filter q t).card + ((finset.filter (not ∘ p) s).card) * (finset.filter (not ∘ q) t).card
@[simp]
@[simp]
@[simp]
theorem
finset.union_product
{α : Type u_1}
{β : Type u_2}
{s s' : finset α}
{t : finset β}
[decidable_eq α]
[decidable_eq β] :
@[simp]
theorem
finset.product_union
{α : Type u_1}
{β : Type u_2}
{s : finset α}
{t t' : finset β}
[decidable_eq α]
[decidable_eq β] :
Given a finite set s
, the diagonal, s.diag
is the set of pairs of the form (a, a)
for
a ∈ s
.
Given a finite set s
, the off-diagonal, s.off_diag
is the set of pairs (a, b)
with a ≠ b
for a, b ∈ s
.
@[simp]
@[simp]
@[simp]