40 likes | 57 Views
2-Way Finite Automata: An Example. 2DFA accepting {x {a,b}* | # a (x) is even, # b (x) is a multiple of 3}, where # c (z) is the # of c’s in z. q even is the initial state. Phase1: Check the # of a’s: (q even ,a)=(q odd ,+1), (q odd ,a)=(q even ,+1),
E N D
2-Way Finite Automata: An Example • 2DFA accepting {x{a,b}* | #a(x) is even, #b(x) is a multiple of 3}, where #c(z) is the # of c’s in z. qeven is the initial state. Phase1: Check the # of a’s: (qeven,a)=(qodd,+1), (qodd,a)=(qeven,+1), (q,c)=(q,+1) if q{qeven,qodd},c{¢,b}; If Phase1 was ok, then (qeven,$)=(q0,-1); Phase2: Check the # of b’s: (q0,b)=(q1,-1), (q1,b)=(q2,-1), (q2,b)=(q0,-1), (qi,a)=(qi,-1) for i=0,1,2; Accept if Phase 2 was ok: (q0,¢)=(qaccept,0); (qeven,¢aba$,1)(qeven,¢aba$,2)(qodd,¢aba, 3) (qodd,¢aba$,4)(qeven,¢aba$,5)(q0,¢aba$,4) (q0,¢aba$,3)(q1,¢aba$,2)(q1,¢aba$,1)No more aba is not accepted by the above 2DFA. 003-03
There is any kind of finite automaton … • A DFA that accepts the language on the previous slide DFAs/NFAs that simulates the moves of two DFAs/NFAs • Finite automata with output • Finite automata with multi input heads Strictly more powerful than ordinary FAs • Finite automata on arbitrary labeled digraphs; especially tree automata • Parallelization in terms of a number of finite automata cellular automata 003-03
Quiz #01 (5 points) • Let M be an -NFA defined by the state transition table given below. Let ={a,b}. • Draw the state transition graph (STG) of M. • Determine *(q0, a1b2). • What is X={x* | (q3,x) * (q3,)}? • What is L(M)? • Convert M to an equivalent DFA (Draw the STG for it). Use Algorithm -NFAtoDFA a b q0 {q1} {q1} {q1,q4} q1 {q2,q3} {q2} q2 {q0} q3 {q4} q4 {q3} q5 {q3,q4} {q3} 003-03
Solution for quiz #01 (1) Shown below (left). (2) *(q0, a1b2)={q0,q1,q2,q3,q4}. (3) X=(bb)*={b2n | n0}. The set of words consisting of even number of b’s. (4) L(M)={a,b}+. The set of all words over {a,b} except for the empty word. (5) Shown below (right). a,b, q0 q1 a, a {q0} b a,b q2 q3 b {q0,q1,q2,q3,q4} a,b b q4 q5 a a,b 003-03