This week we discuss that there are some problems in the world that can not solved by algorithms. That is there are uncomputable problems existed for any reasonable computational model. Consider the following halting problem:
def half(f,i) :
'''return True iff f(i) eventually halts''
we are told that this halt function can not to be implemented. Here is the proof:
assume halt exist.and there are such function exist below:
def confuse(f):
def halt(f,i):
#some code here
if halt(f,f):
while True:
pass
else:
return False
we first assume confuse(confuse) halts, then halt(confuse,confuse) is True, then we enter the infinite while loop.
Therefore, we assume confuse(confuse) halts , but got the result of not half
we then assume confuse(confuse) doesn't halts, then we enter the else, which return False.
once again we assume confuse(confuse) doesn't halts but it halts.
so no matter which case we consider, we got the contradiction, that is halt doesn't exist.
Your explanation on halting function is very nice. Great work!
ReplyDelete