This section further develops the theory of computability and un computability by developing tools—in particular, reducibility —that are more sophisticated than the ones we encountered so far in this volume, toward discovering undecidable and non c.e. problems. We also demonstrate explicitly that diagonalization is at play in a number of interesting examples.

As we mentioned in the Preface and elsewhere already, the aim of computability is to “formalize” the concept of “algorithm” and then proceed to classify problems as decidable vs. undecidable and verifiable vs. unverifiable.

We continue taking— by definition —the term “algorithm” to mean URM program, and computable (partial) function to mean a URM-computable function, or equivalently, one that has a images -derivation (cf. 2.3.0.11 ). Thus proving that such and such a problem x images A does not have an “algorithmic solution”, or is not even verifiable, becomes mathematically precise: We need to show that A images images * or A images images * , respectively.

Church has gone a step further, and observing that all known formalisms of the concept of algorithm were proved to be equivalent (each produced the same computable functions), formulated

Church’s Thesis. Any partial function that can be informally demonstrated to be computable by some algorithm, can be mathematically demonstrated to be programmable in any one of the known formalisms (such as Turing machines, Markov algorithms, Post systems, URMs 89 ).

Of course, this “thesis” is a belief based on empirical evidence, not a metatheorem. The difficulty (toward theoremhood) lies in the fact that in order to, say, demonstrate mathematically that the concepts of “algorithm” and URM coincide, we must already have a mathematical formulation of algorithm !

Images This is why we said above that we take by definition that algorithm means URM. We cannot do better than being arbitrary like this. We already mentioned that while the “Thesis” is widely adopted—indeed, some advanced books such as Rogers (1967) use it to shorten proofs that such and such a function is computable—the adoption is not universal; cf. Kalmár (1957).           Images

This volume will not take the shortcut of relying on Church’s Thesis. Whenever we want to prove that f is computable we will do so mathematically, invariably using 2.3.0.11 and closure properties of images . Nevertheless, we will often also offer an intuitive argument that establishes the desired computability.

2.7.1 More Diagonalization

We begin the development of the theory by revisiting the proof ( 2.5.0.16 and 2.5.0.17 ) of the undecidability of the halting problem.

2.7.1.1 Theorem. (The Undecidability of the Halting Problem; Again) K images images * .

Proof. We will argue by contradiction, so we assume that K images images * , that is, the relation images x ( x ) ↓ is recursive. We view a one-argument function f as a sequence of values,

f (0), f (1), …

where (informally), if f ( x ) ↑, then we take the symbol “↑” as the yielded value.

On this understanding we form the infinite matrix below, of which the i -th row represents images i , for all i .

images

We proceed as in 1.3.0.53 to utilize the main diagonal

images 0 (0), images 1 , … , images i ( i ),…

and build a function that cannot be a row of the above matrix. We simply change each entry that is ↑ to ↓, and vice versa:

images

The above captures the idea, but it is not a well-defined function since we have not said what the output of d is when it is defined. We resolve this “uncertainty” arbitrarily as follows:

images

Indeed, d does not match any row above, as it differs from each row in the spot where it intersects the diagonal. Why do we care? Well, since images is closed under definition by cases ( Exercise 2.12.28 ), and since by assumption both images x ( x ) ↓ and images x ( x ) ↑ are recursive,

Pause. Why “both”? Images

it follows that d images images , i.e., d = images i for some i —i.e., d must be some row in the above matrix. We have a contradiction.          images

An intuitive reason as to why the function d as defined in (1) is computable, is presented here by outlining a pseudo algorithm for the computation of d ( x ): Let M be a URM that decides the predicate images x ( x ) ↓. Given input x , run M on x. If it says “no”, then print 42 and halt; if it says “yes”, then get into a deliberate infinite loop (cf. 2.5.0.12 ).

Images Worth repeating. We chose d so that at input x it differs from images x ( x ), and thus it differs from images x ; full stop. We have cancelled x as a possible images -index of d (cf. 1.3.0.51 ).

Given that we have done this for all x , we have cancelled all possible images -indices of d. Thus d is not computable. Since our assumption about images x ( x ) ↓ also forced d to be computable, we managed to reject said assumption as it forced a contradiction.           Images

A version of unbounded search is the following:

2.7.1.2 Definition . (Alternate Unbounded Search Operator) For any total function λ y images . g ( y , images ) the expression ( images y ) g ( y , images ) stands for

images

Images It is immediate that ( μy ) (2.1.1.18) and ( images y ) coincide on total functions since—in g ( y , images ) = 0 ∧ (∀ z ) < y ( g ( z , images ↓)—the subformula (∀ z ) < y ( g ( z , images ) ↓) is true for such g and therefore its presence or absence in the formula is immaterial.           Images

2.7.1.3 Definition. We say that a class of number-theoretic functions images is closed under ( images y ) just in case for every total g in the class, λ images .( images y ) g ( y , images )—which may fail to be total—is in the class.          images

2.7.1.4 Theorem. images is closed under ( images y ).

Proof . By the preceding images -remark, if g images images , then, for all images , ( images y ) g ( y , images ) ≃ ( μy ) g ( y , images ), thus λ images .( images y ) g ( y , images ) images images .

2.7.1.5 Corollary. In 2.3.0.11 we may replace μ by images .

Proof . We reuse the proof of 2.3.0.11 by simply replacing images by images = Cl( images , {composition, primitive recursion, images }), throughout. In the forward part we use 2.7.1.4 . In the part of said proof that begins by “Conversely”, we replace μ , by images .

Images Immediately after the proof of 2.3.0.11 we noted

The preceding corollary provides an alternative formalism—that is, a syntactic, finite description other than via URM programs …

We cannot say the same here. The requirement that ( images y ) apply on total functions makes it a semantic rather than a syntactic operator: As we have seen, the problem of whether images is in images or not is undecidable, indeed not even c.e.

Thus, given i we cannot know whether writing ( images y ) images ( n +1) ( y , images n ) makes sense or not : For we cannot decide , as Definition 2.7.1.2 requires, whether images is total.           Images

Pause. Hmm. Why can’t we stop worrying about totalness and just allow —in defiance of Definition 2.7.1.2 —( images y ) to apply to all partial functions, including nontotal ones? Images

Well, a first approximation objection to the suggestion of defiance is that while ( μy ) g ( y , images ) is correctly computed by the pseudo program below (cf. 2.1.1.17 )

            y ← 0
while
               ¬ g ( y , images ) = 0
                y ← y + 1
end

the same program does not compute ( images y ) g ( y , images ).

Images For the sake of argument, say, for a given images , we have g (0, images ) ↑, but g (1, images ) = 0.

If so, the above pseudo program correctly computes ( μy ) g ( y , images ) since the definition requires —for convergence—that (∀ z < 1) g ( z , images ) ↓.

This is not the case for ( images y ) g ( y , images ), which ought to return min{ y : g ( y , images ) = 0} = 1 (overlooking the nontotal-ness of g ) but the program above loops forever, since the call to g (0, images ) does.

But wait! What if there is a really clever alternative program that computes correctly min{ y : g ( y , images ) = 0}, for any computable g, total or not?

How can we establish that such a program does not exist (assuming we believe that it does not)? By producing a partial recursive, nontotal , λ xy . images ( x , y ), for which λ x .( images y ) images ( x , y ) images images !            Images

2.7.1.6 Theorem. There is a nontotal λ xy . images ( x , y ) images images such that λ x .( images y ) images ( x , y ) images images .

Proof. The proof just firms up the “what if” discussion above that cast some initial doubt on the appropriateness of applying ( images y ) to nontotal functions. So let us define images by

images

Given that the predicate images x ( x ) ↓ is semi-recursive ( 2.5.0.15 ), closure properties of images * 2.5.0.18 ) establish the top condition in the definition of images as semi-recursive. By definition by positive cases we have that images images images .

Let us evaluate

images

There are just two possible output values: The search returns 0 if images x ( x ) ↓, while it returns 1 if images x ( x ) ↑. Thus λ x .( images y ) images ( x , y ) is χ K and therefore is not in images ).          images

Incidentally, note that χ K , being a characteristic function, it is total, even though images is not.

2.7.1.7 Proposition. The problem which requires us to determine for a given URM program i and input x whether a predetermined output y is attained is undecidable.

We opted to say the above in English, in the first instance. Mathematically we are saying that λ ix . images i ( x ) = y is not in images * .

Proof. If the stated predicate is in images * then so is λ x . images x ( x ) = y by closure properties. We will use a straightforward diagonalization to see that the latter cannot be.

images

Define the new diagonal so that it differs from the one above at every place.

images

Thus, d is not a row above. On the other hand, since we assumed that λ x . images x ( x ) = y is recursive, we have that d images images (it is total) hence d = images i for some i and hence must be a row. A contradiction.          images

2.7.1.8 Corollary. λ ixy . images i ( x ) = y is not in images * .

Proof. Otherwise we would contradict the preceding proposition [ 2.1.2.6 (ii)].          images

The next result, also based on a variant of diagonalization, has a computational complexity flavor: There are arbitrarily hard-to-compute recursive functions ! Recall our concept of complexity of computable functions, Φ, introduced in the context of the dovetailing technique on p. 169 .

2.7.1.9 Theorem. For any a priori chosen recursive function λ x . g ( x ), we can construct an f images images such that , for any i , if f = images i , then g ( x ) < Φ i ( x ) for all x ≥ i .

Images Thus, we have a priori arbitrarily chosen a level of computational “difficulty”, g. We may choose a horrendously “big” g [e.g., A x ( x ), where A is the Ackermann function of Section 2.4 ]. Then we show how to find a function f , which no matter how we program it (via a URM i ), such a program will take more than g ( x ) “steps” to terminate on almost all inputs x , indeed on all x ≥ i .           Images

Proof . We want to build an f that for i ≤ x cannot be computed within ≤ g ( x ) steps.

Thus, we need to meet two requirements:

(1) Ensure that the f we build is recursive.

(2) Ensure that all images -indices i that satisfy

i ≤ x and Φ i ( x ) ≤ g ( x )

are cancelled.

Let us thus set

images

Given that Φ i ( x ) ≤ y is recursive (cf. p. 169 ), so is Φ i ( x ) ≤ g ( x ) since g images images , and thus we have that λ ix . i images I ( x ) is recursive. So is the predicate I ( x ) ≠ images , being equivalent to (∀ i ) ≤ x ¬Φ i ( x ) ≤ g ( x ). We define f , for all x , as follows:

images

It is clear that f images images from Exercise 2.12.28 , but we need to work a bit more to show it is total, before we show that it has property (2) above. Let us define, for all i , x , the function h :

images

By 2.1.2.9 and the earlier remark on i images I ( x ) we have that h images images . Since whenever i images I ( x ) holds we have Images i ( x ) ↓ (why?), it follows that h images images . Thus the totalness of f is established as soon as we rewrite (3) as

Images

We finally turn to establish property (2) for f. Let then f = Images k for some k (as it must since it is recursive) and pick any x ≥ k . Can it be that Φ k ( x ) ≤ g ( x )?

No, for otherwise k images I ( x ) holds and therefore f ( x ) = 1 + … + Images k ( x ) + … > Images k ( x ). A contradiction.           Images

Images The reader will note that the claim that we “can construct” an f with the stated properties is apt.          Images

2.7.1.10 Corollary. There is no λ x.g ( x ) images images such that every recursive Images i is expressed as Images i = λ x.d ((μ y ) ≤ g ( x ) T ( i, x, y )).

Proof. See Exercise 2.12.41.           Images

Images The corollary says that there is no upper bound on the complexities of the recursive functions.          Images

It is noteworthy that there are arbitrarily hard to compute 0-1 valued recursive functions, that is, arbitrarily hard to compute recursive predicates. The following and its proof is due to Blum (1967).

2.7.1.11 Theorem. For any a priori chosen recursive function λ x.g ( x ), we can construct 0-1 valued f images images such that, for any i, if f = Images i , then g ( x ) < Φ i ( x ) a.e.

Proof. With a 0-1 valued function we have to employ a more tricky index cancellation process, following Blum (1967). Adding all the Images i —for the i we want to cancel—and then adding 1 on top of that will not work. We define instead as follows:

Images

Let us leave for last the rather dull verification that (1) can be made mathematically precise toward showing that f images images . That f is 0-1 valued is obvious.

For now, we view the description in (1) as a reasonably complete guideline on how to “program” f and embark on proving its claimed complexity.

Let then f = Images r , for some r, and let us argue by contradiction.

Images

If the claim is false, then there is an infinite sequence of inputs above r,

r < x 1 < x 2 < x 3 < … < x m < … <

on which the complexity of Images r is ≤ g ( x i ), for each x i : i = 1, 2, ....

Now, input x i , for each i, satisfies r < x i and, by assumption, also Φ r ( x i ) ≤ g ( x i ). Moreover, r is uncancelled—that is, there are available indices to cancel in I ( x i ); cf. (l). So we cancel some j < r (why j < r?) at this step, and set f ( x i ) = 1 ∸ Images j ( x i ).

From the above follows that we will have an infinite sequence of indices, j i , that we will cancel, one for each x i :

Images

The inequalities are clear: Since r cannot be cancelled, it must be j 1 < r, and indeed j 1 is the smallest available. For x 2 , index j 1 is already cancelled, so the next larger uncancelled index, j 2 , is cancelled. Always, it must be that the indices we cancel are below r, as the latter is never cancelled.

This leads us to the absurdity that we have an infinite ascending sequence of integers between j 1 and r. We conclude that Φ r ( x ) > g ( x ) a.e. as claimed.

But why is f recursive? We build f together with λ x.c ( x ), the latter a function that stores, via prime power coding, the cancelled indices i ≤ x , after f ( x ) has been defined. We start with c, but first we recall the notation x images z from 2.4.4.1. The function c is given by a primitive recursion.

Images

λ yx.y images I ( x ) being in images * , we conclude that c images images . We return to f :

Images

Since λ xy . Images x ( y ) images images and by Exercise 2.12.28 , f images images . It is also defined on any x since the index of Images is in I ( x ).           Images

Images The above theorem establishes the existence of arbitrarily hard to compute recursive predicates. Does this mean that there are recursive predicates that are not in images images * ? Yes (cf. Exercise 5.3.32). images

2.7.2 Reducibility via the S-m-n Theorem

We now turn to the development of the technique of reductions, using the S-m-n theorem.

2.7.2.1 Definition. (Strong Reducibility) We say that the set A (subset of Images ) is strongly reducible to set B, in symbols A ≤ m B, iff there is a recursive function f such that for all x, we have x images A iff f ( x ) images B . We say that f effects the reducibility .           Images

Images 2.7.2.2 Remark. Several remarks are in order:

(1) The m in the reducibility symbol reflects the fact that f is not required to be 1-1. So, strong reducibility, by default, is a many-one reducibility or m-reducibility .
We also have 1-1 reducibility or 1-reducibility. This is when f is 1-1.

(2) The condition x images A iff f ( x ) images B says that if we know how to decide z images B and also know how to compute f ( x ) for all x, then we know how to decide x images A . Thus, the symbol ≤ m is apt: Intuitively A is “more solvable” than B since we can decide it if we can decide B. Conversely, B is more unsolvable than A .
We express this technically in the proposition below.

(3) By definition, A ≤ m B iff A = { x : f ( x ) images B }. That is, iff A = f ← ( B ).      Images Images

2.7.2.3 Proposition. Suppose that A ≤ m B . Then

(1) A is recursive if B is. Contrapositively, B images images * if A images images * .

(2) A is semi-computable if B is. Contrapositively, B is not c.e. if A is not c.e.

Proof

(1) If z images B is recursive, then so is f ( x ) images B by the assumption on f and by 2.1.2.24.

(2) If z images B is semi-recursive, then so is f ( x ) images B by the assumption on f and by 2.5.0.20.            Images

2.7.2.4 Definition. (Complete Index Sets) Given a subset Images ⊆ images , we call { x : Images x images Images } a complete index set (defined by Images ).           Images

Images 2.7.2.5 Remark. That is, a complete index set A = { x : Images x images Images } is the set of all (codes of) URM programs that compute the functions of some given subset Images of images . Indeed say f images Images . As this is computable, take any program i for f, that is, f = Images i . Now Images i images Images yields i images A by the definition of A .           Images Images

This subsection deals with the undecidability of membership in several complete index sets. Indeed, “several” is an understatement. We will conclude with the rather surprising Theorem of Rice, according to which the only decidable such problems involve the two trivial cases: Images = Images or Images = images .

Images 2.7.2.6 Remark. (The General Technique) The technique in general outline goes like this: We want to show that some A given as { x : Images x images Images }, for some Images ⊆ images , is not recursive.

Equipped with 2.7.2.3 we attempt to show either K ≤ m A or Images ≤ m A — whichever is easier. The latter, of course, yields more information (a stronger result): that A is not c.e.

To this end, we need to demonstrate that there is an h images images that effects one of K ≤ m A or Images ≤ m A .

To execute this plan, we utilize the S-m-n theorem so that we come up with a primitive recursive h such that

Case of K ≤ m A :

Images

Thus, h ( x ) images A if the top case holds, iff x images K —that is, Images x ( x ) ↓. For short, K ≤ m A via h .

Case of Images ≤ m A :

Images

Thus, h ( x ) images A if the top case holds, iff x images Images — that is, Images x ( x ) ↑. For short, Images ≤ m A via h .           Images Images

The following theorem is important both in content and in regards to the technique employed for its proof.

2.7.2.7 Theorem. The following sets are not recursive ,

(1) A = { x : Images x is a constant function }.

(2) B = { x : Images x is total } = { x : Images x images images }

(3) C = {〈 x,y 〉 : y images ran( Images x )}

(4) D = {〈 x,y, 〉 : z = Images x ( y )}

(5) E = { x : dom( Images x ) = Images }

(6) F = { x : dom( Images x ) is infinite }

(7) G = { x : dom( Images x ) is infinite}

(8) H = { x : ran( Images x ) = Images }

(9) I = { x : ran( Images x ) is finite}

(10) J = { x : ran( Images x ) is infinite }

Proof .

(1) A = { x : Images x is a constant function}.

We will be more expansive in just this first case. Following 2.7.2.6, we want to find an h images images such that

Images

Well, the simplest solution is probably this: Define, for all x and y

Images

We see first at the intuitive level that images is computable: Given x, y . We ignore y . Next, we fetch the URM M of code x and call it on input x. If it ever halts, then we print “0” and halt everything. If M never halts, then our process will never return from the call, which is the correct behavior for images ( x, y )—bottom case.

Intuitively, we cannot expect to yield some output in the bottom case, since, at least in the process described above, the call to M for input x will never halt to give us an opportunity to print anything.

Pause. Do you have a mathematical reason as to why defining images so that, say, it yields 42 in the bottom case renders images non computable (i.e., not in images )? Images

Images Mathematically, images images images via definition by positive cases (2.5.0.30). Of course, “ Images x ( x ) ↑” is not a positive case, being non c.e. However, reference back to 2.5.0.30 shows that the last (bottom) case is the “otherwise” case. Images

By the S-m-n theorem, there is an h images images images such that, for all x and y ,

Images

This can be rewritten as (note the change from ≃ to =)

Images

where Images is the empty function—clearly not a constant function! We have achieved the setup (†) and we conclude by directly invoking 2.7.2.6.

(2) B = { x : Images x is total} = : Images x images images }.

Note that (* * *) can be recast as

Images

Thus, K ≤ m B and therefore B images images * as in 2.7.2.6.

Images This result says less than what we already proved in 2.5.0.29 , however, it is important to see this alternative technique even if (seemingly) achieves less. Seemingly. We will refine the technique in the next theorem, to redidcover the non semi-recursiveness of B . Images

(3) C = {〈 x, y 〉) : y images ran( Images x ) }.

We have seen this example, and the next, already in Subsection 2.7.1. Let us use the present technique. If C is recursive, then so is C 0 = { x : 0 images ran( Images h ( x ) )} (by 2.1.2.6 )—where h is the same as above.

But 0 images ran( Images h ( x ) ) can happen iff we are in the top case of (* * *), which is in the case x images K. Thus K ≤ m C 0 via h .

(4) D = {〈 x,y,z 〉 : z = Images x ( y )}.

If D is recursive, then so is D 0 = { x : 0 = Images h ( x ) (0)}. The latter is equivalent to x images K as above and we conclude exactly as in the case of C above: K ≤ m D 0 .

(5) E = { x : dom( Images x ) = Images }.

We can still mine diverse unsolvability results from the very same setup (* * *) above. We rewrite this as

Images

Thus, as in 2.7.2.6 , h ( x ) images E iff we are in the bottom case; iff x images Images . That is, Images ≤ m E via h . We have proved more than what we were asked to: E is not even semi-recursive, let alone decidable.

(6) F = { x : dom( Images x ) is finite}.
We rewrite (* * *) as

Images

Thus, h ( x ) images F iff we are in the bottom case; iff x images Images . That is Images ≤ m F via h . Once again we have proved more than we were asked to: F is not semi-recursive.

(7) G = { x : dom( Images x ) is infinite}.

Yet again, we rely on (* * *). Indeed, see the argument for F above. We have that h ( x ) images G iff we are in the top case; iff x images K . That is, K ≤ m G via h and thus G is not recursive.

(8) H = { x : ran( Images x ) = Images }.

One last time we mine (* * *), rewriting it as

Images

Thus, h ( x ) images H iff we are in the bottom case; iff x images Images . Thus Images ≤ m H and H is not semi-recursive.

(9) I = { x : ran( Images x ) is finite}.

This case needs a fresh start, since neither λ y .0 nor Images have an infinite range, as needed for the “dichotomy” infinite vs. finite (range), toward applying the technique of 2.7.2.6. So, we define a new function, for all x and y , by

Images

χ is computable. Intuitively, given x and y we decode x to get the URM M that it codes. We then call M on input x . If it ever halts, we print y and halt all; otherwise we keep going.

Mathematically, χ is defined by positive cases, since Images x ( x ) ↓ is c.e. Thus it is in images . The S-m-n theorem allows the existence of a k images images , such that, for all x and y ,

Images

Put more conveniently, with no reference to inputs,

Images

Note that k ( x ) images I iff we are in the bottom case of (‡); iff x images Images . Thus Images ≤ m I via k , rendering I non c.e., which says more than what we set out to prove.

(10) J = { x : ran( Images x ) is infinite}.

We reuse (‡). Here k ( x ) images J iff we are in the top case of (‡); iff x images K. Thus K ≤ m J via k , rendering x images J undecidable. Images

Images Worth stating. Since the h and k utilized above are S-m-n functions, they are 1-1 (cf. 2.6.0.39 ). Therefore all reducibilities that we have effected above are 1reducibilities, ≤ 1 . Images

2.7.2.8 Theorem. None of the sets in 2.7.2.7 are semi-recursive, except C and D.

Proof. D is semi-recursive by 2.5.0.7. As for C , we see that y images ran( Images x ) ≡ (∃ z ) Images x ( z ) = y . Its semi-recursiveness follows from 2.5.0.7 via 2.5.0.18 .

We now turn to those sets listed in 2.7.2.7 , which we have not already proved to be non c.e. in the proof of said theorem.

(1) A = { x : Images x is a constant function}.

The obvious approach, that is, badly imitating 2.7.2.6 and modifying (*) to read

Images

will not work. The intuitive reason is that if we try to compute this new Images in the obvious way, given x and y we will ignore y , and will decode x to obtain the machine it denotes, M . We will run M on input x and will output and stop everything precisely if M is in an infinite loop, which is precisely if Images x ( x ) ↑.

Otherwise ( Images x ( x ) ↓) we will ensure that the overall computation never halts by a technique we have already employed (in 2.5.0.12 ).

The catch is that this “obvious” way is doomed, for our program—indeed, no program—can test, or even just verify that Images x ( x ) ↑.

The definitive reason that this Images is not computable is this: If it were, then so would be λ. x . Images ( x, x ). But the domain of the latter is Images . Impossible, because this set is not the domain of any partial recursive function.

Pause. Why “definitive”? Isn’t the intuitive reason (of the uncomputability of Images ) enough? Images

No. The intuition only warns and guides; it does not prove . After all, the suggested “program that did not work” was just one suggested, and “obvious”, program to compute Images .

Why can it not be the case that a future programmer might come up with a really clever and non obvious URM that computes Images ?

Precisely because we got the definitive answer mathematically : There can be no such a URM, now or ever; it does not exist.

OK, here is how to do it right: We want to build a partial recursive Images such that

Images

In view of the above remarks, we cannot use the condition “ Images x ( x ) ↑” outright as the top condition, so we will approximate it with “ Images x ( x ) does not converge in ≤ y steps”.

Note that for a “large” (number of steps) y , the casual (and impatient) observer will consider a computation for Images x ( x ), which is still going, as divergent.

So we finally define

Images

This Images is computable! Let us see why, intuitively at first. We program as follows: Given inputs x and y . We call the URM M , coded by x , on input x . If M has not stopped after y steps of its computation, then we print 0 and stop everything. In the contrary case—that is, the call to M with input x stopped within ≤ y steps—we deliberately enter an infinite loop as in 2.5.0.12 .

Mathematically, ( i ) can be rewritten as

Images

where Z = λ. y .0. Since the conditions are recursive (cf. p. 169 ), we have, by Exercise 2.12.28 , that Images Images Images . 91

By the S-m-n theorem, we have a primitive recursive σ such that, for all x and y ,

Images

Let us now consider the two cases below:

Case 1: Images x ( x ) ↑. Then ¬Φ x ( x ) ≤ y is true; for this x and all y , the top case applies. That is:

Images

Case 2: Images x ( x ) ↓. Let y 0 be smallest such that Φ x ( x ) ≤ y 0 . That is
For y = 0, 1, …, y 0 − 1, we have ¬Φ x ( x ) ≤ y

In this case

Images

where in ( v ) we have denoted the finite function

f ( y ) = if x = 0 ∨ x = 1 ∨ … ∨ x = y 0 − 1 then 0 else Images ( y )

as the finite sequence of its outputs. Of course, f Images Images .

We summarize what cases 1 and 2 say in ( iν ) and (ν):

Images

Given that the function in the bottom case is not a constant function, we immediately have σ( x ) Images A iff x Images Images , or Images ≤ m A as needed.

(2) B = { x : Images x is total} = { x : Images x Images Images }.
We may reuse (†) immediately above, since the top case is total while the bottom case is nontotal. Thus, σ( x ) Images B iff x Images Images , or Images ≤ m B as needed.

(3) G = { x : dom( Images x ) is infinite}.
We may reuse (†) since the top case has infinite domain while the bottom case has finite domain. Thus, σ( x ) Images G iff x Images Images , or Images ≤ m G as needed.

(4) J = { x : ran( Images x ) is infinite}.
We cannot reuse (†) here as both the top and bottom cases have finite ranges. We work entirely analogously to ( ii ) above, and define, for all x, y ,

Images

As χ is defined from partial recursive functions by recursive cases, it is in Images . By S-m-n we have a primitive recursive Images such that, for all x, y ,

Images

A similar analysis as above shows readily that

If Images x ( x ) ↑, then Images Images ( x ) = λ. y.y , while if Images x ( x ) ↓, then

Images Images ( x ) = Images 0, 1, …, y 0 − 1 Images

a finite function displayed as a sequence of outputs, where y 0 is smallest y such that Φ x ( x ) ≤ y .

Thus,

Images

and therefore Images ( x ) Images J if x Images Images , or Images ≤ m J as needed.           Images

The techniques used so far are unified in the results that we develop below.

2.7.2.9 Theorem. (The Rice Lemma) Given a complete index set A = { x : Images x Images Images }—where Images ⊆ Images . If some f Images Images has an extension g Images Images — Images , then Images ≤ m A .

Proof . Let Images m Images Images and Images n ∉ Images , where Images m ⊆ Images n . 92 The plan is to prove that a primitive recursive h exists such that

Images

As we have already observed, to avail ourselves of the “definition by positive cases” technique, the top case must be the “otherwise”. But if so, we cannot allow, in general, an “output” other than “↑” (cf. the remarks in 2.5.0.30 and the followup in Exercise 2.12.35 ).

Thus, once again, we will approximate the condition Images x ( x ) ↑.

Images

Is χ computable? Intuitively, it is. Here is how: Let H be a URM for verifying Images x ( x ) ↓, M a URM that computes Images m , and N a URM for Images n . Let x and y be given.

We run H on input x , and M on input y in parallel. If M halts but H is still running, then we print Images m ( y ) and stop everything.

Images Worth noting. If each of H and M loops for ever, then the top condition is valid; we correctly output Images m ( y ) in this case (we “output” ↑—that is, nothing). images

If, on the other hand, H halts before M does, then we abort M and call N on input y in order to (if convergence is achieved) output Images n ( y ).

The mathematical reason for the computability of χ is based on the above informal description.

The content of the above images -comment is the “otherwise”; thus we achieve a definition by positive cases:

Images

Since the above is a definition by positive cases—recall that Φ i ( x ) = w , Φ i ( x ) < w , and Φ i ( x ) ≤ w are (primitive) recursive—χ′ Images Images .

Pause. But is χ = χ′? Images

Yes. The top condition for χ′ says “ Images x ( x ) does not converge before Images m ( y ) does”—this is the case of Images m ( y ) ↓, where Images x ( x ) may or may not converge. The case of Images m ( y ) ↑ and Images x ( x ) ↑ is covered by the “otherwise” as we already have remarked, noticing that both the top and middle cases now fail. The middle condition says “ Images x ( x ) converges before Images m ( y ) does”.

By the S-m-n theorem there is an h Images Images Images , such that, for all x and y ,

Images

We can now verify that we have (1) above.

Images Let Images x ( x ) ↑. Then Φ x ( x ) ≤ z is false for all z , hence the middle case cannot apply.

(a) If we have Images m ( y ) ↓, then (∃ z )Φ m ( y ) = z , thus the top condition is true and Images h ( x ) ( y ) = Images m ( y ).

(b) If we have Images m ( y ) ↑, then Φ m ( y ) ≤ z is false for all z , thus only the “otherwise” applies. We have, once more Images h ( x ) ( y ) ≃ Images m ( y ) (note the “≃”).

For short, Images h ( x ) \= Images m in this case .

Images Let Images x ( x ) ↓. Let z be smallest such that Φ x ( x ) = z . Now fix a y .

(i) If Φ m ( y ) ≤ z , then the top case holds, thus Images h ( x ) ( y ) ≃. But Images m ( y ) ↓ (why?), thus, by Images m ⊆ Images n , we have Images m ( y ) = Images n ( y ) (note the “=”).
Therefore Images h ( x ) ( y ) = Images n ( y ) 93 .

(ii) If ¬ Φ m ( y ) ≤ z , then the middle case holds, and again Images h ( x ) ( y ) ( y ) (“≃” this time is essential, as it may be that Images n ( y ) ↑.)

For short , Images h ( x ) \= Images n in this case .

This establishes (1), and hence the equivalences h ( x ) Images A iff Images h ( x ) Images Images iff Images h ( x ) \= Images m iff x Images Images . That is, Images ≤ m A via h .

2.7.2.10 Corollary. Given a complete index set A = { x : Images x Images Images }—where Images ⊆ Images . If some f Images Images has an extension g Images Images – Images , then A is not c.e .

2.7.2.11 Corollary. (The Theorem of Rice) A compete index set A = { x : Images x Images Images } is recursive iff it is trivial, meaning that either A = Images or A = Images .

Proof The if part is immediate since, in fact, Images and Images are primitive recursive.

As for the only if say A is recursive. Then A and Images – A (or Images ), that is,

{ x : Images x Images P – Images }

are both c.e.

We consider two cases. First, let Images 94 Images Images . Since A is semi-recursive, 2.7.2.10 yields that every computable extension of Images is in Images . Thus Images = Images and hence A = Images .

Second, let Images Images P – Images . As above, since Images – A is c.e., 2.7.2.10 yields that every computable extension of Images is in P – Images . That is, P – Images = P and hence Images – A = Images . Therefore, A = Images

2.7.2.12 Example. We look back to 2.7.2.7 . We see at once by application of Rice’s theorem that each of the sets A, B , and E–J are not recursive.

Each of them is a nontrivial complete index set. For example, the set of constants Images is not equal to either Images or Images , for, on one hand, constant functions exist (!), such as λ. x .380, or λ. x .0, and, on the other hand, not every computable function is a constant; for example, λ. xy.x + y , λ. x.x , etc. Thus, Images ≠ A ≠ Images .

Similarly one shows all of E–J to be nontrivial.

The sets Images and D are not complete index sets so the theorem of Rice does not help. One can employ either the technique of 2.7.2.7 or direct diagonalization (cf. 2.7.1.7 ).            Images

Images 2.7.2.13 Example. Wait a minute! We have not verified that, e.g., set F of 2.7.2.7 is a complete index set.

As a principle we must , in each case prior to the application of Rice’s theorem. Often it is easy to do so.

Apropos F = { x : dom( Images x ) is finite}, let us set Images = { f Images P : dom( f ) is finite}. Thus F = { x : Images x Images Images }. And this is a complete index set in the format defined in 2.7.2.4.          Images    Images

2.7.2.14 Example. We have seen already that every computable function has infinitely many Images -indices by arguing the case via URM programs. Here is a “high level” approach: Let f Images Images . Then Images ≠ { x : Images x = f } Images . By Rice’s theorem, { x : Images x = f is not recursive, hence must be infinite (every finite set is primitive recursive).           Images

Images Images 2.7.2.15 Example. But how about K ? Is K = { x : Images x ( x ) ↓} a complete index set? That is, is there a Images ⊆ Images such that K = { x : Images x Images Images }? We will answer this negatively in Section 2.9 .           Images Images Images

The Rice Lemma 2.7.2.9 can help in easily establishing non semi-recursiveness. Let us revisit 2.7.2.8 .

2.7.2.16 Example. Look at E = { x : dom( Images x ) = Images }. For convenience let us set

Images

Note that dom( Images ) = Images . However, λ. x .0 extends Images but is not in Images —its domain is Images . By 2.7.2.10 , E is not c.e.

A similar argument holds for F , since Images has a finite domain hence is in F ’s implied “ Images ” . Any constant function extends Images but is not in this “ Images ” . Thus, F is not c.e.

Corollary 2.7.2.10 can similarly show that H and I are not c.e. although we should use λx.x or any other computable infinite-range function—instead of λ. x .0—as an extension of Images that lies outside the “ Images ” of these two complete index sets.

However the corollary does not help the proof of non semi-recursiveness of A, B, G , or J . A new general technique is needed.           Images

The following theorem is the contribution of several people (Rice, Myhill, Shapiro, McNaughton). First a definition.

2.7.2.17 Definition. (Finite Functions) A number theoretic function f is finite iff dom( f ) is a finite set.           Images

2.7.2.18 Theorem. Given A = { x : Images x Images Images }, where Images ⊆ Images . Suppose that some f Images Images has no finite subfunction ξ— i.e. , ξ ⊆ f — that is a member of Images . Then Images ≤ m A .

Proof The idea is to find, using the S-m-n theorem, an h Images Images Images . such that

Images

If this succeeds, then h ( x ) Images A iff Images h ( x ) Images Images iff Images h ( x ) \= f iff x Images Images . Thus, Images ≤ m A .

Now to justify (1) we straightforwardly generalize the technique from 2.7.2.8 , case (4). Thus we define, for all x, y,

Images

This is a definition by recursive cases, thus χ Images Images . By the S-m-n theorem we have an h Images Images Images , such that

Images

Let us now consider the two cases:

(a) Images x ( x ) ↑. Then the top condition of (2) is true for all y , thus Images h ( x ) \= f in this case.

(b) Images x ( x ) ↓. Let y 0 be the smallest y -value such that the bottom condition in (2) holds. Assume first that y 0 ≥ 1. Thus, for y = 0, 1, …, y 0 – 1, we have that ¬Φ x ( x ) ≤ y holds, and therefore
for y = 0, 1, …, y 0 — 1, it is Images h ( x ) ( y ) ≃ f ( y ), but Images h ( x ) ( y ) ↑, if y ≥ y 0 (3)
Let us call ξ the finite subfunction of f in (3) above: ξ = f ↾ {0, 1, …, y 0 – 1} (cf. definitions and notation on p. 45 ). Thus, Images h ( x ) \= ξ (⊆ f ) in this case, for y 0 > 0.
If y 0 = 0, then the bottom condition holds for all y , thus Images h ( x ) \= Images . But Images ⊆ f .
We have verified (1). Images

2.7.2.19 Corollary. Let the complete index set A = { x : Images x Images Images } be c.e. Then f Images Images iff some finite subfunction off is in Images .

Proof. The only if is by 2.7.2.18 , for otherwise Images ≤ m s A , contradicting the assumption. The if is by 2.7.2.9 , for if Images ∋ ξ ⊆ f , then f Images Images . Images

2.7.2.20 Example. We return to the concluding comment

However the corollary does not help the proof of non semi-recursiveness of A , B , G , or J . A new general technique is needed.

from 2.7.2.16 . The respective image -sets in each of the index sets A and B contain total functions only. Thus no f in such a image can have a finite (nontotal!) subfunction also in image . By 2.7.2.19 , neither A nor B can be c.e.

Similarly, the respective image -sets in each of the index sets G and J contain functions with infinite domains only. Thus no f in such a image can have a finite subfunction also in image . Again, by 2.7.2.19 , neither G nor J can be c.e. image

image 2.7.2.21 Remark. A variant of a complete index set has this form

image

where image * ⊆ image * . That indeed this is only a variant of the notation { x : image x Images image } is immediate from (cf. 2.5.0.3 )

image

Thus, setting image = { f Images image : dom( f ) Images image * }, we may rewrite (1) as

image

This new notation is very useful in computability theory. We explore here rewordings of the Rice-related theorems that utilize this new notation.

2.7.2.22 Theorem. Given a complete index set A = { x : W x Images image * }— where image * ⊆ image * . If some S Images image * satisfies S ⊆ T, where T Images image * – image * , then image ≤ m A .

Proof . Following the notational translations of 2.7.2.21 , we write image = { f Images image : dom( f ) Images image * }. So,

image

Let S and T be as given. Thus, for some f Images image , S = dom( f ). The function g = λ x .1 ∸ (1 ∸ f ( x )) satisfies S = dom( g ) as well. Let T = dom( h ) with h Images image and ran( h ) = {0} [if necessary, we use λ x .1 ∸ (1 ∸ h ( x )) instead].

Notice that g Images image , g ⊆ h , and h Images image . 95 By 2.7.2.9 , image ≤ m A .       Images

2.7.2.23 Theorem. (Rice’s Theorem— W -Version) A compete index set A = { x : W x Images image * } is recursive iff it is trivial, meaning that either A = image or A = image .

Proof . This can be proved by invoking 2.7.2.11 after we translate the W i -notation into image i -notation, using 2.7.2.21 . It can be proved just as easily, directly from 2.7.2.22 .

A trivial index set being primitive recursive, we turn to the only if . So let both A and image be c.e.

Case where image Images image * . Then S Images image * for every c.e. subset of image by image ⊆ S . It follows that image * = image * , i.e., A = image .

Case where image Images image * . We work with the c.e. set image = { x : W x Images image * − image * }. As above, S Images image * − image * for every c.e. subset of image . Thus, image * − image * = image * , i.e., A = image .    Images

2.7.2.24 Theorem. Given A = { x : W x Images image * }, where image * ⊆ image * . Suppose that some S Images image * has no finite subset D that is a member of image * . Then image ≤ m A .

Proof . We derive this as a corollary of 2.7.2.18 , using the notational translations from 2.7.2.21 . We write image = { f Images image : dom( f ) Images image * }. So,

image

Let S be as given. Thus, for some f Images image * , S = dom( f ). As before, we may assume that ran( f ) = {0}. If we had a finite ξ ⊆ f as a member of image , then it would be that

(a) dom(ξ) is a finite set D Images image * —by the translation—and

(b) D ⊆ S .

(a) and (b) contradict the hypothesis. Thus, no such ξ exists, and thus image ≤ m A by 2.7.2.18 .

2.7.2.25 Example. { x : W x \= image } is not c.e. by 2.7.2.22 . Indeed, image * = { image }. But image ⊆ image , yet image Images { image }. { x : W x is infinite} is not c.e. by 2.7.2.22 . Indeed, the image * -set here is the set of all infinite members of image * . This image * fails to contain any finite subset of any set that it contains. We are led to image ≤ m { x : W x is infinite} by 2.7.2.24 .    Images

2.7.3  More Dovetailing

A c.e. set can be given either via a URM that is a verifier—the set is the domain of the verifier—or a URM that is an enumerator: the set is the range of the URM-computed function.

Suppose we are given one of these two types of finite description of a set. Can we construct the other? Yes!

Say that a semi-computable set S has been given by a verifier M of code m , that is, S = W m . How do we construct a URM program N , of code n to compute image n , such that

Images

The idea is that, for each x for which M halts—that is, x Images W m —our new program N must output x . Now, we cannot have N enumerate all x = 0, 1, 2, 3, … and simulate M on each such input in turn, since, on some such inputs, M —and therefore N —will be stuck forever; an unfortunate event as there may well be later x -values that need outputting. So, we dovetail instead! (Cf. 2.5.0.23 .) Thus, N will simulate M on all inputs x = 0, 1, 2, 3, … as follows: It will simulate one step of M on input 0; then two steps on inputs 0 and 1; then … then k + 1 steps on all inputs 0, 1, …, k . It will continue in this pattern, for all k ≥ 0. All inputs which during the simulation cause M to halt will be output by N . Note that we have “ constructed ” N (in outline), using knowledge of M (“subroutine”). Clearly, the set of outputs generated by N is precisely the set of inputs on which M halts.

Mathematically, the fact that the program n is constructed from m is captured by the existence of a primitive recursive h such that n = h ( m ). We state and prove

2.7.3.1 Theorem. There is a primitive recursive h such that for all x , ran( image h ( x ) ) = W x .

Proof . This is a trivial adaptation of the proof of 2.5.0.24 following the idea in 2.5.0.28 : Define, for all x and z ,

image

image is trivially partial recursive, hence (by S-m-n) there is a primitive recursive h such that

image

By 2.5.0.28 , ran( image h ( x ) ) = W x .  Images

Pause. Can we ensure that whenever W x ≠ image we obtain a total image h ( x ) ? image

Yes, if we can replace ↑ in (1) of the above proof by a computed “ a ”, analogous to the one employed in 2.5.0.24 , where we said

… where “ a ” is some fixed member of S that we keep outputting every time the condition “ T ( i , ( z ) 0 , ( z ) 1 )” fails …

The “some fixed” a can easily be replaced by a computed value (from the verifier code x of W x ) via the selection theorem .

2.7.3.2 Theorem. (Selection Theorem) There is a partial recursive g of one variable such that, for all x,

(i) W x ≠ image iff g ( x )↓

(ii) If W x ≠ image , then g ( x ) Images W x .

Proof . A familiar dovetailing technique is at play: We compute the first pair [ y, w ] such that T ( x, y, w ) holds. That is, setting z = [ y, w ], we let

image

For (i), let W x ≠ image . Thus (∃ y , w ) T ( x, y, w ) is true and the search in (1) succeeds. Conversely, if the search succeeds, then ( z ) 0 Images W x . For (ii), the successful search yields a ( z ) 0 Images W x . But g ( x ) = ( z ) 0 .          Images

image The selection theorem is a computable version of the axiom of choice . The axiom of choice postulates that if { S a : a Images I } is an indexed collection of sets—indexed by I —then there is an f such that S a ≠ image implies f ( a ) Images S a .

Our “ g ” does just that for the collection { W x : x Images image }; computably !           image

2.7.3.3 Corollary. There is a primitive recursive h such that for all x , ran( image h ( x ) ) = W x . Moreover, if W x ≠ image , then image h ( x ) Images image .

Proof . We use the proof of 2.5.0.24 , adding the i as an argument, and using g ( i )—the selection function at i —rather than the intangible “ a ”. That is,

image

Images is trivially partial recursive, hence (by S-m-n) there is a primitive recursive h such that

image

2.7.3.4 Example. Rogers (1967) offers the following simple proof that obscures the dovetailing at work: Let

image

Via definition by positive cases, Images is partial recursive. Let (by S-m-n) σ —primitive recursive—be such that Images σ ( x ) ( z ) ≃ Images ( x , z ), for all x , z . Note that z Images ran( Images σ ( x ) ) iff Images x ( z ) ↓, that is, iff z Images W x .

Of course, the definition-by-positive-cases theorem ( 2.5.0.30 ) already includes a dovetailing argument buried in its proof.          image

Next, say that a semi-computable set S has been given by an enumeration, by some URM M of code m . That is, S = ran( Images m ). How do we construct a URM program N of code n , for Images n , that is a verifier for S , in other words,

images

If Images m is total, then all that N need do is this: Given x , N tests “ x Images S ?” by

for y = 0, 1, 2, … do
if M on input y outputs x , then halt

For nontotal Images m this will fail, since, say, it could be that Images m (1) = x while Images m (0) ↑. The call to M on input 0 would go forever, never reaching the computation Images m (1). Once again, one must dovetail:

for T = 1, 2, … do
if M on any input y < T outputs x within T steps, then halt

Mathematically,

2.7.3.5 Theorem. There is a primitive recursive k such that for all x , ran( Images x ) = W k ( x ) .

Proof . Define, for all x and y ,

image

The top predicate is c.e. thus χ is defined by positive cases. This makes χ partial recursive. By the S-m-n theorem, there is a k Images Images such that Images k ( x ) ( y ) ≃ χ ( x, y ), for all x, y . The definition of χ immediately yields that Images k ( x ) ( y ) ↓ iff y Images ran( Images x ). Images

2.7.3.6 Corollary. There are σ and Images in Images such that, for all x ,

(i) W x \= ran( Images σ ( x ) ) and, moreover , Images σ ( x ) is 1-1. If it is nontotal, then dom( Images σ ( x ) ) = { i Images Images : i < n }, for some n .

(ii) ran( Images x ) = ran( Images image ( x ) ) and, moreover , Images image ( x ) is 1-1. If it is nontotal, then dom( Images image ( x ) ) = { i Images Images : i < n } for some n .

Proof .

(i) We adapt the proof of 2.7.3.3 , being careful not to output values that have already been output. The technique for generating outputs is dovetailing; the technique to avoid repetitions of outputs is to keep a list of “outputs so far” and not output a generated value if it is in the list.

So this time we define a modified Images via a course-of-values recursion following the careful approach of 2.1.2.50 and 2.1.2.51 , albeit in the present application we will not start with, nor write down, the (simple) primitive recursion for the history function

H ( i, x ) = [ image ( i , 0),…, image ( i, x )]

In this connection we recall the predicate x Images y used in the proof of 2.4.4.1

image

The S-m-n theorem yields a σ such that Images σ ( x ) ( y ) ≃ image ( x, y ), for all x, y . The claim for dom( Images σ ( x ) ) follows from 2.1.2.51 . That W x \= ran( Images σ ( x ) ) is immediate.

(ii) By 2.7.3.5 we get an h such that ran( Images x ) = W h ( x ) . Applying part (i) we get a σ such that W h ( x ) \= ran( Images σ ( h ( x )) ). We set image ( x ) = σ ( h ( x )), for all x .          Images

We continue with a brief exploration of effectively —a synonym of computably —obtaining the results of computable set-theoretic operations on c.e. sets.

2.7.3.7 Example. There is a primitive recursive h such that W h ( x,y ) \= W x ∩ W y . Herein lies the effectiveness of this operation: If we know the verifiers x and y of two c.e. sets, then we can construct (via h ) a verifier h ( x, y ) for their intersection. Note that W x ∩ W y \= dom( Images x + Images y ). Fix an i such that, for all x, y and z , we have Images . By S-m-b, Images . Take Images .          Images

Images 2.7.3.8 Example. ( 2.7.3.6 Revisited) How about proving 2.7.3.6 , case (i), by selecting an a in W i ; selecting an a ′ in W i – { a }; selecting an a ″ in ( W i , – { a }) – { a ′}; etc.?

OK, let us organize this idea. First off, we can find a k Images image such that W k ( x,i ) \= W i – { x } for all i , x . We do this by noting that W i – { x } = W i ∩ ( image – { x }) = W i ∩ W r ( x ) , the last equality by Exercise 2.12.58 . Using 2.7.3.7 we have

W h ( i,r ( x )) \= W i − { x }

Our k is λ ix . h ( i, r ( x )).

We can now take care of the iteration “etc.” above using the selection function g :

We let a = g ( i ); then remove a to obtain W k ( a,i ) ;

We next let a ′ = Images ; then remove a′ to obtain W k ( a ′, k ( a,i )) ;

We next let a ″ = Images ; then remove a ″ to obtain W k ( a ″, k ( a ′, k ( a,i ))) ; etc. We can define an f by recursion,

f (0, i ) = i

f ( x + 1, i ) ≃ k ( g ( f ( x, i )), f ( x, i ))

f enumerates the W -sets—verifiers of, that is—

W i = W f (0, i ) ⊃ W f (1, i ) ⊃ W f (2, i ) ⊃ W f (3, i ) ⊃ …

while the sequence

g ( f (0, i )), g ( f (1, i )), g ( f (2, i )), …

1-1-enumerates (the members of) W i , because g ( f ( x, i ))—if defined—is not in W f ( y,i ) , for y > x , and thus will not be chosen again.

Indeed, by the second equation for f , f ( x + 1, i ) is what g selects in the original W i after the removal of g ( f ( x, i )) in this very step—the g ( f ( x – 1, i )), g ( f ( x – 2, i )),…, g ( f (0, i )) having been removed in the preceding steps (by an obvious induction).

It is also clear that either λ x.g ( f ( x, i )) is total, or an initial segment of image , since the enumeration will not get stuck until W i is depleted.          Images

2.7.3.9 Example. Let A be a c.e. set and f a partial recursive function. What can we conclude about the inverse image of A under f , that is, f ← ( A )? (Cf. p. 43 .)

Well, x Images f ← ( A ) ≡ (∃ y )( f ( x ) = y ∧ y Images A ). Thus, by closure properties of image * and 2.5.0.7 , the inverse image is c.e.

We can do better than this: From programs for f and A we can construct an enumerator for the inverse image. This is done by yet another dovetailing argument!

Intuitively, we dovetail the “enumeration” f : Enumerate all triples 〈 x, y, z 〉 in some systematic way. For example, as 〈( w ) 0 , ( w ) 1 , ( w ) 2 〉, for w = 0, 1, 2, …

For each 〈 x, y, z 〉 generated, we do z steps of the verification of f ( x ) = y ∧ y Images A using the given program for f and the verifier for “ y Images A ?”

If we get a “yes” then we enumerate x into f ← ( A ).

Mathematically this is even simpler, although the dovetailing is hidden. Note that z Images ( Images x ) ← ( W y ) ≡ Images x ( z ) Images W y . But Images x ( z ) Images W y ≡ Images y ( Images x ( z )) ↓. By S-m-n applied to image = λ xyz . Images y ( Images x ( z )) we have an h Images Images such that Images ( x, y, z ) ≃ Images h ( x,y ) ( z ), for all x, y, z . That is, dom( Images h ( x,y ) ) = ( Images x ) ← ( W y ), or W h ( x,y ) \= ( Images x ) ← ( W y ).          Images

2.7.3.10 Example. Let us address the same question as in 2.7.3.9 , but for the forward image f → ( A ) = { f ( x ) : x Images A } for c.e. A and partial recursive f . First off, choose a verifier Images y for A . Then we can dovetail as follows: Enumerate systematically, as in the preceding example, all triples 〈 x, w, z 〉. For each triple generated as a number u = [ x, w, z ], check whether in z steps we have f ( x ) ↓ while we have Images y ( x ) ↓ in w steps; if so, print f ( x ).

Mathematically, let A = dom( Images y ) and f = Images x . Thus, we can enumerate f → ( A ) by

image

By S-m-n, there is a σ in Images such that for all x, y, u , we have Images σ ( x,y ) ( u ) ≃ image ( x, y, u ). Clearly, ran( Images σ ( x,y ) ) = ( Images x ) → ( W y ).          Images

We have so many times remarked that the “dovetailing is hidden” or “obscured”. In a way this is a deliberate outcome of the tools of this subsection— 2.7.3.1 , 2.7.3.5 , and 2.7.3.2 along with their variants and corollaries—which “hardwire” dovetailing arguments into themselves, making it often unnecessary to use such an argument explicitly.

Here is another example that verifies the above point.

2.7.3.11 Example. Let us revisit the “hard direction” of 2.5.0.7 , that is, if y = f ( image n ) is semi-recursive, then f is partial computable . We utilize the selection theorem as it was generalized in Exercise 2.12.61 . By assumption, for some i ,

image

Then f = λ image n . Sel ( n+1 ) (i, image n ). Images

2.7.4  Recursive Enumerations

The definition of the term c.e. (r.e.) was via a recursive enumeration f for non-empty such sets. It turns out that we can say a bit more if the c.e. set is recursive.

2.7.4.1 Definition. A total function image is increasing iff, for all x and y , we have that x < y implies f ( x ) ≤ f ( y ). It is strictly increasing iff, for all x and y , we have that x < y implies f ( x ) < f ( y ). Images

2.7.4.2 Theorem. A non-empty recursive set A has an increasing recursive enumerating function, and conversely: If the c.e. set B has an increasing recursive enumerating function, then it is recursive.

Proof . Let A be as stated. If it is finite , with distinct members in the following increasing order,

a 0 , a 1 , …, a k

then

image

is primitive recursive, increasing, and ran( f ) = A .

Assume now that A is infinite . Define a function h by

h (0) = a

h ( x + 1) = ( μy )( y Images A ∧ y > h ( x ))

where a is the smallest member of A . Thus, h Images image , and since the search succeeds for all x , we have h Images image . It is clear that h is strictly increasing and that ran( h ) ⊆ A . Is it possible that m Images A – ran( h )? If so, let m be smallest such. Now, m ≠ h (0) = a . Let then h ( y ) < m < h ( y + 1) for the appropriate y [which is such that y + 1 is smallest with h ( y + 1) > m , a minimum that exists since h is strictly increasing and thus its outputs increase without bound]. But then, h ( y + 1) is wrongly chosen, since it is not the smallest > h ( y ) in A ! Therefore we can have no such m , and A = ran( h ).

For the converse, let B = ran( f ), where f is a recursive increasing function. If B is finite, then it is recursive—indeed primitive recursive—since in predicate form it is a disjunction of a finite number of elementary formulae of the type x = a , one for each a Images B .

Let then B be infinite. We need to show that the predicate x Images B is recursive. Well, B is the increasing “array”

f (0), f (1), …, f ( i ), …

How do we search such an array for x with a view of finding the first i , if any , such that x = f ( i )? Our programming experience suggests the pseudo program

Images

This “proves”—modulo rewriting the program as a URM—that B is recursive. We can easily turn the above to a mathematical proof.

x Images B ≡ f (( μi ) x ≤ f ( i )) = x

Since B is infinite, the partial recursive function λ x .( μi ) x ≤ f ( i ) is recursive. Thus, so is λ x .( μi ) x ≤ f ( i ). Images

We have at once:

2.7.4.3 Corollary. An infinite recursive set A has a strictly increasing recursive enumerating function, and conversely: If the c.e. set B has a strictly increasing recursive enumerating function, then it is recursive and infinite.

2.7.4.4 Corollary. An infinite c.e. set A has an infinite recursive subset .

Proof . Let A = ran( f ) for recursive f . We define a strictly increasing (recursive) sub-sequence

g (0), g (1), …

of

Images

and then invoke 2.7.4.3 . Note that because A is infinite the sequence (1) is unbounded hence, for any x , there is a y such that g ( x ) < f ( y ).

This leads to this primitive recursion for g :

g (0) = f (0)

g ( x + 1) = f (( μy ) f ( y ) > g ( x ))

Since the search above always succeeds, the partial recursive g is total, hence recursive. But it is also, by construction, strictly increasing. Images

Note that the above proof was constructive in that from the knowledge of f we “programmed” g . This can be made more precise mathematically as follows.

2.7.4.5 Corollary. There is a primitive recursive r such that if image x is recursive and ran( image x ) is infinite, then image r ( x ) is recursive , ran( image r ( x ) ) is recursive and infinite, and, moreover , ran( image r ( x ) ) ⊆ ran( image x ).

Proof . A straightforward adaptation of the proof above. Define instead

g (0, x ) ≃ image x (0)

g ( y + 1, x ) ≃ image x (( μz ) image x ( z ) > g ( y, x ))

As above, the recursiveness and unboundedness of image x means that g is recursive and strictly increasing with respect to the y variable. S-m-n gives us an r such that, for all x, y , we have image r ( x ) ( y ) ≃ g ( y, x ). Images

2.7.4.6 Corollary. There is a primitive recursive h such that if W x is infinite, then W h ( x ) ⊆ W x , and W h ( x ) is infinite and recursive .

Proof . A direct consequence of the proof of 2.7.4.5 : Employ first 2.7.3.3 to obtain a σ Images image such that ran( image σ ( x ) ) = W x and where W x ≠ image implies image σ ( x ) Images image . Now apply Corollary 2.7.4.5 to obtain image r ( σ ( x )) . Finally, apply 2.7.3.5 to obtain a primitive recursive h such that W h ( x ) \= ran( image r ( σ ( x )) ). Images

image 2.7.4.7 Remark. The “programs” r and h in Corollaries 2.7.4.5 and 2.7.4.6 do not simply exist; we demonstrated their existence by constructing them. We say that the proofs were constructive . Constructive proofs that “a program exists” are not always possible. For example, we know from the proof of 2.7.4.2 that for any finite, non-empty set, there is an algorithm that can enumerate it in strict ascending order and then it will “taper off” repeating (the enumeration of) the maximum entry forever.

It turns out that given a finite set we cannot construct said algorithm. 96 We will demonstrate the particulars of this claim in the following discussion. Images Images

Pause. But how is a finite set “ given ”? image

Well, a recursive set S can be given by a decider for S —that is, an x , such that image x = χS —or by a verifier for S —that is, a z , such that W z \= S . Note that giving a set as an enumerator is computably equivalent to giving it as a verifier, since one can go back and forth between these two representations computably (cf. 2.7.3.1 and 2.7.3.5 ).

2.7.4.8 Example. We have already seen that we can convert a decider for a set S to a verifier for the same set ( 2.5.0.12 ). The process described was clearly constructive, albeit at an informal level.

Mathematically, let

image

As (1) is an instance of definition by positive cases, image is computable, so, by S-m-n, let h Images image be such that image ( x, y ) ≃ image h ( x ) ( y ) for all x, y . Thus

image

If now image x = χ S for some S (rendering S recursive), then, by (2), W h ( x ) \= S . Images

For recursive sets, can we go, computably, from a verifier to a decider representation? No, for one way to go about it would be to seek a image Images image such that it satisfies

  • image ( x ) ↓ iff W x is recursive
    and
  • in case W x is recursive, image image ( x ) \= χW x .

The first bullet requires dom( image ) = { x : W x Images R * }, which cannot be, since the left hand side is c.e. but the right hand side is not (cf. Exercise 2.12.48 ). No such image exists.

image 2.7.4.9 Remark. Hmm. What about weakening image so that we allow it to converge as it pleases outside { x : W x Images R * }, yielding irrelevant answers? That is, can we have a “new” image of which we only ask:

image

This is also impossible [Rogers (1967)]. To see this, we go back to Theorem 2.7.2.7 and reuse (* * *) (reproduced below)

image

from the proof of its item (1), rewriting it in this guise:

image

Of course, h is primitive recursive. Suppose now that we have this new, weaker image that we are looking for. Then,

(a) image ( h ( x )) ↓, for all x , since either way, “top” or “bottom”, W h ( x ) is recursive.

(b) Since ran( χ image ) = {0}, we have that 1 Images ran( image image ( h ( x ))) iff we have the bottom case in (2).

Thus,

Images

This is untenable, since one side of ≡ is c.e. but the other is not. Indeed, 1 Images ran( image image ( h ( x ))) ≡ image Images image

Of course, the foregoing comments also apply to finite sets since these are (primitive) recursive. However, finiteness provides yet another manner to finitely code such a set, not coding it via a decider or verifier, but rather coding the set of its elements itself by a single number.

This can be done in any one of the many ways that we have at our disposal for coding finite sequences , for example, prime-power coding (allowing 0 to be the code for the empty set). As this entails a decision on selecting one of the n ! 97 orders of a set of n elements, the following coding is more elegant.

2.7.4.10 Definition. (Canonical Indices) The canonical index of a finite set S = { a 0 , …, a n }—where the a i are distinct but not otherwise sorted in any “preferred” order—is the number u = 2 a 0 + 2 a 1 + … +2 a n .

The canonical index of image is 0. Images

image u —expressed in binary notation—has a digit (“bit”) 1 in precisely the positions a i , for i = 0, …, n (where position-0 is the rightmost or “least significant”). image

2.7.4.11 Example. It is rather trivial to see that if we have a canonical index u of a finite set S , then we can construct a program for its characteristic function, and therefore —by 2.7.4.8 —can also construct a program for a verifier of S .

Indeed, if u = 0, then the characteristic function is λ x .1. Alternatively, once we have recovered from u (by just looking where its binary notation has 1s) the members

{ b 0 , …, b m }

of S , the characteristic function—and indeed the enumerator of p. 202 —can be constructed at once:

image

The converse will not work:

image 2.7.4.12 Example. We cannot (in general) have a computable function image such that if W x is finite, then image ( x ) ↓ and image ( x ) equals the canonical index of W x , while, if W x is not finite, then image ( x ) ↑.

Indeed, if we had such a image , then dom( image ) = { x : W x is finite}.

This is impossible, as the left hand side is c.e. but the right hand side is not (cf. Exercise 2.12.50 ). Images

images 2.7.4.13 Example. If a finite set S is given by its characteristic function, images x , then we have more information about S than we would have if it were given as a W z . Does this extra information allow us to have a computable function ξ such that if { y : images x ( y ) = 0} is finite, then ξ( x ) ↓ and ξ( x ) equals the canonical index of { y : images x ( y ) = 0}; while, if { y : images x ( y ) = 0} is not finite, then ξ( x ) ↑?

The answer is still negative, for consider the following definition by recursive cases

images

f ∈ images and thus, by S-m-n, we have a σ ∈ images , such that

f ( x,y ) = images σ( x ) ( y ), for all x , y

Note that if images ( x ) ↑, then the top condition is always true, thus, using sequence notation

images

that is,

x ∈ images implies that images σ( x ) \= χ images           (1)

If, on the other hand, images x ( x ) ↓, let y = y x be smallest such that Φ x ( x ) ≤ y . Thus,

images

Thus, images σ ( x ) is the characteristic function of an infinite set in the x ∈ K case, and hence ξ(σ( x )) ↑. Therefore, assuming we have our ξ as stated, we also have

ξ(σ( x )) ↓≡ x ∈ images

This will not do, since the left hand side is a c.e. relation, while the right hand side is not c.e. images

images 2.7.4.14 Example. Perhaps, if we weaken the requirement on ξ, we may have a computable passage from the program of the characteristic function of a finite set to its canonical index.

Thus, let us relax the requirement that if { y : images x ( y ) = 0} is not finite, then we are “informed” of this by “ξ( x ) ↑”. Since we cannot computably know whether { y : images x ( y ) = 0} is not finite, we lose nothing if we allow ξ to converge for such x (cf. the analogous situation in 2.7.4.9 ).

So, can we have the validity of the weaker statement below?

“ A computable ξ exists such that if { y : images x ( y ) = 0} is finite, then ξ( x ) ↓ and ξ( x ) equals the canonical index of { y : images x ( y ) = 0}.”

Thus, we are willing to live with a much less informative version of “ξ”, where the statement “{ y : images x ( y ) = 0} is not finite” may well coexist with ξ( x ) ↓. Such a ξ still would always correctly build the canonical index of a set S if it received as input a program x that computes the characteristic function of S , but would produce nonsensical outputs for some x that satisfy “{ y : images x ( y ) = 0} is not finite”.

It turns out that we cannot have this version of ξ either! Indeed, define

images

Note that

y = min{ z : Φ x ( x ) ≤ z } ≡ Φ x ( x ) ≤ y ∧(∀ z ) < y ¬Φ x ( x ) ≤ z

hence both defining conditions (for g ) are recursive. Thus g is recursive. Let σ in images be such that, for all x and y , we have images σ( x ) ( y ) = g ( x , y ). Thus,

if images x ( x ) →, then images σ( x ) \= images x .1—that is, χ images

and

if images x ( x ) ↓, say, at the earliest in y x , steps, then images σ( x ) \= χ{ y x }

Since the canonical index of images is 0, we have

0 = ξ(σ( x )) ≡ x ∈ images

contradicting the non semi-recursiveness of images . So, no such ξ exists. images

We now return to the question that motivated all this discussion. We noted that for any finite set there exists an algorithm, that of p. 202 , that enumerates the set in strict ascending order and once it reaches the maximum element it keeps outputting said element forever.

We claimed that this algorithm’s existence cannot be proved constructively, that is, there is no computable process that constructs said algorithm for the arbitrarily given finite set S .

Indeed, say, S is given by a program ( images -index) for its characteristic function —for a decider. If we can construct its enumerator from this information, then we will obtain knowledge of all the members of S by running the enumerator. From this we can construct the canonical index of S , contradicting the preceding example.

Next, say, S is given as a W x . If we can construct from this information its enumerator, in the form given on p. 202 , then we could also construct it from a program for its characteristic function, since the latter can be algorithmically obtained from x (2.7.4.8) . This cannot be. Trivially, if S is “given– by its canonical index, then the enumerator, a verifier, and a decider for S can be constructed.

Pause. Hmm. In 2.7.3.6 we saw that there is a constructive way, σ , that takes us from W x to a 1-1 images σ( x ) such that W x = ran( images σ( x ) ) and, if images σ( x ) is nontotal, then its domain is { i : i < n }, for some n . So, why not use this images σ( x ) to determine the elements

images σ( x ) (0), ..., images σ( x ) ( n – 1)

of the finite set W x —if indeed it is finite? images