Source: http://www.cs.columbia.edu/~tal/3261/sp12/notes/halting_lecturenotes.pdf