Lesson

Designing a Deterministic Finite Automaton

How to build a deterministic finite automaton for a given language: ask what the machine must remember, discover five design strategies (one fact, progress in a pattern, counting modulo, stages, a trap state) and practise each at once, on validators from real life.

Last updated:


In this lesson we learn to build a deterministic finite automaton (DFA) for a language described in words, guided by the question “what must the machine remember?”.
We meet five design strategies: remember one fact, follow progress in a pattern, count modulo, read the stages of the word, and send invalid input to a trap state; and we test the automaton we built on edge-case words.
We practise the skill on validators: components that check whether an input satisfies a validity rule.

Designing a validator: from specification to automaton

A validator is a component that reads input character by character and says whether it satisfies a rule:
an amount field in a form, a PIN code, a file name. When the rule can be checked with finite memory, the validator can be built as a DFA, correct by construction and open to testing.
The specification says what is valid; the question is how to get from it to an automaton.

The question that leads the design is what must the machine remember? In every topic we start with an attempt:
we build an example validator and discover what must be remembered, then we name the approach, and we practise it at once, before moving to the next topic.

Remember one fact

Think first: a validator accepts words over {a,b}\{a,b\} that end with bb⁠.
What must it remember at every moment, and how many states does that mean?

Hint

What matters about the input that has already passed, apart from the last letter that was read?

Answer

Only the last letter: is it bb⁠. Two states: q0q_0⁠, not yet (start), and qbq_b⁠, just read bb (accepting).
A state’s name is the letter qq with a subscript that says what the state remembers:
in qbq_b the last letter is bb⁠, and the subscript 00 marks a state with no progress yet, the start state, to which every aa returns.
Every aa leads to q0q_0 and every bb to qbq_b⁠.

q0qbabab
The automaton for the words that end with bb⁠: q0q_0 is not yet and qbq_b is just read bb.

Transitions of the diagram:

  • δ(q_0, a) = q_0
  • δ(q_0, b) = q_b
  • δ(q_b, a) = q_0
  • δ(q_b, b) = q_b

This is the first strategy: remember one fact. When the rule depends on one detail of what was read (the last letter, the first letter, whether something appeared), use one state for each value of the detail.

1. Build a DFA over {0,1}\{0,1\} that accepts even binary numbers, that is, nonempty words that end with 00⁠.

Hint

Which fact about the word decides whether the number is even?

Answer

Two states: q¬evenq_{\neg\mathrm{even}} (“not even”: start, or the last letter is not 00⁠) and qevenq_{\mathrm{even}} (the last letter is 00⁠, so the number is even; accepting).
The subscript of each state is a property of the number read so far:
even, and ¬even\neg\mathrm{even} (not even; ¬\neg is the symbol for “not”).
The empty word is not an even number, so the start state is q¬evenq_{\neg\mathrm{even}}⁠.
00 leads to qevenq_{\mathrm{even}} and 11 to q¬evenq_{\neg\mathrm{even}} from every state.
The empty word is rejected, because q¬evenq_{\neg\mathrm{even}} is not accepting.

Follow progress in a pattern

A validator of a pattern (for example a file name that ends with a given extension) must know how much of the end of the input matches the pattern.
We start with an attempt:

2. Build a DFA with at most 33 states over {a,b}\{a,b\} for the words that end with abab⁠.
Give it as a diagram and as a formal tuple with a transition table.

Hint

What must be remembered about the part of the word already read?
Think about how many letters of abab the end of the word matches so far.

Answer

States named by the part of abab that the end of the word already matches:
q0q_0 (matches nothing), qaq_a (the word ends with aa⁠) and qabq_{ab} (ends with abab⁠, accepting).
From q0q_0⁠: a→qaa\to q_a⁠, b→q0b\to q_0⁠. From qaq_a⁠: a→qaa\to q_a⁠, b→qabb\to q_{ab}⁠. From qabq_{ab}⁠:
a→qaa\to q_a⁠, b→q0b\to q_0⁠.

q0qaqabbaabab
A DFA for the words that end with abab⁠: the state remembers how many letters of abab the end of the word matches so far.

Transitions of the diagram:

  • δ(q_0, a) = q_a
  • δ(q_0, b) = q_0
  • δ(q_a, a) = q_a
  • δ(q_a, b) = q_ab
  • δ(q_ab, a) = q_a
  • δ(q_ab, b) = q_0

For a pattern of length kk⁠, k+1k+1 states suffice: the machine remembers how many letters of the pattern have matched so far, and that number is one of the values 0,1,…,k0,1,\ldots,k⁠, that is, k+1k+1 values.
This is the second strategy: follow progress in a pattern. For “contains abab” the states are the same as for “ends with abab”, but the last state is a trap:
after we found it, nothing changes the answer; for “ends with abab” a new aa goes back to qaq_a and a bb to q0q_0⁠.

3. Explain your machine. Take a DFA for the words that end with abab⁠.
In one sentence per state, say what the state remembers, and name a word that reaches it.
Then explain why no state is needed for “the last two letters are bbbb”.

Hint

For each state of the automaton of exercise 2, finish the sentence “the run is here exactly when the word so far …”.
After reading bb from q0q_0 or qabq_{ab}⁠, does it matter whether the letter before was a bb⁠?

Answer

q0q_0⁠: the word does not end with aa or abab (for example ε\varepsilon or bbbb⁠).
qaq_a⁠: the word ends with aa (for example aa or bbabba⁠).
qabq_{ab}⁠: the word ends with abab (for example abab⁠). A state for “ends with bbbb” is not needed because a bb matters only right after an aa⁠; whether the letter before was a bb changes nothing about what the word still needs in order to end with abab⁠.

4. A base (a nitrogenous base) is one of the four letters of DNA:
A,C,G,TA,C,G,T⁠. A start codon is the sequence ATGATG⁠, where a stretch that codes for a protein begins.
Build a DFA over {A,C,G,T}\{A,C,G,T\} that accepts every sequence containing a start codon, and test it on CCATGACCATGA and on ATAGTATAGT⁠.

Hint

Track the progress in the pattern ATGATG⁠. How many of its letters have just been read at the end of the input, and what must be remembered when an AA comes after ATAT⁠?
It can start a new ATGATG⁠.

Answer

Four states, each named by the part of ATGATG that the end of the input already matches:
q0q_0 (no progress), qAq_A (the sequence ends with AA⁠), qATq_{AT} (ends with ATAT⁠), qATGq_{ATG} (found ATGATG⁠, accepting and a trap: every letter stays in qATGq_{ATG}⁠).
From q0q_0⁠: A→qAA\to q_A⁠, any other letter stays. From qAq_A⁠: A→qAA\to q_A⁠, T→qATT\to q_{AT}⁠, C,G→q0C,G\to q_0⁠.
From qATq_{AT}⁠: A→qAA\to q_A⁠, G→qATGG\to q_{ATG}⁠, C,T→q0C,T\to q_0⁠. The run on CCATGACCATGA is q0,q0,q0,qA,qAT,qATG,qATGq_0,q_0,q_0,q_A,q_{AT},q_{ATG},q_{ATG} (accepted); the run on ATAGTATAGT is q0,qA,qAT,qA,q0,q0q_0,q_A,q_{AT},q_A,q_0,q_0 (rejected: after ATAT came an AA⁠, not a GG⁠).

q0qAqATqATGC,G,TAATC,GAGC,TA,C,G,T
A recognizer of the start codon ATGATG⁠. The letter AA leads to qAq_A from every state except qATGq_{ATG}⁠, because it can open a new ATGATG⁠; qATGq_{ATG} is accepting and a trap.

Transitions of the diagram:

  • δ(q_0, A) = q_A
  • δ(q_0, C) = q_0
  • δ(q_0, G) = q_0
  • δ(q_0, T) = q_0
  • δ(q_A, A) = q_A
  • δ(q_A, C) = q_0
  • δ(q_A, G) = q_0
  • δ(q_A, T) = q_AT
  • δ(q_AT, A) = q_A
  • δ(q_AT, C) = q_0
  • δ(q_AT, G) = q_ATG
  • δ(q_AT, T) = q_0
  • δ(q_ATG, A) = q_ATG
  • δ(q_ATG, C) = q_ATG
  • δ(q_ATG, G) = q_ATG
  • δ(q_ATG, T) = q_ATG

Meaningful state names. In the machines we built so far, the name of a state says what the state remembers:
a letter and a subscript, and the subscript is the information the state keeps.
In the start-codon recognizer, qATq_{AT} means “the input so far ends with ATAT”.
Names like these make the diagram easier to read, and they also make the formal description easier, because it is clear how to fill in the transition table:
from qATq_{AT}⁠, the letter GG completes the pattern and leads to qATGq_{ATG}⁠, the letter AA starts a new match and leads to qAq_A⁠, and the letters CC and TT lead back to q0q_0⁠.
When one question involves two automata, we keep the same form and tell them apart by the letter:
qq for the states of the first automaton and pp for the states of the second.

Count modulo

Think first: a validator accepts words over {a,b}\{a,b\} in which the number of aa‘s is even.
What must it remember? And what if the condition is that the number of aa‘s is divisible by 33⁠?

Answer

Not the count, only its remainder: one state for each remainder.
Modulo 22 there are two states (aa swaps them, bb keeps them), and modulo 33 three states (aa adds 11 to the remainder modulo 33⁠).

q0q1q2aaabbb
A counter of aa modulo 33⁠: in the state qiq_i the number of aa's read leaves the remainder ii on division by 33⁠. The letter aa moves around the cycle, and bb keeps the state.

Transitions of the diagram:

  • δ(q_0, a) = q_1
  • δ(q_0, b) = q_0
  • δ(q_1, a) = q_2
  • δ(q_1, b) = q_1
  • δ(q_2, a) = q_0
  • δ(q_2, b) = q_2

This is the third strategy: count modulo mm⁠. When the condition depends on a count only through its remainder on division by a fixed number mm (an even number of aa‘s, a length divisible by 33⁠, the binary value of the input), use one state for each remainder, that is, mm states.
First find the update rule, then the table. The next example is the hardest of the three, because the update rule needs a computation:

An example from hardware: bits arrive one at a time on a wire, most significant bit first, and the device must decide whether the number received so far is divisible by 33 (one way to verify a computation in hardware is to compare remainders modulo 33⁠: the method was studied as early as Avizienis, 1971, and a patent on fault detection in an arithmetic unit shows it in use).
The most significant bit is the one that contributes the most to the number’s value, and it is the leftmost.
For example, 1313 is written 11011101 in binary: the bits contribute 88⁠, 44⁠, 00 and 11 (since 8+4+0+1=138+4+0+1=13⁠), and the leftmost bit, which contributes 88⁠, arrives first.
The number may have millions of bits, so here too it cannot be stored, or even have its bits counted.

The automaton for “binary number divisible by 33” has states q0,q1,q2q_0,q_1,q_2 (the remainder so far), start and accepting state q0q_0⁠, and for every bit cc⁠, δ(qi,c)=q(2i+c) mod 3\delta(q_i,c)=q_{(2i+c)\bmod 3}⁠.
Why this formula: appending a bit cc to a binary number of value vv gives the value 2v+c2v+c⁠, and if v≡i(mod3)v\equiv i\pmod 3 then 2v+c≡2i+c(mod3)2v+c\equiv 2i+c\pmod 3⁠, so the new remainder depends only on the old remainder and on cc⁠:

In the transition table below, the arrow marks the start state and the asterisk an accepting state:

Stateon 0on 1
→∗ q0\to{*}\,q_0q0q_0q1q_1
q1q_1q2q_2q0q_0
q2q_2q1q_1q2q_2
q0q1q2011001
The same automaton as a diagram: the state qiq_i remembers the remainder ii of the number read so far on division by 33⁠.

Transitions of the diagram:

  • δ(q_0, 0) = q_0
  • δ(q_0, 1) = q_1
  • δ(q_1, 0) = q_2
  • δ(q_1, 1) = q_0
  • δ(q_2, 0) = q_1
  • δ(q_2, 1) = q_2

On the word 10011001 the run is

q0→1q1→0q2→0q1→1q0,q_0\xrightarrow{1}q_1\xrightarrow{0}q_2\xrightarrow{0}q_1\xrightarrow{1}q_0 ,

that is δ∗(q0,1001)=q0∈F\delta^*(q_0,1001)=q_0\in F⁠, so 10011001 is accepted, and indeed 10012=9=3⋅31001_2=9=3\cdot 3⁠. The state never held the number, only its remainder.
The empty word is accepted here, because q0q_0 is accepting:
ε∈L(A)\varepsilon\in L(A) exactly when q0∈Fq_0\in F⁠. Here the empty word is read as the number 00⁠; to reject it we would add a new non-accepting start state that moves exactly like q0q_0⁠.

5. A communication line sends frames of bits, and the sender adds a bit that makes the number of ones even.
A parity validator checks that a received frame has an even number of ones.
Build a DFA over {0,1}\{0,1\} for this validator.

Hint

What must be remembered from the count of ones, and what does 00 do?

Answer

Two states: q0q_0 (an even number of ones so far, start and accepting) and q1q_1 (odd).
00 keeps the state and 11 swaps it. The empty word is accepted:
zero ones is an even number.

Stages of a word

When the input has a structure, for example a beginning followed by an end, or a sign followed by digits, it passes through stages.
We start with an attempt:

6. Build a DFA with at most 44 states over {a,b}\{a,b\} for the words that start with aa and end with bb.

Hint

Use a state for each phase of the word. What must be known about the start, and what about the last letter, to decide whether to accept?

Answer

States q0q_0 (start), qaq_a (started with aa⁠, last letter aa⁠), qbq_b (started with aa⁠, last letter bb⁠, accepting) and a rejecting trap qtrapq_{\mathrm{trap}}⁠.
After a correct start the subscript is the last letter. From q0q_0⁠:
a→qaa\to q_a⁠, b→qtrapb\to q_{\mathrm{trap}}⁠. From qaq_a⁠: a→qaa\to q_a⁠, b→qbb\to q_b⁠. From qbq_b⁠: a→qaa\to q_a⁠, b→qbb\to q_b⁠.
From qtrapq_{\mathrm{trap}}⁠: both letters to qtrapq_{\mathrm{trap}}⁠.

q0qaqbqtrapabababa,b
Starts with aa and ends with bb⁠: one state for each stage, and qtrapq_{\mathrm{trap}} is the trap state of a wrong start.

Transitions of the diagram:

  • δ(q_0, a) = q_a
  • δ(q_0, b) = q_trap
  • δ(q_a, a) = q_a
  • δ(q_a, b) = q_b
  • δ(q_b, a) = q_a
  • δ(q_b, b) = q_b
  • δ(q_trap, a) = q_trap
  • δ(q_trap, b) = q_trap

This is the fourth strategy: read the stages of the word. One state for each stage.
For “starts with aa and ends with bb”: nothing has been read yet; we started correctly and the last letter is not bb⁠; we started correctly and the last letter is bb⁠; we failed at the start.

7. A form field for an amount accepts an integer with an optional sign, such as +250+250⁠, −7-7 or 4242⁠.
Input validation is the check that the typed text fits the format.
The input is a word over {s,d,x}\{s,d,x\}⁠: ss is a sign (plus or minus), dd a digit and xx any other character.
Build a DFA that accepts exactly the words that look like an optional sign followed by at least one digit, and include a rejecting trap state for everything invalid.

Hint

Use a state for each phase of the word. Which phases lie between the start of the text and the first digit, and which phase is accepting?
What happens to a sign that comes after a digit?

Answer

Four states: q0q_0 (start), qsignq_{\mathrm{sign}} (a sign was read), qdigitsq_{\mathrm{digits}} (at least one digit was read, accepting) and qtrapq_{\mathrm{trap}} (invalid, a rejecting trap).
From q0q_0⁠: s→qsigns\to q_{\mathrm{sign}}⁠, d→qdigitsd\to q_{\mathrm{digits}}⁠, x→qtrapx\to q_{\mathrm{trap}}⁠. From qsignq_{\mathrm{sign}}⁠: d→qdigitsd\to q_{\mathrm{digits}}⁠, s,x→qtraps,x\to q_{\mathrm{trap}}⁠.
From qdigitsq_{\mathrm{digits}}⁠: d→qdigitsd\to q_{\mathrm{digits}}⁠, s,x→qtraps,x\to q_{\mathrm{trap}}⁠. From qtrapq_{\mathrm{trap}} every letter stays in qtrapq_{\mathrm{trap}}⁠.
For example sdsd and dd are accepted, while ε\varepsilon⁠, ss⁠, dsds and sxsx are rejected.

q0qsignqdigitsqtrapsdxds,xds,xs,d,x
Validating a number with an optional sign: qtrapq_{\mathrm{trap}} is the rejecting trap state, and every letter that comes in the wrong place leads to it.

Transitions of the diagram:

  • δ(q_0, s) = q_sign
  • δ(q_0, d) = q_digits
  • δ(q_0, x) = q_trap
  • δ(q_sign, s) = q_trap
  • δ(q_sign, d) = q_digits
  • δ(q_sign, x) = q_trap
  • δ(q_digits, s) = q_trap
  • δ(q_digits, d) = q_digits
  • δ(q_digits, x) = q_trap
  • δ(q_trap, s) = q_trap
  • δ(q_trap, d) = q_trap
  • δ(q_trap, x) = q_trap

8. The binary-number scanner of the lesson Deterministic Finite Automata: Deciding with Fixed Memory accepts texts such as 101101 and 101.01101.01 (the alphabet is {0,1,.}\{0,1,\texttt{.}\}⁠).
Extend it to accept an optional minus sign at the start as well, as in −101.01-101.01⁠.
The new alphabet also contains the minus sign. How many states must be added, and what are the new transitions?

Hint

The minus sign is allowed only at the start of the text. What must be remembered after a minus sign was read and before a bit was read?
And what happens to any minus sign that arrives later?

Answer

Add one state, q5q_5 (a minus sign was read and no bit yet), which is not accepting.
From q0q_0 on the minus sign go to q5q_5⁠. From q5q_5 on a bit go to q1q_1 (from there continue as before), and on the point and on the minus sign go to q4q_4⁠.
In each of the states q1,q2,q3,q4q_1,q_2,q_3,q_4 the transition on the minus sign goes to q4q_4⁠.
In total six states. For example −101.01-101.01 is accepted, while −- and 1−1- are rejected.

9. The scanner must now recognize a decimal number: the alphabet is the digits 00 to 99 and the point.

(a) Build it and write its five parts. What changes compared with the binary scanner of the lesson Deterministic Finite Automata: Deciding with Fixed Memory?

Hint

Which arrows of the binary scanner were labelled 0,10,1⁠? What happens to them when there are ten digits?

Answer

The same five states and the same accepting states, F={q1,q3}F=\{q_1,q_3\}⁠. The alphabet is Σ={0,1,…,9}∪{.}\Sigma=\{0,1,\ldots,9\}\cup\{\texttt{.}\}⁠.
Every arrow that was labelled 0,10,1 is now labelled with the ten digits:
δ(q0,c)=δ(q1,c)=q1\delta(q_0,c)=\delta(q_1,c)=q_1⁠, δ(q2,c)=δ(q3,c)=q3\delta(q_2,c)=\delta(q_3,c)=q_3 and δ(q4,c)=q4\delta(q_4,c)=q_4 for every digit cc⁠. The transitions on the point do not change.
The number of states stays, and only the number of letters on each arrow grows.

(b) The lesson Languages: Operations and Equalities defines the language of the natural numbers written in decimal, with no leading zero (except for the number zero itself).
Build a DFA that accepts exactly that language, over the digits only.

Hint

What must be remembered after a 00 was read as the first digit, and what after any other first digit?
What happens to a digit that arrives after a first 00⁠?

Answer

Four states: q0q_0 (nothing read yet), zz (only a 00 was read, accepting), q1q_1 (a first digit other than 00 and digits after it were read, accepting) and ee (invalid, a trap).
δ(q0,0)=z\delta(q_0,0)=z⁠, δ(q0,c)=q1\delta(q_0,c)=q_1 for every c∈{1,…,9}c\in\{1,\ldots,9\}⁠, δ(z,c)=e\delta(z,c)=e⁠, δ(q1,c)=q1\delta(q_1,c)=q_1 and δ(e,c)=e\delta(e,c)=e for every digit cc⁠.
The set of accepting states is {z,q1}\{z,q_1\}⁠. For example 00 and 305305 are accepted, while 007007 is rejected.

Forbidden is a trap state

A validator rejects whatever is forbidden, and once the input is invalid no continuation repairs it.
We start with an attempt:

10. A validator accepts words over {a,b}\{a,b\} that do not contain two consecutive aa‘s.
Build a DFA.

Hint

What must be remembered about the last letter, and what happens when an aa follows an aa⁠?

Answer

Three states: q0q_0 (start, or the last letter is bb⁠), qaq_a (the last letter is aa⁠) and qtrapq_{\mathrm{trap}} (invalid, a rejecting trap state).
From q0q_0⁠: a→qaa\to q_a⁠, b→q0b\to q_0⁠. From qaq_a⁠: a→qtrapa\to q_{\mathrm{trap}}⁠, b→q0b\to q_0⁠. From qtrapq_{\mathrm{trap}}⁠:
both letters to qtrapq_{\mathrm{trap}}⁠. The states q0,qaq_0,q_a are accepting.

q0qaqtrapbabaa,b
No two consecutive aa's: a second aa in a row leads to the trap state qtrapq_{\mathrm{trap}}⁠.

Transitions of the diagram:

  • δ(q_0, a) = q_a
  • δ(q_0, b) = q_0
  • δ(q_a, a) = q_trap
  • δ(q_a, b) = q_0
  • δ(q_trap, a) = q_trap
  • δ(q_trap, b) = q_trap

This is the fifth strategy: forbidden is a trap state. Send every invalid input to a rejecting trap state, like q4q_4 in the scanner; and after we found what we were looking for, the accepting state itself is a trap.

11. A validator of a short code accepts exactly the words over {0,1}\{0,1\} of length 44 (four bits, no fewer and no more).
Build a DFA.

Hint

What must be remembered, and what happens when the word is too long?

Answer

Six states: q0,…,q4q_0,\ldots,q_4 by the number of letters read, and a rejecting trap state qtrapq_{\mathrm{trap}} for input that is too long.
qi→qi+1q_i\to q_{i+1} on both letters for every i<4i<4⁠, q4→qtrapq_4\to q_{\mathrm{trap}} and qtrap→qtrapq_{\mathrm{trap}}\to q_{\mathrm{trap}}⁠. Only q4q_4 is accepting.

q0q1q2q3q4qtrap0,10,10,10,10,10,1
Exactly four bits: the state qiq_i counts the letters read, and every letter after the fourth leads to the trap state qtrapq_{\mathrm{trap}}⁠.

Transitions of the diagram:

  • δ(q_0, 0) = q_1
  • δ(q_0, 1) = q_1
  • δ(q_1, 0) = q_2
  • δ(q_1, 1) = q_2
  • δ(q_2, 0) = q_3
  • δ(q_2, 1) = q_3
  • δ(q_3, 0) = q_4
  • δ(q_3, 1) = q_4
  • δ(q_4, 0) = q_trap
  • δ(q_4, 1) = q_trap
  • δ(q_trap, 0) = q_trap
  • δ(q_trap, 1) = q_trap

Summary: what must the machine remember?

Fill in the middle column before you click the question mark in a row:
for each strategy, what the machine remembers.

The strategyWhat the machine remembersExamples from the lesson
Remember one fact
?the value of one detail of the word (for example the last letter)
ends with bb⁠; an even binary number
Follow progress in a pattern
?how many letters of the pattern have matched, from 00 to kk
ends with abab⁠; a start codon
Count modulo mm
?the remainder of the count
an even number of aa‘s; a binary number divisible by 33⁠; parity
Read the stages of the word
?at which stage of the structure we are
starts with aa and ends with bb⁠; a number with an optional sign
Forbidden is a trap state
?whether the input has already been rejected (or already accepted for good)
contains no aaaa⁠; exactly four bits

How many states are needed? Two prefixes must lead to different states if some continuation separates them (one of them continues into the language and the other does not):
had they reached the same state, every continuation would be handled the same way.
This gives a lower bound on the number of states.

Every time, test. Check the empty word; check each state has an arrow for each letter; run the two or three shortest words that are in the language and the shortest ones that are not.

When these strategies fail. If the machine would have to remember an unbounded quantity (for example, how many aa‘s came before the bb‘s in {anbn}\{a^nb^n\}⁠), no finite number of states is enough.

Common mistakes

  • A missing transition. In a DFA every state needs an arrow for every letter. Send forbidden letters to a trap state.
  • Confusing the start state with an accepting state. Whether ε\varepsilon is accepted depends only on whether q0∈Fq_0\in F⁠.
  • Testing too few words. A few accepted words do not show that the automaton recognizes the intended language. Check border words, and justify the design by the meaning of each state.

Back to the lesson Deterministic Finite Automata: Deciding with Fixed Memory.
Next: combining automata, or see the glossary.