Unions of finite sets #
This file defines the union of a family t : α → Finset β
of finsets bounded by a finset
s : Finset α
.
Main declarations #
Finset.disjUnion
: Given a hypothesish
which states that finsetss
andt
are disjoint,s.disjUnion t h
is the set such thata ∈ disjUnion s t h
iffa ∈ s
ora ∈ t
; this does not require decidable equality on the typeα
.Finset.biUnion
: Finite unions of finsets; given an indexing functionf : α → Finset β
and ans : Finset α
,s.biUnion f
is the union of all finsets of the formf a
fora ∈ s
.
TODO #
Remove Finset.biUnion
in favour of Finset.sup
.
def
Finset.disjiUnion
{α : Type u_1}
{β : Type u_2}
(s : Finset α)
(t : α → Finset β)
(hf : (↑s).PairwiseDisjoint t)
:
Finset β
disjiUnion s f h
is the set such that a ∈ disjiUnion s f
iff a ∈ f i
for some i ∈ s
.
It is the same as s.biUnion f
, but it does not require decidable equality on the type. The
hypothesis ensures that the sets are disjoint.
Instances For
@[simp]
theorem
Finset.disjiUnion_cons
{α : Type u_1}
{β : Type u_2}
(a : α)
(s : Finset α)
(ha : a ∉ s)
(f : α → Finset β)
(H : (↑(Finset.cons a s ha)).PairwiseDisjoint f)
:
(Finset.cons a s ha).disjiUnion f H = (f a).disjUnion (s.disjiUnion f ⋯) ⋯
@[simp]
theorem
Finset.disjiUnion_filter_eq
{α : Type u_1}
{β : Type u_2}
[DecidableEq β]
(s : Finset α)
(t : Finset β)
(f : α → β)
:
t.disjiUnion (fun (a : β) => Finset.filter (fun (x : α) => f x = a) s) ⋯ = Finset.filter (fun (c : α) => f c ∈ t) s
theorem
Finset.disjiUnion_filter_eq_of_maps_to
{α : Type u_1}
{β : Type u_2}
[DecidableEq β]
{s : Finset α}
{t : Finset β}
{f : α → β}
(h : ∀ x ∈ s, f x ∈ t)
:
t.disjiUnion (fun (a : β) => Finset.filter (fun (x : α) => f x = a) s) ⋯ = s
def
Finset.biUnion
{α : Type u_1}
{β : Type u_2}
[DecidableEq β]
(s : Finset α)
(t : α → Finset β)
:
Finset β
Finset.biUnion s t
is the union of t a
over a ∈ s
.
(This was formerly bind
due to the monad structure on types with DecidableEq
.)
Equations
- s.biUnion t = (s.val.bind fun (a : α) => (t a).val).toFinset
Instances For
@[simp]
theorem
Finset.biUnion_val
{α : Type u_1}
{β : Type u_2}
[DecidableEq β]
(s : Finset α)
(t : α → Finset β)
:
(s.biUnion t).val = (s.val.bind fun (a : α) => (t a).val).dedup
@[simp]
@[simp]
theorem
Finset.mem_biUnion
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : α → Finset β}
[DecidableEq β]
{b : β}
:
@[simp]
theorem
Finset.coe_biUnion
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : α → Finset β}
[DecidableEq β]
:
↑(s.biUnion t) = ⋃ x ∈ ↑s, ↑(t x)
@[simp]
theorem
Finset.biUnion_insert
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : α → Finset β}
[DecidableEq β]
[DecidableEq α]
{a : α}
:
@[simp]
theorem
Finset.disjiUnion_eq_biUnion
{α : Type u_1}
{β : Type u_2}
[DecidableEq β]
(s : Finset α)
(f : α → Finset β)
(hf : (↑s).PairwiseDisjoint f)
:
s.disjiUnion f hf = s.biUnion f
@[simp]
theorem
Finset.singleton_biUnion
{α : Type u_1}
{β : Type u_2}
{t : α → Finset β}
[DecidableEq β]
{a : α}
:
{a}.biUnion t = t a
theorem
Finset.biUnion_biUnion
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[DecidableEq β]
[DecidableEq γ]
(s : Finset α)
(f : α → Finset β)
(g : β → Finset γ)
:
(s.biUnion f).biUnion g = s.biUnion fun (a : α) => (f a).biUnion g
theorem
Finset.bind_toFinset
{α : Type u_1}
{β : Type u_2}
[DecidableEq β]
[DecidableEq α]
(s : Multiset α)
(t : α → Multiset β)
:
(s.bind t).toFinset = s.toFinset.biUnion fun (a : α) => (t a).toFinset
theorem
Finset.biUnion_mono
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t₁ : α → Finset β}
{t₂ : α → Finset β}
[DecidableEq β]
(h : ∀ a ∈ s, t₁ a ⊆ t₂ a)
:
s.biUnion t₁ ⊆ s.biUnion t₂
theorem
Finset.biUnion_subset_biUnion_of_subset_left
{α : Type u_1}
{β : Type u_2}
{s₁ : Finset α}
{s₂ : Finset α}
[DecidableEq β]
(t : α → Finset β)
(h : s₁ ⊆ s₂)
:
s₁.biUnion t ⊆ s₂.biUnion t
theorem
Finset.subset_biUnion_of_mem
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
[DecidableEq β]
(u : α → Finset β)
{x : α}
(xs : x ∈ s)
:
u x ⊆ s.biUnion u
@[simp]
theorem
Finset.biUnion_singleton_eq_self
{α : Type u_1}
{s : Finset α}
[DecidableEq α]
:
s.biUnion singleton = s
theorem
Finset.filter_biUnion
{α : Type u_1}
{β : Type u_2}
[DecidableEq β]
(s : Finset α)
(f : α → Finset β)
(p : β → Prop)
[DecidablePred p]
:
Finset.filter p (s.biUnion f) = s.biUnion fun (a : α) => Finset.filter p (f a)
theorem
Finset.biUnion_filter_eq_of_maps_to
{α : Type u_1}
{β : Type u_2}
[DecidableEq β]
[DecidableEq α]
{s : Finset α}
{t : Finset β}
{f : α → β}
(h : ∀ x ∈ s, f x ∈ t)
:
(t.biUnion fun (a : β) => Finset.filter (fun (c : α) => f c = a) s) = s
theorem
Finset.erase_biUnion
{α : Type u_1}
{β : Type u_2}
[DecidableEq β]
(f : α → Finset β)
(s : Finset α)
(b : β)
:
(s.biUnion f).erase b = s.biUnion fun (x : α) => (f x).erase b
@[simp]
theorem
Finset.biUnion_nonempty
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : α → Finset β}
[DecidableEq β]
:
(s.biUnion t).Nonempty ↔ ∃ x ∈ s, (t x).Nonempty
theorem
Finset.Nonempty.biUnion
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : α → Finset β}
[DecidableEq β]
(hs : s.Nonempty)
(ht : ∀ x ∈ s, (t x).Nonempty)
:
(s.biUnion t).Nonempty