lecture12
lecture12
Kupferman-Vardi Complementation
I shall begin by presenting the “original” Safra’s construction (see [2]). Let A = (Q, Σ, δ, s, F )
be a nondeterministic Büchi automaton. We shall tranform this into an equivalent deter-
ministic Rabin automaton As . The states of As are “Safra trees”. A Safra tree is a tree with
nodes drawn from the set {n1 , n2 , . . . , } (we shall restrict this to a finite set soon), equipped
with a labelling function that labels nodes with subsets of Q and a colouring function that
colours the nodes with either white or green. We shall write λ(n) to denote the set labelling
node n and c(n) to denote the colour of the node n. A Safra tree satisfies the following
properties:
S
1. If {n1 , n2 , . . . nk } are the children of n then λ(n) is a strict superset of i λ(ni ).
2. If n1 and n2 are children of some n then λ(n1 ) ∩ λ(n2 ) = ∅.
Observation 1: The depth of a Safra tree is bounded by |Q|. This follows from item 1
above.
Observation 2: The number of nodes in a Safra tree is bounded by |Q|. This can be seen
as follows: pick any n in a Safra tree T . We claim that there is a q such that q appears
in the sets labelling the nodes on the path from the root to n and no where else. In proof,
pick any q that appears in λ(n) but not in the labels of any of its children. Such a q must
exist by item 1. ( Observation 2 will allow us to restrict the set of nodes to the finite set
{n1 , n2 , . . . , n2|Q|+1 }. )
The start state of As is the tree with the single node n1 labelled by the set {s}. It is
coloured green if s ∈ F and white otherwise. We now describe the transition function. Given
T and a letter a we shall construct a Safra tree T 0 as follows:
1. Every node in n in T is also a node of T 0 . The label of such a node is δ(λ(n), a)
(Thus each node runs its own copy of the powerset automaton Ap instead of a copy of
the marked powerset automaton Am . As observed in the previous lecture, the second
component of Am is available in the state of the children of a node and so it suffices to
simulate Ap at each node.)
2. For each n ∈ T , if δ(λ(n), a) ∩ F is not empty then we create a new child for n in T 0
and label it with δ(λ(n), a) ∩ F . (Instead of forking one copy per accepting state, we
simply start a single copy simultaneously from all of those states.)
3. If a state q appears along more than one path starting at the root delete it from all
paths except the left most (with the understanding a child inserted earlier appears to
the left of a child inserted later.) If in this process any node has the label ∅ then delete
that node.
S
4. If n is any node with children m1 , m2 , . . . mk with λ(n) = i λ(mk ) then delete
m1 , . . . mk along with all their descendents and colour n with green. Label other nodes
white.
1
The figure below describes a run of the automaton on page 6 of Lecture 11, on the input
ababab. The effect of steps 1 and 2 are indicated via −→ while the effect of steps 3 and 4
are indicated via dotted arrows.
1 {s} a 1 {s,r,p} b 1 {u,q,r,t}
a 1 {s,q,r,t} b 1 {q,u,v,r,t}
{q} {q}
1 {q,u,v,r,t} 1 {s,q,v,r,t}
a
2 {t} 3 {q,u} 4 {v} 2 {t} 3 {s,q} 4 {v}
1 {s,q,v,r,t} b 1 {q,u,v,r,t}
{q}
1 {q,u,v,r,t} 1 {s,q,v,r,t}
1 {s,q,v,r,t} 1 {q,u,v,r,t}
{t} 2 3 b
{t} 2 3
{s,q,v} {q,u,v}
6 {s} 7 {q} 6 {q,u} 7 {q,v}
1 {q,u,v,r,t}
{t} 2 3
{q,u,v}
2
Lemma 1 A word w = a1 a2 . . . is accepted by A if and only if in the unique run of As on
w, some node n is coloured green infinitely often.
1 a a
2 a
1 a
2
Proof: Let an accepting run of A on a1 a2 . . . be q1 −→ q2 −→ q3 . . .. Let T1 −→ T2 −→ ...
be the run of As .
x
First of all note that if n appears in T without children, T −→ T 0 such that the node n is
x
not deleted along this run and further n is coloured green in T 0 then, λ(n) −→g λ0 (n) (where
λ(n) is the label of n in T and λ0 (n) is the label of n in T 0 .) This follows from the definition
of the transition relation of As . Also observe that, whenever a node is coloured green it has
no children. From this it is quite easy to see that if some node n is coloured green infinitely
often along the run of As on w and if the sets labelling n at these green coloured stages are
w1 w2
X1 , X2 , . . . then w = w1 w2 . . . with {s} −→ g X1 −→g X2 . . .. Thus w is accepted by A.
a1 a2
For the converse, we associate a node Ni ∈ Ti with the accepting run q1 −→ q2 −→ . . ..
It is the highest level node (i.e. farthest from the root) whose label carries the state qi . We
claim that Ni = n for some n infinitely often. In proof note that if the associated node
turns out to be the root (which appears in all the trees Ti ) then there is nothing to prove.
Otherwise, after some M1 , the associated node Ni is never the root for all i ≥ M1 . Let m1
be the node at level 2 visited after this. Beyond M1 , whenever the associated node is at level
2 it can only be m1 or any other node at that level that appears to the left of m1 . Thus
there are only finitely many choices. If it visits one such node infinitely often, we are done.
Otherwise, there is is a point M2 beyond which the associated node appears at level 2 or
more. Continuing this argument and using the fact that the depth of the trees is bounded
by |Q| we conclude that there is a n that is hit infinitely often as the associated node.
Now we claim that this node n must be coloured green infinitely often. This follows from
the fact that whenever qi is an accepting state the associated node moves from n to a child
of n. Since it returns back to n, there is a point where the children of n are deleted. At this
point n must be coloured green.
Thus, the node n is coloured green infinitely often along the run of As on w.
Now, we can use the fact that the size of the tree is bounded by |Q| to use a finite
number of nodes (akin to the argument in Lecture 11, Lecture 8 and so on). We simply use
a collection of 2|Q| + 1 nodes and ensure that whenever a node n is deleted at a step, it does
not appear in the tree constructed (as all the new nodes added can be given other labels).
As usual, we shall use a Rabin acceptance condition (Fi , Ii ) one for each node i. Fi consists
of all the trees where i does not appear and Ii consists of all the trees where i appears and is
coloured green. It is easy to see that this finite state deterministic Rabin automaton accepts
the same language as As . Henceforth we shall use As to refer to this automaton. What is the
size of this automaton? Simply observe that there are at most nn−2 trees on n nodes and if
we insist on ordered trees we get nn−2 ∗ n! and labelling involves picking functions from Q to
nodes. Thus the total number of trees is of the order of nn−2 ∗ n! ∗ n|Q| . But n = 2 ∗ |Q| + 1.
Thus, the number of trees is of the order of 2O(|Q|log(|Q|)) .
Theorem 2 (Safra) Any nondeterministic Büchi automaton with n states can be trans-
formed into an equivalent deterministic Rabin automaton of size O(2O(nlogn) ) with O(n) ac-
3
cepting pairs. Any NBA can be complemented into a NBA with a size blowup of at most
O(2O(nlogn) ).
Exercise: Show that every nondeterministic Streett automaton with n states and r ac-
cepting pairs can be tranformed into an equivalent nondeterministic Büchi automaton with
O(n ∗ 2r ) states.
[Hint: The set of Fi s hit infinitely often must be a subset of the set of Ei s hit infinitely
often. Keep track of the set of indices for which Ei has been hit and the set of indices for
which Fi has been hit. If the latter is a subset of the former then reset both sets to the
empty set and continue...]
1 A lower bound
In this section we shall show that we cannot hope to improve Safra’s construction. This
result is due to M. Michel. Our presentation here follows that of C. Löding [1].
The idea is to construct a family of nondeterministic Büchi automata Ai of size n
such that any NBA accepting L(Ai ) must have at least n! states. The automaton An =
({1, 2, . . . , n, #}, {1, 2, . . . , n, #}, δn , {1, 2, . . . n}, {#}). ( We have used a set of initial states
instead of one. We can add one additional state and use that to replace this set by a single
intitial state.)
1 2 n
1 2 2 n
1
n
#
What is the language accepted by this automaton? Say we start at i. We could stay at
i for some time reading say x0 , but eventually we have to move to # and this must be on
reading i. The very next move takes us out of # to the state j where j is the next input
letter. Thus, the input read up to the first trip through the accepting state would be of the
form x0 ij for some j. Now, we could consume some input, say x1 at j but then eventually
we would have to make a trip through # and that would require us to read jk for some k
4
and we would end up at state k and so on. Thus the input read up to the first two trips
through the accepting state looks like x0 ijx1 jk. Thus it is the pairs of adjacent letters in
the given word that arrange for trips through the accepting set.
Claim 1: Suppose there is a sequence i1 i2 . . . ik of elements from {1, 2, . . . n} such that
the words i1 i2 , i2 i3 , . . ., ik i1 all appear infinitely often in w then w is accepted by An .
Proof: Start at i1 . At the first i1 i2 travel through # to reach i2 , then at the next i2 i3 travel
through # to i3 and so on. This ensures that # is visited infinitely often.
Claim 2: If w is accepted by An then there is a sequence i1 i2 . . . ik of elements from
{1, 2, . . . n} such that the words i1 i2 , i2 i3 , . . ., ik i1 appear infinitely often in w.
Proof: Let ρ be an accepting run on w. Suppose j1 is a state from {1, 2, . . . , #} that appears
infinitely often along this run. The run must go from j1 to # infinitely often. Let j2 be
a state that is reached (in two steps) via # from j1 infinitely often. Similarly, let j3 be a
state reached from j2 via # infinitely often and so on. Since there are only finitely many
possibilities, some jl = jl+k for some l and k. Let i1 , i2 . . . ik be the sequence jl , jl+1 , . . . jl+k−1 .
Theorem 3 (C. Löding) Any Streett automaton A = (Q, Σ, δ, s, ((E1 , F1 ), (E2 , F2 ) . . . (Ek , Fk )))
accepting L(An ) must have at least n! states.
Proof: Pick any two distinct permutations i1 i2 . . . in and j1 j2 . . . jn of {1, 2, . . . , n}. The
words w1 = (i1 i2 . . . in #)ω and w2 = (j1 j2 . . . jn #)ω are not in L(An ) since IP (w1 ) and
IP (w2 ) have no cycles. Let I1 (I2 ) be the set of states hit infinitely often along some
accepting run of A on w1 (w2 ). We shall show that I1 ∩ I2 is empty.
Suppose q ∈ I1 ∩ I2 . Then, following the run on w1 we can construct a word x1 =
x1
ui1 i2 . . . in v such that q −→ q visiting exactly the set of states I1 . Similarly, following the
x2
run on the word w2 we can construct a word x2 = u0 j1 j2 . . . jn v 0 such that q −→ q visiting
y x1 x2 x1 x2
exactly the set of states I2 . Thus there is a run s −→ q −→ q −→ q −→ q −→ q that visits
precisely the set of states I1 ∪ I2 infinitely often. This run is also an accepting run! This
follows from the following exercise:
Exercise: Show that if the set X as well as the set Y satisfy the Streett condition
((E1 , F1 ), . . . (Ek , Fk )) then X ∪ Y also satisfies this Streett condition.
However, IP (y(x1 x2 )ω ) has a cycle: Let k be the least number so that ik 6= jk . Then jk
is some il for l > k. Similarly, ik = jm for some m > k. Then ik ik+1 . . . il jk+1 . . . jm−1 forms
a cycle. This contradicts the fact that L(A) = L(An ). Thus, I1 ∩ I2 is empty. Thus, the
total number of states in A is at least n!.
5
Thus, Safra’s construction gives an optimal way to transform a NBA into an equivalent
Rabin automaton.
Corollary 4 Any nondeterministic Büchi automaton accepting L(An ) has at least n! states.
Proof: A NBA (Q, Σ, δ, s, F ) is also the Street automaton (Q, Σ, δ, s, ((F, Q))).
Thus, Safras construction as well as the Kupferman-Vardi construction for complementing
NBAs are optimal.
2. Quite trivially, a NRA automaton can be transformed into a NMA with the same
number of states. The number of accepting sets however is O(2n ) where n is the
number of states of the NRA. This construction transforms deterministic automata
into deterministic automata.
4. NBAs can be transformed into DRA of size 2O(nlogn) and O(n) accepting pairs. This
follows from Safra’s construction.
5. NBAs can be transformed into DMA with 2O(nlogn) states (and double exponential
number of accepting sets). This follows from items 2 and 4.
6. By the exercise at the end of Safra’s construction in this lecture, any nondeterministic
Streett automaton of size n with r accepting pairs can be transformed into an equivalent
NBA of size O(n.2r ).
7. A NRA with n states and r accepting pairs can be transformed into an equivalent NBA
of size O(n.r).
Proof: The Büchi automaton, guesses an i and checks whether the word is accepted
via the accepting pair (Ei , Fi ). This is done by “waiting” for the point from where
no state from Ei appears and then verifying that this is indeed the case and also that
some state from Fi is visited infinitely often.
But here are some transformations that are missing in the list above:
6
2. Transformations between deterministic Streett and Rabin automata. Note that the
last two items in the above list allow transformations between NSA and NRA (since
every Büchi automaton can be thought of as a Streett or as a Rabin automaton with
one accepting pair). We can combine the O(n.2r ) transformation from Streett to NBA
r r
with Safra’s construction to get a O(2O(n.2 log(n.2 ) ) translation from NSAs to DRAs.
But notice that this is double-exponential in the number of accepting pairs. As we
shall see, we can do better.
2. There is a N such that for all i ≥ N the last |X| distinct states in q0 q1 . . . qi is the set
X. The last k distinct states in q0 q1 . . . qi is obtained by removing duplicate occurances
of any state by deleting all but the right most copy of each state. For example the last
3 distinct states in pqrsppqqrsssppp are {p, s, r} as after deleting the duplicate entries
we get qrsp. This permutation of (some subset of) Q obtained by deleting all but
the right most occurance of each state in a state sequence σ is called the LAR (Last
Appearance Record) of σ, written LAR(σ).
(Note that condition 2 alone is not enough. The last 3 distinct states of of r(pq)i is {p, q, r}
for all i. Thus condition 2 does not ensure that states in X are hit infinitely often.)
This suggests that we construct an automaton whose states are LARs. Our LARs will
be permutations Q (that is, every state in Q will appear). Note that LAR(q0 q1 q2 . . . qi+1 ) =
LAR(LAR(q0 q1 . . . qi ).qi+1 ). This leads us naturally to the following definition for the transi-
tion relation: Given a LAR q1 q2 . . . qn and a letter a, we may move to a state p1 p2 . . . pn if
p1 p2 . . . pn = LAR(q1 q2 . . . qn p) where, p ∈ δ(qn , a). Notice that p1 p2 . . . pn = q1 . . . qi−1 qi+1 . . . qn p
when qi = p. The effect of such a transition is to delete p from the current list and append it
at the right end. We shall say that position i is hit in a transition to mean that the ith state
a1 ...
was moved to the right end by this transition. Thus, if q0 −→ q1 −→ is a run in Q then the
a1 a2
LAR automaton simulates this run via the run LAR(q0 ) −→ LAR(q0 q1 ) −→ LAR(q0 q1 q2 ) . . ..
(Well, we are fudging things here. Some of these are not really permutations of Q. Well, we
pad it to the left to get a permutation. I leave it to the reader to figure out what to do.)
7
For a fixed X ∈ F, if we use conditions 1 and 2 to describe acceptance in the LAR
automaton then we get something that is almost a Rabin accepting pair. Condition 2 says
that LARs in which the last |X| entries include states from Q \ X are visited only finitely
often. Thus, condition 2 is of the form “Ei is hit finitely often”. Condition 1 says that every
state in X is visited infinitely often. Condition 1 is not quite equivalent to saying “Fi is hit
infinitely often ”. We shall fix that now. The trick is to record at each move the position
from which a state was deleted (and moved to the right end).
Henceforth by an LAR we shall refer to a pair consisting of a permutation of the states
of Q and an index i with 1 ≤ i ≤ n. Given (q1 q2 . . . qn , i) and a letter a, we allow
a a
a transition (q1 q2 . . . qn , i) −→ (p1 p2 . . . pn , j) if qn −→ p and qj = p and p1 p2 . . . pn =
a1 q2
q1 . . . qj−1 qj+1 . . . qn p. A run q0 −→ q1 −→ . . . is simulated by this automaton via a run of
the form (f1 , i1 )(f2 , i2 ) . . . where each fi is a permutation of Q. We write fi (j) for the jth
element of the permutation fi . Then fi (n) = qi for all i ≥ 1 and further fi = LAR(q1 q2 . . . qi ).
For each Xi ∈ F we shall define a Rabin accepting pair (Ei , Fi ) as follows: Ei is the set
of states (q1 q2 . . . qn , j) such that the last |Xi | states of q1 q2 . . . qn do not form the set Xi .
Thus if Ei is hit finitely often along some run then there is an N such that for all k ≥ N ,
the state reached along this run is of the form (fk , j) where the last |Xi | elements of fk form
the set Xi .
Fi consists of all tuples of the form (f, n − |Xi | + 1). Suppose Ei is hit finitely often
and Fi is hit infinitely often. Let x ∈ Xi . Pick any state (fk , j) in the run with k > N
(where N is as defined in the previous paragraph). Therefore x appears somewhere among
the positions fk (n − |Xi | + 1), fk (n − |Xi | + 2) . . . fk (n). Notice that when the position j is
hit in a transition, states that appear at positions j + 1 through n shift to the left by one
position. The only way in which a state shifts right is when it is visited and in that case it is
moved to the right end of the LAR. Since position n − |X| + 1 is hit infinitely often, at each
such hit x is shifted to the left by one step. And if it is not visited then it will eventually
reach the position n − |Xi | + 1. But then we are guaranteed to visit x as this position is hit
sometime after this. Thus for all k ≥ N there is a k 0 > k such that x is visited at step k 0 .
Thus each state of Xi is visited infinitely often.
a1 a2
It is easy to check that the converse, that is if q0 −→ q1 −→ . . . accepts via Xi then the
a1
corresponding run (f0 , i0 ) −→ (f1 , i1 ) . . . satisfies the Rabin condition (Ei , Fi ). Thus, the
LAR automaton accepts via the pair (Ei , Fi ) if and only if the original automaton accepted
via the set Xi . Thus we have transformed a Müller automaton into an equivalent Rabin
automaton. Moreover this transformation sends deterministic automata to deterministic
automata. This also allows us to translate deterministic Müller automata to deterministic
Streett automata (simply complement, transform to Rabin and complement again). The
number of states is O(n!) and the number of accepting pairs is O(m) where m is the number
of sets in F.
We shall now modify this construction to make the number of accepting pairs independent
of m (and dependent only on n). At present, Ei ensures requirement 2 while Fi ensures
requirement 1 (assuming Ei is hit finitely often). The idea is to redistribute this work.
Let Ei consist of all the pairs of the form (f, j) where j <= n − |Xi |. Let Fi consists
8
of all the pairs of the form (f, n − |Xi | + 1) where the last |Xi | states in Fi are the states
of Xi . Now, if Ei is hit finitely often along some run, then after some point the positions
1, 2, . . . n − |Xi | are not hit. If further Fi is hit infinitely often then there must a later point
at which the last |Xi | states form the set Xi . From here on, since the hit never reaches
positions 1, . . . , n − |Xi |, it is guaranteed that the last |Xi | states will constitute the set Xi .
More over, position n − |Xi |+ 1 is hit infinitely often. Thus, the new Rabin condition (Ei , Fi )
also guarantees that the set of states of A hit infinitely often is Xi .
Now, if |Xi | = |Xj | then Ei = Ej . Can we combine the sets Fi and Fj together? Yes,
because Fi ∪ Fj is hit infinitely often if and only if one of Fi or Fj is hit infinitely often. Thus,
we can replace (Ei , Fi ) and (Ej , Fj ) with (Ei = Ej , Fi ∪ Fj ). Thus, we can obtain a Rabin
automaton which has at the most n accepting pairs. Thus, every Müller automaton with
n states can be transformed into a Rabin automaton with O(n!) states and O(n) accepting
pairs.
Theorem 5 Let A = (Q, Σ, δ, s, F) be a Müller automaton with n states. Then, there is a
Rabin automaton A0 accepting the same language as A with O(n!) states and O(n) accepting
pairs.
Proof: Let Q0 = Perm(Q) × {1, 2, . . . n}. Let s0 = (f, n) for some fixed permutation f with
f (n) = s. The transition relation is given by
a
((q1 q2 . . . qn , i) −→ (q1 q2 . . . qj−1 qj+1 . . . qn qj , j) ⇐⇒ (qn , a, qj ) ∈ δ
The accepting condition consists of a family of pairs (E1 , F1 ), (E2 , F2 ) . . . (En , Fn ) where:
Ei = {(f, j) | j ≤ i}
Fi = {(f, i) | {f (i + 1), f (i + 2) . . . , f (n)} ∈ F}
The correctness of this construction follows from the discussion above.
We shall not stop here, but modify this transformation to get a Rabin automaton with
a very interesting structure.
9
Well, this gives us more — we also have Fi ⊆ Ei+1 for 1 ≤ i < n. Thus the family of
Rabin accepting pairs actually form a chain E1 ⊆ F1 ⊆ E2 ⊆ F2 . . . ⊆ En ⊆ Fn . A Rabin
condition with this property is called a Rabin Chain condition. ,Thus, we have the following
theorem:
Theorem 6 Any Müller automaton can be transformed into an equivalent Rabin Chain
automaton with O(n!) states and n accepting pairs.
Rabin chain automata are also Streett automata! Let A be a Rabin chain automaton with
accepting pairs (E1 , F1 ), (E2 , F2 ), . . . , (Ek , Fk ). Now consider the automaton A0 obtained
from A be replacing the list of accepting pairs by (∅, E1 ), (F1 , E2 ), . . . , (Fk−1 , Ek ), (Fk , Q). A
run is accepting in A if and only if it is rejecting in A0 . This gives us the following results:
Theorem 7 Deterministic Rabin chain automata can be complemented without any blow up
in state space or accepting pairs.
In proof, note that the automaton A0 accepts the complement.
Theorem 8 Any Müller automaton can be transformed into an equivalent Street (chain)
automaton with O(n!) states and n + 1 accepting pairs.
In proof note, that A0 as a Street automaton accepts the same set of words as A accepts as
a Rabin automaton.
10
Exercise: Show that the above construction yields a Rabin chain automaton equivalent
to the parity automaton we started with.
To summarize we have shown the following:
Theorem 10 Any Müller automaton A with n states can be transformed into an equivalent
parity automaton with O(n!) states that uses only O(n) numbers to label the vertices. This
translation preserves determinism.
It is also quite evident that deterministic parity automata can be complemented trivially.
Just add 1 to c(q) for each q to invert the parity.
References
[1] Christof Löding: Optimal Bounds for Transformations of ω-automata, Proceedings of
the International Conference on Foundations of Software Techonology and Theoretical
Computer Science (FSTTCS) 1999, Springer Lecture Notes in Computer Science 1738,
1999.
[2] S. Safra: On the complexity of ω-automata, Proceedings of the 29th FOCS, 1988.
[3] Wolfgang Thomas: Languages, automata, and logic In the Handbook of Formal Lan-
guages, volume III, pages 389-455. Springer, New York, 1997.
11