I'm taking a theoretical CS class and we just discussed the halting problem. In my understanding, the reason that the problem cannot be solved is that if there is a program Halt that tells us whether a not a program halts, and you write another program Proof such that
function Proof (program, input)
if (Halt(program, input)) loop infinitely;
else return 1
To me, the crux of the problem is that the if condition is for the program to loop infinitely, which is the fail condition for Halt.
This is the part I am not sure about:
Say you had a program to check if another program returns the number 4 on a certain input. Let's call this program FourCheck. Then, we could write another program ProofFour such that
ProofFour(program, input)
if(FourCheck(program, input) return 5;
else return 4;
In this case, we could call ProofFour(ProofFour,input). If FourCheck() returns true, then ProofFour returns 5, making FourCheck()'s output incorrect. If FourCheck returns false, then ProofFour returns 4, again making FourCheck()'s output incorrect.
Hence, would it be correct to assume that you could essentially have no program to check other programs, because you could always construct a program similar to Proof() and ProofFour() that essentially inverts the output of your checker program.