<<

Introduction

Recall that a predicate function is a function M(x) whose range is {0, 1}. Moreover, predicate M(x) is decidable iff it is total computable. When a predicate function is not computable, then it is called undecidable.

Predicate functions are often associated with properties of natural numbers. For example, consider the property of a natural number being prime. Then we may define that property using the predicate function  1 if x is prime M(x) = 0 otherwise In this case we say that the property of being prime is decidable, since its associated predicate function is decidable. Moreover, since every natural number x is associated with a φx, and a program Px, then we may also discuss whether or not a property of computable functions (respectively, a property of programs) is decidable. For example, one consequence of the existence of universal programs is that the predicate function

 1 if φ is total M(x) = x 0 otherwise is undecidable, and hence the property of a computable function being total is undecidable. In general, a decision problem is any problem that involves deciding if some entity has a given property.

In this lecture we show that many properties of computable functions are undecidable. We also state some problems in other areas of mathematics that have been shown to be undecidable, as well as a few decidable problems that might not seem so obviously decidable. Finally, we define what it means for a predicate function to be partially decidable, and introduce the notions of recursive and recursively enumerable sets.

1 The Self-Defined Property is Undecidable

Program P is said to have the self-defined property iff P (x) is defined, where x is the Godel number of P . A more succinct way of describing this property is that Px has the self-defined property iff x ∈ Wx.

Theorem 1. The self-defined property is undecidable.

Proof 1. Suppose by way of contradiction that the self-defined property is decidable. Then the function  1 if x ∈ W M(x) = x 0 otherwise is total computable. Now define the function g(x) as

 1 if M(x) = 0 g(x) = undefined otherwise

To see that g(x) is computable, consider a description of the a program P for computing g. On input x the program first executes the program PM that computes M(x). If PM (x) = 0, then P returns 1. Otherwise, P enters an infinite loop, so that g(x) is undefined. We leave it as an exercise to provide an abstract URM program that represents P .

Now, since g(x) is computable, there is an index e, such that g(x) = φe(x) for x ∈ N . In particular g(e) = φe(e). Now suppose g(e) is defined. Then φe(e) is defined, meaning that e ∈ We, which implies that M(e) = 1, which in turn (by definition of g) implies that g(e) is undefined, a contradiction. On the other hand, if g(e) is undefined, then φe(e) is undefined, meaning that e 6∈ We, which implies that M(e) = 0, which in turn (by definition of g) implies that g(e) = 1 is defined, a contradiction. Therefore, the self-defined property is undecidable.

Corollary 1. The is the problem of deciding if φx(y) is defined, for given x, y ∈ N . Moreover, the Halting Problem is undecidable.

Proof of Corollary 1. If the Haltng Problem were decidable, say by a total computable predi- cate function M(x, y). Then x ∈ Wx iff φx(x) is defined, iff M(x, x) = 1, which contradicts the undecidability of the self-defined property.

2 The following table suggests that the above proof can be understood as another diagonalization argument. The red values in the table are the outputs being assigned to g based on the values of M(x).

index\input n 0 1 2 ··· e ··· self defined? φ0(n) 2 →↑ 7 4 ··· 18 ··· yes φ1(n) ↑ ↑→ 17 · · · ↑ · · · no φ2(n) 7 5 9 →↑··· 36 ··· yes ...... g(n)= φe(n) ↑ 1 ↑ · · · 1 →↑··· yes/no ...... g(0) =↑, g(1) = 1, g(2) =↑, ..., g(e) =? (1 or ↑?). The original table states that g(e) = 1, but the changing of values along the diagonal in order to define g implies that g is undefined, a contradiction.

3 Using Reducibility to Prove Undecidability

Given a total (not necessarily computable) predicate function M(x) and an integer x, we call x a positive instance of M, iff M(x) = 1. Similarly, x a negative instance iff M(x) = 0. For example, if M(x) is the predicate function for deciding if x is even, then 2 is a positive instance of M, while 3 is a negative instance.

Let M(x) and N(x) be two total but not necessarily computable predicate functions. We say that M is many-to-one reducible (also referred to as functional reducible) to N, written as M ≤m N, iff there exists a total computable function f(x) for which M(x) = N(f(x)).

Example 1. If M(x) is the predicate function for deciding if x is even, and N(x) is the predicate function for deciding if x is odd, then M ≤m N via the function f(x) = x + 1. In other words, M(x) = N(f(x)) = N(x + 1).

The following theorem shows how to use functional reducibility to establish both decidability and undecidability.

Theorem 2. Given predicate functions M(x) and N(x) with M ≤m N, if N is decidable then so is M. Contrapositively, if M is undecidable, then so is N.

Proof Theorem 2. Suppose N is decidable and M ≤m N via total computable reducing function f(x). Then N(f(x)) is total computable, since both N and f are total computable. Therefore, since M(x) = N(f(x)), it follows that M is also total computable, and hence decidable.

Theorem 1 may be used to show the undecidability of a predicate function by functionally reducing a known undecidable predicate function to the predicate function in question. Moreover, the s-m-n theorem can prove very useful for finding the necessary reducing function.

4 Example 2. We use Theorem 1 and the s-m-n theorem to prove that the “zero property”, namely “φx(y) equals the zero function” is undecidable. To do this we define the function

 0 if x ∈ W g(x, y) = x undefined otherwise

Then by the s-m-n theorem there is a total computable function f(x) for which φf(x) = g(x, y) for all x ∈ N . Moreover, x ∈ Wx iff φf(x)(y) = 0 forall y, meaning that x has the self-defined property iff f(x) has the zero property. Therefore, since the self-defined property is undecidable, then so is the zero property.

5 Example 3. Consider the predicate function E(z) which evaluates to 1 iff φπ1(z) = φπ2(z). Prove that E is undecidable by reducing SD to E.

6 Rice’s Theorem. Let C1 denote the set of unary computable functions, and B be a nonempty proper of C1. Then the predicate function

 1 if φ ∈ B B(x) = x 0 otherwise is undecidable.

Proof of Rice’s Theorem. Let f∅ denote the computable function that is nowhere defined. Without loss of generality, assume f∅ 6∈ B. Let g(y) ∈ B be fixed, and consider the function

 g(y) if x ∈ W h(x, y) = x undefined otherwise

Then h is certainly computable, since one first computes ψU (x, x) and, assuming it is defined, then computes g(y). Therefore, by the s-m-n theorem, there exists a total computable function k(x) for which φk(x)(y) = g(y) if x ∈ Wx, and φk(x)(y) = f∅ otherwise. Therefore, we have x ∈ Wx iff B(k(x)), showing that the self-defined property is many-to-one reducible to B. Therefore, since the self-defined property is undecidable, then so is B.

7 Partially Decidable Predicates

A predicate function P (x) is partially decidable iff there is a computable function f, such that

 1 if P (x) = 1 f(x) = undefined otherwise

Theorem 3. P is a partially-decidable predicate function iff there exists a decidable predicate function (x, y) for which P (x) = 1 iff ∃yR(x, y) is true.

Theorem 3. First suppose P is partially decidable. Then by definition there is an index e for which φe(x) = 1 if P (x) = 1, and is undefined otherwise. Moreover, recall that there is a primitve-recursive decidable predicate s(e, x, 1, t) that evaluates to 1 iff φe(x) ↓ 1 in t or fewer steps. Therefore, P (x) = 1 iff ∃ys(e, x, 1, y). Therefore, we may define R(x, y) = s(e, x, 1, y), which is decidable.

Conversely, suppose there exists a decidable predicate R(x, y) for which P (x) = 1 iff ∃yR(x, y) is true. Then letting f(x) = sgn(µy(R(x, y) = 0) + 1), it follows that P (x) = 1 iff f(x) = 1, and that P (x) is undefined iff f(x) is undefined. Therefore, P is partially decidable.

A subset W ⊆ N is said to be recursive iff there is a decidable predicate M(x) for which x ∈ W iff M(x) = 1. Similary, W is recursively enumerable (r.e.) iff there is a partially decidable predicate M(x) for which x ∈ W iff M(x) = 1.

The proof of the following theorem is left as an exercise.

Theorem 4. W is recursively enumerable iff there exists an effective procedure for printing all elements of W . More formally, W is recursively enumerable iff W = Ex is equal to the range of some total computable function φx.

Theorem 5. W is recursive iff both W and W are recursively enumerable.

Proof of Theorem 5. First suppose W is recursive via decidable predicate M(x). Then W is certainly r.e., since every decidable predicate is also partially decidable. Moreover, since ¬M(x) is also decidable, it follows that W is recursive, and hence r.e..

Conversely, suppose W and W are both r.e. via partially decidable predicates P (x) and Q(x). Now consider the predicate function M(x) that is defined as follows.

 1 if P (x) = 1 M(x) = 0 if Q(x) = 1 Since P and Q are computable, then so is M. Moreover, M is total since, for any x, either x ∈ W

8 or x ∈ W , in which case either P (x) = 1 is defined, or Q(x) = 1 is defined.

Recall primitive recursive s(e, x, y, t) which evaluates to 1 iff Pe(x) ↓ y in t or fewer steps. Letting p be an index for P , and q an index for Q, then the following is an informal program for computing P (x).

For t = 1, 2,...

If s(p, x, 1, t) = 1, then return 1. If s(q, x, 1, t) = 1, then return 0.

Since there is a t for which either s(p, x, 1, t) = 1, or s(q, x, 1, t) = 1, it follows that M is total computable.

9 Exercises

1. Provide an abstract representation of program P described in the proof of Theorem 1.

2. Program Px has the self-output property iff x ∈ Ex. Use a diagonalization argument that shows the self-output property is undecidable.

3. Repeat the previous exercise, but now reduce the self-defined property to the self-output prop- erty.

4. Recall that the property of “φx is total” is undecidable. Reduce this property to the predicate

function EQD(z) which equals 1 iff Wπ1(z) = Wπ2(z). Conclude that the latter property is undecidable.

5. Use any method to prove the undecidability of the problem of determining if Ex is infinite.

6. Prove that determining if Ex 6= ∅ is partially decidable. 7. If predicates M(x) and N(x) are partially decidable, then show that M(x) ∧ N(x) and M(x) ∨ N(x) are partially decidable, but that it is possible for ¬M(x) to be partially decidable.

8. Prove that a finite set W = {w1, . . . , wn} ⊆ N is recursive. 9. Prove Theorem 4.

10. Prove that A is recursive iff there is an that prints A in strictly increasing order.

10 Exercise Solutions

1. The following is an abstract URM program for the program described in the proof of Theorem 1.

PM //Instructions for URM program PM which has s instructions s + 1 : Z(2) s + 2 : J(1, 2, s + 4) s + 3: J(1, 1, s + 3) //Loop forever s + 4 : S(1) //Return 1

2. Suppose by way of contradiction that the self-output property is decidable. Then the function

 1 if x ∈ E M(x) = x 0 otherwise

is total computable. Now define the function g(x) as

 x if M(x) = 0 g(x) = undefined otherwise

Similar to Theorem 1, g(x) is computable. Now, since g(x) is computable, there is an index e, such that g(x) = φe(x) for all x ∈ N . In particular g(e) = φe(e). Now suppose g(e) is defined. Then M(e) = 0, by definition of g. But this implies that e 6∈ Ee, which contradicts the fact that g(e) = e in case g is defined. Similarly, if g(e) is undefined, then M(e) = 1, meaning that e ∈ Ee, which can only happen if g(e) = e, a contradiction. Therefore, M is not total computable and so the self-output property is undecidable.

3. Let M(x) be the predicate for the self-defined property, while N(x) is the predicate for the self-output property. We show M ≤m N, which implies by Theorem 2 that N is undecidable. Since we desire a many-to-one , we must define a total computable function f for which M(x) = N(f(x)) for all x ∈ N . To define such f, we’ll need the s-m-n theorem. But to use the s-m-n theorem, we’ll in turn need to define a computable g(x, y) that somehow relates M(x) to N(x). Then define g as

 y if x ∈ W g(x, y) = x undefined otherwise

Then by the s-m-n theorem, there is total computable f(x) for which, for any given x, φf(x)(y) = g(x, y). Now, for given x suppose M(x) = 1, This implies x ∈ Wx, which in turn implies φf(x)(y) = y for all y. Thus, Ef(x) = N , which in turn implies that f(x) ∈ Ef(x). Thus N(f(x)) = 1. Similarly, suppose M(x) = 0, This implies x 6∈ Wx, which in turn implies φf(x)(y) is undefined for all y. Thus, Ef(x) = ∅, which in turn implies that f(x) 6∈ Ef(x). Thus N(f(x)) = 0. Therefore, M ≤m N, and N is undecidable. 4. Let T (x) be the predicate function for the “total property”, while EQD(z) is the predicate

function that equals 1 when Wπ1(z) = Wπ2(z). Let e be an index for which φe(y) is a total

11 function. It then follows that We = N , Consider the total computable function f(x) = π(x, e). Now let x be arbitrary. If T (x) = 1, then φx is total, meaning that Wx = N = We, i.e.

EQD(f(x)) = EQD(π(x, e)) = 1,

since Wx = We. Similarly, if T (x) = 0, then φx is not total, meaning that Wx 6= N = We, i.e. EQD(f(x)) = EQD(π(x, e)) = 0. Therefore, T ≤m EQD via reducing function f. 5. Let B denote all those unary computable functions that have infinite range. Notice that ∅ 6= B ⊂ C1. Moreover, f∅ 6∈ B, which was one of the conditions assumed in the proof of Rice’s theorem. Similarly, let B(x) evaluate to 1 iff Ex is infinite. Therefore, by Rice’s theorem, B(x) is undecidable.

6. We describe a computable function f(x) for which f(x) = 1 in case Ex 6= ∅, and f(x) is unde- fined otherwise. Recall from the Universal Programs lecture the primitive recursive s(x, y, z, t) which evaluates to 1 iff Px(y) ↓ z in t or fewer steps. Similarly, one can define the primitive recursive function u(x, y, t) as eqaul to 1 iff Px(y) ↓ in t or fewer steps. Then the following function computes f(x). The idea is to let variable i enocde two different values: (i)1 provides a a limit on y, while (i)2 provides a limit on the number of steps to which Px(y) can be simulated.

Input x. For i = 0, 1, 2,...

y ← (i)1.

t ← (i)2. For j = 0, 1, . . . , y If u(x, j, t) = 1, then return 1.

Given x first suppose that Ex 6= ∅, then there must exist a y, for which φx(y) is defined, and a t for which Px(y) halts in fewer than t steps. Then letting i be such that y = (i)1 and t = (i)2, we see that the above program returns 1 on iteration i. Similarly, if Ex = ∅, then φx(y) is undefined for every y ∈ N . Therefore, for all i = 0, 1 ..., we have u(x, (i)1, (i)2) = 0, and so the program never terminates.

7. Suppose predicates M(x) and N(x) are partially decidable. Then there are computable func- tions f and g such that

 1 if M(x) = 1 f(x) = undefined otherwise

and

 1 if N(x) = 1 g(x) = undefined otherwise

From these functions we have

 1 if M(x) ∨ N(x) = 1 sgn(f(x) + g(x)) = undefined otherwise

12 and

 1 if M(x) ∧ N(x) = 1 sgn(f(x) · g(x)) = undefined otherwise Moreover, since sgn, f, g, +, and × are all computable, it follows that sgn(f(x) + g(x)) and sgn(f(x) · g(x)) are both computable, which implies both M(x) ∨ N(x) and M(x) ∧ N(x) are partially decidable. However, consider the predicate function M(x) for the “self-defined property”. M(x) is partially decidable, since we can compute a function f(x) for which f(x) = 1 if the simulation of program Px on input x halts. Otherwise, f(x) is undefined, since the simulation of Px(x) will run forever. Moreover, if ¬M(x) were also partially decidable, then, by definition, both {x|M(x) = 1} and {x|M(x) = 0} are recursively enumerable. But by Theorem 5, this implies that {x|M(x) = 1} is recursive, and hence M(x) is decidable, a contradiction. Therefore, the negation of a partially- decidable predicate is not always partially decidable.

8. Given the finite set A = {x1, . . . , xn} of nonnegative integers, the primitive-recursive predicate

(x = x1) ∨ · · · ∨ (x = xn)

can be used to decide membership in A. Therefore, A is recursive.

9. First suppose W is recursively enumerable. Then there is a partially decidable predicate M(x) for which x ∈ W iff M(x) = 1. Moreover, since M is partially decidable, there is a computable function f such that

 1 if M(x) = 1 f(x) = undefined otherwise

Let e be the Godel number of a program that computes f. Recall from the Universal Programs lecture the primitive recursive s(e, y, 1, t) which evaluates to 1 iff Pe(y) ↓ 1 in t or fewer steps. Then the following program has the effect of printing all elements of W .

For i = 0, 1, 2,... For j = 0, 1, . . . , i If s(e, j, 1, i) = 1, then print j.

For each value of i, the above program performs i steps of Pe(j), for each j = 0, 1, . . . i, in order to compute s(e, j, 1, i). Moreover, in case s(e, j, 1, i) = 1, j is printed, and we know that f(j) = 1, in which case j ∈ W . Conversely, if j ∈ W , then there is some t ≥ 0 for which s(e, j, 1, t) = 1, and so j is printed no later than iteration t of the outer loop. Now suppose there is an effective procedure for printing the elements of W . To compute f(x), execute the printing procedure until x has been printed. In this case return 1. If x is never printed, then f(x) is undefined. Therefore, by the Church-Turing thesis, f is computable, which implies M is partially decidable, which in turn implies W is recursively enumerable.

10. Suppose A is recursive. Then there is a decidable predicate M(x) for which M(x) = 1 iff x ∈ A. The following program prints A in increasing order.

13 For i = 0, 1, 2,... If M(i) = 1, then print i.

Now suppose there is an effective procedure for printing the elements of A in increasing order. To compute M(x), execute the printing procedure until a number y is printed that either equals or exceeds x. Then return 1 iff y = x. Therefore, by the Church-Turing thesis, M is total computable, which implies M is decidable, which in turn implies A is recursive.

14