100 likes | 122 Vues
CSCI 2670 Introduction to Theory of Computing. August 25, 2004. Agenda. Last class Introduced deterministic finite automata Formally defined DFA’s Informally described DFA’s This class Quiz Continue Chapter 1 Goal for the week Section 1.1
E N D
CSCI 2670Introduction to Theory of Computing August 25, 2004
Agenda • Last class • Introduced deterministic finite automata • Formally defined DFA’s • Informally described DFA’s • This class • Quiz • Continue Chapter 1 • Goal for the week • Section 1.1 • Continue reading Section 1.1 (pages 31 – 47) this week
Group 1 0,1 1 0 0 q2 1 q3 0 q4 q1 1 q5 0,1 Hint: What string doesn’t this DFA accept?
Group 2 0,1 q2 0,1 q3 0 q1 0,1 1 q4 0,1 q5 Hint: String length counts.
Remainder of class • Formal definition of computation • Definition of a regular language • Designing finite automata
Formalizing computation • Let M = (Q,,,q0,F) be a finite automaton and let w = w1w2…wn be any string over . Macceptsw if there is a sequence of states r0, r1, …, rn, of Q such that • r0 = q0 • start in the start state • ri+1=(ri, wi) • the transition function determines each step • rn F • the last state is one of the final states
Regular languages • A deterministic finite automaton Mrecognizes 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
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
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
Step 1 • What states do we need? • One state for each value modulo 4 • q1 represents 1 modulo 4 • q2 represents 2 modulo 4 • q3 represents 3 modulo 4 • q4 represents 0 modulo 4