A Unified Construction of the Glushkov, Follow, and Antimirov Automata, (TR )
|
|
- Brian Richards
- 6 years ago
- Views:
Transcription
1 A Unified Construction of the Glushkov, Follow, nd Antimirov Automt, (TR ) Cyril Alluzen nd Mehryr Mohri Cournt Institute of Mthemticl Sciences 251 Mercer Street, New York, NY 10012, USA {lluzen, Astrct. Mny techniques hve een introduced in the lst few decdes to crete ɛ-free utomt representing regulr expressions: Glushkov utomt, the so-clled follow utomt, nd Antimirov utomt. This pper presents simple nd unified view of ll these ɛ-free utomt oth in the cse of unweighted nd weighted regulr expressions. It descries simple nd generl lgorithms with running time complexities t lest s good s tht of the est previously known techniques, nd provides concise proofs. The construction methods re ll sed on two stndrd utomt lgorithms: epsilon-removl nd minimiztion. This contrsts with the multitude of complicted nd specil-purpose techniques nd proofs put forwrd y others to construct these utomt. Our nlysis provides etter understnding of ɛ-free utomt representing regulr expressions: they re ll the results of the ppliction of some comintions of epsilon-removl nd minimiztion to the clssicl Thompson utomt. This mkes it strightforwrd to generlize these lgorithms to the weighted cse, which lso results in much simpler lgorithms thn existing ones. For weighted regulr expressions over closed semiring, we extend the notion of follow utomt to the weighted cse. We lso present the first lgorithm to compute the Antimirov utomt in the weighted cse. 1 Introduction The construction of finite utomt representing regulr expressions hs een widely studied due to its multiple pplictions to pttern-mtching nd mny This work ws prtilly funded y the New York Stte Office of Science Technology nd Acdemic Reserch (NYSTAR). This project ws sponsored in prt y the Deprtment of the Army Awrd Numer W23RYX-3275-N605. The U.S. Army Medicl Reserch Acquisition Activity, 820 Chndler Street, Fort Detrick MD is the wrding nd dministering cquisition office. The content of this mteril does not necessrily reflect the position or the policy of the Government nd no officil endorsement should e inferred.
2 other res of text processing [1, 22]. The most clssicl construction, Thompson s construction [14, 25], cretes finite utomton with numer of sttes nd trnsitions liner in the length m of the regulr expression. Figure 1() shows n exmple. The time complexity of the lgorithm is lso liner, O(m). But Thompson s utomton contins trnsitions leled with the empty string ɛ which crete dely in pttern mtching. Mny lterntive techniques hve een introduced in the lst few decdes to crete ɛ-free utomt representing regulr expressions, in prticulr, Glushkov utomt [11], follow utomt [13], nd Antimirov utomt [2]. The Glushkov utomton, or position utomton, ws independently introduced y [11] nd [17]. Figure 1() shows n exmple for prticulr regulr expression. The utomton hs exctly n + 1 sttes ut up to n 2 trnsitions, where n is the numer of occurrences of lphet symols ppering in the expression. For resonle expression, m = O(n), mking it qudrticlly lrger thn the Thompson utomton. When using it-prllelism for regulr expression serch, due to its smller numer of sttes, the Glushkov utomton cn e represented with hlf the numer of mchine words required y the Thompson utomton [21,22]. Severl techniques hve een suggested for constructing the Glushkov utomton. In [3], the construction is sed on the recursive definition of the follow function nd hs complexity of O(n 3 ). The lgorithm descried y [4] hs complexity of O(m + n 2 ) nd is sed on n optimiztion of the recursive definition of the follow function. It requires the expression to e first rewritten in strnorml form, which cn e done non-trivilly in O(m). Severl other qudrtic lgorithms hve een given: tht of [9] which is sed on n optimiztion of the follow recursion, nd tht of [23], sed on the ZPC structure, which consists of two mutully linked copies of the syntctic tree of the expression. The Antimirov or prtil derivtives utomton ws introduced y [2]. Figure 1(d) shows n exmple. It is in generl smller thn the Glushkov utomton with up to n+1 sttes nd up to n 2 trnsitions. It ws in fct proven y [8] (see [13] for simpler proof) to e the quotient of the Glushkov utomton for some equivlence reltion. The complexity of the originl construction lgorithm y [2] is O(m 5 ). [8] presented n lgorithm whose complexity is O(m 2 ). Finlly, the follow utomton ws introduced y [13], it is the quotient of the Glushkov utomton y the follow equivlence: two sttes re equivlent if they hve the sme follow nd the sme finlity. Figure 1(c) presents n exmple. The uthor gve n O(m+n 2 ) lgorithm where some ɛ-trnsitions re removed from the utomton t ech step of the construction of the Thompson construction s well s t the end. An O(m + n 2 ) lgorithm using the ZPC structure ws given in [7], which requires the regulr expression to e rewritten in str-norml form. Some of these results hve een extended to weighted regulr expressions over ritrry semirings. The generliztion of the Thompson construction trivilly follows from [24]. The Glushkov utomton cn e nturlly extended to the weighted cse [5], nd n O(m 2 ) construction lgorithm sed on the generliztion of the ZPC construct ws given y [6]. The Antimirov utomton ws
3 generlized to the weighted cse y [16], ut no explicit construction lgorithm or complexity nlysis ws given y the uthors. This pper presents simple nd unified view of ll these ɛ-free utomt (Glushkov, follow, nd Antimirov) oth in the cse of unweighted nd weighted regulr expressions. It descries simple nd generl lgorithms with running time complexities t lest s good s tht of the est previously known techniques, nd provides concise proofs. The construction methods re ll sed on two stndrd utomt lgorithms: epsilon-removl 1 nd minimiztion s summrized y the following tle: Automton Algorithm Complexity Glushkov rmeps(t) O(mn) Follow min(rmeps(t)) O(mn) Antimirov rmeps(min(rmeps( T))) O(m log m + mn) Where T is the Thompson utomton, T is the utomton derived from T y mrking lphet symols with their position in the expression. When the symols re mrked, the sme nottion denotes the opertion tht removes the mrking. T is otined y mrking some ɛ-trnsitions in T, mking it deterministic (the ɛ-trnsitions mrked re removed y the rmeps opertion). This contrsts with the multitude of complicted nd specil-purpose techniques nd proofs put forwrd y others to construct these utomt. No need for fine-tuning some recursions, no requirement tht the regulr expression e in str-norml form, nd no need to mintin multiple copies of the syntctic tree. Our nlysis provides etter understnding of ɛ-free utomt representing regulr expressions: they re ll the results of the ppliction of some comintions of epsilon-removl nd minimiztion to the clssicl Thompson utomt. This mkes it strightforwrd to generlize these lgorithms to the weighted cse y using the generliztion of ɛ-removl nd minimiztion [18, 19]. This lso results in much simpler lgorithms thn existing ones. In prticulr, this leds to strightforwrd lgorithm for the construction of the Glushkov utomton of weighted regulr expression, nd, in the cse of closed semirings, llows us to generlize the notion of follow utomton to the weighted cse. We lso give the first explicit construction lgorithm of the Antimirov utomton of weighted expression. When the semiring is k-closed (or only ɛ-k-closed for the regulr expression in the Glushkov cse), the complexities of the construction lgorithms re the sme s in the unweighted cse. 2 Preliminries Semirings A semiring (K,,, 0, 1) is ring tht my lck negtion. K is closed if = n 0 n is defined for ll K, nd k-closed if there exists 1 ɛ-removl is less well known s n lgorithm ecuse it hs often een nd continue to e only presented s prt of determiniztion in mny textooks.
4 () ,2, 3,6 4,5 0 1,2 6 3,4,5 () (c) (d) Fig. 1. () The Thompson utomton, () Glushkov utomton, (c) Follow utomton, nd (d) Antimirov utomton representing the regulr expression α = (+)( + + ). This regulr expression is the running exmple from [13]. k 0 such tht = k for ll K. Exmples of semirings re the oolen semiring (B,,, 0, 1), the tropicl semiring (R + { }, min, +,, 0), nd the rel semiring (R +, +,, 0, 1). Weighted utomt A weighted utomton A over semiring K is 7-uple (Σ, 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; E Q (Σ {ɛ}) K Q finite set of trnsitions; λ : I K the initil weight function; nd ρ : F K the finl weight function mpping F to K. Given trnsition e E, we denote y i[e] its input lel, p[e] its origin or previous stte nd n[e] its destintion stte or next stte, w[e] its weight. Given stte q Q, we denote y E[q] the set of trnsitions leving q. A pth π = e 1 e k is n element of E with consecutive trnsitions: n[e i 1 ] = p[e i ], i = 2,...,k. We extend n nd p to pths y setting: n[π] = n[e k ] nd p[π] = p[e 1 ]. A cycle π is pth whose origin nd destintion sttes coincide: n[π] = p[π]. We denote y P(q, q ) the set of pths from q to q nd y P(q, x, q ) the set of pths from q to q with input lel x Σ. These definitions cn e extended to susets R, R Q, y: P(R, x, R ) = q R, q R P(q, x, q ). The leling function i nd the weight function w cn lso e extended to pths: i[π] = i[e 1 ] i[e k ], w[π] = w[e 1 ] w[e k ]. The weight ssocited y A to
5 ech input string x Σ is [A](x) = π P(I,x,F) λ(p[π]) w[π] ρ(n[π]), [A](x) is defined to e 0 when P(I, x, F) =. Generl lgorithms Let A e weighted utomton over K. The shortest distnce from p to q is defined s d[p.q] = π P(p,q) w[π]. It cn e computed using the generic single-source shortest-distnce lgorithm of [20] if K is k-closed for A, or using generliztion of Floyd-Wrshll [15,20] if K is closed for A. The generl ɛ-removl lgorithm of [19] consists of first computing the ɛ- closure of ech stte p in A, closure(p) = {(q, w) w = d ɛ [p, q] = π P(p,q),i[π]=ɛ w[π] 0}, (1) nd then, for ech stte p, of deleting ll the outgoing ɛ-trnsitions of p, nd dding out of p ll the non-ɛ trnsitions leving ech stte q closure(p) with their weight pre- -multiplied y d ɛ [p, q]. If K is k-closed for the ɛ-cycles of A, 2 then the generic single-source shortest-distnce lgorithm [20] cn e used to compute the ɛ-closures. Weight pushing [18] is normliztion lgorithm tht redistriute the weights long the pths of A such tht e E[q] w[e] + ρ(q) = 1 for every stte q Q, we will denote y push(a) the resulting utomton. The lgorithm requires tht K is zero-sum free, wekly left divisile nd closed or k-closed for A since it depends on the computtion of d[q, F] for ll q Q. It ws proved in [18] tht, if A is deterministic (i.e. if no two trnsitions leving ny stte shre the sme lel nd if it hs unique initil stte), then the lgorithm consisting of weight pushing followed y unweighted minimiztion (considering the pirs (lel,weight) s single symol) leds to miniml utomton equivlent to A, denoted y min(a). See figure 2 for n illustrtion of these lgorithms, more detiled descriptions re given in the ppendix. Regulr expressions A weighted regulr expression over the semiring K is recursively defined y:, ɛ nd Σ re regulr expressions, nd if α nd β re regulr expressions then kα, αk for k K, α + β, α β nd α re lso regulr expressions. We denote y α the length of α, nd y α Σ the width α, i.e. the numer of occurrences of lphet symols in α. Let pos(α) = {1, 2,..., α Σ } e the set of (lphet symol) positions in α. An unweighted regulr expression cn e seen s weighted expression over the oolen semiring (B,,, 0, 1). We denote y A T (α) the Thompson utomton of α nd y I AT (α) nd F AT (α) its unique initil nd finl sttes. For i pos(α), we defined p i nd q i s the sttes such tht the lphet symol t the i-th position in α corresponds to the trnsition from p i to q i. These sttes re the only sttes hving respectively non-ɛ outgoing or incoming trnsition. 2 For A to e well defined, K needs to e closed for the ɛ-cycles of A.
6 0 /7 /3 c/8 / 3 1 / 2 /4 /6 2 /9 /5 3/1 0/75 /45 /5 c/24 /24 /15 c/8 /8 1/25 2/1 () () 0 /2 /2 c/4 d/3 f/1 1 2 f/3 g/1 f/6 g/2 3/1 0 /(1/8) /(1/8) c/(1/4) d/(3/8) f/(1/8) 1 2 f/(3/4) g/(1/4) f/(3/4) g/(1/4) 3/1 /(1/8) /(1/8) 0 c/(1/4) d/(3/8) 1 f/(1/8) f/(3/4) g/(1/4) 2/1 (c) (d) (e) Fig.2. () A weighted utomton A 1 over the rel semiring (R +,+,,0,1). () The result of the ppliction of ɛ-removl to A. (c) A weighted utomton A 2 over the rel semiring (R +,+,,0,1). (d) The result of weight pushing. (e) The result of minimiztion. The initil weight in the lst two utomt is Glushkov Automton Let α e weighted regulr expression over the lphet Σ nd the semiring K. We denote y α the weighted regulr expression otined y mrking ech symol of α with its position. The Glushkov or position utomton A G (α) of α is is defined y the 7-uple (Σ, pos 0 (α), E, 0, 1, F, ρ) where pos 0 (α) = pos(α) {0}, E = {(i,, w, j) : (j, w) follow(α, i) nd pos(α, j) = }, (2) nd for i pos 0 (α), i F iff there exist w K such tht (i, w) lst 0 (α), nd then ρ(i) = w. The functions null(α) K, first(α) pos(α) K, lst(α) pos(α) K nd follow(α, i) pos(α) K re recursively defined over the suterms of α s shown in the tles elow. We lso define follow(α, 0) = first(α) nd lst 0 (α) s lst(α) {(0, null(α))} if null(α) 0, nd lst(α) otherwise. For X pos(α) K, k K nd i pos(α), k X = {(i, k w) (i, w) X} if k 0, 0 X = (X k is defined similrly), nd X, i = w if there exists w such tht (i, w) X, nd X, i = 0 otherwise. The union of two weighted susets X nd Y is defined y X Y = {(i, X, i Y, i ) X, i Y, i 0}. For exmple, {(i, w)} {(i, w )} = {(i, w w )}.
7 null first lst 0 ɛ 1 i 0 {(i, 1)} {(i, 1)} kβ k null(β) k first(β) lst(β) βk null(β) k first(β) lst(β) k β + γ null(β) null(γ) first(β) first(γ) lst(β) lst(γ) β γ null(β) null(γ) first(β) null(β) first(γ) lst(β) null(γ) lst(γ) β null(β) null(β) first(β) lst(β) null(β) follow(, i) ɛ i kβ follow(β, i) βk follow(β, i) follow(, i) j follow(β, i) if i pos(β) β + γ j follow(γ, i) if i pos(γ) follow(β, i) lst(β), i first(γ) if i pos(β) β γ follow(γ, i) if i pos(γ) β follow(β, i) lst(β ), i first(γ) null(α) = null(α) is the vlue ssocited y α to ɛ. For α to e well defined, null(β) must e defined for every suterm. There is in fct very simple reltionship etween the first, lst nd follow functions nd the ɛ-closures of the sttes in the Thompson utomton tht dmit non-ɛ incoming trnsition. Lemm 1. Let α e weighted regulr expression. Let A = A T (α). Then (i) (i, w) first(α) iff (p i, w) closure(i A ); (ii) (i, w) follow(α, j) iff (p i, w) closure(q j ); nd (iii) (i, w) lst(α) iff (F A, w) closure(q i ). Proof. The proof is y induction on the length of the regulr expression. If α =, α = ɛ or α =, then the properties trivilly hold. Due to lck of spce, we will only tret the cse α = β γ, other cses cn e treted similrly. Let A = A T (α), B = A T (β) nd C = A T (γ). If α = β γ, then closure A (I A ) = closure B (I B ) [B][ɛ] closure C (I A ), thus (i) recursively holds since [B][ɛ] = null(β). If j pos(γ), then closure A (q j ) = closure C (q j ). Otherwise j pos(β) nd closure A (q j ) = closure B (q j ) closure B (q j ), F B closure C (I C ). (3) Thus, (ii) nd (iii) recursively hold. The following theorem follows directly from the lemm just presented. Theorem 1. Let α e weighted regulr expression. Then: A G (α) = rmeps(a T (α)). (4) Let α e weighted regulr expression α over K. We will sy tht K is ɛ-k-closed for α if there exist k such tht for every suterm β of α, null(β) = null(β) k.
8 Lemm 2. Let A e the Thompson utomton of weighted regulr expression over k-closed semiring. There is queue discipline for which the complexity of the single-source shortest-distnce lgorithm from ny stte in A is liner. Proof. We define the suterm depth of stte q in A s the numer of suterms β + γ nd β it elongs to. We then use lrger suterm-depth first queue discipline. The queue cn e mintined in constnt time since (1) there is t most two sttes hving the sme suterm depth in the queue t nytime nd (2) if d is the mximl suterm depth of n element in the queue t given time, the suterm depth of the stte inserted next will e d 1, d or d + 1. Theorem 2. Let α e weighted regulr expression over semiring K tht is ɛ- k-closed for α. The Glushkov utomton of α cn e constructed in time O(mn) y pplying ɛ-removl to its Thompson utomton. Proof. If K is ɛ-k-closed for α, then K is k-closed for ll the pths considered during the computtion of the ɛ-closures nd, y Lemm 2, ech ɛ-closure cn e computed in O(m). Since n + 1 closures need to e computed, the totl complexity is in O(mn + n 2 ) = O(mn). In the unweighted cse, the unpulished mnuscript [10] showed tht the Glushkov utomton could e otined y removing the ɛ-trnsitions from the Thompson utomton. However, the uthors used specil-purpose ɛ-removl lgorithm nd not the clssicl ɛ-removl lgorithm, limiting the scope of their results. 4 Follow Automton The follow utomton of n unweighted regulr expression α, denoted y A F (α) ws introduced y [13]. It is the quotient of A G (α) y the equivlence reltion F defined over pos 0 (α) y: i F j iff { {i, j} lst0 (α) or {i, j} lst 0 (α) =, nd follow(α, i) = follow(α, j). (5) Theorem 3. For ny regulr expression α, the following identities hold: A F (α) = min(a G (α)) A F (α) = min(a G (α)). Note tht it is mentioned in [13] tht minimiztion could e used to construct the follow utomt ut the uthors clim tht the complexity of minimiztion would e in O(n 2 log n) mking this pproch less efficient. The following theorem shows tht minimiztion hs in fct etter complexity in this cse. Oserve tht A G (α) is deterministic. Theorem 4. The time complexity of the Hopcroft s minimiztion lgorithm when pplied to A G (α) is liner, i.e., in O(n 2 ) where n = α Σ.
9 Proof. Due to spce constrints, we will give only sketch of the proof. The log Q fctor in Hopcroft s lgorithm corresponds to the numer of times the incoming trnsitions t given stte q re used to split suset (tenttive equivlence clss). In A G (α), trnsitions shring the sme lel hve ll the sme destintion stte (the utomton is 1-locl), thus ech incoming trnsition of stte q cn only e used once to split suset. This theorem ctully holds for ll 1-locl utomt. This leds to simple lgorithm for constructing the follow utomton of regulr expression α: A F (α) = min(rmeps(a T (α))). (6) whose complexity O(mn) is identicl to tht of the more complicted nd specilpurpose lgorithms of [13, 7]. When the semiring K is wekly divisile, zero-sum free, nd closed, we cn then define the follow utomton of weighted regulr expression α s: A F (α) = min(a G (α)). Theorem 5. If K is k-closed, then A F (α) cn e computed in O(mn). Proof. The shortest-distnce computtion required y weight pushing cn e done in O(m) in the cse of A T (α) nd is preserved y ɛ-removl. The weighted utomton push(a G (α)) is 1-locl when considered s finite utomton over pirs (lel, weight), thus theorem 4 cn e pplied. 5 Antimirov Automton In the following we will consider pirs (w, α) with w K, nd we define k (w, α) = (k w, α), (w, α) k = (w, αk) nd (w, α) β = (w, α β). These opertions cn nturlly e extended to multisets 3 of pirs (weight, expression). The prtil derivtive of α with respect to Σ is the multiset of pirs (weight, expression) recursively defined y: (ɛ) = (1) = (β + γ) = (β) (γ) () = ɛ if =, otherwise (β γ) = (β) γ null(β) (γ) (kβ) = k (β) (β ) = null(β) (β) β (βk) = (β) k The prtil derivtive of α with respect to the string s Σ, denoted s (α), is recursively defined y s (α) = ( s (α)). Let D(α) = {β : (w, β) s (α) with s Σ nd w K}. Note tht for D(α) to e well-defined, we need to define when two expressions re the sme. Here we will only llow the following identities: α = α =, +α = α + =, 0α = α0 =, ɛ α = α ɛ = α, 1α = α1 = α, k(k α) = (k k )α, (αk)k = α(k k ) nd (α + β) γ = α γ + β γ. 4 3 By multisets, we men tht {(w, α)} {(w, α)} = {(w, α),(w, α)}. 4 These identities re the trivil identities considered in [16] except for the lst two which were dded to simplify our presenttion. Any lrger set of identities cn e hndled with our method y rewriting α in the corresponding norml form.
10 The Antimirov or prtil derivtives utomton of α is defined y the 7- uple (Σ, D(α), E, α, 1, F, null) where E = {(β,, w, γ) w = (w,γ) (β) w } nd F = {β D(α) null(β) 0}. Let Σ = Σ {ɛ 1 +, ɛ2 +, ɛ1, ɛ2 }. We denote y ÂT(α) the weighted utomton over Σ otined y recursively mrking some of the ɛ-trnsitions of A T (α) s follows: if α = β + γ, we lel y ɛ 1 + (resp. ɛ2 + ) the ɛ-trnsition from I A T (α) to I AT (β) (resp. I AT (γ)); if α = β, we lel y ɛ 1 (resp. ɛ 2 ) the two ɛ-trnsitions to I AT (β) (resp. F AT (α)). Oserve tht ÂT(α) cn e viewed s n utomton recognizing the expression α over Σ recursively defined y =, ɛ = ɛ, â =, kβ = k β, βk = βk, β + γ = ɛ 1 + β + ɛ 2 + γ, β γ = β γ nd β = (ɛ 1 β) ɛ 2. For i pos 0 (α), we use the sme nottion q i (with q 0 = I) for the corresponding sttes in A T (α), Â T (α) nd rmeps(ât(α)). For stte q in rmeps(ât(α)), we define y L(q) the lnguge recognized from q considering rmeps(ât(α)) s n unweighted utomton over pirs (symol,weight). Lemm 3 follows from our mrking of the ɛ-trnsitions. Lemm 3. For i pos 0 (α), L(q i ) uniquely defines regulr expression over Σ, denoted y δ i (or δ α i when there is n miguity). Lemm 4. For ll i pos 0 (α) nd j pos(α), we hve for p j, q i in A T (α) tht: (p j, w) closure(q i ) iff (w, δ j ) (δ i ). (7) Proof. The proof is y induction on the length of the regulr expression. If α =, α = ɛ or α =, then the properties trivilly hold. Due to the lck of spce, we will only tret the cse α = β γ, other cses cn e treted similrly. Let A = A T (α), B = A T (β) nd C = A T (γ). If q i is in C, then δi α = δ γ i nd closure A (q i ) = closure C (q i ). Therefore, if (w, p j ) closure A (q i ), p j is in C nd then δj α = δγ j. Hence (7) recursively holds. If q i is in B, then δi α = δ β i γ nd we hve: (δ α i ) = (δ β i ) γ null(δβ i ) (γ) (8) closure A (q i ) = closure B (q i ) null(δ β i ) closure C(I C ). (9) By induction, we hve tht (p j, w) closure B (q i ) iff (w, δ β j ) (δ β i ), nd (p j, w) closure C (I C ) iff (w, δ γ j ) (δ γ 0 ) = (γ). Hence (7) follows. Oserve tht δ 0 = α, hence lemm 4 implies tht the δ i re the derived terms of α, more precisely, i δ i is surjection from pos 0 (α) onto D(α). This leds us to the following result, where min B is unweighted minimiztion when ech pir (lel,weight) is treted s regulr symol nd rmeps denotes the removl of the mrked ɛ s. Theorem 6. We hve A A (α) = rmeps(min B (rmeps(ât(α)))).
11 Proof. Note tht rmeps(ât(α)) is deterministic. During minimiztion, two sttes q i nd q j re equivlent iff L(q i ) = L(q j ), i.e. δ i = δ j (y lemm 3). Hence, there is ijection etween D(α) nd the set of sttes of min B (rmeps(ât(α))) hving n incoming trnsition with lel in Σ, nd hence etween D(α) nd the set of sttes of A = rmeps(min B (rmeps(ât(α)))). Lemm 4 ensures tht the trnsitions in A is consistent with the definition of A A (α). Theorem 7. If K is ɛ-k-closed, then A A (α) cn e computed in O(m log m + mn). Theorem 7 follows from the fct tht rmeps(ât(α)) hs O(m) sttes nd trnsitions. In the unweighted cse, this complexity is good s the more complicted nd est known lgorithm of [8]. In the weighted cse, the use of minimiztion over (lel,weight) pirs is su-optiml since sttes tht would e equivlent modulo -multiplictive fctor re not merged. When possile, using weighted minimiztion insted would led to smller utomton in generl. Hence, if K is closed, we cn defined the normlized Antimirov utomton of α s rmeps(min K (rmeps(ât(α)))). This utomton would lwys e smller thn the Antimirov utomton nd the utomton of unitry derived terms of [16] 5. If K is k-closed, it cn e constructed in O(m log m + mn). Remrk When the condition out k-closedness (resp. ɛ-k-closedness for α) of K is relxed to the closedness of K (resp. tht α is well-defined), ll our construction lgorithms cn still e used y replcing the generic single-source shortestdistnce lgorithm with generliztion of the Floyd-Wrshll lgorithm [15, 20], leding to complexity in O(m 3 ). It is not hrd however to mintin the qudrtic complexity y modifying the generic single-source shortest-distnce lgorithm to tke dvntge of the specil topology of the Thompson utomton. In the unweighted cse, every regulr expression cn e stightforwrdedly rewritten in ɛ-norml form such tht m = O(n). In tht cse, our O(mn) or O(m log m+mn) complexities ecome O(m+n 2 ) which is wht is often reported in the literture. 6 Conclusion We presented simple nd unified view of ɛ-free utomt representing unweighted nd weighted regulr expressions. We showed tht stndrd unweighted nd weighted epsilon-removl nd minimiztion cn e used to crete the Glushkov, follow, nd Antimirov utomt nd tht the complexities of these lgorithms mtch those of the est known lgorithms. This provides etter understnding 5 This utomton cn e viewed in our pproch s the result of simpler form of reweighting thn weight pushing, the reweighting used y weighted minimiztion.
12 of the ɛ-free utomt representing regulr expressions. It lso suggests using other comintions of epsilon-removl nd minimiztion for creting ɛ-free utomt. For exmple, in some contexts, it might e eneficil to use reverseepsilon-removl rther thn epsilon-removl [19]. Note lso tht the Glushkov utomton cn e constructed on-the-fly since Thompson s construction nd epsilon-removl oth dmit n on-demnd implementtion. References 1. A. V. Aho, R. Sethi, nd J. D. Ullmn. Compilers, Principles, Techniques nd Tools. Addison Wesley: Reding, MA, V. M. Antimirov. Prtil derivtives of regulr expressions nd finite utomton constructions. Theoreticl Computer Science, 155(2): , G. Berry nd R. Sethi. From regulr expressions to deterministic utomt. Theoreticl Computer Science, 48(3): , A. Brüggemnn-Klein. Regulr expressions into finite utomt. Theoreticl Computer Science, 120(2): , P. Cron nd M. Flouret. Glushkov construction for series: the non commuttive cse. Interntionl Journl of Computer Mthemtics, 80(4): , J.-M. Chmprnud, É. Lugerotte, F. Ourdi, nd D. Zidi. From regulr weighted expressions to finite utomt. In Proceedings of CIAA 2003, volume 2759 of Lecture Notes in Computer Science, pges Springer-Verlg, J.-M. Chmprnud, F. Nicrt, nd D. Zidi. Computing the follow utomton of n expression. In Proceedings of CIAA 2004, volume 3317 of Lecture Notes in Computer Science, pges Springer-Verlg, J.-M. Chmprnud nd D. Zidi. Computing the eqution utomton of regulr expression in O(s 2 ) spce nd time. In Proceedings of CPM 2001, volume 2089 of Lecture Notes in Computer Science, pges Springer-Verlg, C.-H. Chng nd R. Pge. From regulr expressions to DFA s using compressed NFA s. Theoreticl Computer Science, 178(1-2):1 36, D. Gimmrresi, J.-L. Ponty, nd D. Wood. Glushkov nd Thompson constructions: synthesis V. M. Glushkov. The strct theory of utomt. Russin Mthemticl Surveys, 16:1 53, J. Hopcroft. An n log n lgorithm for minimizing sttes in finite utomton. In Z. Kohvi nd A. Pz, editors, Proceedings of the Interntionl Symposium on the Theory of Mchines nd Computtions, pges Acdemic Press, L. Ilie nd S. Yu. Follow utomt. Informtion nd Computtion, 186(1): , S. C. Kleene. Representtions of events in nerve sets nd finite utomt. In C. E. Shnnon, J. McCrthy, nd W. R. Ashy, editors, Automt Studies, pges Princeton University Press, D. J. Lehmnn. Algeric structures for trnsitives closures. Theoreticl Computer Science, 4:59 76, S. Lomrdy nd J. Skrovitch. Derivtives of rtionl expressions with multiplicity. Theoreticl Computer Science, 332(1-3): , R. McNughton nd H. Ymd. Regulr expressions nd stte grphs for utomt. IEEE Trnsctions on Electronic Computers, 9(1):39 47, 1960.
13 18. M. Mohri. Finite-Stte Trnsducers in Lnguge nd Speech Processing. Computtionl Linguistics, 23:2, M. Mohri. Generic e-removl nd input e-normliztion lgorithms for weighted trnsducers. Interntionl Journl of Foundtions of Computer Science, 13(1): , M. Mohri. Semiring Frmeworks nd Algorithms for Shortest-Distnce Prolems. Journl of Automt, Lnguges nd Comintorics, 7(3): , G. Nvrro nd M. Rffinot. Fst regulr expression serch. In Proceedings of WAE 99, volume 1668 of Lecture Notes in Computer Science, pges Springer-Verlg, G. Nvrro nd M. Rffinot. Flexile pttern mtching. Cmridge University Press, J.-L. Ponty, D. Zidi, nd J.-M. Chmprnud. A new qudrtic lgorithm to convert regulr expression into utomt. In Proceedings of WIA 96, volume 1260 of Lecture Notes in Computer Science, pges Springer-Verlg, M.-P. Schützenerger. On the definition of fmily of utomt. Informtion nd Control, 4: , K. Thompson. Regulr expression serch lgorithm. Communictions of the ACM, 11(6): , 1968.
14 A Generl lgorithms A.1 Shortest distnce A generic single-source shortest-distnce lgorithm in weighted utomt ws presented in [20]. The lgorithm is generliztion of the clssicl shortestdistnce lgorithms. It does not require the semiring to e idempotent. For weighted utomton A over K, the condition for the lgorithm to work is tht K must e k-closed for A, i.e. there exist k N such tht for ny cycle c in A, w[c] = w[c] k. shortest-distnce(a, s) 1 for ech p Q do 2 d[p] r[p] 0 3 d[s] r[s] 1 4 S {s} 5 while S do 6 q hed(s) 7 dequeue(s) 8 R r[q] 9 r[q] 0 10 for ech e E[q] do 11 if d[n[e]] d[n[e]] (R w[e]) then 12 d[n[e]] d[n[e]] (R w[e]) 13 r[n[e]] r[n[e]] (R w[e]) 14 if n[e] S 15 enqueue(s, n[e]) 16 d[s] 1 Fig. 3. Pseudocode of the generic shortest-distnce lgorithm. The lgorithm is lso generic in the sense tht it works with ny queue discipline. The pseudocode of the lgorithm is given figure 3. The complexity of the lgorithm depends on the queue discipline chosen for S, more precisely it is in: O( Q + (T + T + C(A)) E mx N(q) + (C(I) + C(X)) N(q)) (10) q Q q Q where N(q) denotes the numer of times stte q is extrcted from the queue S, C(X) the cost of extrcting stte from S, C(I) the cost of inserting stte in S, nd C(A) the cost of n ssignment. In the cse of n cyclic utomton, using the topologicl order queue discipline, the complexity of the lgorithm is liner, i.e., O( Q + E ). In the cse of the tropicl semiring, using Fioncci heps, the complexity of the lgorithm is O( E + Q log Q ).
15 ɛ-removl(a) 1 for ech p Q do 2 E[p] {e E[p] : i[e] ɛ} 3 for ech (q, w) C[p] do C[p] = closure(p) 4 E[p] E[p] {(p,, w w, r) : (q,, w, r) E[q] nd ɛ} 5 if q F then 6 F F {p} 7 ρ[p] ρ[p] (w ρ[q] Fig.4. Pseudocode of the ɛ-removl lgorithm. A.2 Epsilon removl Let A e weighted utomton over K with ɛ-trnsitions. Let A ɛ e the utomton otined y deleting ll the trnsitions not leled y ɛ from A. A generl ɛ-removl lgorithm sed on the generic shortest distnce lgorithm presented ove ws given in [19]. This lgorithms works if the semiring K is k-closed for A ɛ. The lgorithm is divided in two steps. The first step consists of computing the ɛ-closure of ech stte p in A. Let d ɛ [p, q] denote the ɛ-distnce from p to q, for p, q Q: d ɛ [p, q] = w[π]. (11) The ɛ-closure of p is then defined s π P(p,q),i[π]=ɛ closure(p) = {(q, d ɛ [p, q]) d ɛ [p, q] 0}. (12) The ɛ-closure of p cn e computed y using the generic shortest-distnce lgorithm on A ɛ with source p. The second step consist of, for ech stte p hving t lest n incoming non-ɛ trnsition, deleting ll the outgoing ɛ-trnsitions of p, nd dding out of p ll the non-ɛ trnsitions leving ech stte q closure(p) with their weight pre- -multiplied y d ɛ [p, q]. The pseudocode of this second step is given figure 4. A.3 Weight pushing Weight pushing is n lgorithm for normlizing the distriution of the weights long the pths of weighted utomt [18]. Let A e weighted utomton over K nd ssume tht K is wekly left divisile nd zero sum free. For every stte q Q, ssume tht the shortest distnce from q to F: d F [q] = (w[π] ρ(n[π])) (13) π P(q,F)
16 is well defined in K. The weight pushing lgorithm consists of computing ech d F [q] nd of reweighting A in the following wy: e E such tht d F [p[e]] 0, w[e] d F [p[e]] 1 (w[e] d F [n[e]]) q I, λ[q] λ[q] d F [q] q F such tht d F [q] 0, ρ[q] d F [q] 1 ρ[q] (14) The complexity of the reweighting step is liner in the size of A under the ssumption tht the cost of the opertion is constnt. The first step cn e chieve y pplying the shortest-distnce lgorithm on the reverse of A, hence the complexity of this step is s discussed in section A.1. Weight pushing hs two interesting properties: (1) it does no chnge the weight of successful pths, (2) the resulting weighted utomton is stochstic, i.e. for ny stte q, the -sum of the weight of the outgoing trnsitions in q is equl to 1. A.4 Weighted minimiztion A weighted utomton A is deterministic if no two trnsitions leving ny stte shre the sme lel nd if it hs unique initil stte. A deterministic weighted utomton is miniml if there exists no other deterministic utomton hving smller numer of sttes nd relizing the sme function. A generl weighted minimiztion ws presented in [18]. Let A e weighted utomton over K, the lgorithm consists of the execution of the following steps: 1. weight pushing, 2. (unweighted) utomt minimiztion, considering ech pir (lel, weight) s single lel. Assuming tht the conditions of ppliction of weight pushing hold, the resulting weighted utomton, denoted y min(a), is miniml nd equivlent to A. The complexity of the second step is in O( E log Q ) using the Hopcroft lgorithm [12].
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 informationSpeech 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 informationSpeech 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 informationLecture 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 informationMinimal 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 informationAUTOMATA 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 informationDesigning 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 informationFormal 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 information12.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 informationModel 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 informationCompiler 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 informationChapter 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 information1. 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 informationCS415 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 informationFinite 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 informationTheory 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 informationGeneral 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 information1 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 informationTheory 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 informationConvert 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 informationRegular 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 informationAssignment 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 informationRegular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*
Regulr Expressions (RE) Regulr Expressions (RE) Empty set F A RE denotes the empty set Opertion Nottion Lnguge UNIX Empty string A RE denotes the set {} Alterntion R +r L(r ) L(r ) r r Symol Alterntion
More informationGeneral Algorithms for Testing the Ambiguity of Finite Automata and the Double-Tape Ambiguity of Finite-State Transducers
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
More informationJava 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 informationDeterministic 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 informationCoalgebra, 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 informationCMPSCI 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 informationNondeterminism 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 information3 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 information1 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 informationIntermediate 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 informationConverting 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 informationFarey 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 informationCMSC 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 information12.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 information80 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 informationLecture 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 informationCSCI 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 informationCS 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 informationTypes 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 informationAnatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute
Victor Admchik Dnny Sletor Gret Theoreticl Ides In Computer Science CS 5-25 Spring 2 Lecture 2 Mr 3, 2 Crnegie Mellon University Deterministic Finite Automt Finite Automt A mchine so simple tht you cn
More informationChapter 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 informationAutomata 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 informationMore 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 informationParse 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 informationCS 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 informationBACHELOR 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 informationTypes 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 informationFormal 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 informationLecture 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 informationCS 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 informationReview of Gaussian Quadrature method
Review of Gussin Qudrture method Nsser M. Asi Spring 006 compiled on Sundy Decemer 1, 017 t 09:1 PM 1 The prolem To find numericl vlue for the integrl of rel vlued function of rel vrile over specific rnge
More informationScanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy:
Scnner Specifying ptterns source code tokens scnner prser IR A scnner must recognize the units of syntx Some prts re esy: errors mps chrcters into tokens the sic unit of syntx x = x + y; ecomes
More informationCHAPTER 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 informationFundamentals of Computer Science
Fundmentls of Computer Science Chpter 3: NFA nd DFA equivlence Regulr expressions Henrik Björklund Umeå University Jnury 23, 2014 NFA nd DFA equivlence As we shll see, it turns out tht NFA nd DFA re equivlent,
More informationI1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3
2 The Prllel Circuit Electric Circuits: Figure 2- elow show ttery nd multiple resistors rrnged in prllel. Ech resistor receives portion of the current from the ttery sed on its resistnce. The split is
More informationFinite 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 informationFirst 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 informationOn NFA reductions. N6A 5B7, London, Ontario, CANADA ilie 2 Department of Computer Science, University of Chile
On NFA reductions Lucin Ilie 1,, Gonzlo Nvrro 2, nd Sheng Yu 1, 1 Deprtment of Computer Science, University of Western Ontrio N6A 5B7, London, Ontrio, CANADA ilie syu@csd.uwo.c 2 Deprtment of Computer
More informationNFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:
CMPU 240 Lnguge Theory nd Computtion Spring 2019 NFAs nd Regulr Expressions Lst clss: Introduced nondeterministic finite utomt with -trnsitions Tody: Prove n NFA- is no more powerful thn n NFA Introduce
More informationHomework 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 informationFinite 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 informationCS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS
CS 310 (sec 20) - Winter 2003 - Finl Exm (solutions) SOLUTIONS 1. (Logic) Use truth tles to prove the following logicl equivlences: () p q (p p) (q q) () p q (p q) (p q) () p q p q p p q q (q q) (p p)
More informationLexical Analysis Finite Automate
Lexicl Anlysis Finite Automte CMPSC 470 Lecture 04 Topics: Deterministic Finite Automt (DFA) Nondeterministic Finite Automt (NFA) Regulr Expression NFA DFA A. Finite Automt (FA) FA re grph, like trnsition
More information5. (±±) Λ = 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 informationCISC 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 informationHarvard 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 informationCS103B 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 informationNon-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 informationMyhill-Nerode Theorem
Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute
More informationThoery 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 informationNon-deterministic Finite Automata
Non-deterministic Finite Automt From Regulr Expressions to NFA- Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion
More informationFirst 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 informationNFAs continued, Closure Properties of Regular Languages
Algorithms & Models of Computtion CS/ECE 374, Fll 2017 NFAs continued, Closure Properties of Regulr Lnguges Lecture 5 Tuesdy, Septemer 12, 2017 Sriel Hr-Peled (UIUC) CS374 1 Fll 2017 1 / 31 Regulr Lnguges,
More informationLinear Inequalities. Work Sheet 1
Work Sheet 1 Liner Inequlities Rent--Hep, cr rentl compny,chrges $ 15 per week plus $ 0.0 per mile to rent one of their crs. Suppose you re limited y how much money you cn spend for the week : You cn spend
More informationState 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 informationNon-deterministic Finite Automata
Non-deterministic Finite Automt Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd T. vn Lrhoven Institute for Computing nd Informtion Sciences Intelligent
More information1. 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 informationTable 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 informationRegular Languages and Applications
Regulr Lnguges nd Applictions Yo-Su Hn Deprtment of Computer Science Yonsei University 1-1 SNU 4/14 Regulr Lnguges An old nd well-known topic in CS Kleene Theorem in 1959 FA (finite-stte utomton) constructions:
More informationp-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 informationClosure 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ɛ-closure, Kleene s Theorem,
DEGefW5wiGH2XgYMEzUKjEmtCDUsRQ4d 1 A nice pper relevnt to this course is titled The Glory of the Pst 2 NICTA Resercher, Adjunct t the Austrlin Ntionl University nd Griffith University ɛ-closure, Kleene
More informationGNFA 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 informationGrammar. 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 informationA tutorial on sequential functions
A tutoril on sequentil functions Jen-Éric Pin LIAFA, CNRS nd University Pris 7 30 Jnury 2006, CWI, Amsterdm Outline (1) Sequentil functions (2) A chrcteriztion of sequentil trnsducers (3) Miniml sequentil
More informationThe 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 informationContext-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 informationWorked out examples Finite Automata
Worked out exmples Finite Automt Exmple Design Finite Stte Automton which reds inry string nd ccepts only those tht end with. Since we re in the topic of Non Deterministic Finite Automt (NFA), we will
More informationHomework 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 informationFormal Language and Automata Theory (CS21004)
Forml Lnguge nd Automt Forml Lnguge nd Automt Theory (CS21004) Khrgpur Khrgpur Khrgpur Forml Lnguge nd Automt Tle of Contents Forml Lnguge nd Automt Khrgpur 1 2 3 Khrgpur Forml Lnguge nd Automt Forml Lnguge
More informationFoundations 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 informationRandom subgroups of a free group
Rndom sugroups of free group Frédérique Bssino LIPN - Lortoire d Informtique de Pris Nord, Université Pris 13 - CNRS Joint work with Armndo Mrtino, Cyril Nicud, Enric Ventur et Pscl Weil LIX My, 2015 Introduction
More informationFABER Formal Languages, Automata and Models of Computation
DVA337 FABER Forml Lnguges, Automt nd Models of Computtion Lecture 5 chool of Innovtion, Design nd Engineering Mälrdlen University 2015 1 Recp of lecture 4 y definition suset construction DFA NFA stte
More informationLecture 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 informationDomino Recognizability of Triangular Picture Languages
Interntionl Journl of Computer Applictions (0975 8887) Volume 57 No.5 Novemer 0 Domino Recognizility of ringulr icture Lnguges V. Devi Rjselvi Reserch Scholr Sthym University Chenni 600 9. Klyni Hed of
More informationDFA 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 informationThe 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 informationTutorial 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