Halting Problem

First, note that the set of codes for programs is a decidable set, call it $\Pi$

Let $\Pi '_{\mbox{\scriptsize halt}}$ be the set of all codes for programs $P$ such that P halts on input $\xi_{P}$.

Theorem 3.2(a). $\Pi '_{\mbox{\scriptsize halt}}$ is undecidable. Proof: Suppose it is decidable. Let $P_0$ decide it. That is,
For all $P$

  1. $P_{0}:\xi_{P}\longrightarrow\fbox{\hspace*{0.2ex}}$ if $P:\xi_{P}\longrightarrow\mbox{halt}$where $\eta\ne\fbox{\hspace*{0.2ex}}$.
  2. From $P_0$, we obtain a program $P_1$ that is ornery: $P_{1}:\xi_{P}\longrightarrow\infty$ if $P:\xi_{P}\longrightarrow\mbox{halt}$
$P_{1}:\xi_{P}\longrightarrow\mbox{halt}$ if $P:\xi_{P}\longrightarrow\infty$

We have that $P_1$ on input code of $P$ doesn't halt if and only if $P$ on input code of $P$ does halt.

Now, let $P$ be $P_1$. That is, we are now looking at $P_1$ on input $\xi_{P_1}$. 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 $P_1$ on input code of $P_1$ doesn't halt if and only if $P_1$ on input code of $P_1$ does halt.

That is a contradiction to the assumption that $P_0$ exists. Thus, there is no such $P_0$, the problem is undecidable.

 

Let $\Pi_{\mbox{halt}}$ be the set of all codes for programs $P$ such that P halts on input $\fbox{\hspace*{0.2ex}}$.

Theorem 3.2(b). $\Pi_{\mbox{halt}}$ 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 $P$ we associate a new program $P^+$ such that $P$ halts on input $\zete_P$ if and only if $P^+$ halts on input $\fbox{\hspace*{0.2ex}}$. 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 $P$ halts with its own Gödel number as input, it will suffice to see if $P^+$ 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 $P$ has code $\zeta_P$ that consists of $n$ $a_0$s. What is $P^+$? It must, starting from the empty string, write $\zeta_P$ in register 0, and then call program $P$.

That's easy: start by adding $a_0$ to the register $n$ times, using $n$ "$+a_0$" instructions, then do $P$, that is, copy the instructions of $P$ 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, $A\Rightarrow B$, assume the antecedent ($A$), and prove the consequent ($B$).

Third, to prove three statements, $A,B,C$, equivalent, it is enough to show $A\Rightarrow B$, $B \Rightarrow C$, and $C\Rightarrow A$.

Homework: Due 21 February. Problem 3.5, p. 167.

-- ProfessorShaughanLavine? - 04 Feb 2005