General Algorithms for Testing the Ambiguity of Finite Automata and the Double-Tape Ambiguity of Finite-State Transducers

Size: px
Start display at page:

Download "General Algorithms for Testing the Ambiguity of Finite Automata and the Double-Tape Ambiguity of Finite-State Transducers"

Transcription

1 Interntionl Journl of Foundtions of Computer Science c World Scientific Pulishing Compny Generl Algorithms for Testing the Amiguity of Finite Automt nd the Doule-Tpe Amiguity of Finite-Stte Trnsducers CYRIL ALLAUZEN Google Reserch, 76 Ninth Avenue, New York, NY 10011, US. lluzen@google.com MEHRYAR MOHRI Cournt Institute of Mthemticl Sciences, 251 Mercer Street, New York, NY 10012, US, nd Google Reserch, 76 Ninth Avenue, New York, NY 10011, US. mohri@cs.nyu.edu ASHISH RASTOGI Goldmn, Schs & Co., 200 West Street, New York, NY 10282, US. shish.rstogi@gs.com We present efficient lgorithms for testing the finite, polynomil, nd exponentil miguity of finite utomt with ǫ-trnsitions. We give n lgorithm for testing the exponentil miguity of n utomton A in time O( A 2 E ), nd finite or polynomil miguity in time O( A 3 E ), where A E denotes the numer of trnsitions of A. These complexities significntly improve over the previous est complexities given for the sme prolem. Furthermore, the lgorithms presented re simple nd sed on generl lgorithm for the composition or intersection of utomt. Additionlly, we give n lgorithm to determine in time O( A 3 E ) the degree of polynomil miguity of polynomilly miguous utomton A nd present n ppliction of our lgorithms to n pproximte computtion of the entropy of proilistic utomton. We lso study the doule-tpe miguity of finite-stte trnsducers. We show tht the generl prolem is undecidle nd tht it is NP-hrd for cyclic trnsducers. We present specific nlysis of the doule-tpe miguity of trnsducers with ounded dely. In prticulr, we give chrcteriztion of doule-tpe miguity for synchronized trnsducers with zero dely tht cn e tested in qudrtic time nd give n lgorithm for testing the doule-tpe miguity of trnsducers with ounded dely. Reserch done t the Cournt Institute, prtilly supported y the New York Stte Office of Science Technology nd Acdemic Reserch (NYSTAR). 1

2 2 C. Alluzen, M. Mohri nd A. Rstogi 1. Introduction A finite utomton is miguous if it dmits distinct ccepting pths with the sme lel. The question of the miguity of finite utomt rises in vriety of contexts. In some cses, the ppliction of n lgorithm requires n input utomton to e finitely miguous, in others, the convergence of ound or gurntee relies on finite miguity, or the symptotic growth rte of miguity s function of the string length. Thus, in ll these cses, n lgorithm is needed to test the miguity, either to determine if it is finite, or to estimte its symptotic growth rte. The prolem of testing miguity hs een extensively nlyzed in the pst [10, 8, 17, 3, 7, 19, 16, 18, 20]. The prolem of determining the degree of miguity of n utomton with finite miguity ws shown y Chn nd Irr to e PSPACEcomplete [3]. However, testing finite miguity cn e chieved in polynomil time using chrcteriztion of exponentil nd polynomil miguity given y Irr nd Rvikumr [7] nd Weer nd Seidel [19]. The most efficient lgorithms for testing polynomil nd exponentil miguity, therey testing finite miguity, were given y Weer nd Seidel [18, 20]. The lgorithms they presented in [20] ssume the input utomton to e ǫ-free, ut they re extended y Weer to the cse where the utomton hs ǫ-trnsitions in [18]. In the presence of ǫ-trnsitions, the complexity of the lgorithms given y Weer [18] is O(( A E + A 2 Q )2 ) for testing the exponentil miguity of n utomton A nd O(( A E + A 2 Q )3 ) for testing polynomil miguity, where A E stnds for the numer of trnsitions nd A Q the numer of sttes of A. This pper presents significntly more efficient lgorithms for testing finite, polynomil, nd exponentil miguity for the generl cse of utomt with ǫ- trnsitions. It gives n lgorithm for testing the exponentil miguity of n utomton A in time O( A 2 E ), nd finite or polynomil miguity in time O( A 3 E ). The min ide ehind our lgorithms is to mke use of the composition or intersection of finite utomt with ǫ-trnsitions [14, 13]. The ǫ-filter used in these lgorithms crucilly helps in the nlysis nd test of the miguity. The lgorithms presented in this pper would not e vlid nd would led to incorrect results without the use of the ǫ-filter. We lso give n lgorithm to determine in time O( A 3 E ) the degree of polynomil miguity of polynomilly miguous utomton A nd present n ppliction of our lgorithms to n pproximte computtion of the entropy of proilistic utomton. The notion of miguity is defined in similr wy for finite-stte trnsducers if one is only interested in the miguity with respect to the input lels, or only the output lels, of trnsducer. With tht definition, ll our results for utomt pply directly to the trnsducer cse s well. There is, however, nother notion of interest for trnsducers tht reltes to oth input nd output lels nd tht we refer to s the doule-tpe miguity of trnsducer. A trnsducer is doule-tpe miguous if it dmits two distinct ccepting pths with the sme input lel nd the sme output lel. Doule-tpe miguity cn led to inefficiencies in vriety

3 Testing Automt Amiguity nd Trnsducer Doule-Tpe Amiguity 3 of pplictions where trnsducers re now commonly used, e.g., mchine trnsltion, speech recognition, other lnguge processing res, nd imge processing. This motivtes our study of the doule-tpe miguity of finite-stte trnsducers. We show tht the generl prolem of doule-tpe miguity is undecidle nd tht it is NP-hrd even for cyclic trnsducers. We lso present specific nlysis of the doule-tpe miguity of trnsducers with ounded dely. In prticulr, we give chrcteriztion of doule-tpe miguity for synchronized trnsducers with zero dely tht cn e tested in qudrtic time nd give n lgorithm for testing the doule-tpe miguity of trnsducers with ounded dely. The reminder of the pper is orgnized s follows. Section 2 presents generl utomt nd miguity definitions. In Section 3, we give rief description of existing chrcteriztions for the miguity of utomt nd extend them to the cse of utomt with ǫ-trnsitions. In Section 4, we present our lgorithms for testing finite, polynomil, nd exponentil miguity, nd the proof of their correctness. Section 5 dels with questions relted to the doule-tpe miguity of finite-stte trnsducers. Section 6 shows the relevnce of the computtion of the polynomil miguity to the pproximtion of the entropy of proilistic utomt. 2. Preliminries Definition 1. A finite utomton A is 5-tuple (Σ, Q, E, I, F) where Σ is finite lphet; Q is finite set of sttes; I Q the set of initil sttes; F Q the set of finl sttes; nd E Q (Σ {ǫ}) Q finite set of trnsitions, where ǫ denotes the empty string. We denote y A Q the numer of sttes, y A E the numer of trnsitions, nd y A = A E + A Q the size of n utomton A. Given stte q Q, E[q] denotes the set of trnsitions leving q. For two susets R Q nd R Q, we denote y P(R, x, R ) the set of ll pths from stte q R to stte q R leled with x Σ. We lso denote y p[π] the origin stte, y n[π] the destintion stte, nd y i[π] Σ the lel of pth π. A stte q Q is ccessile if there exists pth from n initil stte to q nd co-ccessile if there exists pth from q to finl stte. A string x Σ is ccepted y A if it lels n ccepting pth, tht is pth from n initil stte to finl stte. A finite utomton A is sid to e trim if ll its sttes lie on some ccepting pth, tht is if every stte is oth ccessile nd co-ccessile. It is sid to e unmiguous if no string x Σ lels two distinct ccepting pths; otherwise, it is sid to e miguous. The degree of miguity of string x in A is denoted y d(a, x) nd defined s the numer of ccepting pths in A leled y x. Note tht if A contins n ǫ-cycle lying long n ccepting pth, there exists x Σ such tht d(a, x) =. Using depth-first serch of A restricted to ǫ-trnsitions, it cn e decided in liner time if A contins such ǫ-cycles. Thus, in the following, we will ssume, without loss of generlity, tht A is ǫ-cycle free.

4 4 C. Alluzen, M. Mohri nd A. Rstogi v v v v v 1 v 1 v 2 v 2 v d v d p p v q p 1 v 1 q 1 u 2 p 2 v 2 q 2 u d p d v d q d () () (c) Fig. 1. Illustrtion of the properties: () (EDA); () (IDA); nd (c) (IDA d ). The degree of miguity of A is defined s d(a) = sup x Σ d(a, x). A is sid to e finitely miguous if d(a) < nd infinitely miguous if d(a) =. It is sid to e polynomilly miguous if there exists polynomil h such tht d(a, x) h( x ) for ll x Σ. The miniml degree of such polynomil is clled the degree of polynomil miguity of A nd is denoted y dp(a). By definition, dp(a) = 0 iff A is finitely miguous. When A is infinitely miguous ut not polynomilly miguous, it is sid to e exponentilly miguous nd dp(a) =. 3. Chrcteriztion of infinite miguity The chrcteriztion nd test of finite, polynomil, nd exponentil miguity of finite utomt without ǫ-trnsitions re sed on the following three fundmentl properties [7, 19, 18, 20]. Definition 2. The properties (EDA), (IDA), nd (IDA d ) for A re defined s follows. () (EDA): there exists stte q with t lest two distinct cycles leled y some v Σ (see Figure 1()) [7]. () (IDA): there exist two distinct sttes p nd q with pths leled with v from p to p, p to q, nd q to q, for some v Σ (see Figure 1()) [19, 18, 20]. (c) (IDA d ): there exist 2d sttes p 1,...,p d, q 1,...,q d in A nd 2d 1 strings v 1,..., v d nd u 2,...,u d in Σ such tht for ll 1 i d, p i q i nd P(p i, v i, p i ), P(p i, v i, q i ), nd P(q i, v i, q i ) re non-empty, nd, for ll 2 i d, P(q i 1, u i, p i ) is non-empty (see Figure 1(c)) [19, 18, 20]. Oserve tht (EDA) implies (IDA) s shown elow. Indeed, ssuming (EDA), let e nd e e the first trnsitions tht differ in the two cycles t stte p, then, since Definition 1 disllows multiple trnsitions etween the sme two sttes with the sme lel, we must hve n[e] n[e ]. Thus, (IDA) holds for the pir (n[e], n[e ]). In the ǫ-free cse, it ws shown tht trim utomton A stisfies (IDA) iff A is infinitely miguous [19, 20], tht A stisfies (EDA) iff A is exponentilly miguous [7], nd tht A stisfies (IDA d ) iff dp(a) d [18, 20]. In the following, we show tht these results cn e extended to the cse of utomt with ǫ-trnsitions. To simplify the proofs, we first consider the cse of multiset utomt. A multiset utomton or m-utomton is 5-tuple (Σ, Q, E, I, F) s defined in Definition 1 except tht E nd F re multisets. We will denote y the union of two

5 Testing Automt Amiguity nd Trnsducer Doule-Tpe Amiguity 5 multisets ({1, 2} {1, 3} = {1, 1, 2, 3}), y the sclr multipliction of multiset y nturl numer (2 {1, 1, 2} = {1, 1, 1, 1, 2, 2}), y X the multiplicity of element in the multiset X ( {1, 1, 2} 1 = 2) nd y X the crdinlity ( {1, 1, 2} = 3) of X. Lemm 3. Let A e trim ǫ-free m-utomton. (i) A is infinitely miguous iff A stisfies (IDA). (ii) A is exponentilly miguous iff A stisfies (EDA). (iii) dp(a) d iff A stisfies (IDA d ). Proof. Given trim m-utomton A = (Σ, Q, E, I, F), we construct finite utomton A = (Σ {#}, Q, E, I, F ) y inserting trnsition leled with # fter ech trnsition nd from ech finl stte s follows: Q = Q Q E Q F with Q E = {q e e E} nd Q F = {q f f F }, E = {(p[e], i[e], q e ), (q e, #, n[e])} {(f, #, q f )}, nd e E F = Q F. Oserve tht the crdinlity of the set Q E (resp. Q F ) is equl to the crdinlity of the multiset E (resp. F). Ech stte q E hs only one incoming nd one outgoing trnsition. The mpping α E : e (p[e], i[e], q e )(q e, #, n[e]) is n injection from E into E 2 nd the mpping α F : f (f, #, q f ) n injection from F into E. Severl key properties follow from the existence of these injections. (1) A is trim since A is trim (follows from the existence of α E nd α F ). (2) There exists n injection β : e 1... e n α E (e 1 )...α E (e n ) from the set of pths in A to the set of pths in A such tht the following conditions re equivlent: () (IDA) (resp. (EDA), (IDA d )) holds for A, () (IDA) (resp. (EDA), (IDA d )) holds for ll pths in the imge of β nd (c) (IDA) (resp. (EDA), (IDA d )) holds for A. (3) The mpping γ : x 1 x 2... x n x 1 #x 2 #... x n ## is ijection from the lnguge ccepted y A to the lnguge ccepted y A nd (4) d(a, x) = d(a, γ(x)) for ll x Σ since the mpping δ : π β(π)α F (n[π]) is ijection etween the sets of ccepting pths of A nd A such tht i[δ(π)] = γ(i[π]). The proposition holds for A since A is stndrd trim utomton s shown in [19, 20] for (i), [7] for (ii) nd [20] for (iii). Hence, it follows from (2) nd (4) tht the proposition lso hold for A. We will now show tht Lemm 3 cn e generlized to the cse of m-utomt with ǫ-trnsitions. f F Lemm 4. Let A e trim ǫ-cycle free m-utomton. (i) A is infinitely miguous iff A stisfies (IDA). (ii) A is exponentilly miguous iff A stisfies (EDA).

6 6 C. Alluzen, M. Mohri nd A. Rstogi 0 1 ε 2 2,1 ε ε ε 1,2 ε 1,1 ε 2,2 0,0 0,0 1,1 ε 2,2 0 1 ε 2 0,1 # 0,2 1,1 () () (c) (d) (e) # # 1,2 2,2 Fig. 2. ǫ-filter nd miguity: () Finite utomton A; () A A without using ǫ-filter, which incorrectly mkes A pper s exponentilly miguous; (c) A A using n ǫ-filter. Weer s processing of ǫ-trnsitions: (d) Finite utomton B; (e) ǫ-free utomton B such tht dp(b) = dp(b ). (iii) dp(a) d iff A stisfies (IDA d ). Proof. The proof is y induction on the numer of ǫ-trnsitions in A. If A does not hve ny ǫ-trnsition, then the proposition holds nd follows from Lemm 3. Assume now tht A hs n+1 ǫ-trnsitions, n 0, nd tht the sttement of the proposition holds for ll m-utomt with n ǫ-trnsitions. Select n ǫ-trnsition e 0 in A such tht there re no outgoing ǫ-trnsitions in n[e 0 ]. Such trnsition must exist since A is ǫ-cycle free. Let A e the m-utomton otined fter ppliction of ǫ-removl to A limited to trnsition e 0. A is otined y deleting e 0 from A nd y dding trnsition (p[e 0 ], l[e], n[e]) for every trnsition e E[n[e 0 ]], i.e. the multiset E of trnsitions of A is defined s: E = (E \ {e 0 }) {(p[e 0 ], l[e], n[e]) e E such tht p[e] = n[e 0 ]}. Finlly, p[e 0 ] is dded to the multiset of finl sttes s mny times s the multiplicity of n[e 0 ] in F, i.e. the multiset F of finl sttes of A is defined s: F = F ( F n[e0] {p[e 0 ]}). It is cler tht A nd A re equivlent nd tht there is lel nd cceptncepreserving ijection etween the pths in A nd A. Thus, () A stisfies (IDA) (resp. (EDA), (IDA d )) iff A stisfies (IDA) (resp. (EDA), (IDA d )) nd () for ll x Σ, d(a, x) = d(a, x). By induction, Lemm 4 holds for A nd thus, it follows from () nd () tht Lemm 4 lso holds for A. The cse of finite utomt with ǫ-trnsitions then follows s corollry of Lemm 4. Proposition 5. Let A e trim ǫ-cycle free finite utomton. (i) A is infinitely miguous iff A stisfies (IDA). (ii) A is exponentilly miguous iff A stisfies (EDA). (iii) dp(a) d iff A stisfies (IDA d ). These chrcteriztions hve een used in [18, 20] to design lgorithms for testing infinite, polynomil, nd exponentil miguity, nd for computing the degree of

7 Testing Automt Amiguity nd Trnsducer Doule-Tpe Amiguity 7 polynomil miguity in the cse of ǫ-free finite utomt. Theorem 6 ([18,20]) Let A e trim ǫ-free finite utomton. (1) It is decidle in time O( A 3 E ) whether A is infinitely miguous. (2) It is decidle in time O( A 2 E ) whether A is exponentilly miguous. (3) The degree of polynomil miguity of A, dp(a), cn e computed in O( A 3 E ). The first result of Theorem 6 hs lso een generlized y [18] to the cse of utomt with ǫ-trnsitions ut with significntly worse complexity. Theorem 7 ([18]) Let A e trim ǫ-cycle free finite utomton. It is decidle in time O(( A E + A 2 Q )3 ) whether A is infinitely miguous. The lgorithms designed for the ǫ-free cse cnnot e redily used for finite utomt with ǫ-trnsitions since they would led to incorrect results (see Figure 2()-(c)). Insted, [18] proposed reduction to the ǫ-free cse. First, [18] gve n lgorithm to test if there exist two sttes p nd q in A with two distinct ǫ-pths from p to q. If tht is the cse, then A is exponentilly miguous (complexity O( A 4 Q + A E)). Otherwise, [18] defined from A n ǫ-free utomton A over the lphet Σ {#} such tht A is infinitely miguous iff A is infinitely miguous, see Figure 2(d)-(e). However, the numer of trnsitions of A is A E + A 2 Q. This explins why the complexity in the ǫ-trnsition cse is significntly worse thn in the ǫ-free cse. The sme pproch cn e used to test the exponentil miguity of A in time O(( A E + A 2 Q )2 ) nd to compute dp(a) when A is polynomilly miguous in O(( A E + A 2 Q )3 ). Note tht we give tighter estimtes of the complexity of the lgorithms of [18, 20] where the uthors gve complexities using the loose inequlity: A E Σ A 2 Q. 4. Algorithms Our lgorithms for testing miguity re sed on generl lgorithm for the composition or intersection of utomt, which we riefly descrie in the following section. Oserve tht A is not the result of pplying the clssicl ǫ-removl lgorithm to A, since ǫ- removl does not preserve infinite miguity nd would led to n even lrger utomton. Insted, [18] used more complex lgorithm where ǫ-trnsitions re replced y regulr trnsitions leled with specil symol while preserving infinite miguity, dp(a) = dp(a ), even though A is not equivlent to A. Sttes in A re pirs (q, i) with q stte in A nd i {1, 2}. There is trnsition from (p, 1) to (q, 2) leled y # if q elongs to the ǫ-closure of p nd from (p, 2) to (q, 1) leled y σ Σ if there ws such trnsition from p to q in A.

8 8 C. Alluzen, M. Mohri nd A. Rstogi , 0 1, 1 0, 1 2, 1 3, 1 3, 2 3, 3 () () (c) Fig. 3. Exmple of finite utomton intersection. () Finite utomt A 1 nd () A 2. (c) Result of the intersection of A 1 nd A Intersection of finite utomt The intersection of finite utomt is specil cse of the generl composition lgorithm for weighted trnsducers [14, 13]. Sttes in the intersection A 1 A 2 of two finite utomt A 1 nd A 2 re identified with pirs of stte of A 1 nd stte of A 2. The following rule specifies how to compute trnsition of A 1 A 2 in the sence of ǫ-trnsition from pproprite trnsitions of A 1 nd A 2 : (q 1,, q 1 ) nd (q 2,, q 2 ) = ((q 1, q 2 ),, (q 1, q 2 )). Figure 3 illustrtes the lgorithm. A stte (q 1, q 2 ) is initil (resp. finl) when q 1 nd q 2 re initil (resp. finl). In the worst cse, ll trnsitions of A 1 leving stte q 1 mtch ll those of A 2 leving stte q 2, thus the spce nd time complexity of composition is qudrtic: O( A 1 A 2 ), or O( A 1 E A 2 E ) when A 1 nd A 2 re trim Epsilon-filtering A strightforwrd generliztion of the ǫ-free cse would generte redundnt ǫ- pths. This is crucil issue in the more generl cse of the intersection of weighted utomt over non-idempotent semiring, since it would led to n incorrect result. The weight of two mtching ǫ-pths of the originl utomt would then e counted s mny times s the numer of redundnt ǫ-pths generted in the result, insted of once. It is lso crucil prolem in the unweighted cse since redundnt ǫ-pths cn ffect the test of infinite miguity, s we shll see in the next section. A criticl component of the composition lgorithm of [14, 13] consists however of precisely coping with this prolem using n epsilon-filtering mechnism. Figure 4(c) illustrtes the prolem just mentioned. To mtch ǫ-pths leving q 1 nd those leving q 2, generliztion of the ǫ-free intersection cn mke the following moves: (1) first move forwrd on n ǫ-trnsition of q 1, or even ǫ-pth, nd remin t the sme stte q 2 in A 2, with the hope of lter finding trnsition whose lel is some lel ǫ mtching trnsition of q 2 with the sme lel; (2) proceed similrly y following n ǫ-trnsition or ǫ-pth leving q 2 while remining t the sme stte q 1 in A 1 ; or, (3) mtch n ǫ-trnsition of q 1 with n ǫ-trnsition of q 2. Let us renme existing ǫ-lels of A 1 s ǫ 2, nd existing ǫ-lels of A 2 s ǫ 1, nd let us ugment A 1 with self-loop leled with ǫ 1 t ll sttes nd similrly, ugment

9 Testing Automt Amiguity nd Trnsducer Doule-Tpe Amiguity 9 ǫ ǫ ǫ 1 ǫ 2 ǫ 1 ǫ 1 ǫ ǫ 2 () ǫ 2 ǫ 2 (0,0) ǫ 2 :ǫ 2 (1,0) ǫ 2 :ǫ 2 ǫ 1 :ǫ 1 ǫ 2 :ǫ 1 ǫ 1 :ǫ 1 ǫ 2 :ǫ 1 (0,1) (1,1) ǫ 1 :ǫ 1 ǫ ǫ 2 :ǫ 2 :ǫ 1 2 ǫ 1 :ǫ 1 (0,2) (1,2) ǫ 2 :ǫ 2 ε2:ε1 x:x ǫ ǫ 2 :ǫ 2 :ǫ 1 2 ǫ 2 :ǫ 0 2 ε1:ε1 x:x ε2:ε2 ε1:ε1 1 ε2:ε2 ǫ 1 ǫ (2,0) ǫ 1 :ǫ 1 (2,1) ǫ 1 :ǫ 1 (2,2) x:x 2 () (c) (d) (e) Fig. 4. Mrking of utomt, redundnt pths nd filter. () Automton A 1 = A 2. () Ã1: self-loop leled with ǫ 1 dded t ll sttes of A 1, regulr ǫs renmed to ǫ 2. (c) Ã2: self-loop leled with ǫ 2 dded t ll sttes of A 2, regulr ǫs renmed to ǫ 1. (d) Redundnt ǫ-pths: strightforwrd generliztion of the ǫ-free cse could generte ll the pths from (0, 0) to (2, 2) for exmple, even when composing just two simple trnsducers (A 1 A 2 ). (e) Filter trnsducer M llowing unique ǫ-pth. Ech trnsition leled x : x represents trnsitions with input nd output x of ll x in Σ. A 2 with self-loop leled with ǫ 2 t ll sttes, s illustrted y Figures 4() nd (). These self-loops correspond to remining t the sme stte in tht mchine while consuming n ǫ-lel of the other trnsition. The three moves just descried now correspond to the mtches (1) (ǫ 2 : ǫ 2 ), (2) (ǫ 1 : ǫ 1 ), nd (3) (ǫ 2 : ǫ 1 ). The grid of Figure 4(c) shows ll the possile ǫ-pths etween intersection sttes. We will denote y Ã1 nd Ã2 the utomt otined fter ppliction of these chnges. For the result of intersection not to e redundnt, etween ny two of these sttes, ll ut one pth must e disllowed. There re mny possile wys of selecting tht pth. One nturl wy is to select the shortest pth with the digonl trnsitions (ǫ-mtching trnsitions) tken first. Figure 4(c) illustrtes in oldfce the pth just descried from stte (0, 0) to stte (2, 1). Remrkly, this filtering mechnism itself cn e encoded s finite-stte trnsducer such s the trnsducer M of Figure 4(d). We denote y (p, q) (r, s) to indicte tht (r, s) cn e reched from (p, q) in the grid. Proposition 8. Let M e the trnsducer of Figure 4(d). M llows unique ǫ-pth etween ny two sttes (p, q) nd (r, s), with (p, q) (r, s). Proof. The proof of this proposition ws previously given in [2]. Let denote (ǫ 1 : ǫ 1 ), denote (ǫ 2 : ǫ 2 ), c denote (ǫ 2 : ǫ 1 ), nd let x stnd for ny (x: x), with x Σ. The following sequences must e disllowed y shortest-pth filter with mtching trnsitions first:,, c, c. This is ecuse, from ny stte, insted of the moves or, the mtching or digonl trnsition c cn e tken. Similrly, insted of c or c, c nd c cn e tken for n erlier mtch. Conversely, it is cler from the grid or n immedite recursion tht filter disllowing these sequences ccepts unique pth etween two connected sttes of the grid. Let L e the set of sequences over σ = {,, c, x} tht contin one of the

10 10 C. Alluzen, M. Mohri nd A. Rstogi x c 0 1 x c c 3 2 c x c {0} {0,1} c x c x {0,2} x c {0,3} x 1 c x 0 x 2 c c x c 3 () () (c) Fig. 5. () Finite utomton A representing the set of disllowed sequences. () Automton B, result of the determiniztion of A. Susets re indicted t ech stte. (c) Automton C otined from B y complementtion, stte 3 is not coccessile. disllowed sequence just mentioned s sustring tht is L = σ (++c+c)σ. Then L represents exctly the set of pths llowed y tht filter nd is thus regulr lnguge. Let A e n utomton representing L (Figure 5()). An utomton representing L cn e constructed from A y determiniztion nd complementtion (Figures 5()-(c)). The resulting utomton C is equivlent to the trnsducer M fter removl of the stte 3, which does not dmit pth to finl stte. Thus, to intersect two finite utomt A 1 nd A 2 with ǫ-trnsitions, it suffices to compute Ã1 M Ã2, using the ǫ-free rules of composition (see section 5 for forml definition of the composition of finite-stte trnsducers). Sttes in the intersection re now identified with triplets mde of stte of A 1, stte of M, nd stte of A 2. A trnsition (q 1, 1, q 1) in Ã1, trnsition (f, 1, 2, f ) in M, nd trnsition (q 2, 2, q 2) in Ã2 re comined to form the following trnsition in the intersection: ((q 1, f, q 2 ),, (q 1, f, q 2)), with = ǫ if { 1, 2 } {ǫ 1, ǫ 2 } nd = 1 = 2 otherwise. In the rest of the pper, we will ssume tht the result of intersection is trimmed fter its computtion, which cn e done in liner time in the size of the result of intersection. Theorem 9. Let A 1 nd A 2 e two finite utomt with ǫ-trnsitions. To ech pir (π 1, π 2 ) of ccepting pths in A 1 nd A 2 shring the sme input lel x Σ corresponds unique ccepting pth π in A 1 A 2 leled with x. Proof. This follows strightforwrdly from Proposition Amiguity Tests We strt with test of the exponentil miguity of A. The key is tht the (EDA) property trnsltes into very simple property for A 2 = A A. A stte in A 2 is triple (p, f, q), denoted y (p, q) f in the following, where p nd q re sttes in A nd f is filter stte.

11 Testing Automt Amiguity nd Trnsducer Doule-Tpe Amiguity 11 Lemm 10. Let A e trim ǫ-cycle free finite utomton. A stisfies (EDA) iff there exists strongly connected component of A 2 = A A tht contins two sttes of the form (p, p) 0 nd (q, q ) f, where p, q nd q re sttes of A with q q. Proof. Assume tht A stisfies (EDA). There exist stte p nd string v such tht there re two distinct cycles c 1 nd c 2 leled y v t p. Let e 1 nd e 2 e the first edges tht differ in c 1 nd c 2. We cn then write c 1 = πe 1 π 1 nd c 2 = πe 2 π 2. If e 1 nd e 2 shre the sme lel, let π 1 = πe 1, π 2 = πe 2, π 1 = π 1 nd π 2 = π 2. If e 1 nd e 2 do not shre the sme lel, exctly one of them must e n ǫ-trnsition. By symmetry, we cn ssume without loss of generlity tht e 1 is the ǫ-trnsition. Let π 1 = πe 1, π 2 = π, π 1 = π 1 nd π 2 = e 2 π 2. In oth cses, let q = n[π 1] = p[π 1] nd q = n[π 2] = p[π 2]. Oserve tht q q. Since i[π 1] = i[π 2], π 1 nd π 2 re mtched y intersection resulting in pth in A 2 from (p, p) 0 to (q, q ) f. Similrly, since i[π 1 ] = i[π 2 ], π 1 nd π 2 re mtched y intersection resulting in pth from (q, q ) f to (p, p) 0. Thus, (p, p) 0 nd (q, q ) f re in the sme strongly connected component of A 2. Conversely, ssume tht there exist sttes p, q nd q in A such tht q q nd tht (p, p) 0 nd (q, q ) f re in the sme strongly connected component of A 2. Let c e cycle in (p, p) 0 going through (q, q ) f, c hs een otined y mtching two cycles c 1 nd c 2. If c 1 were equl to c 2, intersection would mtch these two pths creting pth c long which ll the sttes would e of the form (r, r) 0 mking c distinct from c, nd since A is trim this would contrdict Theorem 9. Thus, c 1 nd c 2 re distinct nd (EDA) holds. Oserve tht the use of the ǫ-filter in composition is crucil for Lemm 10 to hold (see Figure 2). The lemm leds to strightforwrd lgorithm for testing exponentil miguity. Theorem 11. Let A e trim ǫ-cycle free finite utomton. It is decidle in time O( A 2 E ) whether A is exponentilly miguous. Proof. The lgorithm proceeds s follows. We compute A 2 nd, using depth-first serch of A 2, trim it nd compute its strongly connected components. It follows from Lemm 10 tht A is exponentilly miguous iff there is strongly connected component tht contins two sttes of the form (p, p) 0 nd (q, q ) f with q q. Finding such strongly connected component cn e done in time liner in the size of A 2, i.e. in O( A 2 E ) since A nd A2 re trim. Thus, the complexity of the lgorithm is in O( A 2 E ). Testing the (IDA) property requires finding three pths shring the sme lel in A. As shown elow, this cn e done in nturl wy using the utomton A 3 = (A A) A, otined y pplying twice the intersection lgorithm. A stte in A 3 is 5-tuple (p, f, q, g, r), denoted y (p, q, r) f,g in the following, where p, q nd r re sttes in A nd f nd g re filter sttes.

12 12 C. Alluzen, M. Mohri nd A. Rstogi Lemm 12. Let A e trim ǫ-cycle free finite utomton. A stisfies (IDA) iff there exist two distinct sttes p nd q in A with non-ǫ pth in A 3 = A A A from stte (p, p, q) f.f to stte (p, q, q) g,g. Proof. Assume tht A stisfies (IDA). Then, there exists string v Σ with three pths π 1 P(p, v, p), π 2 P(p, v, q) nd π 3 P(q, v, p). Since these three pths shre the sme lel v, they re mtched y intersection resulting in pth π in A 3 leled with v from (p[π 1 ], p[π 2 ], p[π 3 ]) f,f = (p, p, q) f,f to (n[π 1 ], n[π 2 ], n[π 3 ]) g,g = (p, q, q) g,g. Conversely, if there is non-ǫ pth π from (p, p, q) f,f to (p, q, q) g,g in A 3, it hs een otined y mtching three pths π 1, π 2 nd π 3 in A with the sme input v = i[π] ǫ. Thus, (IDA) holds. This lemm ppers lredy s Lemm 5.10 in [9]. Finlly, Theorem 11 nd Lemm 12 cn e comined to yield the following result. Theorem 13. Let A e trim ǫ-cycle free finite utomton. It is decidle in time O( A 3 E ) whether A is finitely, polynomilly, or exponentilly miguous. Proof. First, Theorem 11 cn e used to test whether A is exponentilly miguous y computing A 2. The complexity of this step is O( A 2 E ). If A is not exponentilly miguous, we proceed y computing nd trimming A 3 nd then testing whether A 3 verifies the property descried in Lemm 12. This is done y considering the utomton B on the lphet Σ = Σ {#} otined from A 3 y dding trnsition leled y # from stte (p, q, q) g,g to stte (p, p, q) f,f for every pir (p, q) of sttes in A such tht p q. It follows tht A 3 verifies the condition in Lemm 12 iff there is cycle in B contining oth trnsition leled y # nd trnsition leled y symol in Σ. This property cn e checked strightforwrdly using depth-first serch of B to compute its strongly connected components. If strongly connected component of B is found tht contins oth trnsition leled with # nd trnsition leled y symol in Σ, A verifies (IDA) ut not (EDA) nd thus A is polynomilly miguous. Otherwise, A is finitely miguous. The complexity of this step is liner in the size of B: O( B E ) = O( A 3 E + A 2 Q ) = O( A 3 E ) since A nd B re trim. The totl complexity of the lgorithm is O( A 2 E + A 3 E ) = O( A 3 E ). When A is polynomilly miguous, we cn derive from the lgorithm just descried one tht computes dp(a). Theorem 14. Let A e trim ǫ-cycle free finite utomton. If A is polynomilly miguous, dp(a) cn e computed in time O( A 3 E ). Proof. We first compute A 3 nd use the lgorithm of Theorem 13 to test whether A is polynomilly miguous nd to compute ll the pirs (p, q) tht verify the condition of Lemm 12. This step hs complexity O( A 3 E ).

13 Testing Automt Amiguity nd Trnsducer Doule-Tpe Amiguity 13 We then compute the component grph G of A, nd for ech pir (p, q) found in the previous step, we dd trnsition leled with # from the strongly connected component of p to the one of q. If there is pth in tht grph contining d edges leled y #, then A verifies (IDA d ). Thus, dp(a) is the mximum numer of edges mrked y # tht cn e found long pth in G. Since G is cyclic, this numer cn e computed in liner time in the size of G, i.e. in O( A 2 Q ). Thus, the overll complexity of the lgorithm is O( A 3 E ). Finlly, let us point out tht A 2 cn lso e used to devise simple test for the miguity of A sed on the following oservtion. Lemm 15. Let A e trim ǫ-cycle free finite utomton. A is unmiguous iff every coccessile stte in A 2 = A A is of the form (p, p) 0. Proof. Assume A is unmiguous nd let (p, q) f e coccessile stte in A 2. Since A 2 hs een trimmed, (p, q) f is oth ccessile nd coccessile. Hence, there exist pth π from the initil stte to finl stte of A 2 tht goes through (p, q) f. This pth ws otined y mtching two ccepting pths π 1 nd π 2 with the sme lel with π 1 going through p nd π 2 going through q. If p q or f 0, then π 1 nd π 2 re distinct (y Theorem 9) nd this contrdicts A unmiguous. Hence, p = q nd f = 0. Conversely, let us ssume tht every coccessile stte in A 2 is of the form (p, p) 0. Let us consider two ccepting pths π 1 nd π 2 shring the sme lel. These two pths will e mtched y composition to form n ccepting pth π in A 2. Since there cnnot e multiple trnsitions with the sme lel etween given pir of sttes, the fct tht ll sttes long π re of the form (p, p) 0 implies tht π 1 = π 2. Hence, A is unmiguous. Oserve tht here gin the use of the ǫ-filter in composition is crucil for Lemm 15 to hold (see Figure 2). Theorem 16. Let A e trim ǫ-cycle free finite utomton. It is decidle in time O( A 2 E ) whether A is miguous. Proof. The lgorithms proceeds s follows. We first compute A 2 nd perform depth-first serch to trim it. We cn now check in O( A 2 Q ) time tht ech stte is of the form (p, p) 0. Thus, the complexity of the lgorithm is in O( A 2 E ). 5. Doule-Tpe Amiguity The previous sections presented comprehensive study of the miguity of finite utomt. The notion of miguity is typiclly defined in the sme wy for finitestte trnsducers: trnsducer is sid to e miguous if it dmits two ccepting As mentioned in section 4.2, we lwys trim the result of intersection.

14 14 C. Alluzen, M. Mohri nd A. Rstogi pths with the sme input lel. Thus, the results of the previous sections pply to the trnsducer cse identiclly with tht notion of miguity. There is however nother notion of miguity relted to oth tpes of trnsducer tht is of interest in pplictions, which we refer to s doule-tpe miguity. This section dels with tht notion of doule-tpe miguity. It gives generl decidility nd hrdness results for doule-tpe miguity, nd presents specific nlysis for the cse of trnsducers with ounded dely, including chrcteriztions nd lgorithms for testing the doule-tpe miguity of such trnsducers. We strt with the stndrd definition of finite-stte trnsducer. Definition 17 (Finite-stte trnsducers) A finite-stte trnsducer T is 6- tuple (Σ,, Q, E, I, F) where Σ is finite input lphet of the trnsducer; is finite output lphet; Q is finite set of sttes; I Q the set of initil sttes; F Q the set of finl sttes; nd E Q (Σ {ǫ}) ( {ǫ}) Q finite set of trnsitions. We sy tht the trnsducer T ccepts pir (x, y) Σ if T dmits n ccepting pth with input lel x nd output lel y nd denote this y (x, y) R(T). R(T) is the rtionl reltion defined y T. Given trnsducer T, we define the inverse of T, denoted y T 1, the trnsducer otined y swpping the input nd output lels of ech trnsition in T, thus (x, y) R(T 1 ) iff (y, x) R(T). Let T 1 nd T 2 e two finite-stte trnsducers such tht the input lphet of T 2 coincides with the output lphet of T 1. The result of the composition of T 1 nd T 2 is finite-stte trnsducer denoted y T 1 T 2 nd specified for ll x, y y: (x, y) R(T 1 T 2 ) iff there exists z such tht (x, z) R(T 1 ) nd (z, y) R(T 2 ). The lgorithm to compute the composition of two finite-stte trnsducers is slight modifiction of the intersection lgorithm descried in section 4. The following rule specifies how to compute trnsition of T 1 T 2 from pproprite trnsitions of T 1 nd T 2 in the sence of output-ǫ trnsitions in T 1 nd input-ǫ trnsitions in T 2 : (q 1,,, q 1 ) nd (q 2,, c, q 2 ) = ((q 1, q 2 ),, c, (q 1, q 2 )). The sme epsilon-filtering technique descried in section 4.2 is then used to del with output-ǫ trnsitions in T 1 nd input-ǫ trnsitons in T 2 [14, 13]. The notion of doule-tpe unmiguous trnsducers is defined s follows. Definition 18 (Doule-Tpe Unmiguous Trnsducer) A trnsducer T is sid to e doule-tpe unmiguous if for ll (x, y) Σ, it dmits t most one ccepting pth in T with input lel x nd output lel y. This notion clerly differs from the single-tpe notion discussed in the previous sections for utomt nd often used for trnsducers. A trnsducer dmitting multiple pths with the sme input lel x cn still e doule-tpe unmiguous so long s the output lels of those pths re ll distinct. The generl prolem of determining doule-tpe miguity turns out to e considerly hrder thn tht of determining single-tpe miguity however.

15 Testing Automt Amiguity nd Trnsducer Doule-Tpe Amiguity 15 N:u[N]... 1:u[1] N:v[N]... 1:v[1] 1 2 Fig. 6. The trnsducer constructed corresponding to PCP prolem with lists of strings u i, v i Σ for 1 i N. Both sttes 1 nd 2 re initil nd finl Undecidility Result We show tht the generl prolem of determining if trnsducer T is doule-tpe miguous is undecidle. When we restrict the trnsducer to e cyclic, then the prolem ecomes NP-hrd. Our reduction is from the Post Correspondence Prolem (PCP) [15]. Definition 19 (The Post Correspondence Prolem [15]) Given two list of strings u 1, u 2,...,u N nd v 1, v 2,...,v N, with u i, v i Σ for 1 i N, determine whether there exists sequence of indices (i 1, i 2,..., i K ) with K 1 nd 1 i k N such tht: u i1 u i2... u ik = v i1 v i2...v ik. Theorem 20 ([15, 11]) PCP is undecidle in generl. Furthermore, the prolem remins undecidle even when restricted to fixed numer of strings in (u i ) N, (v i) N, for N 7. Theorem 21. The prolem of determining the doule-tpe miguity of n ritrry finite-stte trnsducer T is undecidle. Proof. Given PCP prolem instnce over the lphet Σ with strings (u i ) N nd (v i ) N, we construct trnsducer T such tht T is doule-tpe miguous if nd only if the PCP prolem hs solution. The trnsducer T is defined s follows (see Figure 6): The set of sttes Q = {1, 2} with I = F = Q. The set of trnsitions E s: E = {(1, i, u i, 1) : 1 i N} {(2, i, v i, 2) : 1 i N}, where (q i,,, q j ) denotes trnsition from stte q i to q j with input lel nd output lel. c If the PCP instnce hs solution (i 1,...,i K ), then T is doule-tpe miguous since the pir i 1...i K : u i1... u ik is ccepted on two pths: one through the trnsitions (1, i k, u ik, 1) for 1 k K, the other through (2, i k, v ik, 2) for 1 k K. c In order to simplify the proof we consider here trnsducer with trnsition outputs in. There strightforwrdly exists n equivlent trnsducer with trnsition outputs in {ǫ}.

16 16 C. Alluzen, M. Mohri nd A. Rstogi Conversely, if T is doule-tpe miguous then there exists two pths π 1 nd π 2 with the sme input nd output lels. A pth in T either remins t stte 1 or t stte 2. It is cler tht if two distinct pths π 1 nd π 2 hve the sme input lels, then they must e t different sttes. Let π 1 e the pth tht remins t stte 1 nd π 2 the pth tht remins t stte 2. Let the input lel on π 1 (nd π 2 ) e the sequence i 1...i K. Since the output lels re the sme on π 1 nd π 2, it follows tht u 1 u 2... u ik = v 1 v 2... v ik. Thus the PCP dmits solution nd the proof is complete. It is nturl to sk how hrd the prolem remins if we restrict our ttention to more specific clsses of trnsducers. We show tht if we restrict ourselves to cyclic trnsducers, the prolem is NP-hrd. Theorem 22. The prolem of determining the doule-tpe miguity of n ritrry cyclic trnsducer T is NP-hrd. Proof. The reduction is from ounded PCP: vrint of PCP in which we seek sequence of indices i 1... i K with K B for some fixed B > 0. The ounded PCP is NP-complete [6]. Insted of hving self-loops t sttes 1 nd 2 in the construction of Theorem 21, we simply unfold the loops B times. This shows tht the prolem for cyclic trnsducers is (t lest) NP-hrd. Note tht this result does not imply tht the prolem is in NP, which in fct, most likely, is not the cse Bounded-dely trnsducers One nturl clss of trnsducers for which more positive results hold is tht of trnsducers with ounded dely. This imposes ound on the mximum difference of length etween the input nd output lel of pth. The following gives forml definition of the notion of dely. Definition 23 (Dely) The dely of pth π is defined s the difference of length etween its input nd output lels: dely(π) = o[π] i[π]. (5) A trim trnsducer T is sid to hve ounded dely if the dely of ll pths of T is ounded. We then denote y dely(t) the mximum dely of ll pths in T. A trnsducer T is synchronized if long ny ccepting pth of T the dely is zero or increses strictly monotoniclly: for ny ccepting pth π = π 1 eπ 2, dely(π 1 ) < dely(π 1 e) or dely(π 1 ) = dely(π 1 e) = 0. A trnsducer with ounded dely is synchronizle, tht is it dmits n equivlent synchronized trnsducer [12]. Given trnsducer T, let T s denote the synchronized trnsducer otined from T using the synchroniztion lgorithm of [12]. The complexity of the synchroniztion

17 Testing Automt Amiguity nd Trnsducer Doule-Tpe Amiguity 17 lgorithm is in O( T s ). However, the size of T s is exponentil in the worst-cse : O( T ( Σ dely(t) + dely(t) )) where Σ is the input lphet of T nd its output lphet. When T is synchronized trnsducer with dely of 0, we cn give chrcteriztion of doule-tpe miguity sed on the form of the identity pths in T 1 T. An identity pth π is n ccepting pth with equl input nd output lels: i[π] = o[π]. Recll tht stte in T T, the composition of two trnsducers T nd T, is of the form (p, q) f, where p is stte of T, q is stte of T, nd f stte of the epsilon-filter. Lemm 24 (Chrcteriztion) Let T e synchronized trnsducer with dely(t) = 0. T is doule-tpe miguous if nd only if there exists successful identity pth in T 1 T going through stte of the form (p, q) f with p q or f 0. Proof. Oserve tht since T is synchronized nd hs dely zero, every trnsition must hve either oth its input nd output lels equl to ǫ, or oth non-ǫ. Assume tht T is doule-tpe miguous. Then, T dmits two ccepting pths π 1 nd π 2 with the sme input nd output lels, sy x nd y respectively. Since these two pths shre the sme input, they re mtched y composition, which results in pth π in T 1 T. Moreover, π is n identity pth since π 1 nd π hve the sme output lel: o[π 1 ] = o[π 2 ]. Let e e the first trnsition long π tht ws otined y mtching two distinct trnsitions e 1 nd e 2 in T. We shll show tht n[e] is stte of the form (p, q) f with p q or f 0. If e 1 is virtul trnsition corresponding to remining t the sme stte without consuming ny symol while e 2 is n ctul ǫ-trnsition in T, then the filter stte of n[e] is not 0, f 0. Assume now tht oth e 1 nd e 2 re ctul trnsitions in T. Since e 1 nd e 2 re distinct nd i[e 1 ] = i[e 2 ], we must hve n[e 1 ] n[e 2 ] or o[e 1 ] o[e 2 ]. Since T hs dely of 0, we must hve o[e 1 ] = o[e 2 ]. Thus n[e 1 ] n[e 2 ] nd n[e] is of the form (p, q) f with p q. Conversely, ssume tht there exists n identity pth π in T 1 T going through stte of the form (p, q) f with f 0 or p q. This pth ws otined y mtching in composition two pths π 1 nd π 2 such tht i[π 1 ] = i[π 2 ] (since they re mtched in composition) nd o[π 1 ] = o[π 2 ] (since π is n identity pth). If π 1 nd π 2 were equl, ll the sttes long π would e of the form (p, p) 0. Thus, π 1 π 2 nd T is doule-tpe miguous. This chrcteriztion directly leds to n lgorithm for testing the doule-tpe miguity of synchronized trnsducers. Theorem 25. The doule-tpe miguity of synchronized trnsducer T cn e decided in time O( T 2 ), where T = Q + E is the totl numer of sttes nd trnsitions of T.

18 18 C. Alluzen, M. Mohri nd A. Rstogi Proof. A key property of synchronized trnsducer T is tht long ny successful pth, trnsition with non-ǫ input nd ǫ output cn only e followed y trnsitions with non-ǫ input nd ǫ output. Similrily, trnsition of with ǫ input nd nonǫ output cn only e followed y trnsitions with ǫ input nd non-ǫ output. By replcing such ǫs with specil symol not lredy in Σ or, sy #, we otin synchronized trnsducer T with dely of 0 such tht T is doule-tpe miguous iff T is doule-tpe miguous. The lgorithm then consists of computing T 1 T, deleting ny trnsitions e such tht i[e] o[e] nd performing depth-first serch to verify tht the sttes tht re oth ccessile nd co-ccessile re ll of the form (p, 0, p). Finlly, we cn use the previous result to devise n effective lgorithm for testing the doule-tpe miguity of ounded-dely trnsducers. Corollry 26. Let T e ounded-dely trnsducer with input lphet Σ nd output lphet. It is decidle in time O( T 2 ( Σ dely(t) + dely(t) ) 2 ) whether T is doule-tpe miguous. Proof. Since T hs ounded dely, we cn use the synchroniztion lgorithm from [12] to compute n equivlent synchronized trnsducer T s. The synchroniztion lgorithms preserves doule-tpe miguity thus T s is doule-tpe miguous iff T is doule-tpe miguous nd y Theorem 25 we cn decide the doule-tpe miguity of T in time O( T s 2 ). 6. Appliction to Entropy Approximtion In this section, we descrie n ppliction in which determining the degree of miguity of proilistic utomton helps estimte the qulity of n pproximtion of its entropy. Weighted utomt re utomt in which ech trnsition crries some weight in ddition to the usul lphet symol. The weights re elements of semiring, tht is ring tht my lck negtion. The following is more forml definition. Definition 27. A weighted utomton A over semiring (K,,, 0, 1) is 7- tuple (Σ, Q, I, F, E, λ, ρ) where Σ is finite lphet, Q finite set of sttes, I Q the set of initil sttes, F Q the set of finl sttes, E Q Σ {ǫ} K Q finite set of trnsitions, λ : I K the initil weight function mpping I to K, nd ρ : F K the finl weight function mpping F to K. Given trnsition e E, we denote y w[e] its weight. We extend the weight function w to pths y defining the weight of pth s the -product of the weights of its constituent trnsitions: w[π] = w[e 1 ] w[e k ]. The weight ssocited y weighted utomton A to n input string x Σ is defined y [A](x) = λ[p[π]] w[π] ρ[n[π]]. (6) π P(I,x,F)

19 Testing Automt Amiguity nd Trnsducer Doule-Tpe Amiguity 19 The entropy H(A) of proilistic utomton A is defined s: H(A) = x Σ [A](x)log([A](x)). (7) The system (K,,, (0, 0), (1, 0)) with K = (R {+, }) (R {+, }) nd nd defined s follows defines commuttive semiring clled the entropy semiring [4]: for ny two pirs (x 1, y 1 ) nd (x 2, y 2 ) in K, (x 1, y 1 ) (x 2, y 2 ) = (x 1 + x 2, y 1 + y 2 ) (8) (x 1, y 1 ) (x 2, y 2 ) = (x 1 x 2, x 1 y 2 + x 2 y 1 ). (9) In [4], the uthors showed tht generlized shortest-distnce lgorithm over this semiring correctly computes the entropy of n unmiguous proilistic utomton A. The lgorithm strts y mpping the weight of ech trnsition to pir where the first element is the proility nd the second the entropy: w[e] (w[e], w[e] log w[e]). The lgorithm then proceeds y computing the generlized shortest-distnce defined over the entropy semiring, which computes the -sum of the weights of ll ccepting pths in A. Here, we show tht the sme shortest-distnce lgorithm yields n pproximtion of the entropy of n miguous proilistic utomton A, where the pproximtion qulity is function of the degree of polynomil miguity, dp(a). Our proofs mke use of the stndrd log-sum inequlity [5], specil cse of Jensen s inequlity, which holds for ny positive rels 1,..., k, nd 1,..., k : ( k k i log i i ) k i log i k. (10) i Lemm 28. Let A e proilistic utomton nd let x Σ + e string ccepted y A on k pths π 1,..., π k. Let w[π i ] e the proility of pth π i. Clerly, [A](x) = k w[π i]. Then, k w[π i ] log w[π i ] [A](x)(log[A](x) log k). (11) Proof. The result follows strightforwrdly from the log-sum inequlity, with i = w[π i ] nd i = 1: ( k k ) k w[π i ] log w[π i ] w[π i ] log w[π i] = [A](x)(log[A](x) log k). (12) k Let S(A) e the quntity computed y the generlized shortest-distnce lgorithm over the entropy semiring or proilistic utomton A. When A is unmiguous, it is shown y [4] tht S(A) = H(A). Theorem 29. Let A e proilistic utomton nd let L denote the expected length of the strings ccepted y A (i.e. L = x Σ x [A](x)). Then,

20 20 C. Alluzen, M. Mohri nd A. Rstogi (1) if A is finitely miguous with d(a) = k for some k N, then H(A) S(A) H(A) + log k; (2) if A is polynomilly miguous with dp(a) = k for some k N, then H(A) S(A) H(A) + k log L. Proof. The lower ound S(A) H(A) follows from the oservtion tht for string x tht is ccepted in A y k pths π 1,..., π k, k ( k ) ( k ) w[π i ] log(w(π i )) w[π i ] log w[π i ]. (13) Since the quntity k w[π i] log(w[π i ]) is string x s contriution to S(A) nd the quntity ( k w[π i])log( k w[π i]) its contriution to H(A), summing over ll ccepted strings x, we otin H(A) S(A). Assume tht A is finitely miguous with degree of miguity k. Let x Σ e string tht is ccepted on l x k pths π 1,...,π lx. By Lemm 28, we hve l x Thus, w[π i ] log w[π i ] [A](x)(log[A](x) log l x ) [A](x)(log[A](x) log k). (14) S(A) = l x x Σ w[π i ] log w[π i ] H(A) + x Σ (log k)[a](x) = H(A) + log k.(15) This proves the first sttement of the theorem. Next, ssume tht A is polynomilly miguous with degree of polynomil miguity k. By Lemm 28, we hve l x w[π i ] log w[π i ] [A](x)(log[A](x) log l x ) [A](x)(log[A](x) log( x k )).(16) Thus, S(A) H(A) + x Σ k[a](x)log x = H(A) + ke A [log x ] (17) H(A) + k log E A [ x ] = H(A) + k log L, which proves the second sttement of the theorem. (y Jensen s inequlity) The theorem shows in prticulr tht the qulity of the pproximtion of the entropy of polynomilly miguous proilistic utomton cn e estimted y computing its degree of polynomil miguity, which cn e chieved efficiently s descried in the previous section. This lso requires the computtion of the expected length L of n ccepted string. L cn e computed efficiently for n ritrry proilistic utomton using the entropy semiring nd the generlized shortest-distnce lgorithms, using techniques similr to those descried in [4]. The only difference is in the initil step, where the weight of ech trnsition in A is mpped to pir of elements y w[e] (w[e], w[e]).

21 Testing Automt Amiguity nd Trnsducer Doule-Tpe Amiguity Conclusion We presented simple nd efficient lgorithms for testing the finite, polynomil, or exponentil miguity of finite utomt with ǫ-trnsitions. We conjecture tht the time complexity of our lgorithms is optiml. These lgorithms hve vriety of pplictions, in prticulr to test pre-condition for the pplicility of other utomt lgorithms. Our ppliction to the pproximtion of the entropy gives nother illustrtion of their usefulness. We lso initited the study of the doule-tpe miguity of finite-stte trnsducers nd gve numer of decidility nd chrcteriztions results s well s lgorithms in the ounded dely cse. These lgorithms cn e of interest in numer of modern pplictions where finite-stte trnsducers re used. Our lgorithms lso demonstrte the prominent role plyed y the intersection of finite utomt or composition of finite-stte trnsducers with ǫ-trnsitions [14, 13] in the design of testing lgorithms. Composition cn e used to devise simple nd efficient testing lgorithms. We hve shown elsewhere how it cn e used to test the functionlity of finite-stte trnsducer, or the twins property for weighted utomt nd trnsducers [1]. References [1] Cyril Alluzen nd Mehryr Mohri. Efficient Algorithms for Testing the Twins Property. Journl of Automt, Lnguges nd Comintorics, 8(2): , [2] Cyril Alluzen nd Mehryr Mohri. 3-wy composition of weighted finite-stte trnsducers. In CIAA 2008, volume 5148 of LNCS, pges Springer, [3] Tt-hung Chn nd Oscr H. Irr. On the finite-vluedness prolem for sequentil mchines. Theoreticl Computer Science, 23:95 101, [4] Corinn Cortes, Mehryr Mohri, Ashish Rstogi, nd Michel Riley. On the computtion of the reltive entropy of proilistic utomt. Interntionl Journl of Foundtions of Computer Science, 19(1): , [5] Thoms M. Cover nd Joy A. Thoms. Elements of Informtion Theory. John Wiley & Sons, Inc., New York, [6] Michel R. Grey nd Dvid S. Johnson. Computers nd Intrctility: A Guide to the Theory of NP-Completeness. W. H. Freemn & Co., New York, NY, USA, [7] Oscr H. Irr nd Bl Rvikumr. On sprseness, miguity nd other decision prolems for cceptors nd trnsducers. In STACS 1986, volume 210 of LNCS, pges Springer, [8] Gérrd Jco. Un lgorithme clculnt le crdinl, fini ou infini, des demi-groupes de mtrices. Theoreticl Computer Science, 5(2): , [9] Werner Kuich. Finite utomt nd miguity. Technicl Report 253, Institute für Informtionsverreitung - Technische Universität Grz und ÖCG, [10] Arnldo Mndel nd Imre Simon. On finite semigroups of mtrices. Theoreticl Computer Science, 5(2): , [11] Yuri Mtiysevich nd Gérud Sénizergues. Decision prolems for semi-thue systems with few rules. In IEEE Symposium on Logic in Computer Science, pges , [12] Mehryr Mohri. Edit-distnce of weighted utomt: Generl definitions nd lgorithms. Interntionl Journl of Foundtions of Computer Science, 14(6): ,

General Algorithms for Testing the Ambiguity of Finite Automata

General Algorithms for Testing the Ambiguity of Finite Automata Generl Algorithms for Testing the Amiguity of Finite Automt Cyril Alluzen 1,, Mehryr Mohri 2,1, nd Ashish Rstogi 1, 1 Google Reserch, 76 Ninth Avenue, New York, NY 10011. 2 Cournt Institute of Mthemticl

More information

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Mehryr Mohri Cournt Institute nd Google Reserch mohri@cims.nyu.com Preliminries Finite lphet Σ, empty string. Set of ll strings over

More information

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Eugene Weinstein Google, NYU Cournt Institute eugenew@cs.nyu.edu Slide Credit: Mehryr Mohri Preliminries Finite lphet, empty string.

More information

Designing finite automata II

Designing finite automata II Designing finite utomt II Prolem: Design DFA A such tht L(A) consists of ll strings of nd which re of length 3n, for n = 0, 1, 2, (1) Determine wht to rememer out the input string Assign stte to ech of

More information

Formal languages, automata, and theory of computation

Formal languages, automata, and theory of computation Mälrdlen University TEN1 DVA337 2015 School of Innovtion, Design nd Engineering Forml lnguges, utomt, nd theory of computtion Thursdy, Novemer 5, 14:10-18:30 Techer: Dniel Hedin, phone 021-107052 The exm

More information

Minimal DFA. minimal DFA for L starting from any other

Minimal DFA. minimal DFA for L starting from any other Miniml DFA Among the mny DFAs ccepting the sme regulr lnguge L, there is exctly one (up to renming of sttes) which hs the smllest possile numer of sttes. Moreover, it is possile to otin tht miniml DFA

More information

p-adic Egyptian Fractions

p-adic Egyptian Fractions p-adic Egyptin Frctions Contents 1 Introduction 1 2 Trditionl Egyptin Frctions nd Greedy Algorithm 2 3 Set-up 3 4 p-greedy Algorithm 5 5 p-egyptin Trditionl 10 6 Conclusion 1 Introduction An Egyptin frction

More information

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016 CS125 Lecture 12 Fll 2016 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple

More information

Convert the NFA into DFA

Convert the NFA into DFA Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:

More information

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1 Chpter Five: Nondeterministic Finite Automt Forml Lnguge, chpter 5, slide 1 1 A DFA hs exctly one trnsition from every stte on every symol in the lphet. By relxing this requirement we get relted ut more

More information

1 Nondeterministic Finite Automata

1 Nondeterministic Finite Automata 1 Nondeterministic Finite Automt Suppose in life, whenever you hd choice, you could try oth possiilities nd live your life. At the end, you would go ck nd choose the one tht worked out the est. Then you

More information

Lecture 08: Feb. 08, 2019

Lecture 08: Feb. 08, 2019 4CS4-6:Theory of Computtion(Closure on Reg. Lngs., regex to NDFA, DFA to regex) Prof. K.R. Chowdhry Lecture 08: Fe. 08, 2019 : Professor of CS Disclimer: These notes hve not een sujected to the usul scrutiny

More information

Regular expressions, Finite Automata, transition graphs are all the same!!

Regular expressions, Finite Automata, transition graphs are all the same!! CSI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 7: Kleene s Theorem Chpter 7: Kleene s Theorem Regulr expressions, Finite Automt, trnsition grphs re ll the sme!! Dr. Neji Zgui CSI3104-W11 1

More information

Model Reduction of Finite State Machines by Contraction

Model Reduction of Finite State Machines by Contraction Model Reduction of Finite Stte Mchines y Contrction Alessndro Giu Dip. di Ingegneri Elettric ed Elettronic, Università di Cgliri, Pizz d Armi, 09123 Cgliri, Itly Phone: +39-070-675-5892 Fx: +39-070-675-5900

More information

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

More information

Nondeterminism and Nodeterministic Automata

Nondeterminism and Nodeterministic Automata Nondeterminism nd Nodeterministic Automt 61 Nondeterminism nd Nondeterministic Automt The computtionl mchine models tht we lerned in the clss re deterministic in the sense tht the next move is uniquely

More information

Formal Languages and Automata

Formal Languages and Automata Moile Computing nd Softwre Engineering p. 1/5 Forml Lnguges nd Automt Chpter 2 Finite Automt Chun-Ming Liu cmliu@csie.ntut.edu.tw Deprtment of Computer Science nd Informtion Engineering Ntionl Tipei University

More information

1 From NFA to regular expression

1 From NFA to regular expression Note 1: How to convert DFA/NFA to regulr expression Version: 1.0 S/EE 374, Fll 2017 Septemer 11, 2017 In this note, we show tht ny DFA cn e converted into regulr expression. Our construction would work

More information

Coalgebra, Lecture 15: Equations for Deterministic Automata

Coalgebra, Lecture 15: Equations for Deterministic Automata Colger, Lecture 15: Equtions for Deterministic Automt Julin Slmnc (nd Jurrin Rot) Decemer 19, 2016 In this lecture, we will study the concept of equtions for deterministic utomt. The notes re self contined

More information

General Algorithms for Testing the Ambiguity of Finite Automata

General Algorithms for Testing the Ambiguity of Finite Automata TR2007-908 Generl Algorithms for Testing the Amiguity of Finite Automt Cyril Alluzen 1,, Mehryr Mohri 1,2, nd Ashish Rstogi 1 1 Cournt Institute of Mthemtil Sienes, 251 Merer Street, New York, NY 10012.

More information

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014 CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA

More information

More on automata. Michael George. March 24 April 7, 2014

More on automata. Michael George. March 24 April 7, 2014 More on utomt Michel George Mrch 24 April 7, 2014 1 Automt constructions Now tht we hve forml model of mchine, it is useful to mke some generl constructions. 1.1 DFA Union / Product construction Suppose

More information

Lecture 09: Myhill-Nerode Theorem

Lecture 09: Myhill-Nerode Theorem CS 373: Theory of Computtion Mdhusudn Prthsrthy Lecture 09: Myhill-Nerode Theorem 16 Ferury 2010 In this lecture, we will see tht every lnguge hs unique miniml DFA We will see this fct from two perspectives

More information

Homework 3 Solutions

Homework 3 Solutions CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.

More information

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton 25. Finite Automt AUTOMATA AND LANGUAGES A system of computtion tht only hs finite numer of possile sttes cn e modeled using finite utomton A finite utomton is often illustrted s stte digrm d d d. d q

More information

First Midterm Examination

First Midterm Examination Çnky University Deprtment of Computer Engineering 203-204 Fll Semester First Midterm Exmintion ) Design DFA for ll strings over the lphet Σ = {,, c} in which there is no, no nd no cc. 2) Wht lnguge does

More information

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9. Regulr Expressions, Pumping Lemm, Right Liner Grmmrs Ling 106 Mrch 25, 2002 1 Regulr Expressions A regulr expression descries or genertes lnguge: it is kind of shorthnd for listing the memers of lnguge.

More information

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38 Theory of Computtion Regulr Lnguges (NTU EE) Regulr Lnguges Fll 2017 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of Finite Automt A finite utomton hs finite set of control

More information

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz University of Southern Cliforni Computer Science Deprtment Compiler Design Fll Lexicl Anlysis Smple Exercises nd Solutions Prof. Pedro C. Diniz USC / Informtion Sciences Institute 4676 Admirlty Wy, Suite

More information

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.) CS 373, Spring 29. Solutions to Mock midterm (sed on first midterm in CS 273, Fll 28.) Prolem : Short nswer (8 points) The nswers to these prolems should e short nd not complicted. () If n NF M ccepts

More information

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS The University of Nottinghm SCHOOL OF COMPUTER SCIENCE LEVEL 2 MODULE, SPRING SEMESTER 2016 2017 LNGUGES ND COMPUTTION NSWERS Time llowed TWO hours Cndidtes my complete the front cover of their nswer ook

More information

Parse trees, ambiguity, and Chomsky normal form

Parse trees, ambiguity, and Chomsky normal form Prse trees, miguity, nd Chomsky norml form In this lecture we will discuss few importnt notions connected with contextfree grmmrs, including prse trees, miguity, nd specil form for context-free grmmrs

More information

Finite Automata-cont d

Finite Automata-cont d Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automt-cont d The Pumping Lemm WEB SITE: http://ingwe.inghmton.edu/ ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww

More information

First Midterm Examination

First Midterm Examination 24-25 Fll Semester First Midterm Exmintion ) Give the stte digrm of DFA tht recognizes the lnguge A over lphet Σ = {, } where A = {w w contins or } 2) The following DFA recognizes the lnguge B over lphet

More information

Theory of Computation Regular Languages

Theory of Computation Regular Languages Theory of Computtion Regulr Lnguges Bow-Yw Wng Acdemi Sinic Spring 2012 Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring 2012 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of

More information

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Converting Regular Expressions to Discrete Finite Automata: A Tutorial Converting Regulr Expressions to Discrete Finite Automt: A Tutoril Dvid Christinsen 2013-01-03 This is tutoril on how to convert regulr expressions to nondeterministic finite utomt (NFA) nd how to convert

More information

Closure Properties of Regular Languages

Closure Properties of Regular Languages Closure Properties of Regulr Lnguges Regulr lnguges re closed under mny set opertions. Let L 1 nd L 2 e regulr lnguges. (1) L 1 L 2 (the union) is regulr. (2) L 1 L 2 (the conctention) is regulr. (3) L

More information

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages Deprtment of Computer Science, Austrlin Ntionl University COMP2600 Forml Methods for Softwre Engineering Semester 2, 206 Assignment Automt, Lnguges, nd Computility Smple Solutions Finite Stte Automt nd

More information

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4 Intermedite Mth Circles Wednesdy, Novemer 14, 2018 Finite Automt II Nickols Rollick nrollick@uwterloo.c Regulr Lnguges Lst time, we were introduced to the ide of DFA (deterministic finite utomton), one

More information

Harvard University Computer Science 121 Midterm October 23, 2012

Harvard University Computer Science 121 Midterm October 23, 2012 Hrvrd University Computer Science 121 Midterm Octoer 23, 2012 This is closed-ook exmintion. You my use ny result from lecture, Sipser, prolem sets, or section, s long s you quote it clerly. The lphet is

More information

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers 80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES 2.6 Finite Stte Automt With Output: Trnsducers So fr, we hve only considered utomt tht recognize lnguges, i.e., utomt tht do not produce ny output on ny input

More information

Deterministic Finite Automata

Deterministic Finite Automata Finite Automt Deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion Sciences Version: fll 2016 J. Rot Version: fll 2016 Tlen en Automten 1 / 21 Outline Finite Automt Finite

More information

3 Regular expressions

3 Regular expressions 3 Regulr expressions Given n lphet Σ lnguge is set of words L Σ. So fr we were le to descrie lnguges either y using set theory (i.e. enumertion or comprehension) or y n utomton. In this section we shll

More information

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014 CS125 Lecture 12 Fll 2014 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple

More information

Chapter 2 Finite Automata

Chapter 2 Finite Automata Chpter 2 Finite Automt 28 2.1 Introduction Finite utomt: first model of the notion of effective procedure. (They lso hve mny other pplictions). The concept of finite utomton cn e derived y exmining wht

More information

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

More information

Thoery of Automata CS402

Thoery of Automata CS402 Thoery of Automt C402 Theory of Automt Tle of contents: Lecture N0. 1... 4 ummry... 4 Wht does utomt men?... 4 Introduction to lnguges... 4 Alphets... 4 trings... 4 Defining Lnguges... 5 Lecture N0. 2...

More information

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University U.U.D.M. Project Report 07:4 Frey Frctions Rickrd Fernström Exmensrete i mtemtik, 5 hp Hledre: Andres Strömergsson Exmintor: Jörgen Östensson Juni 07 Deprtment of Mthemtics Uppsl University Frey Frctions

More information

Lecture 9: LTL and Büchi Automata

Lecture 9: LTL and Büchi Automata Lecture 9: LTL nd Büchi Automt 1 LTL Property Ptterns Quite often the requirements of system follow some simple ptterns. Sometimes we wnt to specify tht property should only hold in certin context, clled

More information

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings... Tle of contents: Lecture N0.... 3 ummry... 3 Wht does utomt men?... 3 Introduction to lnguges... 3 Alphets... 3 trings... 3 Defining Lnguges... 4 Lecture N0. 2... 7 ummry... 7 Kleene tr Closure... 7 Recursive

More information

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science CSCI 340: Computtionl Models Kleene s Theorem Chpter 7 Deprtment of Computer Science Unifiction In 1954, Kleene presented (nd proved) theorem which (in our version) sttes tht if lnguge cn e defined y ny

More information

Java II Finite Automata I

Java II Finite Automata I Jv II Finite Automt I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz Finite Automt I p.1/13 Processing Regulr Expressions We lredy lerned out Jv s regulr expression

More information

A Unified Construction of the Glushkov, Follow, and Antimirov Automata

A Unified Construction of the Glushkov, Follow, and Antimirov Automata A Unified Construction of the Glushkov, Follow, nd Antimirov Automt Cyril Alluzen nd Mehryr Mohri Cournt Institute of Mthemticl Sciences 251 Mercer Street, New York, NY 10012, USA {lluzen,mohri}@cs.nyu.edu

More information

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 4 1. UsetheproceduredescriedinLemm1.55toconverttheregulrexpression(((00) (11)) 01) into n NFA. Answer: 0 0 1 1 00 0 0 11 1 1 01 0 1 (00)

More information

CS 330 Formal Methods and Models

CS 330 Formal Methods and Models CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 2 1. Prove ((( p q) q) p) is tutology () (3pts) y truth tle. p q p q

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automt Theory nd Forml Lnguges TMV027/DIT321 LP4 2018 Lecture 10 An Bove April 23rd 2018 Recp: Regulr Lnguges We cn convert between FA nd RE; Hence both FA nd RE ccept/generte regulr lnguges; More

More information

The size of subsequence automaton

The size of subsequence automaton Theoreticl Computer Science 4 (005) 79 84 www.elsevier.com/locte/tcs Note The size of susequence utomton Zdeněk Troníček,, Ayumi Shinohr,c Deprtment of Computer Science nd Engineering, FEE CTU in Prgue,

More information

Revision Sheet. (a) Give a regular expression for each of the following languages:

Revision Sheet. (a) Give a regular expression for each of the following languages: Theoreticl Computer Science (Bridging Course) Dr. G. D. Tipldi F. Bonirdi Winter Semester 2014/2015 Revision Sheet University of Freiurg Deprtment of Computer Science Question 1 (Finite Automt, 8 + 6 points)

More information

A Unified Construction of the Glushkov, Follow, and Antimirov Automata, (TR )

A Unified Construction of the Glushkov, Follow, and Antimirov Automata, (TR ) A Unified Construction of the Glushkov, Follow, nd Antimirov Automt, (TR2006-880) Cyril Alluzen nd Mehryr Mohri Cournt Institute of Mthemticl Sciences 251 Mercer Street, New York, NY 10012, USA {lluzen,

More information

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh Lnguges nd Automt Finite Automt Informtics 2A: Lecture 3 John Longley School of Informtics University of Edinburgh jrl@inf.ed.c.uk 22 September 2017 1 / 30 Lnguges nd Automt 1 Lnguges nd Automt Wht is

More information

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata CS103B ndout 18 Winter 2007 Ferury 28, 2007 Finite Automt Initil text y Mggie Johnson. Introduction Severl childrens gmes fit the following description: Pieces re set up on plying ord; dice re thrown or

More information

Bases for Vector Spaces

Bases for Vector Spaces Bses for Vector Spces 2-26-25 A set is independent if, roughly speking, there is no redundncy in the set: You cn t uild ny vector in the set s liner comintion of the others A set spns if you cn uild everything

More information

How Deterministic are Good-For-Games Automata?

How Deterministic are Good-For-Games Automata? How Deterministic re Good-For-Gmes Automt? Udi Boker 1, Orn Kupfermn 2, nd Mich l Skrzypczk 3 1 Interdisciplinry Center, Herzliy, Isrel 2 The Herew University, Isrel 3 University of Wrsw, Polnd Astrct

More information

Some Theory of Computation Exercises Week 1

Some Theory of Computation Exercises Week 1 Some Theory of Computtion Exercises Week 1 Section 1 Deterministic Finite Automt Question 1.3 d d d d u q 1 q 2 q 3 q 4 q 5 d u u u u Question 1.4 Prt c - {w w hs even s nd one or two s} First we sk whether

More information

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck. Outline Automt Theory 101 Rlf Huuck Introduction Finite Automt Regulr Expressions ω-automt Session 1 2006 Rlf Huuck 1 Session 1 2006 Rlf Huuck 2 Acknowledgement Some slides re sed on Wolfgng Thoms excellent

More information

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University CS415 Compilers Lexicl Anlysis nd These slides re sed on slides copyrighted y Keith Cooper, Ken Kennedy & Lind Torczon t Rice University First Progrmming Project Instruction Scheduling Project hs een posted

More information

CHAPTER 1 Regular Languages. Contents

CHAPTER 1 Regular Languages. Contents Finite Automt (FA or DFA) CHAPTE 1 egulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, euivlence of NFAs nd DFAs, closure under regulr

More information

Quadratic Forms. Quadratic Forms

Quadratic Forms. Quadratic Forms Qudrtic Forms Recll the Simon & Blume excerpt from n erlier lecture which sid tht the min tsk of clculus is to pproximte nonliner functions with liner functions. It s ctully more ccurte to sy tht we pproximte

More information

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages 5//6 Grmmr Automt nd Lnguges Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Regulr Lnguges Context Free Lnguges Context Sensitive

More information

Homework Solution - Set 5 Due: Friday 10/03/08

Homework Solution - Set 5 Due: Friday 10/03/08 CE 96 Introduction to the Theory of Computtion ll 2008 Homework olution - et 5 Due: ridy 10/0/08 1. Textook, Pge 86, Exercise 1.21. () 1 2 Add new strt stte nd finl stte. Mke originl finl stte non-finl.

More information

Name Ima Sample ASU ID

Name Ima Sample ASU ID Nme Im Smple ASU ID 2468024680 CSE 355 Test 1, Fll 2016 30 Septemer 2016, 8:35-9:25.m., LSA 191 Regrding of Midterms If you elieve tht your grde hs not een dded up correctly, return the entire pper to

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2 CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 CMSC 330 1 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All exmples so fr Nondeterministic

More information

The Caucal Hierarchy of Infinite Graphs in Terms of Logic and Higher-order Pushdown Automata

The Caucal Hierarchy of Infinite Graphs in Terms of Logic and Higher-order Pushdown Automata The Cucl Hierrchy of Infinite Grphs in Terms of Logic nd Higher-order Pushdown Automt Arnud Cryol 1 nd Stefn Wöhrle 2 1 IRISA Rennes, Frnce rnud.cryol@iris.fr 2 Lehrstuhl für Informtik 7 RWTH Achen, Germny

More information

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1 Non-Deterministic Finite Automt Fll 2018 Costs Busch - RPI 1 Nondeterministic Finite Automton (NFA) Alphbet ={} q q2 1 q 0 q 3 Fll 2018 Costs Busch - RPI 2 Nondeterministic Finite Automton (NFA) Alphbet

More information

SWEN 224 Formal Foundations of Programming WITH ANSWERS

SWEN 224 Formal Foundations of Programming WITH ANSWERS T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Time Allowed: 3 Hours EXAMINATIONS 2011 END-OF-YEAR SWEN 224 Forml Foundtions of Progrmming

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb. CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

CDM Automata on Infinite Words

CDM Automata on Infinite Words CDM Automt on Infinite Words 1 Infinite Words Klus Sutner Crnegie Mellon Universlity 60-omeg 2017/12/15 23:19 Deterministic Lnguges Muller nd Rin Automt Towrds Infinity 3 Infinite Words 4 As mtter of principle,

More information

Tutorial Automata and formal Languages

Tutorial Automata and formal Languages Tutoril Automt nd forml Lnguges Notes for to the tutoril in the summer term 2017 Sestin Küpper, Christine Mik 8. August 2017 1 Introduction: Nottions nd sic Definitions At the eginning of the tutoril we

More information

GNFA GNFA GNFA GNFA GNFA

GNFA GNFA GNFA GNFA GNFA DFA RE NFA DFA -NFA REX GNFA Definition GNFA A generlize noneterministic finite utomton (GNFA) is grph whose eges re lele y regulr expressions, with unique strt stte with in-egree, n unique finl stte with

More information

Hamiltonian Cycle in Complete Multipartite Graphs

Hamiltonian Cycle in Complete Multipartite Graphs Annls of Pure nd Applied Mthemtics Vol 13, No 2, 2017, 223-228 ISSN: 2279-087X (P), 2279-0888(online) Pulished on 18 April 2017 wwwreserchmthsciorg DOI: http://dxdoiorg/1022457/pmv13n28 Annls of Hmiltonin

More information

The Regulated and Riemann Integrals

The Regulated and Riemann Integrals Chpter 1 The Regulted nd Riemnn Integrls 1.1 Introduction We will consider severl different pproches to defining the definite integrl f(x) dx of function f(x). These definitions will ll ssign the sme vlue

More information

CONTEXT-SENSITIVE LANGUAGES, RATIONAL GRAPHS AND DETERMINISM

CONTEXT-SENSITIVE LANGUAGES, RATIONAL GRAPHS AND DETERMINISM Logicl Methods in Computer Science Vol. 2 (2:6) 2006, pp. 1 24 www.lmcs-online.org Sumitted Jn. 31, 2005 Pulished Jul. 19, 2006 CONTEXT-SENSITIVE LANGUAGES, RATIONAL GRAPHS AND DETERMINISM ARNAUD CARAYOL

More information

Context-Free Grammars and Languages

Context-Free Grammars and Languages Context-Free Grmmrs nd Lnguges (Bsed on Hopcroft, Motwni nd Ullmn (2007) & Cohen (1997)) Introduction Consider n exmple sentence: A smll ct ets the fish English grmmr hs rules for constructing sentences;

More information

CS 267: Automated Verification. Lecture 8: Automata Theoretic Model Checking. Instructor: Tevfik Bultan

CS 267: Automated Verification. Lecture 8: Automata Theoretic Model Checking. Instructor: Tevfik Bultan CS 267: Automted Verifiction Lecture 8: Automt Theoretic Model Checking Instructor: Tevfik Bultn LTL Properties Büchi utomt [Vrdi nd Wolper LICS 86] Büchi utomt: Finite stte utomt tht ccept infinite strings

More information

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018 CS 301 Lecture 04 Regulr Expressions Stephen Checkowy Jnury 29, 2018 1 / 35 Review from lst time NFA N = (Q, Σ, δ, q 0, F ) where δ Q Σ P (Q) mps stte nd n lphet symol (or ) to set of sttes We run n NFA

More information

Foundations of XML Types: Tree Automata

Foundations of XML Types: Tree Automata 1 / 43 Foundtions of XML Types: Tree Automt Pierre Genevès CNRS (slides mostly sed on slides y W. Mrtens nd T. Schwentick) University of Grenole Alpes, 2017 2018 2 / 43 Why Tree Automt? Foundtions of XML

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation 9/6/28 Stereotypicl computer CISC 49 Theory of Computtion Finite stte mchines & Regulr lnguges Professor Dniel Leeds dleeds@fordhm.edu JMH 332 Centrl processing unit (CPU) performs ll the instructions

More information

State Minimization for DFAs

State Minimization for DFAs Stte Minimiztion for DFAs Red K & S 2.7 Do Homework 10. Consider: Stte Minimiztion 4 5 Is this miniml mchine? Step (1): Get rid of unrechle sttes. Stte Minimiztion 6, Stte is unrechle. Step (2): Get rid

More information

DFA minimisation using the Myhill-Nerode theorem

DFA minimisation using the Myhill-Nerode theorem DFA minimistion using the Myhill-Nerode theorem Johnn Högerg Lrs Lrsson Astrct The Myhill-Nerode theorem is n importnt chrcteristion of regulr lnguges, nd it lso hs mny prcticl implictions. In this chpter,

More information

Let's start with an example:

Let's start with an example: Finite Automt Let's strt with n exmple: Here you see leled circles tht re sttes, nd leled rrows tht re trnsitions. One of the sttes is mrked "strt". One of the sttes hs doule circle; this is terminl stte

More information

Lecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations.

Lecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations. Lecture 3 3 Solving liner equtions In this lecture we will discuss lgorithms for solving systems of liner equtions Multiplictive identity Let us restrict ourselves to considering squre mtrices since one

More information

Formal Languages and Automata Theory. D. Goswami and K. V. Krishna

Formal Languages and Automata Theory. D. Goswami and K. V. Krishna Forml Lnguges nd Automt Theory D. Goswmi nd K. V. Krishn Novemer 5, 2010 Contents 1 Mthemticl Preliminries 3 2 Forml Lnguges 4 2.1 Strings............................... 5 2.2 Lnguges.............................

More information

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA) Finite Automt (FA or DFA) CHAPTER Regulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, equivlence of NFAs DFAs, closure under regulr

More information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)

More information

dx dt dy = G(t, x, y), dt where the functions are defined on I Ω, and are locally Lipschitz w.r.t. variable (x, y) Ω.

dx dt dy = G(t, x, y), dt where the functions are defined on I Ω, and are locally Lipschitz w.r.t. variable (x, y) Ω. Chpter 8 Stility theory We discuss properties of solutions of first order two dimensionl system, nd stility theory for specil clss of liner systems. We denote the independent vrile y t in plce of x, nd

More information

List all of the possible rational roots of each equation. Then find all solutions (both real and imaginary) of the equation. 1.

List all of the possible rational roots of each equation. Then find all solutions (both real and imaginary) of the equation. 1. Mth Anlysis CP WS 4.X- Section 4.-4.4 Review Complete ech question without the use of grphing clcultor.. Compre the mening of the words: roots, zeros nd fctors.. Determine whether - is root of 0. Show

More information

Parsing and Pattern Recognition

Parsing and Pattern Recognition Topics in IT Prsing nd Pttern Recognition Week Context-Free Prsing College of Informtion Science nd Engineering Ritsumeikn University this week miguity in nturl lnguge in mchine lnguges top-down, redth-first

More information

BACHELOR THESIS Star height

BACHELOR THESIS Star height BACHELOR THESIS Tomáš Svood Str height Deprtment of Alger Supervisor of the chelor thesis: Study progrmme: Study rnch: doc. Štěpán Holu, Ph.D. Mthemtics Mthemticl Methods of Informtion Security Prgue 217

More information

CM10196 Topic 4: Functions and Relations

CM10196 Topic 4: Functions and Relations CM096 Topic 4: Functions nd Reltions Guy McCusker W. Functions nd reltions Perhps the most widely used notion in ll of mthemtics is tht of function. Informlly, function is n opertion which tkes n input

More information