Wikipedia has a proof that every loop that terminates has a loop variant—a well-founded relation on the state space such that each iteration of the loop results in a state that is less than the previous iteration's state under the relation. Here, well-founded refers to the usual classical definition of a well-founded relation: every nonempty subset has a minimal element.
The proof given in the linked article is as follows:
- Let the loop variant be the "iteration" relation, i.e. the reflexive transitive closure of the transition relation.
- Since the loop always terminates, the loop variant has no infinite descending chains.
- Apply the axiom of choice to conclude that the loop variant is well-founded.
My question is about step 3. Using the full, uncountable axiom of choice here feels like swatting a fly with an atom bomb. Elsewhere on Wikipedia, we have the following:
Equivalently, assuming the axiom of dependent choice, a relation is well-founded if it contains no countable infinite descending chains: that is, there is no infinite sequence $x_0, x_1, x_2, \dots$ of elements of $X$ such that $x_{n+1}\ R\ x_n$ for every natural number $n$.
So the much weaker axiom of dependent choice is sufficient.
It seems like it might be possible to weaken this assumption further. The state space of a computer program is not an arbitrary set from the entire Von Neumann universe of ZF. Maybe countable choice suffices, since the state space of any program is countable?
On the other hand, if dependent choice is required and countable choice will not suffice, then (assuming ZF is consistent) there must exist a model of ZF + countable choice where there is some program that (a) always terminates, (b) has an iteration relation with no infinite descending chains, yet (c) has no well-founded loop variant. This seems deeply weird.
My question is:
- Is there a model of ZF where a program always terminates but has no loop variant?
- If the answer to 1 is yes, then what is the weakest choice principle that, when added to ZF, changes the answer to no?
- If the answer to 1 is yes, is it possible to write down an explicit example of such a program (a la Harvey Friedman's explicit formulas equivalent to the strengths of ordinals), or does such a program necessarily correspond to a non-standard natural number?