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.offDiag
: Fors : Finset α
,s.offDiag
is theFinset (α × α)
of pairs(a, b)
witha, b ∈ s
anda ≠ b
.
prod #
theorem
Finset.subset_product_image_fst
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : Finset β}
[DecidableEq α]
:
Finset.image Prod.fst (s ×ˢ t) ⊆ s
theorem
Finset.subset_product_image_snd
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : Finset β}
[DecidableEq β]
:
Finset.image Prod.snd (s ×ˢ t) ⊆ t
theorem
Finset.product_image_fst
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : Finset β}
[DecidableEq α]
(ht : t.Nonempty)
:
Finset.image Prod.fst (s ×ˢ t) = s
theorem
Finset.product_image_snd
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : Finset β}
[DecidableEq β]
(ht : s.Nonempty)
:
Finset.image Prod.snd (s ×ˢ t) = t
theorem
Finset.subset_product
{α : Type u_1}
{β : Type u_2}
[DecidableEq α]
[DecidableEq β]
{s : Finset (α × β)}
:
s ⊆ Finset.image Prod.fst s ×ˢ Finset.image Prod.snd s
theorem
Finset.map_swap_product
{α : Type u_1}
{β : Type u_2}
(s : Finset α)
(t : Finset β)
:
Finset.map { toFun := Prod.swap, inj' := ⋯ } (t ×ˢ s) = s ×ˢ t
@[simp]
theorem
Finset.image_swap_product
{α : Type u_1}
{β : Type u_2}
[DecidableEq (α × β)]
(s : Finset α)
(t : Finset β)
:
Finset.image Prod.swap (t ×ˢ s) = s ×ˢ t
theorem
Finset.product_eq_biUnion
{α : Type u_1}
{β : Type u_2}
[DecidableEq (α × β)]
(s : Finset α)
(t : Finset β)
:
s ×ˢ t = s.biUnion fun (a : α) => Finset.image (fun (b : β) => (a, b)) t
theorem
Finset.product_eq_biUnion_right
{α : Type u_1}
{β : Type u_2}
[DecidableEq (α × β)]
(s : Finset α)
(t : Finset β)
:
s ×ˢ t = t.biUnion fun (b : β) => Finset.image (fun (a : α) => (a, b)) s
theorem
Finset.filter_product
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : Finset β}
(p : α → Prop)
(q : β → Prop)
[DecidablePred p]
[DecidablePred q]
:
Finset.filter (fun (x : α × β) => p x.1 ∧ q x.2) (s ×ˢ t) = Finset.filter p s ×ˢ Finset.filter q t
theorem
Finset.filter_product_left
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : Finset β}
(p : α → Prop)
[DecidablePred p]
:
Finset.filter (fun (x : α × β) => p x.1) (s ×ˢ t) = Finset.filter p s ×ˢ t
theorem
Finset.filter_product_right
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : Finset β}
(q : β → Prop)
[DecidablePred q]
:
Finset.filter (fun (x : α × β) => q x.2) (s ×ˢ t) = s ×ˢ Finset.filter q t
theorem
Finset.filter_product_card
{α : Type u_1}
{β : Type u_2}
(s : Finset α)
(t : Finset β)
(p : α → Prop)
(q : β → Prop)
[DecidablePred p]
[DecidablePred q]
:
(Finset.filter (fun (x : α × β) => p x.1 = q x.2) (s ×ˢ t)).card = (Finset.filter p s).card * (Finset.filter q t).card + (Finset.filter (fun (x : α) => ¬p x) s).card * (Finset.filter (fun (x : β) => ¬q x) t).card
@[simp]
theorem
Finset.singleton_product
{α : Type u_1}
{β : Type u_2}
{t : Finset β}
{a : α}
:
{a} ×ˢ t = Finset.map { toFun := Prod.mk a, inj' := ⋯ } t
@[simp]
theorem
Finset.product_singleton
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{b : β}
:
s ×ˢ {b} = Finset.map { toFun := fun (i : α) => (i, b), inj' := ⋯ } s
@[simp]
theorem
Finset.union_product
{α : Type u_1}
{β : Type u_2}
{s s' : Finset α}
{t : Finset β}
[DecidableEq α]
[DecidableEq β]
:
@[simp]
theorem
Finset.product_union
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t t' : Finset β}
[DecidableEq α]
[DecidableEq β]
:
theorem
Finset.inter_product
{α : Type u_1}
{β : Type u_2}
{s s' : Finset α}
{t : Finset β}
[DecidableEq α]
[DecidableEq β]
:
theorem
Finset.product_inter
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t t' : Finset β}
[DecidableEq α]
[DecidableEq β]
:
theorem
Finset.product_inter_product
{α : Type u_1}
{β : Type u_2}
{s s' : Finset α}
{t t' : Finset β}
[DecidableEq α]
[DecidableEq β]
:
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem
Finset.disjoint_diag_offDiag
{α : Type u_1}
[DecidableEq α]
(s : Finset α)
:
Disjoint s.diag s.offDiag
@[simp]
theorem
Finset.offDiag_filter_lt_eq_filter_le
{ι : Type u_4}
[PartialOrder ι]
[DecidableEq ι]
[DecidableRel LE.le]
[DecidableRel LT.lt]
(s : Finset ι)
:
Finset.filter (fun (i : ι × ι) => i.1 < i.2) s.offDiag = Finset.filter (fun (i : ι × ι) => i.1 ≤ i.2) s.offDiag