The halting problem
Contents
The halting problem¶
We come to one of the most famous and most basic results in computability theory.
There is no program \(p\) such that for all words \(x\) and \(y\),
Here is the proof. Suppose toward a contradiction that we had such a program \(p\). Modifying \(p\), we get a program \(q\) so that for all \(a\),
Here’s how this would be done. Assume that \(p\) preserves its input. Let \(p\) have \(k\) instructions. Let
Then \(q\) has the property that we want. But now, take \(a\) to be \(q\). Then
Contradiction!
Tip
Look up this setting of the proof by Geoffrey Pullum in the spirit of Dr. Seuss.
Corollaries¶
There are a number of corollaries to the basic undecidability result.
The set of programs which halt when run on all empty registers is undecidable.
The set of programs which halt when run on themselves is undecidable.
Improvement for one-register programs¶
There is also an improved version of the basic result.
Let \(A\) be the set of programs which are tidy and which only use one register.
The halting problem is undecidable even for programs in \(A\) when run on all emtpy registers.
The language \(\one\hash\) has infinitely many instructions: the instructions are the words \(\one^k \hash^{\ell}\), where \(k\in \N\) and \(1\leq \ell\leq 5\).
For each finite set \(F\) of \(\one\hash\) instructions, we can consider \(H_F\), the set of programs \(p\) built using the instructions of \(F\) (and no others) such that \(\phifn_p(\ )\dar\).
For example, if \(F = \set{\one\hash, \one\hash\hash}\), then \(H_F\) is decidable. This is because every program built from these two instructions halts.
Find a finite set \(F\) such that \(H_F\) is undecidable.