Two broad distinctions of sets by size are finite vs. infinite. Intuitively, we can count the elements of a finite set and come up with a (natural) number at some distinct point in (future) time. No such possibility is open for infinite sets. Just as finite sets come in various sizes, a 5-element set, vs. a 0-element set, vs. a 2 3500000 -element set, Cantor has taught us that infinite sets also come in various sizes. The technique he used to so demonstrate is of interest to us, as it applies to computability, and is the key topic of this section.

1.3.0.34 Definition. (Finite sets) A set A is finite iff it is either empty, or is in 1-1 correspondence with { x images images : x ≤ n }. We prefer to refer to this “normalized” finite set by the sloppy notation {0,..., n }.

In this case we say that “ A has n + 1 elements”. If A = images we say that “ A has 0 elements”. If a set is not finite, then it is infinite. images

1.3.0.35 Example. If A and B have n +1 elements, then A ~ B (cf. Exercise 1.8.31 ). images

1.3.0.36 Theorem. If X ⊂ {0,..., n }, then there is no onto function f : X → {0,..., n }.

Proof. First off, the claim holds if X = images , since then f = images and its range is empty. Let us otherwise proceed by way of contradiction, and assume that it is possible to have such onto functions, for some n . Suppose then that the smallest n that allows this to happen is n 0 , and let X 0 be a corresponding set “X” that works, that is, we have an onto f : X 0 → {0,..., n 0 }. Thus X 0 ≠ images , by the preceding remark, and therefore n 0 > 0, since otherwise X 0 = images .

Let us set H = f ← ({ n 0 }). images ≠ H images X 0 ; the ≠ by ontoness.

Case 1. n 0 images H. Then f images ( X 0 – H ) is onto, from X 0 – H to {0,..., n 0 – 1}— where X 0 – H ⊂ {0,..., n 0 – 1}—contradicting minimality of n 0 .

Case 2. n 0 ∉ H. If n 0 ∉ X 0 , then we are back to Case 1. Otherwise, X 0 – H ⊄ {0,..., n 0 – 1} and we need a bit more work to get a Y ⊂ {0,..., n 0 – 1}, and an onto function from left to right, to get our contradiction.

Well, we first look at the subcase where f ( n 0 ) ↑: then just ignore n 0 ; that is, take Y = X 0 – H – { n 0 }. Our function (onto {0,..., n 0 – 1}) is f images Y.

Finally, consider the subcase where f ( n 0 ) = m. Take g = ( f – ({ images n 0 , m images } images H × { n 0 })) images ( H × { m }). Essentially, g is f ; except that it ensures that (a) we get no output n 0 , (b) n 0 ∉ dom( g ), and yet (c) we do obtain output m —to maintain ontoness. Now, taking Y = X 0 – { n 0 } we see that g : Y → {0,..., n 0 – 1} is onto. images

1.3.0.37 Corollary. (Pigeon-Hole Principle) If m < n , then {0,..., m } images {0,..., n }.

Proof. If the conclusion fails then we have an onto f : {0,..., m } → {0,..., n }, contradicting 1.3.0.36 . images

images Here is a “quick proof” of 1.3.0.37 that does not utilize 1.3.0.36 : Since A ~ A for any non-empty set, {0,..., m } has m + 1 elements. If {0,..., m } ~ {0,..., n } then, by 1.3.0.34 , it also has n + 1 elements. Impossible!

Pause. Do you accept this “proof”? images

You shouldn’t. “ A has n + 1 elements” is just informal jargon for “ A ~ {0,..., n }”. It may well be that this naming was unfortunate, and that it fails to uniquely assign a number to a finite set as “the number of its elements” . That the nomenclature in quotes is apt is the content of Corollary 1.3.0.37 , not the other way around.     images

1.3.0.38 Corollary. There is no onto function from { 0 ,..., n } to images .

images “For all n images images ” is, of course, implied (cf. 1.1.1.10 ).    images

Proof . Fix an n . By way of contradiction, let g : {0,..., n } → images be onto. The function f given below is onto from images to {0,..., n + 1}

f (0)  = 0

f (1)  = 1

f (2)  =2

⋮

f ( n + 1)= n + 1

f ( m )   = 0, for all m > n + 1

Thus (cf. Exercise 1.8.34 ) ( fg ) : {0,..., n } → {0,..., n + 1} is onto, contradicting 1.3.0.36 . images

images Our mathematical definitions have led to what we hoped they would: That images is infinite!     images

images is a “canonical” infinite set, and sets that can be enumerated using natural number indices

a 0 , a 1 ,...

have a special name.

1.3.0.39 Definition. (Countable Sets) A set A is countable , if it is empty or (in the opposite case) if there is a way to arrange all its members in an infinite sequence, in a “row of locations”, utilizing one location for each member of images . It is allowed to repeatedly list any element of A , so that finite sets are countable. For example, {1}:

1,1,1,...

Technically, this enumeration is a total and onto function f : images → A. We say that f ( n ) is the n th element of A in the enumeration f . We often write f n_ instead of _f ( n ) and then call n a “subscript” or “index”. images

A closely related notion is that of a set that can be enumerated using the elements of images as indices, but without repetitions.

1.3.0.40 Definition. (Enumerable Sets) A set A is enumerable iff it is in 1-1 correspondence with images . images

images 1.3.0.41 Example. Every enumerable set is countable, but the converse fails. For example, {1} is countable but not enumerable due to 1.3.0.38 . {2 n : n images images } is enumerable, with f ( n ) = 2 n effecting the 1-1 correspondence f : images → {2 n : n images images }. images

1.3.0.42 Theorem. If A is an infinite subset of images , then A ~ images .

Proof . We will build a 1-1 and total enumeration of A , presented in a finite manner as a (pseudo) program below:

X     ← A

n     ← 0

repeat forever:

pick a , the smallest member of X

tag a with n as a subscript; print a n

n     ← n + 1

X     ← X – { a n }

Since A in not finite, this process never ends. In particular, all the members of A will be picked (picking always the smallest avoids gaps) and all numbers from images will be utilized as indices, considering the non-ending nature of the process, the sequential choice of indices, and the starting point n = 0. That is, the function f : images → A , given for all n by f ( n ) = a n , is total and onto. Since f is strictly increasing— f ( n ) < f ( n + 1)—it is 1-1 (distinct inputs cause distinct outputs). images

See also Exercise 1.8.35 .

1.3.0.43 Theorem. Every infinite countable set is enumerable.

Proof. Let f : images → A be onto and total, where A is infinite. Let g : A → images such that ( fg ) = 1 A ( 1.2.0.27 ). Let us set B = ran( g ). Thus, g is onto B , and by 1.2.0.22 is also 1-1 and total. Thus it is a 1-1 correspondence g : A → B , or A ~ B.

B must be infinite, otherwise ( 1.3.0.34 ), for some n , A ~ B ~ {0,..., n }. By transitivity of ~ ( Exercise 31 ), this proves that A is finite, contradicting the hypothesis. Thus, by 1.3.0.42 , A ~ B ~ images , hence (again, Exercise 1.8.31 ) A is enumerable. images

So, if we can enumerate an infinite set at all, then we can enumerate it without repetitions. It is useful to observe that we can convert a multirow enumeration

( f i , j )for all i,j in images

into a single-row enumeration quite easily. This is shown diagrammatically below. The “linearization” or “unfolding” of the infinite matrix of rows is effected by walking along the arrows.

images

Technically, the set images × images —the set of “double subscripts” ( i , j )—is countable. This can be seen by a less informal argument; in fact, images × images ~ images :

Perhaps the simplest way to see this is to consider the function f : images × images → images given by f ( m , n ) = 2 m 3 n . It is clearly total, and (less) clearly 1-1: For the latter just show that

2 m 3 n = 2 m ′ 3 n ′ implies m = m′ and n = n′

But ran( f ) is infinite (see Exercise 1.8.36 ). Thus images × images ~ ran( f ) ~ images .

This unfolding of a matrix into a straight line yields a very useful fact regarding strings over countable sets (alphabets):

If the string alphabet V is countable, then the set of all strings of length 2 over V is also countable. Why? Because the arbitrary string of length 2 is of the form d i d j , where d i and d j represent the i th and j elements of the enumeration of V , respectively. Unfolding the infinite matrix exactly as above we get a single-row enumeration of these strings.

By induction on the length n ≥ 2 of strings we see that the set of strings of any length n ≥ 2 is also countable. Indeed, a string of length n + 1 is a string ab , where a has length n and b images V. By the induction hypothesis, the set of all strings a can be arranged in a single row (is countable), and we are done exactly as in the case of the d i d j above (think of d i as an “ a ” and d j as a “ b ”).

Finally, let us collect all the strings over V into a set S. Is S countable? Yes! We can arrange S , at first, into an infinite matrix of strings m i , j , that is, the jth string of length i. Then we employ our matrix-unfolding trick above.

images Given what we understand as a “string” (cf. subsection 1.1.3 ), the above argument translates as

(1) If V is countable, then so is V n for any n ≥ 2.

(2) If V is countable, then so is V +

With little additional effort one can see that if A and B are countable, then so is A × B and generalize to the case of images .     images

1.3.0.44 Remark. Let us collect a few more remarks on countable sets here. Suppose now that we start with a countable set A. Is every subset of A countable? Yes, because the composition of onto functions is onto ( Exercise 1.8.34 ). As a special case, if A is countable, then so is A ∩ B for any B , since A ∩ B images A.

images In particular, there is only an enumerable set of formulae if we start with a countable alphabet V, since the set of formulae is a subset of V + . This comment relates to the discussion under the Pause on p. 41 .     images

How about A images B ? If both A and B are countable, then so is A images B. Indeed, and without inventing a new technique, let

a 0 , a 1 ,...

be an enumeration of A and

b 0 , b 1 ,...

for B. Now form an infinite matrix with the A -enumeration as the 1st row, while every other row is the same as the B -enumeration. Now unfold this matrix!

Of course, we may alternatively adapt the unfolding technique to an infinite matrix of two rows. images

1.3.0.45 Example. Suppose we have a 3 × 3 matrix

1  1  0
1  0  1
0  1  1

and we are asked: Find a sequence of three numbers, using only 0 or 1, that does not fit as a row of the above matrix—i.e., is different from all rows.

Sure, you reply: Take 0 0 0.

That is correct. But what if the matrix were big, say, 10 350000 × 10 350000 , or even infinite ?

Is there a finitely describable technique that can produce an “unfit” row for any square matrix, even an infinite one? Yes, Cantor’s diagonal method or technique.

He noticed that any row that fits in the matrix as the, say, i -th row, intersects the main diagonal at the same spot that the i -th column does.

Thus if we take the main diagonal—a sequence that has the same length as any row—and change every one of its entries , then it will not fit anywhere as a row! Because no row can have an entry that is different than the entry at the location where it intersects the main diagonal!

This idea would give the answer 0  1  0 to our original question. While 1000  11  3 also follows the principle and works, we were constrained by “using only 0 or 1”. More seriously, in a case of a very large or infinite matrix it is best to have a simple technique that works even if we do not know much about the elements of the matrix. Read on! images

1.3.0.46 Example. We have an infinite matrix of 0-1 entries. Can we produce an infinite sequence of 0-1 entries that does not match any row in the matrix? Yes, take the main diagonal and flip every entry (0 to 1; 1 to 0).

If the diagonal has an a in row i , the constructed row has an 1 – a in column i , so it will not fit as row i. So it fits nowhere, i being arbitrary. images

images 1.3.0.47 Example. (Cantor) Let S denote the set of all infinite sequences of 0s and Is.

Pause. What is an infinite sequence ? Our intuitive understanding of the term is captured mathematically by the concept of a total function f with left field (and hence domain) images . The n -th member of the sequence is f ( n ). images

Can we arrange all of S in an infinite matrix—one element per row? No, since the preceding example shows that we would miss at least one infinite sequence (i.e., we would fail to list it as a row), for a sequence of infinitely many 0s and/or Is can be found, that does not match any row!

But arranging all members of S as an infinite matrix—one element per row—is tantamount to saying that we can enumerate all the members of S using members of images as indices.

So we cannot do that S is not countable! images

1.3.0.48 Definition. (Uncountable Sets) A set that is not countable is called uncountable . images

So, an uncountable set is neither finite, nor enumerable. The first observation makes it infinite, the second makes it “more infinite” than the set of natural numbers since it is not in 1-1 correspondence with images (else it would be enumerable, hence countable) nor with a subset of images : If the latter, our uncountable set would be finite or enumerable (which is absurd) according as it is in 1-1 correspondence with a finite subset or an infinite subset (cf. 1.3.0.42 and Exercise 1.8.31 ).

Example 1.3.0.47 shows that uncountable sets exist. Here is a more interesting one.

1.3.0.49 Example. (Cantor) The set of real numbers in the interval

images

is uncountable. This is done via an elaboration of the argument in 1.3.0.47 .

Think of a member of (0,1], in form , as an infinite sequence of numbers from the set {0,1, 2, 3,4, 5, 6, 7, 8, 9} prefixed with a dot; that is, think of the number’s decimal notation.

Some numbers have representations that end in 0s after a certain point. We call these representations finite . Every such number has also an “infinite representation” since the non zero digit d immediately to the left of the infinite tail of 0s can be converted to d – 1, and the infinite tail into 9s, without changing the value of the number.

Disallow all finite representations.

Assume now by way of contradiction that a listing of all members of (0,1] exists, listing them via their infinite representations

. a 00 a 01 a 02 a 03 a 04 ...

. a 10 a 11 a 12 a 13 a 14 ...

. a 20 a 21 a 22 a 23 a 24 ...

. a 30 a 31 a 32 a 33 a 34 ...

⋮

The argument from 1.3.0.47 can be easily modified to get a “row that does not fit”, that is, a representation

. d 0 d 1 d 2 ...

not in the listing.

Well, just let

images

Clearly . d 0 d 1 d 2 ... does not fit in any row i as it differs from the expected digit at the i -th decimal place: should be a ii , but d i ≠ a ii . It is, on the other hand, an infinite decimal expansion, being devoid of zeros, and thus should be listed. This contradiction settles the issue. images

1.3.0.50 Example. ( 1.3.0.47 Revisited) Consider the set of all total functions from images to {0,1}. Is this countable?

Well, if there is an enumeration of these one-variable functions

images

consider the function g : images → {0,1} given by g ( x ) = 1 – f x ( x ). Clearly, this must appear in the listing (1) since it has the correct left and right fields, and is total.

Too bad! If g = f i then g ( i ) = f i ( i ) By definition, it is also 1 – f i ( i ). A contradiction.

This is a “mathematized” version of 1.3.0.47 ; as already noted, an infinite sequence of 0s and 1s is just a total function from images to {0,1}. images

The same argument as above shows that the set of all functions from images to itself is uncountable. Taking g ( x ) = f x ( x ) +1 also works here to “systematically change the diagonal” f 0 (0), f 1 (1),... since we are not constrained to keep the function values in {0,1}.

images 1.3.0.51 Remark. Worth Emphasizing. Here is how we constructed g : We have a list of in principle available indices for g. We want to make sure that none applies. A convenient method to do that is to inspect each available index, i , and using the diagonal method do this: Ensure that g differs from f i at input i , setting g ( i ) = 1 − f i ( i ).

This ensures that g ≠ f i period. We say that we cancelled the index i as a possible “ f -index” of g.

Since the process is applied for each i , we have cancelled all possible indices for g : For no i can we have g = f i . images

images 1.3.0.52 Example. (Cantor) What about the set of all subsets of images — images ( images ) or 2 images ?

Cantor showed that this is uncountable as well: If not, we have an enumeration of its members as

images

Define the set

images

So, D images images , thus it must appear in the list (1) as an S i . But then i images D iff i images S i by virtue of D = S i . However, also i images D iff i ∉ S i by (2). This contradiction establishes that 2 images is uncountable.

In particular, it establishes that D is not an S i . images

images 1.3.0.53 Example. (Characteristic functions) First a definition: Given a set S in the context of a reference set U, the characteristic function of S , denoted by χ S , is given by

images

If the reference set is images , the characteristic function of S images images is

images

Note that there is a 1-1 correspondence F between subsets of images and 0-1-valued functions from images simply given by F ( S ) = χ S —cf. Exercise 1.8.37 . Thus

The set of 0-1-valued functions from images is in 1-1 correspondence with images ( images )

In particular, the concept of characteristic functions shows that Example 1.3.0.52 fits the diagonalization methodology. Indeed, χ D ( x ) = 1 – χ S x ( x ) for all x . In other words, χ D is nothing else but the altered “main diagonal” (in bold face type) of the infinite matrix

images

1.3.0.54 Example. By Exercise 1.8.38 we have that 2 images × images ~ 2 images so that The set of all subsets of images × images is uncountable

The above can be rephrased to

The set of all binary relations on images is uncountable

Thus, if we build our formulae with symbols out of a countable alphabet, then we do not have enough symbols to represent (in our notation) all binary relations on images by formulae. This observation concludes our discussion that started on p. 41 , following Definition 1.2.0.4 and continued in 1.3.0.44 . images

images 1.3.0.55 Example. (Russell’s Paradox is a Diagonalization) Russell formed the collection of sets x given as

images

He argued that it is contradictory to accept R as a set: For if it is, and given that (1) is equivalent to the statement (for all sets x )

images

we can substitute the specific set R into the set variable x to obtain—from the truth of (2)—the truth of the special case

R images R ≡ R ∉ R

This, of course, is absurd!

Let us now argue intuitively —taking liberties with working with all sets at once!—that the above argument is a diagonalization over all sets.

Imagine an infinite matrix, M , whose columns and rows are labeled by all sets, arranged in the same order along rows and columns. Assume that the matrix has as entries only the numbers 0 and 1, entered such that in the location determined by the row (named) x and the column (named) y we have a 0 iff y images x is true (we have 1 otherwise). That is,

images

It follows that each row represents a set as an array of 0s and 1s— that is, as the set’s characteristic function . 43

Thus, the partial depiction of the row for set a informs us that the following are true: a ∉ a , b images a and x ∉ a. Indeed, any array, X, of 0s and 1s whose entries are labeled by the column names represents a collection of sets that has y as a member iff the y -th entry of X is 0. For example, the diagonal collection contains b , but neither a , nor x.

images

Images

Let us do Cantor’s trick now: We take the main diagonal d and form an array Images from it, by swapping all 1s with 0s. This Images cannot fit as a row anywhere in the matrix M since it will disagree at the diagonal entry in any placement.

The fact that the collection of sets (named) Images does not fit as a row of M means that it is not a set —because all sets are accounted for as row labels in M !

But which collection does Images represent?

Well, using the analogy of X above, y is in Images iff the y -th entry of Images is 0 iff the y -th entry of d is 1 iff y ∉ y. Thus,

Images = R , Russell’s “paradoxical collection”           Images Images