Chap. 2 Finite Automata

Size: px
Start display at page:

Download "Chap. 2 Finite Automata"

Transcription

1 Chap. 2 Finite Automata 2.1 An Informal Picture of Finite Automata (See 2nd Edition) A man with a wolf, goat, and cabbage is on the left bank of a river A boat carries one man and only one of the other three. The wolf eats the goat without the man. The goat eats the cabbage without the man. Is it possible to cross the river without the goat or cabbage being eaten? states: occupants of each bank after a crossing 16 subsets of the man(m), wolf(w), goat(g), and cabbage(c). 16 states: mwgc-, WC-mG,, -mwgc input symbol: four ways of crossing the river A man crosses alone(m) with the wolf(w), goat(g), or cabbage(c). input string: a sequence of crossings (input symbols = {m, w, g, c}) state transition: From a state to another state by an input symbol (crossing) 9/14/17 Kwang-Moo Choe 1

2 mcgw- m,c,w,g -mcgw g g m,c,w m-cgw mc-gw mw-cg m,c,w g g CW-mG m m mg-cw m mcw-g m c c w w W-mCG mgw-c w w m m m G-mCW C-mGW g g g g m mcg-w c c 9/14/17 Kwang-Moo Choe 2

3 2.2 Deterministic Finite Automata(DFA) Definition of a DFA A deterministic finite automaton A = (Q, T,, q 0, F) consists of: 1. A finite set of states, denoted Q, 2. A finite set of input symbols, denoted T, in the text 3. A transition function, : Q T Q Let p, q Q, and a T, if we write (q, a) = p, meaning that when current state is in q and input symbol is a, the current state is changed to p, and input symbol is changed to the next(right) one. 4. A start(initial) state, q 0 Q, and 5. A set of final or accepting states, F Q. A DFA A = (Q, T,, q 0, F) five-tuple notation 9/14/17 Kwang-Moo Choe 3

4 2.2.2 How a DFA Processes Strings How a DFA decides whether or not accept a input string(sequence of input symbols) Suppose a 1 a 2 a n is a sequence of input symbols 1. We start out the DFA with in its start state q We consult the transition function,, with current state and current input symbol, assume in the first trial (q 0, a 1 ) = q 1, 3. Repeat this step with the next state q 1 and the next input symbol a 2. Assume (q 1, a 2 ) = q 2, (q 2, a 3 ) = q 3,, (q n-1, a n ) = q n. 4. Finally, check if (q n-1, a n ) = q n F or not. If q n F, accept a 1 a 2 a n. If q n F does not accept a 1 a 2 a n. ( ( ( (q 0, a 1 ), a 2 ), ), a n-1 ), a n ) = q n where (q i-1, a i ) = q i for 1 i n. 9/14/17 Kwang-Moo Choe 4

5 function DFA( D = (Q:set of states, T:set of symbols, : Q Q, q 0 Q, F Q); x = a 1 a 2 a n T * ) /* (D; x T * ) are two formal parameters */ /* D has five tuples, D = (Q, T,, q 0, F) */ return {D accept x, D accept x} q Q, i N; /* q and i are two local variables */ q, i := q 0, 1; do i n if (q, a i ) q, i := (q, a i ), i+1 (q, a i ) return D accept x fi od if q F return D accept x q F return D accept x fi end function DFA. 9/14/17 Kwang-Moo Choe 5

6 2.2.3 Simple notations for DFA s Example 2.2 Let T = {0, 1} and L = {x01y T * x, y T * }. substring 01. (0 1) * 01(0 1) *. 1. Transition diagram Figure 2.4 in p , 1 0 q 0 q 1 1 q 2 State q 0 : initial state If it sees 0, go to a new state q 1. If it sees 1 stay in the state q 0. It has never seen 0. State q 1 : The last symbol it has seen is 0. If it sees 1, go to a new state q 2. If it sees 0, stay in the state q 1. State q 2 : It has ever seen is 01. final state Whether it sees 0 or 1, stay in the state q 2. 9/14/17 Kwang-Moo Choe 6

7 2. Transition table Figure 2.5 in p q 0 q 1 q 0 q 1 q 1 q 2 * q 2 q 2 q 2 Formal definition of DFA D D = (Q, T,, q 0, F) where 1. Q = {q 0, q 1, q 2 } 2. T = {0, 1} 3. = { (q 0, 0)=q 1, (q 0, 1)=q 0, (q 1, 0)=q 1, (q 1, 1)=q 2, (q 2, 0)=q 2, (q 2, 1)=q 2 } 4. q 0 Q 5. F = {q 2 } 9/14/17 Kwang-Moo Choe 7

8 2.2.4 Extend the domain of transition function from symbols to strings : Q T Q ^: Q T * Q ^(q, ) = B q basis ^(q, xa) = R ( ^(q, x), a) recursion (2.1) q Q, x T *, a, xa T +. ^(q 0, a 1 a 2 a n ) = R ( ^(q 0, a 1 a 2 a n-1 ), a n ) 1st recursion = R ( ( ^(q 0, a 1 a 2 a n-2 ), a n-1 ), a n ) 2nd recursion = R = R ( ( ( ( ^(q 0, ), a 1 ), a 2 ), ), a n-1 ), a n ) n-th recursion = B ( ( ( (q 0, a 1 ), a 2 ), ), a n-1 ), a n ) basis We may use * instead of ^ to show that the 2nd domain of is T *. 9/14/17 Kwang-Moo Choe 8

9 Example 2.4 in p q 0 1 q Even numbers of 0 s and even numbers of 1 s. q The Language of DFA We define the language of a DFA D = (Q, T,, q 0, F), L(D), L(D) = {w T * * (q 0, w) F}. L(D) T * or L(D) 2 T* q 3 9/14/17 Kwang-Moo Choe 9

10 Def. A Class of Regular languages Let L be a language. If L = L(A) for some DFA A, then we say L is a regular language. A class of regular languages type-3 languages in Chomsky s language hierarchy Automata M 1 M 2 DFA L L L L Languages 2 T* regular L Def. Equivalence of two Automata Let M 1 and M 2 be two automata. We say two automata M 1 and M 2 are equivalent, if L(M 1 ) = L(M 2 ) = L. 9/14/17 Kwang-Moo Choe 10

11 DFA: : Q T Q q Q, a T, (q, a) Q. (total) function q Q, a T \ (q, a). partial function If A = (Q, T,, q 0, F) be a FA with : Q T \ Q partial function, L(A) = L(B) for DFA B = (Q {d}, T,, q 0, F) where d Q, DFA but partial function: : Q T Q { }. = { (q, a) = d (q, a) Q} { (d, a) = d a T} d: dead state in B is the DFA(with total function) but? : Q T Q. Dead state: m cgw, mc gw, mw cg state in the 1st Example. eliminate the state and relevant transition functions partial function. DFA with partial function can be considered as a DFA. 9/14/17 Kwang-Moo Choe 11

12 2.3 Nondeterministic Finite Automata(NFA) An Informal View of NFA Example 2.9 An NFA accepting all strings that ends in 01(postfix 01). Fig. 2.9(p. 56) 0, 1 0 q 0 q 1 1 q 2 Consider an input string {0, 1} *. q 0 0 q 1 0 X(stuck) q 0 0 q 0 0 q 1 1 q 2 0 X(stuck) q 0 0 q 0 0 q 0 1 q 0 0 q 0 1 q 0 F(fail) q 0 0 q 0 0 q 0 1 q 0 0 q 1 1 q 2 F(success) 9/14/17 Kwang-Moo Choe 12

13 2.3.2 Definition of NFA A = (Q, T,, q 0, F) is a nondeterministic finite automaton(nfa), if 1. Q is a finite set of states, 2. T is a finite set of input symbols, 3. is a transition function, : Q T 2 Q. If q Q, a T, and {p 1, p 2,, p n } Q (1 i n, p i Q) then we write (q, a) = {p 1, p 2,, p n }, meaning that when current state is in q and input symbol is a, the state may be changed to any one of p 1, p 2,, p n, and input symbol is changed to the next(right) one. 4. q 0 Q is a start state, and 5. F Q is a set of final or accepting states. 9/14/17 Kwang-Moo Choe 13

14 2.3.3 The Extended Transition Function DFA: : Q T Q Definition * : Q T * Q ^: Q * Q in the text NFA: : Q T 2 Q Definition : 2 Q T 2 Q (1) set extension in this lecture * : 2 Q T * 2 Q (2) string extension in this lecture ^: Q * 2 Q in the text Two step extensions 1. Set extension: : We extend the 1st domain of to set of states. : 2 Q T 2 Q. Let P Q. Then we define (P, a) = {q Q p P, q (p, a)} or = p P (p, a) We may write (p, a) instead of ({p}, a) when needed. 9/14/17 Kwang-Moo Choe 14

15 2. String extension: * (same as ^ = * ) * : 2 Q T * 2 Q. * (P, ) = B P basis * (P, wa) = R ( * (P, w), a) recursion P Q(or P 2 Q ), w T *, a T, wa T +. We may write and * instead of and * since The Language of an NFA Let N = (Q,,, q 0, F) be an NFA. Then the language defined by the NFA N, denoted as L(N) is, L(N) = {w T * * (q 0, w) F }. L(N) T * or L(N) 2 T*. 9/14/17 Kwang-Moo Choe 15

16 2.3.5 Equivalence of DFA and NFA Example 2.10 NFA of Fig. 2.9(p. 56) postfix 01. 0, 1 0 q 0 q 1 1 q 2 Transition table for NFA 0 1 q 0 {q 0, q 1 } {q 0 } (q 0, 0) = {q 0, q 1 }: NFA q 1 {q 2 } * q 2 Transition table for subsets of NFA 2 3 = 8 subset-states(see Fig. 2.12) {q 0, q 1 } {q 0, q 1 } {q 0, q 2 } {q 0 } {q 0, q 1 } {q 0 } * {q 0, q 2 } {q 0, q 1 } {q 0 } {q 1 } {q 2 } * {q 1, q 2 } {q 2 } * {q 2 } * {q 0, q 1, q 2 } {q 0, q 1 } {q 0, q 2 } 9/14/17 Kwang-Moo Choe 16

17 Starting from {q 0 } See Fig in p {q 0 } {q 0, q 1 } {q 0 } [ ] [0] [ ] {q 0, q 1 } {q 0, q 1 } {q 0, q 2 } [0] [0] [01] * {q 0, q 2 } {q 0, q 1 } {q 0 } * [01] [0] [ ] Only 3 subset-states are reachable from the initial state {q 0 }. Renaming of states {q 0 } [ ], {q 0, q 1 } [0], and {q 0, q 2 } [01]. 1 0 [ ] 0 [0] 1 0 [01] 1 Fig DFA from NFA Fig. 2.9.(postfix 01) 9/14/17 Kwang-Moo Choe 17

18 Subset Construction(NFA DFA) Q D = 2 Q N. Given an NFA N = (Q N, T, N, q 0N, F N ), construct an equivalent DFA D = (Q D,, D, q 0D, F D ) such that L(D) = L(N). 1. Q D = {P P Q N } = 2 Q N. 3. D (P, a) = {q Q N p P Q N, q N (p, a)} Q N or Q D. or = p P N (p, a) or = N (P, a) set extension of N. D (P, a) = N (P, a) or D = N for short, where D : Q D T Q D and N : 2 Q N T 2 Q N(Q D = 2 Q N). 4. q 0D ( Q D ) = {q 0N }( Q N ). 5. F D = {F Q D F F N } 9/14/17 Kwang-Moo Choe 18

19 Thm L(D) = L(N) in the above subset construction Proof * D (q 0D, w) = N * ({q 0N }, w) for all w *. D * : Q D T * Q D (= 2 Q N * 2 Q N). N * : 2 Q N T * 2 Q N. We may use q 0N instead of {q 0N }. Induction on w. basis: Let w = 0, * D (q 0D, ) = * D ({q 0N }, ) = {q 0N }= ^N ({q 0N }, ). induction: Let w = xa where a T, x T *, and w T +. ( w = x + 1) * D (q 0D, xa) = D ( * D ({q 0N }, x), a) by string extension of * D. = N ( D * ({q 0N }, x), a) by subset construction = N ( N * ({q 0N }, x), a) by induction hypothesis = N * ({q 0N }, xa) by string extension of N *. D * (q 0D, x) F D, if and only if, N * (q 0, x) F N. L(D) = L(N). 9/14/17 Kwang-Moo Choe 19

20 Thm A language L is defined by some DFA, if and only if L is defined by some NFA.(NFA DFA) Proof: (If) subset construction(nfa DFA) Thm (Only if) NFA can easily simulate DFA(DFA NFA). Let a DFA D = (Q, T, D, q 0, F). We define an NFA(Q, T, N, q 0, F) N (q, a) = {p D (q, a) = p}. Proof for w *, if and only if, ^ D (q, w) = p, then ^D (q, w) = {p}. L is regular, iff L = L(N) for some NFA N. Automata NFA N DFA D L L L L L L Languages 2 T* regular L 9/14/17 Kwang-Moo Choe 20

21 2.3.6 A Bad Case for the Subset Construction See Ex (p64-65) (0+1) * 1(0+1) n-1. The state of DFA summarizes the information concerning past inputs that is needed to determine the behaviour of the automata on subsequent inputs. Aho and Ullman in the 2nd Edition. [(0+1) * ] 1 [(0+1) * 1] 0 [(0+1) * 10] 0 [(0+1) * 100] * [(0+1) * 10 n-2 0] * [(0+1) * 10 n-2 1] 1 [(0+1) * 101] [(0+1) * 11] 0 [(0+1) * 110]... * [(0+1) * 11 n-2 0] 1 [(0+1) * 111] * [(0+1) * 11 n-2 1] 9/14/17 Kwang-Moo Choe 21

22 2.4 An Application: Text Search Read text 2.5 Finite Automata with Epsilon-Transitions A = (Q, T,, q 0, F) is a fa with epsilon transition( -NFA), if Q, T, q 0, and F are same as NFA, but 3. is a transition function, : Q (T { }) 2 Q. If q Q and {p 1, p 2,, p n } Q, then we write (q, ) = {p 1, p 2,, p n }, meaning that when current state is in q and regardless of input symbol the state may be changed to any one of p 1, p 2,, p n, and next input symbol is not changed. Ex in Fig for an -NFA accepting decimal numbers in p. 73. Ex in Fig for an -NFA accepting keywords web and ebay in p /14/17 Kwang-Moo Choe 22

23 2.5.3 Epsilon-closure basis: q * (q) (same as ECLOSE(q) in the text) recursion: If p * (q), and r (p, ), then r * (q). Example 2.19 in p. 74. Why * (q) instead of ECLOSE(q) Let = {(p, q) Q Q q (p, )}. Then Q Q(a binary relation on Q) and ECLOSE(q) = * (q) reflexive-transitive closure of. 9/14/17 Kwang-Moo Choe 23

24 2.5.4 The Extended Transition and Language for -NFA s NFA: : Q T 2 Q. -NFA: : Q (T { }) 2 Q. Let s divide of -NFA into 1 and 0 (= ). 1 : Q T 2 Q. 0 : Q { } 2 Q. = : is same as in NFA, we use instead of 1, since 1 =. 0 f what is the bijection f? We use instead of 0. = {(p, q) Q Q q (p, )} binary relation on Q. * = i N i 0 Q Q binary relation on Q., * : Q 2 Q. function from Q to 2 Q. 9/14/17 Kwang-Moo Choe 24

25 Let s extend the domain of (= 1 ),, and * from state to set of states. Let P Q, we define : 2 Q T 2 Q. (P, a) = {q Q p P, (p, a) = q} or = p P (p, a) We may write (p, a) instead of ({p}, a) when needed. We may write (P, a) instead of (P, a) when needed. : 2 Q 2 Q. (P) = {q Q p P, (p) = q} or = p P (p) * : 2 Q 2 Q. * (P) = {q Q p P, * (p) = q} = p P * (p) We write (P) instead of (P) and * (P) instead of * (P). 9/14/17 Kwang-Moo Choe 25

26 Let s extend the 2nd domain of from symbol to strings. * : 2 Q T * 2 Q. * (P, ) = B * (P) basis * (P, wa) = R * ( ( * (P, w), a)) recursion P Q(or P 2 Q ), w *, a T, wa T +. n (q 0, a 1 a 2 a n ) = R * ( ( n-1 (q 0, a 1 a 2 a n-1 ), a n )) 1st recursion = R * ( ( * ( ( n-2 (q 0, a 1 a 2 a n-2 ), a n-1 )), a n )) 2nd recursion = R = R * ( ( * ( ( * ( ( * ( ( 0 (q 0, ), a 1 )), a 2 )), )), a n-1 )), a n )) n-th = B * ( ( * ( ( * ( ( * ( ( * (q 0 ), a 1 )), a 2 )), )), a n-1 )), a n )) basis n = * * * = * ( * ) n = * ( 1 ) n. where 1 = *. * = i N 0 i = *. 9/14/17 Kwang-Moo Choe 26

27 2.5.5 Eliminating -Transitions Given an -NFA E = (Q E, T, E, q 0E, F E ), construct the equivalent DFA D = (Q D, T, D, q 0D, F D ) such that L(D) = L(N). 1. Q D = {P P Q E } = 2 Q E. 3. q 0D = * ({q 0E }) 4. D (P, a) = * ( E (P, a)) set extension of E and -closure( 1 = * ) where P Q E (P Q D ), a T, and D (P, a) Q E (or D (P, a) Q D ) 5. F D = {F Q D F F E } Theorem 2.22 A language L is accepted by some -NFA if and only if L is accepted by some DFA. Proof: (If) -NFA can easily simulate DFA(DFA -NFA). (Only if) Eliminating -transitions( -NFA DFA) 9/14/17 Kwang-Moo Choe 27

28 Let E = (Q E, T, E, q 0E, F E ) be a -NFA and DFA D = (Q D,, D, q 0D, F D ) is the one in We show E * (q 0E, w) = D * (q 0D, w) by induction on w. basis: * E (q 0E, ) = * (q 0E ) by basis definition of * E. = q 0D by construction of D. = D * (q 0D, ) by basis definition of D *. Induction: Let w = xa T +, a T, and x T *. E * (q 0, xa) = E ( * ( E * (q 0, x), a) by recursive definition of E *. = E ( * ( D * (q 0D, x), a)) by induction hypothesis. = D ( D * (q 0D, x), a) by construction of D. = D * (q 0D, xa) by recursive definition of D *. 9/14/17 Kwang-Moo Choe 28

29 -NFA Transition Table for Fig in p ,. d * q 0 {q 1 } q 0 {q 1 } {q 0, q 1 } q 1 {q 2 } {q 1, q 4 } q 1 {q 1 } q 2 {q 3 } q 2 {q 2 } * q 3 {q 3 } q 3 {q 5 } {q 3, q 5 } q 4 {q 3 } q 4 {q 4 } q 5 q 5 {q 5 } DFA Transition Table for Fig in p. 79. * 1 * +,. d {q 0, q 1 } {q 1 } {q 2 } {q 1, q 4 } {q 1 } {q 2 } {q 1, q 4 } {q 2 } {q 3, q 5 } {q 1, q 4 } {q 2, q 3, q 5 } {q 1, q 4 } * {q 3, q 5 } {q 3, q 5 } * {q 2, q 3, q 5 } {q 3, q 5 } 9/14/17 Kwang-Moo Choe 29

30 2.A Extended Finite Automata(XFA) X = (Q, T, q 0,, F) is an extended Finite state Automata(XFA), if : Q T * 2 Q. Given an XFA X = (Q X, T, q 0, X, F), construct an equivalent -NFA E = (Q E, T, q 0, E, F) such that L(X) = L(E). Construction algorithm Q E := Q X ; E := ; for ( X (q, x) = P) X where x = a 1 a 2 a n do if 0 n 1 E := E { E (q, x) = P} where x { } n 2 Q E := Q E {p 1 }; E := E { E (q, a 1 ) = {p 1 }}; od for 2 i n do Q E :=Q E {p i }; E := E { E (p i-1, a i )= {p i }} od; E := E { E (p n-1, a n ) = P} where Q X {p 1, p 2,, p n-1 } fi 9/14/17 Kwang-Moo Choe 30

31 XFA s = -NFA s = NFA s = DFA s = Class of regular languages = FA s Automata XFA=FA X -NFA E NFA N DFA D L(X) L(N) L(E) L(D) Languages 2 T* regular L 9/14/17 Kwang-Moo Choe 31

32 The following six statements are equivalent, 1. A language L is regular. 2. L = L(D) for some DFA D where : Q T Q. 3. L = L(P) for some DFA P where : Q T Q { }. with partial function. 4. L = L(N) for some NFA N where : Q T 2 Q. 5. L = L(E) for some -NFA E where : Q ({ } T) 2 Q. 6. L = L(X) for some XFA X where : Q T * 2 Q. The following two statements are equivalent, 1. A language L is regular. 2. L = L(A) for some FA A where : Q T * 2 Q. We ve changed the definition of FA from DFA to XFA. 9/14/17 Kwang-Moo Choe 32

33 2.B Configuration rewriting system for FA Let A = (Q, T,, q 0, F) be a Finite automata where : Q T * 2 Q.Then A configuration rewritng system R A = (Q T *, ) on Q T * is = {(q, x) (p, ) p (q, x)}. (q, x), (p, ) Q T * : configurations Assume x = x 1 x 2...x n T * and 1 i n: q i (q i-1, x i ). Then x q 1 x 2 x 3 x 0 q 1 q 2 n-1 x q n n-1 q n (... ( (q 0, x 1 ), x 2 ),..., x n-1 ), x n ) = q 1 (q 0, x 1 ) ( (... (q 1, x 2 ),...,x n-1 ) x n ) =... = (q n-2, x n-1 ), x n ) = q n-1 (q n-2, x n-1 ) (q n-1, x n ) = q n (q n-1, x n ) q n. (q 0, x 1 x 2...x n-1 x n ) (q 0, x 1 ) (q 1, ) (q 1, x 2...x n-1 x n )... (q n-2, x n-1 x n ) (q n-2, x n-1 ) (q n-1, ) (q n-1, x n ) (q n-1, x n ) (q n, ) (q n, ). L(R A ) = {x T * (q 0, x) * (f, ), f F}. 9/14/17 Kwang-Moo Choe 33

34 Read this page for the minimal state DFA TBD in Chap. 4. Consider a language L T * and a binary relation R L on T * where x, y * : x R L y, if z T * : xz, yz L or xz, yz L. Then R L is an equivalent(proof? ) binary relation on T *. Consider a DFA M = (Q, T,, q 0, F) and a binary relation R M on T * x, y * : x R M y, if * (q 0, x) = * (q 0, y). Then Par RM ( * ) Q. Compare two quivalent relation on T *, R L and R M where L = L(M). Par RL (T * ) Par RM (T * ) in general. If Par RL (T * ) = Par RM (T * ) for some M = (Q, T,, q 0, F ). M is a minimal state DFA that accepting L. 9/14/17 Kwang-Moo Choe 34

Chap. 2 Finite Automata

Chap. 2 Finite Automata Chap. 2 Finite Automata 2.1 An Informal Picture of Finite Automata (See 2nd Edition) A man with a wolf, goat, and cabbage is on the left bank of a river A boat carries one man and only one of the other

More information

Chap. 2 Finite Automata

Chap. 2 Finite Automata Chap. 2 Finite Automata 2.1 An Informal Picture of Finite Automata A man with a wolf, goat, and cabbage is on the left bank of a river A boat carries one man and only one of the other three. The wolf eats

More information

Finite Automata. BİL405 - Automata Theory and Formal Languages 1

Finite Automata. BİL405 - Automata Theory and Formal Languages 1 Finite Automata BİL405 - Automata Theory and Formal Languages 1 Deterministic Finite Automata (DFA) A Deterministic Finite Automata (DFA) is a quintuple A = (Q,,, q 0, F) 1. Q is a finite set of states

More information

Automata and Formal Languages - CM0081 Determinist Finite Automata

Automata and Formal Languages - CM0081 Determinist Finite Automata Automata and Formal Languages - CM0081 Determinist Finite Automata Andrés Sicard-Ramírez Universidad EAFIT Semester 2018-2 Formal Languages: Origins Source areas [Greibach 1981, p. 14] Logic and recursive-function

More information

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA) Deterministic Finite Automata Non deterministic finite automata Automata we ve been dealing with have been deterministic For every state and every alphabet symbol there is exactly one move that the machine

More information

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata Automata and Formal Languages - CM81 Non-Deterministic Finite Automata Andrés Sicard-Ramírez Universidad EAFIT Semester 217-2 Non-Deterministic Finite Automata (NFA) Introduction q i a a q j a q k The

More information

Theory of Computation

Theory of Computation Theory of Computation COMP363/COMP6363 Prerequisites: COMP4 and COMP 6 (Foundations of Computing) Textbook: Introduction to Automata Theory, Languages and Computation John E. Hopcroft, Rajeev Motwani,

More information

CS Pushdown Automata

CS Pushdown Automata Chap. 6 Pushdown Automata 6.1 Definition of Pushdown Automata Example 6.2 L ww R = {ww R w (0+1) * } Palindromes over {0, 1}. A cfg P 0 1 0P0 1P1. Consider a FA with a stack(= a Pushdown automaton; PDA).

More information

Algorithms for NLP

Algorithms for NLP Regular Expressions Chris Dyer Algorithms for NLP 11-711 Adapted from materials from Alon Lavie Goals of Today s Lecture Understand the properties of NFAs with epsilon transitions Understand concepts and

More information

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is, Recall A deterministic finite automaton is a five-tuple where S is a finite set of states, M = (S, Σ, T, s 0, F ) Σ is an alphabet the input alphabet, T : S Σ S is the transition function, s 0 S is the

More information

CS 455/555: Finite automata

CS 455/555: Finite automata CS 455/555: Finite automata Stefan D. Bruda Winter 2019 AUTOMATA (FINITE OR NOT) Generally any automaton Has a finite-state control Scans the input one symbol at a time Takes an action based on the currently

More information

Lecture 1: Finite State Automaton

Lecture 1: Finite State Automaton Lecture 1: Finite State Automaton Instructor: Ketan Mulmuley Scriber: Yuan Li January 6, 2015 1 Deterministic Finite Automaton Informally, a deterministic finite automaton (DFA) has finite number of s-

More information

Finite Automata. Theorems - Unit I SUSAN ELIAS. Professor Department of Computer Science & Engineering Sri Venkateswara College of Engineering

Finite Automata. Theorems - Unit I SUSAN ELIAS. Professor Department of Computer Science & Engineering Sri Venkateswara College of Engineering Finite Automata Theorems - Unit I SUSAN ELIAS Professor Department of Computer Science & Engineering Sri Venkateswara College of Engineering September 17, 2012 Unit I - Guidelines Formal Definitions Definition

More information

3515ICT: Theory of Computation. Regular languages

3515ICT: Theory of Computation. Regular languages 3515ICT: Theory of Computation Regular languages Notation and concepts concerning alphabets, strings and languages, and identification of languages with problems (H, 1.5). Regular expressions (H, 3.1,

More information

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA)

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA) Languages Non deterministic finite automata with ε transitions Recall What is a language? What is a class of languages? Finite Automata Consists of A set of states (Q) A start state (q o ) A set of accepting

More information

Chapter Two: Finite Automata

Chapter Two: Finite Automata Chapter Two: Finite Automata In theoretical computer science, automata theory is the study of abstract machines (or more appropriately, abstract 'mathematical' machines or systems) and the computational

More information

Lecture 5: Minimizing DFAs

Lecture 5: Minimizing DFAs 6.45 Lecture 5: Minimizing DFAs 6.45 Announcements: - Pset 2 is up (as of last night) - Dylan says: It s fire. - How was Pset? 2 DFAs NFAs DEFINITION Regular Languages Regular Expressions 3 4 Some Languages

More information

CS 154. Finite Automata, Nondeterminism, Regular Expressions

CS 154. Finite Automata, Nondeterminism, Regular Expressions CS 54 Finite Automata, Nondeterminism, Regular Expressions Read string left to right The DFA accepts a string if the process ends in a double circle A DFA is a 5-tuple M = (Q, Σ, δ, q, F) Q is the set

More information

Introduction to Finite-State Automata

Introduction to Finite-State Automata Introduction to Finite-State Automata John McDonough Language Technologies Institute, Machine Learning for Signal Processing Group, Carnegie Mellon University March 26, 2012 Introduction In this lecture,

More information

Finite Automata and Regular languages

Finite Automata and Regular languages Finite Automata and Regular languages Huan Long Shanghai Jiao Tong University Acknowledgements Part of the slides comes from a similar course in Fudan University given by Prof. Yijia Chen. http://basics.sjtu.edu.cn/

More information

Lecture 3: Nondeterministic Finite Automata

Lecture 3: Nondeterministic Finite Automata Lecture 3: Nondeterministic Finite Automata September 5, 206 CS 00 Theory of Computation As a recap of last lecture, recall that a deterministic finite automaton (DFA) consists of (Q, Σ, δ, q 0, F ) where

More information

CS243, Logic and Computation Nondeterministic finite automata

CS243, Logic and Computation Nondeterministic finite automata CS243, Prof. Alvarez NONDETERMINISTIC FINITE AUTOMATA (NFA) Prof. Sergio A. Alvarez http://www.cs.bc.edu/ alvarez/ Maloney Hall, room 569 alvarez@cs.bc.edu Computer Science Department voice: (67) 552-4333

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Not A DFA Does not have exactly one transition from every state on every symbol: Two transitions from q 0 on a No transition from q 1 (on either a or b) Though not a DFA,

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 6 CHAPTER 2 FINITE AUTOMATA 2. Nondeterministic Finite Automata NFA 3. Finite Automata and Regular Expressions 4. Languages

More information

Decision, Computation and Language

Decision, Computation and Language Decision, Computation and Language Non-Deterministic Finite Automata (NFA) Dr. Muhammad S Khan (mskhan@liv.ac.uk) Ashton Building, Room G22 http://www.csc.liv.ac.uk/~khan/comp218 Finite State Automata

More information

Course 4 Finite Automata/Finite State Machines

Course 4 Finite Automata/Finite State Machines Course 4 Finite Automata/Finite State Machines The structure and the content of the lecture is based on (1) http://www.eecs.wsu.edu/~ananth/cpts317/lectures/index.htm, (2) W. Schreiner Computability and

More information

What we have done so far

What we have done so far What we have done so far DFAs and regular languages NFAs and their equivalence to DFAs Regular expressions. Regular expressions capture exactly regular languages: Construct a NFA from a regular expression.

More information

Finite Automata and Regular Languages

Finite Automata and Regular Languages Finite Automata and Regular Languages Topics to be covered in Chapters 1-4 include: deterministic vs. nondeterministic FA, regular expressions, one-way vs. two-way FA, minimization, pumping lemma for regular

More information

Incorrect reasoning about RL. Equivalence of NFA, DFA. Epsilon Closure. Proving equivalence. One direction is easy:

Incorrect reasoning about RL. Equivalence of NFA, DFA. Epsilon Closure. Proving equivalence. One direction is easy: Incorrect reasoning about RL Since L 1 = {w w=a n, n N}, L 2 = {w w = b n, n N} are regular, therefore L 1 L 2 = {w w=a n b n, n N} is regular If L 1 is a regular language, then L 2 = {w R w L 1 } is regular,

More information

Chapter Five: Nondeterministic Finite Automata

Chapter Five: Nondeterministic Finite Automata Chapter Five: Nondeterministic Finite Automata From DFA to NFA A DFA has exactly one transition from every state on every symbol in the alphabet. By relaxing this requirement we get a related but more

More information

Classes and conversions

Classes and conversions Classes and conversions Regular expressions Syntax: r = ε a r r r + r r Semantics: The language L r of a regular expression r is inductively defined as follows: L =, L ε = {ε}, L a = a L r r = L r L r

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY NON-DETERMINISM and REGULAR OPERATIONS THURSDAY JAN 6 UNION THEOREM The union of two regular languages is also a regular language Regular Languages Are

More information

Theory of Computation (I) Yijia Chen Fudan University

Theory of Computation (I) Yijia Chen Fudan University Theory of Computation (I) Yijia Chen Fudan University Instructor Yijia Chen Homepage: http://basics.sjtu.edu.cn/~chen Email: yijiachen@fudan.edu.cn Textbook Introduction to the Theory of Computation Michael

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV27/DIT32 LP4 28 Lecture 5 Ana Bove March 26th 28 Recap: Inductive sets, (terminating) recursive functions, structural induction To define an inductive set

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 9 Ana Bove April 19th 2018 Recap: Regular Expressions Algebraic representation of (regular) languages; R, S ::= a R + S RS R......

More information

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism, CS 54, Lecture 2: Finite Automata, Closure Properties Nondeterminism, Why so Many Models? Streaming Algorithms 0 42 Deterministic Finite Automata Anatomy of Deterministic Finite Automata transition: for

More information

COM364 Automata Theory Lecture Note 2 - Nondeterminism

COM364 Automata Theory Lecture Note 2 - Nondeterminism COM364 Automata Theory Lecture Note 2 - Nondeterminism Kurtuluş Küllü March 2018 The FA we saw until now were deterministic FA (DFA) in the sense that for each state and input symbol there was exactly

More information

Lecture 2: Regular Expression

Lecture 2: Regular Expression Lecture 2: Regular Expression Instructor: Ketan Mulmuley Scriber: Yuan Li January 8, 2015 In the last lecture, we proved that DFA, NFA, and NFA with ϵ-moves are equivalent. Recall that a language L Σ is

More information

CS 581: Introduction to the Theory of Computation! Lecture 1!

CS 581: Introduction to the Theory of Computation! Lecture 1! CS 581: Introduction to the Theory of Computation! Lecture 1! James Hook! Portland State University! hook@cs.pdx.edu! http://www.cs.pdx.edu/~hook/cs581f10/! Welcome!! Contact Information! Jim Hook! Office:

More information

CS 154, Lecture 3: DFA NFA, Regular Expressions

CS 154, Lecture 3: DFA NFA, Regular Expressions CS 154, Lecture 3: DFA NFA, Regular Expressions Homework 1 is coming out Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and

More information

Non-deterministic Finite Automata (NFAs)

Non-deterministic Finite Automata (NFAs) Algorithms & Models of Computation CS/ECE 374, Fall 27 Non-deterministic Finite Automata (NFAs) Part I NFA Introduction Lecture 4 Thursday, September 7, 27 Sariel Har-Peled (UIUC) CS374 Fall 27 / 39 Sariel

More information

COMP4141 Theory of Computation

COMP4141 Theory of Computation COMP4141 Theory of Computation Lecture 4 Regular Languages cont. Ron van der Meyden CSE, UNSW Revision: 2013/03/14 (Credits: David Dill, Thomas Wilke, Kai Engelhardt, Peter Höfner, Rob van Glabbeek) Regular

More information

CSC173 Workshop: 13 Sept. Notes

CSC173 Workshop: 13 Sept. Notes CSC173 Workshop: 13 Sept. Notes Frank Ferraro Department of Computer Science University of Rochester September 14, 2010 1 Regular Languages and Equivalent Forms A language can be thought of a set L of

More information

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata : Organization of Programming Languages Theory of Regular Expressions Finite Automata Previous Course Review {s s defined} means the set of string s such that s is chosen or defined as given s A means

More information

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F)

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Outline Nondeterminism Regular expressions Elementary reductions http://www.cs.caltech.edu/~cs20/a October 8, 2002 1 Determistic Finite Automata A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Q is a finite

More information

Chapter 5. Finite Automata

Chapter 5. Finite Automata Chapter 5 Finite Automata 5.1 Finite State Automata Capable of recognizing numerous symbol patterns, the class of regular languages Suitable for pattern-recognition type applications, such as the lexical

More information

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 9 : Myhill-Nerode Theorem and applications

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 9 : Myhill-Nerode Theorem and applications COMP-33 Theory of Computation Fall 217 -- Prof. Claude Crépeau Lec. 9 : Myhill-Nerode Theorem and applications COMP 33 Fall 212: Lectures Schedule 1-2. Introduction 1.5. Some basic mathematics 2-3. Deterministic

More information

Formal Language and Automata Theory (CS21004)

Formal Language and Automata Theory (CS21004) Theory (CS21004) Announcements The slide is just a short summary Follow the discussion and the boardwork Solve problems (apart from those we dish out in class) Table of Contents 1 2 3 Languages that are

More information

Lecture 4 Nondeterministic Finite Accepters

Lecture 4 Nondeterministic Finite Accepters Lecture 4 Nondeterministic Finite Accepters COT 4420 Theory of Computation Section 2.2, 2.3 Nondeterminism A nondeterministic finite automaton can go to several states at once. Transitions from one state

More information

Inf2A: Converting from NFAs to DFAs and Closure Properties

Inf2A: Converting from NFAs to DFAs and Closure Properties 1/43 Inf2A: Converting from NFAs to DFAs and Stuart Anderson School of Informatics University of Edinburgh October 13, 2009 Starter Questions 2/43 1 Can you devise a way of testing for any FSM M whether

More information

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT. Recap DFA,NFA, DTM Slides by Prof. Debasis Mitra, FIT. 1 Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { {, } } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite

More information

Regular Language Equivalence and DFA Minimization. Equivalence of Two Regular Languages DFA Minimization

Regular Language Equivalence and DFA Minimization. Equivalence of Two Regular Languages DFA Minimization Regular Language Equivalence and DFA Minimization Equivalence of Two Regular Languages DFA Minimization Decision Property: Equivalence Given regular languages L and M, is L = M? Algorithm involves constructing

More information

C2.1 Regular Grammars

C2.1 Regular Grammars Theory of Computer Science March 22, 27 C2. Regular Languages: Finite Automata Theory of Computer Science C2. Regular Languages: Finite Automata Malte Helmert University of Basel March 22, 27 C2. Regular

More information

C2.1 Regular Grammars

C2.1 Regular Grammars Theory of Computer Science March 6, 26 C2. Regular Languages: Finite Automata Theory of Computer Science C2. Regular Languages: Finite Automata Malte Helmert University of Basel March 6, 26 C2. Regular

More information

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r Syllabus R9 Regulation UNIT-II NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: In the automata theory, a nondeterministic finite automaton (NFA) or nondeterministic finite state machine is a finite

More information

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata.

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata. Finite Automata Automata (singular: automation) are a particularly simple, but useful, model of computation. They were initially proposed as a simple model for the behavior of neurons. The concept of a

More information

Deterministic Finite Automaton (DFA)

Deterministic Finite Automaton (DFA) 1 Lecture Overview Deterministic Finite Automata (DFA) o accepting a string o defining a language Nondeterministic Finite Automata (NFA) o converting to DFA (subset construction) o constructed from a regular

More information

Page 1. Compiler Lecture Note, (Regular Language) 컴파일러입문 제 3 장 정규언어. Database Lab. KHU

Page 1. Compiler Lecture Note, (Regular Language) 컴파일러입문 제 3 장 정규언어. Database Lab. KHU Page 1 컴파일러입문 제 3 장 정규언어 Page 2 목차 I. 정규문법과정규언어 II. 정규표현 III. 유한오토마타 VI. 정규언어의속성 Page 3 정규문법과정규언어 A study of the theory of regular languages is often justified by the fact that they model the lexical analysis

More information

Chap. 7 Properties of Context-free Languages

Chap. 7 Properties of Context-free Languages Chap. 7 Properties of Context-free Languages 7.1 Normal Forms for Context-free Grammars Context-free grammars A where A N, (N T). 0. Chomsky Normal Form A BC or A a except S where A, B, C N, a T. 1. Eliminating

More information

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D )

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D ) Search algorithm Clever algorithm even for a single word Example: find abac in abaababac See Knuth-Morris-Pratt and String searching algorithm on wikipedia 2 Subset construction We have defined for a DFA

More information

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties Recall a closure property is a statement

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Lecture 6 Section 2.2 Robb T. Koether Hampden-Sydney College Mon, Sep 5, 2016 Robb T. Koether (Hampden-Sydney College) Nondeterministic Finite Automata Mon, Sep 5, 2016

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be

More information

Sri vidya college of engineering and technology

Sri vidya college of engineering and technology Unit I FINITE AUTOMATA 1. Define hypothesis. The formal proof can be using deductive proof and inductive proof. The deductive proof consists of sequence of statements given with logical reasoning in order

More information

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 5 : DFA minimization

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 5 : DFA minimization COMP-33 Theory of Computation Fall 27 -- Prof. Claude Crépeau Lec. 5 : DFA minimization COMP 33 Fall 27: Lectures Schedule 4. Context-free languages 5. Pushdown automata 6. Parsing 7. The pumping lemma

More information

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata.

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata. CMSC 330: Organization of Programming Languages Last Lecture Languages Sets of strings Operations on languages Finite Automata Regular expressions Constants Operators Precedence CMSC 330 2 Clarifications

More information

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed HKN CS/ECE 374 Midterm 1 Review Nathan Bleier and Mahir Morshed For the most part, all about strings! String induction (to some extent) Regular languages Regular expressions (regexps) Deterministic finite

More information

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 BIJU PATNAIK UNIVERSITY OF TECHNOLOGY, ODISHA Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 Prepared by, Dr. Subhendu Kumar Rath, BPUT, Odisha. UNIT 2 Structure NON-DETERMINISTIC FINITE AUTOMATA

More information

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont )

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) Sungjin Im University of California, Merced 2-3-214 Example II A ɛ B ɛ D F C E Example II A ɛ B ɛ D F C E NFA accepting

More information

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 CMPSCI 250: Introduction to Computation Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 λ-nfa s to NFA s to DFA s Reviewing the Three Models and Kleene s Theorem The Subset

More information

Finite Automata. Wen-Guey Tzeng Computer Science Department National Chiao Tung University

Finite Automata. Wen-Guey Tzeng Computer Science Department National Chiao Tung University Finite Automata Wen-Guey Tzeng Computer Science Department National Chiao Tung University Syllabus Deterministic finite acceptor Nondeterministic finite acceptor Equivalence of DFA and NFA Reduction of

More information

Computational Models - Lecture 3

Computational Models - Lecture 3 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models - Lecture 3 Equivalence of regular expressions and regular languages (lukewarm leftover

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Mahesh Viswanathan Introducing Nondeterminism Consider the machine shown in Figure. Like a DFA it has finitely many states and transitions labeled by symbols from an input

More information

More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41

More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41 More on Finite Automata and Regular Languages (NTU EE) Regular Languages Fall 2016 1 / 41 Pumping Lemma is not a Sufficient Condition Example 1 We know L = {b m c m m > 0} is not regular. Let us consider

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata COMP2600 Formal Methods for Software Engineering Katya Lebedeva Australian National University Semester 2, 206 Slides by Katya Lebedeva. COMP 2600 Nondeterministic Finite

More information

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova. Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12.

More information

Automata and Languages

Automata and Languages Automata and Languages Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Nondeterministic Finite Automata with empty moves (-NFA) Definition A nondeterministic finite automaton

More information

Finite Automata. Seungjin Choi

Finite Automata. Seungjin Choi Finite Automata Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr 1 / 28 Outline

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION FORMAL LANGUAGES, AUTOMATA AND COMPUTATION DECIDABILITY ( LECTURE 15) SLIDES FOR 15-453 SPRING 2011 1 / 34 TURING MACHINES-SYNOPSIS The most general model of computation Computations of a TM are described

More information

September 7, Formal Definition of a Nondeterministic Finite Automaton

September 7, Formal Definition of a Nondeterministic Finite Automaton Formal Definition of a Nondeterministic Finite Automaton September 7, 2014 A comment first The formal definition of an NFA is similar to that of a DFA. Both have states, an alphabet, transition function,

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation 9/2/28 Stereotypical computer CISC 49 Theory of Computation Finite state machines & Regular languages Professor Daniel Leeds dleeds@fordham.edu JMH 332 Central processing unit (CPU) performs all the instructions

More information

Extended transition function of a DFA

Extended transition function of a DFA Extended transition function of a DFA The next two pages describe the extended transition function of a DFA in a more detailed way than Handout 3.. p./43 Formal approach to accepted strings We define the

More information

E.g. The set RE of regular expressions is given by the following rules:

E.g. The set RE of regular expressions is given by the following rules: 1 Lecture Summary We gave a brief overview of inductively defined sets, inductively defined functions, and proofs by structural induction We showed how to prove that a machine is correct using induction

More information

Nondeterministic Finite Automata. Nondeterminism Subset Construction

Nondeterministic Finite Automata. Nondeterminism Subset Construction Nondeterministic Finite Automata Nondeterminism Subset Construction 1 Nondeterminism A nondeterministic finite automaton has the ability to be in several states at once. Transitions from a state on an

More information

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova. Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures Tuesday 10:45 pm - 12:15 pm Instructions Tuesday 12:30

More information

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2 5-25 Great Theoretical Ideas in Computer Science Lecture 4: Deterministic Finite Automaton (DFA), Part 2 January 26th, 27 Formal definition: DFA A deterministic finite automaton (DFA) M =(Q,,,q,F) M is

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 5 CHAPTER 2 FINITE AUTOMATA 1. Deterministic Finite Automata DFA 2. Nondeterministic Finite Automata NDFA 3. Finite Automata

More information

September 11, Second Part of Regular Expressions Equivalence with Finite Aut

September 11, Second Part of Regular Expressions Equivalence with Finite Aut Second Part of Regular Expressions Equivalence with Finite Automata September 11, 2013 Lemma 1.60 If a language is regular then it is specified by a regular expression Proof idea: For a given regular language

More information

Finite Automata and Formal Languages TMV026/DIT321 LP4 2012

Finite Automata and Formal Languages TMV026/DIT321 LP4 2012 Finite Automata and Formal Languages TMV26/DIT32 LP4 22 Lecture 7 Ana Bove March 27th 22 Overview of today s lecture: Regular Expressions From FA to RE Regular Expressions Regular expressions (RE) are

More information

Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular OctoberExpressions

Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular OctoberExpressions Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular Expressions Orit Moskovich Gal Rotem Tel Aviv University October 28, 2015 Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular

More information

Chapter 2. Finite Automata. (part A) (2015/10/20) Hokkaido, Japan

Chapter 2. Finite Automata. (part A) (2015/10/20) Hokkaido, Japan Chapter 2 Finite utomata (part ) (25//2) Hokkaido, Japan Outline 2 Introduction 2 n Informal Picture of Finite utomata 22 Deterministic Finite automata 23 Nondeterministic Finite utomata 24 n pplication:

More information

Constructions on Finite Automata

Constructions on Finite Automata Constructions on Finite Automata Informatics 2A: Lecture 4 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 23rd September, 2014 1 / 29 1 Closure properties of regular languages

More information

컴파일러입문 제 3 장 정규언어

컴파일러입문 제 3 장 정규언어 컴파일러입문 제 3 장 정규언어 목차 3.1 정규문법과정규언어 3.2 정규표현 3.3 유한오토마타 3.4 정규언어의속성 Regular Language Page 2 정규문법과정규언어 A study of the theory of regular languages is often justified by the fact that they model the lexical

More information

Uses of finite automata

Uses of finite automata Chapter 2 :Finite Automata 2.1 Finite Automata Automata are computational devices to solve language recognition problems. Language recognition problem is to determine whether a word belongs to a language.

More information

Constructions on Finite Automata

Constructions on Finite Automata Constructions on Finite Automata Informatics 2A: Lecture 4 Mary Cryan School of Informatics University of Edinburgh mcryan@inf.ed.ac.uk 24 September 2018 1 / 33 Determinization The subset construction

More information

Introduction to Formal Languages, Automata and Computability p.1/51

Introduction to Formal Languages, Automata and Computability p.1/51 Introduction to Formal Languages, Automata and Computability Finite State Automata K. Krithivasan and R. Rama Introduction to Formal Languages, Automata and Computability p.1/51 Introduction As another

More information

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS Automata Theory Lecture on Discussion Course of CS2 This Lecture is about Mathematical Models of Computation. Why Should I Care? - Ways of thinking. - Theory can drive practice. - Don t be an Instrumentalist.

More information

Finite Automata and Regular Languages (part III)

Finite Automata and Regular Languages (part III) Finite Automata and Regular Languages (part III) Prof. Dan A. Simovici UMB 1 / 1 Outline 2 / 1 Nondeterministic finite automata can be further generalized by allowing transitions between states without

More information

Chap. 1.2 NonDeterministic Finite Automata (NFA)

Chap. 1.2 NonDeterministic Finite Automata (NFA) Chap. 1.2 NonDeterministic Finite Automata (NFA) DFAs: exactly 1 new state for any state & next char NFA: machine may not work same each time More than 1 transition rule for same state & input Any one

More information

Chapter 6: NFA Applications

Chapter 6: NFA Applications Chapter 6: NFA Applications Implementing NFAs The problem with implementing NFAs is that, being nondeterministic, they define a more complex computational procedure for testing language membership. To

More information