Hello World! An Invitation to Computer Science

Lecture Slides

The Halting Problem
Thursday May 8, 2008


Key ideas from last time


Can we compute "majority" on a Turing machine?


Church-Turing Thesis


When does an algorithm or TM halt?


Proof by contradiction


Universal Turing machine

a simple Turing machine - encoded

  (A,0,1,L,A)  ==>  01 * 00 * 01 * 10 * 01 *
  (A,1,0,L,A)  ==>  01 * 01 * 00 * 10 * 01 *
  (A,*,*,R,B)  ==>  01 * 11 * 11 * 01 * 10 *
  (B,0,0,R,B)  ==>  10 * 00 * 00 * 01 * 10 *
  (B,1,1,R,B)  ==>  10 * 01 * 01 * 01 * 10 *
  (B,*,*,N,H)  ==>  10 * 11 * 11 * 00 * 11 *

glued together:
01*00*01*10*01*01*01*00*10*01*01*11*11*01*10*10*00*00*01*10*10*01*01*01*10*10*11*11*00*11**


Turing machine to solve the halting problem


Turing machine that partially decides halting

we can augment F to G by changing:

  (_,_,1,R,HALT)  ==>   (_,_,1,R,NEW)
and adding:
    (NEW,_,_,NOMOVE,NEW)

given input T# and x, G only halts if T does not halt on x


Testing if a Turing machine halts on itself


The halting problem is unsolvable!


Implications

(Turing's original paper)