The powerset of a multiset #
powerset #
A helper function for the powerset of a multiset. Given a list l
, returns a list
of sublists of l
as multisets.
Equations
- Multiset.powersetAux l = List.map Multiset.ofList l.sublists
Instances For
theorem
Multiset.powersetAux_eq_map_coe
{α : Type u_1}
{l : List α}
:
Multiset.powersetAux l = List.map Multiset.ofList l.sublists
@[simp]
theorem
Multiset.mem_powersetAux
{α : Type u_1}
{l : List α}
{s : Multiset α}
:
s ∈ Multiset.powersetAux l ↔ s ≤ ↑l
Helper function for the powerset of a multiset. Given a list l
, returns a list
of sublists of l
(using sublists'
), as multisets.
Equations
- Multiset.powersetAux' l = List.map Multiset.ofList l.sublists'
Instances For
theorem
Multiset.powersetAux_perm_powersetAux'
{α : Type u_1}
{l : List α}
:
(Multiset.powersetAux l).Perm (Multiset.powersetAux' l)
@[simp]
theorem
Multiset.powersetAux'_cons
{α : Type u_1}
(a : α)
(l : List α)
:
Multiset.powersetAux' (a :: l) = Multiset.powersetAux' l ++ List.map (Multiset.cons a) (Multiset.powersetAux' l)
theorem
Multiset.powerset_aux'_perm
{α : Type u_1}
{l₁ l₂ : List α}
(p : l₁.Perm l₂)
:
(Multiset.powersetAux' l₁).Perm (Multiset.powersetAux' l₂)
theorem
Multiset.powersetAux_perm
{α : Type u_1}
{l₁ l₂ : List α}
(p : l₁.Perm l₂)
:
(Multiset.powersetAux l₁).Perm (Multiset.powersetAux l₂)
The power set of a multiset.
Equations
- s.powerset = Quot.liftOn s (fun (l : List α) => ↑(Multiset.powersetAux l)) ⋯
Instances For
@[simp]
theorem
Multiset.powerset_cons
{α : Type u_1}
(a : α)
(s : Multiset α)
:
(a ::ₘ s).powerset = s.powerset + Multiset.map (Multiset.cons a) s.powerset
theorem
Multiset.map_single_le_powerset
{α : Type u_1}
(s : Multiset α)
:
Multiset.map singleton s ≤ s.powerset
theorem
Multiset.revzip_powersetAux_perm_aux'
{α : Type u_1}
{l : List α}
:
(Multiset.powersetAux l).revzip.Perm (Multiset.powersetAux' l).revzip
theorem
Multiset.revzip_powersetAux_perm
{α : Type u_1}
{l₁ l₂ : List α}
(p : l₁.Perm l₂)
:
(Multiset.powersetAux l₁).revzip.Perm (Multiset.powersetAux l₂).revzip
powersetCard #
Helper function for powersetCard
. Given a list l
, powersetCardAux n l
is the list
of sublists of length n
, as multisets.
Equations
- Multiset.powersetCardAux n l = List.sublistsLenAux n l Multiset.ofList []
Instances For
theorem
Multiset.powersetCardAux_eq_map_coe
{α : Type u_1}
{n : ℕ}
{l : List α}
:
Multiset.powersetCardAux n l = List.map Multiset.ofList (List.sublistsLen n l)
@[simp]
theorem
Multiset.powersetCardAux_zero
{α : Type u_1}
(l : List α)
:
Multiset.powersetCardAux 0 l = [0]
@[simp]
theorem
Multiset.powersetCardAux_nil
{α : Type u_1}
(n : ℕ)
:
Multiset.powersetCardAux (n + 1) [] = []
@[simp]
theorem
Multiset.powersetCardAux_cons
{α : Type u_1}
(n : ℕ)
(a : α)
(l : List α)
:
Multiset.powersetCardAux (n + 1) (a :: l) = Multiset.powersetCardAux (n + 1) l ++ List.map (Multiset.cons a) (Multiset.powersetCardAux n l)
theorem
Multiset.powersetCardAux_perm
{α : Type u_1}
{n : ℕ}
{l₁ l₂ : List α}
(p : l₁.Perm l₂)
:
(Multiset.powersetCardAux n l₁).Perm (Multiset.powersetCardAux n l₂)
powersetCard n s
is the multiset of all submultisets of s
of length n
.
Equations
- Multiset.powersetCard n s = Quot.liftOn s (fun (l : List α) => ↑(Multiset.powersetCardAux n l)) ⋯
Instances For
theorem
Multiset.powersetCard_coe'
{α : Type u_1}
(n : ℕ)
(l : List α)
:
Multiset.powersetCard n ↑l = ↑(Multiset.powersetCardAux n l)
theorem
Multiset.powersetCard_coe
{α : Type u_1}
(n : ℕ)
(l : List α)
:
Multiset.powersetCard n ↑l = ↑(List.map Multiset.ofList (List.sublistsLen n l))
@[simp]
theorem
Multiset.powersetCard_zero_left
{α : Type u_1}
(s : Multiset α)
:
Multiset.powersetCard 0 s = {0}
theorem
Multiset.powersetCard_zero_right
{α : Type u_1}
(n : ℕ)
:
Multiset.powersetCard (n + 1) 0 = 0
@[simp]
theorem
Multiset.powersetCard_cons
{α : Type u_1}
(n : ℕ)
(a : α)
(s : Multiset α)
:
Multiset.powersetCard (n + 1) (a ::ₘ s) = Multiset.powersetCard (n + 1) s + Multiset.map (Multiset.cons a) (Multiset.powersetCard n s)
theorem
Multiset.powersetCard_one
{α : Type u_1}
(s : Multiset α)
:
Multiset.powersetCard 1 s = Multiset.map singleton s
@[simp]
theorem
Multiset.card_powersetCard
{α : Type u_1}
(n : ℕ)
(s : Multiset α)
:
Multiset.card (Multiset.powersetCard n s) = (Multiset.card s).choose n
theorem
Multiset.powersetCard_le_powerset
{α : Type u_1}
(n : ℕ)
(s : Multiset α)
:
Multiset.powersetCard n s ≤ s.powerset
@[simp]
theorem
Multiset.powersetCard_eq_empty
{α : Type u_2}
(n : ℕ)
{s : Multiset α}
(h : Multiset.card s < n)
:
Multiset.powersetCard n s = 0
@[simp]
theorem
Multiset.powersetCard_card_add
{α : Type u_1}
(s : Multiset α)
{i : ℕ}
(hi : 0 < i)
:
Multiset.powersetCard (Multiset.card s + i) s = 0
theorem
Multiset.powersetCard_map
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(n : ℕ)
(s : Multiset α)
:
Multiset.powersetCard n (Multiset.map f s) = Multiset.map (Multiset.map f) (Multiset.powersetCard n s)
theorem
Multiset.pairwise_disjoint_powersetCard
{α : Type u_1}
(s : Multiset α)
:
Pairwise fun (i j : ℕ) => Disjoint (Multiset.powersetCard i s) (Multiset.powersetCard j s)
theorem
Multiset.bind_powerset_len
{α : Type u_2}
(S : Multiset α)
:
((Multiset.range (Multiset.card S + 1)).bind fun (k : ℕ) => Multiset.powersetCard k S) = S.powerset
@[simp]
Alias of the reverse direction of Multiset.nodup_powerset
.
Alias of the forward direction of Multiset.nodup_powerset
.
theorem
Multiset.Nodup.powersetCard
{α : Type u_1}
{n : ℕ}
{s : Multiset α}
(h : s.Nodup)
:
(Multiset.powersetCard n s).Nodup