A function is one kind of interrelationship among objects. For every finite
sequence of objects (called the arguments), a function associates a
unique object (called the value). More formally, a function is defined as
a set of finite lists of objects, one for each combination of possible
arguments. In each list, the initial elements are the arguments, and the final
element is the value. For example, the
function contains the list
, indicating that integer successor of
is
.
A relation is another kind of interrelationship among objects in the universe
of discourse. More formally, a relation is an arbitrary set of finite
lists of objects (of possibly varying lengths). Each list is a selection of
objects that jointly satisfy the relation. For example, the < relation on
numbers contains the list
, indicating that
is
less than
.
Note that both functions and relations are defined as sets of lists. In fact,
every function is a relation. However, not every relation is a function. In a
function, there cannot be two lists that disagree on only the last element.
This would be tantamount to the function having two values for one combination
of arguments. By contrast, in a relation, there can be any number of lists
that agree on all but the last element. For example, the list
is a member of the
function, and there is no other list of
length 2 with
as its first argument, i.e. there is only one successor for
. By contrast, the < relation contains the lists
,
, and so forth, indicating that
is less than
,
,
and so forth.
Many mathematicians require that functions and relations have fixed arity, i.e
they require that all of the lists comprising a function or relation have the
same length. The definitions here allow for functions and relations with
variable arity, i.e. it is perfectly acceptable for a function or a relation to
contain lists of different lengths. For example, the + function contains
the lists
and
, reflecting the
fact that the sum of
and
is
and the fact that the sum of
and
and
is
. Similarly, the relation < contains the lists
and
, reflecting the fact that
is less
than
and the fact that
is less than
and
is less than
.
This flexibility is not essential, but it is extremely convenient and poses no
significant theoretical problems.