combinat::powerset
-- power set
of a set or listcombinat::powerset
(set)
computes the
powerset of the given set set
, that is, the set of all
subsets of set
.
combinat::powerset
(list)
computes the
powerset of the given list list
, that is, the set of all
sublists of list
. In this context, lists are understood as
multisets.
combinat::powerset
(n)
computes the
powerset of the set 1,2,...,n.
combinat::powerset(n)
combinat::powerset(set)
combinat::powerset(list)
n |
- | a nonnegative integer |
set |
- | a set of domain type DOM_SET |
list |
- | a list of domain type DOM_LIST |
A set of domain type DOM_SET
which contains the computed
subsets.
set
combinat::powerset
is a list, it is
treated like a multiset. This means that sublists that contain the same
elements the same number of times are treated as equal, even if the
elements appear in a different order. Cf. Example 3.>> combinat::powerset({a, b, c})
{{}, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
>> combinat::powerset(3)
{{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}
Here you can see that lists are treated as multisets. There is no sublist [2, 1] since it is identified with the list [1,2] which is in the powerset.
>> combinat::powerset([2, 1, 2])
{[], [1], [2], [1, 2], [2, 2], [1, 2, 2]}