Automata theory for XML researchers

Size: px
Start display at page:

Download "Automata theory for XML researchers"

Transcription

1 Automt theory for XML reserchers Frnk Neven University of Limurg Introduction The dvent of XML initited symiosis etween document reserch, dtses nd forml lnguges (see, e.g., the survey y Vinu [38]). This symiosis resulted, for instnce, in the development of unrnked tree utomt [3]. In rief, unrnked trees re finite leled trees where nodes cn hve n ritrry numer of children. So, there is no fixed rnk ssocited to ech lel. As the structure of XML documents cn e dequtely represented y unrnked trees, unrnked tree utomt cn serve XML reserch in four different wys: (i) s sis of schem lnguges [0, 2, 3, 8, 9] nd vlidting of schems; (ii) s n evlution mechnism for pttern lnguges [4, 32, 24]; (iii) s n lgorithmic toolox (e.g., XPth continment [6] nd typechecking [5]); nd (iv) s new prdigm: unrnked tree utomt use regulr string lnguges to del with unrnkedness. The ltter simple ut effective prdigm found ppliction in severl formlisms [4, 20, 2, 22, 27]. The present pper is n ttempt to provide gentle introduction to unrnked tree utomt nd to give references to some pplictions. We mention tht Vrdi, lredy in 989, wrote pper demonstrting the usefulness of rnked tree utomt for the sttic nlysis of dtlog progrms [37]. Dtse Principles Column. Column editor: Leonid Likin, Deprtment of Computer Science, University of Toronto, Toronto, Ontrio M5S 3H5, Cnd. E-mil: likin@cs.toronto.edu. 2 Trees Every XML document cn e represented y tree. See, for instnce, Figure. In this view, inner nodes correspond to elements which determine the structure of the document, while the lef nodes nd the ttriutes provide the content. Sometimes, for instnce in the cse of typechecking, we re only interested in the structure of documents, not in the ctul vlues of the ttriutes or the lef nodes. In such cses, we cn dequtely represent XML documents s trees over finite lphet. Agin, this is restriction s the lphet is only known when some schem informtion is ville (such s DTD for instnce). For now, however, we fix finite lphet Σ nd come ck to the finite lphet restriction in Section 5. We next provide the definitions for our strction of XML documents: Σ-trees. The set of Σ-trees, denoted y T Σ, is inductively defined s follows: (i) every σ Σ is Σ-tree; (ii) if σ Σ nd t,...,t n σ(t,...,t n ) is Σ-tree. T Σ, n then Note tht there is no priori ound on the numer of children of node in Σ-tree; such trees re therefore unrnked. Denote y N, the set of strings over the lphet consisting of the nturl numers. For every tree t T Σ, the set of nodes of t, denoted y Dom(t), is the suset of N defined s follows: if t = σ(t t n ) with σ Σ, n 0, nd t,...,t n T Σ, then Dom(t) = {ε} {ui i {,...,n},u Dom(t i )}. Thus, ε represents the root while ui represents the i-th child of u. For instnce, the domin of the ottom tree in Figure is grphiclly represented s follows:

2 ε By l t (u) we denote the lel of u in t. In the following, when we sy tree we lwys men Σ-tree. 4 3 Unrnked Tree Automt 3. Automt on strings Before we define tree utomt, let us recll nondeterministic finite utomt on strings (NFAs). In our definition we hve initil sttes for every σ- symol. In this wy, we cn define run of the utomton tht strts on the first symol nd ends on the lst one. In prticulr, n NFA is tuple M =(Q, Σ,δ,(I σ ) σ Σ,F) where Q is the set of sttes; for every σ Σ, I σ Q is the set of initil sttes for σ; F Q is the sets of finl sttes; nd, δ : Q Σ 2 Q is the trnsition function. A run λ : {,...,n} Qon string n Σ is function such tht (i) λ() I ; (ii) for ll i {2,...,n}, λ(i) δ(λ(i ), i ). A run is ccepting if λ(n) F. A string is ccepted if there is n ccepting run for it. Exmple 3.. Consider the utomton M ccepting ll the strings over {, } tht strt nd end with the sme symol. Set Q := {q,q }, I := {q }, I := {q }, F := Q, δ(q,):=δ(q,)={q }, nd δ(q,):=δ(q,)={q }. This utomton hs only one run on every string: for instnce, on the string, we hve the run λ q q q q Usully, we view NFAs s processing input strings from left to right: n initil stte is ssigned to the first position nd from there on we ssign new sttes tht re consistent with the trnsition function. The string is ccepted if we cn ssign finl stte to the lst position. Note, however, tht we cn lso view M s right-to-left utomton y simply reversing the roles of F nd I. Indeed, we ssign finl stte to the lst position nd ssign new sttes strting from tht position to the left tht re consistent with the trnsition function. The string is ccepted if we cn ssign n initil stte from the correct set to the first position. Although processing strings from right to left might seem it strnge, for trees processing in ottom-up wy is eqully sensile s processing in top-down mnner. 3.2 Automt on inry trees For ese of exposition we ssume for this section tht ll trees re inry. Tht is, ll non-lef nodes hve exctly two children. A tree utomton is then tuple A =(Q, Σ,δ,(I σ ) σ Σ,F) where Q, F, nd ll I σ s re s efore, nd δ : Q Q Σ Q is function mpping pir of sttes nd symol to new stte. A run for t is mpping λ : Dom(t) Q such tht (i) for every lef node u, λ(u) I l t (u) ; (ii) for ll inner nodes u, λ(u) δ(λ(u),λ(u2), l t (u)). Recll tht ui is the i-th child of u. A run is ccepting if λ(ε) F. A tree is ccepted if there is n ccepting run for it. Tree utomt cn e viewed s processing their input in ottom-up or in top-down fshion depending on the roles of F nd I σ. Indeed, in the ottom-up view, initil sttes from the I σ s re ssigned to σ-leled leves nd new sttes re ssigned to inner nodes depending on their lel nd on the sttes t their children. The tree is ccepted if finl stte is ssigned to the root. In the top-down view, finl stte from F is ssigned to the root; new sttes re ssigned to the children of node u depending on the lel of u nd the stte of u. A tree is ccepted if every σ-leled lef is ssigned stte from I σ. 2

3 <muppet cretor="henson"> <nme> Kermit </nme> <niml> Frog </niml> <friends> <nme> Ms. Piggy </nme> </friends> </muppet> cretor Henson muppet muppet nme niml Kermit Frog friends nme Ms. Piggy cretor nme niml friends nme Figure : A smple XML document, its tree representtion, nd its structurl representtion. Exmple 3.2. Consider the lphet Σ = {,, 0, }. Suppose for ese of exposition tht trees re lwys s follows: 0 nd only pper t leves, nd nd cn pper everywhere except t leves. These re ll tree-shped oolen circuits. We next define n utomton ccepting exctly the circuits evluting to. Define A =(Q, Σ,δ,F) with Q = {0, }, I 0 = {0}, I = {},F = {}, nd δ(0, 0, ) =0 δ(0,, ) =0; δ(, 0, ) =0 δ(,, ) =; δ(0, 0, ) =0 δ(0,, ) =; δ(, 0, ) = δ(,, ) =. Intuitively, A works s follows: A ssigns 0 () to 0-leled (-leled) leves; further, A ssigns to -leled node iff oth its children re ; nd, A ssigns 0 to -leled node iff oth its children re 0. Finlly, A ccepts when the root is leled with. So, in this exmple, the ottom-up view is the most intuitive one. In Figure 2, we give n exmple of n ccepting run on tree. In Exmple 3.4, we give n utomton evluting n XPth expression for which the top-down view is more nturl. 3.3 Automt on unrnked trees Extending the tree utomt of the previous section to unrnked trees implies tht we should define the trnsition functions for ny numer of children: δ : n=0 Qn Σ 2 Q. To chieve the ltter, 0 0 Figure 2: A tree nd n ccepting run of the utomton of Exmple 3.2. Brüggemnn-Klein, Murt, nd Wood [3], sed on the work of Pir nd Quere [30] nd Tkhshi [36], use regulr string lnguges over Q to represent trnsitions. Tht is, the trnsition function δ is mpping δ : Q Σ 2 Q such tht δ(q, ) is regulr string lnguge over Q. Definition 3.3. A nondeterministic tree utomton (NTA) is tuple B =(Q, Σ, δ, F), where Q is finite set of sttes, F Q is the set of finl sttes, nd δ is function Q Σ 2 Q such tht δ(q, ) is regulr string lnguge over Q for every Σ nd q Q. A run of B on tree t is leling λ : Dom(t) Q such tht for every v Dom(t) with n children, λ(v) λ(vn) δ(λ(v), l t (v)). Note tht when v hs no children, then the criterion reduces to ε δ(λ(v), l t (v)). So, we do not need n explicit definition of the I σ s nymore. A run is ccepting iff the root is leled with finl stte, tht is, λ(ε) F. A tree is ccepted if there is n ccepting run for it. The set of ll ccepted trees is denoted y L(B). 3

4 We illustrte the ove definition with two exmples. In the first exmple we represent the trnsition functions y regulr expressions. In the second exmple we use logicl formuls. Exmple 3.4. () We continue Exmple 3.2. Inner nodes cn now hve n ritrry numer of children. Agin, we define n utomton ccepting exctly the circuits evluting to. Define B =(Q, Σ, δ, F) with Q = {0, }, F = {}, nd δ(0, 0) := δ(, ) := {ε}; δ(0, ) := δ(, 0) := ; δ(0, ) := (0+) 0(0 + ) ; δ(, ) := ; δ(0, ) := 0 ; δ(, ) := (0+) (0 + ). Intuitively, B works s follows: B ssigns 0 () to 0-leled (-leled) leves; B ssigns to - leled node iff ll its children re ; B ssigns 0 to -leled node iff ll its children re 0. Finlly, B ccepts when the root is leled with. In Figure 3, we give n exmple of tree nd n ccepting run. (2) Let p e the XPth expression ///[/]//. We construct n utomton ccepting precisely the trees mtching p. The set of sttes Q consists of ll the suptterns of p nd F = {///[/]//}. The trnsition function is defined in Figure 4. We use logicl formuls to denote regulr lnguges. For ll sttes q,...,q n Q the formul n i= q i denotes the set of strings contining ll the sttes q i (nd possily some others). If ϕ nd ϕ 2 re formuls, then ϕ ϕ 2 denotes the union of the set of strings defined y ϕ nd ϕ 2 ; true denotes the set of ll strings over Q. Clerly, these formuls cn only define regulr lnguges. Trnsitions tht re not mentioned re empty. The most intuitive wy to interpret the utomton is to red the rules in top-down wy. The utomton strts t the root in stte ///[/]//. A run strted s such cn only e vlid if the root is leled with nd one of the children mtches //[/]//. Further, -leled node cn only e in stte //[/]// if () it hs child tht mtches //[/]//; (2) there re two children mtching / nd //, respectively; or, (3) there is one child mtching ///. An-leled node cn only e in stte //[/]// if one of its children mtch the pttern //[/]//. The remining rules re selfexplntory. We give n exmple in Figure Reltionship with rnked utomt Unrnked trees cn e encoded into inry ones in severl wys. In Figure 6 we illustrte one such possiility. Intuitively, the first child of node remins the first child of tht node in the encoding. But it is explicitly encoded s left child. The other children re right descendnts of the first child in the encoding. Whenever there is right child ut no left child, # is inserted. Also, when there is only left child, # is inserted for the right child. By using the encodings enc nd dec of Figure 6 one otins the following proposition. Proposition 3.5. [34] For every unrnked NTA B there is tree utomton A over inry trees such tht L(A) = {enc(t) t L(B)}. For every tree utomton A over inry trees there is n unrnked NTA B such tht L(B) = {dec(t) t L(A)}. Although Proposition 3.5 provides tool for trnsferring results from rnked to unrnked trees, it does not del with issues which re specific for unrnked tree utomt. The complexity of decision prolems for NTAs, for instnce, depends on the formlism used to represent the regulr string lnguges δ(q, ) in the trnsition function. As there re mny wys to represent regulr string lnguges (logicl formuls, utomt with vrious forms of control, grmmrs, regulr expressions,... ), Proposition 3.5 does not offer immedite help. Let NTA(M) denotes the set of NTAs where the regulr lnguges δ(q, ) re represented y elements in the clss M (for instnce, the clss of NFAs). A closer inspection of enc nd dec revels tht the trnsltion etween inry nd unrnked tree utomt is polynomil for NTA(NFA) s. For this reson, the ltter clss cn e seen s the defult for unrnked tree utomt. Also the complexity of the memership prolem for this clss is trctle. 4

5 Figure 3: A tree nd n ccepting run of the utomton of Exmple 3.4(). δ(///[/]//,) := //[/]// δ(//[/]//,) := //[/]// (/ //) /// δ(//[/]//,) := //[/]// δ(///,) := // δ(//,) := true δ(//,) := // δ(/,) := true Figure 4: The utomton of Exmple 3.4(2) ccepting ///[//]//. ///[/]// //[/]// // //[/]// // / // Figure 5: A tree nd n ccepting run of the utomton of Exmple 3.4(2). enc dec # # # # # Figure 6: An unrnked tree nd its inry encoding. 5

6 Proposition 3.6. Let t T Σ nd B NTA(NFA). Testing whether t L(B) cn e done in time O( t B 2 ). However, when using tree utomt to otin upper ounds on the complexity of prolems relted to XML, one sometimes needs to turn to more expressive formlisms. In [5], n upper ound on the complexity of the typechecking prolem for structurl recursion is otined y reduction to the emptiness prolem of NTA(2AFA) s. Here, 2AFA re two-wy lternting string utomt. 3.5 Schems Like extended context-free grmmrs form strctions of DTDs, unrnked tree utomt re n strction of the vrious XML schem proposls. Definition 3.7. A DTD is tuple (d, s d ) where d is function tht mps Σ-symols to regulr expressions over Σ nd s d Σ is the strt symol. Exmple 3.8. As n exmple consider the following DTD (tken from [35]) descriing ctlog of products d(ctlog) := product d(product) := nme? (mfr-price + sle-price) color Here, w? denotes w + ε. The equivlent unrnked tree utomton is defined next: B = (Q, Σ, δ, F) with Q := {ctlog, product, nme, mfr-price, sle-price, color}, F := {ctlog}, for ll {nme, mfr-price, sle-price, color}, δ(, ) ={ε}, nd δ(ctlog, ctlog) := product δ(product, product) := nme? (mfr-price + sle-price) color The δ(q, ) tht re not mentioned re empty. It is not so hrd to see tht for every DTD there is n equivlent unrnked tree utomton. Moreover, the unrnked tree utomt re equivlent to the specilized DTDs of Ppkonstntinou nd Vinu[3] nd the XDuce types of Hosoy nd Pierce [0]. Lee, Mni, nd Murt provide provide comprison of XML schem lnguges sed on forml lnguge theory [3]. 4 Relted work We riefly discuss numer of pplictions of unrnked tree utomt or relted formlisms. We refer the interested reder to [26] for more detiled overview of pttern lnguges sed on tree utomt. Severl reserchers defined pttern lnguges for unrnked trees tht cn e implemented y unrnked tree utomt: Neumnn nd Seidl develop µ-clculus for expressing structurl nd contextul conditions on forests [2]. They show tht their formlism cn e implemented y push-down forest utomt. The ltter re specil cses of unrnked tree utomt. Murt defines n extension of pth expressions sed on regulr expressions over unrnked trees [20]. Brüggemnn-Klein nd Wood consider cterpillr expressions [4]. These re regulr expressions tht in ddition to lels cn specify movement through the tree. Neven nd Schwentick define gurded frgment ETL of mondic second-order logic (MSO) whose comined complexity is much more trctle thn tht of generl MSO [32, 24]. Expressiveness nd complexity results on ETL re prtly otined vi techniques sed on unrnked tree utomt. Neven nd Schwentick define query utomt [27]. These re two-wy deterministic unrnked tree utomt tht cn select nodes in the tree. Query utomt correspond exctly to the unry queries definle in mondic second-order logic. By result of Gottlo nd Koch they lso correspond to the unry queries definle in mondic dtlog [9]. In [22], n extension of the Boolen ttriute grmmrs considered in [29] to unrnked trees is defined. These lso express precisely the unry queries in MSO. A trnsltion of the region lger, considered y Consens nd Milo [5], into these ttriute grmmrs drsticlly improves the complexity of the optimiztion prolems of the former. A forest is conctention of unrnked trees. 6

7 5 Discussion We reclled the definition of unrnked tree utomt nd provided some exmples of pplictions in the context of XML. In ddition to tree utomt, some other formlisms regined ttention in the re of dtses: Tree-wlking. The tree-wlking prdigm dtes ck from the erly reserch on compilers nd ttriute grmmrs [, 6]. Tree-wlking utomt re still considered in forml lnguge theory s the connection with tree utomt is still unknown [7, 8, 25]. In the context of XML, the tree-wlking prdigm ttrcted ttention s n strction of XML query lnguges [2, 7, 23] nd streming [33]. Infinite lphets. The frmework considered in this pper is limited in two wys. It ssumes tht the element nmes of XML documents re from finite nd known set nd it ignores the dt vlues in the lef nodes nd ttriutes of XML documents. For this reson, the work of Kminski nd Frncez [] on utomt on infinite lphets hs een reexmined from n XML perspective [28, 23]. We mention tht Miklu nd Suciu otined trnsltion of XPth expressions to rnked tree utomt through n involved simultion [6]. The trnsltion shows how the different XPth lnguge constructs prmeterize the complexity of the XPth continment prolem. Although direct trnsltion of tht XPth frgment to unrnked utomt is immedite, it is not cler t the moment whether there is n esy trnsltion to unrnked tree utomt which gives the sme prmeterized results for continment. The min prolem is the filter predicte s ech predicte introduces conjunction. Acknowledgment The uthor thnks Dn Suciu, Leonid Likin, Jn Vn den Bussche, Wim Mrtens, nd Stijn Vnsummeren for comments on n erlier version of this pper. References [] A. V. Aho nd J. D. Ullmn. Trnsltions on contextfree grmmr. Inform. nd Control, 9: , 97. [2] G. J. Bex, S. Mneth, nd F. Neven. A forml model for n expressive frgment of XSLT. Informtion Systems, 27():2 39, [3] A. Brüggemnn-Klein, M. Murt, nd D. Wood. Regulr tree nd regulr hedge lnguges over unrnked lphets: Version, pril 3, 200. Technicl Report HKUST- TCSC-200-0, The Hongkong University of Science nd Technology, 200. [4] A. Brüggemnn-Klein nd D. Wood. Cterpillrs: A context specifiction technique. Mrkup Lnguges, 2():8 06, [5] M. Consens nd T. Milo. Algers for querying text regions: Expressive power nd optimiztion. Journl of Computer nd System Sciences, 3: , 998. [6] P. Dernsrt, M. Jourdn, nd B. Lorho. Attriute Grmmrs: Definition, Systems nd Biliogrphy, volume 323 of Lecture Notes in Computer Science. Springer, 988. [7] J. Engelfriet nd H. J. Hoogeoom. Tree-wlking pele utomt. In J. Krhumki, H. Murer, G. Pun, nd G.Rozenerg, editors, Jewels re forever, contriutions to Theoreticl Computer Science in honor of Arto Slom, pges Springer-Verlg, 999. [8] J. Engelfriet, H.J. Hoogeoom, nd J.-P. vn Best. Trips on trees. Act Cyernetic, 4:5 64, 999. [9] G. Gottlo nd C. Koch. Mondic dtlog nd the expresive power of lnguges for we informtion extrction. In Proc. 2th Symposium on Principles of Dtse Systems (PODS 2002), pges ACM Press, [0] H. Hosoy nd B. C. Pierce. Regulr expression pttern mtching for XML. In Proceedings of 28th Symposium on Principles of Progrmming Lnguges (POPL 200), pges ACM Press, 200. [] M. Kminski nd N. Frncez. Finite-memory utomt. Theoreticl Computer Science, 34(2): , 994. [2] N. Klrlund, A. Moller, nd M. I. Schwrtzch. The DSD schem lnguge. In Proceedings of the 3th ACM SIGSOFT Workshop on Forml Methods in Softwre Prctice (FMSP 2000), [3] D. Lee, M. Mni, nd M. Murt. Resoning out XML schem lnguges using forml lnguge theor. Technicl report, IBM Almden Reserch Center, Log# [4] S. Mneth nd F. Neven. Structured document trnsformtions sed on XSL. In R. Connor nd A. Mendelzon, editors, Reserch Issues in Structured nd Semistructured Dtse Progrmming (DBPL 99), volume 949 of Lecture Notes in Computer Science, pges Springer,

8 [5] W. Mrtens nd F. Neven. Typechecking of top-down uniform unrnked tree trnsducers. Mnuscript. [6] G. Miklu nd D. Suciu. Continment nd equivlence for n XPth frgment. In Proc. 2th Symposium on Principles of Dtse Systems (PODS 2002), pges 65 76, [7] T. Milo, D. Suciu, nd V. Vinu. Type checking for XML trnsformers. In Proceedings of the Nineteenth ACM Symposium on Principles of Dtse Systems, pges 22. ACM Press, [8] M. Murt. Relx. [9] M. Murt. Dt model for document trnsformtion nd ssemly. In E. V. Munson, K. Nichols, nd D. Wood, editors, Proceedings of the workshop on Principles of Digitl Document Processing, volume 48 of Lecture Notes in Computer Science, pges 40 52, 998. [20] M. Murt. Extended pth expressions for xml. In Proc. 20th Symposium on Principles of Dtse Systems (PODS 200), pges ACM Press, 200. [2] A. Neumnn nd H. Seidl. Locting mtches of tree ptterns in forests. In V. Arvind nd R. Rmnujm, editors, Foundtions of Softwre Technology nd Theoreticl Computer Science, Lecture Notes in Computer Science, pges Springer, 998. [22] F. Neven. Extensions of ttriute grmmrs for structured document queries. In R. Connor nd A. Mendelzon, editors, Reserch Issues in Structured nd Semistructured Dtse Progrmming (DBPL 99), volume 949 of Lecture Notes in Computer Science, pges Springer, [23] F. Neven. On the power of wlking for querying treestructured dt. In Proc. 2th Symposium on Principles of Dtse Systems (PODS 2002), pges ACM Press, [24] F. Neven nd T. Schwentick. Expressive nd efficient pttern lnguges for tree-structured dt. In Proc. 9th Symposium on Principles of Dtse Systems (PODS 2000), pges 45 56, [25] F. Neven nd T. Schwentick. On the power of treewlking utomt. In U. Montnri, J. D. P. Rolim, nd E. Welzl, editors, Interntionl Colloquium on Automt, Lnguges nd Progrmming (ICALP 2000), volume 853 of Lecture Notes in Computer Science, pges Springer, [26] F. Neven nd T. Schwentick. Automt- nd logic-sed pttern lnguges for tree-structured dt. Unpulished, 200. [27] F. Neven nd T. Schwentick. Query utomt on finite trees. Theoreticl Computer Science, 275: , [28] F. Neven, T. Schwentick, nd V. Vinu. Towrds regulr lnguges over infinite lphets. In J. Sgll, A. Pultr, nd P. Kolmn, editors, Mthemticl Foundtions of Computer Science (MFCS 200), volume 236 of Lecture Notes in Computer Science, pges Springer, 200. [29] F. Neven nd J. Vn den Bussche. Expressiveness of structured document query lnguges sed on ttriute grmmrs. Journl of the ACM, 49(), [30] C. Pir nd A. Quere. Définition et etude des ilngges réguliers. Informtion nd Control, 3(6): , 968. [3] Y. Ppkonstntinou nd V. Vinu. DTD inference for views of XML dt. In Proc. 20th Symposium on Principles of Dtse Systems (PODS 200), pges ACM Press, 200. [32] T. Schwentick. On diving in trees. In Proceedings of 25th Mthemticl Foundtions of Computer Science (MFCS 2000), pges , [33] L. Segoufin nd V. Vinu. Vlidting streming XML documents. In Proc. 2th Symposium on Principles of Dtse Systems (PODS 2002), pges ACM Press, [34] D. Suciu. Typechecking for semistructured dt. In Proceedings of the 8th Workshop on Dt Bses nd Progrmming Lnguges (DBPL 200), 200. [35] D. Suciu. The XML typechecking prolem. SIGMOD Record, 3():89 96, [36] M. Tkhshi. Generliztions of regulr sets nd their ppliction to study of context-free lnguges. Informtion nd Control, 27(): 36, 975. [37] M. Y. Vrdi. Automt theory for dtse theoreticins. In Proceedings of the Eighth ACM Symposium on Principles of Dtse Systems, pges ACM Press, 989. [38] V. Vinu. A we odyssey: From Codd to XML. In Proc. 20th Symposium on Principles of Dtse Systems (PODS 200), pges 5,

Foundations of XML Types: Tree Automata

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

More information

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

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

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

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

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

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

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

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

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

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

Designing finite automata II

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

More information

Formal Languages 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

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

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

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

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

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

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

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

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

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

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

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh Finite Automt Informtics 2A: Lecture 3 Mry Cryn School of Informtics University of Edinburgh mcryn@inf.ed.c.uk 21 September 2018 1 / 30 Lnguges nd Automt Wht is lnguge? Finite utomt: recp Some forml definitions

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

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

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

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

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

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

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

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

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

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

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

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

Formal Language and Automata Theory (CS21004)

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

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

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

More information

CS 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

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

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

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont. NFA DFA Exmple 3 CMSC 330: Orgniztion of Progrmming Lnguges NFA {B,D,E {A,E {C,D {E Finite Automt, con't. R = { {A,E, {B,D,E, {C,D, {E 2 Equivlence of DFAs nd NFAs Any string from {A to either {D or {CD

More information

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

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

Fundamentals of Computer Science

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

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

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

More information

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!) CMSC 330: Orgniztion of Progrmming Lnguges DFAs, nd NFAs, nd Regexps (Oh my!) CMSC330 Spring 2018 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All

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

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

Let's start with an example:

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

More information

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

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

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 9 1. (4pts) ((p q) (q r)) (p r), prove tutology using truth tles. p

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

CS 330 Formal Methods and Models

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

More information

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

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

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

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

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

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

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

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

In-depth introduction to main models, concepts of theory of computation:

In-depth introduction to main models, concepts of theory of computation: CMPSCI601: Introduction Lecture 1 In-depth introduction to min models, concepts of theory of computtion: Computility: wht cn e computed in principle Logic: how cn we express our requirements Complexity:

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

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

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

Validating Streaming XML Documents

Validating Streaming XML Documents Vlidting Streming XML Documents Luc Segoun INRIA-Rocquencourt LucSegoun@inrifr Victor Vinu UC Sn Diego vinu@csucsdedu ABSTRACT This pper investigtes the on-line vlidtion of streming XML documents with

More information

input tape head moves current state

input tape head moves current state CPS 140 - Mthemticl Foundtions of CS Dr. Susn Rodger Section: Finite Automt (Ch. 2) (lecture notes) Things to do in clss tody (Jn. 13, 2004): ffl questions on homework 1 ffl finish chpter 1 ffl Red Chpter

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 267: Automated Verification. Lecture 8: Automata Theoretic Model Checking. Instructor: Tevfik Bultan

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

More information

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010 CS 311 Homework 3 due 16:30, Thursdy, 14 th Octoer 2010 Homework must e sumitted on pper, in clss. Question 1. [15 pts.; 5 pts. ech] Drw stte digrms for NFAs recognizing the following lnguges:. L = {w

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

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

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

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

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 Part III

Lexical Analysis Part III Lexicl Anlysis Prt III Chpter 3: Finite Automt Slides dpted from : Roert vn Engelen, Florid Stte University Alex Aiken, Stnford University Design of Lexicl Anlyzer Genertor Trnslte regulr expressions to

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

Streamed Validation of XML Documents

Streamed Validation of XML Documents Preliminries DTD Document Type Definition References Jnury 29, 2009 Preliminries DTD Document Type Definition References Structure Preliminries Unrnked Trees Recognizble Lnguges DTD Document Type Definition

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

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

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

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

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

FABER Formal Languages, Automata and Models of Computation

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

SWEN 224 Formal Foundations of Programming WITH ANSWERS

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

More information

CS375: Logic and Theory of Computing

CS375: Logic and Theory of Computing CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tle of Contents: Week 1: Preliminries (set lger, reltions, functions) (red Chpters 1-4) Weeks

More information

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3

I1 = 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 information

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model? CS125 Lecture 11 Fll 2016 11.1 Finite Automt Motivtion: TMs without tpe: mybe we cn t lest fully understnd such simple model? Algorithms (e.g. string mtching) Computing with very limited memory Forml verifiction

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

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

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

More information

TREE AUTOMATA AND TREE GRAMMARS

TREE AUTOMATA AND TREE GRAMMARS TREE AUTOMATA AND TREE GRAMMARS rxiv:1510.02036v1 [cs.fl] 7 Oct 2015 by Joost Engelfriet DAIMI FN-10 April 1975 Institute of Mthemtics, University of Arhus DEPARTMENT OF COMPUTER SCIENCE Ny Munkegde, 8000

More information

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA Nondeterminism Nondeterministic Finite Automt Nondeterminism Subset Construction A nondeterministic finite utomton hs the bility to be in severl sttes t once. Trnsitions from stte on n input symbol cn

More information

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30 Tlen en Automten Test 1, Mon 7 th Dec, 2015 15h45 17h30 This test consists of four exercises over 5 pges. Explin your pproch, nd write your nswer to ech exercise on seprte pge. You cn score mximum of 100

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

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

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

More information

Scanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy:

Scanner. 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 information

Learning Moore Machines from Input-Output Traces

Learning Moore Machines from Input-Output Traces Lerning Moore Mchines from Input-Output Trces Georgios Gintmidis 1 nd Stvros Tripkis 1,2 1 Alto University, Finlnd 2 UC Berkeley, USA Motivtion: lerning models from blck boxes Inputs? Lerner Forml Model

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

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