180 likes | 212 Views
Learn about deterministic finite automata, regular languages, and designing finite automata in this comprehensive introduction to the theory of computing. Dive into formal definitions of computation and explore practical examples.
E N D
CSCI 2670Introduction to Theory of Computing August 24, 2005
Announcements • Please send me an email by midnight tonight • Office hours changed • Tues & Wed 11:00 – 12:30
Agenda • Last class • Introduced deterministic finite automata • Formally defined DFA’s • Informally described DFA’s • This class • Quiz • Continue Chapter 1
Group 1 0,1 0 q2 1 q3 0 q4 q1 0 1 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.
Group 3 0,1 1 q1 q2 0 q3 0,1 Hint: Symbol position counts.
Group 4 0 q1 q2 1 0,1 0,1 0,1 q3 q4 Hint: Can you simplify this DFA?
0,1 Group 5 q7 1 1 q1 q3 q5 1 1 0 0 0 0 0 0 q4 q6 q2 1 1 Hint: For each state, what do you know about how many times each symbol has appeared?
Group 6 0 1 q1 q2 0 1 q3 0, 1 Hint: What happens when you get to q3?
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=(ri-1, 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
Step 2 • Create the state transition table
Step 3 • What elements of the 5-tuple do we know? • Q, , and • So we still need q0 and F • q0 = q4 • F = {q2, q3}
3 1 0 q1 q2 0 2 2 3 1 1 3 2 2 q4 q3 0 0 1 3 Draw DFA