Decidability & Computability



Shared context
Assume a total, correct procedure HALTS(f,x) reports whether f(x) terminates. Define FUNNY(f)=IF HALTS(f,f) THEN NOT(f(f)) ELSE TRUE. Use termination of FUNNY to prove by contradiction that no such total correct HALTS exists.
Answer & solution
Answer: FUNNY(FUNNY) would return the negation of its own Boolean result. (no official key was published)
Assume HALTS exists as a computable, always-terminating correct decision procedure. Then the definition constructs a computable FUNNY, and part (a) shows that FUNNY terminates on every program description, including its own. Consequently HALTS(FUNNY,FUNNY) must return TRUE.
Let b be the Boolean returned by FUNNY(FUNNY). Following its definition and the TRUE answer, the same call must return NOT(FUNNY(FUNNY)), namely NOT b. This implies b=NOT b. Neither Boolean value satisfies this equation: TRUE would have to be FALSE and FALSE would have to be TRUE.
There is also an operational view: the TRUE branch invokes the identical FUNNY(FUNNY) call again before it can negate the result, producing unending recursion, contradicting the termination guaranteed by part (a). Either explanation refutes the initial assumption. Therefore no algorithm decides halting for arbitrary programs and inputs. Assuming a function can accept its own encoded description is standard for general-purpose programs; restricting output to Booleans does not avoid the contradiction.