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
-derivation (cf. 2.3.0.11 ). Thus proving that such and such a problem x
A does not have an “algorithmic solution”, or is not even verifiable, becomes mathematically precise: We need to show that A
* or A
* , 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 !
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).
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
. 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
* .
Proof. We will argue by contradiction, so we assume that K
* , that is, the relation
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
i , for all i .
We proceed as in 1.3.0.53 to utilize the main diagonal
0 (0),
1 , … ,
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:
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:
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
is closed under definition by cases ( Exercise 2.12.28 ), and since by assumption both
x ( x ) ↓ and
x ( x ) ↑ are recursive,
Pause. Why “both”?
it follows that d
, i.e., d =
i for some i —i.e., d must be some row in the above matrix. We have a contradiction.
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
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 ).
Worth repeating. We chose d so that at input x it differs from
x ( x ), and thus it differs from
x ; full stop. We have cancelled x as a possible
-index of d (cf. 1.3.0.51 ).
Given that we have done this for all x , we have cancelled all possible
-indices of d. Thus d is not computable. Since our assumption about
x ( x ) ↓ also forced d to be computable, we managed to reject said assumption as it forced a contradiction.
A version of unbounded search is the following:
2.7.1.2 Definition . (Alternate Unbounded Search Operator) For any total function λ y
. g ( y ,
) the expression (
y ) g ( y ,
) stands for
It is immediate that ( μy ) (2.1.1.18) and (
y ) coincide on total functions since—in g ( y ,
) = 0 ∧ (∀ z ) < y ( g ( z ,
↓)—the subformula (∀ z ) < y ( g ( z ,
) ↓) is true for such g and therefore its presence or absence in the formula is immaterial.
2.7.1.3 Definition. We say that a class of number-theoretic functions
is closed under (
y ) just in case for every total g in the class, λ
.(
y ) g ( y ,
)—which may fail to be total—is in the class.
2.7.1.4 Theorem.
is closed under (
y ).
Proof . By the preceding
-remark, if g
, then, for all
, (
y ) g ( y ,
) ≃ ( μy ) g ( y ,
), thus λ
.(
y ) g ( y ,
)
.
2.7.1.5 Corollary. In 2.3.0.11 we may replace μ by
.
Proof . We reuse the proof of 2.3.0.11 by simply replacing
by
= Cl(
, {composition, primitive recursion,
}), throughout. In the forward part we use 2.7.1.4 . In the part of said proof that begins by “Conversely”, we replace μ , by
.
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 (
y ) apply on total functions makes it a semantic rather than a syntactic operator: As we have seen, the problem of whether
is in
or not is undecidable, indeed not even c.e.
Thus, given i we cannot know whether writing (
y )
( n +1) ( y ,
n ) makes sense or not : For we cannot decide , as Definition 2.7.1.2 requires, whether
is total.
Pause. Hmm. Why can’t we stop worrying about totalness and just allow —in defiance of Definition 2.7.1.2 —(
y ) to apply to all partial functions, including nontotal ones?
Well, a first approximation objection to the suggestion of defiance is that while ( μy ) g ( y ,
) is correctly computed by the pseudo program below (cf. 2.1.1.17 )
y ← 0
while
¬ g ( y ,
) = 0
y ← y + 1
end
the same program does not compute (
y ) g ( y ,
).
For the sake of argument, say, for a given
, we have g (0,
) ↑, but g (1,
) = 0.
If so, the above pseudo program correctly computes ( μy ) g ( y ,
) since the definition requires —for convergence—that (∀ z < 1) g ( z ,
) ↓.
This is not the case for (
y ) g ( y ,
), which ought to return min{ y : g ( y ,
) = 0} = 1 (overlooking the nontotal-ness of g ) but the program above loops forever, since the call to g (0,
) does.
But wait! What if there is a really clever alternative program that computes correctly min{ y : g ( y ,
) = 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 .
( x , y ), for which λ x .(
y )
( x , y )
!
2.7.1.6 Theorem. There is a nontotal λ xy .
( x , y )
such that λ x .(
y )
( x , y )
.
Proof. The proof just firms up the “what if” discussion above that cast some initial doubt on the appropriateness of applying (
y ) to nontotal functions. So let us define
by
Given that the predicate
x ( x ) ↓ is semi-recursive ( 2.5.0.15 ), closure properties of
* 2.5.0.18 ) establish the top condition in the definition of
as semi-recursive. By definition by positive cases we have that
.
Let us evaluate
There are just two possible output values: The search returns 0 if
x ( x ) ↓, while it returns 1 if
x ( x ) ↑. Thus λ x .(
y )
( x , y ) is χ K and therefore is not in
).
Incidentally, note that χ K , being a characteristic function, it is total, even though
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 .
i ( x ) = y is not in
* .
Proof. If the stated predicate is in
* then so is λ x .
x ( x ) = y by closure properties. We will use a straightforward diagonalization to see that the latter cannot be.
Define the new diagonal so that it differs from the one above at every place.
Thus, d is not a row above. On the other hand, since we assumed that λ x .
x ( x ) = y is recursive, we have that d
(it is total) hence d =
i for some i and hence must be a row. A contradiction.
2.7.1.8 Corollary. λ ixy .
i ( x ) = y is not in
* .
Proof. Otherwise we would contradict the preceding proposition [ 2.1.2.6 (ii)].
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
such that , for any i , if f =
i , then g ( x ) < Φ i ( x ) for all x ≥ i .
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 .
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
-indices i that satisfy
i ≤ x and Φ i ( x ) ≤ g ( x )
are cancelled.
Let us thus set
Given that Φ i ( x ) ≤ y is recursive (cf. p. 169 ), so is Φ i ( x ) ≤ g ( x ) since g
, and thus we have that λ ix . i
I ( x ) is recursive. So is the predicate I ( x ) ≠
, being equivalent to (∀ i ) ≤ x ¬Φ i ( x ) ≤ g ( x ). We define f , for all x , as follows:
It is clear that f
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 :
By 2.1.2.9 and the earlier remark on i
I ( x ) we have that h
. Since whenever i
I ( x ) holds we have
i ( x ) ↓ (why?), it follows that h
. Thus the totalness of f is established as soon as we rewrite (3) as
We finally turn to establish property (2) for f. Let then f =
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
I ( x ) holds and therefore f ( x ) = 1 + … +
k ( x ) + … >
k ( x ). A contradiction.
The reader will note that the claim that we “can construct” an f with the stated properties is apt.
2.7.1.10 Corollary. There is no λ x.g ( x )
such that every recursive
i is expressed as
i = λ x.d ((μ y ) ≤ g ( x ) T ( i, x, y )).
Proof. See Exercise 2.12.41.
The corollary says that there is no upper bound on the complexities of the recursive functions.
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
such that, for any i, if f =
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
i —for the i we want to cancel—and then adding 1 on top of that will not work. We define instead as follows:
Let us leave for last the rather dull verification that (1) can be made mathematically precise toward showing that f
. 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 =
r , for some r, and let us argue by contradiction.
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
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 ∸
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 :
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
z from 2.4.4.1. The function c is given by a primitive recursion.
λ yx.y
I ( x ) being in
* , we conclude that c
. We return to f :
Since λ xy .
x ( y )
and by Exercise 2.12.28 , f
. It is also defined on any x since the index of
is in I ( x ).
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
* ? Yes (cf. Exercise 5.3.32).
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
) 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
A iff f ( x )
B . We say that f effects the reducibility .
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
A iff f ( x )
B says that if we know how to decide z
B and also know how to compute f ( x ) for all x, then we know how to decide x
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 )
B }. That is, iff A = f ← ( B ).
2.7.2.3 Proposition. Suppose that A ≤ m B . Then
(1) A is recursive if B is. Contrapositively, B
* if A
* .
(2) A is semi-computable if B is. Contrapositively, B is not c.e. if A is not c.e.
Proof
(1) If z
B is recursive, then so is f ( x )
B by the assumption on f and by 2.1.2.24.
(2) If z
B is semi-recursive, then so is f ( x )
B by the assumption on f and by 2.5.0.20.
2.7.2.4 Definition. (Complete Index Sets) Given a subset
⊆
, we call { x :
x
} a complete index set (defined by
).
2.7.2.5 Remark. That is, a complete index set A = { x :
x
} is the set of all (codes of) URM programs that compute the functions of some given subset
of
. Indeed say f
. As this is computable, take any program i for f, that is, f =
i . Now
i
yields i
A by the definition of A .
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:
=
or
=
.
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 :
x
}, for some
⊆
, is not recursive.
Equipped with 2.7.2.3 we attempt to show either K ≤ m A or
≤ 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
that effects one of K ≤ m A or
≤ 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 :
Thus, h ( x )
A if the top case holds, iff x
K —that is,
x ( x ) ↓. For short, K ≤ m A via h .
Case of
≤ m A :
Thus, h ( x )
A if the top case holds, iff x
— that is,
x ( x ) ↑. For short,
≤ m A via h .
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 :
x is a constant function }.
(2) B = { x :
x is total } = { x :
x
}
(3) C = {〈 x,y 〉 : y
ran(
x )}
(4) D = {〈 x,y, 〉 : z =
x ( y )}
(5) E = { x : dom(
x ) =
}
(6) F = { x : dom(
x ) is infinite }
(7) G = { x : dom(
x ) is infinite}
(8) H = { x : ran(
x ) =
}
(9) I = { x : ran(
x ) is finite}
(10) J = { x : ran(
x ) is infinite }
Proof .
(1) A = { x :
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
such that
Well, the simplest solution is probably this: Define, for all x and y
We see first at the intuitive level that
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
( 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
so that, say, it yields 42 in the bottom case renders
non computable (i.e., not in
)?
Mathematically,
via definition by positive cases (2.5.0.30). Of course, “
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.
By the S-m-n theorem, there is an h
such that, for all x and y ,
This can be rewritten as (note the change from ≃ to =)
where
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 :
x is total} = :
x
}.
Note that (* * *) can be recast as
Thus, K ≤ m B and therefore B
* as in 2.7.2.6.
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 .
(3) C = {〈 x, y 〉) : y
ran(
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
ran(
h ( x ) )} (by 2.1.2.6 )—where h is the same as above.
But 0
ran(
h ( x ) ) can happen iff we are in the top case of (* * *), which is in the case x
K. Thus K ≤ m C 0 via h .
(4) D = {〈 x,y,z 〉 : z =
x ( y )}.
If D is recursive, then so is D 0 = { x : 0 =
h ( x ) (0)}. The latter is equivalent to x
K as above and we conclude exactly as in the case of C above: K ≤ m D 0 .
(5) E = { x : dom(
x ) =
}.
We can still mine diverse unsolvability results from the very same setup (* * *) above. We rewrite this as
Thus, as in 2.7.2.6 , h ( x )
E iff we are in the bottom case; iff x
. That is,
≤ 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(
x ) is finite}.
We rewrite (* * *) as
Thus, h ( x )
F iff we are in the bottom case; iff x
. That is
≤ m F via h . Once again we have proved more than we were asked to: F is not semi-recursive.
(7) G = { x : dom(
x ) is infinite}.
Yet again, we rely on (* * *). Indeed, see the argument for F above. We have that h ( x )
G iff we are in the top case; iff x
K . That is, K ≤ m G via h and thus G is not recursive.
(8) H = { x : ran(
x ) =
}.
One last time we mine (* * *), rewriting it as
Thus, h ( x )
H iff we are in the bottom case; iff x
. Thus
≤ m H and H is not semi-recursive.
(9) I = { x : ran(
x ) is finite}.
This case needs a fresh start, since neither λ y .0 nor
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
χ 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
x ( x ) ↓ is c.e. Thus it is in
. The S-m-n theorem allows the existence of a k
, such that, for all x and y ,
Put more conveniently, with no reference to inputs,
Note that k ( x )
I iff we are in the bottom case of (‡); iff x
. Thus
≤ m I via k , rendering I non c.e., which says more than what we set out to prove.
(10) J = { x : ran(
x ) is infinite}.
We reuse (‡). Here k ( x )
J iff we are in the top case of (‡); iff x
K. Thus K ≤ m J via k , rendering x
J undecidable.
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 .
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
ran(
x ) ≡ (∃ z )
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 :
x is a constant function}.
The obvious approach, that is, badly imitating 2.7.2.6 and modifying (*) to read
will not work. The intuitive reason is that if we try to compute this new
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
x ( x ) ↑.
Otherwise (
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
x ( x ) ↑.
The definitive reason that this
is not computable is this: If it were, then so would be λ. x .
( x, x ). But the domain of the latter is
. 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
) enough?
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
.
Why can it not be the case that a future programmer might come up with a really clever and non obvious URM that computes
?
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
such that
In view of the above remarks, we cannot use the condition “
x ( x ) ↑” outright as the top condition, so we will approximate it with “
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
x ( x ), which is still going, as divergent.
So we finally define
This
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
where Z = λ. y .0. Since the conditions are recursive (cf. p. 169 ), we have, by Exercise 2.12.28 , that
. 91
By the S-m-n theorem, we have a primitive recursive σ such that, for all x and y ,
Let us now consider the two cases below:
Case 1:
x ( x ) ↑. Then ¬Φ x ( x ) ≤ y is true; for this x and all y , the top case applies. That is:
Case 2:
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
where in ( v ) we have denoted the finite function
f ( y ) = if x = 0 ∨ x = 1 ∨ … ∨ x = y 0 − 1 then 0 else
( y )
as the finite sequence of its outputs. Of course, f
.
We summarize what cases 1 and 2 say in ( iν ) and (ν):
Given that the function in the bottom case is not a constant function, we immediately have σ( x )
A iff x
, or
≤ m A as needed.
(2) B = { x :
x is total} = { x :
x
}.
We may reuse (†) immediately above, since the top case is total while the bottom case is nontotal. Thus, σ( x )
B iff x
, or
≤ m B as needed.
(3) G = { x : dom(
x ) is infinite}.
We may reuse (†) since the top case has infinite domain while the bottom case has finite domain. Thus, σ( x )
G iff x
, or
≤ m G as needed.
(4) J = { x : ran(
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 ,
As χ is defined from partial recursive functions by recursive cases, it is in
. By S-m-n we have a primitive recursive
such that, for all x, y ,
A similar analysis as above shows readily that
If
x ( x ) ↑, then
( x ) = λ. y.y , while if
x ( x ) ↓, then
( x ) =
0, 1, …, y 0 − 1
a finite function displayed as a sequence of outputs, where y 0 is smallest y such that Φ x ( x ) ≤ y .
Thus,
and therefore
( x )
J if x
, or
≤ m J as needed.
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 :
x
}—where
⊆
. If some f
has an extension g
—
, then
≤ m A .
Proof . Let
m
and
n ∉
, where
m ⊆
n . 92 The plan is to prove that a primitive recursive h exists such that
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
x ( x ) ↑.
Is χ computable? Intuitively, it is. Here is how: Let H be a URM for verifying
x ( x ) ↓, M a URM that computes
m , and N a URM for
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
m ( y ) and stop everything.
Worth noting. If each of H and M loops for ever, then the top condition is valid; we correctly output
m ( y ) in this case (we “output” ↑—that is, nothing).
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
n ( y ).
The mathematical reason for the computability of χ is based on the above informal description.
The content of the above
-comment is the “otherwise”; thus we achieve a definition by positive cases:
Since the above is a definition by positive cases—recall that Φ i ( x ) = w , Φ i ( x ) < w , and Φ i ( x ) ≤ w are (primitive) recursive—χ′
.
Pause. But is χ = χ′?
Yes. The top condition for χ′ says “
x ( x ) does not converge before
m ( y ) does”—this is the case of
m ( y ) ↓, where
x ( x ) may or may not converge. The case of
m ( y ) ↑ and
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 “
x ( x ) converges before
m ( y ) does”.
By the S-m-n theorem there is an h
, such that, for all x and y ,
We can now verify that we have (1) above.
Let
x ( x ) ↑. Then Φ x ( x ) ≤ z is false for all z , hence the middle case cannot apply.
(a) If we have
m ( y ) ↓, then (∃ z )Φ m ( y ) = z , thus the top condition is true and
h ( x ) ( y ) =
m ( y ).
(b) If we have
m ( y ) ↑, then Φ m ( y ) ≤ z is false for all z , thus only the “otherwise” applies. We have, once more
h ( x ) ( y ) ≃
m ( y ) (note the “≃”).
For short,
h ( x ) \=
m in this case .
Let
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
h ( x ) ( y ) ≃. But
m ( y ) ↓ (why?), thus, by
m ⊆
n , we have
m ( y ) =
n ( y ) (note the “=”).
Therefore
h ( x ) ( y ) =
n ( y ) 93 .
(ii) If ¬ Φ m ( y ) ≤ z , then the middle case holds, and again
h ( x ) ( y ) ( y ) (“≃” this time is essential, as it may be that
n ( y ) ↑.)
For short ,
h ( x ) \=
n in this case .
This establishes (1), and hence the equivalences h ( x )
A iff
h ( x )
iff
h ( x ) \=
m iff x
. That is,
≤ m A via h .
2.7.2.10 Corollary. Given a complete index set A = { x :
x
}—where
⊆
. If some f
has an extension g
–
, then A is not c.e .
2.7.2.11 Corollary. (The Theorem of Rice) A compete index set A = { x :
x
} is recursive iff it is trivial, meaning that either A =
or A =
.
Proof The if part is immediate since, in fact,
and
are primitive recursive.
As for the only if say A is recursive. Then A and
– A (or
), that is,
{ x :
x
P –
}
are both c.e.
We consider two cases. First, let
94
. Since A is semi-recursive, 2.7.2.10 yields that every computable extension of
is in
. Thus
=
and hence A =
.
Second, let
P –
. As above, since
– A is c.e., 2.7.2.10 yields that every computable extension of
is in P –
. That is, P –
= P and hence
– A =
. Therefore, A =
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
is not equal to either
or
, 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,
≠ A ≠
.
Similarly one shows all of E–J to be nontrivial.
The sets
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 ).
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(
x ) is finite}, let us set
= { f
P : dom( f ) is finite}. Thus F = { x :
x
}. And this is a complete index set in the format defined in 2.7.2.4.
2.7.2.14 Example. We have seen already that every computable function has infinitely many
-indices by arguing the case via URM programs. Here is a “high level” approach: Let f
. Then
≠ { x :
x = f }
. By Rice’s theorem, { x :
x = f is not recursive, hence must be infinite (every finite set is primitive recursive).
2.7.2.15 Example. But how about K ? Is K = { x :
x ( x ) ↓} a complete index set? That is, is there a
⊆
such that K = { x :
x
}? We will answer this negatively in Section 2.9 .
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(
x ) =
}. For convenience let us set
Note that dom(
) =
. However, λ. x .0 extends
but is not in
—its domain is
. By 2.7.2.10 , E is not c.e.
A similar argument holds for F , since
has a finite domain hence is in F ’s implied “
” . Any constant function extends
but is not in this “
” . 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
that lies outside the “
” 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.
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.
2.7.2.18 Theorem. Given A = { x :
x
}, where
⊆
. Suppose that some f
has no finite subfunction ξ— i.e. , ξ ⊆ f — that is a member of
. Then
≤ m A .
Proof The idea is to find, using the S-m-n theorem, an h
. such that
If this succeeds, then h ( x )
A iff
h ( x )
iff
h ( x ) \= f iff x
. Thus,
≤ 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,
This is a definition by recursive cases, thus χ
. By the S-m-n theorem we have an h
, such that
Let us now consider the two cases:
(a)
x ( x ) ↑. Then the top condition of (2) is true for all y , thus
h ( x ) \= f in this case.
(b)
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
h ( x ) ( y ) ≃ f ( y ), but
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,
h ( x ) \= ξ (⊆ f ) in this case, for y 0 > 0.
If y 0 = 0, then the bottom condition holds for all y , thus
h ( x ) \=
. But
⊆ f .
We have verified (1).
2.7.2.19 Corollary. Let the complete index set A = { x :
x
} be c.e. Then f
iff some finite subfunction off is in
.
Proof. The only if is by 2.7.2.18 , for otherwise
≤ m s A , contradicting the assumption. The if is by 2.7.2.9 , for if
∋ ξ ⊆ f , then f
.
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
-sets in each of the index sets A and B contain total functions only. Thus no f in such a
can have a finite (nontotal!) subfunction also in
. By 2.7.2.19 , neither A nor B can be c.e.
Similarly, the respective
-sets in each of the index sets G and J contain functions with infinite domains only. Thus no f in such a
can have a finite subfunction also in
. Again, by 2.7.2.19 , neither G nor J can be c.e.
2.7.2.21 Remark. A variant of a complete index set has this form
where
* ⊆
* . That indeed this is only a variant of the notation { x :
x
} is immediate from (cf. 2.5.0.3 )
Thus, setting
= { f
: dom( f )
* }, we may rewrite (1) as
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
* }— where
* ⊆
* . If some S
* satisfies S ⊆ T, where T
* –
* , then
≤ m A .
Proof . Following the notational translations of 2.7.2.21 , we write
= { f
: dom( f )
* }. So,
Let S and T be as given. Thus, for some f
, S = dom( f ). The function g = λ x .1 ∸ (1 ∸ f ( x )) satisfies S = dom( g ) as well. Let T = dom( h ) with h
and ran( h ) = {0} [if necessary, we use λ x .1 ∸ (1 ∸ h ( x )) instead].
Notice that g
, g ⊆ h , and h
. 95 By 2.7.2.9 ,
≤ m A .
2.7.2.23 Theorem. (Rice’s Theorem— W -Version) A compete index set A = { x : W x
* } is recursive iff it is trivial, meaning that either A =
or A =
.
Proof . This can be proved by invoking 2.7.2.11 after we translate the W i -notation into
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
be c.e.
Case where
* . Then S
* for every c.e. subset of
by
⊆ S . It follows that
* =
* , i.e., A =
.
Case where
* . We work with the c.e. set
= { x : W x
* −
* }. As above, S
* −
* for every c.e. subset of
. Thus,
* −
* =
* , i.e., A =
.
2.7.2.24 Theorem. Given A = { x : W x
* }, where
* ⊆
* . Suppose that some S
* has no finite subset D that is a member of
* . Then
≤ 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
= { f
: dom( f )
* }. So,
Let S be as given. Thus, for some f
* , S = dom( f ). As before, we may assume that ran( f ) = {0}. If we had a finite ξ ⊆ f as a member of
, then it would be that
(a) dom(ξ) is a finite set D
* —by the translation—and
(b) D ⊆ S .
(a) and (b) contradict the hypothesis. Thus, no such ξ exists, and thus
≤ m A by 2.7.2.18 .
2.7.2.25 Example. { x : W x \=
} is not c.e. by 2.7.2.22 . Indeed,
* = {
}. But
⊆
, yet
{
}. { x : W x is infinite} is not c.e. by 2.7.2.22 . Indeed, the
* -set here is the set of all infinite members of
* . This
* fails to contain any finite subset of any set that it contains. We are led to
≤ m { x : W x is infinite} by 2.7.2.24 .
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
n , such that
The idea is that, for each x for which M halts—that is, x
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(
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 ,
is trivially partial recursive, hence (by S-m-n) there is a primitive recursive h such that
By 2.5.0.28 , ran(
h ( x ) ) = W x .
Pause. Can we ensure that whenever W x ≠
we obtain a total
h ( x ) ?
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 ≠
iff g ( x )↓
(ii) If W x ≠
, then g ( x )
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
For (i), let W x ≠
. Thus (∃ y , w ) T ( x, y, w ) is true and the search in (1) succeeds. Conversely, if the search succeeds, then ( z ) 0
W x . For (ii), the successful search yields a ( z ) 0
W x . But g ( x ) = ( z ) 0 .
The selection theorem is a computable version of the axiom of choice . The axiom of choice postulates that if { S a : a
I } is an indexed collection of sets—indexed by I —then there is an f such that S a ≠
implies f ( a )
S a .
Our “ g ” does just that for the collection { W x : x
}; computably !
2.7.3.3 Corollary. There is a primitive recursive h such that for all x , ran(
h ( x ) ) = W x . Moreover, if W x ≠
, then
h ( x )
.
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,
is trivially partial recursive, hence (by S-m-n) there is a primitive recursive h such that
2.7.3.4 Example. Rogers (1967) offers the following simple proof that obscures the dovetailing at work: Let
Via definition by positive cases,
is partial recursive. Let (by S-m-n) σ —primitive recursive—be such that
σ ( x ) ( z ) ≃
( x , z ), for all x , z . Note that z
ran(
σ ( x ) ) iff
x ( z ) ↓, that is, iff z
W x .
Of course, the definition-by-positive-cases theorem ( 2.5.0.30 ) already includes a dovetailing argument buried in its proof.
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(
m ). How do we construct a URM program N of code n , for
n , that is a verifier for S , in other words,
If
m is total, then all that N need do is this: Given x , N tests “ x
S ?” by
for y = 0, 1, 2, … do
if M on input y outputs x , then halt
For nontotal
m this will fail, since, say, it could be that
m (1) = x while
m (0) ↑. The call to M on input 0 would go forever, never reaching the computation
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(
x ) = W k ( x ) .
Proof . Define, for all x and y ,
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
such that
k ( x ) ( y ) ≃ χ ( x, y ), for all x, y . The definition of χ immediately yields that
k ( x ) ( y ) ↓ iff y
ran(
x ).
2.7.3.6 Corollary. There are σ and
in
such that, for all x ,
(i) W x \= ran(
σ ( x ) ) and, moreover ,
σ ( x ) is 1-1. If it is nontotal, then dom(
σ ( x ) ) = { i
: i < n }, for some n .
(ii) ran(
x ) = ran(
( x ) ) and, moreover ,
( x ) is 1-1. If it is nontotal, then dom(
( x ) ) = { i
: 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
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 ) = [
( i , 0),…,
( i, x )]
In this connection we recall the predicate x
y used in the proof of 2.4.4.1
The S-m-n theorem yields a σ such that
σ ( x ) ( y ) ≃
( x, y ), for all x, y . The claim for dom(
σ ( x ) ) follows from 2.1.2.51 . That W x \= ran(
σ ( x ) ) is immediate.
(ii) By 2.7.3.5 we get an h such that ran(
x ) = W h ( x ) . Applying part (i) we get a σ such that W h ( x ) \= ran(
σ ( h ( x )) ). We set
( x ) = σ ( h ( x )), for all x .
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(
x +
y ). Fix an i such that, for all x, y and z , we have
. By S-m-b,
. Take
.
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
such that W k ( x,i ) \= W i – { x } for all i , x . We do this by noting that W i – { x } = W i ∩ (
– { 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 ′ =
; then remove a′ to obtain W k ( a ′, k ( a,i )) ;
We next let a ″ =
; 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
, since the enumeration will not get stuck until W i is depleted.
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
f ← ( A ) ≡ (∃ y )( f ( x ) = y ∧ y
A ). Thus, by closure properties of
* 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
A using the given program for f and the verifier for “ y
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
(
x ) ← ( W y ) ≡
x ( z )
W y . But
x ( z )
W y ≡
y (
x ( z )) ↓. By S-m-n applied to
= λ xyz .
y (
x ( z )) we have an h
such that
( x, y, z ) ≃
h ( x,y ) ( z ), for all x, y, z . That is, dom(
h ( x,y ) ) = (
x ) ← ( W y ), or W h ( x,y ) \= (
x ) ← ( W y ).
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
A } for c.e. A and partial recursive f . First off, choose a verifier
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
y ( x ) ↓ in w steps; if so, print f ( x ).
Mathematically, let A = dom(
y ) and f =
x . Thus, we can enumerate f → ( A ) by
By S-m-n, there is a σ in
such that for all x, y, u , we have
σ ( x,y ) ( u ) ≃
( x, y, u ). Clearly, ran(
σ ( x,y ) ) = (
x ) → ( W y ).
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 (
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 ,
Then f = λ
n . Sel ( n+1 ) (i,
n ).
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
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 ).
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
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
A ∧ y > h ( x ))
where a is the smallest member of A . Thus, h
, and since the search succeeds for all x , we have h
. It is clear that h is strictly increasing and that ran( h ) ⊆ A . Is it possible that m
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
B .
Let then B be infinite. We need to show that the predicate x
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
This “proves”—modulo rewriting the program as a URM—that B is recursive. We can easily turn the above to a mathematical proof.
x
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 ).
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
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.
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
x is recursive and ran(
x ) is infinite, then
r ( x ) is recursive , ran(
r ( x ) ) is recursive and infinite, and, moreover , ran(
r ( x ) ) ⊆ ran(
x ).
Proof . A straightforward adaptation of the proof above. Define instead
g (0, x ) ≃
x (0)
g ( y + 1, x ) ≃
x (( μz )
x ( z ) > g ( y, x ))
As above, the recursiveness and unboundedness of
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
r ( x ) ( y ) ≃ g ( y, x ).
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 σ
such that ran(
σ ( x ) ) = W x and where W x ≠
implies
σ ( x )
. Now apply Corollary 2.7.4.5 to obtain
r ( σ ( x )) . Finally, apply 2.7.3.5 to obtain a primitive recursive h such that W h ( x ) \= ran(
r ( σ ( x )) ).
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.
Pause. But how is a finite set “ given ”?
Well, a recursive set S can be given by a decider for S —that is, an x , such that
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
As (1) is an instance of definition by positive cases,
is computable, so, by S-m-n, let h
be such that
( x, y ) ≃
h ( x ) ( y ) for all x, y . Thus
If now
x = χ S for some S (rendering S recursive), then, by (2), W h ( x ) \= S .
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
such that it satisfies
-
( x ) ↓ iff W x is recursive
and -
in case W x is recursive,
( x ) \= χW x .
The first bullet requires dom(
) = { x : W x
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
exists.
2.7.4.9 Remark. Hmm. What about weakening
so that we allow it to converge as it pleases outside { x : W x
R * }, yielding irrelevant answers? That is, can we have a “new”
of which we only ask:
This is also impossible [Rogers (1967)]. To see this, we go back to Theorem 2.7.2.7 and reuse (* * *) (reproduced below)
from the proof of its item (1), rewriting it in this guise:
Of course, h is primitive recursive. Suppose now that we have this new, weaker
that we are looking for. Then,
(a)
( h ( x )) ↓, for all x , since either way, “top” or “bottom”, W h ( x ) is recursive.
(b) Since ran( χ
) = {0}, we have that 1
ran(
( h ( x ))) iff we have the bottom case in (2).
Thus,
This is untenable, since one side of ≡ is c.e. but the other is not. Indeed, 1
ran(
( h ( x ))) ≡
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
is 0.
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”).
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:
The converse will not work:
2.7.4.12 Example. We cannot (in general) have a computable function
such that if W x is finite, then
( x ) ↓ and
( x ) equals the canonical index of W x , while, if W x is not finite, then
( x ) ↑.
Indeed, if we had such a
, then dom(
) = { 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 ).
2.7.4.13 Example. If a finite set S is given by its characteristic function,
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 :
x ( y ) = 0} is finite, then ξ( x ) ↓ and ξ( x ) equals the canonical index of { y :
x ( y ) = 0}; while, if { y :
x ( y ) = 0} is not finite, then ξ( x ) ↑?
The answer is still negative, for consider the following definition by recursive cases
f ∈
and thus, by S-m-n, we have a σ ∈
, such that
f ( x,y ) =
σ( x ) ( y ), for all x , y
Note that if
( x ) ↑, then the top condition is always true, thus, using sequence notation
that is,
x ∈
implies that
σ( x ) \= χ
(1)
If, on the other hand,
x ( x ) ↓, let y = y x be smallest such that Φ x ( x ) ≤ y . Thus,
Thus,
σ ( 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 ∈
This will not do, since the left hand side is a c.e. relation, while the right hand side is not c.e.
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 :
x ( y ) = 0} is not finite, then we are “informed” of this by “ξ( x ) ↑”. Since we cannot computably know whether { y :
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 :
x ( y ) = 0} is finite, then ξ( x ) ↓ and ξ( x ) equals the canonical index of { y :
x ( y ) = 0}.”
Thus, we are willing to live with a much less informative version of “ξ”, where the statement “{ y :
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 :
x ( y ) = 0} is not finite”.
It turns out that we cannot have this version of ξ either! Indeed, define
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
be such that, for all x and y , we have
σ( x ) ( y ) = g ( x , y ). Thus,
if
x ( x ) →, then
σ( x ) \=
x .1—that is, χ
and
if
x ( x ) ↓, say, at the earliest in y x , steps, then
σ( x ) \= χ{ y x }
Since the canonical index of
is 0, we have
0 = ξ(σ( x )) ≡ x ∈
contradicting the non semi-recursiveness of
. So, no such ξ exists.
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 (
-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
σ( x ) such that W x = ran(
σ( x ) ) and, if
σ( x ) is nontotal, then its domain is { i : i < n }, for some n . So, why not use this
σ( x ) to determine the elements
σ( x ) (0), ...,
σ( x ) ( n – 1)
of the finite set W x —if indeed it is finite?