Constructing a DFA, with automatic checking
To build an automaton, think about what it has to remember. Each state stands for one piece of information. The trainer compares your automaton with the language exactly.
Rules
- Think: what must be remembered?
- Complete: every state, every symbol
- A trap state for words that can no longer match
- More states than the minimum are fine as long as the language is right
Your turn
Three problems on this topic. The software checks your answer exactly.
- 1 · Construct a DFA
- 2
- 3
Build a complete finite automaton over {a, b} for: All words ending in ba.
Your automaton (the minimum is 3 states)
| δ | a | b | Accepting |
|---|---|---|---|
| → q0 | |||
| q1 | |||
| q2 |
Worked example
Build a complete finite automaton over {a, b} for: All words with an odd number of b.
Worked solution
- 1Minimal automaton with 2 states:
- 2→ q0: a→q0, b→q1
- 3*q1: a→q1, b→q0
Typical mistake: The automaton must be complete: every state needs a transition for each symbol, into a trap state if necessary.
Common questions
Must my automaton be minimal?
No. The trainer only checks whether the language is right, and otherwise shows a counterexample.
