I am reading Sipsers. The book introduces halting problem and proves that is a turing recognisable language but not a turing decidable language. Thus giving a Turing machine which does not halt on some inputs. The language to be precise is $L=\{\langle M,w \rangle| \ M \text{is a turing machine and } w \text{ is a string M accepts} \}$. Let $D$ be the turing machine that recognises $L$. Inability of $D$ to halt on some inputs is due to the fact that there exist Turing Machine $M$ which do not halt on some input. Thus the reason for not halting is kind of recursive ( if I consider only this example ). I am still not able to understand in crux why a turing machine won't halt. But can't come up with language over $\{0,1\}$ which is turing recognisable but not decidable. What are all the reasons a Turing machine won't halt ?
2 Answers
A TM s just a program. It does whatever you program it to do. If, for instance, you program it to perform the following:
while (true)
{
do_nothing
}
, then it will never halt!
The language $L$ goes over all possible machines $M$, and therefore it must encounter some machines that don't halt, for instance, the one stated above.
There is a deep difference between the reason the above machine doesn't halt (it is just programmed to do so), and the reason that any machine for $L$ will not halt–no machine for $L$ exists since that language is undecidable.
regarding your question about finding a more "natural" language that is undecidable, see Is there a “natural” undecidable language?. You may get some more intuition about undecidable languages here.
A Turing machine doesn't halt if it never reaches a halting state. For example, it might keep moving its head to the right, never stopping. Or it might count $1,2,3,\ldots$, never halting. It doesn't need a reason not to halt.
What we know about the language $L$ is that there is no machine $T$ that satisfies the following two properties:
- If $\langle M,x \rangle \in L$ then on input $\langle M,x \rangle$, $T$ halts and outputs YES.
- If $\langle M,x \rangle \notin L$ then on input $\langle M,x \rangle$, $T$ halts and outputs NO.
How do we know that? Sipser proves it in his textbook. The naive attempt at deciding $L$, that is simulating $M$ on $x$, doesn't halt when the answer is NO; but there could be a completely different algorithm whose principle of operation is different and doesn't suffer from this problem. What Sipser shows (following Turing) is that no matter what you do, you cannot come up with a machine $T$ deciding $L$.
- 280,205
- 27
- 317
- 514