Relations
Mathematically, a relation is a subset of a product space. Equivalently, it is a set of “tuples” with entries from some fixed domains.
In mathematics, the most important relations tend to be binary relations between entities of the same type:
LessThan, on {0, 1, 2, 3} ? {0, 1, 2, 3}:
{ (0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3) }
Contains, on {sunder, sun, sundry, dry} ? {sunder, sun, sundry, dry}:
{ (sunder, sunder), (sunder, sun), (sun, sun),
(sundry, sundry), (sundry, sun), (sundry, dry), (dry, dry) }
SameColor, on {tomato, cherry, banana} ? {tomato, cherry, banana}:
{ (tomato, tomato), (tomato, cherry), (cherry, tomato),
(cherry, cherry), (banana, banana) }
Examples respectively of total order, partial order and equivalence relation.