CleverSphere

Subset construction: NFA to DFA

An NFA can be in several states at once. The DFA remembers exactly that set of states.

Rules

  • Start state: the set of NFA start states
  • Transition: union of all next states
  • Accepting: the set contains an accepting state
  • Write down reachable sets only

Your turn

Three problems on this topic. The software checks your answer exactly.

  1. 1 · Subset construction
  2. 2
  3. 3

Convert the NFA into a DFA with the subset construction (reachable states only, the empty set counts if reachable).

w = abb

δab
→ q0{q1}{q0, q1}
q1∅∅
q2∅∅
*q3{q0, q2, q3}{q0, q2}

Number of DFA states

Does the NFA accept w?

Worked example

Convert the NFA into a DFA with the subset construction (reachable states only, the empty set counts if reachable).

w = aba

δab
→ q0{q2}{q0, q1}
q1∅{q1, q2}
*q2{q2}{q0}

Worked solution

  1. 1{q0}: a → {q2}, b → {q0, q1}
  2. 2{q2}: a → {q2}, b → {q0}
  3. 3{q0, q1}: a → {q2}, b → {q0, q1, q2}
  4. 4{q0, q1, q2}: a → {q2}, b → {q0, q1, q2}
  5. 5Run on w: {q0} → {q2} → {q0} → {q2}

Typical mistake: A DFA state is accepting as soon as its set contains at least one accepting NFA state.

Common questions

Does the empty set count?

Yes, if it is reachable. It then acts as a trap state.

Related

More topics