Halting Problem
First, note that the set of codes for programs is a decidable set, call it
Let

be the set of all codes for programs

such that P halts on input

.
Theorem 3.2(a).

is undecidable.
Proof: Suppose it is decidable. Let

decide it. That is,
For all
-
if
where
.
- From
, we obtain a program
that is ornery:
if

if
We have that

on input code of

doesn't halt if and only if

on input code of

does halt.
Now, let

be

. That is, we are now looking at

on input

. What does this program do? It says "I halt if and only if I don't halt," which is the contradiction we need.
More formally, plug in to the formula above:
We have that

on input code of

doesn't halt if and only if

on input code of

does halt.
That is a contradiction to the assumption that

exists. Thus, there is no such

, the problem is undecidable.
Let

be the set of all codes for programs

such that P halts on input

.
Theorem 3.2(b).

is undecidable.
Proof: We prove this by reducing it to 3.2(a). That is the most commonly used technique of proof in this subject. That is, we show that if the set of 3.2(b) were decidable, then the set of 3.2(a) would be as well, contradicting 3.2(a).
So, to each program

we associate a new program

such that

halts on input

if and only if

halts on input

. That will do the job: If we could solve the halting problem for machines with no input, we can use the construction to solve the halting problem for machines with their own Gödel numbers as input as follows: To see if machine

halts with its own Gödel number as input, it will suffice to see if

halts on no input. Thus, if we the halting problem for machinew with no input were decidable, the halting problem for machines with their own Gödel numbers as input would also be decidable, contradicting part a of the theorem.
This will be our characteristing method of proof for the rest of the semester: we show problems hard by reducing the halting problem to them.
So, say machine

has code

that consists of

s. What is

? It must, starting from the empty string, write

in register 0, and then call program

.
That's easy: start by adding

to the register

times, using

"

" instructions, then do

, that is, copy the instructions of

after those, renumbering as needed.
Remarks on the HW.
First, to show that a set is decidable has
two parts: show how to tell if something is in the set,
and show how to tell that something is not in the set. If you just do the first half, you have shown the set r.e., not decidable.
Second, to prove a conditional statement,

, assume the antecedent (

), and prove the consequent (

).
Third, to prove three statements,

, equivalent, it is enough to show

,

, and

.
Homework: Due 21 February. Problem 3.5, p. 167.
-- ProfessorShaughanLavine? - 04 Feb 2005