Lesson 5 drops the determinism requirement and lets a machine take several arrows on one symbol, or none at all. It covers the active-set method of running such a machine, acceptance as an existential claim over paths, and the computation tree, then gives the five-tuple with its set-valued transition function, epsilon-arrows and epsilon-closure, and the extended transition function with closures. It closes with guess-and-verify design and the exponential saving in states it can produce, why swapping the accepting set fails to complement an NFA, and what nondeterminism is not.
Subject: Theory of Computation · 112 slides · symbolic lesson
Open the interactive version of this deck · Homework for this lesson
Title
Theory of Computation · Lesson 5
Let the machine take several arrows at once, or none at all. It becomes far easier to design — and, remarkably, no more powerful.
Objectives
Lesson 4 insisted on exactly one arrow per state per symbol. This lesson drops that rule and sees what happens. By the end you can:
Warm-up
Discussion prompt
Before we open Nondeterministic Finite Automata: without looking back, what was the main idea of Deterministic Finite Automata, and what could you do by the end of it that you could not do before?
Hint: One sentence for the idea, one for the skill. If the second one is blank, that is the part to revisit.
Answer:
Lesson 4 introduces the first machine model. It covers state diagrams and tracing, the determinism requirement, the formal five-tuple, and transition tables, then defines the extended transition function by recursion and uses it to define acceptance, the language of a machine, and a regular language. From there it gives a design recipe built on asking what has to be remembered, and covers dead states, counting modulo a fixed number, the product construction for union and intersection, complement by swapping the accepting set, and correctness proofs by invariant.
Section
Section 1
Concept
A nondeterministic finite automaton looks exactly like the machines of Lesson 4, except that two restrictions on the arrows are lifted.
The first means the machine faces a choice. The second means a run can simply stop partway through the input, with symbols left unread.
| DFA | NFA | |
|---|---|---|
| arrows per state per symbol | exactly one | any number, including zero |
| runs on a given input | exactly one | any number, including zero |
| can it get stuck? | never | yes |
Comparison
Comparison matrix
From Two rules are dropped at once: refill the DFA column from what you know. The rest of the table is as it appeared.
| DFA | NFA | |
|---|---|---|
| arrows per state per symbol | exactly one | any number, including zero |
| runs on a given input | exactly one | any number, including zero |
| can it get stuck? | never | yes |
Intuition
The cleanest way to think about it: instead of one marker walking the diagram, imagine a handful of markers, and the handful changes size as you read.
When a marker meets two arrows with the right label, it splits — one copy down each. When it meets none, it dies. Symbols are read by every surviving marker simultaneously.
At any moment the machine's situation is not a single state but a set of states: exactly the states some marker is currently standing on.
\[ \text{situation} \;=\; S \subseteq Q \]
Counterexample
Discussion prompt
The cleanest way to think about it: instead of one marker walking the diagram, imagine a handful of markers, and the handful changes size as you read.
That is stated as though it always holds. Do one of two things: produce a case where it fails, or say precisely what rules such a case out. "It just does" is not on the menu.
Hint: Hunt at the extremes first — zero, one, negative, empty, equal. If every extreme survives, the reason they survive is the proof.
Answer:
When a marker meets two arrows with the right label, it splits — one copy down each. When it meets none, it dies. Symbols are read by every surviving marker simultaneously.
Concept
Running the machine means updating that set once per symbol. The rule is a union.
For each state in the current set, collect every state its arrows on the incoming symbol lead to, and take the union of all those collections.
\[ S \;\longmapsto\; \bigcup_{q \in S} \delta(q, a) \]
Nothing else is needed. States with no arrow contribute the empty set and quietly drop out; states with two arrows contribute both destinations.
If the set ever becomes empty it stays empty, because a union of nothing is nothing. That is what 'every branch has died' looks like in this bookkeeping.
\[ S = \varnothing \;\Longrightarrow\; \text{every later set is } \varnothing \]
Analogy
Discussion prompt
Explain The active set, and how it advances by analogy to something with no Theory of Computation in it at all — a queue, a recipe, a map, a bank balance, whatever fits. Then say where your analogy breaks.
Hint: An analogy that never breaks is not an analogy, it is the same idea wearing a hat. Find the seam — that is the part that is actually new.
Answer:
Running the machine means updating that set once per symbol. The rule is a union.
Intuition
Two markers standing on the same state are indistinguishable. Whatever one of them does next, the other does identically, so keeping both is pure bookkeeping waste.
That is why the situation is recorded as a set rather than a list or a multiset. Collapsing duplicates costs nothing and is what keeps the number of distinct situations finite.
It also puts a hard ceiling on the work. However much the machine branches, the active set is a subset of the state set, so it can never have more members than the machine has states.
\[ |S| \le |Q| \quad\text{at every step} \]
Explain it
Discussion prompt
Explain The active set never needs duplicates to a student a year behind you. No notation, no jargon they have not met — and it still has to be true.
Hint: If your explanation needs a symbol they have never seen, you are describing the notation rather than the idea.
Answer:
Two markers standing on the same state are indistinguishable. Whatever one of them does next, the other does identically, so keeping both is pure bookkeeping waste.
Concept
Because the active set is a subset, the machine has only finitely many possible situations — and the count is exactly the number of subsets.
\[ \text{possible active sets} \;=\; |\mathcal{P}(Q)| = 2^{|Q|} \]
This is a large number but a finite one, and that observation is the entire idea behind Lesson 6. If there are finitely many situations, each one can be made a state of an ordinary deterministic machine.
Hold on to the number. It is where the exponential cost of determinization comes from, and it is also why that cost cannot in general be avoided.
Picture it
Figure (svg): Automaton with states q0, q1, q2
Discussion prompt
Read the picture before the words. What is this showing, and what is the one thing it is built to make obvious? Commit to an answer, then read on.
Hint: Name the parts, then say what changes between them — and if nothing changes, say what is being held still.
Answer:
Run the machine below on the input 0010, tracking the active set after each symbol.
Worked example
Run the machine below on the input 0010, tracking the active set after each symbol.
Figure (svg): Automaton with states q0, q1, q2
Start with the set holding just the start state
Why: Before any symbol is read there is one marker, on the start state, so the active set is a one-element set.
\[ S_0 = \{q_0\} \]
Read the first 0
Why: From the start state a 0 leads two ways: the self-loop keeps a marker there, and the guessing arrow sends a copy onward. The set grows.
\[ S_1 = \{q_0\} \cup \{q_1\} = \{q_0, q_1\} \]
Read the second 0
Why: The start state again splits into both destinations. The middle state has no 0-arrow at all, so that marker dies and contributes nothing.
\[ S_2 = \{q_0, q_1\} \cup \varnothing = \{q_0, q_1\} \]
Read the 1
Why: The start state's self-loop keeps a marker there. The middle state's 1-arrow reaches the accepting state. Both contributions are unioned.
\[ S_3 = \{q_0\} \cup \{q_2\} = \{q_0, q_2\} \]
Read the final 0
Why: The start state splits as usual. The accepting state has no outgoing arrows at all, so that marker dies — reaching the accepting state early is worth nothing.
\[ S_4 = \{q_0, q_1\} \]
Verify the verdict against the language
Why: The final set misses the accepting state, so 0010 is rejected. That is right: the language is the strings ending in 01, and 0010 ends in 10. The set bookkeeping and the specification agree.
\[ S_4 \cap F = \varnothing \;\Rightarrow\; \text{reject} \ \checkmark \]
Notation
Annotate
From Trace a string as a moving set of states — read this one piece at a time. What is each part doing?
On: \( S_1 = \{q_0\} \cup \{q_1\} = \{q_0, q_1\} \)
Ranking
Put in order
These are the steps of How to run a machine by the active set, scrambled. Put them back in order before the next slide shows you.
Why: This is the order the recipe itself gives. Recalling the sequence without the slide in front of you is the difference between recognising the method and being able to run it — most of what goes wrong in practice is a step done out of turn.
Pattern
The procedure never varies, and writing it as a table makes mistakes visible.
Two habits prevent nearly all errors: never let a state appear twice in a set, and never stop early because a set looks promising.
Elimination
Eliminate the wrong options
While running an NFA, the active set becomes empty after reading some prefix. What happens next?
3 of these 4 are wrong. Strike them one at a time, and say what rules each one out before you strike the next. The survivor is the answer.
Survives elimination: A
Why: The update rule takes a union over the members of the current set. With no members there is nothing to union, so the next set is empty too, and this repeats. The final set is empty, misses the accepting set, and the string is rejected.
Check
Think about what a union of nothing gives.
Check your understanding
While running an NFA, the active set becomes empty after reading some prefix. What happens next?
Answer: A
Why: The update rule takes a union over the members of the current set. With no members there is nothing to union, so the next set is empty too, and this repeats. The final set is empty, misses the accepting set, and the string is rejected.
Anomaly
Predict first
A student writes this, and it looks reasonable:
Does the machine above accept the string 001?
It is wrong. Say what breaks — and say it before you turn the page.
Correct: After the first 0 the machine guesses the final block has begun and moves to the middle state.
Does the machine above accept the string 001?
Why: After the first 0 the machine guesses the final block has begun and moves to the middle state. The next symbol is another 0, and the middle state has no 0-arrow, so this branch dies. Report reject.
Trap
Does the machine above accept the string 001?
Follow the branch that guesses early
Why: After the first 0 the machine guesses the final block has begun and moves to the middle state. The next symbol is another 0, and the middle state has no 0-arrow, so this branch dies. Report reject.
\[ q_0 \xrightarrow{0} q_1 \xrightarrow{0} \text{ (no arrow — branch dies)} \]
Verdict: reject — a branch got stuck partway through.
Does the machine above accept the string 001?
Follow every branch, then ask whether ANY ends accepting
Why: The branch that waits one symbol before guessing reads 0 and stays, reads the second 0 and guesses, then reads 1 and lands on the accepting state. One surviving accepting path is the entire requirement.
\[ q_0 \xrightarrow{0} q_0 \xrightarrow{0} q_1 \xrightarrow{1} q_2 \in F \]
Verdict: accept — rejection requires every branch to fail, not just one.
Translation
\( q_0 \xrightarrow{0} q_0 \xrightarrow{0} q_1 \xrightarrow{1} q_2 \in F \)
Draw it
Translate both ways. First write the expression above as a sentence with no symbols in it at all. Then cover it, and write your sentence back as notation. If the two versions disagree, the disagreement is the thing to fix.
Concept
The acceptance rule is where nondeterminism actually lives, and it is deliberately lopsided.
\[ w \in L(N) \iff \exists \text{ a path from } q_0 \text{ spelling } w \text{ and ending in } F \]
Read the quantifier. One successful path is enough, no matter how many others die or finish in the wrong place. The machine is credited with the best outcome available to it.
In active-set language this becomes a membership test on the final set, which is why the two views agree.
\[ w \in L(N) \iff \hat{\delta}(q_0, w) \cap F \neq \varnothing \]
Intuition
A third picture is sometimes the clearest: draw the run as a tree that branches wherever the machine had a choice.
The root is the start state. Each level corresponds to one symbol of the input. A node with two children is a split; a node with none is a branch that died.
The string is accepted exactly when some leaf at the bottom level is an accepting state. Leaves higher up are dead branches and are simply ignored — they neither help nor hurt.
\[ \text{accept} \iff \exists \text{ a leaf at depth } |w| \text{ lying in } F \]
Ranking
Put in order
Put the moves of A tree where exactly one branch survives into the order they have to happen.
Why: These are the moves of the worked example in the order it makes them, and each one is set up by the one before it. The start state has two 0-arrows, so the root has two children — one staying at the start state, one guessing forward to the middle.
Worked example
Run the same machine on 001, but draw the branching explicitly rather than tracking sets.
Level one: read the first 0
Why: The start state has two 0-arrows, so the root has two children — one staying at the start state, one guessing forward to the middle.
Level two: read the second 0
Why: The staying branch splits again into two. The guessing branch is at the middle state, which has no 0-arrow, so that branch ends here as a dead leaf.
\[ \text{live at depth } 2: \{q_0, q_1\} \]
Level three: read the 1
Why: The branch at the start state loops back to itself. The branch at the middle state takes its 1-arrow to the accepting state.
\[ \text{live at depth } 3: \{q_0, q_2\} \]
Read off the verdict
Why: One leaf at the bottom level is the accepting state, so the string is accepted. The branch that died at level two placed no constraint on the answer.
Verify that the tree and the active set agree
Why: Collecting the live states at each depth gives the same sets the active-set method produced: the start state, then both, then both again, then the pair including the accepting state. Two different bookkeeping methods, one answer.
\[ \text{tree leaves at depth } |w| \;=\; \hat{\delta}(q_0, w) \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "A tree where exactly one branch survives", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Collecting the live states at each depth gives the same sets the active-set method produced: the start state, then both, then both again, then the pair including the accepting state. Two different bookkeeping methods, one answer.
Section
Section 2
Concept
The tuple has the same five slots as before. Only the transition function is different, and it is different in exactly one way.
\[ N = (Q, \Sigma, \delta, q_0, F) \]
It no longer returns a state. It returns a set of states — possibly empty, possibly several, possibly one.
\[ \delta : Q \times \Sigma \to \mathcal{P}(Q) \]
That single change encodes both dropped rules at once. Returning the empty set is 'no arrow'; returning a two-element set is 'two arrows'.
Concept
Using the power set is not a notational flourish. It is what keeps the function total while allowing zero or many destinations.
A function must return exactly one value for each input, and it does: one set. The multiplicity has been moved inside the value, where it does no harm to the definition.
\[ |\mathcal{P}(Q)| = 2^{|Q|} \]
That count is worth noticing now, because it is exactly the number of possible active sets — and in Lesson 6 it becomes the state count of the equivalent deterministic machine.
Concept
Most treatments allow one further extension, and it is the one that makes machines easy to wire together.
epsilon arrow — A transition the machine may take at any moment without consuming an input symbol.
An ε-arrow costs nothing and may always be taken. It is a way of saying 'these two states are, for free, the same place'.
Formally the alphabet is extended with ε for the purposes of the transition function only. The alphabet of the language is unchanged — no string ever contains an ε.
\[ \delta : Q \times \Sigma_{\varepsilon} \to \mathcal{P}(Q), \qquad \Sigma_{\varepsilon} = \Sigma \cup \{\varepsilon\} \]
Picture it
Figure (svg): Automaton with states q0, q1, q2
Discussion prompt
Read the picture before the words. What is this showing, and what is the one thing it is built to make obvious? Commit to an answer, then read on.
Hint: Name the parts, then say what changes between them — and if nothing changes, say what is being held still.
Answer:
Convert the ends-in-01 machine into its formal tuple.
Worked example
Convert the ends-in-01 machine into its formal tuple.
Figure (svg): Automaton with states q0, q1, q2
Read off the four easy components
Why: Three circles, two arrow labels, the stub marks the start, and one circle is doubled.
\[ Q = \{q_0,q_1,q_2\}, \; \Sigma = \{0,1\}, \; F = \{q_2\} \]
Write the transition function with set values
Why: Every cell must hold a set, even when that set is empty or has one member. Writing a bare state name here is the most common notational slip.
| δ | 0 | 1 |
|---|---|---|
| -> q0 | {q0, q1} | {q0} |
| q1 | {} | {q2} |
| * q2 | {} | {} |
Notice the empty cells
Why: Three cells are empty sets. In Lesson 4 that was illegal; here it simply means those branches die, and the function is still perfectly total.
Compare with the deterministic machine for the same language
Why: The DFA of Lesson 4 also used three states, but every cell held exactly one state and the design required naming what each state remembered. This machine needed no such analysis.
Verify the tuple by re-running one string
Why: Running 101 from the table gives the start set, then the pair, then the pair including the accepting state — which meets the accepting set, so 101 is accepted. The string does end in 01, so the table faithfully describes the picture.
\[ \hat{\delta}(q_0, 101) \cap F = \{q_2\} \neq \varnothing \ \checkmark \]
Pattern
Step through it
Step through Write the five-tuple for a nondeterministic machine one row at a time. What is driving the change, and what would the row after the last one be?
Intuition
For a deterministic machine the transition table held single state names. Here every cell holds a set, and that is not extra decoration — it is the actual content of nondeterminism.
Reading the table aloud is the algorithm: 'from the start state on a 0 you may go to the start state, or to the next one'. The word may is what the braces encode.
A useful discipline when writing these tables: always draw the braces, even around a single state, and always write the empty set explicitly rather than leaving a blank. A blank cell is ambiguous between 'no arrow' and 'not filled in yet'.
Concept
The two models are not rivals. One is a special case of the other, and the translation is purely notational.
Given a deterministic machine, wrap every transition value in braces. The result satisfies the nondeterministic definition and behaves identically, since every active set stays a one-element set forever.
\[ \delta_N(q,a) = \{\delta_D(q,a)\} \]
So one direction of the equivalence proved in Lesson 6 is free. The interesting direction — turning a genuinely nondeterministic machine into a deterministic one — is the one that needs work.
Step zero
Discussion prompt
Convert a deterministic machine into a nondeterministic one — before any calculation: what is the plan? Name the moves in order, in plain English, without doing the arithmetic.
Hint: It starts with: Wrap every transition value in braces
Answer:
Worked example
Make the special-case claim concrete by converting the ends-in-1 machine from Lesson 4.
Wrap every transition value in braces
Why: Each cell of the deterministic table held one state; each cell of the new table holds the one-element set containing it. Nothing else changes.
| δ | 0 | 1 |
|---|---|---|
| -> q0 | {q0} | {q1} |
| * q1 | {q0} | {q1} |
Check the new object satisfies the nondeterministic definition
Why: The transition function now returns subsets of the state set, which is exactly what the definition requires. Every other component is unchanged.
Watch what the active set does
Why: Starting from a one-element set, each update unions a single one-element set, so the result is again a one-element set. The active set never grows and never empties.
\[ |S_0| = 1 \;\Rightarrow\; |S_i| = 1 \text{ for every } i \]
See that acceptance agrees
Why: A one-element set meets the accepting set exactly when its single member belongs to it. So the membership test reduces to the deterministic one.
Verify on a string both machines should accept
Why: Running 1101 gives the singleton sets holding the accepting state, the accepting state, the start state, and the accepting state — the same four states the deterministic trace visited. Both machines accept, and they would agree on every input for the same reason.
\[ \hat{\delta}(q_0,1101) = \{q_1\}, \quad \{q_1\} \cap F \neq \varnothing \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Convert a deterministic machine into a nondeterministic one", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: The transition function now returns subsets of the state set, which is exactly what the definition requires. Every other component is unchanged.
Concept
Some textbooks allow a set of start states rather than one. It is a genuine convenience and adds no power whatever.
Running such a machine simply begins with the whole start set as the initial active set, and everything else proceeds unchanged.
\[ S_0 = Q_{\text{start}} \quad \text{instead of} \quad S_0 = \{q_0\} \]
To get back to the single-start definition, add one fresh state and an ε-arrow from it into each old start state. The fresh state consumes nothing, so it changes no verdict.
This is worth recognizing because it appears naturally when reversing a machine in Lesson 7: flipping the arrows turns the accepting set into a set of start states, and the fix is exactly this.
Prediction
Predict first
In the formal definition of an NFA, what is the codomain of the transition function?
Answer it in your own words, now, with nothing to choose from. The options are on the next slide — and picking the right one off a list is an easier skill than producing it.
Correct: The power set of the state set
Why: Returning a set is what lets one state-and-symbol pair map to several destinations, to exactly one, or to none. The function stays total and single-valued, because the single value it returns is itself a set.
Check
Look carefully at what the transition function returns.
Check your understanding
In the formal definition of an NFA, what is the codomain of the transition function?
Answer: A
Why: Returning a set is what lets one state-and-symbol pair map to several destinations, to exactly one, or to none. The function stays total and single-valued, because the single value it returns is itself a set.
Pattern
Given a table with braces in the cells, this recovers the machine and its behaviour.
The union step is the only place a mistake can hide. Doing it in writing, set by set, is worth the extra seconds.
Section
Section 3
Concept
An ε-arrow may be taken at any moment, which means the active set is never quite what the last symbol left behind.
If a marker sits on a state with an ε-arrow leaving it, a copy is also — immediately and for free — on the destination. And if that destination has an ε-arrow too, the same applies again.
So before and after every symbol, the active set must be saturated: closed under following ε-arrows as far as they go. That saturation has a name.
Concept
epsilon-closure — The set of all states reachable from a given set using ε-arrows alone, including the states you started from.
Two properties define it, and both are needed. It contains everything you started with, and it is closed under one more ε-step.
\[ E(S) \supseteq S, \qquad E\big(E(S)\big) = E(S) \]
Computing it is a graph reachability problem restricted to ε-arrows: start with the set, repeatedly add anything an ε-arrow reaches, and stop when a full pass adds nothing.
Picture it
Figure (svg): Automaton with states p, r, s
Discussion prompt
Read the picture before the words. What is this showing, and what is the one thing it is built to make obvious? Commit to an answer, then read on.
Hint: Name the parts, then say what changes between them — and if nothing changes, say what is being held still.
Answer:
A machine has ε-arrows from the start state to a second state, and from that second state on to a third. Compute the closure of the start state.
Worked example
A machine has ε-arrows from the start state to a second state, and from that second state on to a third. Compute the closure of the start state.
Figure (svg): Automaton with states p, r, s
Seed the set with the state itself
Why: The closure always contains what it started with, so begin there.
\[ E_0 = \{p\} \]
Take one round of epsilon-arrows
Why: The start state has an ε-arrow to the middle state, so add it. Nothing else is reachable in one step.
\[ E_1 = \{p, r\} \]
Take another round
Why: The newly added state has its own ε-arrow onward. This is the step people stop one short of — closures follow chains, not single arrows.
\[ E_2 = \{p, r, s\} \]
Take a third round and stop
Why: The last state has no outgoing ε-arrow, so nothing is added. The set is now closed, and that is the answer.
\[ E\big(\{p\}\big) = \{p, r, s\} \]
Verify by checking closure and by asking about the empty string
Why: Applying one more round adds nothing, which is exactly the fixed-point condition. And since the closure of the start state contains an accepting state, the empty string is accepted — reading nothing still lets the machine drift down the chain.
\[ E\big(E(\{p\})\big) = E(\{p\}) \quad\text{and}\quad \varepsilon \in L(N) \ \checkmark \]
Notation
Annotate
From Compute an epsilon-closure through a chain — read this one piece at a time. What is each part doing?
On: \( E\big(E(\{p\})\big) = E(\{p\}) \quad\text{and}\quad \varepsilon \in L(N) \ \checkmark \)
Concept
With closures in hand, the extended transition function for a machine with ε-arrows has the shape you would expect, plus a closure at every stage.
\[ \hat{\delta}(q, \varepsilon) = E\big(\{q\}\big) \]
The base case is already interesting: reading nothing does not leave you at the state you started from, but at everything reachable from it for free.
\[ \hat{\delta}(q, wa) \;=\; E\!\left( \bigcup_{p \in \hat{\delta}(q,w)} \delta(p,a) \right) \]
Read the recursive case as three moves: where could we be after the prefix, where does one symbol take us, and where can we drift for free afterwards.
Estimation
Predict first
Take a machine whose start state has an ε-arrow to a second state, where the second state loops on a and the first reads b to an accepting state. Run the input a.
Commit before you compute: what does Run a machine with epsilon-arrows on a full string come out to? A rough magnitude and the right form is enough — the point is to have something concrete to be wrong about.
Correct: Verify by checking the step everyone skips
Why: A prediction you can defend turns the computation into a check rather than a leap of faith — and an answer that contradicts it is caught on the spot. Had the opening closure been omitted, the run would have started at the first state alone, which has no a-arrow, and the active set would have died immediately.
Worked example
Take a machine whose start state has an ε-arrow to a second state, where the second state loops on a and the first reads b to an accepting state. Run the input a.
Close the start set before reading anything
Why: The base case closes the one-element start set, so the run begins with two live states rather than one.
\[ S_0 = E\big(\{p_0\}\big) = \{p_0, p_1\} \]
Read the symbol a from every live state
Why: Only the second state has an a-arrow; the first contributes the empty set. Union the results.
\[ \bigcup \delta(\cdot, a) = \varnothing \cup \{p_1\} = \{p_1\} \]
Close again after reading
Why: Check whether any newly reached state has an ε-arrow out of it. Here none does, so the closure changes nothing — but the step must still be performed.
\[ S_1 = E\big(\{p_1\}\big) = \{p_1\} \]
Test the final set against the accepting set
Why: The accepting state is not in the final set, so the input a is rejected by this machine.
\[ S_1 \cap F = \varnothing \]
Verify by checking the step everyone skips
Why: Had the opening closure been omitted, the run would have started at the first state alone, which has no a-arrow, and the active set would have died immediately. The verdict happens to be the same here, but the reason would have been wrong — and on the input b the two methods disagree outright.
\[ E\big(\{p_0\}\big) = \{p_0,p_1\} \neq \{p_0\} \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Run a machine with epsilon-arrows on a full string", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Had the opening closure been omitted, the run would have started at the first state alone, which has no a-arrow, and the active set would have died immediately. The verdict happens to be the same here, but the reason would have been wrong — and on the input b the two methods disagree outright.
Intuition
An ε-arrow never consumes input, so it never makes progress through the string. Its whole purpose is to connect machines together.
That is exactly how Lesson 7 builds the closure constructions: to accept the union of two languages, wire a fresh start state to both machines with ε-arrows; to accept their concatenation, wire the accepting states of the first machine to the start state of the second.
Because the wiring costs nothing and consumes nothing, the two machines being joined need to know nothing about each other. That modularity is the real payoff, and it is why Thompson's construction in Lesson 8 is so short.
Step zero
Discussion prompt
Build a union by wiring, using epsilon-arrows — before any calculation: what is the plan? Name the moves in order, in plain English, without doing the arithmetic.
Hint: It starts with: Place both machines side by side
Answer:
Worked example
Given a machine for the strings ending in a and a machine for the strings of even length, build one machine for the union without touching either original.
Place both machines side by side
Why: Rename states if necessary so the two state sets are disjoint. Nothing inside either machine is altered.
\[ Q = \{s\} \cup Q_1 \cup Q_2, \qquad Q_1 \cap Q_2 = \varnothing \]
Add a fresh start state with two epsilon-arrows
Why: The new state has an ε-arrow into each original start state and no other transitions at all.
\[ \delta(s,\varepsilon) = \{q_1, q_2\} \]
Keep both accepting sets
Why: A string should be accepted if either machine would accept it, so the accepting set is the union of the two originals.
\[ F = F_1 \cup F_2 \]
See why this recognizes the union
Why: The opening closure puts a marker at both original start states, so both machines run on the whole input in parallel. The final set meets the accepting set exactly when at least one of them ended accepting.
Verify on one string from each side and one from neither
Why: A string ending in a is accepted through the first branch; a string of even length is accepted through the second; a string that is neither leaves both branches non-accepting and is rejected. The construction adds no strings and loses none.
\[ w \in L_1 \cup L_2 \iff w \in L(N) \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Build a union by wiring, using epsilon-arrows", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: A string ending in a is accepted through the first branch; a string of even length is accepted through the second; a string that is neither leaves both branches non-accepting and is rejected. The construction adds no strings and loses none.
Commit first
Predict first
An ε-NFA has an ε-arrow from its start state to a state r, and r is accepting. Is the empty string accepted?
Commit to an answer, then rate it — certain, fairly sure, or guessing — and write the rating down before you turn the page.
Correct: Yes, because the closure of the start state contains r
Why: The extended transition function on the empty string returns the ε-closure of the start state, not the start state itself. That closure contains r, which is accepting, so the final set meets the accepting set.
The rating matters as much as the answer: confident-and-wrong is the combination that survives revision, because nothing about it feels like it needs revisiting.
Check
Think about what the base case of the extended transition function says.
Check your understanding
An ε-NFA has an ε-arrow from its start state to a state r, and r is accepting. Is the empty string accepted?
Answer: A
Why: The extended transition function on the empty string returns the ε-closure of the start state, not the start state itself. That closure contains r, which is accepting, so the final set meets the accepting set.
Pattern
Add two closure steps to the ordinary procedure, and never skip either.
The habit worth building: say 'close, read, close' out loud for each symbol. The forgotten closure is almost always the opening one.
Section
Section 4
Constraint
Discussion prompt
Run The guess-and-verify design recipe with this step confiscated:
From the waiting state, branch to a chain that verifies the guess.
Is it still possible? If it is, say what takes its place and what it costs you. If it is not, say exactly what that step was providing that nothing else does.
Hint: A step you can drop for free was never load-bearing. If you cannot drop it, name the thing that goes wrong the moment it is gone.
Answer:
Pattern
Nondeterministic design is a different activity from deterministic design, and much easier once the shift is made.
The last step is the only real obligation. The machine may guess freely, but a wrong guess must lead nowhere — because acceptance credits the best branch.
Edge cases
Discussion prompt
The guess-and-verify design recipe works on the cases you have just seen. Push it to the edge: what is the most degenerate input it still handles — empty, zero, one item, everything equal — and what is the first case where it stops being true? Name the case, not just "it breaks".
Hint: Try the smallest legal input, then the largest, then the one where two things collide. Methods are specified at their edges; the middle takes care of itself.
Answer:
Nondeterministic design is a different activity from deterministic design, and much easier once the shift is made.
Concept
It looks like cheating. The machine simply guesses the answer, then confirms it. The acceptance rule is what makes it legitimate.
If the string really is in the language, then some guess is correct, and the branch making that guess verifies successfully. One accepting path exists, so the string is accepted.
If the string is not in the language, then every guess is wrong, and every branch fails its verification. No accepting path exists, so the string is rejected.
\[ \exists \text{ correct guess} \iff w \in L \]
The two halves match the two directions of the acceptance rule exactly, which is why guess-and-verify designs almost prove themselves.
Estimation
Predict first
The language that needed exponentially many deterministic states. Guess-and-verify handles it in four.
Commit before you compute: what does Design: the third symbol from the end is a 1 come out to? A rough magnitude and the right form is enough — the point is to have something concrete to be wrong about.
Correct: Verify on a positive and a negative string
Why: A prediction you can defend turns the computation into a check rather than a leap of faith — and an answer that contradicts it is caught on the spot. In 100 the third symbol from the end is the leading 1, and the branch guessing there reaches the accepting state with the input exhausted.
Worked example
The language that needed exponentially many deterministic states. Guess-and-verify handles it in four.
Build the waiting state
Why: One state loops on both symbols. It represents 'still reading, have not committed to anything yet'.
Guess the anchor
Why: From the waiting state, a 1-arrow leaves to a second state. Taking it is the guess that this particular 1 is the third symbol from the end.
Verify by counting off the remaining symbols
Why: Two more arrows follow, each labelled with either symbol, leading to the accepting state. They confirm that exactly two symbols follow the guessed 1.
\[ Q = \{\text{wait}, 1, 2, 3\}, \quad F = \{3\} \]
Check that a wrong guess dies
Why: The accepting state has no outgoing arrows. A branch that guessed too early runs out of arrows before the input ends, so it dies without accepting — which is exactly what a wrong guess must do.
Verify on a positive and a negative string
Why: In 100 the third symbol from the end is the leading 1, and the branch guessing there reaches the accepting state with the input exhausted. In 011 the third from the end is a 0, so no branch can place the guessed 1 correctly and all of them die or finish early.
\[ 100 \in L \qquad 011 \notin L \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Design: the third symbol from the end is a 1", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Two more arrows follow, each labelled with either symbol, leading to the accepting state. They confirm that exactly two symbols follow the guessed 1.
Concept
That example is the standard illustration of what nondeterminism buys, and the gap is not small.
| Position from the end | NFA states | Smallest DFA states |
|---|---|---|
| third | four | eight |
| fifth | six | thirty-two |
| k-th | k plus one | two to the k |
The deterministic machine must remember the last k symbols exactly, and there are two to the k possibilities. The nondeterministic machine remembers nothing and simply guesses.
\[ \text{NFA: } k+1 \text{ states} \qquad \text{DFA: } 2^{k} \text{ states, and no fewer} \]
Lesson 6 proves the lower bound, so this really is a gap in the machines and not a failure of imagination.
Pattern
Step through it
Step through The state-count contrast one row at a time. What is driving the change, and what would the row after the last one be?
Ranking
Put in order
Put the moves of Design: contains the block ab into the order they have to happen.
Why: These are the moves of the worked example in the order it makes them, and each one is set up by the one before it. One waiting state looping on both symbols; an a-arrow guessing that the block starts here; a b-arrow completing it; and an accepting state looping on both symbols.
Worked example
A substring condition, which is the archetypal guess-and-verify shape.
Wait, guess, verify, absorb
Why: One waiting state looping on both symbols; an a-arrow guessing that the block starts here; a b-arrow completing it; and an accepting state looping on both symbols.
\[ \text{wait} \xrightarrow{a} \text{saw }a \xrightarrow{b} \text{found} \]
Make the final state absorbing
Why: Once the block has been found the string qualifies regardless of what follows, so the accepting state loops on every symbol.
Compare with the deterministic design
Why: The DFA for the same language needed the longest-suffix analysis of Lesson 4, deciding carefully where to fall back after a partial match. This machine needs none of that: a failed guess simply dies while other branches carry on.
Confirm no wrong guess can accept
Why: The middle state has only a b-arrow. A branch that guessed at an a not followed by a b dies there, and cannot reach the accepting state by any other route.
Verify on a positive and a negative string
Why: The string aab contains the block, and the branch guessing at the second a completes it. The string ba contains no ab, so every branch that guesses at the a dies for want of a following b.
\[ aab \in L \qquad ba \notin L \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Design: contains the block ab", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: The string aab contains the block, and the branch guessing at the second a completes it. The string ba contains no ab, so every branch that guesses at the a dies for want of a following b.
Step zero
Discussion prompt
Design: starts and ends with the same symbol — before any calculation: what is the plan? Name the moves in order, in plain English, without doing the arithmetic.
Hint: It starts with: Split into two independent cases
Answer:
Worked example
Two conditions tied together, over the alphabet of a and b. The union structure does the work.
Split into two independent cases
Why: Either the string opens and closes with a, or it opens and closes with b. Build one branch for each and let a fresh start state guess which.
Build the a-branch
Why: Read a leading a, then loop on both symbols, then read a final a into an accepting state. The loop-then-final structure is another guess: the branch guesses which a is the last symbol.
Build the b-branch identically
Why: The same shape with b in place of a. The two branches never interact.
Handle the one-symbol case
Why: The single string a begins and ends with a, but the main branch needs two separate a's. Add a short path accepting a directly, and likewise for b. This is the case that gets forgotten.
\[ L = a\Sigma^{*}a \;\cup\; a \;\cup\; b\Sigma^{*}b \;\cup\; b \]
Verify a positive, a negative, and the one-symbol case
Why: The string abba opens and closes with a and is accepted by the a-branch. The string abb opens with a and closes with b, so both branches fail. The single symbol a is accepted only by the short path added in the previous step, which is why that step was necessary.
\[ abba,\ a \in L \qquad abb \notin L \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Design: starts and ends with the same symbol", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: The string abba opens and closes with a and is accepted by the a-branch. The string abb opens with a and closes with b, so both branches fail. The single symbol a is accepted only by the short path added in the previous step, which is why that step was necessary.
Intuition
Many nondeterministic designs are clearer read from the accepting state backwards, because that is where the verification chain ends.
Ask: what must the last few symbols look like for a branch to be sitting in an accepting state right now? The chain of arrows leading into the accepting set answers exactly that.
For the third-from-the-end machine, the last two arrows say 'two arbitrary symbols' and the arrow before them says 'a 1'. Reading backwards, the accepting condition is literally a 1 followed by two of anything — which is the specification, restated.
\[ L = \Sigma^{*}\,1\,\Sigma\,\Sigma \]
Hypothesis
Predict first
Design: length divisible by two or by three is about to be worked. State your hypothesis first: which rule or definition decides this one, and what is the first move it forces? Then watch whether the example agrees with you.
Correct: Build the two cycles separately
Why: A two-state cycle accepts the even lengths; a three-state cycle accepts the lengths divisible by three. Each cycle advances on every symbol.
A hypothesis you wrote down is falsifiable; a vague sense of how it will go is not. If the example opens somewhere else, that gap is the thing worth chasing.
Worked example
A union of two modular conditions, wired with ε-arrows rather than built as a product.
Build the two cycles separately
Why: A two-state cycle accepts the even lengths; a three-state cycle accepts the lengths divisible by three. Each cycle advances on every symbol.
\[ L = \{\, w : |w| \equiv 0 \bmod 2 \; \text{ or } \; |w| \equiv 0 \bmod 3 \,\} \]
Wire a fresh start state into both
Why: Two ε-arrows, one into each cycle's start. The guess of which condition to satisfy is made before any symbol is read.
Keep both accepting sets
Why: Each cycle's own accepting state stays accepting, so either route can carry the string.
\[ |Q| = 1 + 2 + 3 = 6 \]
Contrast with the product construction
Why: A deterministic product machine would need six states too, but every one of them would have to track both remainders at once. Here each state tracks only one, and the ε-arrows do the combining.
Verify one string of each length class
Why: Length 4 is divisible by 2 and accepted down the first branch. Length 3 is divisible by 3 and accepted down the second. Length 5 is divisible by neither, so both branches finish on non-accepting states and it is rejected.
\[ |w| = 4 \text{ accept}, \quad |w| = 3 \text{ accept}, \quad |w| = 5 \text{ reject} \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Design: length divisible by two or by three", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Length 4 is divisible by 2 and accepted down the first branch. Length 3 is divisible by 3 and accepted down the second. Length 5 is divisible by neither, so both branches finish on non-accepting states and it is rejected.
Prediction
Predict first
In a guess-and-verify NFA design, what must be true of a branch that guesses incorrectly?
Answer it in your own words, now, with nothing to choose from. The options are on the next slide — and picking the right one off a list is an easier skill than producing it.
Correct: It must die or finish in a non-accepting state
Why: Acceptance credits the best branch, so a wrong guess is harmless as long as it never reaches an accepting state with the input exhausted. Letting it die for want of an arrow is the usual and simplest way to arrange that.
Check
Think about what must happen when the guess is wrong.
Check your understanding
In a guess-and-verify NFA design, what must be true of a branch that guesses incorrectly?
Answer: A
Why: Acceptance credits the best branch, so a wrong guess is harmless as long as it never reaches an accepting state with the input exhausted. Letting it die for want of an arrow is the usual and simplest way to arrange that.
Anomaly
Predict first
A student writes this, and it looks reasonable:
A machine has a start state with two a-arrows: one self-loop and one to an accepting state. Complement it by the Lesson 4 method.
It is wrong. Say what breaks — and say it before you turn the page.
Correct: Lesson 4 complemented a machine by replacing the accepting set with its complement, changing nothing else.
A machine has a start state with two a-arrows: one self-loop and one to an accepting state. Complement it by the Lesson 4 method.
Why: Lesson 4 complemented a machine by replacing the accepting set with its complement, changing nothing else. Apply the same move here.
Trap
A machine has a start state with two a-arrows: one self-loop and one to an accepting state. Complement it by the Lesson 4 method.
Swap the accepting set, as with a deterministic machine
Why: Lesson 4 complemented a machine by replacing the accepting set with its complement, changing nothing else. Apply the same move here.
\[ F = \{n_1\} \;\longmapsto\; F' = \{n_0\} \]
Claim the complement
Why: The paths are unchanged, so surely the verdicts are all negated, exactly as before.
\[ L(N') \overset{?}{=} \overline{L(N)} \]
A machine has a start state with two a-arrows: one self-loop and one to an accepting state. Complement it by the Lesson 4 method.
Check what the active set actually does
Why: On the input a the active set is both states at once. It meets the old accepting set, so a was accepted; and it meets the new one too, so a is accepted again.
\[ \hat{\delta}(n_0, a) = \{n_0, n_1\} \]
Exhibit the failure
Why: The string a is accepted by both machines, so the second is not the complement of the first. The deterministic argument needed exactly one final state per input, and that is precisely what was given up.
\[ a \in L(N) \; \text{ and } \; a \in L(N') \;\Rightarrow\; L(N') \neq \overline{L(N)} \]
State the correct route
Why: To complement a nondeterministic machine, first convert it to a deterministic one, then swap. The conversion is the subset construction of Lesson 6, and this failure is the reason that construction is needed.
\[ N \;\longrightarrow\; \text{DFA} \;\longrightarrow\; \text{swap } F \]
Two truths and a lie
Sort into buckets
Some of these hold up and some are the exact mistakes this lesson is built to prevent. Sort them.
Step zero
Discussion prompt
Watch the complement failure in full — before any calculation: what is the plan? Name the moves in order, in plain English, without doing the arithmetic.
Hint: It starts with: Find the language of the machine as drawn
Answer:
Worked example
Take the machine from the trap and work out both languages explicitly.
Find the language of the machine as drawn
Why: From the start state an a leads to both states. On any nonempty run of a's the active set is both states, which meets the accepting set. On the empty string the set is just the start state, which does not.
\[ L(N) = \{a, aa, aaa, \dots\} = a^{+} \]
Find the language after swapping
Why: The active sets are identical, because no transition changed. Now the start state is accepting, so every set containing it qualifies — including the opening set.
\[ L(N') = a^{*} \]
Compare with the true complement
Why: The complement of the first language, over this one-symbol alphabet, holds only the empty string. The swapped machine accepts every string instead.
\[ \overline{L(N)} = \{\varepsilon\} \neq a^{*} = L(N') \]
Diagnose the cause precisely
Why: The deterministic argument relied on there being exactly one final state per input, so that negating the membership test negated the answer. Here the final set can meet both the accepting set and its complement at once.
Verify the diagnosis on the culprit string
Why: On the input a the final set holds both states. It meets the old accepting set and the new one simultaneously, so no swap of accepting states could ever have negated this verdict. The failure is structural, not arithmetic.
\[ \{n_0,n_1\} \cap F \neq \varnothing \; \text{ and } \; \{n_0,n_1\} \cap F' \neq \varnothing \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Watch the complement failure in full", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: On the input a the final set holds both states. It meets the old accepting set and the new one simultaneously, so no swap of accepting states could ever have negated this verdict. The failure is structural, not arithmetic.
Section
Section 5
Concept
The word invites bad analogies. Three of them are worth ruling out explicitly.
What it actually is: an existential quantifier over paths, dressed as a machine. That is the whole content of the definition.
Matching
Match the pairs
From Three things nondeterminism is not — match each one to what it actually does. The descriptions have been shuffled.
Why: Not randomness, Not parallelism, Not magic lookahead are easy to tell apart while they are sitting next to their descriptions and much harder afterwards, which is what this checks.
Intuition
Seeing acceptance as a quantifier explains immediately why some operations are easy here and others are painful.
Acceptance says a path exists. Union is easy because a path in either machine is still a path. Rejection, though, says no path exists — and negating an existential gives a universal, which the machine has no direct way to check.
\[ \neg \exists\, b \,.\, \mathrm{acc}(b) \;\equiv\; \forall\, b \,.\, \neg\,\mathrm{acc}(b) \]
That is why complement needs determinization first: a deterministic machine has exactly one path, so the existential and the universal coincide and negation becomes trivial again.
Concept
Sorting the operations by whether the quantifier cooperates predicts the constructions of Lesson 7 before any of them are built.
| Operation | On an NFA | Why |
|---|---|---|
| union | easy: wire a fresh start | a path in either machine still exists |
| concatenation | easy: wire the join | guess where to split |
| star | easy: wire a loop back | guess how many repetitions |
| complement | awkward: determinize first | needs 'no path exists' |
| intersection | awkward: product or determinize | needs two paths at once |
Every easy row is a guess. Every awkward row is a claim about all branches at once.
Comparison
Comparison matrix
From Which operations stay easy: refill the On an NFA column from what you know. The rest of the table is as it appeared.
| Operation | On an NFA | Why |
|---|---|---|
| union | easy: wire a fresh start | a path in either machine still exists |
| concatenation | easy: wire the join | guess where to split |
| star | easy: wire a loop back | guess how many repetitions |
| complement | awkward: determinize first | needs 'no path exists' |
| intersection | awkward: product or determinize | needs two paths at once |
Ranking
Put in order
Put the moves of Two edge-case machines worth building once into the order they have to happen.
Why: These are the moves of the worked example in the order it makes them, and each one is set up by the one before it. One state, no accepting states, and no arrows.
Worked example
Two tiny machines come up constantly in later constructions. Build both now so they are never in doubt.
Build a machine for the empty language
Why: One state, no accepting states, and no arrows. Every input dies immediately or finishes non-accepting, so nothing is ever accepted.
\[ N_{\varnothing}: \quad Q = \{q_0\}, \; \delta(q_0,a) = \varnothing, \; F = \varnothing \]
Build a machine for the empty string alone
Why: One state, accepting, with no arrows out of it. Reading nothing leaves the machine accepting; reading anything at all kills the only branch.
\[ N_{\{\varepsilon\}}: \quad Q = \{q_0\}, \; \delta(q_0,a) = \varnothing, \; F = \{q_0\} \]
Note how little separates them
Why: The two machines differ in exactly one bit: whether the single state is accepting. Yet one recognizes nothing and the other recognizes one string.
Note why these two matter later
Why: They are the base cases of Thompson's construction in Lesson 8, where every regular expression is built up from atoms. Getting them wrong corrupts every expression built on top.
Verify each accepts exactly what it should
Why: The first has no accepting state at all, so no final set can ever meet the accepting set and its language is genuinely empty. The second accepts precisely when nothing has been read, since any symbol kills the only branch.
\[ L(N_{\varnothing}) = \varnothing, \qquad L(N_{\{\varepsilon\}}) = \{\varepsilon\} \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Two edge-case machines worth building once", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: The first has no accepting state at all, so no final set can ever meet the accepting set and its language is genuinely empty. The second accepts precisely when nothing has been read, since any symbol kills the only branch.
Intuition
It is worth being precise about what was gained, since the class of recognizable languages did not change at all.
What was lost is equally concrete: running the machine now costs work proportional to the size of the active set, and complementing it requires a detour through determinization.
\[ \text{easy to write} \;\longleftrightarrow\; \text{costly to run} \]
Explain it
Discussion prompt
Explain Where nondeterminism actually pays off to a student a year behind you. No notation, no jargon they have not met — and it still has to be true.
Hint: If your explanation needs a symbol they have never seen, you are describing the notation rather than the idea.
Answer:
What was lost is equally concrete: running the machine now costs work proportional to the size of the active set, and complementing it requires a detour through determinization.
Elimination
Eliminate the wrong options
An NFA rejects a string exactly when which condition holds?
3 of these 4 are wrong. Strike them one at a time, and say what rules each one out before you strike the next. The survivor is the answer.
Survives elimination: A
Why: Acceptance is existential — one good path is enough — so rejection is universal. Every path must fail, whether by dying early or by ending on a non-accepting state.
Check
Recall which quantifier acceptance uses.
Check your understanding
An NFA rejects a string exactly when which condition holds?
Answer: A
Why: Acceptance is existential — one good path is enough — so rejection is universal. Every path must fail, whether by dying early or by ending on a non-accepting state.
Pattern
Nondeterministic designs fail differently from deterministic ones, so the checklist is different too.
The fourth item catches the only error nondeterminism makes easy: a machine that accepts too much because a half-finished verification could still reach an accepting state.
Concept
The model is not only a proof device. It is what sits underneath a large class of real pattern-matching tools.
The trade-off is always the same one. Simulating the active set costs work proportional to its size on every symbol; determinizing pays that cost once, in advance, and risks the exponential blowup.
\[ \text{simulate: } O(|Q| \cdot |w|) \qquad \text{determinize: } O(2^{|Q|}) \text{ once} \]
Analogy
Discussion prompt
Explain Where these machines show up in practice by analogy to something with no Theory of Computation in it at all — a queue, a recipe, a map, a bank balance, whatever fits. Then say where your analogy breaks.
Hint: An analogy that never breaks is not an analogy, it is the same idea wearing a hat. Find the seam — that is the part that is actually new.
Answer:
The model is not only a proof device. It is what sits underneath a large class of real pattern-matching tools.
Ranking
Put in order
These are the steps of Choosing between a deterministic and a nondeterministic…, scrambled. Put them back in order before the next slide shows you.
Why: This is the order the recipe itself gives. Recalling the sequence without the slide in front of you is the difference between recognising the method and being able to run it — most of what goes wrong in practice is a step done out of turn.
Pattern
Both models recognize the same languages, so the choice is about what you are optimizing.
The fourth line is the practical summary of this lesson and the next: write the easy machine, and let a mechanical construction produce the fast one.
Real world
Discussion prompt
Outside this lesson: where does Nondeterministic Finite Automata actually turn up? Name one concrete situation — a job, a piece of software someone ships, a decision somebody has to make — and say which part of Choosing between a deterministic and a nondeterministic… is doing the work in it.
Hint: Vague is the failure mode here. "Engineering" is not a situation; "deciding whether this build is fast enough to ship" is.
Answer:
Lesson 5 drops the determinism requirement and lets a machine take several arrows on one symbol, or none at all. It covers the active-set method of running such a machine, acceptance as an existential claim over paths, and the computation tree, then gives the five-tuple with its set-valued transition function, epsilon-arrows and epsilon-closure, and the extended transition function with closures. It closes with guess-and-verify design and the exponential saving in states it can produce, why swapping the accepting set fails to complement an NFA, and what nondeterminism is not.
Concept
Everything so far suggests these machines are stronger than deterministic ones. They are not.
Lesson 6 proves that every nondeterministic machine — ε-arrows and all — can be converted into a deterministic one recognizing exactly the same language. The construction turns each active set into a single state, and the two-to-the-n count from earlier in this lesson is where its cost comes from.
\[ \Sigma_{\varepsilon}\text{-NFA} \; \equiv \text{NFA} \; \equiv \text{DFA} \]
So nondeterminism is a convenience, not a capability. It changes how much you have to write, never what you can recognize — and that is a genuinely surprising theorem, since the same is emphatically not true for the machines of Lesson 20.
Counterexample
Discussion prompt
Everything so far suggests these machines are stronger than deterministic ones. They are not.
That is stated as though it always holds. Do one of two things: produce a case where it fails, or say precisely what rules such a case out. "It just does" is not on the menu.
Hint: Hunt at the extremes first — zero, one, negative, empty, equal. If every extreme survives, the reason they survive is the proof.
Connect it up
Draw it
One page, no notation unless you need it: draw how these connect — Letting the Machine Guess · The Formal Definition · Epsilon Arrows and Closure · Designing With Nondeterminism · What Nondeterminism Is and Is Not. Put an arrow wherever one of them is what makes another possible, and label the arrow with why.
Recap
You can run, specify, and design machines that branch — and you know the one place the convenience has to be paid for.
| Situation | Move |
|---|---|
| a string to test | close, read, close — and track the whole set |
| somewhere in the string, something happens | wait, guess, verify |
| two languages to combine | wire a fresh start with ε-arrows |
| the opposite language | determinize first, then swap |
| a design that accepts too much | check that no verification chain exits early |
Lesson 6 proves these machines are exactly as powerful as the deterministic ones, by turning every active set into a state.
Want this taught 1-on-1? Alexander tutors Theory of Computation — $55/session, free consultation.