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 α}
:
powersetAux l = List.map ofList l.sublists
@[simp]
theorem
Multiset.mem_powersetAux
{α : Type u_1}
{l : List α}
{s : Multiset α}
:
s ∈ 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 α}
:
(powersetAux l).Perm (powersetAux' l)
@[simp]
theorem
Multiset.powersetAux'_cons
{α : Type u_1}
(a : α)
(l : List α)
:
powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l)
theorem
Multiset.powerset_aux'_perm
{α : Type u_1}
{l₁ l₂ : List α}
(p : l₁.Perm l₂)
:
(powersetAux' l₁).Perm (powersetAux' l₂)
theorem
Multiset.powersetAux_perm
{α : Type u_1}
{l₁ l₂ : List α}
(p : l₁.Perm l₂)
:
(powersetAux l₁).Perm (powersetAux l₂)
The power set of a multiset.
Equations
- s.powerset = Quot.liftOn s (fun (l : List α) => ↑(Multiset.powersetAux l)) ⋯
Instances For
theorem
Multiset.revzip_powersetAux_perm_aux'
{α : Type u_1}
{l : List α}
:
(powersetAux l).revzip.Perm (powersetAux' l).revzip
theorem
Multiset.revzip_powersetAux_perm
{α : Type u_1}
{l₁ l₂ : List α}
(p : l₁.Perm l₂)
:
(powersetAux l₁).revzip.Perm (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
Instances For
theorem
Multiset.powersetCardAux_eq_map_coe
{α : Type u_1}
{n : ℕ}
{l : List α}
:
powersetCardAux n l = List.map ofList (List.sublistsLen n l)
@[simp]
@[simp]
@[simp]
theorem
Multiset.powersetCardAux_cons
{α : Type u_1}
(n : ℕ)
(a : α)
(l : List α)
:
powersetCardAux (n + 1) (a :: l) = powersetCardAux (n + 1) l ++ List.map (cons a) (powersetCardAux n l)
theorem
Multiset.powersetCardAux_perm
{α : Type u_1}
{n : ℕ}
{l₁ l₂ : List α}
(p : l₁.Perm l₂)
:
(powersetCardAux n l₁).Perm (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 α)
:
powersetCard n ↑l = ↑(powersetCardAux n l)
theorem
Multiset.powersetCard_coe
{α : Type u_1}
(n : ℕ)
(l : List α)
:
powersetCard n ↑l = ↑(List.map ofList (List.sublistsLen n l))
@[simp]
@[simp]
theorem
Multiset.powersetCard_cons
{α : Type u_1}
(n : ℕ)
(a : α)
(s : Multiset α)
:
powersetCard (n + 1) (a ::ₘ s) = powersetCard (n + 1) s + map (cons a) (powersetCard n s)
theorem
Multiset.powersetCard_one
{α : Type u_1}
(s : Multiset α)
:
powersetCard 1 s = map singleton s
@[simp]
theorem
Multiset.card_powersetCard
{α : Type u_1}
(n : ℕ)
(s : Multiset α)
:
(powersetCard n s).card = s.card.choose n
theorem
Multiset.powersetCard_le_powerset
{α : Type u_1}
(n : ℕ)
(s : Multiset α)
:
powersetCard n s ≤ s.powerset
theorem
Multiset.powersetCard_mono
{α : Type u_1}
(n : ℕ)
{s t : Multiset α}
(h : s ≤ t)
:
powersetCard n s ≤ powersetCard n t
@[simp]
theorem
Multiset.powersetCard_eq_empty
{α : Type u_2}
(n : ℕ)
{s : Multiset α}
(h : s.card < n)
:
powersetCard n s = 0
@[simp]
theorem
Multiset.powersetCard_card_add
{α : Type u_1}
(s : Multiset α)
{i : ℕ}
(hi : 0 < i)
:
powersetCard (s.card + i) s = 0
theorem
Multiset.powersetCard_map
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(n : ℕ)
(s : Multiset α)
:
powersetCard n (map f s) = map (map f) (powersetCard n s)
theorem
Multiset.pairwise_disjoint_powersetCard
{α : Type u_1}
(s : Multiset α)
:
_root_.Pairwise fun (i j : ℕ) => Disjoint (powersetCard i s) (powersetCard j s)
theorem
Multiset.bind_powerset_len
{α : Type u_2}
(S : Multiset α)
:
((range (S.card + 1)).bind fun (k : ℕ) => 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)
:
(powersetCard n s).Nodup