Solution of Church's Problem - A Tutorial
Solution of Church's Problem - A Tutorial
Wolfgang Thomas
1 Lehrstuhl Informatik 7
RWTH Aachen University
52074 Aachen, Germany
[email protected]
Abstract
Church’s Problem (1957) asks for the construction of a finite-state
procedure that transforms any input sequence α letter by letter into
an output sequence β such that the pair (α, β) satisfies a given spec-
ification. Even after the solution by Büchi and Landweber in 1969
(for specifications in monadic second-order logic over the structure
(N, +1)), the problem has stimulated research in automata theory
for decades, in recent years mainly in the algorithmic study of infi-
nite games. We present a modern solution which proceeds in several
stages (each of them of moderate difficulty) and provides additional
insight into the structure of the synthesized finite-state transducers.
1 Introduction
Fifty years ago, during the “Summer Institute of Symbolic Logic” at Cornell
University in 1957, Alonzo Church considered in [3] a problem which is both
simply stated and fundamental.
Imagine a scenario in which an infinite bit stream α is to be transformed,
bit by bit, into an infinite stream β, as indicated in the following figure.
output input
β = 11010 . . . α = 01101 . . .
1. ∀t(α(t) = 1 → β(t) = 1)
2. ¬∃t β(t) = β(t + 1) = 0
3. ∃ω t α(t) = 0 → ∃ω t β(t) = 0
The first two conditions are satisfied easily by producing output 1 at each
moment. But the last condition, which has the form of a fairness constraint,
excludes this simple solution; we cannot ignore the zero bits in α. A natural
idea is to alternate between outputs 0 and 1 if the inputs are only 0. We
arrive at the following procedure:
1/1
last 0/1 last
output output 1/1
0 1
0/0
Church’s Problem 3
consider the automaton as a referee who watches the play evolving between
players A and B that consists of the two sequences α and β (logically speak-
ing: of the set tuple (P α , Qα ) built up by A and B), and who decides at
infinity (by the acceptance condition) whether B has won or not.
An appropriate acceptance condition is the so-called Muller condition. It
is specified by a collection F = {F1 , . . . , Fk } of state sets, and the automaton
accepts an ω-word γ if the set of the states visited infinitely often in the
unique infinite run on γ is one of the Fi . (The sets Fi are called accepting
loops; indeed, if the states in Fi are visited again and again they form a
strongly connected set (“loop”) in the transition graph of the automaton.)
We use here two core results of the theory of ω-automata due to Büchi [1]
and McNaughton [10] (see e.g. [19] or [7] for more recent expositions). They
allow to translate an S1S-formula into an equivalent (non-deterministic)
Büchi automaton, which is then transformed into a deterministic Muller
automaton: For each S1S-formula ϕ(X, Y ) one can construct an equivalent
Muller automaton Aϕ . As a drawback in this result we mention that the
size of Aϕ cannot be bounded by an elementary function in the length n of
ϕ (see, e.g., [7]); in other words, for no k, the k-fold iteration of the function
n 7→ 2n can serve as an upper bound for the size of Aϕ .
Let us illustrate the theorem for our example specification above. The
formula ∀t(α(t) = 1 → β(t) = 1) is equivalent to the Muller automaton
1 0 ∗
1 ∗ ∗
1
0
1 2
with accepting loop {1} only (and where ∗ stands for an arbitrary bit).
The formula ¬∃tβ(t) = β(t + 1) = 0 is expressed by the following Muller
automaton with accepting loops {1} and {1, 2}:
∗ ∗
1 ∗
∗
∗
0 0
1 2 3
∗
1
as initial state. From each state we have, for each bit pair (b1 , b2 ), a transi-
tion labelled (b1 , b2 ) to the state (b1 , b2 ). A set F is accepting if it satisfies
the following condition: If the first component is 0 in some state of F , then
the second component is 0 for some (possibly different) state of F .
It is known how to combine Muller automata for several conditions to
a single Muller automaton for their conjunction. We do not present it
explicitly here for our example. Rather we turn to a variant, called “finite-
state game with Muller winning condition”. This approach, introduced by
McNaughton [11], is motivated by the view that the two components of an
input letter of the Muller automaton are contributed by two players A and
B who pursue antagonistic objectives: A aims at violating the condition ϕ
and B at satisfying it.
• 0 1
0 1
0 1
0 1
1 0
0 1 0 1
• • • •
Note that we keep every state of the Muller automaton as an A-state. For
each A-state q and bit b, we introduce a b-labelled transition to a new state
called (q, b), and from (q, b) for each bit c a c-labelled transition to the state p
which was reached from q by cb in the original automaton. For such a state
p we call c the corresponding “output bit”, denoted out(q, b, p). (If both c-
transitions from (q, b) lead to the same state p we agree that out(q, b, p) = 0.)
If the input alphabet is {0, 1}m1 and the output alphabet {0, 1}m2 , we
introduce B-states (q, b) with b ∈ {0, 1}m1 , and define out(q, b, p) as a vector
in {0, 1}m2 .
The result is a “game graph”. For our example specification above, we
can obtain the following game graph from a corresponding Muller automa-
ton (the reader should ignore for the moment the boldface notation of some
arrows).
8 W. Thomas
1 0 0, 1
1 2 6 7
1 1 0, 1
1 0
3 4 0
0
0
1 5
Up to names of states (and the irrelevant initial state), this is precisely the
Mealy automaton mentioned in the Introduction.
In the remainder of the paper, we shall give a general construction that
starts with a finite game graph equipped with a Muller winning condition,
provides the decision whether player B wins, and in this case yields a finite-
Church’s Problem 9
Inf(ρ) := {q ∈ Q | ∃ω i ρ(i) = q}
Occ(ρ) := {q ∈ Q | ∃i ρ(i) = q}
1 2 3
7 5 6
The reachability game (G1 , {3}) with “goal set” F = {3} is won by
player B if the play starts in state 3. Otherwise player A can avoid this
state by going from 2 to 5 and from 6 to 4. We shall say that the winning
region of player A in this game is the set {1, 2, 4, 5, 6, 7} and that of player
B the set {3}. As a second example, consider the condition that states 2
and 7 both have to be visited again and again. Formally, this is the Muller
game (G1 , F) where F consists of all sets R ⊇ {2, 7}. Obviously, player B
can win from any state: From 1 he proceeds to 2 and to 7 in alternation,
from 5 he moves to 6, and from 3 to 4. So the winning region of A is empty
in this case, and that of B the set of all states. Note that switching between
the moves from 1 to 2 and from 1 to 7 means to use memory (here only one
bit) when executing the strategy.
Formally, a strategy for player B from q is a function f : Q+ → Q,
specifying for any play prefix q0 . . . qk with q0 = q and qk ∈ QB some vertex
r ∈ Q with (qk , r) ∈ E (otherwise the value of f is chosen arbitrarily).
A play ρ = q0 q1 . . . from q0 = q is played according to strategy f if for
each qi ∈ QB we have qi+1 = f (q0 . . . qi ). A strategy f for player B from
q is called winning strategy for player B from q if any play from q which
is played according to f is won by player B. In the analogous way, one
introduces strategies and winning strategies for player A. We say that A
(resp. B) wins from q if A (resp. B) has a winning strategy from q.
For a game (G, W ) with G = (Q, QA , E), the winning regions of players
A and B are the sets WA := {q ∈ Q | A wins from q} and WB := {q ∈
Q | B wins from q}. It is obvious that a state cannot belong to both WA
and WB ; so the winning regions WA , WB are disjoint. But whether these
sets exhaust the whole game graph is a more delicate question. One calls
a game determined if WA ∪ WB = Q, i.e. from each vertex one of the two
players has a winning strategy. Determinacy of infinite games is a central
topic in descriptive set theory; with the axiom of choice one can construct
games that are not determined. For the games considered in this paper
(i.e. games defined in terms of the operators Occ and Inf), determinacy
12 W. Thomas
1 2 3
• Q′ = S × Q, Q′A = S × QA ,
• ((r, p), (s, q)) ∈ E ′ iff (p, q) ∈ E and δ(r, p) = s (which means that a
play ρ = q0 q1 . . . in G induces the play ρ′ = (s0 , q0 )(δ(s0 , q0 ), q1 ) . . .
over G′ ),
Church’s Problem 17
We apply this remark for the concrete simulation of weak Muller games
by weak parity games mentioned above. We show “positional determinacy”
for weak parity games and thus – by the preceding remark – finish the proof
of part (a) of Theorem 3.1, concerning weak Muller games.
Theorem 4.4. A weak parity game (G, c) is determined, and one can com-
pute the winning regions WA , WB and also construct corresponding posi-
tional winning strategies for the players A and B.
Proof. Let G = (Q, QA , E) be a game graph (we do not refer to the special
graph G′ above), c : Q → {0, . . . , k} a coloring (w.l.o.g. k even). Set
Ci = {q ∈ Q | c(q) = i}.
We first compute the attractor for B of the states with maximal color,
which is even. When player B reaches such a state the play is won whatever
happens later. So Ak := AttrB (Ck ) is a part of the winning region of player
B.
18 W. Thomas
The remaining nodes form the set Q \ Ak ; this is again a game graph.
Note that from each state q in Q \ Ak there is at least one edge back to
Q \ Ak , otherwise (as seen by case distinction whether q ∈ QA or q ∈ QB )
q would belong to Ak = AttrB (Ck ).
In the subgame induced by Q \ Ak , we compute Ak−1 := AttrA (Ck−1 \
Ak ); from these vertices player A can reach the highest odd color k − 1 and
guarantee to stay away from Ak , in the same way as explained above for
reachability games (see Section 4.1).
In both sets we can single out positional winning strategies, over Ak
for B, and over Ak−1 for A. In this way we continue to adjoin “slices” of
the game graph to the winning regions of B and A in alternation. The
next set Ak−2 is the set of all states q ∈ Q \ (Ak−1 ∪ Ak ) from which
player B can force the play to Ck−2 \ (Ak−1 ∪ Ak ). We denote this set by
Q\(A ∪A )
AttrB k−1 k (Ck−2 \ (Ak−1 ∪ Ak )). The exponent indicates the set of
states that induces the subgame in which the attractor computation takes
place. In order to facilitate the notation for the general case, set Qi :=
Q \ (Ai+1 ∪ . . . ∪ Ak ).
So we compute the sets Ak , Ak−1 , . . . , A0 inductively as follows:
Ak := AttrB (Ck )
Q
Ak−1 := AttrAk−1 (Ck−1 \ Ak )
and for i = k − 2, . . . , 0:
(
AttrQ
B (Ci \ (Ai+1 ∪ . . . ∪ Ak ))
i
if i even
Ai :=
AttrQ
A (Ci \ (Ai+1 ∪ . . . ∪ Ak ))
i
if i odd
The positional strategies for A and B are chosen as explained for the
initial cases Ak , Ak−1 . Now we have
[ [
WB = Ai and WA = Ai
i even i odd
Returning to the solution of weak Muller games, we first note that the
claim of Theorem 3.1(a) on the memory size of a finite-state winning strat-
egy (2n memory states over a game graph with n states) is clear from the
Church’s Problem 19
the name “latest appearance record” (LAR) under which the structure is
known today.
Let us study an example. Suppose player A picks successively the letter-
states A, C, C, D, B, D, C, D, D, . . .. We note this sequence on the left, and
the associated sequence of latest appearance records on the right:
Now assume that player A indeed sticks to the states C and D and
repeats these two infinitely often. Then the states A and B will finally stay
on the last two LAR-positions and not be touched anymore. Thus the hit
value will be only 1 or 2 from some point onwards, and the maximal hit
value visited infinitely often will be 2. In fact, if only position 1 is underlined
from some point onwards, then only the same letter would be chosen from
that point onwards (and not two states C and D as assumed).
We conclude that player B should always move to the number state
named by the current hit value. In the scenario mentioned, this would
mean to move finally only to states 1 or 2, and to 2 infinitely often. If at
some point player A would decide to go to one state only, this state would
be repeated at the head of the LAR and underlined; so the maximal hit
value visited infinitely often would be 1 (and correct again).
We leave it to the reader to show that “to move to the number given
by the current hit value” is a winning strategy of player B in the game (see
also Remark 5.1 below). Since the required memory is finite and the update
rule is defined in terms of the previous LAR and the current state, this is a
finite-state winning strategy.
The example suggests a solution of Muller games in very close analogy to
the case of weak Muller games, using the latest appearance record in place
of the appearance record. We shall introduce the LAR-structure in general
(i.e., we take it to cover all states of the game graph under consideration
and not only a subset, such as the letter-states in our example). From each
LAR we extract an “index”. Whereas in an appearance record we referred
to its cardinality, we use the hit value for a LAR. Then we introduce the
“parity condition” (a variant of the weak parity condition) as new winning
Church’s Problem 21
Proof. Consider the point in ρ from where no new states will occur and
where all visits of states that are visited only finitely often are completed.
After a further visit of each state in Inf(ρ), these states will stay at the head
of the LAR’s (in various orders), and the hit values will be ≤ k := |Inf(ρ)|.
It remains to show that the hit value in ρ′ reaches k again and again (so
that k is the maximal hit occurring infnitely often in ρ′ ). If the hit was
< k from some point onwards, the state q listed on position k would not be
visited later and thus not be in Inf(ρ). q.e.d.
Using the remark, we can reformulate the Muller winning condition for
the play ρ: The hit set for the highest hit occurring infinitely often in ρ′
belongs to F. This allows us to extract two data from the LAR’s which are
sufficient to decide whether the play ρ satisfies the Muller condition: the
hit value and the information whether the corresponding hit set belongs to
F. We combine these two data in the definition of a coloring of the LAR’s.
22 W. Thomas
The pair (G, c) with this convention for the winning condition for player B
is called a parity game.
Similar to the case of weak Muller games, one can set up a game simula-
tion of a Muller game (G, F) by a parity game (G′ , c): We use the finite-state
machine S introduced before that transforms a given play ρ over G into the
corresponding sequence ρ′ of LAR’s (realized in the states visited by S),
and we use the coloring c defined above. The game graph G′ is fixed as in
Section 4.3 above, using the new machine S. We obtain the game simulation
(G, F) ≤S (G′ , c) where (G′ , c) is a parity game.
Remark 5.2. There is a variant of S in which some of the states are spared.
We cancel the initial LAR’s (corresponding to hit value 0), starting (over
states 1, . . . , n) with the LAR ((1 . . . n), 1) rather than (( ), 0), and keeping
the update rule as before. With this change, one cannot distinguish between
first and repeated visits of states, but clearly this loss of information is
inessential for the satisfaction of the winning condition. The number of
states of the reduced machine is then n! · n over a graph with n states.
Theorem 5.3. A parity game (G, c) is determined, and one can compute
the winning regions WA , WB and also construct corresponding positional
winning strategies for the players A and B.
Church’s Problem 23
Let us first verify that one of the two cases applies (which gives a kind of
local determinacy). Assume Case 1 fails. If q ∈ QB , then all transitions
from q have to go to UA , otherwise we would be in Case 1. By the same
reason, if q ∈ QA , then some transition from q goes to UA ; so Case 2 applies.
In Case 1, one shows WB = UB ∪AttrB ({q}) and WA = UA , applying the
positional strategies of the induction hypothesis over UA , UB , the attractor
strategy over AttrB ({q}), and (if q ∈ QB ) the choice of the next state from q
according to Case 1. For the first claim, note that a play in UB ∪AttrB ({q})
either remains in UB from some point onwards, whence Player B wins by
induction hypothesis, or it visits (by choice of player A) the attractor A0 and
hence q again and again, so that player B wins by seeing the highest color
(even!) repeatedly. The second claim WA = UA is now clear by induction
hypothesis.
We turn to Case 2. In this case we know that q ∈ AttrA (UA ) and
consider the set A1 = AttrA (UA ∪ {q}), clearly of cardinality ≥ 1. So we
can apply the induction hypothesis to the subgame induced by Q \ A1 . We
obtain a partition of this domain into winning regions VA , VB for A and B,
with corresponding positional winning strategies. Now it is easy to verify
WB = VB and WA = VA ∪ A1 , with positional winning strategies again
provided by the induction hypothesis and the attractor strategy over A1 .
Finally we note that the inductive construction can be turned to a re-
cursive procedure which produces, given G and the coloring c, the desired
winning regions and positional strategies. q.e.d.
6 Conclusion
Let us recall the three major steps for a solution of Church’s Problem:
First we relied on a translation from the logic S1S to Muller automata,
which were then changed into game graphs with Muller winning condition.
From Muller games we constructed parity games via the LAR structure;
and finally we presented a solution of parity games. All three steps are
nontrivial. As mentioned, the first step involves a non-elementary blow-up
(from length of formula to size of automaton). For each of the other two
steps, an exponential time procedure was presented; a direct construction
is possible, however, resulting in a single exponential altogether (see [20]).
On the other hand, our two-step approach showed that finite-state winning
strategies for a Muller game over a graph G can be constructed with a
transition structure that depends on G alone, and that only for the output
function the winning condition has to be invoked.
Church’s Problem and its solution were the starting point for a highly
active area of research in computer science, first restricted to pure automata
theory, but in the last 20 years with a great influence in algorithmic ver-
ification and program synthesis. A problem in current research is to find
classes of infinite game graphs over which games with MSO-definable win-
ning conditions can still be solved algorithmically. Some results (on so-called
pushdown graphs) are mentioned in [7]. Another direction is to modify or
to generalize the specification language in Church’s Problem (see e.g. [17]).
In a wider context, more general models of games are studied, for instance
“concurrent games” (where the two players move simultaneously), “timed
games” (generalizing the model of timed automata), stochastic games (in
which random moves enter), and multiplayer games.
Church’s Problem 25
7 Acknowledgment
Thanks are due to Erich Grädel, Wong Karianto, Detlef Kähler, Christof
Löding, and Michaela Slaats for their helpful comments on a previous ver-
sion of this paper.
References
[1] J.R. Büchi. On a decision method in restricted second order arith-
metic, in Proc. 1960 International Congress on Logic, Methodology
and Philosophy of Science, E. Nagel at al., eds, Stanford University
Press 1962, pp. 1-11.
[6] E.A. Emerson, C.S. Jutla. Tree automata, mu-calculus, and deter-
minacy, in Proc. 32nd FoCS 1991, IEEE Comp. Soc. Press 1991,
pp. 368-377.
[13] A.W. Mostowski. Regular expressions for infinite trees and a stan-
dard form of automata, in Computation Theory, Springer LNCS
208 (1984), 157-168.