Sets
Relations
Correspondences
Ordered Sets
Lattices
Graphs
Powersets
Binary Strings
Logic
AIA
Greek
Glossary
Abstracts
Argument
Inquiry Cycle
Legal Relations
Presentations
Elicitation
Glossaries
Goals
i*
SCR
Tracing
Design Patterns
Javadoc
Java Packages
Java Types
A (binary) relation R between sets X and Y is a subset of X×Y. (X×Y is a Cartesian product.)
Thus, a relation is a set of pairs.
The interpretation of this subset is that it contains all the pairs for which the relation is true. We write xRy if the relation is true for x and y (equivalently, if (x,y)∈R).
X and Y can be the same set, in which case the relation is said to be "on" rather than "between":
A (binary) relation R on set E is a subset of E×E. (E×E is a Cartesian product.)
Examples using E={0,1,2,3}:
Relations may also be of other arities. An n-ary relation R between sets X1, ... , and Xn is a subset of the n-ary product X1×...×Xn, in which case R is a set of n-tuples.
The empty relation between sets X and Y, or on E, is the empty set ∅.
The empty relation is false for all pairs.
The full relation (or universal relation) between sets X and Y is the set X×Y.
The full relation on set E is the set E×E.
The full relation is true for all pairs.
The identity relation on set E is the set {(x,x) | x∈E}.
The identity relation is true for all pairs whose first and second element are identical.
All these relations are definitions of the relation "likes" on the set {Ann, Bob, Chip}.
Let R be a relation on E, and let x,y,z∈E.
A relation R is ... | if ... | A relation R is ... | if ... | |
---|---|---|---|---|
reflexive | xRx | irreflexive | xRy implies x≠y | |
symmetric | xRy implies yRx | antisymmetric | xRy and yRx implies x=y | |
transitive | xRy and yRz implies xRz |
Examples using =, <, and ≤ on integers:
Examples using Ann, Bob, and Chip:
An equivalence relation is a relation that is reflexive, symmetric, and transitive.
Example: = is an equivalence relation, because = is reflexive, symmetric, and transitive.
An equivalence relation partitions its domain E into disjoint equivalence classes.
Examples:
An order (or partial order) is a relation that is antisymmetric and transitive.
Examples:
In mathematics and formal reasoning, order relations are commonly allowed to include equal elements as well. However, for some authors and in everyday usage, orders are more commonly irreflexive, so that "John is taller than Thomas" does not include the possibility that John and Thomas are the same height.
A strict order is one that is irreflexive and transitive; such an order is also trivially antisymmetric because there is no x and y such that xRy and yRx.
A non-strict order is one that is reflexive, antisymmetric, and transitive. Any order we discuss will be considered non-strict unless specifically stated otherwise.
Examples:
An order relation R on E is a total order if either xRy or yRx for every pair of elements x,y∈E.
An order relation R on E is a partial order if there is a pair of elements x,y∈E for which neither xRy nor yRx.
Let R be an order relation on E and let x,y∈E. x and y are incomparable under R if neither xRy nor yRx. We write this as x||y (or x#y). From the definitions, we can see that a total order is one for which no two elements are incomparable, and a partial order is one for which at least two elements are incomparable.
Examples:
Let R be a relation from X to Y and S be a relation from Y to Z.
The composition (or join) of R and S, written R.S, is the relation {(x,z)∈X×Z | xRy and ySz for some y∈Y}.
A function-style notation S○R is also sometimes seen, but is quite inconvenient for relations. The notation R.S is easier to deal with as the relations are named in the order that leaves them adjacent to the elements that they apply to (thus x(R.S)z because xRy and ySz for some y).
The product of two relations R and S is the relation {(w,x,y,z) | wRx∧yRz} }
The converse (or transpose) of R, written R−1, is the relation {(y,x) | xRy}.
The closure of a relation R is the relation {(x,z) | (x,y)∈R∧(y,z)∈R}.
The transitive closure of R is the smallest transitive relation S such that R⊆S. You can obtain the transitive closure of R by closing it, closing the result, and continuing to close the result of the previous closure until no further tuples are added.
Because relations are sets (of pairs), all the operations on sets also apply to relations.
The intersection of R and S, written RS, is the relation {x(RS)y | xRy and xSy}.
The union of R and S, written R∪S, is the relation {x(R∪S)y | xRy or xSy}.
The difference of R and S, written R−S or R \ S, is the relation {x(R−S)y | xRy but not xSy}.
Let
Transitivity and composition may seem similar: both are defined using x, y, and z, for one thing. But they are unrelated: transitivity is a property of a single relation, while composition is an operator on two relations that produces a third relation (which may or may not be transitive).
Symmetric and converse may also seem similar; both are described by swapping the order of pairs. But they are also unrelated: symmetry is a property of a single relation, while converse is an operator that takes a relation and produces another relation (which may or may not be symmetric). It is true, however, that the union of a relation with its converse is a symmetric relation.
Because relations are sets (of pairs), the relations on sets also apply to relations.
Let E be a set and R and S be relations on E.
R and S are equal if for every x,y∈E, xRy iff xSy.
R is a subset of S if for every x,y∈E, xRy implies xSy.
Examples:
I thank Alex Fink and his unnamed student for pointing out an error in an earlier version of this page.