Q2Theory of Computation
Question
Convert the given NFA to an equivalent DFA.
Answer
The subset construction converts an NFA into an equivalent DFA whose states are sets of NFA states, computed via epsilon-closures, illustrated below on a representative NFA.
Given NFA , construct DFA as follows: (1) The start state , the set of NFA states reachable from using only -transitions. (2) For each DFA state (a subset of ) and each input symbol , compute — move on from every NFA state in , then take the -closure of the result. (3) Repeat step 2 for every newly discovered subset until no new subsets appear (this is done lazily, only constructing reachable subsets, to avoid the full blow-up when unnecessary). (4) A DFA state if and only if , i.e., the subset contains at least one NFA accepting state.
Consider an NFA over with states , start state , final state , and transitions , , (no -transitions in this example, so -closure of any set is itself). This NFA accepts strings ending in '01'. Apply subset construction: start state . From : on 0, , giving new state ; on 1, , staying at . From : on 0, (self-loop); on 1, , a new state. From : on 0, (already seen); on 1, (already seen). No further new subsets arise, so the reachable DFA states are , with the only final state (it contains ).
Renaming (start), , (final), the DFA has transitions , , , , , . Correctness of subset construction follows by induction on input length: the invariant 'after reading prefix , the DFA is in state ' holds at the base case (empty string, by definition of ) and is preserved by the transition definition at each step, so the DFA is in an accepting state after exactly when some NFA computation path on ends in an NFA-accepting state, meaning .