The Subset Construction
The Goal
Convert an NFA (or NFA-) to an equivalent DFA that recognises the same language.
The Construction
Input
NFA-
Output
DFA
States
Each DFA state is a set of NFA states.
Start State
The -closure of the NFA’s start state.
Accepting States
A DFA state is accepting if it contains at least one NFA accepting state.
Transition Function
For and :
Equivalently: the set of all states reachable from on symbol , followed by any number of -transitions.
Algorithm Summary
- Start with -closure of
- For each reachable set and symbol , compute
- Add newly discovered states to worklist
- Repeat until no new states
Example
NFA
: , ,
Transitions:
- ,
DFA Construction
Start:
Compute transitions:
| DFA State | ||
|---|---|---|
Accepting: (states containing )
Resulting DFA
Size
Worst Case
The DFA can have up to states.
Typical Case
Many subsets may be unreachable, so the actual DFA is often smaller.
Exponential Blowup
Some NFAs require exponentially many DFA states. Example: language of strings where the -th symbol from the end is requires DFA states but only NFA states.
Key Intuition
The DFA simulates “all possible computations” of the NFA simultaneously.
- DFA state set of NFA states that could be active
- Transition move all active states, take -closures
- Accepting any active state is an NFA accept state
Summary
- Subset construction: NFA state DFA state = set of NFA states
- DFA simulates all NFA computations in parallel
- Start state = -closure of NFA start
- Accept if intersection with is non-empty
- Worst case: exponential blowup in state count