Let \(C \) represent the set of living cats, and let \(H \) represent the set of living humans. Then one relationship between elements of these two sets can be expressed by writing \(c \mathrel{R} h \) to mean that cat \(c \) is the pet of human \(h \text{.}\)
Let \(H \) represent the set of living humans. Then one type of relationship between elements of this set can be expressed by writing \(h_1 \mathrel{R} h_2 \) to mean that human \(h_1 \) is the parent of human \(h_2 \text{.}\)
One type of relationship between elements of \(\posset{\N} \) can be expressed by writing \(m \mid n \) to mean that nonzero natural number \(m \) divides nonzero natural number \(n \text{.}\)
Just as with functions, we want to avoid the use of the undefinable word βruleβ. Notice that a relation just pairs elements of a set \(A \) with elements of a set \(B \text{;}\) we have seen this before.
With this formal definition, writing \(R \subseteq A \cartprod B \) becomes the same as saying β\(R \) is a relation between elements of \(A \) and \(B \text{,}\)β and writing \((a,b) \in R \) becomes the same as writing \(a \mathrel{R} b \text{.}\)
Recall that our formal definition of function states that a function \(A \to B \) is a special kind of subset of \(A \cartprod B \text{.}\) But every subset of \(A \cartprod B \) can be considered as a relation, so a function is a special kind of relation.
The difference is that a function \(A \to B \) must assign exactly one element of \(B \) to each element of \(A \text{,}\) whereas a relation from \(A \) to \(B \) can assign any number of elements of \(B \) (even zero) to each element of \(A \text{.}\) That is, a relation does not have to be well-defined (see ExampleΒ 10.1.17), and can be left undefined on some elements of \(A \) (see ExampleΒ 10.1.16).
\begin{equation*}
R = \setdef{(a,C)}{a \in C} \subseteq A \cartprod \powset{A} \text{.}
\end{equation*}
Then \(a \mathrel{R} C \) means \(a \in C \text{.}\) This relation is in general not a function, since it is not well-defined: an element of \(A \) can be contained in several subsets of \(A \text{.}\)
A relation between pairs of objects, such as the ones we have considered so far, is sometimes called a binary relation. But we can consider relationships between collections of more than two objects.
Example17.1.9.A human (usually) has two biological parents.
Let \(H \) represent the set of all living humans. Then we can define a ternary relation \(R \subseteq H^3 \) by taking \((h_1,h_2,h_3) \in R \) to mean that humans \(h_1,h_2 \) are the parents of human \(h_3 \text{.}\)