Intuitively, a relation is a formula,
( x , y , z ). We say that a, b, c are related according to
( x , y , z ) just in case
( a , b , c ) is true. Influenced by the set theorist who wants to realize “everything” (even formulae) as some set, the modern mathematician views relations extensionally (by what they contain) as sets . For example,
( x , y , z ) naturally defines this set, its extension: {
x , y , z
:
( x , y , z )}. One goes one step further and forgets the role of
. As a result, we give a totally extensional definition of a relation as a set of tuples, disregarding how it may have been formed by a “defining property”.
1.2.0.4 Definition . A binary relation —or simply relation—R is a set of 2-tuples. We use the notations
x , y
R , xRy and R ( x , y ) to mean the same thing .
A relation R , on the other hand, immediately gives rise to an atomic formula —variably denoted by one of the forms
x , y
R , xRy or R ( x , y )— just as the specific relations < and
lead to the atomic formulae x < y and x
y (cf. 1.1.1.1 ).
Pause . So, every formula
( x ,…) defines the relation A = {
x , …
:
( x , …
}, and every (binary) relation R defines the (atomic) formula xRy; right?
Not exactly . If we have an “enormous 41 supply of symbols for formulae, then we could do this, since for every relation we could then introduce a formula symbol (so-called “predicate”)—say, R ,
,
, or whatever—by a definition , such as “ x
y if and only iff
x , y
is a member of the given relation”. This fails in most practical cases, e.g., in set theory and arithmetic, where our symbol-alphabet is finite or enumerable (cf. Definition 1.3.0.40 ). To write down —that is, to “have”—a formula, we need notation for it. As we will see in Section 1.3 , we have far “more” binary relations R than we have means to “write them down” as formulae xRy , if our symbol-alphabet is finite or enumerable .
Hm. Did I not just write down “xRy”? Well, yes; however, writing one or two symbols down, like “R” or “Q” and saying that they “stand for relations” does not equate to having a system of notation to write down all binary relations .
Intuitively, a relation is a table—possibly infinite in length—of pairs like
The head-row names the relation’s variables. The entries in each row represent the tuples-members of the relation. It is standard convention to think of the left column, headed by x as the “input-side”, while the right column as the “output-side”. This is consistent with a “black box” view of the relation
where we don’t know or don’t care what makes it tick, but we do know which inputs cause which output(s).
It is not a priori precluded to have the same input produce several outputs. For example, think of R = {
1, 2
,
1, 1
,
1, 7
}.
Thus, the relation (table) establishes a one-to-many input/output correspondence.
Contrary to our viewpoint with formulae
( x , y )—where the input variables are all the free variables, here x and y —in the case of relations we are allowed two points of view , one being the one presented above, and the other where both x and y are the inputs of the relation R ( x , y ). The context will fend for us!
Of course, when we take all the variables of a relation as input, then the output that is implied—just as in the case of formulae—is one of t or f .
Since
n +1
= (
n
, a n +1 ), there is no loss of generality in focusing mostly on binary relations. In other words, the left (input) column may well be a column of n-tuple entries
. The relation is then said to be ( n +1)- ary and, in table form, would look like
The set consisting of the entries in the input column is the relation’s domain—that is, those inputs that cause some output—while those in the output column constitute the range—that is, the set of all outputs.
1.2.0.5 Definition . Let R be a (binary) relation. Its domain , denoted by dom( R ), is the set { x : (∃ y ) x Ry }. Its range , denoted by ran( R ), is the set { x : (∃ y ) yRx }.
1.2.0.6 Example . Let R = {
x, x
: x
}. Then dom( R ) = ran( R ) =
.
Let Q = {
0, x
: x
}. Then dom( Q ) = {0} and ran( Q ) =
.
Let S = {
x , 0
: x
}. Then ran( S ) = {0} and dom( S ) =
.
Let T = {
0,0
,
0,7
}. Then dom( T )={0} and ran( T ) = {0, 7}.
An abstract term of logic captures well the intentional aspect of a function —indeed a function call —of mathematics and programming: we have a “rule” that defines the input/output dependence. For example, the “rule” x + y that tells us how the output is to be obtained, once we have the x and y values.
While, in logic, a term is a totally different type of object from a formula, on the other hand, extensionally—i.e., in its set theory realization—a function is a subsidiary construct of a relation. Referring back to the black box analogy, a function is simply a relation that obeys the restriction that no input can cause more than one output . So a function, extensionally, is a single-valued relation.
1.2.0.7 Definition . A function R is a single-valued relation. That is, whenever we have both xRy and xRz , we will also have y = z .
It is traditional to use, generically, lower case letters from among f , g , h , k to denote functions but this is by no means a requirement.
1.2.0.8 Example . The empty set is a relation of course, the empty set of pairs. It is also a function since
x , y
⋀
x , z
→ y = z
vacuously, by virtue of the left hand side of → being false.
It is often the case that we study relations, and functions, that take their inputs from a given set A that is fixed throughout the study, and, similarly, produce their outputs in a given fixed set B .
For example, our work on computability in this volume deals exclusively with functions and relations whose inputs and outputs are from
.
Additional terminology has been invented to name these fixed “input-” and “output-spaces” and also to name relations that fully utilize one or the other of these spaces. The input space is called the left field while the output space is called the right field .
If A and B are the adopted left and right fields of the function or relation R then clearly R ⊆ A × B , and, in particular, dom( R ) ⊆ A while ran( R ) ⊆ B . A well-established abbreviation—other than R ⊆ A × B — for “ R is relation with left field a and right field B ” is R : A → B , read “ R is a relation from A to B ”.
If A = B , then we say “ R is a relation on A ”.
If dom( R ) = A , then R is totally defined on A . We just say “ R is total ”. If ran( R ) = B , then R “covers” the entire right field with its outputs. We say “ R is onto ”.
Pause . Totalness and ontoness are relative to a left field and a right field, respectively; they are not absolute notions .
A relation R : A → B is either total or not ( nontotal ). An indifference toward which is which will be expressed by calling R partial . Thus “partial” is not synonymous with “nontotal”. All relations are therefore partial relations .
All the terminology introduced in this
-segment applies to the special case of functions as well .
We now turn to notation and concepts specific to functions. Let f be a function. First off, f ( a ) denotes the unique b such that a f b or
a, b
f . Note that such a b exists iff α
dom( f ). Thus
b = f ( a ) iff
a , b
f iff a f b
We write f ( a ) ↓—pronounced “ f ( a ) is defined” or “ f ( a ) converges ”—to mean a
dom( f ). Otherwise we write f (a ) ↑—pronounced “ f ( a ) is undefined” or “ f ( a ) diverges ”.
The set of all outputs of a function, when the inputs come from a particular set X , is called the image of X under f and is denoted by f → ( X ). Thus,
Pause . So far we have been giving definitions regarding functions of one variable. Or have we?
Not really: We have already said that the multiple-input case is subsumed by our notation. If f : A → B and A is a set of n -tuples, then f is a function of “ n -variables”, essentially. We usually abuse the notation f (
) and write instead f (
).
The inverse image of a set Y under a function is useful as well, that is, the set of all inputs the generate f -outputs in Y . It is denoted by f ← ( Y ) and is defined as
Regarding, say, the definition of f → :
What if f ( a ) ↑? How do you “collect” an undefined value into a set ?
Well, you don’t. Both (1) and (2) have a rendering that is independent of the notation “ f ( a )”.
1.2.0.9 Example . Thus, f → ({ a }) = { f ( x ) : x
{ a }} = { f ( x ) : x = a } = { f ( a )}.
Let now g = {
1, 2
,
{1, 2}, 2
,
2, 7
}. Thus, g ({1, 2}) = 2, but g → ({1, 2}) = {2, 7}. Also, g (5) ↑ and g → ({5}) =
.
On the other hand, g ← ({2, 7}) = {1, {1, 2}, 2} and g ← ({2}) = {1, {1, 2}}, while g ← ({8}) =
.
When f ( a ) ↓, then f ( a ) = f ( a ) as is naturally expected. What about when f ( a ) ↑? This begs a more general question that we settle as follows:
First, seeking help from logic . For any formula
[ x ] and term t that does not contain the variable x ,
We settle (1) by a ping pong argument (putting aside an urge to proclaim “but, it is obvious!”).
(→) direction. We want to prove
[ t ] → (∃ x )( x = t ⋀
[ x ]). Note that
[ t ] → t = t ⋀
[ t ]
is true. So is
t = t ⋀
[ t ] → (∃ x )( x = t ⋀
[ x ])
by 1.1.1.40 since we may view x = t ⋀
[ x ] as ( x = t ⋀
[ x ])[ x ] and thus view t = t ⋀
[ t ] as ( x = t ⋀
[ x ])[ t ] due to the absence of x in t . Using this and the previous displayed formula along with tautological implication we get what we want.
(←) direction. We want to prove (∃ x )( x = t ⋀
[ x ]) →
[ t ]. We will employ the deduction theorem, so we freeze all free variables in (∃ x )( x = t ⋀
[ x ]), and assume it. So, let us call a an x -value that makes the quantification work (cf. 1.1.1.13 ). We have
Since the a = t part of (2) and the Leibniz axiom [(vi) of 1.1.1.38 ] yield
[ a ] ≡
[ t ], the remaining part of (2) yields the truth of
[ t ], as needed.
Transferring the above result to the specific case of substituting terms into input variables 42 of relations , we have the following.
1.2.0.10 Remark . For any ( m + n + 1-ary) relation R ( z 1 …, z m , x , y 1 ,…, y n ), function f , and object a , the substitution R ( z 1 ,…, z m , f ( a ), y 1 ,…, y n ) is short-hand for
Note that w = f ( a ) entails that f ( a ) ↓, so that if no such w exists [the case where f ( a ) ↑], then (3) is false; not undefined!
This convention is prevalent in the modern literature [cf. Hinman (1978), p. 9 ]. Contrast with the convention in Kleene (1943), where, for example, an expression like f ( a ) = g ( b ) [and even f ( a ) = b ] is allowed to be undefined!
1.2.0.11 Example . Thus, applying the above twice, f ( a ) = g ( b ) means (∃ u ) (∃ w ) ( u = f ( a ) ⋀ w = g ( b )) which simplifies to (∃ u ) ( u = f ( a ) ⋀ u = g ( b )). In particular, f ( a ) = g ( b ) entails that f ( a ) ↓ and g ( b )↓.
The above is unsettling as it fails to satisfy the reflexivity of equality [axiom (v) of 1.1.1.38 ]: If f ( a ) ↑, then ¬ f ( a ) = f ( a ). To get around this difficulty, Kleene (1943) has extended equality to include the undefined case, restoring reflexivity in this “generalized” equality relation. We will use this so-called Kleene-complete-equality quite often in the chapter on computability. This version of equality uses a different symbol, ≃, to avoid confusion with the “standard” equality, =, of Remark 1.2.0.10 that compares only objects (not “undefined values”). For any two functions f and g , we define
while f ( a ) ≃ b means the same thing as a f b , that is, f ( a ) = b .
1.2.0.12 Example . Let g = {
1,2
,
{1,2},2
,
2,7
}. Then, g (1) = g ({1,2}) and also g (1) ≃ g ({1,2}). Also, g (1) ≄ g (2) and also g (1) ≠ g (2). Moreover, g (3) ≃ g (9).
If f and g are functions and f ⊆ g then g is an extension of f while f is a restriction of g . If g : A → B , one way to restrict g to f is to choose for f a “smaller” left field, C ⊆ A , and take for f only those 2-tuples that have the their first component in C . We write this as f = g ↾ C . Thus, g ↾ C = g ∩ ( C × B ).
Note that every function f extends the totally undefined function
since
⊆ f .
1.2.0.13 Definition . A function f is 1-1 if for all x and y , f ( x ) = f ( y ) implies x = y .
Note that f ( x ) = f ( y ) implies that f ( x ) ↓ and f ( y ) ↓ ( 1.2.0.10 ).
1.2.0.14 Example. {
1,1
} and {
1,1
,
2,7
} are 1-1. {
1,0
,
2,0
} is not.
is 1-1 vacuously.
1.2.0.15 Definition. (Relational Converse) If R is a relation, then its converse , denoted by R –1 is the relation {
x , y
: yRx }.
1.2.0.16 Exercise. Prove that if f is a 1-1 function, then the relation converse f −1 is a function (that is, single-valued).
1.2.0.17 Definition. (1-1 Correspondence) A function f : A → B is called a 1-1 correspondence iff it is all three: 1-1, total and onto.
Often we say that A and B are in 1-1 correspondence writing A ~ B , omitting mention of the function that is the 1-1 correspondence.
The terminology is derived from the fact that every element of A is paired with precisely one element of B and vice versa.
1.2.0.18 Definition. (Composition of Relations and Functions) Let R : A → B and Q : B → C be two relations. The relation R ○ Q : A → C, their relational composition , is the relation
If R and Q are functions, then their functional composition —or composition as functions—refers to their relational composition, but has a different notation: ( QR ) (no “○”) is an alternative notation for R ○ Q ; note the order reversal.
So xR ○ Qy iff (
z )( xRz
zQy ). Let then xR ○ Qy and also xR ○ Qw. For some a and b , guaranteed to exist, we have xRa and aQy on one hand and xRb and bQw on the other. Let next R and Q both be functions. Then a = b (from R ) and hence y = w (from Q ). Thus,
If R and Q are functions, then so is their composition, R ○ Q or ( QR ).
Let R and Q still be functions. Assume that ( QR )( a ) ↓. Then, for some b , aR ○ Qb , and hence, for some c , aRc and cQb. That is,
The above justifies the order reversal for the alternative notation of “functional composition”.
1.2.0.19 Theorem. Relational composition is associative, that is , R ○ ( Q ○ S ) = ( R ○ Q ) ○ S for any relations R.Q, S. If the relations are functions we may also write (( SQ ) R ) = ( S ( QR )).
Proof See Exercise 24 in Section 1.8 .
1.2.0.20 Definition. The identity function on a set A is 1 A : A → A given by 1 A ( x ) = x for all x
A.
By 1.2.0.19 , if R , Q , T , S are relations, then R ○ Q ○ T ○ S is unambiguous , as it means the same thing regardless of how we insert brackets. In particular,
is unambiguous regardless of the absence of brackets. We have the shorthand R n for the above chain of compositions. We can put this into an inductive definition similar to the one that defines positive powers of a positive real:
1.2.0.21 Definition. (Relational Powers) The symbol R n , for n ≥ 1, is the relational power of R and is defined as
R 1 = R
and, for n ≥ 1,
R n +1 \= R ○ R n
If R is a relation on A , then we replace the first equation by R 0 = 1 A and the condition for the second becomes “and, for n ≥ 0”.
The following interesting result connects the notions of ontoness and 1-1ness with the “algebra” of composition.
1.2.0.22 Theorem. Let f : A → B and g : B → A be functions. If ( gf ) = 1 A , then g is onto while f is total and 1-1.
We say that g is a left inverse of f and f is a right inverse of g.
Proof. About g : Our goal, ontoness, means that, for each x
A , a y exists such that g ( y ) = x. Fix then an x
A . By ( gf ) = 1 A , we have ( gf )( x ) = 1 A ( x ) = x . But ( gf )( x ) = g ( f ( x )). So take y = f ( x ).
About f : As seen above, x = g ( f ( x )) for each x
A. Since this is the same as “ xf ○ gx is true”, there must be a z such that xfz and zgx. The first of these says f ( x ) = z and therefore f ( x )↓. This settles totalness.
For the 1-1ness, let f ( a ) = f ( b ). Applying g to both sides (that is, using Exercise 1.8.4 ) we get g ( f ( a )) = g ( f ( b )). But this says a = b , by ( gf ) = 1 A , and we are done.
1.2.0.23 Example. The above is as much as we can be expected to prove. For example, say A = {1,2} and B = {3,4,5,6}. Let f : A → B be {
1,4
,
2,3
} and g : B → A be {
4,1
,
3,2
,
6,1
}, or in friendlier notation
f (1)= 4
f (2)= 3
and
g (3) = 2
g (4) = 1
g (5)↑
g (6)= 1
Clearly, ( gf ) = 1 A holds, but note:
(1) f is not onto.
(2) g is neither 1-1 nor total.
1.2.0.24 Example. With A = {1,2}, B = {3,4,5,6} and f : A → B and g : B → A as in the previous example, consider also the functions
and
given by
(1)= 6
(2)= 3
and
(3)= 2
(4)= 1
(5) ↑
(6)= 2
Clearly, (
f ) = 1 A and ( g
) = 1 A hold, but note:
(1) f ≠
.
(2) g ≠
.
Thus, neither left nor right inverses need to be unique. The article “a” in the definition of said inverses was well-chosen.
The following two partial converses of 1.2.0.22 are useful.
1.2.0.25 Theorem. Let f : A → B be total and 1-1. Then there is an onto g : B → A such that ( gf ) = 1 A .
Proof Consider the converse relation ( 1.2.0.15 ) of f and call it g :
By Exercise 1.2.0.16 , g : B → A is a (possibly nontotal) function. Note that, for any a
A , there is a b such that f ( a ) = b ( f is total), and, by (1), g ( b ) = a. That is, g ( f ( a )) = a , or ( gf ) = 1 A .
1.2.0.26 Remark. By (1) above, dom( g ) = { x : (
y ) ( x , y )
g } = { x : (
y ) f ( y ) = x } = ran( f ).
1.2.0.27 Theorem. Let f : A → B be onto. Then there is a total and 1-1 g : B → A such that ( fg ) = 1 B .
Proof . By assumption,
≠ f ← ({ b })
A , for all b
B. To define g ( b ) choose one c
f ← ({ b }) and set g ( b ) = c. Since f ( c ) = b , we get f ( g ( b )) = b for all b
B , and hence g is 1-1 and onto by 1.2.0.22 .
The above argument makes potentially infinitely many choices, one from each f ← ({ b }). Of course, these sets are pairwise disjoint.
Pause. Why is it that f ← ({ x }) ∩ f ← ({ y }) =
if x ≠ y ?
Contrast with the case where B = { b , b ′}, a set of two elements. Then we can define g by simply saying
Let c
f ← ({ b }), and set g ( b ) = c. Let c ′
f ← ({ b ′}), and set g ( b ′) = c ′.
We can contain our (two) choices in the space of a proof. The same is true if B had 2 350000 elements. We would just have to write a proof that would be, well, a bit longer, using a copy of the sentence “Let y
f ← ({ x }), and set g ( x ) = y ” once for each one of the 2 350000 members of B that we generically called here “ x ”.
However, the “Let...” approach does not work for an infinite B , since we cannot contain infinitely many such sentences in the space of a finite-length proof; unless we have a way to codify the infinitely many choices in a finite manner. For example, if A is a set of natural numbers then so is f ← ({ b }) for each b and we can say precisely how a c can be chosen in each case: For example, “for each b
B , choose the smallest c in f ← ({ b })” would do just fine.
Some mathematicians did not accept that one may effect infinitely many choices, in the absence of a finitely describable process of how to go about making them; this was not mathematically acceptable. They argued that in the absence of some kind of known “structure” in the various f ← ({ b }), all the elements of these sets “look the same” and therefore the infinite process of “choosing” cannot be compacted into a finite well-defined description. This observation hinges on the number of choices one needs to make rather than on the number of elements in a f ← ({ b }).
An example of the difficulty, in layman’s terms, attributed to Russell, contrasts two cases: One where we have an infinite set of pairs of shoes, and another, where we have an infinite set of pairs of socks.
In the former case we can finitely define infinitely many choices of one shoe per pair by always choosing the left shoe in each pair. In the case of socks this “rule” does not define well which sock to pick, because, the two socks in a pair have no distinct “left” or “right” members.
I used past tense above, “Some mathematicians did not accept, etc.”, for the dissenting opinion. This is because mathematicians nowadays feel comfortable with the notion of effecting infinitely many choices without having a finite process to describe said choices. They even have an axiom (the Axiom of Choice, or AC) that says they can do so [for a thorough discussion of AC, see Tourlakis (2003b)].
1.2.0.28 Definition. (Equivalence Relations) Let R be a relation on a set A . We call it an equivalence relation iff it has all the three following properties:
(1) It is reflexive , that is, xRx holds, for all x
A
(2) It is symmetric , that is, xRy implies yRx , for all x and y
(3) It is transitive , that is, xRy and yRz imply xRz , for all x , y and z.
The concept “equivalence relation” does not apply to relations R : A → B with A ≠ B. The concept of reflexivity requires reference to the left (and right, since they are equal) field. If we make the fields larger, without adding any pairs to the relation, a previously reflexive relation will cease being reflexive.
1.2.0.29 Example. The function 1 A : A → A is an equivalence relation.
The relation < on
is transitive, but neither symmetric, nor reflexive; on the other hand, ≤ has reflexivity (still fails symmetry).
The relation R on
given by: “ xRy iff the difference x – y is divisible by 5” (divisible with 0 remainder, that is) can be easily verified to be an equivalence relation.
Given an equivalence relation R on a set A , we define for each x
A the set of all its equivalents in A. This is known as an equivalence class of R. We employ the symbol [ x ] R , thus
Despite employing the term “class” in this context, which is standard practice in the literature, we do not imply at all that these classes are “too large” to technically be sets. On the contrary, any such class is a subset of A.
1.2.0.30 Theorem. Given an equivalence relation R on A. Its equivalence classes [ x ] R satisfy
(1) [ x ] R ≠
(2) if x Ry iff [ x ] R = [ y ] R
(3) if [ x ] R ∩ [y] R ≠
, then [ x ] R = [ y ] R
(4)
x
A [ x ] R = A
Proof.
(1) [ x ] R ≠
: In fact x
[ x ] R by xRx.
(2) if xRy iff [ x ] R = [ y ] R :
First, assume the left hand side of the “ iff ”, which also yields yRx by symmetry. For the (
) of the right hand side let z
[ x ] R . Thus xRz. Transitivity yields yRz , hence z
[ y ] R .
For the (
), let z
[ y ] R . i.e., yRz. Along with xRy and transitivity we have xRz , that is, z
[ x ] R .
Now assume the right hand side of the “ iff ”. By the proof of (1), y
[ x ] R , thus xRy .
(3) if [ x ] R ∩ [ y ] R ≠
, then [ x ] R = [ y ] R : By the assumption, there is a z such that z
[ x ] R and z
[ y ] R . Thus xRz and yRz , the latter implying zRy . By transitivity, xRy ; done by (2).
(4)
x
A [ x ] R = A: The (
) is trivial, since [ x ] R
A for any x
A. For (
), let x
A. But x
[ x ] R and this meets the entrance requirement for x in
x
A [ x ] R .
1.2.0.31 Remark. (Partitions) Thus the equivalence classes of an R on A meet the three conditions a partition of A must satisfy, by definition:
A partition on A is a set of sets P such that
(a) If C
P , then C ≠
(b) (Nonoverlap) If C and D are in P and C ∩ D ≠
, then C = D
(c) (Coverage)
S = A.
So equivalence classes furnish an example of partitions. More is true (cf. Exercise 1.8.33 ): If P is a partition on A , then an equivalence relation on A can be defined in a natural way, whose equivalence classes are precisely the members of P.
1.2.0.32 Definition. (Order) A relation R on a set A is called an order or order relation iff it is transitive and irreflexive , the latter meaning ¬(
x ) xRx .
We normally use the abstract symbol < for orders and let the context fend off confusion with concrete usage of the symbol as the order on
or
.
We call all orders partial , since some orders, < on A , are total or linear , while others are not.
Indeed, we will seldom use the qualifier “partial” for orders as it is automatically understood. Exception: Often one presents the “package” consisting of the order and the underlying set A together, in symbols ( A , <), and calls it a partially ordered set or POset.
That an order < on A is total means that every pair of members x and y of A are comparable: That is, one of x = y , x < y or y < x holds (this is also know as the trichotomy property of linear orders).
1.2.0.33 Example. A standard example of a total order is < on
. A standard example of a nontotal (nonlinear) order is ⊂ on 2 A . For example, taking as A = {0,1}, we see that {0} and {1} are not comparable under ⊂. That the latter is an order is trivial to verify (it is irreflexive by definition), a task that we leave to the reader.