Philosophy of Computer Science

The Halting Problem

William J. Rapaport

Department of Computer Science and Engineering,
Department of Philosophy,
Department of Linguistics,
and Center for Cognitive Science
State University of New York at Buffalo,
Buffalo, NY 14260-2000

Last Update: 2 February 2010

Note: NEW or UPDATED material is highlighted


The Halting Problem provides an example of a non-computable function.


Question:

Is there a computer program (e.g., a program for a Turing machine) that takes as input:

  1. a computer program C, and
  2. C's input (suppose it's an integer; call it "i")
and that outputs:

Call this program "H".

Since H's input is C and i, we can refer to H and its input as:


Notes:

  1. You can imagine that H(C, i) works as follows:

  2. However, we can't answer the question whether C halts on i by just running C on i:


Answer:

No! There is no such program H(C, i).


Proof (sketch):

Assume by way of contradiction that there is such a program H.

Now consider another program, H*, which works as follows:

Next, code C as a number, so that it can be treated as input to itself.

Now consider H*(C,C). (This step is called "diagonalization".)

Now code H* as a number! And consider H*(H*,H*):