Small Problem
- what if at one state, there’s no transition with the label that you want?
- what if at one state, there’s two transitions with the same label?
- we’ll see two ways of addressing this issue. First: DFAs, which disallow choices. NFAs, which allow choices.
DFAs
- Deterministic Finite Automaton, the simplest type
- A DFA is defined relative to some alphabet $\Sigma$ such that:
- for each state in the DFA, there must be exactly one transition defined for each symbol in $\Sigma$.
- This is the deterministic part of the DFA
- there is a unique start state.
- There are zero or more accepting states.
Designing DFAs
- At each point, DFA can only remember what state it is in.
- Design tip: build each state to correspond to some piece of information you need to remember.
Example: $L=\{ w \in \{a,b\}^* ~|~ \text{the number of b's in $w$ is congruent to 2 mod 3} \}$
- $\text{start} \to q_0 \to_b q_1 \to_b \boxed{q_2}$
- $q_2 \to_b q_0$
- for any $i=0,1,2$, $q_i \to_a q_i$
Another example: $L = \{ w \in \{a, b\}^* ~|~ \text{$w$ contains $aa$ as a substring} \}$