Integer Weighted Finite Automata, Matrices and Formal Power Series over Laurent Polynomials Vesa Halava Department of Mathematics, University of Turku FIN-20014 Turku, Finland and TUCS - Turku Centre for Computer Science E-mail: [email protected] Turku Centre for Computer Science TUCS Technical Report No 608 May 2004 ISBN 952-12-1349-3 ISSN 1239-1891 Abstract It is well known that the family of regular languages (over alphabet A), accepted by finite automata, coincides with the set of supports of the rational and recognizable formal power series over N with the set of variables A. Here we prove that there is a corresponding presentation for languages accepted by integer weighted finite automata, where the weights are from the additive group of integers, via the matrices over Laurent polynomials with integer coefficients. Keywords: formal power series, linear representation, Laurent polynomials, matrix, integer weighted finite automata TUCS Laboratory Discrete Mathematics for Information Technology 1 Introduction It is well known that the family of languages accepted by a finite automata (over alphabet A), can be defined also with the set of recognizable formal power series over N, which on the other hand is equal with the set of rational formal power series over N, where A is considered as a noncommutative set of variables. This connection is proved by using the matrix representation of the finite automata. Here we give a similar representation for the family of languages accepted with the integer weighted finite automata, see [4, 5]. In these automata the weights are from the additive group of integers and a word is accepted, if it has a successful path in the underlying automaton and the weight of the path adds up to zero. We show that there is a connection between these languages and the recognizable and rational formal power series with coefficients from the ring of the Laurent polynomials with integer coefficients. The proof uses the representation of the integer weighted finite automata with matrices over the Laurent polynomials. The difference between these two constructions is in the definition of the language defined with the series. Next we give the basic definitions on words and languages. Let A be a finite set of symbols, called an alphabet. A word over A is a finite sequence of symbols in A. We denote by A∗ the set of all words over A. Note that also the empty word, denoted by ε, is in A ∗ . Let u = u1 . . . un and v = v1 . . . vm be two words in A∗ , where each ui and vj are in A for 1 ≤ i ≤ n and 1 ≤ j ≤ m. The concatenation of u and v is the word u · v = uv = u1 . . . un v1 . . . vm . The operation of concatenation is associative on A∗ , and thus A∗ is a semigroup (containing an identity element ε). Let A+ = A∗ \ {ε} be the semigroup of all nonempty words over A. A subset L of A∗ is called a language. 2 Formal power series Here we give the needed definitions and notations on formal power series. As a general reference and for the details, we give [2, 9, 11] . Let K be a semiring and A an alphabet. A formal power series S is a function A∗ → K. Note that here A is considered as a (noncommutative) set of variables. The image of a word w under S is denoted by (S, w) and it is called the coefficient of w in S. The support of S is the language supp(S) = {w ∈ A∗ | (S, w) 6= 0}. The set of formal series over A with coefficients in K is denoted by KhhAii. A formal series with a finite support is called a polynomial. The set of 1 polynomials is denoted by KhAi. Let S and T be two formal series in KhhAii. Then their sum is given by (S + T, w) = (S, w) + (T, w) and their product by (ST, w) = X (S, u)(T, v). uv=w We also define two external operations of K in KhhAii. Assume that a is in K and S in KhhAii, then the series aS and Sa are defined by (aS, w) = a(S, w) and (Sa, w) = (S, w)a. P A formal series S can also be written in the sum form S = aw w over ∗ all w ∈ A such that aw is the coefficient of w in K, i.e. (S, w) = a w . A formal series S in KhhAii is called proper if the coefficient of the empty word vanishes, that is (S, ) = 0. Let S be proper formal series. Then the family (S n )n≥0 is locally finite (see [2]), and we can define the sum of this family, denoted by X S∗ = Sn n≥0 and it is called the star of S. Note that S 0 = 1, S 1 = S and S n = SS n−1 , where 1 is the identity of K under product. The rational operations in KhhAii are the sum, the product and the star. A formal series is called rational if it is an element of the rational closure of KhAi, i.e. it can be defined using the polynomials KhAi and the rational operations. The family of rational series is denoted by K rat hhAii. As usual, we denote by K m×n the set of the m × n matrices over K. A formal series S ∈ KhhAii is called recognizable if there exists an integer n ≥ 1, and a monoid morphism µ : A∗ → K n×n , into the multiplicative structure of K n×n , and two vectors ı, ρ ∈ K n such that for all words w, (S, w) = ıµ(w)ρT . The triple (ı, µ, ρ) is called a linear representation of S with dimension n. The set of recognizable series over K is denoted by K rec hhAii The next theorem is fundamental in the theory of rational series. It was first proved by Kleene in 1956 for languages that are those series with coefficients in the Boolean semiring. It was later extented by Schützenberger to arbitrary semirings. For details, see [2, 9, 11]. Theorem 2.1. A formal series is recognizable if and only if it is rational. 2 3 Finite automaton A (nondeterministic) finite automaton is a quintuple A = (Q, A, δ, q A , F ), where Q is a finite set of states, A is a finite input alphabet, δ : Q × A → 2 Q is a transition function, qA ∈ Q is an initial state and F is the set of final states. A transition p ∈ δ(q, a), where p, q ∈ Q and a ∈ A, will also be written as (q, a, p), in which case δ ⊆ Q × A × Q is regarded as a relation (and sometimes also as an alphabet). Without loss of generality, we can assume that Q = {1, 2, . . . , n} for some n ≥ 1, and qA = 1 . Indeed, renaming of the states will not change the accepted language. A path π of A (from q1 to qn+1 ) is a sequence π = t1 t2 . . . tk where ti = (qi , ai , qi+1 ) ∈ δ (1) for i = 1, 2, . . . , k. If we consider δ as an alphabet, then we can write π ∈ δ ∗ . The label of the path π in (1) is the word kπk = a 1 a2 . . . ak . Let A(w : p → q) = {π | π a path from p to q with kπk = w} . Moreover, a path π ∈ A(w : p → q) is successful (for w), if p = 1 and q ∈ F . The language accepted by A is the subset L(A) ⊆ A ∗ consisting of the labels of the successful paths of A: L(A) = {w ∈ A∗ | π ∈ A(w : 1 → q) for some q ∈ F } . It is well-known that each finite automata has a matrix representation obtained as in the following. Let A = (Q, A, δ, 1, F ) be a finite automaton with n states, i.e., Q = {1, 2, . . . , n}. Define for all a ∈ A, the matrix Ma ∈ Nn×n by ( 1, if j ∈ δ(i, a), (Ma )ij = (2) 0, otherwise. We define a monoid morphism µ : A∗ → Nn×n by setting µ(a) = Ma , where the operation in Nn×n is the usual matrix multiplication. Let ı = (1, 0, . . . , 0), where only the first term is nonzero, and let ρ = (ρ1 , ρ2 , . . . , ρn ) in Nn where ( 1, if qi ∈ F, ρi = (3) 0, otherwise. The triple (ı, µ, ρ) is then called the linear representation of A. For the proof for the following theorem, see [2, 9, 11]. 3 Theorem 3.1. A language L is accepted by a finite automaton if and only if there exists a linear representation (ı, µ, ρ) such that w ∈ L ⇐⇒ ıµ(w)ρT 6= 0. Note that we could have defined the matrices over the boolean semiring B instead of the semiring N, and then replacing ıµ(w)ρ T 6= 0 by ıµ(w)ρT = 1. But using the ring N, we achieve the following advantage. Theorem 3.2. For a finite automaton A having a linear representation (ı, µ, ρ), the value ıµ(w)ρT equals the number of different successful paths in A for w. By Theorem 3.1 and the fundamental theorem, Theorem2.1, we get the following corollary. Corollary 3.3. L ⊆ A∗ is a regular language if and only if there exists a formal series SL ∈ Nrat hhAii = Nrec hhAii such that L = supp(SL ). Note that it follows that the regular languages are closed under the rational operations, since Nrat hhAii is. 4 Laurent polynomials and weighted automata In this section we give a corresponding representation for the languages accepted by the integer weighted finite automata. We begin with some definitions. A Laurent polynomial p ∈ Z[x, x−1 ] with coefficients in Z is a series p(x) = . . . a−2 x−2 + a−1 x−1 + a0 + a1 x + a2 x2 + . . . , where there are only finitely many nonzero coefficients a i ∈ Z. The constant term of the Laurent polynomial p ∈ Z[x, x −1 ] is a0 . The family of Laurent polynomials with coefficients in Z forms a ring with respect to the operations of sum and multiplication, that are defined in the usual way. Indeed, the sum is defined componentwise and the multiplication is the Cauchy product of the polynomials: ! ! ∞ ∞ ∞ X X X X i i ai x bi x = ( aj bk )xi . i=−∞ i=−∞ i=−∞ j+k=i Note that in the definition of Laurent polynomials we could have used also arbitrary ring instead of Z, but here we need only the integer case. Actually, we concentrate on matrices over Laurent polynomials with integer coefficients, that is, the elements of Z[x, x −1 ]n×n for n ≥ 1. A Laurent polynomial matrix M = (cij )n×n ∈ Z[x, x−1 ]n×n 4 is a n × n-square matrix the entries of which are Laurent polynomials from Z[x, x−1 ]. For these matrices, multiplication is defined in the usual way using the multiplication of the ring Z[x, x −1 ]. Indeed, if M1 = (cij )n×n and M2 = (dij )n×n , then M1 · M2 = (eij )n×n , where eij = n X cik dkj ∈ Z[x, x−1 ]. k=1 Also the sum for these matrices can be defined, but we are interested in the semigroups generated by a finite number of Laurent polynomials under multiplication. Next we consider a generalization of finite automata where the transitions have integer weights. The type of automata we consider is closely related to the 1-turn counter automata as considered by Baker and Book [1], Greibach [3], and especially by Ibarra [8]. Also, regular valence grammars are related to these automata, see [7]. Moreover, the extended finite automata of Mitrana and Stiebe [10] are generalizations of these automata. Consider the additive group of Z of integers. A (Z-)weighted finite automaton Aγ consists of a finite automaton A = (Q, A, δ, 1, F ) as above, except that here δ may be a finite multiset of transitions in Q × A × Q, and a weight function γ : δ → Z. We let δ be a multiset in order to be able to define (finitely) many different weights for each transition of A. For example, it is possible that for t1 , t2 ∈ δ, t1 = (i, a, j) = t2 and γ(t1 ) 6= γ(t2 ). Let π = t1 t2 . . . tk be a path of A, where ti = (qi , ai , qi+1 ) for i = 1, 2, . . . , k. The weight of π is the element γ(π) = γ(t1 ) + γ(t2 ) + · · · + γ(tk ). Furthermore, we let L(Aγ ) = {w ∈ A∗ | γ(π) = 0, π ∈ A(w : 1 → q) for some q ∈ F } , be the language of Aγ . In other words, a word is accepted by A γ if and only if there is a successful path of weight 0 in A γ . Next we shall introduce a matrix representation of integer weighted finite automata with the matrices over the Laurent polynomials Z[x, x −1 ]. Let Aγ be a weighted finite automaton, where A = (Q, A, δ, 1, F ) and γ : δ → Z. Let again Q = {1, 2, . . . , n}. Define for each element a ∈ A and a pair of states i, j ∈ Q the Laurent polynomial X paij = xγ(t) . t=(i,a,j)∈δ Moreover, define the Laurent polynomial matrix M a ∈ Z[x, x−1 ]n×n for all a ∈ A by (Ma )ij = paij . (4) 5 Let µ : A∗ → Z[x, x−1 ]n×n be the morphism defined by µ(a) = Ma . Let ı and ρ be the vectors as in (3). The triple (ı, µ, ρ) is called a Laurent representation of Aγ . For completeness sake, we give here the proof of the following result of [6]. Lemma 4.1. Let (ı, µ, ρ) be a Laurent representation of A γ , and let w ∈ A∗ . Then the coefficient of xz in µ(w)ij is equal to the number of paths π ∈ A(w : i → j) of weight z. Proof. We write Mu = µ(w) for each word w. We prove the claim by induction on the length of the words. The claim is trivial, if w ∈ A. Assume then the claim holds for the words u, v ∈ A + , and let (Mu )ij = puij = P zthat z z z αij x , where αrs is the number P zof zpaths fromz A(u : i → j) of weight z. x , where βrs is the number of paths Similarly, let (Mv )ij = pvij = z βij from A(v : i → j) of weight z. Now, (Mu Mv )ij = n X puik pvkj k=1 = n X X = n X X k=1 αzik1 xz1 z1 z2 z1 +z2 αzik1 βkj x = k=1 z1 ,z2 X z2 z2 βkj x z2 n XX z2 z1 +z2 αzik1 βkj x . z1 ,z2 k=1 In other words, the coefficient of xz is equal to wherefrom the claim easily follows. P z1 +z2 =z Pn z1 z2 k=1 αik βkj , The following result is an immediate corollary to Lemma 4.1. Theorem 4.2. Let (ı, µ, ρ) be a Laurent representation of A γ , and let w ∈ A∗ Then the constant term c of ıµ(w)ρT equals the number of different successful paths of w in Aγ . In particular, w ∈ L(Aγ ) if and only if c > 0. Since Z[x, x−1 ] is a ring we can also study the formal power series Z[x, x−1 ]hhAii. Note that the zero element of Z[x, x −1 ] is the zero polynomial, where all the coefficients are 0. By Theorem 2.1, we get the following corollary. Corollary 4.3. A language L ⊆ A∗ accepted with Aγ if and only if there exists a formal power series SL ∈ Z[x, x−1 ]rat hhAii = Z[x, x−1 ]rec hhAii such that n X w ∈ L ⇐⇒ (SL , w) = ai xi and a0 6= 0. i=m Note that the this corollary does not give any closure properties on the family of languages accepted with integer weighted finite automata. The closure properties of these languages were studied in [4]. For example, the family is not closed under star. 6 Note also that the undecidability result in [5] gives undecidability result for matrices over Laurent polynomials, see [6]. Actually, for the power series SL ∈ Z[x, x−1 ]hhAii in Corollary 4.3, supp(SL ) = L(A), i.e., the support of SL is the regular language accepted by the underlying automaton of Aγ . By reordering the terms according to powers of the variable x, we get SL = n X Lz xz , (5) z=m where Lz is the sum of words of the language {w ∈ A∗ | π ∈ A(w : 1 → q) for some q ∈ F, γ(π) = z} ⊆ A ∗ , with multiplicities from Z. We denote these languages simply by L z . Now L0 = L(Aγ ) = L and L(A) = ∪z∈Z Lz . Note that this union can be infinite, since the sum (5) can be infinite, even for both directions. It follows also by the rationality of SL that the languages Lz are in the family of languages accepted with integer weighted finite automata, since x −z SL ∈ Z[x, x−1 ]rat hhAii. Acknowledgements I want to thank Dr. Tero Harju for the several comments and suggestion for this work during our coffee breaks. References [1] B. Baker and R. Book, Reversal-bounded multipushdown machines, J. Comput. System Sci. 8 (1974), 315–332. [2] J. Berstel and C. Reutenauer, Rational series and their languages, Springer-Verlag, 1988. [3] S. A. Greibach, An infinite hierarchy of context-free languages, J. Assoc. Comput. Mach. 16 (1969), 91–106. [4] V. Halava and T. Harju, Languages accepted by integer weighted finite automata, Jewels are forever, Springer, Berlin, 1999, pp. 123–134. [5] V. Halava and T. Harju, Undecidability in integer weighted finite automata, Fund. Inform. 38 (1999), no. 1-2, 189–200. [6] V. Halava and T. Harju, Undecidability in matrices over Laurent polynomials, Tech. Report 600, TUCS, 2004, to appear in Adv. in Appl. Math. 7 [7] V. Halava, T. Harju, H. J. Hoogeboom, and M. Latteux, Valence languages generated by generalized equality sets, Tech. Report 502, TUCS, 2002, to appear in JALC. [8] O. H. Ibarra, Restricted one-counter machines with undecidable universe problems, Math. Systems Theory 13 (1979), 181–186. [9] W. Kuich and A. Salomaa, Semirings, automata, languages, SpringerVerlag, 1986. [10] V. Mitrana and R. Stiebe, The accepting power of finite automata over groups, New Trends in Formal Language (G. Păun and A. Salomaa, eds.), Lecture Notes in Comput. Sci., vol. 1218, Springer-Verlag, 1997, pp. 39–48. [11] A. Salomaa and M. Soittola, Automata–theoretic aspects of formal power series, Springer–Verlag, 1978. 8 Turku Centre for Computer Science Lemminkäisenkatu 14 FIN-20520 Turku Finland http://www.tucs.fi University of Turku • Department of Information Technology • Department of Mathematics Åbo Akademi University • Department of Computer Science • Institute for Advanced Management Systems Research Turku School of Economics and Business Administration • Institute of Information Systems Science
© Copyright 2026 Paperzz