7.3 Universal Turing machine 109
simple sketch of proof of the insolvability of the halting problem in the general case, as
the following illustrates.
10
As we know, any TM is uniquely defined by its action table or program. Such a
program can be encoded into a string of symbols, for instance, in the binary system
with 0 and 1 bits. According to the coding rules, each individual instruction k in the
table takes the form of a binary number s
k
of defined size. Concatenating the coded
instructions gives the string s = s
1
s
2
s
3
...s
k
...s
N
#, where N is the total number of
instructions in the table, and # is an end delimiter, e.g., s = 110101110 ...1000010#.
Because of the coding rules, not every binary string picked at random defines a TM,
but the contrary is true: for any TM there is a corresponding unique binary string s.We
can then index each TM according to its unique string value and put these TMs into
an ordered list. Although there exists an infinity of such strings, it is said that they are
countable, just like integer numbers,
11
but unlike real numbers. Let this counter index
be n, and call T (n) the TM that uses this program. We now have an infinite catalog of
TM, which can be listed as T (1), T (2), T (3),...
Consider next the input data on the TM tape. The data also form a string of finite size,
which corresponds to any binary number. Likewise, we can index and order these data
into a list, forming the infinite, but countable, set of all possible input data strings, with
p as the index. Call T (n, p) the unique Turing machine T (n), which has the data string
p on its input tape. If T (n, p) halts, call the output data T
∗
(n, p). The halting problem
is summarized by the question: “Given a Turing machine T (n, p), is there any rule to
determine whether it will halt?” With the previous definitions, we can now prove the
undecidability of the halting problem. I shall do this by assuming that such a rule (call it
the halting rule) does exist; then I will show that this assumption leads to an intractable
contradiction!
With the halting rule, we know for sure whether or not a given machine T (n, p)
does halt. In all the favorable cases (halting TMs), we can safely run the computa-
tions to a conclusion, and tabulate the output data T
∗
(n, p). We can, thus, fill in a
two-dimensional array of T
∗
(n, p) such as that in Table 7.7. In the unfavorable cases
(nonhalting TMs), there is no point in running the machines, since the halting rule
tells us that they never halt. In this case, we just enter a × mark in the corresponding
array cell. This array is infinite in two dimensions, so it can never be physically com-
pleted, but this does not matter for the demonstration. The halting rule yields a Boolean
answer to the statement “T (n, p) halts,” under the form q = true or q = false. We can,
therefore, design another universal Turing machine H(t) with a program t that does the
following:
r
In the favorable case (q = true), emulate T ( p, p) to compute T
∗
(p, p); the output is
then T
∗
(p, p) + 1 (to differentiate from the output of machine T ( p, p)).
r
In the unfavorable case (q = false), skip calculation and output 0.
10
See http://pass.maths.org.uk/issue5/turing/, and also http://en.wikipedia.org/wiki/Halting_problem.
11
Integers are countable, because given any two integer bounds (n
1
, n
2
≥ n
1
), there exists a finite number
n
2
− n
1
− 1 of integers between the two bounds.