|
As explained in the Introduction (Chapter INTRODUCTION TO AGGREGATES), when elements are taken out
of a set their parent will be the universe of the set
(or, if the universe is itself a set, the universe of
the universe, etc.); in particular, the set itself is not the parent.
Hence equality testing on set elements is in fact equality testing between
two elements of certain algebraic structures, and the sets are
irrelevant. We only list the (in)equality operator for convenience
here.
Element membership testing is of critical importance for all types
of sets.
Testing whether or not R is a subset of S can be done
if R is an enumerated or indexed set and S is any
set; hence (in)equality testing is only possible
between sets that are not formal sets.
IsNull(R) : SetIndx -> BoolElt
IsNull(R) : SetMulti -> BoolElt
Returns true if and only if the enumerated, indexed, or multi- set R is
empty and does not have its universe defined.
IsEmpty(R) : SetIndx -> BoolElt
IsEmpty(R) : SetMulti -> BoolElt
Returns true if and only if the enumerated, indexed or multi- set R is empty.
Given an element x of a set R with universe U
and an element y of a set S with universe V, where
a common overstructure W can be found
with U⊂W⊃V (see the Introduction (Chapter INTRODUCTION TO AGGREGATES)
for details on overstructures),
return true if and only if
x and y are equal as elements of W.
Given an element x of a set R with universe U
and an element y of a set S with universe V, where
a common overstructure W can be found
with U⊂W⊃V (see the Introduction (Chapter INTRODUCTION TO AGGREGATES)
for details on overstructures),
return true if and only if
x and y are distinct as elements of W.
Returns true if and only if the element x is a member of the set R.
If x is not an element of the universe U of R,
it is attempted to coerce x into U; if this fails, an error
occurs.
Returns true if and only if the element x is not a member
of the set R.
If x is not an element of the parent structure U of R,
it is attempted to coerce x into U; if this fails, an error
occurs.
R subset S : SetIndx, Set -> BoolElt
R subset S : SetMulti, Set -> BoolElt
Returns true if the enumerated, indexed or multi- set R
is a subset of the
set S, false otherwise. For multisets, if an element x of R has
multiplicity n in R, the multiplicity of x in S must be at least n.
Coercion of the elements of R into S is attempted if
necessary, and an error occurs if this fails.
R notsubset S : SetIndx, Set -> BoolElt
R notsubset S : SetMulti, Set -> BoolElt
Returns true if the enumerated, indexed, or multi- set R is a not a subset of the
set S, false otherwise.
Coercion of the elements of R into S is attempted if
necessary, and an error occurs if this fails.
Returns true if and only if R and S are identical sets, where R and S are
enumerated, indexed or multi- sets
For indexed sets, the index function is irrelevant for deciding equality.
For multisets, matching multiplicities must also be equal.
Coercion of the elements of R into S is attempted if
necessary, and an error occurs if this fails.
Returns true if and only if R and S are distinct sets, where R and S are
enumerated indexed, or multi- sets.
For indexed sets, the index function is irrelevant for deciding equality.
For multisets, matching multiplicities must also be equal.
Coercion of the elements of R into S is attempted if
necessary, and an error occurs if this fails.
IsDisjoint(R, S) : SetIndx, SetIndx -> BoolElt
IsDisjoint(R, S) : SetMulti, SetMulti -> BoolElt
Returns true iff the enumerated, indexed or multi- sets R and S are disjoint.
Coercion of the elements of R into S is attempted if
necessary, and an error occurs if this fails.
For each of the following operators, R and S are sets of the same type.
If R and S are both formal sets, then
an error will occur unless both have been constructed with the same
carrier structure F in the definition. If R and S are both enumerated,
indexed, or multi- sets, then an error occurs unless the universes of R and
S are compatible, as defined in the Introduction to this Part
(Chapter INTRODUCTION TO AGGREGATES).
Note that
Q := { ! x in R !}
converts an enumerated set R into a formal set Q.
R join S : SetIndx, SetIndx -> SetIndx
R join S : SetMulti, SetMulti -> SetMulti
R join S : SetFormal, SetFormal -> SetFormal
Union of the sets R and S (see above for the restrictions on
R and S). For multisets, matching multiplicities are added in the
union.
R meet S : SetIndx, SetIndx -> SetIndx
R meet S : SetMulti, SetMulti -> SetMulti
R meet S : SetFormal, SetFormal -> SetFormal
Intersection of the sets R and S (see above for the restrictions on
R and S). For multisets, the minimum of matching multiplicities is
stored in the intersection.
R diff S : SetIndx, SetIndx -> SetIndx
R diff S : SetMulti, SetMulti -> SetMulti
R diff S : SetFormal, SetFormal -> SetFormal
Difference of the sets R and S. i.e., the set consisting
of those elements of R which are not members of S (see above for
the restrictions on R and S).
For multisets, the difference contains any elements of R remaining
after removing the corresponding elements of S the appropriate
number of times.
R sdiff S : SetIndx, SetIndx -> SetIndx
R sdiff S : SetMulti, SetMulti -> SetMulti
R sdiff S : SetFormal, SetFormal -> SetFormal
Symmetric difference of the sets R and S. i.e., the set
consisting of those elements which are members of either
R or S but not both (see above for the restrictions on
R and S).
Alternatively, it is the union of the difference of R with S
and the difference of S with R.
> R := { 1, 2, 3 };
> S := { 1, 1/2, 1/3 };
> R join S;
{ 1/3, 1/2, 1, 2, 3 }
> R meet S;
{ 1 }
> R diff S;
{ 2, 3 }
> S diff R;
{ 1/3, 1/2 }
> R sdiff S;
{ 1/3, 1/2, 2, 3 }
Return the multiplicity in multiset S of element x. If x is not
in S, zero is returned.
Returns the sequence of multiplicities of distinct elements in the
multiset S. The order is the same as the internal enumeration order
of the elements.
The set of all subsets of S.
The set of subsets of S of size k. If k is larger than the cardinality
of S then the result will be empty.
A random subset of S of size k. It is an error if k is larger
than the size of S.
The set of multisets consisting of k not necessarily distinct elements of
S.
The set of sequences of length k with elements from S.
The set of permutations (stored as sequences) of the elements of S.
The set of permutations (stored as sequences) of each of the subsets of
S of cardinality k.
[Next][Prev] [Right] [Left] [Up] [Index] [Root]
|