Fair Termination and Ha rel’s Theorem 269
s |= ρ) if some resource associated with ρ,whateveritmaybe,isbeing
requested. We think of σ as expressing the condition that the request has
been satisfied.
An infinite computation path is unfair with respect to the fairness con-
dition (ρ, σ)ifρ is true infinitely often along the path but σ is true only
finitely often. This models the idea that a request is made infinitely often
along the path, but from some point on is never satisfied. The path is unfair
with respect to a set of fairness conditions if it is unfair with respect to
any one of them. (Notice the similarity to the Rabin acceptance condition
for automata on infinite strings; see Lecture 26.) A path is fair if it is not
unfair. By our definition, all finite paths are fair.
A (nondeterministic) computation is fairly terminating if there are no
infinite fair paths; equivalently, if all infinite paths are unfair. Intuitively,
we do not care if the computation tree contains infinite paths as long as
they are unfair, because a fair scheduler would never allow them to occur
anyway.
In our example (41.1) above, let be the statement in the body of the
while loop. Maintain in the state an extra bit telling whether the left or the
right branch was taken the last time was executed. Let ρ be the property,
“about to execute ”, and let σ
0
(respectively, σ
1
) be the property, “the
left (respectively, right) branch was taken the last time was executed”.
Consider the fairness conditions (ρ, σ
0
)and(ρ, σ
1
). The program terminates
fairly with respect to these conditions, because any computation path that
satisfies both σ
0
and σ
1
sufficiently many times eventually satisfies the
condition for exiting the while loop.
Proof Rules for Fair Termination
There is a rather large literature on fairness and fair termination (see [44]
and references therein). Much of that work was devoted to deriving proof
rules for establishing correctness and termination in various logical for-
malisms and under various fairness assumptions. A central notion is the
idea of helpful directions that move a computation toward termination.
This notion ultimately reduces to well-foundedness, but is not simply a de-
crease of an integer parameter. It was observed that transfinite induction
on ordinals higher than ω was necessary in general.
Harel’s Theorem
The situation was significantly clarified in 1986 by Harel [52]. He showed
that fair termination of finitely branching recursive trees is equivalent to
the well-foundedness of countably branching recursive trees. Because decid-
ing well-foundedness of countably branching recursive trees is Π
1
1
-complete