
How Dr. Seuss would prove the halting problem undecidable - raganwald
http://ebiquity.umbc.edu/blogger/2008/01/19/how-dr-suess-would-prove-the-halting-problem-undecidable/
======
jcl
Reminds me of the "Theory of Relativity in words of four letters or less"
(which is also quite readable):

<http://www.muppetlabs.com/~breadbox/txt/al.html>

~~~
patio11
This has greatly improved my understanding of relativity. Thank you.

------
trominos
This is great but (unfortunately) it's not quite right. The author seems to
have forgotten the difference between a program without specified inputs --
which can't be said to "halt" or "not halt", because it might halt on some
inputs and loop on others -- and a program _with_ specified inputs, which
always either halts or loops.

Thus at one point the poem asks whether Q halts without specifying an input to
Q. This question is meaningless.

The correct proof is given by BrandonM in a thread somewhere on this page.
Check it out. (scott_s restates the incorrect proof above BrandonM, for
comparison.)

~~~
scott_s
The bug in my pseudocode is that I did the wrong thing after consulting P
inside Q. I'm not convinced that using "program" or "Q" as shorthand for
"program(inputs)" and "Q(inputs)" changes the semantics of the pseudocode or
the implications of the paradox.

------
ryanjmo
This somehow seems easier to follow than a formal proof (even though it is
actually a formal proof). Fun times!

~~~
pw0ncakes
It's a proof, but not a formal one. It doesn't define the notion of "program",
for example. It's somewhere between an informal proof and a proof sketch (a
correct and valid one, of course).

A _formal_ proof is a sequence of statements where each is either an axiom or
derived from previous ones via a set of derivation rules, and wherein
assessing the validity of each axiom statement or derivation can be done
"typographically" (mechanically and primitive-recursively). It's nigh-
impossible to write a human-readable formal proof of anything interesting; the
vast majority of mathematical papers published are informal proofs.

(Of course, this diversion doesn't detract from the matter of this proof-poem
being very cool.)

~~~
ryanjmo
Yes I am sorry, I believe I ment "it is in some ways a formal proof." It is
indeed a proof sketch. With a preliminary section defining things more
rigorously, I do believe that this is publishable in most of the Cryptography
conferences I have published in.

~~~
alain94040
With a preliminary section defining things more rigorously I do believe that
this is publishable in a conference on Cryptography

[trying to get the rhyme going for you]

------
Groxx
I still wonder why the anti-halting-detecting-program + halting-detecting-
program aren't viewed as a single program, as they can't be separated from
each other in the proof. By wrapping the detector in an external application,
aren't you modifying the detector, changing the assumptions of the proof?

An external halting detector (such as _one of us_ ) would tell you the
hypothetical arrangement would never halt. If we can prove it would never
halt, can't a program?

~~~
meastham
An "external halting detector" couldn't correctly tell if the arrangement
would halt. If we decide that the input of the program halts, then the wrapper
instance loops infinitely and we were wrong. If we decide that the input of
the program doesn't halt, then the wrapper halts and we were also wrong.

~~~
ars
Why are you only looking at the program and ignoring the wrapper? The detector
should also look at the wrapper.

~~~
scott_s
It does look at the wrapper. The problem is that whatever decision P makes
about Q, Q then goes and does the opposite. Consider:

    
    
      def P(program):
        if program halts:
          true
        else:
          false
    
      def Q(program):
        if P(program):
          false
        else:
          Q(program)
    

When we call Q(Q), we call P(Q). Let's say P(Q) returns false; P says that Q
halts. In that case, the conditional fails, and we then call Q(Q) infinitely.
Q has done the opposite of what P said it would do.

Now let's say that P(Q) returns true; P says that Q does not halt. In that
case, the conditional succeeds, and Q returns false - it halts. Again, Q has
done the opposite of what P said it would do.

Here we have a situation where Q will always do the opposite of what P says it
will do. We've constructed a situation where P is always wrong; we've created
a paradox. The only way out of it is to say P cannot exist.

~~~
Groxx
While running some errands, I think I realized the core of my trouble
accepting this proof. I think it may be the same for a lot of people, but I've
never heard it stated, so here it is:

To my mind, it seems logical that if P reaches a paradox, it _never_ returns.
It's an infinite logical loop, never finishing, thus never returning true or
false. Like evaluating "this statement is false", it's stuck on "if it's true,
it's false. If false, true". To that end, the paradox isn't a paradox: it just
never finishes.

If this is the case, then P(Q(Q)) does indeed escape the problem entirely: it
shows that Q(Q) will never finish. _That_ argument I've made, and I've seen
others make, but the realization of the previous paragraph is new. And nobody
I've debated this with has really attempted to look outside of "but it's a
_proof_ , it _proves_ it", and re-iterating the steps of the proof. Not that
many have _tried_ for very long, they usually get upset that I can't see the
"obvious". Thanks for sticking it out, I've had longer to think on this than
I've had with others, and that may have been what I needed.

This reveals a missing assumption in the proof, or at least one I've never
seen stated: that P _must_ finish. If it must finish, then I accept the proof
completely. If it's a paradox, I agree, it's a paradox, and it certainly is
within that requirement. It must return, but it cannot, therefore it can not
exist.

But then I must ask: Why _must_ P finish on all inputs? I can make a program
which doesn't (print(num) when passed Pi), why not this one?

I'd be very interested in any input / rebuttals to this. I'm not trying to be
difficult, honest! I've understood the proof where P must finish for quite a
while, but I don't see that it's a valid assumption if categorically stating
that it's inherently un-doable.

~~~
jorgeortiz85
Th original P is defined as a program that can decide whether any program
halts or not. If your proposed P doesn't terminate for some programs, then it
hasn't made a decision, and it's not really the P you set out to find.

In other words: can you make a P that decides correctly for -some- programs,
but never gives an answer for others? Sure. (E.g., if the program is
"while(true) {}", then it loops, otherwise I don't know.) But unless P works
(terminates and gives a decision) for any arbitrary program, it's not
generally useful.

~~~
Groxx
Good point. But that doesn't mean it's useless. Check it with an external P:
If it's a paradoxical process like is given in the proof, it won't finish,
which will be detected, uniquely, as a paradox because it won't halt.

~~~
argv_empty
For what finite number of steps can we watch the program and know afterwards
that it will never halt in the future?

------
pmichaud
I can't upvote this enough, it's amazing.

------
InclinedPlane
This is also amusing: [http://stackoverflow.com/questions/235984/the-halting-
proble...](http://stackoverflow.com/questions/235984/the-halting-problem-in-
the-field)

------
dmoney
_It’s something that cannot be done. So we users must find our own bugs; our
computers are losers!_

This doesn't prove that users are capable of finding bugs that computers
aren't (theoretically) capable of finding. The sets might be the same.

------
adamc
OK, that made my day. Although it reminds me of the barber paradox
(<http://en.wikipedia.org/wiki/Barber_paradox>) in its self-referentiality.

------
ireadzalot
I still don't get it.

~~~
InclinedPlane
Say halting detectors exist, then you can build a looping detector trivially
by merely reversing the outputs from the halting detector. You can then modify
the looping detector so that it loops if it doesn't find any loops in the
target program.

Then you use the modified looping detector on itself. If you think about it,
it can't be used on itself. Because if it says that it will loop then it will
itself not loop, and if it says that it won't loop then it will itself loop.

It's a logical paradox, which is also a reductio ad absurbum proof that no
such thing as a halting detector can exist.

~~~
ireadzalot
Thanks.

------
ErrantX
Excellent find! I just started a book of basic world history and this inspired
me to have a go at my own Seuss-like verse :D

