Chapter 7. Kleene s Theorem. 7.1 Kleene s Theorem. The following theorem is the most important and fundamental result in the theory of FA s:

Size: px
Start display at page:

Download "Chapter 7. Kleene s Theorem. 7.1 Kleene s Theorem. The following theorem is the most important and fundamental result in the theory of FA s:"

Transcription

1 Chpte 7 Kleene s Theoem 7.1 Kleene s Theoem The following theoem is the most impotnt nd fundmentl esult in the theoy of FA s: Theoem 6 Any lnguge tht cn e defined y eithe egul expession, o finite utomt, o tnsition gph cn e defined y ll thee methods. Poof. The poof hs thee pts: Pt 1: (FA TG) Evey lnguge tht cn e defined y n FA cn lso e defined y tnsition gph. Pt 2: (TG RegExp) Evey lnguge tht cn e defined y tnsition gph cn lso e defined y egul expession. Pt 3: (RegExp FA) Evey lnguge tht cn e defined y egul expession cn lso e defined y n FA. 7-1

2 CHAPTER 7. KLEENE S THEOREM Poof of Pt 1: FA TG We peviously sw tht evey FA is lso tnsition gph. Hence, ny lnguge tht hs een defined y FA cn lso e defined y tnsition gph. 7.3 Poof of Pt 2: TG RegExp We will give constuctive lgoithm fo poving pt 2. Thus, we will descie n lgoithm to tke ny tnsition gph T nd fom egul expession coesponding to it. The lgoithm will wok fo ny tnsition gph T. The lgoithm will finish in finite time. An oveview of the lgoithm is s follows: Stt with ny tnsition gph T. Fist, tnsfom it into n equivlent tnsition gph hving only one stt stte nd one finl stte. In ech following step, eliminte eithe some sttes o some cs y tnsfoming the TG into nothe equivlent one. We do this y eplcing the stings lelling cs with egul expessions. We cn tvese n c lelled with egul expession using ny sting tht cn e geneted y the egul expession. End up with TG hving only two sttes, stt nd finl, nd one c going fom stt to finl. The finl TG will hve egul expession on its one c Note tht in ech step we eliminte some sttes o cs. Since the oiginl TG hs finite nume of sttes nd cs, the lgoithm will teminte in finite nume of itetions.

3 CHAPTER 7. KLEENE S THEOREM 7-3 Algoithm: 1. If T hs moe thn one stt stte, dd new stte nd dd cs leled Λ going to ech of the oiginl stt sttes => - /\ /\ If T hs moe thn one finl stte, dd new stte nd dd cs leled Λ going fom ech of the oiginl finl sttes to the new stte. Need to mke sue the finl stte is diffeent thn the stt stte.... +, =>... /\, +, +, /\

4 CHAPTER 7. KLEENE S THEOREM Now we give n itetive pocedue fo eliminting sttes nd cs () If T hs some stte with n > 1 loops cicling ck to itself, whee the loops e leled with egul expessions 1, 2,..., n, then eplce the n loops with single loop leled with the egul expession n. 1 2 => () If two sttes e connected y n > 1 diect cs in the sme diection, whee the cs e lelled with the egul expessions 1, 2,..., n, then eplce the n cs with single c leled with the egul expession n. 1 2 => + 1 2

5 CHAPTER 7. KLEENE S THEOREM 7-5 (c) Bypss opetion: i. If thee e thee sttes x, y, z such tht thee is n c fom x to y lelled with the egul expession 1 nd n c fom y to z lelled with the egul expession 2, then eplce the two cs nd the stte y with single c fom x to z lelled with the egul expession x y 2 z => x 1 2 z 3 1 x y 2 z x 1 3 * 2 => z

6 CHAPTER 7. KLEENE S THEOREM 7-6 ii. If thee e n+2 sttes x, y, z 1, z 2,..., z n such tht thee is n c fom x to y lelled with the egul expession 0, nd n c fom y to z i, i = 1, 2,..., n, lelled with the egul expession i, nd n c fom y ck to itself lelled with egul expession n+1, then eplce the n + 1 oiginl cs nd the stte y with n cs fom x to z i, i = 1, 2,..., n, ech lelled with the egul expession 0 n+1 i. x 0 n+1 y 1 2 n z 1 z 2. z n => 0 * n+1 1 x 0 * n * n+1 n z 1 z 2. z n iii. If ny othe cs led diectly to y, divet them diectly to the z i s.

7 CHAPTER 7. KLEENE S THEOREM 7-7 iv. Need to mke sue tht ll pths possile in the oiginl TG e still possile fte the ypss opetion. Exmple w 1 x 2 3 y 4 5 z 1 ( 2 3 )* 4 => w z 1 2 ( 3 2 )* 5 => w z 1 ( 2 3 )* ( 3 2 )* 5

8 CHAPTER 7. KLEENE S THEOREM 7-8 Exmple: Suppose we wnt to get id of stte y. Need to ccount fo ll pths tht go though stte y. Thee e cs coming fom x, w, nd z going into y. Thee e cs fom y to x nd z. Thus, we need to ccount fo ech possile pth fom stte hving n c into y (i.e., x, w, z) to ech stte hving n c fom y (i.e., x, z) Thus, we need to ccount fo the pths fom x to y to x, which hs egul expession x to y to z, which hs egul expession w to y to x, which hs egul expession w to y to z, which hs egul expession z to y to x, which hs egul expession z to y to z, which hs egul expession Thus, fte eliminting stte y, we get the following: v. Neve delete the unique stt o finl stte.

9 CHAPTER 7. KLEENE S THEOREM 7-9 Exmple: /\ /\, => => 1 - *(++)(+)* 5 +

10 CHAPTER 7. KLEENE S THEOREM 7-10 Exmple: => 4 5 +, - /\ /\ /\ 4 5 /\ + + => - => - /\ /\+ 2 * 2 * * *(+)* 4 5 /\ + 4 (+)* + +

11 CHAPTER 7. KLEENE S THEOREM 7-11 => - /\+ => - /\+ 2 *(/\+(+)*) 2 *(/\+(+)*) 4 (+)* + 4 (+)* + ()*(+)* + ()**(/\+(+)*) (/\+)(()**(/\+(+)*) + ()*(+)*) => - ()*(+)* + ()**(/\+(+)*) + => (/\+)(()**(/\+(+)*) + ()*(+)*) + ()*(+)* + ()**(/\+(+)*)

12 CHAPTER 7. KLEENE S THEOREM Poof of Pt 3: RegExp FA To show: evey lnguge tht cn e defined y egul expession cn lso e defined y FA. We will do this y using ecusive definition nd constuctive lgoithm. Recll evey egul expession cn e uilt up fom the lettes of the lphet nd Λ nd. Also, given some existing egul expessions, we cn uild new egul expessions y pplying the following opetions: 1. union (+) 2. conctention 3. closue (Kleene st) We will not include + in ou discussion hee, ut this will not e polem since + =.

13 CHAPTER 7. KLEENE S THEOREM 7-13 Recll tht we hd the following ecusive definition fo egul expessions: Rule 1: If x Σ, then x is egul expession. Λ is egul expession. is egul expession. Rule 2: If 1 nd 2 e egul expessions, then is egul expession. Rule 3: If 1 nd 2 e egul expessions, then 1 2 is egul expession. Rule 4: If 1 is egul expession, then 1 is egul expession. Bsed on the ove ecusive definition fo egul expessions, we hve the following ecusive definition fo FA s ssocited with egul expessions: Rule 1: Thee is n FA tht ccepts the lnguge L defined y the egul expession x; i.e., L = {x}, whee x Σ, so lnguge L consists of only single wod nd tht wod is the single lette x. Thee is n FA tht ccepts the lnguge defined y egul expession Λ; i.e., the lnguge {Λ}. Thee is n FA defined y the egul expession ; i.e., the lnguge with no wods, which is. Rule 2: If thee is n FA clled F A 1 tht ccepts the lnguge defined y the egul expession 1 nd thee is n FA clled F A 2 tht ccepts the lnguge defined y the egul expession 2, then thee is n FA clled F A 3 tht ccepts the lnguge defined y the egul expession Rule 3: If thee is n FA clled F A 1 tht ccepts the lnguge defined y the egul expession 1 nd thee is n FA clled F A 2 tht ccepts the lnguge defined y the egul expession 2, then thee is n FA clled F A 3 tht ccepts the lnguge defined y the egul expession 1 2, which is the conctention. Rule 4: If thee is n FA clled F A 1 tht ccepts the lnguge defined y the egul expession 1, then thee is n FA clled F A 2 tht ccepts the lnguge defined y the egul expession 1.

14 CHAPTER 7. KLEENE S THEOREM 7-14 Let s now show tht ech of the ules hold y constuction: Rule 1: Thee is n FA tht ccepts the lnguge L defined y the egul expession x; i.e., L = {x}, whee x Σ. Thee is n FA tht ccepts lnguge defined y the egul expession Λ. Thee is n FA tht ccepts the lnguge defined y the egul expession. If x Σ, then the following FA ccepts the lnguge {x}: x {x} An FA tht ccepts the lnguge {Λ} is + _ An FA tht ccepts the lnguge is -

15 CHAPTER 7. KLEENE S THEOREM 7-15 Rule 2: If thee is n FA clled F A 1 tht ccepts the lnguge defined y the egul expession 1 nd thee is n FA clled F A 2 tht ccepts the lnguge defined y the egul expession 2, then thee is n FA clled F A 3 tht ccepts the lnguge defined y the egul expession Suppose egul expessions 1 nd 2 e defined with espect to common lphet Σ. Let L 1 e the lnguge geneted y egul expession 1. L 1 hs finite utomton F A 1. Let L 2 e the lnguge geneted y egul expession 2. L 2 hs finite utomton F A 2. Regul expession genetes the lnguge L 1 + L 2. Recll L 1 + L 2 = {w Σ : w L 1 o w L 2 }. Thus, w L 1 + L 2 if nd only if w is ccepted y eithe F A 1 o F A 2 (o oth). We need F A 3 to ccept sting if the sting is ccepted y F A 1 o F A 2 o oth. We do this y constucting new mchine F A 3 tht simultneously keeps tck of whee the input would e if it wee unning on F A 1 nd whee the input would e if it wee unning on F A 2. Suppose F A 1 hs sttes x 1, x 2,..., x m, nd F A 2 hs sttes y 1, y 2,..., y n. Assume tht x 1 is the stt stte of F A 1 nd tht y 1 is the stt stte of F A 2. We will cete F A 3 with sttes of the fom (x i, y j ). The nume of sttes in F A 3 is t most mn, whee m is the nume of sttes in F A 1 nd n is the nume of sttes in F A 2. Ech stte in F A 3 coesponds to stte in F A 1 nd stte in F A 2. F A 3 ccepts sting w if nd only if eithe F A 1 o F A 2 ccepts w. So finl sttes of F A 3 e those sttes (x, y) such tht x is finl stte of F A 1 o y is finl stte of F A 2.

16 CHAPTER 7. KLEENE S THEOREM 7-16 We use the following lgoithm to constuct F A 3 fom F A 1 nd F A 2. Suppose tht Σ is the lphet fo oth F A 1 nd F A 2. Given F A 1 = (K 1, Σ, π 1, s 1, F 1 ) with Set of sttes K 1 = {x 1, x 2,..., x m } s 1 = x 1 is the initil stte F 1 K 1 is the set of finl sttes of F A 1. π 1 : K 1 Σ K 1 is the tnsition function fo F A 1. Given F A 2 = (K 2, Σ, π 2, s 2, F 2 ) with Set of sttes K 2 = {y 1, y 2,..., y n } s 2 = y 1 is the initil stte F 2 K 2 is the set of finl sttes of F A 2. π 2 : K 2 Σ K 2 is the tnsition function fo F A 2. We then define F A 3 = (K 3, Σ, π 3, s 3, F 3 ) with Set of sttes K 3 = K 1 K 2 = {(x, y) : x K 1, y K 2 } The lphet of F A 3 is Σ. F A 3 hs tnsition function π 3 : K 3 Σ K 3 with The initil stte s 3 = (s 1, s 2 ). The set of finl sttes π 3 ((x, y), l) = (π 1 (x, l), π 2 (y, l)). F 3 = {(x, y) K 1 K 2 : x F 1 o y F 2 }. Since K 3 = K 1 K 2, the nume of sttes in the new mchine F A 3 is K 3 = K 1 K 2. But we cn leve out stte (x, y) K 1 K 2 fom K 3 if (x, y) is not echle fom F A 3 s initil stte (s 1, s 2 ). This would esult in fewe sttes in K 3, ut still we hve K 1 K 2 s n uppe ound fo K 3 ; i.e., K 3 K 1 K 2.

17 CHAPTER 7. KLEENE S THEOREM 7-17 Exmple: L 1 = { wods with s second lette} with egul expession 1 = ( + )( + ) L 2 = { wods with odd nume of s} with egul expession 2 = ( + ) FA1 fo L1:, x1- x2 x3+, FA2 fo L2: y1- y2+ x4, FA3 fo L1+L2: x1,y1- x3,y1+ x2,y2+ x3,y2+ x4,y1 x2,y1 x4,y2+

18 CHAPTER 7. KLEENE S THEOREM 7-18 Rule 3: If thee is n FA clled F A 1 tht ccepts the lnguge defined y the egul expession 1 nd thee is n FA clled F A 2 tht ccepts the lnguge defined y the egul expession 2, then thee is n FA clled F A 3 tht ccepts the lnguge defined y the egul expession 1 2. Fo this pt, we need F A 3 to ccept sting if the sting cn e fctoed into two sustings, whee the fist fcto is ccepted y F A 1 nd the second fcto is ccepted y F A 2. One polem is we don t know when we ech the end of the fist fcto nd the eginning of the second fcto. Exmple: L 1 = {wods tht end with } with egul expession 1 = ( + ) L 2 = {wods with odd length} with egul expession 2 = ( + )(( + )( + )) Conside the sting. If we fcto it s ()(), then L 1 ut L 2. Howeve, nothe fctoiztion, ()(), shows tht L 1 L 2 since L 1 nd L 2. FA1 fo L1: x1- x2 FA2 fo L2:, y1- y2+, x3+

19 CHAPTER 7. KLEENE S THEOREM 7-19 Bsiclly ide of uilding F A 3 fo L 1 L 2 fom F A 1 fo L 1 nd F A 2 fo L 2 : Recll L 1 L 2 = {w = w 1 w 2 : w 1 L 1, w 2 L 2 }. So sting w is in L 1 L 2 if nd only if we cn fcto w = w 1 w 2 such tht w 1 is ccepted y F A 1 nd w 2 is ccepted y F A 2. F A 3 initilly cts like F A 1. When F A 3 hits stte of F A 1, Stt vesion of F A 2. Keep pocessing on F A 1 nd ny pevious vesions of F A 2. We need to keep pocessing on F A 1 ecuse we don t know whee the fist fcto w 1 ends nd the second fcto w 2 egins Finl sttes of F A 3 e those sttes tht hve t lest one finl stte fom F A 2. Moe fomlly, we uild mchine F A 3 in following wy: Suppose tht F A 1 nd F A 2 hve the sme lphet Σ. Let L 1 e lnguge geneted y egul expession 1 nd hving FA F A 1 = (K 1, Σ, π 1, s 1, F 1 ). Let L 2 e lnguge geneted y egul expession 2 nd hving FA F A 2 = (K 2, Σ, π 2, s 2, F 2 ). Definition: Fo ny set S, define 2 S to e the set of ll possile susets of S. Exmple: If S = {,, }, then 2 S = {, {}, {}, {}, {, }, {, }, {, }, {,, }}. Fct: If S <, then 2 S = 2 S ; i.e., thee e 2 S diffeent susets of S. Mchine F A 3 = (K 3, Σ, π 3, s 3, F 3 ) fo L 1 L 2 is s follows: Sttes K 3 = {{x} + Y : x K 1, Y 2 K 2 }; i.e., ech stte of F A 3 is set of sttes, whee exctly one of the sttes is fom F A 1 nd the est (possily none) e fom F A 2. Initil stte s 3 = {s 1 }; i.e., the initil stte of F A 3 is the set consisting of only the initil stte of F A 1.

20 CHAPTER 7. KLEENE S THEOREM 7-20 Tnsition function π 3 : K 3 Σ K 3 is defined s π 3 ({x, y 1,..., y n }, l) { {π1 (x, l), π = 2 (y 1, l),..., π n (y 2, l)} if π 1 (x, l) F 1, {π 1 (x, l), π 2 (y 1, l),..., π n (y 2, l), s 2 } if π 1 (x, l) F 1, whee {x, y 1,..., y n } K 3, n 0, x K 1, y i K 2 fo i = 1,..., n, nd l Σ. Finl sttes F 3 = {{x, y 1,..., y n } : n 1, y i F 2 fo some i = 1,..., n}. The nume of sttes in F A 3 is K 3 = K 1 2 K 2 = K 1 2 K 2. Actully, we cn leve out fom K 3 ny sttes {x, y 1,..., y n } tht e not echle fom the initil stte s 3. In this cse, K 1 2 K 2 still povides n uppe ound fo K 3 ; i.e., K 3 K 1 2 K 2.

21 CHAPTER 7. KLEENE S THEOREM 7-21 Exmple: L 1 = {wods tht end with } with egul expession 1 = ( + ) L 2 = {wods with odd length} with egul expession 2 = ( + )(( + )( + )) FA1 fo L1: x1- x2 FA2 fo L2:, y1- y2+, x3+ FA3 fo L1 L2: x1- x2 x2,y2+ x3,y1 x3,y2,y1+ x1,y1,y2+ x1,y1 x1,y2+ x2,y1 x2,y2,y1+

22 CHAPTER 7. KLEENE S THEOREM 7-22 Rule 4: If thee is n FA clled F A 1 tht ccepts the lnguge defined y the egul expession 1, then thee is n FA clled F A 2 tht ccepts the lnguge defined y the egul expession 1. Bsic ide of how to uild mchine F A 2 : Ech stte of F A 2 coesponds to one o moe sttes of F A 1. F A 2 initilly cts like F A 1. when F A 2 hits stte of F A 1, then F A 2 simultneously keeps tck of how the est of the sting would e pocessed on F A 1 fom whee it left off nd how the est of the sting would e pocessed on F A 1 stting in the stt stte. Wheneve F A 2 hits stte of F A 1, we hve to stt new pocess stting in the stt stte of F A 1 (if no vesion of F A 1 is cuently in its stt stte.) The finl sttes of F A 2 e those sttes which hve coespondence to some finl stte of F A 1. We need to e ceful out mking sue tht F A 2 ccepts Λ. To hve F A 2 ccept Λ, we mke the stt stte of F A 2 lso finl stte. But we need to e ceful when thee e cs going into the stt stte of F A 1.

23 CHAPTER 7. KLEENE S THEOREM 7-23 Fomlly, we uild the mchine F A 2 fo L 1 s follows: Let L 1 e lnguge geneted y egul expession 1 nd hving finite utomton F A 1 = (K 1, Σ, π 1, s 1, F 1 ). Fo now, ssume tht F A 1 does not hve ny cs enteing the initil stte s 1. Know tht lnguge L 1 is geneted y egul expession 1. Define F A 2 = (K 2, Σ, π 2, s 2, F 2 ) fo L 1 with Sttes K 2 = 2 K 1. Initil stte s 2 = {s 1 }. Tnsition function π 2 : K 2 Σ K 2 with π 2 ({x 1,..., x n }, l) { {π1 (x = 1, l),..., π 1 (x n, l)} if π 1 (x k, l) F 1 fo ll k = 1,..., n, {π 1 (x 1, l),..., π 1 (x n, l), s 1 } if π 1 (x k, l) F 1 fo some k = 1,..., n, whee {x 1,..., x n } K 2, n 1, x i K 1 fo ll i = 1,..., n, nd l Σ. Finl sttes F 2 = {s 1 }+{{x 1,..., x n } : n 1, x i F 1 fo some i = 1,..., n}. The nume of sttes in F A 2 is K 2 = 2 K 1 = 2 K 1. Actully, we cn leve out fom K 2 ny stte {x 1,..., x n } tht is not echle fom the initil stte s 2. In this cse, 2 K 1 still povides n uppe ound fo K 2 ; i.e., K 3 2 K 1.

24 CHAPTER 7. KLEENE S THEOREM 7-24 Exmple: Conside lnguge L hving egul expession = ( + )(( + ) ) FA fo L: x1- x2+ x3 x4 FA fo L*: x1+ - x4,x2,x1+ x4 x3 x2,x1+ x2,x1,x3+ x3,x4 x1,x2,x3,x4+

25 CHAPTER 7. KLEENE S THEOREM 7-25 Exmple: Conside lnguge L hving egul expession ( + ) Need to e ceful since we cn etun to the stt stte. FA fo L: x1- x2+ If we lindly pplied pevious method fo constucting F A fo L, we get the following: x1+ - x2,x1+ Polem: Note tht stt stte is finl stte. But this F A ccepts L, nd so this FA is incoect. Polem occus ecuse we cn etun to stt stte in oiginl FA, nd since we mke the stt stte finl stte in new FA.

26 CHAPTER 7. KLEENE S THEOREM 7-26 Solution: Given oiginl FA F A 1 hving cs going into the initil stte, cete n equivlent FA F A 1 hving no cs going into the initil stte y splitting the oiginl stt stte x 1 of F A 1 into two sttes x 1.1 nd x 1.2 x 1.1 is the new stt stte of F A 1 nd is neve visited gin fte the fist lette of the input sting is ed. x 1.2 in F A 1 coesponds to x 1 fte the fist lette of the input sting is ed. Then un lgoithm to cete FA fo L fom the new FA F A 1. new FA fo L: x1.1- x2+ x1.2 FA fo L*: x x2, x1.1+ x1.2

27 CHAPTER 7. KLEENE S THEOREM Nondeteministic Finite Automt Definition: A nondeteministic finite utomton (NFA) is given y M = (K, Σ, Π, s, F ), whee 1. K is finite set of sttes. s K is the initil stte, which is denoted pictoilly y, nd thee is exctly one initil stte. F K is set of finl sttes (possily empty), whee ech finl stte is denoted pictoilly y. 2. An lphet Σ of possile input lettes. 3. Π K Σ K is finite set of tnsitions, whee ech tnsition (c) fom one stte to nothe stte is leled with lette l Σ. (We do not llow fo Λ to e the lel of n c since Λ is sting nd not lette of Σ.) We llow fo the possiility of moe thn one edge with the sme lel fom ny stte nd thee my e stte (o sttes) fo which cetin input lettes hve no edge leving tht stte.

28 CHAPTER 7. KLEENE S THEOREM 7-28 Exmple:, - + Note tht definition of NFA is diffeent fom tht of FA since FA must hve fom ech stte n c leled with ech lette of lphet, while NFA does not. FA is deteministic, while NFA my e nondetemisic. An NFA cn hve epeted lels fom ny single stte. NFA llows fo humn choice to ecome fcto in selecting wy to pocess n input sting. The definition of NFA is diffeent fom tht of TG since TG cn hve cs leled with sustings of lettes while NFA hs cs leled with only lettes. TG cn hve cs leled with Λ while NFA cnnot. TG cn hve moe thn one stt stte while NFA cn only hve one.

29 CHAPTER 7. KLEENE S THEOREM 7-29 Cn tnsfom ny NFA with epeted lels fom ny single stte to n equivlent TG with no epeted lels fom ny single stte => 1 ^ 2 3 ^ Popeties of NFA Theoem 7 FA = NFA; i.e., ny lnguge definle y NFA is lso definle y deteministic FA nd vice ves. Poof. Note tht Evey FA is n NFA since we cn conside n FA to e n NFA without the ext possile fetues. Evey NFA is TG. Kleene s theoem sttes tht evey TG hs n equivlent FA. NFA useful ecuse pplictions in tificil intelligence (AI).

30 CHAPTER 7. KLEENE S THEOREM 7-30 given two FA s fo two lnguges with egul expessions 1 nd 2, it is esy to constuct n NFA to ccept lnguge coesponding to egul expession

31 CHAPTER 7. KLEENE S THEOREM 7-31 Exmple: FA1: FA2:, + +,, - - +, NFA 1+2, + +,, - +, This woks when neithe of the oiginl FA s hs ny cs going into thei oiginl initil sttes. If one o oth of the oiginl FA s hs n c going into its oiginl initil stte, the newly constucted FA fo the lnguge coesponding

32 CHAPTER 7. KLEENE S THEOREM 7-32 to egul expession my e incoect. This is ecuse the new FA my pocess pt of the wod on one of the oiginl FA s nd then pocess the est of the wod on the othe FA, nd then incoectly ccept the wod.

Language Processors F29LP2, Lecture 5

Language Processors F29LP2, Lecture 5 Lnguge Pocessos F29LP2, Lectue 5 Jmie Gy Feuy 2, 2014 1 / 1 Nondeteministic Finite Automt (NFA) NFA genelise deteministic finite utomt (DFA). They llow sevel (0, 1, o moe thn 1) outgoing tnsitions with

More information

2-Way Finite Automata Radboud University, Nijmegen. Writer: Serena Rietbergen, s Supervisor: Herman Geuvers

2-Way Finite Automata Radboud University, Nijmegen. Writer: Serena Rietbergen, s Supervisor: Herman Geuvers 2-Wy Finite Automt Rdoud Univesity, Nijmegen Wite: Seen Rietegen, s4182804 Supeviso: Hemn Geuves Acdemic Ye 2017-2018 Contents 1 Intoduction 3 2 One wy utomt, deteministic nd non-deteministic 5 3 Ovehed

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

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

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

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

Lecture 08: Feb. 08, 2019

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

More information

Chapter 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

Deterministic simulation of a NFA with k symbol lookahead

Deterministic simulation of a NFA with k symbol lookahead Deteministic simultion of NFA with k symbol lookhed SOFSEM 7 Bl Rvikum, Clifoni Stte Univesity (joint wok with Nic Snten, Univesity of Wteloo) Oveview Definitions: DFA, NFA nd lookhed DFA Motivtion: utomted

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

Week 8. Topic 2 Properties of Logarithms

Week 8. Topic 2 Properties of Logarithms Week 8 Topic 2 Popeties of Logithms 1 Week 8 Topic 2 Popeties of Logithms Intoduction Since the esult of ithm is n eponent, we hve mny popeties of ithms tht e elted to the popeties of eponents. They e

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

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

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

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

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

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

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

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

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

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

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

Discrete Mathematics and Logic II. Automata

Discrete Mathematics and Logic II. Automata Discete Mthemtics nd Logic II. Automt SFWR ENG 2FA3 Ryszd Jnicki Winte 2014 Acknowledgments: Mteil sed on Automt nd Computility y Dexte C. Kozen (Chpte 3). Ryszd Jnicki Discete Mthemtics nd Logic II. Automt

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

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

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

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) - Spring L. Blum

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) - Spring L. Blum 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY THE PUMPING LEMMA FOR REGULAR LANGUAGES nd REGULAR EXPRESSIONS TUESDAY Jn 21 WHICH OF THESE ARE REGULAR? B = {0 n 1 n n 0} C = { w w hs equl numer of

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

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

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

Context-Free Grammars and Languages

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

More information

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

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

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

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

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

Previously. Extensions to backstepping controller designs. Tracking using backstepping Suppose we consider the general system

Previously. Extensions to backstepping controller designs. Tracking using backstepping Suppose we consider the general system 436-459 Advnced contol nd utomtion Extensions to bckstepping contolle designs Tcking Obseves (nonline dmping) Peviously Lst lectue we looked t designing nonline contolles using the bckstepping technique

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

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

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

Java II Finite Automata I

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

More information

A Survey of Methods for Generating a Test Sequence for Conformance Testing of Finite State Machine

A Survey of Methods for Generating a Test Sequence for Conformance Testing of Finite State Machine ISSN:2229-693 Hnn Ndeem et l, Int.J.Compute Technology & Applictions,Vol 5 (2),435-446 A Suvey of Methods fo Geneting Test Sequence fo Confomnce Testing of Finite Stte Mchine Zin Eid King Adul Aziz Univesity

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

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

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

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

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

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

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

ɛ-closure, Kleene s Theorem,

ɛ-closure, Kleene s Theorem, DEGefW5wiGH2XgYMEzUKjEmtCDUsRQ4d 1 A nice pper relevnt to this course is titled The Glory of the Pst 2 NICTA Resercher, Adjunct t the Austrlin Ntionl University nd Griffith University ɛ-closure, Kleene

More 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

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

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

U>, and is negative. Electric Potential Energy

U>, and is negative. Electric Potential Energy Electic Potentil Enegy Think of gvittionl potentil enegy. When the lock is moved veticlly up ginst gvity, the gvittionl foce does negtive wok (you do positive wok), nd the potentil enegy (U) inceses. When

More information

Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15

Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15 Models of Comput:on Lecture #8 Chpter 7 con:nued Any lnguge tht e defined y regulr expression, finite utomton, or trnsi:on grph cn e defined y ll three methods We prove this y showing tht ny lnguge defined

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

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

Regular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15

Regular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15 Regulr Lnguge Nonregulr Lnguges The Pumping Lemm Models of Comput=on Chpter 10 Recll, tht ny lnguge tht cn e descried y regulr expression is clled regulr lnguge In this lecture we will prove tht not ll

More information

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

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

More information

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

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Intoduction to Computing II Mcel Tucotte School of Electicl Engineeing nd Compute Science Abstct dt type: Stck Stck-bsed lgoithms Vesion of Febuy 2, 2013 Abstct These lectue notes e ment to be

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

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

Math 4318 : Real Analysis II Mid-Term Exam 1 14 February 2013

Math 4318 : Real Analysis II Mid-Term Exam 1 14 February 2013 Mth 4318 : Rel Anlysis II Mid-Tem Exm 1 14 Febuy 2013 Nme: Definitions: Tue/Flse: Poofs: 1. 2. 3. 4. 5. 6. Totl: Definitions nd Sttements of Theoems 1. (2 points) Fo function f(x) defined on (, b) nd fo

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

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

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

More information

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

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

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

Data Structures. Element Uniqueness Problem. Hash Tables. Example. Hash Tables. Dana Shapira. 19 x 1. ) h(x 4. ) h(x 2. ) h(x 3. h(x 1. x 4. x 2.

Data Structures. Element Uniqueness Problem. Hash Tables. Example. Hash Tables. Dana Shapira. 19 x 1. ) h(x 4. ) h(x 2. ) h(x 3. h(x 1. x 4. x 2. Element Uniqueness Poblem Dt Stuctues Let x,..., xn < m Detemine whethe thee exist i j such tht x i =x j Sot Algoithm Bucket Sot Dn Shpi Hsh Tbles fo (i=;i

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

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

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

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 Tble of Contents: Week 1: Preliminries (set lgebr, reltions, functions) (red Chpters 1-4) Weeks

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

( ) D x ( s) if r s (3) ( ) (6) ( r) = d dr D x

( ) D x ( s) if r s (3) ( ) (6) ( r) = d dr D x SIO 22B, Rudnick dpted fom Dvis III. Single vile sttistics The next few lectues e intended s eview of fundmentl sttistics. The gol is to hve us ll speking the sme lnguge s we move to moe dvnced topics.

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

Today s Topics Automata and Languages

Today s Topics Automata and Languages Tody s Topics Automt nd Lnguges Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn DFA to Regulr Expression GFNA DFAèGNFA GNFA è RE DFA è RE Exmples 2 DFA è RE NFA DFA -NFA REX GNFA 3 Definition

More information

Automata and Languages

Automata and Languages Automt nd Lnguges Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Tody s Topics DFA to Regulr Expression GFNA DFAèGNFA GNFA è RE DFA è RE Exmples 2 DFA è RE NFA DFA -NFA REX GNFA 3 Definition

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

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

10 Statistical Distributions Solutions

10 Statistical Distributions Solutions Communictions Engineeing MSc - Peliminy Reding 1 Sttisticl Distiutions Solutions 1) Pove tht the vince of unifom distiution with minimum vlue nd mximum vlue ( is ) 1. The vince is the men of the sques

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

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

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

FI 2201 Electromagnetism

FI 2201 Electromagnetism FI 1 Electomgnetism Alexnde A. Isknd, Ph.D. Physics of Mgnetism nd Photonics Resech Goup Electosttics ELECTRIC PTENTIALS 1 Recll tht we e inteested to clculte the electic field of some chge distiution.

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

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

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

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

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

Some Theory of Computation Exercises Week 1

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

More information

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

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

More information

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

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