Deterministic Finite Automata (DFA) - 1
description
Transcript of Deterministic Finite Automata (DFA) - 1
Deterministic Finite Automata (DFA) - 1
q0 q1
01
0
1
strings that do not end with "1".
Build an automaton to identify strings that end with "0".
q1 q2
01
0
1
q00
1
Σ = {0,1}
Deterministic Finite Automata (DFA) - 2
What patterns does this automaton identify (over {a,b,c})?
strings that begin and end with the same letter.
aA
b B
c
C
S
a
b
c
A’b,c
B’a,c
C’a,b
b,c
a
a,c
b
a,b
c
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
q0 q1 q2
01
1
0
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 a a a … a a a b b b b b … b b b
a a … a a b b b b b … b b b
* comment: for any finite known n, there IS such an automaton…
delete
N+1 N+1
<N+1 N+1
si si