Fast LTL To B Uchi Automata Translation
Fast LTL To B Uchi Automata Translation
Introduction
(1)
A formula of this type is very often encountered in LTL model checking. Moreover, the fairness conditions and the right-hand side property are usually more
complex. The value of n is very often greater than 5. Alas, in this case, Spin
fails to produce the B
uchi automaton within a reasonable amount of time and
memory (see Table 1).
1
2
3
4
5
6
7
8
9
10
Spin
time
space
0.18
460
4.6
4,200
170
52,000
9,600 970,000
Wring
EQLTL
time
space
time
0.56
4,100
16
2.6
4,100
16
16
4,200
18
110
4,700
25
1,000
6,500
135
8,400 13,000
N/A
72,000 43,000
LTL2BA
time
space
0.01
9
0.01
19
0.01
86
0.07
336
0.70
1,600
12
8,300
220
44,000
4,200
260,000
97,000 1,600,000
LTL2BA
time space
0.01
9
0.01
11
0.01
19
0.06
38
0.37
48
4.0
88
32 175
360 250
3,000 490
36,000 970
Table 1. Comparison on the formulae n for 1 n 10. Time is in sec, space in kB.
(N/A) : no answer from the server within 24 h. () : the program died, giving no result
Spins algorithm was improved by [1] (LTL2AUT), [2] (EQLTL), [10] (Wring):
these papers did not modify the basis of the algorithm, but improved it using
the same core algorithm, rewriting LTL formulae, and simplifying the resulting
B
uchi automaton. These improvements are quite efficient but the actual transformation of the LTL formula to a B
uchi automaton, which is similar to the
tableau construction explained in [3], may still perform badly on some natural
formulae such as n . Some experiments are presented in Table 1. Note that Wring
is written in Perl while Spin and LTL2BA are written in C and that EQLTL is
used through a web server. Hence the figures are still relevant but should not be
compared litterally. See Sect. 7 for more details.
In this paper, we present a new algorithm to generate a B
uchi automaton
from an LTL formula. Our algorithm is not based on the tableau construction
presented in [3]. Instead, using the classical construction (see e.g. [12]), we first
produce an alternating automaton from the LTL formula, with n states where
n is less than the size of the formula. This alternating automaton turns out to
be very weak as shown by Rohde [9]. Thanks to that property, instead of generating directly a B
uchi automaton with 2n 2n states, we are able to build first
a generalized B
uchi automaton, that is a B
uchi automaton with labels and accepting conditions on transitions instead of states, with at most 2n states. Using
a generalized B
uchi automaton is one of the most important improvements of
our algorithm. The best solution would be to design a model-checking algorithm
using directly this generalized B
uchi automaton, but in order to compare our
work with other ones and to use existing model-checking algorithms, we transform this automaton into a classical B
uchi automaton. The method we use is
very classical, and we obtain a B
uchi automaton with at most n 2n states.
The second main improvement stems from our simplifications of the automata. Since our construction goes in several steps, we are able to simplify
the automata at each step, improving the efficiency of the following steps. The
simplifications dramatically reduce the number of states and transitions of the
automata, especially of the generalized B
uchi automaton. Moreover, each simpli-
u |= p if p u0 ,
u |= 1 if u 6|= 1 ,
u |= 1 2 if u |= 1 or u |= 2 ,
u |= X 1 if u1 u2 . . . |= 1 ,
u |= 1 U 2 if k 0, uk uk+1 . . . |= 2 and 0 i < k, ui ui+1 . . . |= 1 .
Only basic operators have been defined above. We will of course also use the
derived operators defined by:
def
def
def
tt = p p , ff = tt , 1 2 = ( 1 2 ) , (2)
def
def
def
1 R 2 = ( 1 U 2 ) , F = tt U and G = ff R = F .(3)
An LTL formula that is neither a disjunction () nor a conjunction () is
called a temporal formula.
An LTL formula can be written in negative normal form, using only the
predicates in Prop, their negations, and the operators , , X, U, and R. Notice
that this operation does not change the number of temporal operators of the
formula. From now on, we suppose that every LTL formula is in negative normal
form.
Example 1. Let = (G F p G(q F r)) be our running example along the
paper. The negative normal form of is (ff R (tt U p)) (tt U (q (ff R r))).
Before any construction our algorithm simplifies the formula, using a set of
rewriting rules that reduce the number of temporal operators. This is relevant
since the complexity of our algorithm is based on this number. Some of these
rules are presented in [2],[10]. We will not discuss them in this paper.
tt
G F p tt
tt
Fp
F(q G r)
tt
p
q r
q
p
tt
ff
q
r
Gr
Fig. 1. Automaton A . Some states (right) are unaccessible, they will be removed
Remark 1. The transition function looks different from the usual definition ( :
Q B + (Q)). We made those changes for implementation reasons, in order
to ease the manipulation of the data structures and to save time and space
during the computation. The classical representation of our transition function
is given by:
_
e .
(4)
(q, a) =
(,e)(q)
a
Conversely we may obtain our definition from the classical one, essentially
by taking the disjunctive normal form. Hence the two definitions are equivalent.
Notice that in the transition function we use instead of : so that transitions that differ only by the action can be gathered. In practice, this usually
reduces a lot the number of transitions. However the automaton still reads words
in .
Example 2. You can see the representation of a VWAA on Fig. 1. States in F are
circled twice. Notice that arrows with the same origin represent one transition
to a conjunction of states. In this example, we have:
I = {G F p F(q G r)},
(p) = {(p , tt)} where p = {a | p a},
(G F p) = {(p , G F p), (, G F p F p)}.
A run of A on a word u0 u1 . . . is a labeled DAG (V, E, ) such that :
V is partitioned in
i=0
Vi with E
Vi Vi+1 ,
i=0
{p, q}
GFp
GFp
Fp
GFp
Fp
F(q G r)
F(q G r)
F(q G r)
{p}
{p}
GFp
GFp
Gr
Gr
In the definition of the VWAA associated with an LTL formula, we use two
new operators. helps treating conjunctions, and gives roughly the DNF of ,
allowing us to restrict the states of the automaton to the temporal subformulae
of .
( p) = {( p , tt)} where p = \p
(X ) = {(, e) | e }
(
1 R 2 ) = (2 ) ((1 ) {(, 1 R 2 )})
() = () if is a temporal formula
(1 2 ) = (1 ) (2 )
(1 2 ) = (1 ) (2 )
Using the partial order subformula of it is easy to prove that A is very weak.
Remark 2. One can notice that the elements of used in our definition are
intersections of the sets , p and p . Hence, they can be denoted by conjunctions of literals, as in the following examples : p q r for p q r ,
tt for . Note that intersection and test for inclusion can be easily performed
with this representation.
Example 4. Figure 1 shows the result of Step 1 on the formula defined in Ex. 1.
p r
p
G F p F(q G r)
p q r
GFp Gr
p q r
p q r
q r
p
p r
tt
G F p F p F(q G r)
p r
p
A
q r
tt
q r
B
r
GFp Fp Gr
r
tt
Fig. 2. Automaton GA , before (left) and after (right) simplification
Theorem 1. L(A ) = {u | u |= }.
Proof. The idea of the proof is to show recursively that for any subformula of
, the language accepted by A with I = is equal to {u | u |= }. The
main difficulties are encountered for = 1 U 2 (this is where the acceptance
condition comes into play) and = 1 R 2 .
VWAA to Generalized B
uchi Automata (GBA)
At that point we have obtained a VWAA for our LTL formula . The problem
is that the usual method to transform an alternating automaton into a B
uchi
automaton produces an automaton that is much too big. This is why we generate
first a GBA, which is a B
uchi automaton with several acceptance conditions on
transitions instead of states.
Definition 5. A generalized B
uchi automaton is a five-tuple G = (Q, , , I, T )
where :
Here is the second step of our algorithm, building a GBA from a co-B
uchi
VWAA. It can be of course applied to any VWAA, and not only to an automaton
issued from Step 1. GA has at most 2|Q| states and |F | acceptance sets.
Step 2. Let A = (Q, , , I, F ) be a VWAA with co-B
uchi acceptance conditions. We define the GBA GA = (Q , , , I, T ) where:
Q = 2Q is identified with conjunctions of states as explained in Definition 3,
n
N
(qi ),
(q1 . . . qn ) =
i=1
i0
xVi
of GA , and that T
ui . Since
S t , x Vi , (x , ex ) ((x))
such that =
x and ex =
e.
xVi
xVi
Let Vi+1
= {y Vi+1 | (y) e } and Ei = {(x, y) Vi Vi+1
| (y) ex }.
Note that (Ei (x)) = ex since ex e = (Vi ) and that Ei (Vi ) may be strictly
contained in Vi+1
.
Claim. i 0, f F , the following property holds:
if (x, y) Ei , (x) = (y) = f then (x, y) Ei , (x) = (y) = f .
Proof. If x Vi , (x) 6= f then the claim is true. Otherwise x Vi
Vi , (x) = f . Assume that y Ei (x) with (y) = f . Then we have
f ex , and by definition of ex we deduce that t
/ Tf . Since t 4 t we
have t
/ Tf and we deduce easily that f ex , which proves the claim.
Let V =
i0
Vi , E =
i0
p q r
A,0
p r
B,2
p r
q r
r
B,1
tt
Fig. 3. Automaton BGA after simplification
infinitely many transitions in Tf , and for each such transition there is no edge
in E with both ends labeled by f at the corresponding depth. Hence this is
impossible.
Therefore from any accepting run of GA , we have built an accepting run
of A on the same word, proving the converse inclusion L(GA ) L(A).
GBA to B
uchi Automata (BA)
At that point we have obtained a GBA for our LTL formula . We simply have
to transform it into a BA to complete our algorithm. This construction is quite
easy and well-known, but for the sake of completeness we explain it briefly. We
will begin by defining a BA, using once more the same modifications concerning
the alphabet and the transition function.
Definition 6. A B
uchi automaton is a five-tuple B = (Q, , , I, F ) where :
Remark 5. There exist many similar algorithms transform a GBA into a BA.
They often consist in building the synchronous product of the GBA with some
automaton verifying that every acceptance condition is verified infinitely often.
This automaton differs from one algorithm to another. We chose one that gives
good results for the size of the resulting BA after simplification.
Simplification
Note that for a GBA issued from Step 2, the condition (q1 , , q ) Tj does
not depend on q1 so that the condition simply becomes (q1 ) = (q2 ).
This simplification procedure is really efficient to reduce the size of the automata. But the strength of our algorithm is that the last two simplification rules
are also used on-the-fly: after a transition has been created, it is compared with
the other transitions already calculated from the same state, and the ones that
become useless are immediately deleted; after all the transitions of a state have
been created, that state is compared with the other states that have already
been created, and is merged to one of those states if possible. This method is
important since usually many states and transitions are to be simplified, and
simplifying them on-the-fly saves a lot of time and space.
In Table 1, the results of the algorithm with or without on-the-fly simplification are compared (LTL2BA is our algorithm with a posteriori simplification
only). For the formula n defined in (1), the unsimplified GBA has 2n+1 states,
whereas the simplified GBA has only 2 states. Using on-the-fly simplification
avoids the intermediary exponential automaton which explains the great improvement, even if the time and memory used by LTL2BA are still exponential.
Experimental Results
2
3
4
5
6
7
8
Spin
time
space
0.01
8
0.03
110
0.75
1,700
43
51,000
1,200 920,000
Wring
EQLTL
LTL2BA
time space
time
time space
0.07 4,100
8
0.01
3.2
0.29 4,100
8
0.01
5.5
1.34 4,200
9
0.01
11
10 4,200
11
0.01
13
92 4,500
15
0.15
25
720 6,000
27
9.2
48
92 1,200
93
avg.
14.23
5.74
14.73
Spin
max.
4521.65
56
223
LTL2BA
avg. max.
0.01 0.04
4.51
39
9.67 112
References
1. M. Daniele, F. Giunchiglia, and M. Vardi. Improved automata generation for
linear temporal logic. In Proc. 11th International Computer Aided Verification
Conference, pages 249260, 1999.
2. K. Etessami and G. Holzmann. Optimizing B
uchi automata. In Proceedings of
11th Int. Conf. on Concurrency Theory (CONCUR), 2000.
3. R. Gerth, D. Peled, M. Vardi, and P. Wolper. Simple on-the-fly automatic verification of linear temporal logic. In Protocol Specification Testing and Verification,
pages 318, Warsaw, Poland, 1995. Chapman & Hall.
4. G. Holzmann. The model checker SPIN. IEEE Transactions on Software Engineering, 23(5):279295, May 1997.
5. O. Kupferman and M. Vardi. Weak alternating automata are not that weak.
In Proc. 5th Israeli Symposium on Theory of Computing and Systems ISTCS97,
pages 147158. IEEE, 1997.
6. D. Muller and P. Schupp. Alternating automata on infinite objects: Determinacy
and Rabins theorem. In Proceedings of the Ecole de Printemps dInformatique
Theoretique on Automata on Infinite Words, volume 192 of LNCS, pages 100107,
Le Mont Dore, France, May 1984. Springer.
7. D. Muller and P. Schupp. Alternating automata on infinite trees. Theoretical
Computer Science, 54(2-3):267276, October 1987.
8. D. Muller and P. Schupp. Simulating alternating tree automata by nondeterministic automata: New results and new proofs of the theorems of Rabin, McNaughton
and Safra. Theoretical Computer Science, 141(12):69107, April 1995.
9. S. Rohde. Alternating automata and the temporal logic of ordinals. PhD Thesis
in Mathematics, University of Illinois at Urbana-Champaign, 1997.
10. F. Somenzi and R. Bloem. Efficient B
uchi automata from LTL formulae. In CAV:
International Conference on Computer Aided Verification, 2000.
11. H. Tauriainen. A randomized testbench for algorithms translating linear temporal
logic formulae into B
uchi automata. In Workshop Concurrency, Specifications and
Programming, pages 251262, Warsaw, Poland, 1999.
12. M. Vardi. An Automata-Theoretic Approach to Linear Temporal Logic, volume
1043 of Lecture Notes in Computer Science, pages 238266. Springer-Verlag Inc.,
New York, NY, USA, 1996.