Theory of Computation Regular Languages

Size: px
Start display at page:

Download "Theory of Computation Regular Languages"

Transcription

1 Theory of Computtion Regulr Lnguges Bow-Yw Wng Acdemi Sinic Spring 2012 Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

2 Schemtic of Finite Automt control Figure: Schemtic of Finite Automt A finite utomton hs finite set of control sttes. A finite utomton reds input symbols from left to right. A finite utomton ccepts or rejects n input fter reding the input. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

3 Finite Automton M q 1 q 2 q 3 0, 1 Figure: A Finite Automton M 1 Figure 2 shows the stte digrm of finite utomton M 1. M 1 hs 3 sttes: q 1, q 2, q 3 ; strt stte: q 1 ; ccept stte: q 2 ; trnsitions: q 1 q 1, q 1 q 2, q 2 q 2, q 2 q 3, q 3 q 2, 1 nd q 3 q 2. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

4 Accepted nd Rejected String q 1 q 2 q 3 0, 1 Consider n input string M 1 processes the string from the strt stte q 1. It tkes the trnsition lbeled by the current symbol nd moves to the next stte. At the end of the string, there re two cses: If M1 is t n ccept stte, M 1 outputs ccept; Otherwise, M1 outputs reject. Strings ccepted by M 1 : 1, 01, 11, 1100, 1101,.... Strings rejected by M 1 : 0, 00, 10, 010, 1010,.... Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

5 Finite Automton Forml Definition A finite utomton is 5-tuple (Q, Σ, δ, q 0, F) where Q is finite set of sttes; Σ is finite set clled lphbet; δ : Q Σ Q is the trnsition function; q 0 Q is the strt stte; nd F Q is the set of ccept sttes. Accept sttes re lso clled finl sttes. The set of ll strings tht M ccepts is clled the lnguge of mchine M (written L(M)). Recll lnguge is set of strings. We lso sy M recognizes (or ccepts) L(M). Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

6 M 1 Forml Definition A finite utomton M 1 = (Q, Σ, δ, q 1, F) consists of Q = {q 1, q 2, q 3 }; Σ = {0, 1}; δ : Q Σ Q is 0 1 q1 is the strt stte; nd F = {q 2 }. Moreover, we hve q 1 q 1 q 2 q 2 q 3 q 2 q 3 q 2 q 2 L(M 1 ) = {w : w contins t lest one 1 nd n even number of 0 s follow the lst 1} Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

7 Finite Automton M q 1 q 2 0 Figure: Finite Automton M 2 Figure 3 shows M 2 = ({q 1, q 2 }, {0, 1}, δ, q 1, {q 2 }) where δ is Wht is L(M 2 )? L(M2 ) = {w : w ends in 1}. 0 1 q 1 q 1 q 2 q 2 q 2 q 2 Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

8 Finite Automton M q 1 q 2 0 Figure: Finite Automton M 2 Figure 3 shows M 2 = ({q 1, q 2 }, {0, 1}, δ, q 1, {q 2 }) where δ is Wht is L(M 2 )? L(M2 ) = {w : w ends in 1}. 0 1 q 1 q 1 q 2 q 2 q 2 q 2 Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

9 Finite Automton M q 1 q 2 0 Figure: Finite Automton M 3 Figure 4 shows M 3 = ({q 1, q 2 }, {0, 1}, δ, q 1, {q 1 }) where δ is Wht is L(M 3 )? 0 1 q 1 q 1 q 2 q 2 q 2 q 2 L(M3 ) = {w : w is the empty string ɛ or ends in 0}. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

10 Finite Automton M q 1 q 2 0 Figure: Finite Automton M 3 Figure 4 shows M 3 = ({q 1, q 2 }, {0, 1}, δ, q 1, {q 1 }) where δ is Wht is L(M 3 )? 0 1 q 1 q 1 q 2 q 2 q 2 q 2 L(M3 ) = {w : w is the empty string ɛ or ends in 0}. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

11 Finite Automton M 5 0 2, RESET q q 0 q 2 0, RESET 1, RESET Figure: Finite Automton M 5 Figure 5 shows M 5 = ({q 0, q 1, q 2 }, {0, 1, 2, RESET }, δ, q 0, {q 0 }). Strings ccepted by M 5 : 0, 00, 12, 21, 012, 102, 120, 021, 201, 210, 111, 222,.... M 5 computes the sum of input symbols modulo 3. It resets upon the input symbol RESET. M 5 ccepts strings who sum is multiple of 3. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

12 Computtion Forml Definition Let M = (Q, Σ, δ, q 0, F) be finite utomton nd w = w 1 w 2 w n string where w i Σ for every i = 1,..., n. We sy M ccepts w if there is sequence of sttes r 0, r 1,..., r n such tht r 0 = q 0 ; δ(r i, w i+1 ) = r i+1 for i = 0,..., n 1; nd r n F. M recognizes lnguge A if A = {w : M ccepts w}. Definition 1 A lnguge is clled regulr lnguge if some finite utomton recognizes it. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

13 Regulr Opertions Definition 2 Let A nd B be lnguges. We define the following opertions: Union: A B = {x : x A or x B}. Conctention: A B = {xy : x A nd y B}. Str: A = {x 1 x 2 x k : k 0 nd every x i A}. Note tht ɛ A for every lnguge A. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

14 Closure Property Union Theorem 3 The clss of regulr lnguges is closed under the union opertion. Tht is, A 1 A 2 is regulr if A 1 nd A 2 re. Proof. Let M i = (Q i, Σ, δ i, q i, F i ) recognize A i for i = 1, 2. Construct M = (Q, Σ, δ, q 0, F) where Q = Q 1 Q 2 = {(r 1, r 2 ) : r 1 Q 1, r 2 Q 2 }; δ((r 1, r 2 ), ) = (δ 1 (r 1, ), δ 2 (r 2, )); q 0 = (q 1, q 2 ); F = (F 1 Q 2 ) (Q 1 F 2 ) = {(r 1, r 2 ) : r 1 F 1 or r 2 F 2 }. Why is L(M) = A 1 A 2? Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

15 Nondeterminism When mchine is t given stte nd reds n input symbol, there is precisely one choice of its next stte. This is cll deterministic computtion. In nondeterministic mchines, multiple choices my exist for the next stte. A deterministic finite utomton is bbrevited s DFA; nondeterministic finite utomton is bbrevited s NFA. A DFA is lso n NFA. Since NFA llow more generl computtion, they cn be much smller thn DFA. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

16 NFA N 4 q 1 b ɛ q 2 q 3, b Figure: NFA N 4 On input string b, N 4 hs severl possible computtion: q 1 b q 2 q 2 q 2 ; b q 1 q 2 q 2 q 3 ; or b q 1 q 2 q 3 q 1. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

17 Nondeterministic Finite Automton Forml Definition For ny set Q, P(Q) = {R : R Q} denotes the power set of Q. For ny lphbet Σ, define Σ ɛ to be Σ {ɛ}. A nondeterministic finite utomton is 5-tuple (Q, Σ, δ, q 0, F) where Q is finite set of sttes; Σ is finite lphbet; δ : Q Σɛ P(Q) is the trnsition function; q0 Q is the strt stte; nd F Q is the ccept sttes. Note tht the trnsition function ccepts the empty string s n input symbol. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

18 NFA N 4 Forml Definition q 1 b ɛ q 2 q 3, b N 4 = (Q, Σ, δ, q 1, {q 1 }) is nondeterministic finite utomton where Q = {q 1, q 2, q 3 }; ɛ b q 1 {q 3 } {q 2 } q 2 {q 2, q 3 } {q 3 } q 3 {q 1 } Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

19 Nondeterministic Computtion Forml Definition Let N = (Q, Σ, δ, q 0, F) be n NFA nd w string over Σ. We sy N ccepts w if w cn be rewritten s w = y 1 y 2 y m with y i Σ ɛ nd there is sequence of sttes r 0, r 1,..., r m such tht r 0 = q 0 ; r i+1 δ(r i, y i+1 ) for i = 0,..., m 1; nd rm F. Note tht finitely mny empty strings cn be inserted in w. Also note tht one sequence stisfying the conditions suffices to show the cceptnce of n input string. Strings ccepted by N 4 :, b,.... Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

20 Equivlence of NFA s nd DFA s Theorem 4 Every nondeterministic finite utomton hs n equivlent deterministic finite utomton. Tht is, for every NFA N, there is DFA M such tht L(M) = L(N). Proof. Let N = (Q, Σ, δ, q 0, F) be n NFA. For R Q, define E(R) = {q : q cn be reched from R long 0 or more ɛ trnsitions }. Construct DFA M = (Q, Σ, δ, q 0, F ) where Q = P(Q); δ (R, ) = {q Q : q E(δ(r, )) for some r R}; q 0 = E({q 0}); F = {R Q : R F }. Why is L(M) = L(N)? Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

21 A DFA Equivlent to N 4 q 1 b ɛ, b q 2 q 3, b {q 1 } b {q 2 } {q 1, q 2 } b {q 3 } b {q 1, q 3 } b b {q 2, q 3 }, b b {q 1, q 2, q 3 } Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

22 Closure Properties Revisited Theorem 5 The clss of regulr lnguges is closed under the union opertion. Proof. Let N i = (Q i, Σ, δ i, q i, F i ) recognize A i for i = 1, 2. Construct N = (Q, Σ, δ, q 0, F) where Q = {q 0 } Q 1 Q 2 ; F = F 1 F 2 ; nd δ(q, ) = δ 1 (q, ) q Q 1 δ 2 (q, ) q Q 2 {q 1, q 2 } q = q 0 nd = ɛ q = q 0 nd ɛ Why is L(N) = L(N 1 ) L(N 2 )? Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

23 Closure Properties Revisited Theorem 6 The clss of regulr lnguges is closed under the conctention opertion. Proof. Let N i = (Q i, Σ, δ i, q i, F i ) recognize A i for i = 1, 2. Construct N = (Q, Σ, δ, q 1, F 2 ) where Q = Q 1 Q 2 ; nd δ 1 (q, ) q Q 1 nd q F 1 δ δ(q, ) = 1 (q, ) q F 1 nd ɛ δ 1 (q, ) {q 2 } q F 1 nd = ɛ δ 2 (q, ) q Q 2 Why is L(N) = L(N 1 ) L(N 2 )? Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

24 Closure Properties Revisited Theorem 7 The clss of regulr lnguges is closed under the str opertion. Proof. Let N 1 = (Q 1, Σ, δ 1, q 1, F 1 ) recognize A 1. Construct N = (Q, Σ, δ, q 0, F) where Q = {q 0 } Q 1 ; F = {q 0 } F 1 ; nd δ 1 (q, ) q Q 1 nd q F 1 δ 1 (q, ) q F 1 nd ɛ δ(q, ) = δ 1 (q, ) {q 1 } q F 1 nd = ɛ {q 1 } q = q 0 nd = ɛ q = q 0 nd ɛ Why is L(N) = [L(N 1 )]? Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

25 Closure Properties Revisited Theorem 8 The clss of regulr lnguges is closed under complementtion. Proof. Let M = (Q, Σ, δ, q 0, F) be DFA recognizing A. Consider M = (Q, Σ, δ, q 0, Q \ F). We hve w L(M) if nd only if w L(M). Tht is, L(M) = A s required. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

26 Regulr Expressions Definition 9 R is regulr expression if R is for some Σ; ɛ; ; (R 1 R 2 ) where R i s re regulr expressions; (R 1 R 2 ) where R i s re regulr expressions; or (R 1 ) where R 1 is regulr expression. We write R + for R R. Hence R = R + ɛ. k {}}{ Moreover, write R k for R R R. Define R 0 = ɛ. We hve R = R 0 R 1 R n. L(R) denotes the lnguge described by the regulr expression R. Note tht {ɛ}. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

27 Exmples of Regulr Expressions For convenience, we write RS for R S. We my lso write the regulr expression R to denote its lnguge L(R). L(0 10 ) = {w : w contins single 1}. L(Σ 1Σ ) = {w : w hs t lest one 1}. L((ΣΣ) ) = {w : w is string of even length }. (0 ɛ)(1 ɛ) = {ɛ, 0, 1, 01}. 1 =. = {ɛ}. For ny regulr expression R, we hve R = R nd R ɛ = R. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

28 Exmples of Regulr Expressions For convenience, we write RS for R S. We my lso write the regulr expression R to denote its lnguge L(R). L(0 10 ) = {w : w contins single 1}. L(Σ 1Σ ) = {w : w hs t lest one 1}. L((ΣΣ) ) = {w : w is string of even length }. (0 ɛ)(1 ɛ) = {ɛ, 0, 1, 01}. 1 =. = {ɛ}. For ny regulr expression R, we hve R = R nd R ɛ = R. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

29 Exmples of Regulr Expressions For convenience, we write RS for R S. We my lso write the regulr expression R to denote its lnguge L(R). L(0 10 ) = {w : w contins single 1}. L(Σ 1Σ ) = {w : w hs t lest one 1}. L((ΣΣ) ) = {w : w is string of even length }. (0 ɛ)(1 ɛ) = {ɛ, 0, 1, 01}. 1 =. = {ɛ}. For ny regulr expression R, we hve R = R nd R ɛ = R. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

30 Exmples of Regulr Expressions For convenience, we write RS for R S. We my lso write the regulr expression R to denote its lnguge L(R). L(0 10 ) = {w : w contins single 1}. L(Σ 1Σ ) = {w : w hs t lest one 1}. L((ΣΣ) ) = {w : w is string of even length }. (0 ɛ)(1 ɛ) = {ɛ, 0, 1, 01}. 1 =. = {ɛ}. For ny regulr expression R, we hve R = R nd R ɛ = R. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

31 Exmples of Regulr Expressions For convenience, we write RS for R S. We my lso write the regulr expression R to denote its lnguge L(R). L(0 10 ) = {w : w contins single 1}. L(Σ 1Σ ) = {w : w hs t lest one 1}. L((ΣΣ) ) = {w : w is string of even length }. (0 ɛ)(1 ɛ) = {ɛ, 0, 1, 01}. 1 =. = {ɛ}. For ny regulr expression R, we hve R = R nd R ɛ = R. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

32 Exmples of Regulr Expressions For convenience, we write RS for R S. We my lso write the regulr expression R to denote its lnguge L(R). L(0 10 ) = {w : w contins single 1}. L(Σ 1Σ ) = {w : w hs t lest one 1}. L((ΣΣ) ) = {w : w is string of even length }. (0 ɛ)(1 ɛ) = {ɛ, 0, 1, 01}. 1 =. = {ɛ}. For ny regulr expression R, we hve R = R nd R ɛ = R. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

33 Exmples of Regulr Expressions For convenience, we write RS for R S. We my lso write the regulr expression R to denote its lnguge L(R). L(0 10 ) = {w : w contins single 1}. L(Σ 1Σ ) = {w : w hs t lest one 1}. L((ΣΣ) ) = {w : w is string of even length }. (0 ɛ)(1 ɛ) = {ɛ, 0, 1, 01}. 1 =. = {ɛ}. For ny regulr expression R, we hve R = R nd R ɛ = R. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

34 Regulr Expressions nd Finite Automt Lemm 10 If lnguge is described by regulr expression, it is regulr. Proof. We prove by induction on the regulr expression R. R = for some Σ. Consider the NFA N = ({q 1 {, q 2 }, Σ, δ, q 1, {q 2 }) where {q2 } r = q δ(r, y) = 1 nd y = otherwise R = ɛ. Consider the NFA N ɛ = ({q 1 }, Σ, δ, q 1, {q 1 }) where δ(r, y) = for ny r nd y. R =. Consider the NFA N = ({q 1 }, Σ, δ, q 1, ) where δ(r, y) = for ny r nd y. R = R 1 R 2, R = R 1 R 2, or R = R 1. By inductive hypothesis nd the closure properties of finite utomt. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

35 Regulr Expressions nd Finite Automt b b b ɛ b ɛ ɛ b b ɛ ɛ ɛ ɛ ɛ b ɛ (b ) ɛ Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

36 Regulr Expressions nd Finite Automt Lemm 11 If lnguge is regulr, it is described by regulr expression. For the proof, we introduce generliztion of finite utomt. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

37 Generlized Nondeterministic Finite Automt Definition 12 A generlized nondeterministic finite utomton is 5-tuple (Q, Σ, q strt, q ccept ) where Q is the finite set of sttes; Σ is the input lphbet; δ : (Q {q ccept }) (Q {q strt }) R is the trnsition function, where R denotes the set of regulr expressions; q strt is the strt stte; nd q ccept is the ccept stte. A GNFA ccepts string w Σ if w = w 1 w 2 w k where w i Σ nd there is sequence of sttes r 0, r 1,..., r k such tht r 0 = q strt ; r k = q ccept ; nd for every i, w i L(R i ) where R i = δ(q i 1, q i ). Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

38 Regulr Expressions nd Finite Automt Proof of Lemm. Let M be the DFA for the regulr lnguge. Construct n equivlent GNFA G by dding q strt, q ccept nd necessry ɛ-trnsitions. CONVERT (G): 1 Let k be the number of sttes of G. 2 If k = 2, then return the regulr expression R lbeling the trnsition from q strt to q ccept. 3 If k > 2, select q rip Q \ {q strt, q ccept }. Construct G = (Q, Σ, δ, q strt, q ccept ) where Q = Q \ {q rip }; for ny q i Q \ {q ccept } nd q j Q \ {q strt }, define δ (q i, q j ) = (R 1 )(R 2 ) (R 3 ) R 4 where R 1 = δ(q i, q rip ), R 2 = δ(q rip, q rip ), R 3 = δ(q rip, q j ), nd R 4 = δ(q i, q j ). 4 return CONVERT (G ). Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

39 Regulr Expressions nd Finite Automt Lemm 13 For ny GNFA G, CONVERT (G) is equivlent to G. Proof. We prove by induction on the number k of sttes of G. k = 2. Trivil. Assume the lemm holds for k 1 sttes. We first show G is equivlent to G. Suppose G ccepts n input w. Let q strt, q 1, q 2,..., q ccept be n ccepting computtion of G. We hve w q 1 w strt q1 q i w i+1 w j 1 i 1 qi q rip q rip w i w i+1 w j qi q rip w j q j q ccept. w Hence q 1 strt q1 q i 1 q j q ccept is computtion of G. Conversely, ny string ccepted by G is lso ccepted by G since the trnsition between q i nd q j in G describes the strings tking q i to q j in G. Hence G is equivlent to G. By inductive hypothesis, CONVERT (G ) is equivlent to G. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

40 Regulr Expressions nd Finite Automt q 1 q strt ɛ q 1 b b q 2, b q ccept ɛ q 2, b () DFA M (b) GNFA G q strt ɛ q 1 q strt b( b) b( b) q ccept q ccept (c) GNFA (d) GNFA Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

41 Regulr Expressions nd Finite Automt Theorem 14 A lnguge is regulr if nd only if some regulr expression describes it. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

42 Pumping Lemm Lemm 15 If A is regulr lnguge, then there is number p such tht for ny s A of length t lest p, there is prtition s = xyz with 1 for ech i 0, xy i z A; 2 y > 0; nd 3 xy p. Proof. Let M = (Q, Σ, δ, q 1, F) be DFA recognizing A nd p = Q. Consider ny string s = s 1 s 2 s n of length n p. Let r 1 = q 1,..., r n+1 be the sequence of sttes such tht r i+1 = δ(r i, s i ) for 1 i n. Since n + 1 p + 1 = Q + 1, there re 1 j < l p + 1 such tht r j = r l (why?). Choose x = s 1 s j 1, y = s j s l 1, nd z = s l s n. x y z Note tht r 1 r j, r j r l, nd r l r n+1 F. Thus M ccepts xy i z for i 0. Since j l, y > 0. Finlly, xy p for l p + 1. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

43 Applictions of Pumping Lemm Exmple 16 B = {0 n 1 n : n 0} is not regulr lnguge. Proof. Suppose B is regulr. Let p be the pumping length given by the pumping lemm. Choose s = 0 p 1 p. Then s B nd s p, there is prtition s = xyz such tht xy i z B for i 0. y 0 + or y 1 +. xz B. A contrdiction. y xyyz B. A contrdiction. Corollry 17 C = {w : w hs n equl number of 0 s nd 1 s} is not regulr lnguge. Proof. Suppose C is regulr. Then B = C 0 1 is regulr. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

44 Applictions of Pumping Lemm Exmple 18 F = {ww : w {0, 1} } is not regulr lnguge. Proof. Suppose F is regulr lnguge nd p the pumping length. Choose s = 0 p 10 p 1. By the pumping lemm, there is prtition s = xyz such tht xy p nd xy i z F for i 0. Since xy p, y 0 +. But then xz F. A contrdiction. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

45 Applictions of Pumping Lemm Exmple 19 D = {1 n2 : n 0} is not regulr lnguge. Proof. Suppose D is regulr lnguge nd p the pumping length. Choose s = 1 p2. By the pumping lemm, there is prtition s = xyz such tht y > 0, xy p, nd xy i z D for i 0. Consider the strings xyz nd xy 2 z. We hve xyz = p 2 nd xy 2 z = p 2 + y p 2 + p < p 2 + 2p + 1 = (p + 1) 2. Since y > 0, we hve p 2 = xyz < xy 2 z < (p + 1) 2. Thus xy 2 z D. A contrdiction. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

46 Applictions of Pumping Lemm Exmple 20 E = {0 i 1 j : i > j} is not regulr lnguge. Proof. Suppose E is regulr lnguge nd p the pumping length. Choose s = 0 p+1 1 p. By the pumping lemm, there is prtition s = xyz such tht y > 0, xy p, nd xy i z E for i 0. Since xy p, y 0 +. But then xz E for y > 0. A contrdiction. Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring / 38

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

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

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

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

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

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

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

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

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

More information

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

Lecture 08: Feb. 08, 2019

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

More information

CHAPTER 1 Regular Languages. Contents

CHAPTER 1 Regular Languages. Contents Finite Automt (FA or DFA) CHAPTE 1 egulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, euivlence of NFAs nd DFAs, closure under regulr

More information

NFAs continued, Closure Properties of Regular Languages

NFAs continued, Closure Properties of Regular Languages Algorithms & Models of Computtion CS/ECE 374, Fll 2017 NFAs continued, Closure Properties of Regulr Lnguges Lecture 5 Tuesdy, Septemer 12, 2017 Sriel Hr-Peled (UIUC) CS374 1 Fll 2017 1 / 31 Regulr Lnguges,

More information

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

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

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

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

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

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1 Non Deterministic Automt Forml Lnguges nd Automt - Yonsei CS 1 Nondeterministic Finite Accepter (NFA) We llow set of possible moves insted of A unique move. Alphbet = {} Two choices q 1 q2 Forml Lnguges

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

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

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

Deterministic Finite-State Automata

Deterministic Finite-State Automata Deterministic Finite-Stte Automt Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 12 August 2013 Outline 1 Introduction 2 Exmple DFA 1 DFA for Odd number of

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

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

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

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

Nondeterminism and Nodeterministic Automata

Nondeterminism and Nodeterministic Automata Nondeterminism nd Nodeterministic Automt 61 Nondeterminism nd Nondeterministic Automt The computtionl mchine models tht we lerned in the clss re deterministic in the sense tht the next move is uniquely

More information

Finite 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

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

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

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

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

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

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

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

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

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

More information

NFAs continued, Closure Properties of Regular Languages

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

More information

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

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

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

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

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 CMSC 330 1 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All exmples so fr Nondeterministic

More information

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

Automata and Languages

Automata and Languages Automt nd Lnguges Prof. Mohmed Hmd Softwre Engineering Lb. The University of Aizu Jpn Grmmr Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Regulr Lnguges Context Free Lnguges Context Sensitive

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

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

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

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

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

More information

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

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

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb. CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2 CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

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

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

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

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

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

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

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

Lecture 6 Regular Grammars

Lecture 6 Regular Grammars Lecture 6 Regulr Grmmrs COT 4420 Theory of Computtion Section 3.3 Grmmr A grmmr G is defined s qudruple G = (V, T, S, P) V is finite set of vribles T is finite set of terminl symbols S V is specil vrible

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

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

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

More information

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

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

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

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

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

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

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

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata CSC4510 AUTOMATA 5.1 Definitions nd Exmples 5.2 Deterministic Pushdown Automt Definitions nd Exmples A lnguge cn be generted by CFG if nd only if it cn be ccepted by pushdown utomton. A pushdown utomton

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

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

Chapter 4 Regular Grammar and Regular Sets. (Solutions / Hints)

Chapter 4 Regular Grammar and Regular Sets. (Solutions / Hints) C K Ngpl Forml Lnguges nd utomt Theory Chpter 4 Regulr Grmmr nd Regulr ets (olutions / Hints) ol. (),,,,,,,,,,,,,,,,,,,,,,,,,, (),, (c) c c, c c, c, c, c c, c, c, c, c, c, c, c c,c, c, c, c, c, c, c, c,

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

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

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

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

Name Ima Sample ASU ID

Name Ima Sample ASU ID Nme Im Smple ASU ID 2468024680 CSE 355 Test 1, Fll 2016 30 Septemer 2016, 8:35-9:25.m., LSA 191 Regrding of Midterms If you elieve tht your grde hs not een dded up correctly, return the entire pper to

More information

1 Structural induction

1 Structural induction Discrete Structures Prelim 2 smple questions Solutions CS2800 Questions selected for Spring 2018 1 Structurl induction 1. We define set S of functions from Z to Z inductively s follows: Rule 1. For ny

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

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

Finite Automata Part Three

Finite Automata Part Three Finite Automt Prt Three Hello Hello Wonderful Wonderful Condensed Condensed Slide Slide Reders! Reders! The The first first hlf hlf of of this this lecture lecture consists consists lmost lmost exclusively

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

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

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.6.: Push Down Automt Remrk: This mteril is no longer tught nd not directly exm relevnt Anton Setzer (Bsed

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

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

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

Introduction to ω-autamata

Introduction to ω-autamata Fridy 25 th Jnury, 2013 Outline From finite word utomt ω-regulr lnguge ω-utomt Nondeterministic Models Deterministic Models Two Lower Bounds Conclusion Discussion Synthesis Preliminry From finite word

More information

1 Structural induction, finite automata, regular expressions

1 Structural induction, finite automata, regular expressions Discrete Structures Prelim 2 smple uestions s CS2800 Questions selected for spring 2017 1 Structurl induction, finite utomt, regulr expressions 1. We define set S of functions from Z to Z inductively s

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

Probabilistic Model Checking Michaelmas Term Dr. Dave Parker. Department of Computer Science University of Oxford

Probabilistic Model Checking Michaelmas Term Dr. Dave Parker. Department of Computer Science University of Oxford Probbilistic Model Checking Michelms Term 2011 Dr. Dve Prker Deprtment of Computer Science University of Oxford Long-run properties Lst lecture: regulr sfety properties e.g. messge filure never occurs

More information

Languages & Automata

Languages & Automata Lnguges & Automt Dr. Lim Nughton Lnguges A lnguge is sed on n lphet which is finite set of smols such s {, } or {, } or {,..., z}. If Σ is n lphet, string over Σ is finite sequence of letters from Σ, (strings

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

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

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