Creating Sets#
The customary braces { } are used to define
enumerated sets. Formal sets are delimited by the composite braces
{ ! and !}.
For indexed sets { @ and @} are used.
For multisets {* and *} are used.
The Formal Set Constructor#
The formal set constructor has the following fixed format (the expressions appearing in the construct are defined above):
- { ! x in F | P(x) ! }#
Form the formal set consisting of the subset of elements \(x\) of \(F\) for which \(P(x)\) is true. If \(P(x)\) is true for every element of \(F\), the set constructor may be abbreviated to
{! x in F !}. Note that the universe of a formal set will always be equal to the carrier set \(F\).
The Enumerated Set Constructor#
Enumerated sets can be constructed by expressions enclosed in braces, provided that the values of all expressions can be automatically coerced into some common structure, as outlined in the Introduction All general constructors have an optional universe ($U$ in the list below) up front, that allows the user to specify into which structure all terms of the sets should be coerced.
- { }: Null Set#
The null set: an empty set that does not have its universe defined.
- { U | }: Str Set#
The empty set with universe \(U\).
- { e_1, e_2, ..., e_n }: Elt, ..., Elt Set#
Given a list of expressions \(e_1, \ldots, e_n\), defining elements \(a_1, a_2, \ldots, a_n\) all belonging to (or automatically coercible into) a single algebraic structure \(U\), create the set \({ a_1, a_2, ..., a_n}\) of elements of \(U\).
- Example: Universe#
We create a set by listing its elements explicitly.
> S := { (7^2+1)/5, (8^2+1)/5, (9^2-1)/5 }; > S; { 10, 13, 16 } > Parent(S); Set of subsets of Rational Field
Thus \(S\) was created as a set of rationals, because
/on integers has a rational result. If one wishes to obtain a set of integers, one could specify the universe (or one could usediv, or one could use!on every element to coerce it into the ring of integers):> T := { Integers() | (7^2+1)/5, (8^2+1)/5, (9^2-1)/5 }; > T; { 10, 13, 16 } > Parent(T); Set of subsets of Integer Ring
- { U | e_1, e_2, ..., e_n }: Str, Elt, ..., Elt Set#
Given a list of expressions \(e_1, \ldots, e_n\), which define elements \(a_1, a_2, \ldots, a_n\) that are all coercible into \(U\), create the set \({ a_1, a_2, ..., a_n }\) of elements of \(U\).