THE HALTING PROBLEM PROOF Review What makes a problem decidable? 3 properties of an efficient algorithm? What is the meaning of “complete”, “mechanistic”, and “deterministic”? Is the Halting Problem decidable/undecidable? How would you define the Universal Turing Machine? Halting problem is undecidable Proof Proof by contradiction Assume that there is a TM H that solves the halting problem The computation of H can be depicted as follows: M halts with input w R(M)w Accept H Reject M does not halt with input w Halting problem is undecidable Proof We modify H to construct a new TM H’, which behaves very much as H: The computations of H’ are the same as H, except that H’ loops indefinitely whenever H terminates in an accepting state, i.e., whenever H halts on input w, and halts otherwise M halts with input w R(M)w Loop H’ Halt M does not halt with input w Halting problem is undecidable Proof H’ is combined with a copy machine to construct a new TM D: The input to D is a TM representation R(M) A computation of D begins with copying the string R(M) to yield R(M)R(M) The computation continues by running H’ on R(M)R(M) M halts with input R(M) Copy R(M) D R(M) R(M) H’ Loop Halt M does not halt with input R(M) Halting problem is undecidable Proof Consider a computation of D with input R(D): The input to D is the representation to any arbitrary TM D halts with input R(D) Copy R(D) D Examining D R(D) R(D) Loop H’ Halt D does not halt with input R(D) the preceding computation, we see that: halt on input R(D) iff D does not halt on input R(D), which is a contradiction Therefore, the original assumption is wrong and the halting problem is undecidable