IFAC
Copyright © IF AC System Structure and Control, Prague, Czech Republic, 2001
c::
0
C>
Publications www.elsevier.comllocatelifac
SEQUENTIALIZATION AND UNAMBIGUITY OF (MAX,+) RATIONAL SERIES OVER ONE LETTER Sylvain Lombardy
Ecole Nationale Superieure des Telecommunications, 46, rue Barrault, 75013 Paris, France lombardyCenst.fr
Abstract: We present an algorithm to decide whether a (max,+ )-rational series over one letter is sequential. We discuss the relation between sequentiality and unambiguity of rational series. Copyright © 2001 [FAC Keywords: Automata, Rational series, (max,+) Algebra
1. INTRODUCTION
biguously. This is what makes the problem harder than for transducers. In the second part, we prove that the sequentiality of a function from a" in a (max, + )-semiring can be decided on the automaton which realizes it.
Determinization of automata with multiplicity is a well-known problem solved for many semirings. The classical theory of automata corresponds to the Boolean semi ring and we know that every automaton can be determinized. Transducers correspond to automata with multiplicity in the semiring of subsets of a free monoid; if the relation is functional, we can decide sequentiality [3].
The third part is devoted to algorithms which use results of the second part for the decidability of sequentiality and the determinization. 2. NOTATIONS AND DEFINITIONS
The problem in the case of (max, +) or (min, +)semirings is open, except if the input alphabet is a singleton :
Let G be an additive subgroup of lR. and lK = G, G n lR.+ or G n lR_. In the last two cases, we say that lK is respectively positive or negative. Let lKm be the commutative and idem potent semiring (lK U {-oo }, max, + ).
Theroem. Let lK be a (max, + )-semiring. Determinizability of a unary lK-automaton is decidable. We present in a first part two properties of sequential series with values in a (max, + )-semiring. As in the case of functions with values in a free monoid [9], we show that a function is sequential if, and only if, the number of its translated series is finite.
We use the additive notations for the sum (which is actually the multiplication law of the semi ring) . Any function or series rp : X -+ lKm, the support of rp, denoted by Supp(rp) is the set of elements x E X such that xrp ¥ -00 .
The second property is uniform divergence, which is often called bounded variations. This is a classical characterization of sequential functions with values in a monoid of words. This can not be extended to (max, + )-automata. In fact, contrary to transducers, there are (max, + }-automata which realize functions which can not be realized unam-
Definition 1. A lK-automaton A is a sextuple (Q, A,lKm, E,I,T), where E: Q x A x Q -+ lKm, [ : Q -+ lKm and T : Q -+ lKm are functions . For any e = (p,a,q) E Q x A x Q, e is a transition if e E Supp(E). The elements of Supp(I)
765
and Supp(T) are respectively called initial and terminal states.
T he proof of the theorem makes use of the following lemma:
The value of a path is the product of values of its transitions which is, with sum notations,
Lemma 5. Let u, u' E A* . If u-1Supp(a) u,-lSupp(a) and, for all v E u-1Supp(a) , Ju ,u'(v) = (a, uv) - (a, u'v) does not depend on v , then Ju ,u' = (~, u) - (~, u') and a/u = a/u' .
Ep=
LEe .. iE[l ;kl
A computation is a path C which begins in an initial state i and ends in a final state t. Its value is Ec [j +Ec +Tt .
=
• If the set of translated series is finite , let Q {a/u I u E A-} and Aa = (Q,A,lK,E,I,T) be the following automaton :
=
For any subset X of Q, any u E A* , X . u is the set of states of Q that can be reached from a state of X by a path labeled by u ; X * u is the maximum value of all these paths and ~ the maximum value of corresponding computations. The maximum of an empty set is -00 .
Ta / u
(~, ua) - (~, u) E IK by definition of ~. We can check that this automaton is deterministic and that it realizes a. • If a is sequential, there exists a deterministic automaton A (Q, A, lK, E, [, T) realizing a . Let i be its initial state. For all u, v E A*,
*»
er;u.
=
(a, uv) = Ij
3.1 Translated Series of a Series
3.2 Topological Property and Sequentiality
Definition 3. We define the series ~ in lKm«A*» according to the sign of lie For every " in f1 * , let D = u-1Supp(a).
For (u, v) E A* , we define u 1\ v as the longuest prefix common to u and v. ap is the prefix distance defined by dp(u, v) = lul + Ivl- 21u 1\ vi ·
« *» is uniformly
• IflK > 0, (~,u) = min{(uv,a) I v E D}. • If IK < 0, (~, u) = maxi (uv , a) I v E D} . • Else, (~, u) = (a, uv), where v is the smallest element of D according to the radix order 1 .
Definition 6. A series a in lKm A diverging 2 if
Vk E N, 3N, Vu, v E Supp(a), dp(u, v) ~ k:::}1 (a, u) - (a, v)1 ~ N .
For every u E A *, The left translated series of a by u is defined by :
Remark. Supp(a/u)
(1)
Actually {a/u define
= u-1Supp(a) .
Nk
(lxl = IYI
uEA-
E A*} is finite . For all k , we max
vESupp(a/u),lvl~k
{I(a/u, v)l}.
I(a , u) - (a, v)1 ~ 2Nk.
~
k, it
(4)
We follow (2), while the usual terminology is "series with bounded variation" [3,8) .
2
or
= max
Iu
Then, for all u, v E N such that dp(u, v) is easy to see that
Theorem 4. A series a in lKm«A*» is sequential if, and only if, the set of its translated serIes, {a/u I u E A*} is finite .
(Ixl < Iyn
(3)
Proposition 7. If a is a sequential series, it is uniformly diverging.
These translated series give, as for transducers, a criterium of sequentiability:
I x < y iff
(2)
Remark. As for transducers, this proof shows that if there exists a deterministic automaton, there exists a minimal and canonical one.
The series ~ is defined such that (~, u) is the "biggest common part" of elements of (a, A *) . This definition is inspired by the case of functions into a free monoid [9].
(~, u)
+ i * u + (i · u) * v + T(i.u)v.
Then, for all u , u' in A*, if i . u = i . u', from Lemma 5, a/u = a/u' . There is a surjection from states of A into the set of translated series of a which is, therefore, finite. 0
3. TWO PROPERTIES OF SEQUENTIAL SERIES
= (a, uv) -
=(~, ua) - (~, u)
E(a/u,a ,a/(ua»
Definition 2. A series a in lKm «A is rational if there exists a lK-automaton A such that, for every u E A* , (a, u) = We say that A realizes the series a. A series is sequential if there exists a deterministic lK-automaton that realizes it.
"Iv, (a/u, v)
=(~, lA-) ' SUpp(I) = {a/lA-}, =(a/u, lA-)'
[a/lA_
and x
766
a/l ,:S- a1o,:sFig. 1. An ambiguous rational series Then 0' is uniformly diverging.
0
Contrary to the case of transducers [3], the erty 3 is not characteristic.
pro~
Fig. 2. The N-automaton that realizes Al. From these sets we can decide the sequentiality of the realized series; that is our main theorem :
Proposition 8. A rational and uniformly diverging series can be a non-sequential series.
Theorem 12. A rational series 0' realized by an automaton A is sequential if, and only if, C]f(A) is finite .
Example 9. Let 0' be the series realized by the automaton of figure 9. For all 1.1 E A 0, 1a if lul a ~ lulb (0',1.1 ) -_ {lu lulb otherwise.
The both sides of this theorem will be proved in this section (Propositions 14 and 17) .
On the one hand, this series is 1-Lipschitzian, thus uniformly diverging, On the other hand, for all n, o (0', an) = (0', an) = n,and, for all rn,
Proposition 13. Let 0' be a rational series realized bv an automaton A . i)" For all k, (a, ak ) ( emk + M(n + 2). ii) There exists (r, s) such that, for all k,
(O'/an,bm>={O
ifm(.n m - n otherwise.
The set of translated series of 0' is infinite and is not sequential.
(a, a rk +.) ~ em(rk + s) - M(4n
0'
+ 2).
i ) is easily proved by induction on k. To prove ii), we chose a cycle of maximum weight and show then the inequality. 0
This fact emphasizes the difference between the theory of sequentiality of rational functions in a monoid and the sequentiality of rational series in a semiring.
These inequalities allow to prove the following proposition: Proposition 1{ Let 0' be a rational series realized by an automaton A. If 0' is sequential, then .c]f(A) is finite.
4. DECIDABILITY OF SEQUENTIALITY FOR A UNARY ALPHABET Let A = (Q, {a}, lK, E, E, T) be a trim automaton realizing a rational series 0'. Let n be the number of states of A and M = max{IEel, e E Supp(E)}.
I f 0' is sequential, it is uniformly diverging, therefore there exists TJ such that
li - il ( r => 1(0', ai )
Definition 10. For any simple cycle C of length I, we define the weight of C by e = Eell.
-
(a, ai)1 ( TJ .
(5)
If .c]f(A) is infinite, there exists I arbitrary large such that at E .cmA). Let k be such that I E [r(k - 1) + s, rk + s). A maximum path realizing at goes through cycles with weight smaller than em - J, hence (0', at) ( M(n + 2) + (em - J)l . It then holds:
Notations . Let em be the maximum weight of simple cycles of A and let R be the set of states that belong to these cycles. Let .cR(A) be the set of words that label a path going through at least one state of R . .cmA) is the intersection of the complement of .cR(A) with the support of 0'. Let J = min{em - ele ¥- em} .
(O',a"k+')-(O',a t ») >IJ-M(Sn+4).
(6)
For I > (M(Sn + 4) + TJ)/J, this inequality in contradiction with sequentiality. 0
Example 11. Let Al be the automaton of figure 2. n = 5 and M = 3. Simple cycles are [q, q) and [5, t, 5], with respective weight 1 and 3/2. Thus R= {s,t}, em = 3/2 and J = 1/2. The support of 0'1 realized by Al is a 2 a o , .cR(At} = a 2 (a 2 )*, hence .c]f(Ad = a3 (a 2 )*.
To prove the converse proposition, the key lemma is the following. Lemma 15. For all f accepted by A for which there exists a computation going through R, there
767
exists a computation labeled by I with less than n 2 transitions out of cycles of maximum weight.
Conversely, if ak+B E Supp( 0'), a computation realizing (a, ak+B) has cycles of maximum weight of lengths [I, . . . ,[k, (k ::; n), let Ai the number of cycle of length [i. As the length out of cycles of maximum weight is smaller than N, 2:i Ai[i ~ Bn; therefore, there exists i such that Ail; ~ B; li divide B, thus there exists Ai ::; Ai such that Aili = B . Going Ai times less through cycles of length li' a k is accepted and the value of computation is (O',a k +B ) - BUm::; (O',a k ). Hence the equality. For all r ~ 0, (0', ak+Ba r ) = (a, aka r ) + BUm, then O'/a k = O'/a k + B . 0
T he proof makes use of the following application of the pigeon hole principle: Lemma 16. For all n EN, for all k ~ n, for any set (X;)iE[I;kj of elements of 'Z'../n'Z'.., there exists a non-empty set J C [1; k] such that 2:iEJ Xi = O.
By contradiction, let I be the shortest word such that for any computation there is more than n 2 transitions out of cycles of maximum weight and such that there is a computation going through a state pER. By minimality, this computation has no cycle of maximum weight. Let [ be the length of a cycle of maximum weight around p . III ~ n 2 , thus this computation goes through at least n simple cycles; [ ::; n, by the previous lemma, we can choose k of these cycl/'s such that their total length is multiple of t. We can replace them by cycles of maximum weight, which is in contradiction with minimality of I . 0
Actually, for rational series over a unary alphabet, the uniform divergence is characteristic of sequential series.
«
Proposition 18. Let 0' in oc", a *» be a rational series. 0' is sequential if, and only if, 0' is uniformly diverging. L et 0' be a rational and uniformly diverging series realized by an automaton A. Let n, M, .eR' Urn and 6 be defined as below. For all U E .eR' UO'::; M(n + 2) + (Urn - 6)lul. By proposition 14, there exists k such that for all U E .eR' 3v E A* such that dp(u,v)::; k and vO' ~ Umlvl- M(4n+ 2) . 0' is uniformly diverging, thus there exists Tf (depending only of 1:) such that :
If .eR(A) is finite, for word in Supp(O') that is long enough, there is a computation with a bounded number of transitions out of cycle of maximum weight . We shall show that, for a "long" word , this kind of computation has a maximum value.
Tf ~ IvO' - uO'I
Proposition 17. Let 0' be a rational series realized by an automaton A. If .eR(A) is finite, then 0' is sequential.
~ Umk - M(5n
Hence, the length of u is bounded. Therefore .eR is finite and 0' is sequential. 0
L et No = maxfE.c-(I/I). Let B be the lcm of lengths of simple cycles of maximum weight. Let N = max(No , n 2 + 2M(n 2 + 2)/6)). By lemma 15, for all k > N, k (O',a )
> Um(k -
2 2 n ) - M(n
+ 2) .
(8)
+ 4) + 61uI
5. UNAMBIGUITY OF RATIONAL SERIES OVER ONE LETTER
(7)
We first use a result which is a particular case of a theorem of Gaubert [6].
Let r be the smallest integer greater than N such that there exists a k E Supp(O') and a computation with a maximum value with r transitions out of cycles of maximum weight. Nevertheless, this computation has cycles, thus the value of 0' is smaller than Um(k - n 2 ) - M(n 2 + 2), which is in contradiction with inequality 7. Thus, for all words longer than N, for all computations with maximum value, there is less than N transitions out of cycles of maximum weight. We will show now that, for any k > N + Bn, (a, ak+B) = (a, ak) + BUm . If a k belongs to Supp(O') , there exists a computation realizing (a, a k ) . It goes through a state pER. Turning around P by a cycle of maximum weight, we can obtain a computation labeled by ak+B and with value equal to (a, ak) + BUm ::;
Proposition 19. Let
0'
be a rational series of
oc",<{a*». There exist sequential series 0'1, . .. ,O'k such that, for every nE N, (a, an) = max{ (ai, an) I i::; k}. Proposition 20. Any rational series unambiguous.
0' :
a*
~
lK is
L et 0'1, .. . ,O'k be sequential series such that, for every nE N, (O',a n ) = max{(O'i,a n ) I i::; k}. Let Ul, .. . , Uk be the respective weights of the cycles these series, and PI, ... , Pk be there respective periods. If U; = Uj, the series max( 0';,0' j) is sequential by the characterization of the previous section. Hence, we can suppose Ul < .. . < Uk· Therefore, if i is smaller than j, there exists
(a, ak+B).
768
Fig. 4. The automaton that realizes CR(At} .
Fig. 3. An unambiguous automaton realizing frl such that for every n > Nij, (fri , a n +p ,) = (fri ' an) + Pigi , (frj , a n+PJ ) = (frj , an) + P.j{!] and, if an E SUpp(fri) nSupp(frj), (fri , an) < (frj, a") . Let N = maxi
Fig. 5. The automaton that realizes CmA]). sequential if and only if this automaton, trim, is acyclic. Remark. This construction depends only on the structure of the underlying automaton .
Example 21. Let frl be the series of example 11. The automaton of figure 3 is an unambiguous automaton that realizes fr 1.
Example 22. Let Ai be the automaton of example 11. Figures 4 and 5 show the two steps of the decision algorithm (every edge is labeled by a). CR(At} is infinite (the trim automaton is not acyclic), hence frl is not sequential.
We can see that, contrary to the case of functional transducers, the equivalent unambiguous automat.on does not. depend only on the st.ructure of t.he lK-automaton but also on its coefficient.s. 6. EFFECTIVE ALGORlTHMS
6.2 Determinization 6.1 Decidability of Sequentiality
=
Let A (Q, A, E, f, T) be a trim automaton realizing the series fr which has been tested as sequential. We shall build a deterministic automaton realizing (}'. We consider now f and T as vectors of OC1 xQ and Jl(Qx 1 respectively. Il is a matrix of size Q x Q defined by IIp,q E(p,a .q).3 The series 1] in ~ «a·)) is defined by (1], u) = f.Il". We suppose Q ordered. For all u in A·, let D Supp«1], u)), and
From propositions of the previous part, the sequentiality depends on the finitude of Cn(A). Thus, once the set 7' is identified, we only deal with classical automata. We compute a (boolean) automaton that realize CR(A), then Cn(A). Let A (Q, A, E, J, T) be the underlying automaton of A. We build A' (Q x {O; 1},A,F,J,U), with J {(p, 0) I p E J} u {(p, 1) I pER n i},
=
=
=
= U = {(p, 1) I pET}, F = {((p, i), a, (q, i)) liE {O; I},
=
=
• IfOC > 0, (~, u) min{(1], u)p I p E D}. • If IK < 0, (ry, u) maxi (1]. u)p I p E D} . • Else , (ry, u) (1], u)p, P min(Q n D).
=
(p, a, q) E E}
=
u {«p, 0), a, (q, 1)) Iq ER, (p, a, q) E E} Then, the complementary of CR(A) is computed, and the intersection wi th the support of fr. fr is
=
3 (1,1-', T) is the linear repre$entation that corresponds to A: (a,a") = I.I-'".T.
769
The translated series is then 17/u = 17 - (ry, u). Unfortunately, the set of these translated series can be infinite. We shall modify the series 17/u to avoid this. We compute R, the set of states that belong to cycles of maximum weight. le( is divided into two parts :
[3] C. Choffrut, Une caracterisation des fonctions sequentielles et des fonctions sous-sequentielles en tant que relations rationnelles, Theoret. Comput. Sci . 5 (1977) 325-337 . [4] M. Chrobak, Finite Automata and Unary Languages, Theoret. Comput. Sci. 41 (1986) 119158 . [5] G. Cohen, P. Moller, J.-P. Quadrat, M. Viot , Algebraic Tools for the Performance Evaluation of Discrete Event Systems, IEEE Proc.: Special issue on D.E.S. 11.1 (1989). [6] S. Gaubert. Rational Series over Dioids and Discrete Event Systems. Proc. of the 11th Conf. on Anal. and Opt. of Systems, Lect. Notes in Contr. and 1nL Sci. 199 (1994) . [7] S. Gaubert, On the Burnside problem for Semigroups of Matrices in the (max, +) Algebra, Semigroup Forum 52 (1996) 271-292. [8] M. Mohri, Finite-State Transducers in Languagee and Speech Processing, Computat. Ling. 23.2 (1997) 269-311. [9] G. Raney, Sequential functions, J. Assoc. Comput. Mach 5 (1958) 177-180.
• Elements of R or descendants from these, • Other elements which form a set C. Let N be the value computed in the decidability algorithm. If pE C, for all k > N, no computation realizing (Q',a k ) goes through p after the N-th letter. Else. it would be in contradiction with the proof of the proposition 18. The series 1] is modified in order to take care of these useles states. For all k > N, if pE C, we set (1], ak)p
=
-00.
We can show that the set {7]/u I u E A*} is then finite . We define Adet = (S, A,]I(, F, J, U) with
8 = {7]/1l I U E Aa}, F: (7]/u, a, 17/(ua)) t--+ (7]/u, a) - (7]/lla, lA·) , .J : 7]/IA·
t--+
(ry , lA·) ,
(J :
7]/11
t--+
(7]/tt) .T.
It is easy to prove that this deterministic automaton realizes 0'.
7. NON-UNARY ALPHABETS The decision of the sequentiality of rational series over a non-unary alphabet seems to be much harder. Gaubert has proved that it gives the decision for the limitedness problem (personal communication based on results in [7)). On another hand, the decision of the ambiguity gives the decision of the sequentiality; this is a generalization due to Mohri[8] of the method for transducers.
8. ACKNOWLEDGMENTS The author thanks Jacques Sakarovitch for his advices. He is especially grateful to Stephane Gaubert and Jean Mairesse for their very competent remarks.
9. REFERENCES [1] A. Buchsbaum, R. Giancarlo and J. Westbrook, On the Determinization of Weighted Finite Automata, Proc. of ICALP'98, Lect. Notes in Comp. Sci . 1443 (1998) 482-493. [2] M.-P. Beal, O . Carton, C. Prieur and J. Sakarovitch, Squaring transducers, Proc. of Latin 2000, Lect. Notes in Comp. Sci. 1716, (2000) 397-406.
770