Presentation is loading. Please wait.

Presentation is loading. Please wait.

Finite Automata and Non Determinism

Similar presentations


Presentation on theme: "Finite Automata and Non Determinism"— Presentation transcript:

1 Finite Automata and Non Determinism http://cis.k.hosei.ac.jp/~yukita/

2 2 Definition 1.1: Finite Automaton

3 3 State Diagram for M 1 q3q3 q1q1 q2q2 0 1 1 0 0, 1

4 4 Data Representation for M 1

5 5 Task 01 DFA 1.Implement M 1 with your favorite programming language. 2.GUI Two buttons for input 0 and 1 State chart with the current state highlighted

6 6 Language of M 1

7 7 State Diagram for M 5 q2q2 q1q1 q0q0 0 1 1 2 2, 1, 2 0, 0

8 8 Data Representation for M 5

9 9 Informal Description of M 5 M 5 keeps a running count of the sum of the numerical symbols it reads, modulo 3. Every time it receives the symbol it resets the count to 0. M 5 accepts if the sum is 0, modulo 3.

10 10 Definition 1.7: Regular Language A language is called a regular language if some finite automaton recognizes it.

11 11 Example 1.9: A finite automaton E 2 E 2 recognizes the regular language of all strings that contain the string 001 as a substring. 0010, 1001, 001, and 1111110011110 are all accepted, but 11 and 0000 are not.

12 12 Find a set of states of E 2 You 1.haven’t just seen any symbols of the pattern, 2.have just seen a 0, 3.have just seen 00 or, 4.have just seen the entire pattern 001. Assign the states q,q 0,q 00, and q 001 to these possibilities.

13 13 Draw a State Diagram for E 2 q 00 q 001 0 0, 1 1 1 0 q0q0 0 q 1

14 14 Regular Operations on Languages

15 15 Example 1.11

16 16 Theorem 1.12 Closedness for Union

17 Proof of Th 1.1217 Proof of Theorem 1.12

18 Proof of Th 1.1218 Construction of M

19 Proof of Th 1.1219 Correctness You should check the following. 1.For any string recognized by M 1 is recognized by M. 2.For any string recognized by M 2 is recognized by M. 3.For any string recognized by M is recognized by M 1 or M 2.

20 20 Theorem 1.13 Closedness for concatenation

21 21 Nondeterminism To prove Theorem 1.13, we need nondeterminism. Nondeterminism is a generalization of determinism. So, every deterministic automaton is automatically a nondeterministic automaton.

22 22 Nondetermistic Finite Automata A nondeterministic finite automaton can be different from a deterministic one in that –for any input symbol, nondeterministic one can transit to more than one states. –epsilon transition NFA and DFA stand for nondeterministic finite automaton and deterministic finite automaton, respectively.

23 23 NFA N 1 q3q3 q1q1 q2q2 0,1 1 0,  q4q4 0,1 1

24 24 Parallel world and NFA... accept

25 25 Example 1.14 NFA N 2 q3q3 q1q1 q2q2 0,1 1 0,  q4q4 0,1 Let language A consist of all strings over {0,1} containing a 1 in the third position from the end. N 2 recognizes A.

26 26 A DFA equivalent to N 2 q 010 q 000 q 100 0 00 q 110 q 011 q 001 q 101  q 111 1 0 1 0 0 1 0 1 1 01 1

27 27 Example 1.15 NFA N 3  0 Let language A consist of all strings 0 k, where k is a multiple of 2 or 3. N 3 recognizes A.  0 0 0 0

28 28 A DFA equivalent to N 3 0 q2q2 q1q1 q3q3 q5q5 0 q0q0 000 q4q4 0 q -1 1 1 11 1 1 0, 1

29 29 Example 1.16 NFA N 4 q1q1 q2q2 q3q3 a b a,b  a N 4 accepts , a, baba, and baa. N 4 does not accept b, nor babba.

30 30 Definition 1.17: NFA

31 31 Example 1.18 NFA N 1 q3q3 q1q1 q2q2 0,1 1 0,  q4q4 0,1 1

32 32 In what situation is Non Determinism relevant? Von Neumann machines are deterministic. However, there are many cases where machine specification is all we need.

33 33 Theorem 1.19 Every nondeterministic finite automaton has an equivalent deterministic finite automaton. –Def. The two machines are equivalent is they recognize the same language.

34 Proof of Th 1.1934 Proof of Th. 1.19

35 Proof of Th 1.1935 Incorporate  arrows

36 36 Corollary 1.20 A language is regular if and only if some nondeterministic finite automaton recognizes it.

37 37 Example 1.21 NFA N 4 to DFA 1 2 3 a b a,b  a

38 38 Task 02 Parallel World 1.Write a program that simulates N 4. 2.GUI –Three buttons for input 0, 1, and epsion. –State chart that reflect the branching of the world.

39 39 Start and Accept states

40 40 The state diagram of D  {1} {2}{1,2} {3} {1,3} {2,3} {1,2,3} a,b a a a a a a b b b b b b

41 41 Theorem 1.22 The class of regular languages is closed under the union operation. N1N1 N2N2 N  

42 42 Proof of Th. 1.22

43 43 Theorem 1.23 The class of regular languages is closed under the concatenation operation. N1N1 N2N2 N  

44 44 Proof of Th. 1.23

45 45 Theorem 1.24 The class of regular languages is closed under the star operation. N1N1 N   

46 46 Proof of Th. 1.24


Download ppt "Finite Automata and Non Determinism"

Similar presentations


Ads by Google