4.6.3 · D1Theory of Computation

Foundations — NFA — formal definition, epsilon transitions

2,565 words12 min readBack to topic

Before you can read a single line of the parent note, you need a small toolbox. This page builds each tool from nothing — plain words first, then the picture, then why the NFA needs it. Nothing is used before it is defined.


1. A set — the bag that holds things

The picture: imagine a real cloth bag with three labelled marbles inside. Shaking the bag changes nothing — and are the same set.

Why the topic needs it. The whole point of an NFA is that after reading a symbol you may be in several states. "Several states" is exactly a set of states. Without the idea of a bag we could not even say "the machine is in right now."

Figure — NFA — formal definition, epsilon transitions
Figure s01 — The same three marbles sit in a bag on the left and a re-shuffled bag on the right; a big "=" between them shows that reordering changes nothing, so and are one and the same set.


2. Subset and — a smaller bag inside a bigger one

The picture: a big circle ; a smaller circle drawn entirely inside it. Nothing of pokes out.

Why the topic needs it. The parent writes — the accepting states are a smaller bag sitting inside the bag of all states . Some states win, some don't; the winners are a subset.


3. The power set — the bag of ALL possible bags

This is the trickiest symbol in the parent note, so we build it slowly.

The picture: if , lay out every sub-bag you can make: That is bags. In general a set of items has subsets, because each item is independently either in or out.

Why the topic needs it. The parent note's transition rule (a rule we build fully in §4) will hand back a set of states. To describe "returns a set of states — one, many, or none" precisely, we need the collection of all possible such sets. That collection is exactly , and being able to return any member of it is what will give the NFA its multiple/zero targets.

Figure — NFA — formal definition, epsilon transitions
Figure s02 — For the four sub-bags are drawn as boxes: the empty box , , , and . Counting them gives , since each of the two states is independently either in or out of a sub-bag.


4. A function, its arrow , and the NFA transition rule

The picture: a little vending machine. You press a button (input); one item drops out (output). Same button always gives the same item.

Why the topic needs it. is the heart of the machine — the rule that tells it where it may go. Its arrow's left side (input) and right side (output) are the definition of the machine's behaviour.


5. The Cartesian product — pairing two bags

The picture: a grid. List down the left, across the top; every cell is one pair. If has 3 items and has 2, the grid has cells.

Why the topic needs it. The input to is a pair (which state am I in, which symbol did I just read). You always need both to decide the next move, so the input must be a pair, and pairs come from a Cartesian product. The exact bags being paired are named in §6–§8.

Figure — NFA — formal definition, epsilon transitions
Figure s03 — A grid whose rows are states and whose columns are the symbols and the free-move label . Each cell holds one ordered pair like — precisely the kind of input must answer for. Two states times three column-labels gives six pairs.


6. The alphabet and strings

The picture: is your box of alphabet tiles; a string is a row of tiles laid left-to-right; is the infinite catalogue of every row you could ever lay, from length 0 upward.

Why the topic needs it. The machine's job is to answer "is this string in the language?" for strings drawn from . The set of all strings the machine accepts is a subset of that catalogue (we name that set in §10).


7. Epsilon — the empty string

The picture: a completely blank row on the table. There is a row there (it exists), it just holds nothing.

Why the topic needs it. ε-transitions — letting the machine change state without reading input — are one of the two superpowers of an NFA. You cannot describe them without a name for "no symbol."


8. Union and intersection — combining bags

The picture: two overlapping circles (a Venn diagram). Union shades both circles; intersection shades only the overlap.

Why the topic needs it.

  • uses union to bolt the free-move label onto the real symbols — this is exactly the input-symbol side of .
  • Intersection powers the acceptance test we meet in §9: do any of the states I ended in overlap with the winning states? If the overlap is non-empty, the machine accepts.

9. Running a whole string: , then "there exists"

(from §4) answers only for one symbol. To run an entire string we need a companion rule that applies symbol after symbol.

The picture: many trails leaving a trailhead. If even one trail reaches the summit, you "reached the summit." The failed trails don't count against you.

Why the topic needs it. This is the heartbeat of nondeterminism. The acceptance test says: the final cloud must share at least one state with the winning set — written . This literally means "there exists a surviving path that ends on a winner." Contrast this with the wrong idea ("all paths win"), which the parent flags as a classic mistake.


10. Naming the whole machine: and its language

The picture: is the whole vending machine sitting on the table; is the list of every input string that makes its "accept" light turn on.

Now every symbol in the parent's central definition is earned: Read it aloud: " takes a pair (§5) — a state and a (symbol-or-free-move) — and returns a set of states." That single line is nondeterminism.

Set - a bag of states

Subset - smaller bag inside

Power set - bag of all subbags

Cartesian product - pairs

Alphabet Sigma - input symbols

Strings Sigma star

Empty string epsilon

Function and arrow

Union to add epsilon

Transition delta

Extended delta hat

Intersection and there-exists

Acceptance rule

NFA formal definition 4.6.3

Every arrow above feeds the parent topic NFA formal definition. These same foundations also power DFA — formal definition, Subset Construction (NFA to DFA), Regular Languages, Regular Expressions, and Closure Properties of Regular Languages.


Equipment checklist

Cover the right side and test yourself — if any line stumps you, reread its section.

A set — what is it, and does order matter?
An unordered bag of distinct items; order and repeats do not matter.
What does mean, and is it an error in an NFA?
The empty set (empty bag); not an error — it means every guess died, nowhere to be.
What does say?
Every item of is also in ; may be empty or equal .
What is , and if has some number of states , how many members does it have?
The power set — the set of all subsets of ; it has members.
Can a function whose output is return many states?
Yes — it returns exactly one set, and that set may contain many states.
What is ?
The set of all ordered pairs with and .
What does do, and why is its input a pair?
It is the move-rule; you need both current state and symbol to decide the next states, so the input is a (state, symbol) pair.
Is in ?
No — is the empty string (no symbol); it is only added in 's domain via .
What does give you?
The set of states you can be in after reading the whole string starting from .
What does mean in the acceptance rule?
The ending states share at least one state with the winning set — a winning path exists.
"Accept" uses which logic — for-all or there-exists?
There-exists: at least one surviving path reaches an accepting state.
What is ?
The language of machine — the set of all strings accepts; a subset of .
Recall Quick self-check
  • where is a single item ::: (two members).
  • ::: .
  • Is always true? ::: Yes — the empty set is a subset of every set.