Live data from Hacker News

Scooping the Loop Snooper (2000)

lel.ed.ac.uk

11–20 of 34 posts

Re: Scooping the Loop Snooper (2000)

#11
post #6

assuming unbounded time and memory. not being pedantic. you can exhaustively enumerate all inputs for a program. tautologically self-references aside, axiomatically, yes, we can determine if a program will halt, if it has a finite amount of time, or memory. if it doesn't [have unbounded range], then it must [terminate], but it is very, very, very hard to determine if that is the case. but not impossible. and this nua…

[deleted]

Re: Scooping the Loop Snooper (2000)

#12
I don’t follow this proof. If Q takes an executable program, then Q(x) is executable, but Q alone isn’t. So you can ask questions about Q(Q(x)), but Q(Q) shouldn’t type check, as the inner Q isn’t executable without an argument. Am I being dumb? How would you do this proof with types?

Re: Scooping the Loop Snooper (2000)

#13

I don’t follow this proof. If Q takes an executable program, then Q(x) is executable, but Q alone isn’t. So you can ask questions about Q(Q(x)), but Q(Q) shouldn’t type check, as the inner Q isn’t executable without an argument. Am I being dumb? How would you do this proof with types?

Define P(A, S) as the function that takes as input an algorithm A and a string S and returns true if A(S) halts, and false if A(S) does not halt. The claim is that P does not exist.

Assume P exists, let Q(S) be the function that takes a string S and halts if P(Q, S) returns false, otherwise it loops forever. Q(S) is not some whacky function either, in TypeScript it could be implemented as follows:

    function P(A: (S: string) => void, S: string): boolean;

    function Q(S: string): void {
      if(P(Q, S)) {
        while(true) {}
      }
    }
But then you have the following contradiction:

If P(Q, S) returns false, then that implies Q(S) runs forever, but by definition Q(S) halts when P(Q, S) returns false, so P was incorrect about Q(S).

If P(Q, S) returns true, then that implies Q(S) halts, but by definition Q(S) loops forever when P(Q, S) returns true, so P was incorrect about Q(S).

This exhausts all possibilities, hence our assumption that there is such a P must be false.

Re: Scooping the Loop Snooper (2000)

#14

I don’t follow this proof. If Q takes an executable program, then Q(x) is executable, but Q alone isn’t. So you can ask questions about Q(Q(x)), but Q(Q) shouldn’t type check, as the inner Q isn’t executable without an argument. Am I being dumb? How would you do this proof with types?

Well, if you know anonymous function, it should be easy to understand what happens. Functions are first-class objects here. Q is a procedure that takes an arbitrary procedure. It's not that you run the procedure. In fact, it's another way around, you want to say something about the source code of the function, not the result of applying it.

Re: Scooping the Loop Snooper (2000)

#15
Pullum keeps a slightly updated version of this poem on his website: http://www.lel.ed.ac.uk/~gpullum/loopsnoop.html

It adjusts the phrasing in a few places to make the meter flow more naturally. Apparently it also fixes a small error in the original proof, which, for the life of me, I cannot find.

I've used this poem to teach the halting problem to a variety of people for almost a decade and a half. Reading the one linked here just didn't sound right.

Re: Scooping the Loop Snooper (2000)

#16
post #6

assuming unbounded time and memory. not being pedantic. you can exhaustively enumerate all inputs for a program. tautologically self-references aside, axiomatically, yes, we can determine if a program will halt, if it has a finite amount of time, or memory. if it doesn't [have unbounded range], then it must [terminate], but it is very, very, very hard to determine if that is the case. but not impossible. and this nua…

That's correct. With determinism and finite memory, you must eventually either repeat a previous state, or halt.

This is useful. Verifiers which work by symbolic execution examine large numbers of cases they work through the control flow. Each case can contain a large number of states; you only need one case for each control flow pattern. Now, some programs run into combinatorial explosion when you do that. The number of cases to be examined grows rapidly. That means halting detection is NP-hard, not impossible. There's a difference.

The Microsoft Static Driver Verifier operates on the assumption that if symbolic execution doesn't terminate after a reasonable amount of automatic analysis, your driver doesn't get to run in the kernel. This is a good, practical solution.

Re: Scooping the Loop Snooper (2000)

#17
post #13

I don’t follow this proof. If Q takes an executable program, then Q(x) is executable, but Q alone isn’t. So you can ask questions about Q(Q(x)), but Q(Q) shouldn’t type check, as the inner Q isn’t executable without an argument. Am I being dumb? How would you do this proof with types?

Define P(A, S) as the function that takes as input an algorithm A and a string S and returns true if A(S) halts, and false if A(S) does not halt. The claim is that P does not exist. Assume P exists, let Q(S) be the function that takes a string S and halts if P(Q, S) returns false, otherwise it loops forever. Q(S) is not some whacky function either, in TypeScript it could be implemented as follows: function P(A: (S: s…

Ah, thanks for spelling it out with the typescript. That’s clearer to me now!

Re: Scooping the Loop Snooper (2000)

#19
post #15

Pullum keeps a slightly updated version of this poem on his website: http://www.lel.ed.ac.uk/~gpullum/loopsnoop.html It adjusts the phrasing in a few places to make the meter flow more naturally. Apparently it also fixes a small error in the original proof, which, for the life of me, I cannot find. I've used this poem to teach the halting problem to a variety of people for almost a decade and a half. Reading the one…

Ok, changed to that from https://www.cs.rice.edu/~vardi/comp409/scooping.pdf. Thanks!

Re: Scooping the Loop Snooper (2000)

#20
Godel's theorem and the halting problem began as having difficult and obscure proofs. Today, you can find "one page" proofs of either. And these proofs depend strongly on a variety of computation processes going from obscure to obvious for the average person.

Is it "obvious" you can produce program Y that doesn't halt if program X halts? Do you understand one program can be taken as input string of another? If so, the Halting Problem proof in Sudkamp's Languages and Machines, my undergraduate text in the 90s, can indeed take just a page.

Post reply on HN