Unordered tuples of elements of a multiset #
Defines Multiset.sym
and the specialized Multiset.sym2
for computing multisets of all
unordered n-tuples from a given multiset. These are multiset versions of Nat.multichoose
.
Main declarations #
Multiset.sym2
:xs.sym2
is the multiset of all unordered pairs of elements fromxs
, with multiplicity. The multiset's values are inSym2 α
.
TODO #
Once
List.Perm.sym
is defined, defineprotected def sym (n : Nat) (m : Multiset α) : Multiset (Sym α n) := m.liftOn (fun xs => xs.sym n) (List.perm.sym n)
and then use this to remove the
DecidableEq
assumption fromFinset.sym
.theorem injective_sym2 : Function.Injective (Multiset.sym2 : Multiset α → _)
theorem strictMono_sym2 : StrictMono (Multiset.sym2 : Multiset α → _)
theorem
Multiset.sym2_cons
{α : Type u_1}
(a : α)
(m : Multiset α)
:
(a ::ₘ m).sym2 = Multiset.map (fun (b : α) => s(a, b)) (a ::ₘ m) + m.sym2
theorem
Multiset.sym2_map
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(m : Multiset α)
:
(Multiset.map f m).sym2 = Multiset.map (Sym2.map f) m.sym2
theorem
Multiset.dedup_sym2
{α : Type u_1}
[DecidableEq α]
(m : Multiset α)
:
m.sym2.dedup = m.dedup.sym2