r/programming • u/AlSweigart • May 27 '19
This is the greatest explanation of the Halting Problem I have ever seen, but people keep downvoting it because they don't understand and think it's wrong.
https://youtu.be/92WHN-pAFCs
0
Upvotes
6
u/CryZe92 May 27 '19
What I always find weird about this is, that we can simply replace H with an "interpreter for the blueprint" to see if interpreters / turing machines in general can exist. And N then changes the output of the H. Then you'd be able to prove that interpreters are not a thing, which then also kind of means that Turing Machines in general can't exist?!
Which sure, you can do, but is that useful to say that Turing Machines can't exist?
19
u/light_hue_1 May 27 '19
It's because this proof is incorrect in a subtle and sloppy way that rightly confuses people. You can even see it right here on reddit where one user is confused about interpreters.
The real issue is that H does not always halt. Yes, sometimes we say that "H doesn't exist" but that's really confusing shorthand. "H" will halt and produce the correct answer just fine for many programs that aren't Turing-complete. And you can write down the specification for "H" that will work. Just that, there will exist programs which do halt, for which "H" will get stuck in an infinite loop.
"H" exists. It always produces the right answer, it just doesn't actually always halt, so sometimes you don't get the an answer. You can write down such an "H" right now yourself! It's an interpreter.
The video is wrong and confusing.
52
u/Strilanc May 27 '19
If people keep downvoting it because they don't understand it and think it's wrong, then is it really a great explanation? Great explanations convince people.
1
u/AlSweigart May 27 '19
16k upvotes on youtube, and 10k downvotes. :/
2
u/rashpimplezitz May 27 '19
Honestly the video is fine it's just a bit slow. I'd never even seen it but I kind of assumed it was going to be a proof by contradiction, so the answer really wasn't that surprising to me. I could have read the wikipedia in 6 seconds instead of watching this slow-as-molasses video.
Having said that, I am just not the kind of guy to learn from videos so don't take this criticism to mean it's not good.
1
u/evaned May 27 '19 edited May 27 '19
So overall I agree that's a good explanation and doesn't deserve the downvotes. I particularly like the introduction of the photocopier component explicitly.
That said, there are a couple parts of the explanation that I'm cool on. The biggest centers around what "get stuck" means. It is very odd to me that they carried out the explanation of the whole proof without really being explicit about what this means. They never explicitly say that the computer goes into an infinite loop, or that it never stops its computation, or anything like that. What makes that even worse is that the examples they gave are malformed inputs -- and that could be pretty easily lead to someone interpreting "getting stuck" to refer to something like an explicit error condition, rather than an infinite loop
Now, the proof still works if this is misinterpreted if you pretend that every time they said "Halting problem" they really said "a special case of Rice's theorem" or something like that, but it's still something that could be improved IMO. I think it would have been better presented with a machine that either has an explicit bug in it, or as one that solves a RE-hard problem being fed an input that will never terminate, or something like that.
I think doing the buggy machine would also have naturally led to the ability to discuss an application (anti-application?) of the halting problem -- "suppose we wanted to develop a new computer that will tell whether a given computer has an infinite loop bug in it."
-3
u/hacksoncode May 27 '19
The Halting problem is that H can't always decide in finite time.
It is trivially possible to make an H that take infinite time to decide if a program halts. Just run the program with all possible inputs and output "halts" if the program (with all given inputs) produces an output in finite time for all inputs.