Content-Type: text/html
The halting problem is used to show that some functions cannot be computed within any standard model of computation. The problem is stated as follows:
Given a universal computing system, write a program (the halting function) in that computing system that accepts two arguments, an integer representing a program and an integer representing the arguments to that program. The output of the halting function should be 1 if the first argument represents a program that will terminate when given the inputs represented by the second argument and 0 otherwise. It can be shown that no such function can be written in any system that is equivalent in power to a Turing machine (or with Markov algorithms, or LISP with infinite memory or any of a large number of equivalent systems).
This depends on two important properties. First, all programs can be encoded as integers because they can be written with a finite alphabet. Secondly, multiple arguments, each of which can be an arbitrary precision integer can be combined into a single integer using an encoding trick. The typical argument encoding trick is to use
x' = Π pixi where x' is the integer representing the combined arguments, pi is the i-th prime and xi is the i-th original argument.
The theorem follows from the fact that if we can write the halting function, then we can encode is as an integer (call it H). The problems start when we give the halting function the following function (written roughly in scheme here):
(define (trouble n)
(if (H trouble n) (forever) else 1))Where forever is the classic non-terminating program:
(define (forever) (forever)) The reason that the function trouble is so much trouble is that it will halt for an input n precisely if H says that it won't and it will loop forever whenever H says it will terminate. Thus, the existence of this function proves that H can't work.
One can define a computing system that can solve the halting problem. The problem is that the function that solves the halting problem can't be written down and the computing system can't be implemented. For instance, if we take scheme with real numbers as constants, variables and arguments, then this function can solve the halting problem for a suitable value of the constant x0
(define (HR program input)
(select-bit x0 (* (expt 2 program) (expt 3 input))))
(define (select-bit x n)
(if (zero? n) (> x 0.5) else (select-bit (fraction (* x 2)) (- n 1))))The trick here is that we just use x0 as a lookup table to find the answer. Of course, to write down the program HR, we would have to know this value.
Thanks, the page is so much better now!
I wonder if you think the following trivia would be worth putting on the page: for an actual existing computer with a finite amount of RAM and external storage, the halting problem is of course solvable. If the number of internal states is N, you can just wait for N+1 steps to see if a state returns.
Also, do you know anything about the Chaitin connection? --AxelBoldt
I do know something about the Chaitin connection, but I question my memory, have been some years. I'll try to check it further, but right now it seems to me that this doesn't belong on this page, this information is not important enough for the general article on the halting problem; it can be relegated to a page on Chaitin and his results. -- AV