crashOnString
is UncomputableSeptember 15, 2025
Computability theory explores what problems can or cannot be solved by algorithms, so if a problem cannot be solved by algorithms, it is uncomputable
crashOnString determines, given an input string and a program, whether it will crash or not.
At first glance, this seems possible; however, by building self-referential programs, we will prove that this creates contradictions.
This approach connects “crashOnString” directly to the Halting Problem; therefore, it is uncomputable.
Book Figure
crashOnString
takes as input a program and a string and then deterimes whether or not that program crashes on that stringcrashOnSelf
from crashOnString import crashOnString
def crashOnSelf(progString):
return crashOnString(progString, progString)
crashOnSelf
takes as input a program and deterimes whether or not that program crashes when run on itselfweirdCrashOnSelf
from crashOnSelf import crashOnSelf
def weirdCrashOnSelf(progString):
val = crashOnSelf(progString)
if (val == 'yes'):
return 'did not crash!'
else:
# deliberately crash (divide by zero)
x = 1 / 0
weirdCrashOnSelf
takes an input program and then deterimes whether or not it crashes using crash on selfcrashOnString
is uncomputablecrashOnString
can be proven to be uncomputable through contradiction using weirdCrashOnSelf
weirdCrashOnSelf
takes itself as an input there are only two possiblities
weirdCrashOnSelf
isn’t possiblecrashOnString
is possible. Then we could use it to write both crashOnSelf
and weirdCrashOnSelf
. Although, we know weirdCrashOnSelf
is impossible therefore our assumption isn’t correct and crashOnString
must also be impossibleweirdCrashOnSelf
is impossible and causes a contradiction with crashOnString
crashOnString
is uncomputable (and untractable)weirdCrashOnSelf
takes itself as an input it creates a contradiction with crashOnString
Proofgrammers