Relation
Here we are going to formally define general n-ary relation
using the concept of ordered n-tuple.
Definition (ordered n-tuple):
An ordered n-tuple is a set of n
objects with an order
associated with them.
If n objects are represented by x1, x2,
..., xn, then we write the ordered n-tuple as
<x1, x2, ..., xn> .
Definition (Cartesian product):
Let A1, ..., An be n sets.
Then the set of all ordered n-tuples
<x1, ..., xn> ,
where xi
Ai
for all i,
1
i
n ,
is called the Cartesian product of
A1, ..., An, and is denoted by
A1
...
An .
Definition (equality of n-tuples):
Two ordered n-tuples
<x1, ..., xn> and
<y1, ..., yn>
are equal if and only if
xi = yi for all i,
1
i
n .
For example the ordered 3-tuple <1, 2, 3>
can be equal to only <1, 2, 3> and nothing else.
It is not equal to the ordered n-tuple <2, 3, 1>
for example.
Definition (n-ary relation):
An n-ary relation on sets
A1, ..., An is a set
of ordered n-tuples
<a1, ..., an>
where ai is an element of Ai
for all i,
1
i
n .
Thus an n-ary relation on sets
A1, ..., An is a subset of Cartesian
product
A1
...
An .
Example: Let A1 be a set of names,
A2 a set of addresses, and A3 a set of
telephone numbers. Then a set of 3-tuples <name, address,
telephone number> such as {<Amy Angels,
35 Mediterranean Ave, 224-1357>, <Barbara Braves, 221 Atlantic Ave, 301-1734>,
<Charles Cubs, 312 Baltic Ave, 223-9876>}, is a 3-ary (ternary) relation.