So, I'm a CS grad, class of '03. I know that the following program cannot exist:
- Code: Select all
H(P,I) => "Y" if P terminates on input I
=> "N" if P never terminates on input I
Because the following program does the opposite of what H says it does, invalidating the existence of H(P,I) via reductio ad absurdum:
- Code: Select all
T(P) => LOOP() if H(P,P)
But something's been plaguing me for years now. What if we tweaked the requirements of the above program thus (I'll call it the Relaxed Halting Problem)?
- Code: Select all
H(P,I) => "Y" or "?" if P terminates on input I
=> "N" or "?" if P never terminates on input I
It's trivial to show such a program exists:
- Code: Select all
H(P,I) => "?"
Of course, I also know that a general algorithm that detects whether such a program is correct can be reduced to the halting problem, and is therefore also undecidable.
But lately I've been wondering about how complete a correct implementation can be written and manually verified. Here are a few implementations that are obviously correct:
- Code: Select all
H(P,I) => "?" if P has loops or recursion, including nested recursion
=> "N" if P has obviously infinite loops, e.g. while(1)
=> "Y" otherwise
- Code: Select all
H(P,I) => "Y" if P terminates after 1000 steps of simulation
=> "?" otherwise
I've thought about the possibility of "everything" variables that you could use in a simulation in order to to whittle down valid inputs and possible outcomes in order to deduce, among other things, loops that are more complex than just while(1).
My thinking is that, while not a complete HP solution, such a tool, being sufficiently well-featured, could be useful in catching potential programming errors. My gut instinct, however, tells me that if such a program could be useful, someone smarter than me would have thought of it and built it already. Moreover, I've not been able to come up with anything more substantive than these musings. Is this because of a fundamental limit on what answers this type of program can provide? Are there proofs of this? I seriously doubt I'm the first person to propose such a modification.
Thoughts?
