ApasScript.

Sets

set

A finite set of numbers, text, or nested sets. Duplicate elements are removed. Numeric sets are sorted; mixed sets retain their first-occurrence order.

union

A union B.

difference

A minus B: the elements of A not in B.

symmetricDifference

Elements in exactly one of A and B.

setWhere

Select members of a finite numeric universal set for which an exact rule is true.

interval

A real interval with exact finite endpoints; -inf and inf give unbounded ends. Each finite end is open or closed.

complement

The complement of A within the universal set U.

isSubset

True if every element of A is in B.

isSuperset

True if A contains every element of B.

isDisjoint

True if A and B have no element in common.

setEqual

True if A and B have the same elements.

contains

True if x is an element of A.

cardinality

The number of elements, |A|.

powerSet

The set of all subsets of A, shown as a set of sets with the subsets in order of size. cardinality and contains work on it. At most 20 elements.

cartesianProduct

The Cartesian product A x B as a set of ordered pairs (a, b), a in A and b in B; with three sets, the set of triplets. The set functions (cardinality, contains, isSubset, union) work on it.

pair

The ordered pair (a, b). Order counts: pair(1, 2) is not pair(2, 1). A set of pairs is a relation.

triplet

The ordered triplet (a, b, c).

relationWhere

The relation from A to B given by a rule: the pairs (x, y) of A x B for which the rule holds.

domain

The domain of a relation: the set of first components of its pairs.

range

The range of a relation: the set of second components of its pairs. (With numbers, range(a, b) is the list a, ..., b - 1.)

imageOf

The set of images of x under a relation: every y with (x, y) in R. A function gives one image.

inverseRelation

The relation with every pair turned round: (y, x) for each (x, y).

isRelation

Whether R is a relation from A to B: a subset of A x B.

isFunction

Whether a relation is a function: no element has two images. With a set A, whether it is a function from A: every element of A has exactly one image.

isOneOne

Whether a relation is one-one: different elements never have the same image.

isOnto

Whether a relation is onto B: every element of B is an image.

isReflexive

Whether (x, x) is in R for every x of A.

isSymmetric

Whether (y, x) is in R whenever (x, y) is.

isTransitive

Whether (x, z) is in R whenever (x, y) and (y, z) are.

isEquivalence

Whether R is an equivalence relation on A: reflexive, symmetric and transitive.

reflexiveClosure

A relation with (x, x) added for every element; the result is a set of pairs.

symmetricClosure

A relation with (b, a) added for every (a, b).

transitiveClosure

A relation with (a, c) added whenever (a, b) and (b, c) are in it.

equivalenceClasses

The classes of the equivalence relation generated by a list of pairs.