Self-Halting Problem
Introduction
This piece of code
produces a sequence of values called the Collatz sequence. Every input that
has been tried causes this program to halt. Since we donÕt know if this
program halts for every possible input, we cannot calculate an upper bound,
but we can show that the lower bound is W(log n).
while (x > 1) do if
(x is odd) do x
= 3 * x + 1 else
do x
= x / 2
The Self-Halting problem
involves determining whether a program will ever terminate. The proof idea of
the Self-halting problem is that a machine is unable to verify or halt on its
own descriptive input. We can ask, given a machine and its description as input
does this machine halt? We will see below by contradiction that it does not
halt. Thus, a computer cannot solve the general problem of software
verification, that is, determining for any program whether it terminates for
all possible inputs. Therefore, the Self-Halting problem for Turing Machines is
not Turing-computable in terms of the Church-Turing thesis. Below we have two
formulations of the Self-halting proof.
The first one is by Sipser and the second one is by Taylor.
Sipser Formulation
We have a
Turing machine H, which takes as input a representation or description of another
Turing machine M and an input word w, such as in the following:
{
accept if
M accepts w reject if
M rejects w
H(‡M, w–) =
We
construct a new Turing machine D with H as a subroutine, where D calls H to
determine what M does when the input to M is its own description ‡M–. D then does the opposite of what M (or H) does. So, we have:
D(‡M–) = opposite[H(‡M, ‡M––)]:
Where D
runs H on input ‡M, ‡M––, and outputs the opposite of what H
outputs.
D(‡M–) =
Then if we
run D with its own description ‡D– as input, D(‡D–) = opposite[H(‡D, ‡D––)], we have a contradiction.
D(‡D–) =
The
contradiction is that when D rejects its own description ‡D– (which means H yields a rejection)
we get an acceptance by definition of D since D wants to produce the opposite
of H. But how can we have an
acceptance when D rejected ‡D–? And so, we can never know for sure whether this halts or
not.
\ Neither TM D nor TM H can exist.
Taylor Formulation
Let us represent the Self-Halting problem, Ps, as a (number-theoretic) function and show that Ps is not Turing-computable. The proof is in three steps and is a contradiction. This proof closely resembles Gregory TaylorÕs from Models of Computation and Formal Languages.
First Step
Suppose we have an enumeration of Turing Machines <TM0, TM1, TM2, ..., TMn> such that TM0 has the smallest Gšdel number and increases accordingly. Now, lets say that TMn computes on a tape starting from the left, with a string of n + 1 1's representing n where n is a natural number. If TMn halts with a value representation, given it's own Gšdel number as input, then we shall say that TMn self-halts.
So, we ask is there an algorithm for
determining if TMn self-halts for n ³ 0?
Second Step
Every Turing Machine can compute a (partial unary number-theoretic) function called the everywhere-undefined function. We can write a unary function Än computed by TMn. We now can further enumerate Turing-computable functions <Ä0, Ä1, Ä2, ..., Än>. Thus, Än(n) is either defined or undefined.
So, we now ask is there an algorithm for determining if Än(n) is defined for n ³ 0?
Third Step
We can clearly show where Än(n) can be defined and cannot be defined. For instance, if Ä3(n) = n3, then Ä3(3) = 33 which equals 27, a self-halting value. Where as Ä20(n) = 10 - n would be undefined for n = 20 and for any n > 10, thus not self-halting. So now we can formulate Ps.
|
Ps(n) = { |
Än(n) + 1
if Än(n) is defined |
The significance of this formulation is to show that we have an algorithm that successfully calculates Ps (as long as the Self-Halting problem is solvable.)
So, we then ask if Ps, as just defined above, is effectively computable?
Contradiction
Ps is not Turing-Computable by contradiction. Suppose that a Turing Machine TM computes Ps. Let g be the Gšdel number of TM so that TM = TMg and Ps = Äg. Now, lets say that Ps takes g as input, which results in either 0 or Äg(g) + 1. If Ps(g) = Äg(g) + 1 we would have Äg(g) = Ps(g) = Äg(g) + 1, which is not correct. Also, if in the other case, Ps(g) = 0 implies that Äg(g) is undefined. However, since Ps = Äg by contradiction Ps(g) cannot be undefined. Therefore, no Turing Machine can compute Ps.
Full-Halting Problem
The Full Halting Problem for Turing Machines can follow the same iterative logic as the Self-Halting problem for Turing machines. Let us represent the Full-Halting problem, Pf, as a (number-theoretic) function and show that Pf is not Turing-computable. The final step would yield the following total number-theoretic function:
|
Ps(n, m) = { |
Än(m) + 1
if Än(m) is defined |
The assertions is that FH*
is not Turing-computable thus unsolvable.
Proof
Let's prove this assertion by contradiction. Let's say that Pf is Turing-computable. Pf(n, m) is defined for any n and m, thus we can say that Pf(n, n) is defined for any n, thus we have:
|
Ps(n, n) = { |
Än(n) + 1
if Än(n) is defined |
Now, we would like to
compare the Full-Halting problem's definition to the Self-Halting problem's
definition, namely Pf(n, n) = Ps(n), for all n. So, what
this says is that Ps is now Turing-computable which we showed
not to be the case for the Self-Halting problem. Therefore, by contradiction we
show that Pf is not Turing-computable, thus by Church-Turing
the Full-Halting problem for Turing Machines is not solvable.
Conclusion
The Self-Halting problem reduces to the Full-Halting problem because a solution to the Full-Halting problem would yield a solution to the Self-Halting problem. In terms of decidability, since the Self-Halting problem is reduced to the Full-Halting problem, but is not Turing-computable then the Full-Halting problem is at least as hard the Self-Halting problem. So, if the Self-Halting problem reduces to the Full-Halting problem and the Full-Halting problem is decidable then the Self-Halting problem is decidable, as well, which of course is found by contradiction, is not the case. Furthermore, again in terms of unsolvability, when the Self-Halting problem is undecidable and reduces to the Full-Halting problem, then the Full-Halting problem is also undecidable, as we have found to be the case.
Links
http://shakti.trincoll.edu/~rtaylor/thcomp/chapter8.ppt
http://hebb.cis.uoguelph.ca/~skremer/Teaching/CIS4600/Lectures/27460/
http://cs.engr.uky.edu/~lewis/texts/theory/unsolvability/reduce.pdf
http://www.cs.washington.edu/homes/csk/halt.html
http://www.wikipedia.org/wiki/Halting_problem
http://mathworld.wolfram.com/HaltingProblem.html
http://faculty.juniata.edu/rhodes/intro/theory2.htm
http://www.csc.liv.ac.uk/~ped/teachadmin/algor/halt.html
http://mini.net/tcl/644