The PowerSet constructor returns a structure comprising the subsets of a given structure R; it is mainly useful as a parent for other set and sequence constructors. The only operations that are allowed on power sets are printing, testing element membership, and coercion into the power set (see the examples below).
The structure comprising all enumerated subsets of structure R. If R itself is a set (or sequence) then the power set of its universe is returned.
True if enumerated set S is in the power set P, that is, if all elements of the set S are contained in or coercible into R, where P is the power set of R; false otherwise.
Return a set with universe R consisting of the elements of the enumerated set S, where P is the power set of R. An error results if not all elements of S can be coerced into R.
> S := { 1 .. 10 };
> P := PowerSet(S);
> print P;
Set of subsets of { 1 .. 10 }
> F := { 6/3, 12/4 };
> print F in P;
true
> G := P ! F;
> print Parent(F);
Set of subsets of Rational Field
> print Parent(G);
Set of subsets of { 1 .. 10 }
Using car< > and CartesianProduct( ), it is possible to create the Cartesian product of sets (or, in fact, of any combination of structures), but the result will be of type `Cartesian product' rather than set, and the elements are tuples -- we refer the reader to the Chapter on tuples for details.
[Next] [Prev] [Right] [Left] [Up] [Index] [Root]