# 3 every state of g d whose label contains and q f f n

• 94

This preview shows page 51 - 64 out of 94 pages.

3. Every state of G D whose label contains and q f F N is identified as a final vertex. 4. If M N accepts , the vertex q 0 in G D is also made a final vertex.
NFA DFA Example: Convert the following NFA into an equivalent DFA (Figure 2.12 in Linz.).
NFA DFA 1. Create a graph G D with vertex {q 0 }. Identify this vertex as the initial vertex. OK; here it is: {q 0 }
NFA DFA 1. Repeat the following steps until no more edges are missing: a. Take any vertex {q i , q j , …, q k } of G D that has no outgoing edge for some a . OK. Vertex q 0 in our new DFA has no outgoing edge for a yet. b. Compute δ * (q i , a ), δ * (q j , a ), …, δ * (q k , a ). OK. From q 0 in our NFA, upon reading an a the extended transition function takes us to state q 1 , or we can go on to q 2 (via a “free” lambda-move).
NFA DFA c. Then form the union of all these δ * , yielding the set {q l , q m , …, q n }. So our new DFA will have a state labeled {q1, q2}. d. Create a vertex for G D labeled {q l , q m , …, q n } if it does not already exist. So create a vertex for our new DFA and label it {q1, q2}. e. Add to G D an edge from {q i , q j , …, q k } to {q l , q m , …, q n } and label it with a . So add a transition labeled a to {q1, q2} from q 0 .
NFA DFA So now we have: {q 0 } {q 1 , q 2 } a
NFA DFA 1. Repeat the following steps until no more edges are missing: a. Take any vertex {q i , q j , …, q k } of G D that has no outgoing edge for some a . OK. Vertex q 0 in our new DFA has no outgoing edge for b yet. b. Compute δ * (q i , b ), δ * (q j , b ), …, δ * (q k , b ). Well, there is no transition specified in our NFA from state q 0 upon reading a b. Therefore, δ * ({q 0 }, b ) = .
NFA DFA c. Then form the union of all these δ * , yielding the set {q l , q m , …, q n }. So our new DFA will have a state labeled . d. Create a vertex for G D labeled {q l , q m , …, q n } if it does not already exist. So create a vertex for our new DFA and label it . e. Add to G D an edge from {q i , q j , …, q k } to {q l , q m , …, q n } and label it with a . So add a transition labeled b to from q 0 .
NFA DFA So now we have: {q 0 } {q 1 , q 2 } a b a, b Any state labeled represents an impossible move and thus is a non-final trap state.
NFA DFA 1. Repeat the following steps until no more edges are missing: a. Take any vertex {q i , q j , …, q k } of G D that has no outgoing edge for some a . OK. Vertex {q 1 , q 2 } in our new DFA has no outgoing edge for a yet. b. Compute δ * (q i , b ), δ * (q j , b ), …, δ * (q k , b ). OK. From q 1 in our NFA, upon reading an a the extended transition function leaves us in state q 1 , or q 2 via a “free” lambda-move. From q 2 in our NFA, upon reading an a there is no specified transition.
NFA DFA c. Then form the union of all these δ * , yielding the set {q l , q m , …, q n }. The union is {q 1 , q 2 } . d. Create a vertex for G D labeled {q l , q m , …, q n } if it does not already exist. It does. e. Add to G D an edge from {q i , q j , …, q k } to {q l , q m , …, q n } and label it with a . So add a transition labeled a to {q 1 , q 2 } from {q 1 , q 2 } .
NFA DFA So now we have: {q 0 } {q 1 , q 2 } a b a a, b
NFA DFA 1. Repeat the following steps until no more edges are missing: a. Take any vertex {q i , q j , …, q k } of G D that has no outgoing edge for some a .