Here is my Halting Problem proof, that largely mirrors other (non-diagonalizing) proofs that I've seen.
- $H(p,i)$ returns $1$ if program $p$ halts on input $i$.
- $H(p,i)$ returns $0$ if program $p$ does not halt on input $i$.
- Let $f(t,t)$ be an interface for any program that returns a $0$ or a $1$.
$g(x)$ is $0$ if $f(x,x)$ is $0$, infinite loop if $f(x,x)$ is $1$
Now use $H$ in place of $f$:
4b. (modified) $g(x)$ is $0$ if $H(x,x)$ is $0$, infinite loop if $H(x,x)$ is $1$
- Run $g(g(i))$ which runs $H(g(i),g(i))$ If $H(i,i)=0$, then $g(i) = 0$ If $H(i,i)=1$, then $g(i)$ is undefined
If $g$ halts, then $H(g(i),g(i))$ must return $1$ (line 1).
But then $g$ won't halt. (line 4b)
If $g$ doesn’t halt, then $H(g,g)$ must return $0$ (line 2).
But if $H(g(i),g(i))$ is $0$, then $g$ halts. (line 4b)
My issue is with $g(g(i))$. I understand that the idea of the proof is to feed the machine into itself, but what, exactly, is the contents of the $i$?