Calculates and returns the powerset of a Set.

powerset(x, simplify = FALSE)

Arguments

x

Set

simplify

logical, if TRUE then tries to simplify the result to a Set otherwise creates an object of class PowersetSet.

Value

Set

Details

A powerset of a set, S, is defined as the set of all subsets of S, including S itself and the empty set.

See also

Examples

# 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"