130 likes | 423 Views
1. 0. 1. q 0. q 1. 0. Deterministic Finite Automata (DFA) - 1. Σ = {0,1}. strings that do not end with "1". Build an automaton to identify strings that end with "0". 1. 0. 1. 0. q 1. q 2. q 0. 1. 0. a. a. b,c. A. A’. b,c. a. b. b. b. a,c. S. B. B’. a,c. c. c.
E N D
1 0 1 q0 q1 0 Deterministic Finite Automata (DFA) - 1 Σ = {0,1} strings that do not end with "1". Build an automaton to identify strings that end with "0". 1 0 1 0 q1 q2 q0 1 0
a a b,c A A’ b,c a b b b a,c S B B’ a,c c c c a,b C C’ a,b Deterministic Finite Automata (DFA) - 2 What patterns does this automaton identify (over {a,b,c})? strings that begin and end with the same letter.
0 1 q0 Deterministic Finite Automata (DFA) - 3 Build an automaton to identify strings over {0,1} that are binary numbers divided by 3. explanation: qi denotes remainder of i. for example, if n=3k+1 (remainder 1) then adding "1" yields 2n+1 = 2(3k+1)+1 = 6k+3 = 3(2k+1) remainder 0 1 0 q2 q1 0 1
Deterministic Finite Automata (DFA) - 4 Given 2 automata A1 and A2, that identify patterns p1 and p2 respectively, describe an automaton that identifies strings with either p1 or p2. solution: states: tuples (q1,q2) for every q1 from A1 and q2 from A2 transitions: if q1 –x-> q1' and q2 –x-> q2' then (q1,q2) –x-> (q1',q2') start state: (q1start,q2start) when q1start and q2start are A1 and A2 starting states accepting states: (q1,q2) is accepting if q1 is accepting in A1 or q2 is accepting in A2.
Deterministic Finite Automata (DFA) - 5 Prove no finite automata can identify strings of the form anbn for unknown n. proof: assume there is such an automaton, with N states. then for aN+1bN+1 it must repeat the same state si at least twice (pigeon hole principle). but then it must also accept strings with <N+1 a's , contradiction. aN+1bN+1= a a aaa … a aa b bbbb … b bb a a … a a b bbbb … b bb * comment: for any finite known n, there IS such an automaton… N+1 N+1 si si delete <N+1 N+1