“Turing’s work was of course a great contribution to the world of mathematics, but there is a question of exactly how it is related to the world of computing. – Wilkes
Despite what it says on the Wikipedia page, the halting problem for Turing machines is not relevant to computer programming. In particular, whether there can be computer programs that automatically check the correctness of or absence of infinite loops in other computer programs has nothing to do with the Turing machine halting problem. There can be no Turing machine which given input \(n,m\) is guaranteed to decide whether Turing machine \(T_n\) with input \(m\) will eventually halt. But there are, trivially, Turing machines which take input \(s,n,m\) and decide if \(T_n\) halts within \(s\) steps (or \(2^s\) steps or \(10^{10^{100000\times s}}\)) steps. That is, it is Turing trivial to determine whether a Turing machine halts within the expected lifespan of the Milky Way. Since physical computers are finite state and non-terminating computer programs have to cycle eventually, the problem is even simpler – if we had Turing machines to do the computation.
Even in foundations of mathematics, the difference between “never halts” and “takes too long” is not always important. Gödel wrote that if decision processes worked in linear or exponential time, “this would have consequences of the greatest importance . Namely, it would obviously mean that in spite of the undecidability of the Entscheidungsproblem, the mental work of a mathematician concerning Yes-or-No questions could be completely replaced by a machine. After all, one would simply have to choose the natural number n so large that when the machine does not deliver a result, it makes no sense to think more about the problem.” Certainly for computer science, feasibility and algorithmic complexity are important, not Turing decidability. Although it’s trivially Turing decidable whether a Turing machine can complete before the heat death of the universe or next year or in 30 microseconds, trivial Turing decidability carries no information about how hard it is if it is feasible at all.
However, the critical importance of the halting problem for Turing machines is folkloric and anyone bringing up these pesky facts will likely get one of the standard confused responses
- Yes, actual computers are finite state, but golly they have a lot of states so it’s pretty much the same thing (nope).
- If someone keeps adding or swapping out CDs or disk drives, actual computers are really infinite state (that’s not a computer, it is a system comprised of a computer, an immortal person to swap CDs, infinite matter, and unlimited time).
- Turing machines are good models of real programs (perhaps, but the halting problem is not relevant to that use.).
- Python, or Lisp or Haskell or something, has unbounded integers. (No they do not.)
- etc.
Much of the confusion is caused by mixing-up informal explanations with mathematics. Turing’s Entscheidungsproblem paper proposes a specific model of “computable”, arguing that the informal notion of “algorithm” in mathematics can be formalized by a type of automata that is now known as Turing machine. Once this notion is made precise, it is possible to look at the properties of these algorithms and to prove some theorems about what Turing machines can and cannot compute. The first sentence of the Wikipedia page on “Halting Problem” is a good example of imprecision leading to error:
“In computability theory, the halting problem is the problem of determining, from a description of an arbitrary computer program and an input, whether the program will finish running (i.e., halt) or continue to run forever. “
The definition of “computability theory” linked in the text starts “Computability theory, also known as recursion theory“, firmly placing the topic in mathematics. But the definition of “computer program” linked in the text is concerned with programs on physical digital computers. And of course, determining whether such a program halts is Turing Trivial yet the next sentence in the Wikipedia article jumps back to Turing machines:
“Alan Turing proved in 1936 that a general algorithm to solve the halting problem for all possible program-input pairs cannot exist“.
So we’ve jumped from “computer programs” on physical computers to calling Turing machines “programs”. And then a jump back:
“The theoretical conclusion of not solvable is significant to practical computing efforts, defining a class of applications which no programming invention can possibly perform perfectly.“
Nope. Similar sounding words don’t necessarily have the same meaning. A mathematical proof about the limitations of “computable functions” can not be safely handwaved around to show something about physical computers and programs running on those computers.