Lecture 20: Undecidability: Faculty: K.R. Chowdhary: Professor of CS
Lecture 20: Undecidability: Faculty: K.R. Chowdhary: Professor of CS
Fall 2015
: Professor of CS
Disclaimer: These notes have not been subjected to the usual scrutiny reserved for formal publications.
They may be distributed outside this class only with the permission of the faculty.
20.1
Undecidability
In the following discussions, our objective will be those problems which cannot be solved by computer. In
other words, we will be able to show that no Turing Machine exists to solve such problems.
Consider that M is a TM with alphabet = {a, b} and w , and M accepts w. We had discussed that
a TM M can be encoded as en(M ), and its input w as en(w), accordingly, for the alphabet , the encoding
is:
(qi , a) = (qj , b, L)
= 001i+1 012 01j+1 013 012 00
(20.1)
Similarly, all the transitions can be encoded, hence hM, wi is encoded as 00mi 00mj 00 . . . 00mk , where mi
is a transition, like shown in equation 20.1. We note that all the transitions of a TM, separated by 00 is
a big integer number. If this process is followed, we can encode all the possible TMs. If a string is not a
well-formed representation of any TM, we take this as encoding of a TM with null moves, hence every binary
string, whether long or short, can be taken as representation of some TM. Therefore, all Turing machines
are represented by integers {1, 2, 3, . . . , i, . . . }, which is enumeration of Turing machines Mi , and are the
countable infinite numbers.
20-2
20.2
Barbers Paradox
A barber in a small town declares that he shaves every one in this town who does not shave himself, and that
he does not shave any one who shaves himself. We will see that barbers declaration leads to contradiction.
This contradiction is heart of the argument to prove that the halting problem is unsolvable.
Let us see this barbers paradox. Let X denote how the barber behaves, X = 1 means to shave a villager,
and X = 0 means not to shave. Similarly, Y denotes how the villager behaves, Y = 1 means to shave himself,
and Y = 0 means not to shave himself.
Clearly, what barber declared is for any villager including himself, so (X, Y ) must be (1, 0) or (0, 1).
On the other hand, the barber shaves not only as barber, but also as one of the villager, i.e., himself,
which is shaves: to the barber, and also shaves to villager. Therefore, if barber shaves himself, (X, Y )
becomes (1, 1). Where as when barber does not shave himself, (X, Y ) becomes (0, 0). In either cases, this
contacts what barber has declared.
If the barber is not treated as villager, the contradiction does not occur. The contradiction in above results
20-3
20.3
Let us assume that there is a TM M that accepts input w with w L(M ), and rejects w
/ L(M ). To model
the halting problem, let us assume that there is a TM H that decides this. That is, when H is simulated to
run M with input w, so that when M prints accept H will also print accept, and when M print reject,
the H will also print reject in the above case. For this we feed representation R(M ) and w as input to H
(see fig. 20.2(a)).
20-4
(20.2)
Corollary 20.1 A language LH = {R(M )w|R(M ) is representation of TM M and M halts over input w}
is not Recursively Enumerable. Since it is not RE, it is also not R (recursive).
The Diagonal of the table represents the answers to the self reference question: Does Mi halt when run on
itself? The machine D was constructed to produce contradiction in response to this question.
In general if there exists a TM that eventually halts and decides Yes/No for a given problem, the problem
is called decidable. The problem called halting problem to tell whether TM will eventually halt or run for
ever is such a problem, i.e., undecidable. In the above we have concluded that halting problem is undecidable.
At first instance, the halting problem seems decidable. It seems reasonable that we can let universal TM U
solve the hating problem by running U for an arbitrary TM M together with input w and producing Yes
when U halts in the course of simulation. In fact, output Yes is correct as long as M with input w eventually
halts. But if the machine M with input w runs forever, the Universal Turing machine U will also run forever,
and hence can never output No forever. So we cannot solve the halting problem by simply running the
Universal Turing machine. But, this is not the proof. The proof is shown in systematic transformation of
the Universal TM, as shown above.
Theorem 20.2 The language LH ={R(M )w | R(M ) is representation of M , with input w {0, 1} is not
recursive but recursively enumerable (RE)}.
Proof: The proof is left as an exercises (see fig. 20.3).
Consider that P is a program, and x is a string over input alphabet, which we fix as {0, 1}. Following are
some fundamental problems because they are inherently important or because they have played historical
role in development of computation theory.
1. Universal Simulation: Given a program P and input x to P , determine the output (if any) that P
would produce on input x.
20-5
RE
RE but not R