Halting Problem
Or rather a variation of it called “the acceptance problem”. Suppose we have a program P and we want to know that P accepts or correctly computes some input i. Let H(P,i) be a program that tells us whether a program P accepts input i. Thus:
- H(P,i) returns
truewhen when P accepts i.- H(P,i) returns
falsewhen when P does not accept i.Let be [P] be an encoding of program P (that is, the “code” of P). Running H(P,[P]) tells us whether P accepts itself as input.
Next, let D([P]) be a program that runs H(P,[P]) as a subroutine but returns the opposite of H. Thus, D returns
falsewhen P accepts its encoding [P] as input and returnstruewhen P does not accept itself as input.Now, Run D([D])—that is, run D with its encoding as input:
- D([D]) returns
truewhen H(D,[D]) returnsfalseand H(D,[D]) returnsfalsewhen D([D]) returnsfalse.
- So, D([D]) returns
truewhen D([D]) returnsfalse.- D([D]) returns
falsewhen H(D,[D]) returnstrueand H(D,[D]) returnstruewhen D([D]) returnstrue.
- So, D([D]) returns
falsewhen D([D]) returnstrue.Due to the obvious contradiction, neither programs D nor H can exist. I hope I got that right.
Also, this is hell.
Also, who cares? “What are the civilian applications?”