Lecture 4-NFA to DFA

NFA to DFA Conversion

Purpose of Conversion

  • Nondeterministic Finite Automaton (NFA) behavior:

    • On a given input, it can transition to multiple states simultaneously.

    • Can have zero, one, or more transitions for a single input symbol.

  • Deterministic Finite Automaton (DFA) behavior:

    • For any specific input and current state, it transitions to only one state.


Steps for Converting NFA to DFA

Step 1: Create Transition Table of NFA

  • Construct an equivalent transition table for the given NFA:

    • List all states, input symbols, and transition rules.

    • Transition rules are visually represented in a matrix format:

      • Rows showcase the current state.

      • Columns showcase input symbols.

      • Cells indicate the next state.


Step 2: Construct the DFA from NFA

  1. Initialize the Set of States:

    • Add the initial state q0 of NFA to the set of states Q' in the DFA.

  2. Find Transitions:

    • From the start state, determine which states can be reached based on input symbols.

  3. Expand States:

    • For each input symbol, find all possible sets of states.

    • If any new set of states is created, add it to Q'.

  4. Identify Final States:

    • In the DFA, the final state will include all sets of states in Q' that contain the final states (F) from the NFA.


Example Conversion

Sample #1

  1. Display the original NFA transition table.

  2. Perform conversion to DFA.

  3. Present the new DFA transition table.

  4. Illustrate the new transition diagram.


Additional Example

  1. Show the transition table.

  2. Convert the provided NFA to DFA.

  3. Show the resulting new transition table.

  4. Present the corresponding new transition diagram.


Epsilon Closure (ε-closure)

Definition

  • The epsilon closure (ε-closure) of a state q in Q:

    • Is the union of the state set {q} and all states accessible from q via one or more ε transitions.

  • If R is a set of states from Q, the epsilon closure E(R):

    • Is identified as the union of the epsilon closures of each state within R.

Characteristics

  • For any state X, the ε-closure comprises:

    • States that can be reached from X using only ε moves (including state X itself).


Recursive Computation

  • The ε-closure for a state can be derived recursively:

    • By applying a union operation of the ε-closures of states that can be reached from X with a single ε move.


Transition Table Example

State

A

B

C

ε-closure

1

A

0

B

0

B

0

0


1

B.C

A

B


-

B

C

C


C

C

C

epsilon