Power Sets
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).
- PowerIndexedSet(R): Str -> PowSetIndx
The structure comprising all indexed subsets of structure \(R\).
- PowerMultiset(R): Str -> PowSetMulti
The structure consisting of all submultisets of the structure \(R\).
- S in P: SetEnum, PowSetEnum -> BoolElt
Returns
trueif 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\);falseotherwise.
- S in P: SetIndx, PowSetIndx -> BoolElt
Returns
trueif indexed 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\);falseotherwise.
- S in P: SetMulti, PowSetMulti -> BoolElt
Returns
trueif multiset \(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\);falseotherwise.
- P ! S: PowSetEnum, SetEnum -> SetEnum
Return a set with universe \(R\) consisting of the elements of the set \(S\), where \(P\) is the power set of \(R\). An error results if not all elements of \(S\) can be coerced into \(R\).
- P ! S: PowSetIndx, SetIndx -> SetIndx
Return an indexed set with universe \(R\) consisting of the elements of the set \(S\), where \(P\) is the power indexed set of \(R\). An error results if not all elements of \(S\) can be coerced into \(R\).
- P ! S: PowSetMulti, SetMulti -> SetMulti
Return a multiset with universe \(R\) consisting of the elements of the set \(S\), where \(P\) is the power multiset of \(R\). An error results if not all elements of \(S\) can be coerced into \(R\).
- Example: Power Sets (ex-0340bf)
> S := { 1 .. 10 }; > P := PowerSet(S); > P; Set of subsets of { 1 .. 10 } > F := { 6/3, 12/4 }; > F in P; true > G := P ! F; > Parent(F); Set of subsets of Rational Field > Parent(G); Set of subsets of { 1 .. 10 }
The Cartesian Product Constructors
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 Chapter Tuples and Cartesian Products for details.