Automata on Lempel-Ziv Compressed Strings

Size: px
Start display at page:

Download "Automata on Lempel-Ziv Compressed Strings"

Transcription

1 Automt on Lempel-Ziv Compressed Strings Hns Leiß 1 nd Michel de Rougemont 2 1 Universität München, CIS, D München, Germny, leiss@cis.uni-muenchen.de 2 Université Pris-II & LRI Bâtiment 490, F Orsy Cedex, Frnce, mdr@lri.fr Astrct. Using the Lempel-Ziv-78 compression lgorithm to compress string yields dictionry of sustrings, i.e. n edge-lelled tree with n order-comptile enumertion, here clled n LZ-trie. Queries out strings trnslte to queries out LZ-tries nd hence cn in principle e nswered without decompression. We compre notions of utomt ccepting LZ-tries nd consider the reltion etween cceptle nd MSOdefinle clsses of LZ-tries. It turns out tht regulr properties of strings cn e checked efficiently on compressed strings y LZ-trie utomt. 1 Introduction We re interested in the compressed model checking prolem: which properties of strings cn e checked given the compressed strings? The chllenge is to et the decompress-nd-then-check method. We restrict ourselves to the clssicl Ziv-Lempel[8] string compression lgorithm LZ-78. It compresses string w Σ + to generlly much shorter sequence LZ (w) (N Σ) +, where the numers point to previous elements of the sequence. As usul, we view string w s colored finite liner order S w = (D, <, U ) Σ, where D = {0,..., w 1} is the set of positions, ordered y < s usul, nd U (i) mens tht occurs t position i of w. Properties of strings re expressed in first-order (FO) or second-order (SO) logic of colored liner orders. In similr wy, we give two representtions of LZ-78-compressed strings α y reltionl structures, one y node-lelled LZ-grphs G α nd nother one y LZ-tries T α, which re kind of edge-lelled trees. A nturl pproch to the compressed model checking prolem is to trnslte properties of strings to properties of compressed strings.

2 In fct, mondic second-order (MSO) formuls ϕ in the lnguge of strings cn e trnslted to dydic second-order (DSO) formuls ϕ LZ in the lnguge of LZ-grphs G α. One cn therefore nswer queries ϕ out S w y evluting ϕ LZ on the smller structure G LZ (w). However, since the trnsltion doules the rity of reltion vriles, this is not gurnteed to provide n efficient solution. By Büchi s well-known theorem (cf. [4], Theorem 5.2.3), MSO for strings is eqully expressive s regulr expressions, or finite utomt, re. This rises the question whether MSO for LZ-grphs leds to notion of LZ-utomton tht provides n efficient method for checking resonly rich clss of properties of compressed strings. We study this question in the slightly more suitle formt of LZ-tries. These come with n enumertion of their nodes nd cn e viewed s simple cyclic directed grphs. We introduce notions of LZtrie utomt y modifying corresponding notions of tree-utomt. We show tht deterministic ottom-up LZ-trie-utomt re less powerful thn non-deterministic ones, nd tht the ltter cpture -MSO for LZ-tries, where -MSO is the set of MSO-formuls of the form Xψ where X re set vriles nd ψ is n FO-formul. Finlly, we show tht MSO-properties of strings cn e checked efficiently on LZ-compressed strings y deterministic top-down LZutomt. Thus, regulr expression serch in strings cn e done on the LZ-compressed strings, without decompression. 2 Lempel-Ziv-78 Compression We fix finite lphet Σ nd, to void structures with empty universe, only consider non-empty strings w Σ +. The clssicl Lempel-Ziv-78 compression lgorithm hs mny vritions (cf. [2], [3]). It decomposes string w Σ + into sequence of sustrings or locks B i Σ +, so tht w = B 0 B m 1. The first lock B 0 consists of the first letter of w. Suppose for some n > 0, we hve constructed locks B 0,..., B n 1 such tht w = B 0 B n 1 v for some v Σ +. Then B n is the shortest non-empty prefix of v tht is not mong {B 0,..., B n 1 }, if this exists 1, otherwise B n is v. The LZ-compression LZ (w) of w is the sequence p 0 p m 1 of pirs 1 nd then B n extends one of B 0,..., B n 1 y exctly one letter. 2

3 p n = (k, ) such tht B n = B k 1 (where B 1 := ɛ) nd w = B 0 B m 1. The decompression is given y B k = decode(p k ) where decode((0, )) = nd decode((n + 1, )) = decode(p n ). Exmple 1. The locks of w = re..., nd its compression is LZ (w) = (0, )(0, )(2, )(1, )(3, )(3, ). 2.1 LZ-Grphs Definition 1. A compressed string α = p 0 p m 1 s finite lelled ordered grph is represented G α := (D m, <, U, E) Σ, where m = α is the numer of locks, D m = {0,..., m 1}, < the nturl order on D m, U (i) is true iff the lst letter of lock B i is. The inry reltion E descries the reference to previous pirs: if p i = (k, ) for some Σ nd k > 0, (i.e. the k-th lock B k 1 is the longest strict prefix of B i ), then there is n edge E(i, k 1) from node i to k 1. Exmple 1 (Cont.). For w =... = B 0 B 1 B 2 B 3 B 4 B 5, the grph G LZ (w) is Oserve tht S w cn e interpreted in G LZ (w) s inry reltion: position i in w is mpped to the pir h(i) = (k, j) in LZ (w) iff i lies in lock B k nd B j is the nonempty prefix of B k ending in i. Note tht in G LZ (w), node j cn e reched from k y pth of E-edges. Exmple 2. If w =..., the positions 5,6,7 occurring in lock B 3 = re represented y (3, 0), (3, 2), (3, 3), ecuse the nonempty prefixes of B 3 re = B 0, = B 2, nd = B 3. Theorem 1 ([1]). For every MSO-formul ϕ(x 1,..., x n, X (1) ) out strings there is DSO formul ϕ LZ (x 1, y 1,..., x n, y n, X (2) ) out LZ-grphs, such tht for ech S w nd ll i 1,..., i n S w nd S S w, S w = ϕ[i, S] G LZ (w) = ϕ LZ [h(i), h(s)]. 3

4 Proof. (Sketch) In DSO, we cn define E, the reflexive trnsitive closure of E, nd then define ϕ LZ inductively using (U (x i )) LZ := U (y i ), (x i x j ) LZ := x i < x j (x i = x j y i y j ), ( x n+1 ϕ) LZ := x n+1 y n+1 (E (x n+1, y n+1 ) ϕ LZ ), ( X 1 ϕ) LZ := X 2 ( x y(x 2 (x, y) E (x, y)) ϕ LZ ). (1) For the tomic cses, note tht in ϕ LZ vrile x i stnds for lock of w nd y i for reltive position in this lock. A property L of non-empty strings is definle on strings (resp. on compressed strings or LZ-grphs), if for some formul ϕ of the pproprite lnguge, L = {w S w = ϕ} (resp. L = {w G LZ (w) = ϕ}). Remrk 1. There re properties of strings tht re F O-definle on strings, ut not on LZ-grphs, like x(u (x) U (x + 1)). There re properties of strings tht re FO-definle on LZ-grphs, ut not even MSO-definle on strings (cf. [1]). 2.2 LZ-Tries While compressing w = B 0 B n 1 v, the locks B 0,..., B n 1 found re mintined s dictionry of suwords of w nd stored s tree y shring common prefixes. The liner order of the locks in LZ (w) mounts to n enumertion of the nodes of the tree. Definition 2. A (finite) Σ-tree (T,,, 0) Σ is (finite) tree (T,, 0) with root 0, where { T T Σ} re pirwise disjoint miniml reltions such tht is the reflexive trnsitive closure of their union. A Σ-tree is Σ-trie if to ech node n T nd ech Σ there is t most one n T such tht n n. A (finite) enumerted Σ-trie T = (T,,, 0, Succ) Σ, or n LZ-trie for short, is Σ-trie (T,,, 0) Σ with successor reltion 2 Succ on T tht is comptile with the prtil order. We ssume tht T = {0, 1, 2,..., m} nd Succ(i, j) iff i + 1 = j in N. 2 i.e. miniml inry reltion Succ whose trnsitive reflexive closure Succ is totl ordering of T 4

5 Exmple 1 (Cont.). Enumerting the pirs of LZ (w) y 1,2, etc. in third component, we otin sequence (0,, 1)(0,, 2)(2,, 3) (1,, 4)(3,, 5)(3,, 6) of triples. These represent tree in which lock B k lels the pth from the root 0 to node k + 1: A tuple p n = (k, ) of LZ (w) is drwn s n edge k n + 1. We write T α for the enumerted trie representing the compressed word α. We lwys ssume tht our strings w hve distinguished end symol; then the finl lock of LZ (w) is different from the previous ones nd the tree of locks indeed is trie. Remrk 2. Wht differs in choosing G α or T α is the logicl lnguge used to tlk out LZ-compessed strings α. Bsiclly, we hve G α = E(i, j) U (i) T α = (j + 1) (i + 1). Modulo the dditionl root node in the trie, in the trie mounts to E in the grph, nd in the grph to Succ in the trie. Since E resp. Succ is - nd -MSO-definle in the lnguge of LZ - grphs resp. LZ -tries, -MSO-properties of LZ-grphs trnslte to -MSO-properties of LZ-tries nd vice vers. Using (1), quntifiers Qx nd QX out strings trnslte to ounded quntifiers Q(x, y) E nd QX E. So when trnslting to the lnguge of LZ-tries we only quntify over tuples (nd reltions of such) whose components lie on pth of T LZ (w). 3 MSO-Equivlence for LZ-Grphs For reltionl structures A, B of the sme signture, A MSO r B sys tht A nd B stisfy the sme MSO-sentences of quntifier rnk r. Two fcts out MSO for strings imply the existence of finite utomt tht cn check MSO-properties of strings (cf. [4]): 5

6 ) for ech r, there re only finitely mny MSO r -equivlence clsses for word structures S w, nd ) for compound strings w, the MSO r -clss of S w depends only on the MSO r -clsses of S w nd S. (The nlogous situttion holds for trees over Σ.) LZ-compressed words α = p 0 p m 1 re words over the infinite lphet N Σ. Cn we check MSO-properties of compressed strings y kind of finite utomton for LZ-grphs? Since we del with finite reltionl lnguge, we still hve ): Proposition 1. For ech r, the equivlence reltion MSO r LZ-grphs hs finite index. etween But wht out )? By extending winning strtegies for duplictor in the Ehrenfeucht-Frisse-gme G r (G α, G β ), we cn show: Lemm 1. (i) For LZ-compressed words α(0, ), β(0, ) over Σ, G α MSO r G β = = G α(0,) MSO r G β(0, ). (ii) For LZ-compressed words α(k + 1, ) nd β(k + 1, ) over Σ, (G α, k) MSO r (G β, k ) = = G α(k+1,) MSO r G β(k +1, ). However, in (ii) one hs to ssume tht the elements k, k pointed to from the new mximl elements shre the sme properties. Insted, one would need the stronger clim G α G β G α k G β k = = G α(k+1,) G β(k +1, ), where G α k is the restriction of G α with k s its mximl element. The equivlence clss of G α k would e the utomton stte ssigned to k. (Notice tht G α k is LZ-grph, ut (k + 1, ) is not LZcompressed word.) The prolem is tht duplictor s winning strtegies for G r (G α, G β ) nd G r (G α k, G β k ) my pick different elements to nswer spoilers plying of some element of, sy, G α k. Thus, unlike in the cse of strings or trees, for compound compressed words α(k, ) we hve component LZ-grphs G α nd G α k tht re not disjoint, nd winning strtegies in gmes for these do not comine to winning strtegies for composed LZ-grphs. From this we conclude tht we cnnot use Büchi-Myhill-Nerode construction to otin from the MSO r -clsses finite sequentil utomton for LZ-grphs, nd likewise for LZ-tries. 6

7 4 LZ-Trie-Automt If we view LZ-tries s trees with n dditionl edge Succ etween nodes, we otin directed cyclic grphs of specil kind: the successor child my e equl to some decendnt with respect to the -child-reltions. Since these re still very close to trees, it is nturl to use vrition of tree-utomt s n pproximtive notion of LZ-utomton for checking properties of LZ-tries. Definition 3. Let n G e node in grph (G, E). For m N, the sphere of rdius m round n, s m (n), is the set of nodes k G such tht there is E-pth of length m from n to k or vice vers. The hemisphere of rdius m round n, hs m (n), is the set of nodes k such tht there is n E-pth of length m from n to k. Definition 4. Let n T e node in the LZ -trie T. The ottomup LZ-hemisphere of rdius m round n, u-hs T m (n), is the restriction of T to the m-hemisphere round n in the grph (T, E), where E := { Σ} {Succ}. The top-down LZ-hemisphere of rdius m round n, td-hs T m (n), is the restriction of T to the m-hemisphere round n in the grph (T, Ĕ), where Ĕ is the converse of E. An LZ-hemisphere is n LZhemisphere of some rdius round some node in some LZ-trie T. Exmple 1 (Cont.). An LZ-trie nd the ottom-up resp. top-down 2-hemispheres of node 3 (with dshed edges for Succ resp. Pred): Definition 5. A finite ottom-up (resp. top-down) m-lz-utomton A = (Q, Σ, δ, q in, F ) consists of finite set Q of sttes, sets I, F Q of initil nd finl sttes, finite lphet Σ, finite 7

8 trnsition reltion δ consisting of pirs (P, q), written P q, where q Q nd P is ottom-up (resp. top-down) LZ-hemisphere of rdius m whose nodes except the root re lelled y elements of Q. A run of A on n LZ-trie T is function r : T Q where r(mx) I (resp. r(0) I) nd for ech n T there is some (P, q) δ such tht u-hs T m (n) (resp. td-hst m (n)), expnded y the lelling of nodes given y r, is isomorphic to P with lel q t its root. A ccepts T if there is run r of A on T such tht r(0) F (resp. r(mx) F ). Let L(A) := {T A ccepts T } e the clss of LZ-tries ccepted y A. A is deterministic if I = 1 nd q = q when (P, q), (P, q ) δ. While n m-lz-utomton A sequentilly follows the enumertion of trie T α, it cn ccess some sttes reched t suffixes (resp. prefixes) of α. Strictly speking, it does not hve finite memory. 4.1 Bottom-up LZ-Trie-Automt A 1-LZ-utomton working ottom-up the LZ-trie towrds the root hs trnsitions tht determine the stte t node from the sttes t the node s Σ-children nd successor. But it lso hs to distinguish which of the Σ-children is the successor of the node, if ny. Exmple 2. Consider the clss K of LZ-tries over Σ = {, } which hve node whose successor nd -child gree, i.e. which stisfy the sentence ϕ := x y [y = x + 1 (x y)]. We give ottom-up 1-LZ-utomton A ccepting K. We write trnsition in the form (q, q, q succ, i) p, where q, q, q succ re the sttes of the -, - nd Succ-child or, when there is no such child, nd i {1, 2, 3, } sys which of the children is equl to the successor node, if ny. Thus, (p, q, p, 1) q corresponds to the trnsition P q which cn e shown s q (n) p(n+1) q(m) 8

9 A hs finl stte q 1, which is ssigned to ll ncestors of the root of sutrie stisfying ϕ, nd n initil stte q 0, which is ssigned to ll other nodes of the input trie. Letting q, p, q rnge over {q 0, q 1 }, the trnsition tle is ) (,,, ) q 0 e) (q, p, q, 3) q ) (q,, q, 1) q 1 f) (q,, q, 3) q c) (q, p, q, 1) q 1 g) (, q, q, 3) q d) (q, p, q, 2) q h) (,, q, 3) q. Rule ) mens tht if there is no successor-node, A is in stte q 0. Rules ) nd c) sy tht if the successor-node is the -child, then A goes to q 1 s we just sw the pttern ϕ. Rules d) f) sy tht if the successor node differs from the -child, A remins in the stte of the successor node. Similr for g) nd h), when there is no -child. Theorem 2. There is property of LZ-tries tht is recognized y non-deterministic ottom-up 1-LZ-utomton ut not y ny deterministic ottom-up m-lz-utomton. Proof. (Sketch) Let Σ = {,, c} nd consider the following property ϕ of enumerted Σ-tries: There re two susequent nodes i 1 nd i such tht some node j is oth the -predecessor of i nd -ncestor of i 1. An LZ-trie stisfies ϕ iff it contins nodes linked s follows (in the trie nd in the LZ-grph, respectively), where j < i 1: i j j+1 i 2 i 1 j When finding nodes connected like i 1 nd i, ottom-up 1-LZutomton cn (non-deterministiclly) guess tht -ncestor of i 1 will e the -prent of i nd check this while proceeding. But no i 1 i (2) 9

10 deterministic ottom-up m-lz-utomton cn check the property ϕ ecuse, intuitively speking, the m-hemisphere of node j is not ig enough to see if the predecessor of its -child is one of its - descendnts. The proof detils re not quite ovious ut hve to e omitted for lck of spce. 4.2 Top-down LZ-Trie-Automt G.Nvrro [5] hs shown how to do regulr expression serch on LZ-78-compressed texts y simulting n utomton reding the originl text, eting the decompression-nd-serch pproch y fctor of 2. Actully, this simultion is deterministic top-down 1- LZ-utomton on the LZ-compressed text: Theorem 3. The LZ-compression {T LZ (w) w R} of ny regulr set R Σ + is ccepted y deterministic top-down 1-LZ-utomton. Proof. Let A = (Q, Σ, q 0, δ, F ) e deterministic finite utomton ccepting R. Define deterministic top-down 1-LZ-utomton A = (Q, Σ, δ, q in, F ) y Q := Q (Q Q), q 0 := (q 0, λq.q), F := {(q, f) q F } nd δ ccording to the following trnsitions: 0 (q 0, λq.q) (p, f) (p, f ) i i+1 (δ(f (p), ), λq.δ(f (q), )) for ech Σ (including the cse i = k). Suppose r is run of A on T LZ (w) for compressed word LZ (w) = p 0 p m 1 where p k represents lock B k of w = B 0 B m 1. By induction we see tht for ech k < m, r (k) = (δ(q 0, B 0 B k 1 ), λp.δ(p, B k 1 )). (3) For k > 0, suppose r (i) = (p, f) = (δ(q 0, B 0 B i 1 ), f) nd p i = (k, ). Then B i = B k 1, nd with r (k) = (p, f ) = (p, λp.δ(p, B k 1 )) r (i + 1) = (δ(f (p), ), λq.δ(f (q), )) = (δ(p, B k 1 ), λq.δ(q, B k 1 )) = (δ(δ(q 0, B 0 B i 1 ), B i ), λq.δ(q, B i )) = (δ(q 0, B 0 B i ), λq.δ(q, B i )). 10 k

11 Hence A ccepts {T LZ (w) w R}, ecuse w R δ(q 0, B 0 B m 1 ) F r (m) F. 4.3 Grph Acceptors nd -MSO for LZ-Tries If we consider the sttes q of n utomton A s mondic predictes on nodes of tries, the condition there is n ccepting A-run cn e expressed y n -MSO-sentence qψ in the lnguge of LZ-tries: Proposition 2. For every m-lz-utomton A there is n -MSOsentence ϕ A defining the clss of LZ-tries ccepted y A. For sentences, this improves on the trnsltion of Theorem 1: Corollry 1. Every property of strings which is definle in MSO on strings is definle in -MSO on LZ-tries. Proof. By Büchi s theorem, Theorem 3 nd Proposition 2. The converse of Corollry 1 is wrong: {... n. n. n N} is not regulr lnguge, ut hs n FO-definle clss of LZ-tries. To show the converse of Proposition 2, we use the grph cceptors for directed cyclic grphs presented y W. Thoms [7]. On grphs G = (V, E), tile δ over set Q is n m-neighourhood of node with lelling in Q, i.e. finite node-lelled grph. A grph cceptor is triple A = (Q,, Occ) where is finite set of tiles over the finite set Q nd Occ is oolen comintion of conditions χ p,δ := there re p occurences of tile δ. A run of A on G is function r : V Q such tht ech m-neighourhood of G ecomes tile δ. Then A ccepts grph G if there exists run of A on G whose tiles stisfy Occ. Note tht the existence of n ccepting run is non-constructive. The min result of [7] sys tht clss of grphs of ounded degree is definle in -MSO iff it is ccepted y grph cceptor. Theorem 4. A clss K of LZ-tries is -MSO-definle iff for some m, K is ccepted y n m-lz-utomton. Proof. Note tht ech LZ-trie T stisfies the following conditions: 11

12 (i) ech node of T hs degree Σ + 1, (ii) T is n cyclic (directed) grph with designted out-edge (the successor) for ech node, (iii) T hs node tht is rechle from ny node y pth. Using (i), y Theorem 3 of [7], K is -MSO-definle iff K is recognizle y grph cceptor. Moreover, from (i)-(iii) nd Proposition 6 of [7], it follows tht K is recognizle y grph cceptor iff it is recognizle y grph cceptor without occurrence constrints. : Suppose K is ccepted y some m-lz-utomton A. We my ssume tht finl sttes of A do not occur in the m-hemispheres P of trnsitions (P, q) of A. Consider the trnsitions of A s tiling system. Then n ccepting run of A is tiling tht uses t lest one of the tiles (P, q) where q F. Thus, K hs grph cceptor. : By the ove remrks, K is recognizle y grph cceptor without occurrence constrints. On the LZ-tries, the tiles hve root node, so we cn view ech tile s trnsition rule sying tht the utomton enters stte t the root depending on the m-sphere of the root nd the sttes t the descendnts in the sphere. Let ech stte e finl; then the utomton ccepts iff there is tiling. A grph G = (V, E) is k-colorle if there is prtitioning of the set V of nodes into t most k clsses (colors) such tht ny two djcent nodes elong to different clsses. Clerly, k-colorility cn e expressed y n -MSO sentence, nd hence hs grph cceptor. While 3-colorility on ritrry grphs is n NP-complete prolem, it is trivil on LZ-tries, ecuse the mximl node m is connected to t most two nodes: Proposition 3. Every LZ-trie is 3-colorle. Potthoff e.. [6] hve shown tht on the clss of directed cyclic grphs whose edges re uniquely lelled with ounded numer of lels, 2-colorility is not recognizle y deterministic grph cceptor, i.e. one with t most one ccepting run on ech grph. For the suclss of LZ -tries, however, it is (ctully y 4-stte deterministic ottom-up-lz-utomton): Proposition 4. On the clss of LZ-tries, 2-colorility is recognizle y deterministic grph cceptor. 12

13 4.4 Strictness of the Automt Hierrchy The ottom-up resp. top-down hierrchies of m-lz-utomt re strict, nd no level exhusts the MSO-properties of tries: Theorem 5. For every m, there is n MSO-sentence defining clss of LZ-tries tht is not ccepted y ny m-lz-utomton. Proof. For m = 1, let L = { 1 2 n 1 2 n 1 n N} {, } +. Ech w L hs LZ-lock decomposition s indicted y nd compression w n = n n 1 LZ (w n ) = (0, )(1, ) (n 1, )(0, )(1, ) (n 1, ). The corresponding tries T LZ (wn) look like n (4) n+2 n 1 2n n where the successor reltion is given y the node numers. The clss of enumerted tries in LZ (L) cn e defined y the MSO-sentence ϕ sying tht the set B of nodes tht re the root 0 or -child, hs the following properties (of which (i) is neither -MSO nor -MSO): (i) B {0} is the smllest set eing closed under -children, (ii) node is not in B iff it is n -child of node in B, (iii) for ll nodes x, y, we hve y = x + 1 iff one of the following holds: () y is the -child of x, () y is the -child of the -child y of some x whose -child is x, (c) y is the -child of 0 nd x the memer of B tht hs no -child. Clim. LZ (L) is not ccepted y 1-ottom-up-LZ-utomton. 13

14 Suppose tht A is 1-ottom-up-LZ-utomton tht ccepts the clss defined y ϕ. Let m > Q nd w = w 2m. An ccepting run of A on T LZ (w) ssigns the sme stte, sy q, to t lest two different -childs, sy nodes n+k+2 nd n+2. The stte of their predecessors is determined y rule (,, q, 3) p. Let T e like T LZ (w), except tht nodes n + 1 nd n + k + 1 re switched in the ordering. Then A will lso ccept the modified structure, s indicted y the sttes ssigned to nodes s follows: m m p(n+1) m+1 p(n+k+1) m+1 q(n+2) m+k q(n+2) m+k p(n+k+1) m+k+1 p(n+1) m+k+1 q(n+k+2) q(n+k+2) But the enumertion of -children in T does not conform to ϕ, so T T (A) \ LZ (L). For the cse m > 1, we modify the exmple s follows: long the B-prt, etween two nodes tht hve oth n -child nd -child, we dd m 1 nodes tht hve no -child, i.e. the sugrphs k k+1 n n +1 re replced y k n k+1 k+m 1 k+m n +1 The LZ-tries rising this wy re the compressions of the words w n,k = nm+k.. m. 2m.. nm. 14

15 Then {T LZ (wn,k ) n, k N, k m} is ccepted y (m + 1)-ottomup-LZ-utomton, hence MSO-definle. But it is not ccepted y ny m-ottom-up-lz-utomton: intuitively, the m-hemisphere of node k does not tell whether the pth from k following nd successor nd the pth following m end t the sme node. A similr rgument shows tht the clss defined y ϕ is lso not ccepted y ny m-top-down-lz-utomton with the sme m. 5 Conclusion We hve shown some reltions etween properties of strings, properties of their Lempel-Ziv-78-compressions, nd utomt ccepting compressed strings, ut the picture is not complete yet. For exmple: Conjecture 1. On the clss of ll LZ-tries, not every MSO-formul is equivlent to n -MSO-formul. It seems likely tht the clss of cceptle LZ-tries is not closed under complement (cf. Theorem 2). We lso elieve tht deterministic ottom-up-lz-utomt re much weker thn deterministic top-down-lz-utomt (cf. Theorem 3): Conjecture 2. There is no deterministic ottom-up m-lz-utomton tht cn check on LZ (w) whether w {, } + hs suword. References 1. Foto Afrti, Hns Leiß, nd Michel de Rougemont. Definility nd compression. In 15th Annul IEEE Symposium on Logic In Computer Science, LICS Snt Brr, CA, June 22-26, 2000, pges Computer Society Press, Timothy C. Bell, John G. Clery, nd In H. Witten. Text Compression. Prentice Hll, Englewood Cliffs, NJ, T. Cover nd J. Thoms. Elements of Informtion Theory. John Wiley, H.-D. Einghus nd J. Flum. Finite Model Theory. Springer-Verlg, Gonzlo Nvrro. Regulr expression serching on compressed text. Journl of Discrete Algorithms, 2003 (to pper). 6. Andres Potthoff, Sestin Seiert, nd Wolfgng Thoms. Nondeterminism versus determinism of finite utomt over directed cyclic grphs. Bull. Belg. Mth. Soc., 1: , Wolfgng Thoms. Automt theory on trees nd prtil orders. In eds. M. Bidoit, M. Duchet, editor, TAPSOFT 97, LNCS 1214, pges Springer Verlg, J. Ziv nd A. Lempel. Compression of individul sequences vi vrile-rte coding. IEEE Trnsctions on Informtion Theory, pges ,

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

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

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

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

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

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

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

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

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

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

Finite-State Automata: Recap

Finite-State Automata: Recap Finite-Stte Automt: Recp Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 09 August 2016 Outline 1 Introduction 2 Forml Definitions nd Nottion 3 Closure under

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

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

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

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

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

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

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

Ehrenfeucht-Fraïssé Games: Applications and Complexity. Department of Mathematics and Computer Science University of Udine, Italy ESSLLI 2010 CPH

Ehrenfeucht-Fraïssé Games: Applications and Complexity. Department of Mathematics and Computer Science University of Udine, Italy ESSLLI 2010 CPH Ehrenfeucht-Frïssé Gmes: Applictions nd Complexity Angelo Montnri Nicol Vitcolonn Deprtment of Mthemtics nd Computer Science University of Udine, Itly ESSLLI 2010 CPH Outline Introduction to EF-gmes Inexpressivity

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

Myhill-Nerode Theorem

Myhill-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 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Good-for-Games Automata versus Deterministic Automata.

Good-for-Games Automata versus Deterministic Automata. Good-for-Gmes Automt versus Deterministic Automt. Denis Kuperberg 1,2 Mich l Skrzypczk 1 1 University of Wrsw 2 IRIT/ONERA (Toulouse) Séminire MoVe 12/02/2015 LIF, Luminy Introduction Deterministic utomt

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

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

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

NFAs continued, Closure Properties of Regular Languages

NFAs 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 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

Worked out examples Finite Automata

Worked 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 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

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

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

On Determinisation of History-Deterministic Automata.

On Determinisation of History-Deterministic Automata. On Deterministion of History-Deterministic Automt. Denis Kupererg Mich l Skrzypczk University of Wrsw YR-ICALP 2014 Copenhgen Introduction Deterministic utomt re centrl tool in utomt theory: Polynomil

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

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

NFAs continued, Closure Properties of Regular Languages

NFAs continued, Closure Properties of Regular Languages lgorithms & Models of omputtion S/EE 374, Spring 209 NFs continued, losure Properties of Regulr Lnguges Lecture 5 Tuesdy, Jnury 29, 209 Regulr Lnguges, DFs, NFs Lnguges ccepted y DFs, NFs, nd regulr expressions

More information

Free groups, Lecture 2, part 1

Free groups, Lecture 2, part 1 Free groups, Lecture 2, prt 1 Olg Khrlmpovich NYC, Sep. 2 1 / 22 Theorem Every sugroup H F of free group F is free. Given finite numer of genertors of H we cn compute its sis. 2 / 22 Schreir s grph The

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

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

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

Random subgroups of a free group

Random 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 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

A negative answer to a question of Wilke on varieties of!-languages

A negative answer to a question of Wilke on varieties of!-languages A negtive nswer to question of Wilke on vrieties of!-lnguges Jen-Eric Pin () Astrct. In recent pper, Wilke sked whether the oolen comintions of!-lnguges of the form! L, for L in given +-vriety of lnguges,

More information

Non-deterministic Finite Automata

Non-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 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

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

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

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

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

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

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

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

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

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

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

Non-deterministic Finite Automata

Non-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 information

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

CS 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 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

1.3 Regular Expressions

1.3 Regular Expressions 56 1.3 Regulr xpressions These hve n importnt role in describing ptterns in serching for strings in mny pplictions (e.g. wk, grep, Perl,...) All regulr expressions of lphbet re 1.Ønd re regulr expressions,

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

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

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

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

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

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1 CS4 45- Determinisitic Finite Automt -: Genertors vs. Checkers Regulr expressions re one wy to specify forml lnguge String Genertor Genertes strings in the lnguge Deterministic Finite Automt (DFA) re nother

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

PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA

PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA RIGHT LINEAR LANGUAGES. Right Liner Grmmr: Rules of the form: A α B, A α A,B V N, α V T + Left Liner Grmmr: Rules of the form: A Bα, A α A,B V N, α V T

More information

CS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7

CS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7 CS103 Hndout 32 Fll 2016 Novemer 11, 2016 Prolem Set 7 Wht cn you do with regulr expressions? Wht re the limits of regulr lnguges? On this prolem set, you'll find out! As lwys, plese feel free to drop

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

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

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v. 1 Exercises Chpter 1 Exercise 1.1. Let Σ e n lphet. Prove wv = w + v for ll strings w nd v. Prove # (wv) = # (w)+# (v) for every symol Σ nd every string w,v Σ. Exercise 1.2. Let w 1,w 2,...,w k e k strings,

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

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

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Anatomy 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 information

Lexical Analysis Finite Automate

Lexical 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 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

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

Exercises with (Some) Solutions

Exercises with (Some) Solutions Exercises with (Some) Solutions Techer: Luc Tesei Mster of Science in Computer Science - University of Cmerino Contents 1 Strong Bisimultion nd HML 2 2 Wek Bisimultion 31 3 Complete Lttices nd Fix Points

More information

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes CSE 260-002: Exm 3-ANSWERS, Spring 20 ime: 50 minutes Nme: his exm hs 4 pges nd 0 prolems totling 00 points. his exm is closed ook nd closed notes.. Wrshll s lgorithm for trnsitive closure computtion is

More information

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution Tehnishe Universität Münhen Winter term 29/ I7 Prof. J. Esprz / J. Křetínský / M. Luttenerger. Ferur 2 Solution Automt nd Forml Lnguges Homework 2 Due 5..29. Exerise 2. Let A e the following finite utomton:

More information

Lecture 3: Equivalence Relations

Lecture 3: Equivalence Relations Mthcmp Crsh Course Instructor: Pdric Brtlett Lecture 3: Equivlence Reltions Week 1 Mthcmp 2014 In our lst three tlks of this clss, we shift the focus of our tlks from proof techniques to proof concepts

More information

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1 Chpter 1, Prt 1 Regulr Lnguges CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 1 Finite Automt A finite utomton is system for processing ny finite sequence of symols, where the symols re chosen from finite

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

378 Relations Solutions for Chapter 16. Section 16.1 Exercises. 3. Let A = {0,1,2,3,4,5}. Write out the relation R that expresses on A.

378 Relations Solutions for Chapter 16. Section 16.1 Exercises. 3. Let A = {0,1,2,3,4,5}. Write out the relation R that expresses on A. 378 Reltions 16.7 Solutions for Chpter 16 Section 16.1 Exercises 1. Let A = {0,1,2,3,4,5}. Write out the reltion R tht expresses > on A. Then illustrte it with digrm. 2 1 R = { (5,4),(5,3),(5,2),(5,1),(5,0),(4,3),(4,2),(4,1),

More information

Regular Languages and Applications

Regular 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 information

1.4 Nonregular Languages

1.4 Nonregular Languages 74 1.4 Nonregulr Lnguges The number of forml lnguges over ny lphbet (= decision/recognition problems) is uncountble On the other hnd, the number of regulr expressions (= strings) is countble Hence, ll

More information