Lecture 09
Lecture 09
Lecture #9
Sarmad Abbasi
Virtual University
Halting Problem.
Undecidability of the Halting Problem
Diagonalization
Co-Turing Recognizability
the Halting Problem is not co-Turing Recognizable
Let us define
On Input hM, wi
Simulate M on w.
If M accepts w accept.
This machine lets call it U is a recognizer for ATM .
Theorem
ATM is not decidable.
Note that we can easily make this TM D provided H is given to us. So,
if H exists then so does D.
The main step D has to do is to convert the input hMi to hM, hMii.
What will running H on hM, hMii tell us?
1 the first three entries in the first row tells us that M1 accepts hM1 i
and hM3 i but not the hM2 i and so on...
2 M2 accepts all descriptions......
3 Similarly the 4th row tells us that M4 accepts hM1 i and hM2 i...
The contradiction comes when we try to fill out the entry that
corresponds to the column of D.
1 If we put an accept there, it should be reject.
2 Similarly, if we put a reject there, it should be accept.
hM1 i hM2 i hM3 i hM4 i ··· ··· hMi i ···
···
D = Mi accept accept reject reject ··· ··· ?? ···
1 Assume H exists.
2 Construct D. We argue that D can be constructed from H.
3 We check what D will do if it is given its own description.
4 This leads to an absurdity. Therefore, H cannot exist.
5 Quad erat demenstratum
Theorem
A language A is decidable if and only if A is decidable.
L(M) = A.
The TM M does not have to halt on all inputs. All we want is
accept, x ∈ A;
M(x) =
does not accept, x 6∈ A.
Note that the same trick we did in the previous theorem will not work
here. If we switch the accept and reject states of M we get a new
machine M 0 that does the following:
0 rejects, x 6∈ A;
M (x) =
accepts or loops, x ∈ A.
Definition
A language B is called co-Turing-recognizable if B is
Turing-recognizable.
1 if x ∈ A then M1 accepts x.
2 if x ∈ A then M2 accepts x.
Lets consider the TM N now.
1 On input x.
2 Run M1 and M2 on x in parallel.
3 If M1 accepts x accept.
4 If M2 accepts x reject.
We can use dovetailing to run both machines in parallel.
1 On input x.
2 Place the start configuration of M1 on x on one tape.
3 Place the start configuration of M2 on x on second tape.
4 For i = 1, 2, 3, . . . ,
5 Simulate one step of M1 . If M1 accepts accept.
6 Simulate one step of M2 . If M2 accepts reject.
L(N) = A.
A ∪ A = Σ∗ .
Theorem (4.16)
If a language is Turing recognizable and co-Turing-recognizable then it
is decidable.
Lets apply this theorem to the Halting Problem. We cannot apply is
directly.
Theorem
If A is not decidable the either A or A is not Turing-recognizable.
not Q ⇒ not P
P1 ∧ P2 ⇒ Q
then its contrapositive is