Simulating a finite automaton
A DFA reads a word symbol by symbol and changes state as it goes. In the end only the last state decides.
Rules
- Start in the state with the arrow
- Exactly one transition per symbol
- Accepted if the last state is accepting
Your turn
Three problems on this topic. The software checks your answer exactly.
- 1 · Simulate a DFA
- 2
- 3
The automaton reads the word from left to right (start →, accepting *).
w = bbab
| δ | a | b |
|---|---|---|
| → *q0 | q2 | q0 |
| *q1 | q0 | q0 |
| q2 | q1 | q0 |
Which state does it end in? (number, q2 = 2)
Is the word accepted?
Worked example
The automaton reads the word from left to right (start →, accepting *).
w = baaa
| δ | a | b |
|---|---|---|
| → q0 | q0 | q2 |
| q1 | q0 | q0 |
| *q2 | q1 | q2 |
Worked solution
- 1q0 → q2 → q1 → q0 → q0
- 2q0 is not accepting.
Typical mistake: Only the state after the last symbol counts, not whether an accepting state was visited on the way.
Common questions
What is a DFA?
A deterministic finite automaton has exactly one next state for each symbol in each state.
