Model Reduction of Finite State Machines by Contraction

Size: px
Start display at page:

Download "Model Reduction of Finite State Machines by Contraction"

Transcription

1 Model Reduction of Finite Stte Mchines y Contrction Alessndro Giu Dip. di Ingegneri Elettric ed Elettronic, Università di Cgliri, Pizz d Armi, Cgliri, Itly Phone: Fx: Emil: giu@diee.unic.it Astrct The pper discusses n pproch to the model reduction of discrete event systems represented y finite stte mchines. A set of good reduced order pproximtions of deterministic finite stte mchine M cn e efficiently computed y looking t its contrctions, i.e., finite stte mchines constructed from M y merging two sttes. In some prticulr cse, it is lso possile to prove tht the pproximtions thus constructed re infiml, in the sense tht there do not exist etter pproximtions with the sme numer of sttes. The pper lso defines merit function to choose, mong set of pproximtions, the est one with respect to given oserved ehvior. Pulished s: A. Giu, Model Reduction of Finite Stte Mchines y Contrctions, IEEE Trns. on Automtic Control, Vol. 46, No. 5, pp , My

2 1 Introduction Model reduction techniques hve een used in control theory to pproximte high order systems with simpler ones tht still cpture the ehvior of the originl complex systems. In this pper we consider the sme prolem in the frmework of discrete event systems [7]. In prticulr, discrete event system will e modeled y finite stte mchine (FSM) nd its ehvior will e given y the lnguge generted. A reduced order pproximtion of miniml deterministic FSM M with n sttes is deterministic FSM M with n < n sttes such tht L(M ) L(M). Let M e n pproximtion of order n of M; we sy tht M is infiml if there does not exist nother pproximtion M of order n n such tht L(M ) L(M ) L(M). Computing infiml pproximtions is complex tsk. The pper shows how set of good ut possily not infiml pproximtions of given miniml deterministic FSM M cn e computed efficiently y looking t contrctions of M, i.e., FSMs constructed from M y merging 2 sttes. In some prticulr cse, it cn lso e proven tht ll pproximtions in the set thus constructed re infiml. The pper lso discusses how, given set of pproximtions of FMS M, it is possile to define merit function to choose the est pproximtion with respect to given oserved ehvior L o L(M). The two requirements of hving smll order model nd tight lnguge pproximtion re conflicting. The procedure presented in this pper cn e recursively pplied, strting with given FSM nd computing contrctions until stisfctory trde-off etween order of the model nd degree of lnguge pproximtion is reched. The proposed pproch is prticulrly useful in the cse of systems composed of interconnected susystems. It is well know tht composing the FMS modules tht descrie the different susystems e.g., using the concurrent composition opertor [7] the numer of sttes of the resulting overll model grows exponentilly. The reduction of even few sttes in ech FMS module my led to significnt simplifiction of the resulting overll model. The pper is structured s follows. In Section II the nottion used is presented. In Section III contrctions re defined nd their properties re studied. In Section IV n efficient lgorithm for computing set of good reduced order pproximtions y contrction is presented. In Section V quntittive mesure to choose the est mong set of reduced order pproximtions is given. 2 Bckground A finite stte mchine [3, 4] is 5-tuple M = (Q, Σ, δ, q 0, F ), where: Q is finite stte set, Σ is finite lphet of symols, δ : Q Σ 2 Q is the trnsition reltion, q 0 Q is the initil stte, F Q is set of finl sttes. The trnsition reltion δ is usully extended to pply to 2

3 stte nd string, rther thn stte nd symol. Let w = 1 2 r Σ nd q δ(q, w). Then the following is legl move of M: m(q, w) = q[ 1 q 1 [ 2 q r 1 [ r q = q[w q nd we define m Q (q, w) = {q 1,, q r 1 }. A finite stte mchine is sid to e deterministic (DFSM) if the trnsition reltion is such tht δ(q, ) is singleton set or is not defined. The lnguge generted y FSM M is the set of ll strings w generted with move tht strts from the initil stte nd reches finl stte, i.e., L(M) = {w Σ δ(q 0, w) F }. Note tht the ove definitions re slightly different from clssic definitions of utomt ut re consistent with the modern discrete event systems terminology. As n exmple, in the clssic definition of deterministic utomt it is required tht δ(q, ) e defined for ll q Q nd for ll Σ. Note lso tht in the discrete event system pproch [7] there re usully two different notions of lnguges. The mrked ehvior is identicl to the lnguge L(M) defined ove. The closed ehvior is defined s the set of strings generted with move tht strts from the initil stte nd reches ny stte of M. Without ny loss of generlity, the pper will only consider mrked lnguges, since ny closed lnguge cn e considered s mrked lnguge if one lets the set of finl sttes F e identicl to the set of ll sttes Q. A DFSM M = (Q, Σ, δ, q 0, F ) with n sttes is sid to e miniml [5, 6] if there does not exist DFSM M = (Q, Σ, δ, q 0, F ) with n < n sttes such tht L(M ) = L(M). Note tht in the clssic definition of miniml FSM there is lwys dump stte tht cn e reched y ll strings tht cnnot e continued into string in L(M). Since we do not require tht δ(q, ) e defined for ll q Q nd for ll Σ, miniml DFSM ccording to our definition will e rechle (i.e., there is pth from q 0 to ny other stte) nd corechle (i.e., there is pth from ny stte q to stte in F ). Let M e miniml DFSM with n sttes. It is not possile to find DFSM M with n < n sttes tht genertes L(M). However, we cn look for n M with n < n sttes tht genertes L(M ) L(M) s wy to pproximte M. Definition 1. Let M = (Q, Σ, δ, q 0, F ) e miniml DFSM with n sttes. A lnguge L Σ is n pproximtion of L(M) if L L(M). An pproximtion L is order n implementle if there exists miniml DFSM M with n < n sttes such tht L = L(M ). We lso sy tht M implements L nd tht it is n pproximtion of order n of M. An order n implementle pproximtion L of L(M) is infiml if there does not exist nother DFSM M with n n sttes such tht L L(M ) L(M). If M implements L, we sy tht M is n infiml pproximtion of order n of M. 3

4 Infiml pproximtions of miniml DFSM M re the est pproximtions, in the sense tht, comptily with the stte spce size limittion, their ehvior contins the ehvior of M nd is s close s possile to it. 3 Contrctions Given miniml DFSM M with n sttes how cn one find n infiml pproximtion of order n < n? One possiility is tht of computing ll DFSMs with n sttes over the sme lphet Σ of M nd of looking for those tht stisfy the definition of infiml pproximtions. However, this pproch is clerly infesile in light of the following proposition. Proposition 1. There re (n + 1) m n 2 n different DFSMs with n sttes nd lphet Σ of crdinlity m. Proof: According to the definition of DFSM given in the previous section, for ll q Q nd ll Σ there re n + 1 possile choices of δ(q, ), keeping in mind tht it my e undefined. Thus there re (n + 1) m n different possile choices of δ. Finlly since F is suset of Q, there re 2 n different possile choices of F. We will explore the possiility of using contrctions, whose structure cn e esily computed, s mens of finding pproximtions of given miniml DFSM M. Definition 2. Let M = (Q, Σ, δ, q 0, F ) e DFSM nd let q i, q j Q, with q i q j. The (i, j)- contrction of M is the FSM M i,j otined from M y merging sttes q i nd q j. Formlly, M i,j = (Q, Σ, δ, q 0, F ), where: the stte set is Q = Q {q new } \ {q i, q j }. the trnsition reltion is δ(q, ), if q Q Q δ(q, ) Q Q ; δ q new, if q Q Q δ(q, ) {q i, q j }; (q, ) = δ(q i, ) δ(q j, ), if q = q new δ(q i, ) δ(q j, ) Q Q ; δ(q i, ) δ(q j, ) {q new } \ {q i, q j }, otherwise. { the initil stte is q 0 = q 0, if q 0 Q Q ; q new, otherwise. { the set of finl sttes is F F, if F Q ; = F {q new } \ {q i, q j }, otherwise. Note tht M i,j my well e non-deterministic even if M is DFSM. In Figure 1 it is shown DFSM M nd its three possile contrctions. M 0,1 is non-deterministic nd non-miniml; M 0,2 nd M 1,2 re deterministic nd miniml. Let us consider some properties of contrctions. 4

5 , q 0 q 1 q 2 q new q 2 M M 0,1 q new, q 1 q 0 q new M 0,2 M 1,2 Figure 1: A FSM M nd its contrctions. Lemm 1. Let M = (Q, Σ, δ, q 0, F ) e DFSM nd let M i,j = (Q, Σ, δ, q 0, F ) e its (i, j)- contrction. Then [( ) ] L(M i,j ) = L(M) L i 0 L j 0 L i,j (L i L j ) where: L k h = {w Σ δ(q h, w) = q k ; q i, q j m Q (q h, w)}, L h = ( {w Σ δ(q h, w) ) F ; q i, q j m Q (q h, w)}, L i,j = L i i Lj i Li j Lj j. Proof: We will just give sketch of the proof. First note tht from the definition of contrction, it follows tht for ll w such tht q new m Q (q 0, w): ( ) δ (q 0, w) = q new w L i 0 Lj 0, nd for ll w such tht q new m Q (q new, w): δ (q new, w) = q new w L i,j, δ (q new, w) F w (L i L j ). Since word w L(M i,j ) is generted either with move m(q 0, w) = q 0 [w q f F, where q new m Q (q 0, w), or with move m(q 0, w) = q 0 [w 0 q new [w r 1 q new [w r q f F, where q new m Q (q 0, w 0) nd for ll k > 0, q new m Q (q new, w k ), it is possile to prove the result of the lemm. Proposition 2. Let M = (Q, Σ, δ, q 0, F ) e DFSM nd let M i,j = (Q, Σ, δ, q 0, F ) e its (i, j)-contrction. Then L(M i,j ) L(M). Also if M is miniml DFSM then L(M i,j ) L(M). Proof: The fct tht L(M i,j ) L(M) trivilly follows from Lemm 1. 5

6 q 0 q 1 q new M M 0,1 Figure 2: A non-miniml FSM M nd its contrction. If M is miniml, then sttes q i nd q j re distinguishle, i.e., there must exist string w i such tht, sy, δ(q i, w i ) is in F while δ(q j, w i ) is not defined or is not in F. Now, let w 0,j e string such tht δ(q 0, w 0,j ) = q j. Then w 0,j w i L(M) while y Lemm 1 w 0,j w i L 0,j L i L(M i,j ). According to the ove proposition, the lnguges generted y contrctions of DFSM M re pproximtions of L(M). Exmple 1. The requirement tht M e miniml in Proposition 2 cn e explined y the following exmple. Figure 2 shows DFSM M tht is not miniml nd its contrction M 0,1. It cn e seen tht L(M) = L(M 0,1 ) =. Exmple 2. Not ll lnguges generted y contrctions re infiml pproximtions. Consider the miniml DFSM M in Figure 1 nd its three contrctions. The lnguge generted y M 0,1 is L(M 0,1 ) = Σ, i.e., it is superset of the lnguges generted y the contrctions M 0,2 nd M 1,2. In this cse, however, it is possile to prove tht M 0,2 nd M 1,2 re the only infiml pproximtions of M of order 2. To prove this one my construct ll pproximtions of M of order 2. Exmple 3. Not ll infiml pproximtions of order n 1 of miniml DFSM M with n sttes re contrctions. Consider the DFSM M with 4 sttes nd the DFSM M with 3 sttes in Figure 3. M is n pproximtion of M since L(M ) L(M) ut it cn e esily checked tht it is not contrction, ecuse its lnguge is not superset of ny contrction of M. Hence, there exists n infiml pproximtion of M of order 3 tht is not contrction. Note, however, tht in this cse it cn lso e shown tht for ll q i, q j, L(M i,j ) is not superset of L(M ). Hence one cnnot conclude tht the contrctions of M re not infiml pproximtions. Contrctions re good cndidtes for infiml pproximtions of miniml DFSM M. There re some cses in which it is possile to prove tht ny implementle pproximtion of L(M) is superset of lnguge generted y some contrction of L(M). Theorem 1. Let M = (Q, Σ, δ, q 0, F ) e miniml DFSM with n sttes nd let M = (Q, Σ, δ, q 0, F ) e miniml DFSM with n < n such tht L(M ) L(M). Let h : Q 2 Q e the mpping defined y q 0 h(q 0); q h(q), if q h( q) δ( q, ) = q δ ( q, ) = q. 6

7 q 0 M q 1 q 2 d c q 3 e q' 0 M' q' 1 q' 2 c,e d,e Figure 3: A miniml FSM M with 4 sttes nd n pproximtion of order 3. If h(q) is singleton set for ll q Q then there exists n (i, j)-contrction of M such tht L(M ) L(M i,j ) L(M). Proof: Since h(q) is singleton set nd n > n, there must exist two sttes q i, q j Q such tht h(q i ) = h(q j ) = q. Then it is possile to prove tht L(M ) L(M i,j ). In fct, y the definition of h nd the fct tht L(M ) L(M) it follows tht if δ(q, w) = q then δ (h(q), w) = h( q) while h(f ) F. Hence with the nottion of Lemm 1 w L i 0 L j 0, δ (q 0, w) = q, w L i i L j i Li j L j j, δ (q, w) = q, w L i L j, δ (q, w) F, nd ny string in the set L(M i,j ), whose expression is given in Lemm 1, cn lso e generted y M. Note 1. There re DFSMs M such tht, regrdless of the structure of M, the imge of h(q), s defined in the ove theorem, is singleton set. As n exmple, let M e DFSM with tree-like grph. Since there is only one pth from the initil stte to ny other stte nd since M is deterministic, h(q) cn only ssume single vlue. Thus, for this clss of DFSMs it follows from Theorem 1 tht if ll lnguges generted y contrctions re implementle then ll infiml pproximtions of order n 1 of L(M) re contrctions. The uthor s feeling is tht the implementle lnguges generted y contrctions of miniml DFSM M re lmost lwys infiml pproximtions of L(M) ecuse no counterexmple hs een found to disprove the following conjecture. Conjecture 1. Let M e miniml DFSM. Let L = {L(M i,j ) M h,k L(M i,j ) L(M h,k )}. Then ll implementle lnguges in L re infiml pproximtions of L(M). 7

8 q 0 q 1 q 2 M Figure 4: A miniml DFSM M in Exmple 4. 4 Implementing n pproximtion In the ove section we hve seen how to construct pproximtions of the lnguge generted y given miniml DFSM M y looking t its contrctions. We hve lso noted tht contrction is not lwys deterministic. Thus, to implement contrction lnguge we my hve to convert contrction M i,j into deterministic FSM. The following exmples will show severl possile cses. Exmple 4. In this exmple we consider contrctions tht re non-miniml. Consider the miniml DFSM with 3 sttes in Figure 4. It is esy to see tht ll its contrctions generte the lnguge L =, tht cn e generted y single stte DFSM. Since ll contrctions of M hve 2 sttes they re not miniml. Note tht M 0,1 is non-deterministic, while M 0,2 nd M 1,2 re deterministic. Exmple 5. In this exmple we show tht not ll lnguges generted y contrction re implementle. Consider the miniml DFSM M with 5 sttes in Figure 5. The contrction M 0,2 is not deterministic. When we compute the miniml DFSM tht genertes L(M 0,2 ) we otin the DFSM M0,2 D tht hs 6 sttes. The following lgorithm cn e used to compute set M of good pproximtions of miniml DFMS. Algorithm 1. Let M e miniml DFSM with n sttes. 1. Construct the set M c of ll contrctions of M. 2. Let M m e the set constructed s follows. For ll contrctions M i,j M c : () If M i,j is deterministic let M D i,j = M i,j, else let M D i,j e DFSM equivlent to M i,j. () If Mi,j D is miniml let M i,j m = M i,j D, else let M i,j m e miniml DFSM equivlent to Mi,j D. (c) If the numer of sttes of M m i,j is n m < n, let M m i,j Mm. 3. Let M = {M M m M M m L(M ) L(M )}. M is set of pproximtions of M of order less thn n. Some comments on the complexity of the lgorithm. ( ) n n (n 1) In step 1, there re = contrctions

9 q 0 q 1 q 3 q 2 c d q 1 q new c q 4 d q 3 e M M 0,2 q 4 e q new {q 1,q 3 } c q 1 c d M D 0,2 {q new,q 4 } e q 4 e q 3 d Figure 5: A DFSM M nd its contrction M 0,2 whose lnguge cnnot e implemented. 9

10 Step 2.() is the computtionlly hrdest step. In fct, DFSM M D equivlent to nondeterministic one M with n sttes my hve up to 2 n sttes [3]. This mens tht in generl the determiniztion cnnot e done in polynomil time or spce. In step 2.(), the minimiztion of DFSM with n sttes cn e done with n n log n lgorithm given y Hopcroft [2]. In step 3, one cn use the lgorithm given in [1] pge 144 to check if L(M 1 ) L(M 2 ). If M 1 hs n 1 sttes nd M 2 hs n 2 sttes the complexity of the lgorithm is n G(n), where n = n 1 + n 2 nd G(n) 5 for n Choosing the est pproximtion In this section we consider the following prolem. Given set M of pproximtions of given miniml DFSM M nd finite set of oserved strings L o L(M), choose mong ll FSMs in M the est pproximtion reltive to the oserved ehvior, i.e., the pproximtion M tht mximizes suitle function f(l 0, M ). First of ll, given M = (Q, Σ, δ, q 0, F ) we define two functions ν, µ : Q IN. The first one is such tht ν(q ) = 1 if q F (i.e., if it is finl stte), else ν(q ) = 0. The second one is such tht µ(q ) = { Σ δ (q, ) is defined }, i.e., it counts the numer of events enled t q. If we hve no dditionl knowledge, we my ssume tht t ech step while generting string w nd eing in stte q, M my choose with equl proility to ccept the string generted so fr (if q is finl stte) or to continue, executing one of the events enled t q. The totl numer of choices t ech stte is thus ν(q ) + µ(q ). Thus, let w = 1 2 r e generted y M with the move We define merit function m(q 0, w) = q 0[ 1 q 1[ 2 q r 1[ r q r. f(w, M ) = r i=0 1 ν(q i ) + µ(q i ), whose vlue is mesure of the likelihood tht w is generted y M. Exmple 6. Consider the DFSM M in Figure 1 nd its two pproximtions M 0,2, nd M 1,2. The string w 1 = () k is more likely to e generted y M 1,2 since f(w 1, M 0,2 ) = ( ) k = k, while f(w 1, M 1,2 ) = ( 1 1 ) k 1 = k. 10

11 On the contrry, the string w 2 = 2k for k > 1 is more likely to e generted y M 0,2 since f(w 2, M 0,2 ) = 1 ( ) k = k, while ( 1 f(w 2, M 1,2 ) = ) k = k. Next proposition shows tht f is good mesure for choosing mong pproximtions in the sense tht it tends to give higher rting to infiml pproximtions. Proposition 3. Let M = (Q, Σ, δ, q 0, F ) nd M = (Q, Σ, δ, q 0, F ) e DFSMs such tht L(M) L(M ). Then for ll w L(M), f(w, M) f(w, M ). Proof: Let w = 1 2 r e generted y M with the move q 0 [ 1 q 1 [ r q r, nd y M with the move q 0 [ 1 q 1 [ r q r. Since L(M) L(M ), it follows tht q i F if q i F, i.e., ν(q i ) ν(q i); δ(q i, ) is defined if δ(q i, ) is defined, i.e., µ(q i ) µ(q i). Hence f(w, M) f(w, M ). The merit function f cn e extended to set of strings. If L L(M ), we define f(l, M ) = w L f(w, M ). Thus, given set M of pproximtions of given miniml DFSM M nd finite set of oserved strings L o, we sy tht the est pproximtion of M with respect to f nd L o is the DFSM M M such tht f(l o, M ) = mx M M [f(l o, M )]. Different merit functions could e used if we ssume tht some knowledge on the proility of occurrence of different events in Σ is known. 6 Conclusions The pper hs presented introductory work on the model reduction of discrete event systems represented y finite stte mchines. It ws shown how set of good ut possily not infiml pproximtions of given miniml DFSM M cn e computed efficiently y looking t contrctions of M. In some prticulr cse, it is lso possile to prove tht the pproximtions thus constructed re infiml. 11

12 The pper hs lso discussed how, given set of pproximtions of FMS M, it is possile to define merit function to choose the est pproximtion with respect to given oserved ehvior L o L(M). The pproch presented in the pper leves open some interesting prolems. Firstly, we do not know if the conjecture presented in Section 3 is true; it should e possile to prove it or to find counterexmple to disprove it. Secondly, it my e interesting to try to pply the contrction technique to other grphicl models of discrete event systems such s Petri nets. References [1] A.V. Aho, J.E. Hopcroft, J.D. Ullmn, The Design nd Anlysis of Computer Algorithms, Addison-Wesley, [2] J.E. Hopcroft, An n log n Algorithm for Minimizing the Sttes in Finite Automton, The Theory of Mchines nd Computtions, Z. Kohvi (Ed.), pp , Acdemic Press, [3] J.E. Hopcroft, J.D. Ullmn, Introduction to Automt Theory, Lnguges, nd Computtion, Addison-Wesley, [4] H.R. Lewis, C.H. Ppdimitriou, Elements of the Theory of Computtion, Prentice-Hll, [5] J. Myhill, Finite Automt nd the Representtion of Events, WADD TR , pp , Wright Ptterson AFB, Ohio. [6] A. Nerode, Liner Automton Trnsformtions, Proceedings AMS, Vol. 9, pp , [7] P.J. Rmdge, W.M. Wonhm, The Control of Discrete Event Systems, Proceedings IEEE, Vol. 77, No. 1, pp , Jnury,

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51 Non Deterministic Automt Linz: Nondeterministic Finite Accepters, pge 51 1 Nondeterministic Finite Accepter (NFA) Alphbet ={} q 1 q2 q 0 q 3 2 Nondeterministic Finite Accepter (NFA) Alphbet ={} Two choices

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

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

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

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

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

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

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

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

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

On Decentralized Observability of Discrete Event Systems

On Decentralized Observability of Discrete Event Systems 2011 50th IEEE Conference on Decision nd Control nd Europen Control Conference (CDC-ECC) Orlndo, FL, USA, Decemer 12-15, 2011 On Decentrlized Oservility of Discrete Event Systems M.P. Csino, A. Giu, C.

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

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

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

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

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

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

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

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

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

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

Thoery of Automata CS402

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

More information

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

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

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

Centrum voor Wiskunde en Informatica REPORTRAPPORT. Supervisory control for nondeterministic systems

Centrum voor Wiskunde en Informatica REPORTRAPPORT. Supervisory control for nondeterministic systems Centrum voor Wiskunde en Informtic REPORTRAPPORT Supervisory control for nondeterministic systems A. Overkmp Deprtment of Opertions Reserch, Sttistics, nd System Theory BS-R9411 1994 Supervisory Control

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

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

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

Bases for Vector Spaces

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

More information

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

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

Section: Other Models of Turing Machines. Definition: Two automata are equivalent if they accept the same language.

Section: Other Models of Turing Machines. Definition: Two automata are equivalent if they accept the same language. Section: Other Models of Turing Mchines Definition: Two utomt re equivlent if they ccept the sme lnguge. Turing Mchines with Sty Option Modify δ, Theorem Clss of stndrd TM s is equivlent to clss of TM

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

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

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

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

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

More information

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

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

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

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

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

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

Supervisory Control of Petri Nets with Language Specifications

Supervisory Control of Petri Nets with Language Specifications Supervisory Control of Petri Nets with Lnguge Specifictions Alessndro Giu Dip. di Ing. Elettric ed Elettronic, Università di Cgliri, Itly Emil: giu@diee.unic.it Astrct In this chpter we discuss how Petri

More information

Normal Forms for Context-free Grammars

Normal Forms for Context-free Grammars Norml Forms for Context-free Grmmrs 1 Linz 6th, Section 6.2 wo Importnt Norml Forms, pges 171--178 2 Chomsky Norml Form All productions hve form: A BC nd A vrile vrile terminl 3 Exmples: S AS S AS S S

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

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

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

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

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

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

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

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

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

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

More information

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

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

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

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

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

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

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

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

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

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa CS:4330 Theory of Computtion Spring 208 Regulr Lnguges Equivlences between Finite utomt nd REs Hniel Brbos Redings for this lecture Chpter of [Sipser 996], 3rd edition. Section.3. Finite utomt nd regulr

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

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

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

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

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

Non-Deterministic Finite Automata

Non-Deterministic Finite Automata Non-Deterministic Finite Automt http://users.comlb.ox.c.uk/luke. ong/teching/moc/nf2up.pdf 1 Nondeterministic Finite Automton (NFA) Alphbet ={} q1 q2 2 Alphbet ={} Two choices q1 q2 3 Alphbet ={} Two choices

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

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science CSCI 340: Computtionl Models Trnsition Grphs Chpter 6 Deprtment of Computer Science Relxing Restrints on Inputs We cn uild n FA tht ccepts only the word! 5 sttes ecuse n FA cn only process one letter t

More information

Review of Gaussian Quadrature method

Review of Gaussian Quadrature method Review of Gussin Qudrture method Nsser M. Asi Spring 006 compiled on Sundy Decemer 1, 017 t 09:1 PM 1 The prolem To find numericl vlue for the integrl of rel vlued function of rel vrile over specific rnge

More information