Created
December 28, 2011 04:56
-
-
Save trafnar/1526386 to your computer and use it in GitHub Desktop.
Halting problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doesProgramHalt = (program) -> | |
if halts(program) == true | |
return true | |
else | |
return false | |
q = (program) -> | |
if doesProgramHalt(program) | |
return | |
else | |
q(program) | |
a = () -> | |
print "hello world" | |
b = () -> | |
while(1) | |
print "hello world" | |
q(a) # -> true | |
q(b) # -> infinite loop - no return value | |
q(q) # -> universe explodes (paradox which proves doesProgramHalt() cannot exist) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment