1 / 13

NFA  DFA

NFA  DFA. Subset Construction. Convert an NFA to DFA using the subset construction. Each state of the DFA is a set of states of the NFA. The initial state of the DFA is the  -closure of the initial state of the NFA. CLOSE{0}={0, 1, 3}=S 0.

cicada
Download Presentation

NFA  DFA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. NFA  DFA Subset Construction

  2. Convert an NFA to DFAusing the subset construction

  3. Each state of the DFA is a set of states of the NFA. The initial state of the DFA is the -closure of the initial state of the NFA. CLOSE{0}={0, 1, 3}=S0

  4. Determine the transition function of the DFA on all inputs. Begin with the initial state S0, and determine the transition on input a. CLOSE{0} = {0, 1, 3} = S0 (S0, a) = CLOSE{1, 2}

  5. The e-closure of the set {1, 2} is {1, 2, 3} This is a new state in the DFA, call it S1. CLOSE{0} = {0, 1, 3} = S0 (S0, a) = CLOSE{1, 2} = {1, 2, 3} = S1

  6. With the initial state S0, determine the transition on input b. CLOSE{0} = {0, 1, 3} = S0 (S0, a) = CLOSE{1, 2} = {1, 2, 3} = S1 (S0, b) = CLOSE{3}

  7. The -closure of the set {3} is {1, 3}. This is a new state in the DFA, call it S2. CLOSE{0} = {0, 1, 3} = S0 (S0, a) = CLOSE{1, 2} = {1, 2, 3} = S1 (S0, b) = CLOSE{3} = {1, 3} = S2

  8. Determine the transition function of the DFA from state S1 on inputs a and b. On a there is no where to go in the NFA, so we create a “sink“(“trap”) state for DFA. (S0, a) = CLOSE{1, 2} = {1, 2, 3} = S1 (S0, b) = CLOSE{3} = {1, 3} = S2 (S1, a) = CLOSE{} == S3

  9. Determine the transition function of the DFA from state S1 on inputs a and b. On b there is a transition to an existing state S2. (S0, a) = CLOSE{1, 2} = {1, 2, 3} = S1 (S0, b) = CLOSE{3} = {1, 3} = S2 (S1, a) = CLOSE{} == S3 (S1, b) = CLOSE{3} = {1, 3} = S2

  10. Determine the transition from state S2 on inputs a and b. (S0, a) = CLOSE{1, 2} = {1, 2, 3} = S1 (S0, b) = CLOSE{3} = {1, 3} = S2 (S1, a) = CLOSE{} =  = S3 (S1, b) = CLOSE{3} = {1, 3} = S2 (S2, a) = CLOSE{} =  = S3 (S2, b) = CLOSE{3} = {1, 3} = S2

  11. Determining the transition from state S2 on inputs a and b is easy;from the empty set of states there are no transitions in the NFA. Inthe DFA this is represented by a transition from the empty setback to itself.

  12. The final states of the DFA are determined from the final states of the NFA. State 3 was the only final state in the NFA. Any set of NFA states containing a final state is a final state in the DFA.

  13. NFA  DFA RESULTAT

More Related