Calculates and returns the powerset of a Set.
powerset(x, simplify = FALSE)
x | |
---|---|
simplify | logical, if |
A powerset of a set, S, is defined as the set of all subsets of S, including S itself and the empty set.
Other operators:
setcomplement()
,
setintersect()
,
setpower()
,
setproduct()
,
setsymdiff()
,
setunion()
# simplify = FALSE is default powerset(Set$new(1, 2)) #> ℘({1, 2}) powerset(Set$new(1, 2), simplify = TRUE) #> {{1, 2}, {1}, {2}, ∅} # powerset of intervals powerset(Interval$new()) #> ℘([-∞,+∞]) # powerset of powersets powerset(powerset(Reals$new())) #> ℘(℘(ℝ)) powerset(powerset(Reals$new()))$properties$cardinality #> [1] "Beth3"