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
Initialize the Set of States:
Add the initial state
q0of NFA to the set of statesQ'in the DFA.
Find Transitions:
From the start state, determine which states can be reached based on input symbols.
Expand States:
For each input symbol, find all possible sets of states.
If any new set of states is created, add it to
Q'.
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
Display the original NFA transition table.
Perform conversion to DFA.
Present the new DFA transition table.
Illustrate the new transition diagram.
Additional Example
Show the transition table.
Convert the provided NFA to DFA.
Show the resulting new transition table.
Present the corresponding new transition diagram.
Epsilon Closure (ε-closure)
Definition
The epsilon closure (ε-closure) of a state
qin Q:Is the union of the state set {
q} and all states accessible fromqvia one or more ε transitions.
If
Ris a set of states fromQ, the epsilon closureE(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
Xusing only ε moves (including stateXitself).
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
Xwith 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 |