Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI 2670 Introduction to Theory of Computing August 24, 2005.

Similar presentations


Presentation on theme: "CSCI 2670 Introduction to Theory of Computing August 24, 2005."— Presentation transcript:

1 CSCI 2670 Introduction to Theory of Computing August 24, 2005

2 Announcements Please send me an email by midnight tonight Office hours changed –Tues & Wed 11:00 – 12:30

3 Agenda Last class –Introduced deterministic finite automata Formally defined DFA’s Informally described DFA’s This class –Quiz –Continue Chapter 1

4 Group 1 q1q1 q2q2 q4q4 10 1 0,1 0 q3q3 0 Hint: What string doesn’t this DFA accept? q5q5 1 0,1

5 Group 2 q1q1 q2q2 0,1 0 q3q3 q4q4 q5q5 1 Hint: String length counts.

6 Group 3 q1q1 q2q2 1 0,1 Hint: Symbol position counts. q3q3 0 0,1

7 Group 4 q1q1 q2q2 0 0,1 Hint: Can you simplify this DFA? q3q3 q4q4 0,1 1

8 Group 5 q1q1 q2q2 0 Hint: For each state, what do you know about how many times each symbol has appeared? q3q3 q4q4 0 1 1 0 q5q5 0 1 1 0,1 q6q6 1 0 0 q7q7 1

9 Group 6 q1q1 0, 1 Hint: What happens when you get to q 3 ? q2q2 0 1 0 q3q3 1

10 Remainder of class Formal definition of computation –Definition of a regular language Designing finite automata

11 Formalizing computation Let M = (Q, , ,q 0,F) be a finite automaton and let w = w 1 w 2 …w n be any string over . M accepts w if there is a sequence of states r 0, r 1, …, r n, of Q such that –r 0 = q 0 start in the start state –r i =  (r i-1, w i ) the transition function determines each step –rn  F–rn  F the last state is one of the final states

12 Regular languages A deterministic finite automaton M recognizes the language A if A = { w | M accepts w } Alternatively, we say the language of M is A L(M) = { w | M accepts w } Any language recognized by a deterministic finite automaton is called a regular language

13 Designing finite automata Select states specifically to reflect some important concept –even number of 0’s –odd number of occurrences of the string 010 Ensure this meaning is relevant to the language you are trying to define Try to get “in the head” of the automaton

14 Example Design a DFA accepting all strings over {0,1,2,3} such that the sum of the symbols in the string is equivalent to 2 modulo 4 or 3 modulo 4

15 Step 1 What states do we need? –One state for each value modulo 4 q 1 represents 1 modulo 4 q 2 represents 2 modulo 4 q 3 represents 3 modulo 4 q 4 represents 0 modulo 4

16 Step 2 Create the state transition table 0123 q 1 (1 mod 4)q1q1 q2q2 q3q3 q4q4 q 2 (2 mod 4)q2q2 q3q3 q4q4 q1q1 q 3 (3 mod 4)q3q3 q4q4 q1q1 q2q2 q 4 (0 mod 4)q4q4 q1q1 q2q2 q3q3

17 Step 3 What elements of the 5-tuple do we know? –Q, , and  So we still need q 0 and F –q 0 = q 4 –F = {q 2, q 3 }

18 Draw DFA q1q1 q3q3 q4q4 q2q2 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3


Download ppt "CSCI 2670 Introduction to Theory of Computing August 24, 2005."

Similar presentations


Ads by Google