From a Drawing to a Definition, and Back
Practise moving between the two descriptions of a deterministic finite automaton (DFA): read a drawn automaton and write its formal definition, and draw an automaton from a definition; the tool checks every answer.
Last updated:
From a drawing to a definition
The lesson Deterministic Finite Automata gave two descriptions of a deterministic finite automaton (DFA):
a state diagram, and the formal definition , with the transition function and the set of accepting states .
Here you practise moving between them in both directions.
Question 1. The tool below shows a DFA over . Read the drawn automaton and write its formal definition:
the set of states , the start state , the set of accepting states and the transition function .
Choose the target of every state on every letter, then press “Check the definition”.
The workbench needs JavaScript. Use the question on paper instead.
Hint
Name the states in the drawing, then follow the arrows of one state at a time.
Every state has exactly one arrow on and one on .
The accepting states are drawn with a double circle, and the start state has an arrow that comes from nowhere.
Answer
, start state , , and , , , , , , .
The automaton accepts the words that start with and end with , and is a rejecting trap.
From a definition to a drawing
How to use the workbench
- Double-click an empty place to add a state, and drag a state to move it. Double-click a state to make it accepting, or not accepting.
- Hold Shift and drag from an empty place to a state to mark it as the start state (drag the tail of its arrow to move or resize it). Hold Shift and drag from a state to another state (or back to the same state) to draw an arrow, then type its letters, separated by commas, and press Enter. Drag an arrow to bend it, and press Delete or Backspace to remove the selected state or arrow.
- Everything the drawing can do can also be done in the list of states and the transition table, with a keyboard or on a touch screen.
- Choose what to check against, and press “Check”. A deterministic finite automaton (DFA) must have exactly one arrow from every state on every letter; the workbench lists what is missing.
Question 2. Let with , , start state , and for and every bit .
Draw this automaton in the tool below, with the state names of the definition, and press “Check”.
Then say which words it accepts.
The workbench needs JavaScript. Use the question on paper instead.
Hint
Compute for each of the six pairs, for example .
Then draw one arrow for each pair.
Answer
, , , , , . The state means that the binary number read so far leaves remainder when divided by , so the automaton accepts the binary numbers that are divisible by (and the empty word).
Back to Deterministic Finite Automata, or see the glossary.