4 ms·
Sorry to say, this example has nothing to do with the halting problem. Rather, I would say, it's a reformulation of a(n unsolved) mathematical problem to the qu
by dzsekijo 6y ago
Sorry to say, this example has nothing to do with the halting problem. Rather, I would say, it's a reformulation of a(n unsolved) mathematical problem to the question whether a certain function halts on a certain input (being "no input", as the function is nullary). Or, if you insist, we can regard it as a trivial instance of the halting problem.
An instance of the halting problem asks, given (a partial recursive) function F, whether there is an decision algorithm A (aka. Boolean valued algorithm) on the universe of inputs U of F that calculates the domain of F (those inputs where F takes a value, ie. halts; ie, A(x) <=> F halts on x, where x in U).
For any finite subset S = {s_1, ..., s_n} of U, there is a trivial decision algorithm on U that calculates S:
def A_S(x):
for s in (s_1, ..., s_n):
if x == s:
return True
return False
Therefore if the domain D of F is finite, the answer to the halting problem of F is trivially yes: A_D is a decision algorithm for F. (This has noting to do with the question whether we know D or not!)
If U is finite, then D is finite, so the answer to the halting problem of F is trivially yes.
If F is a thunk (nullary function), then U is finite, ie. the singleton set of "no input", so the answer to the halting problem of F is trivially yes.
odd_perfect_number is a thunk.
- tom_mellior 6y ago> An instance of the halting problem asks, given (a partial recursive) function F, whether there is an decision algorithm A > so the answer to the halting problem of F is trivially yes. The answer is "yes, there is a decision algorithm"? What would that decision algorithm be for this particular function (odd_perfect_number)? And what is its answer?
- dzsekijo 6y ago> The answer is "yes, there is a decision algorithm"? Indeed. > What would that decision algorithm be for this particular function (odd_perfect_number)? Either of () => True or () => False where '()' represents the empty input. > And what is its answer? I'd be a Fields medal candidate if I knew ;)