Let's say that there is a standard code-golf question where you:
- Have to find a solution that satisfies some constraints (eg. a math equation, etc.)
- Or, if a solution doesn't exist, output the nonexistence of a solution (by erroring, returning -1, etc.)
- There are no explicitly stated limits to the "size" of the solution.
Is it valid to submit an answer, which aside from complications raising from resource exhaustion, is a semi-decision algorithm, and then utilize a recursion/memory limit to detect cases when there is no solution?
A semi-decision algorithm is an algorithm which is able to find a solution if it exists, but if a solution doesn't exists, it will go in an infinite loop.
For example, if the task was to find an integer solution for a polynomial equation \$ax^2+bxy+c=0\$, a semi-decision algorithm would try all possible combinations of \$x\$ and \$y\$, until it finds a solution. If a solution exists, this algorithm will terminate and return the solution. But, if no solution exists, the algorithm will go on forever, never returning anything.
Now is it valid to take that semi-decision algorithm, implement it in a language which has the ability to handle recursion limits, and then say that if a solution doesn't exist, a recursion-limit error is returned, and thus the submission satisfies the rules?
Background
This question has some semi-decision algorithms as answers.