# Lecture 25: Non-determinism

Reading: Pass and Tseng, section 8.2

Nondeterminism, definition of NFA, converting NFA to DFA

**Review questions:**
- draw NFAs for the languages from homework 7
- translate the NFAs to DFAs
- prove that the power set construction is correct
- show how to translate (formally) a DFA to an NFA

## NFAs

DFAs require exactly one transition from every state on every character (δ is a function). While processing a string, there is only one place you can go at every step.

NFAs allow any number of transitions from a state on a given character. The machine accepts a string \(x\) if there is any possible path from the start state to a final state using \(x\).

One way of thinking of nondeterminism is that the machine gets to "magically" guess which path to take at any point.

Another way is that it explores all possible paths and accepts if any of them do.

Formally, the only difference between an NFA and a DFA is that in an NFA, \(δ\) is a function from \(Q \times Σ\) to \(2^Q\) (instead of to \(Q\)). \(δ(q,a)\) outputs the *set of states* that can be reached by taking a transition labeled \(a\) from state \(q\).

The extended transition function serves the same purpose as with a DFA. The definition is a bit more involved, but follows the same logic: to compute \(\hat{δ}(q,xa)\), first recursively find all of the states you can reach from \(q\) using string \(x\): compute \(\hat{δ}(q,x)\). Then, from each of these steps, take all of the states you can reach from any of them using a single transition on \(a\). Formally:

\[\hat{δ}(q,xa) = \bigcup_{q' \in \hat{δ}(q,x)} δ(q',a)\]

## Converting from NFA to DFA and back

See Notes on automata constructions.