studyhubAutomata Theory

Method sheet

The definitions and every method on one page, written as the steps you actually perform. The right-hand column is the mistake that particular line invites.

The 5-tuple

M = (Q, Σ, δ, q₀, F)

Qthe set of all statesEvery circle in the diagram, including any dead state.
Σthe set of input symbolsε is never in Σ — it is not an input.
δ — DFAQ × Σ → QExactly one state per cell. Never a set, never empty.
δ — NFAQ × Σ → 2^QA cell may hold two states, or Φ.
q₀the start state — one onlyThe loose arrow with no source.
Fthe set of accepting states, F ⊆ QDouble ring. F may be empty; it is still a set.
Reading a diagramone row per state, one column per symbolAn arrow labelled 0,1 is two table entries.

The three machines

Every DFA is an NFA; not every NFA is a DFA

DFAdeterministic, complete, no εComplete matters: a missing arrow means it is not yet a DFA.
NFAmay branch, may have empty cells, no εNo dead state is required — Φ is a legal cell.
ε-NFANFA plus transitions taken without reading inputε moves happen spontaneously, before and after every symbol.
PowerDFA ≡ NFA ≡ ε-NFA — all accept exactly the regular languagesNondeterminism buys brevity, not power.
Acceptanceaccept if ANY sequence of choices ends in FOne accepting path is enough; the rest may die.

NFA → DFA

Subset construction

1. Startthe DFA start state is {q₀}A set, even when it has one member.
2. Each cellδ′(S, a) = ⋃ over q ∈ S of δ(q, a)Union the NFA rows — do not read them one at a time.
3. New setsevery set that appears becomes a new rowStop only when no new set appears.
4. Dead statethe empty set is a state; it self-loops on every symbolGive it the next unused label and draw its loop.
5. AcceptingS accepts ⟺ S ∩ F ≠ ∅One accepting member is enough.
Sizeat most 2^|Q| states, usually far fewerOnly the reachable subsets are drawn.

ε-NFA → NFA

ε-Closure and ε*·a·ε*

ε-Closure(q)every state reachable from q on ε aloneq is always in its own closure. Follow ε chains all the way.
New transitionδ′(q, a) = ε-Closure( δ( ε-Closure(q), a ) )Closure on both sides — before the symbol and after it.
The ε-NFA tablestate | ε* | 0 | ε* | 1 | ε* — closure, symbol, closure again, per symbolUnion the whole closure's rows — reading the symbol from q alone is the usual slip.
New accepting statesq ∈ F′ ⟺ ε-Closure(q) ∩ F ≠ ∅This is where marks go. The start state often becomes accepting.
States and startunchangedOnly δ and F change; Q and q₀ stay as they were.

ε-NFA → DFA

Do it in two moves, not one

1.ε-NFA → NFA by closures, as aboveFinish F′ before going on — the DFA inherits it.
2.NFA → DFA by subset constructionSubsets of the NFA's states, using the new δ′.
Shortcutor subset-construct directly with ε-Closure applied at every stepSame answer, more places to slip. Two clean tables beat one clever one.

Minimising a DFA

Equivalence classes, round by round

0-equivalencetwo blocks: {non-accepting} {accepting}Nothing else is looked at yet — not the arrows, only the rings.
k-equivalencep, q stay together ⟺ for every symbol a, δ(p, a) and δ(q, a) are in the same block of round k − 1Compare against the previous round, never the one you are in the middle of writing.
Splittingblocks only ever split; they never merge backTwo states apart in round k are apart for good.
Stopwhen a round equals the one before itWrite the repeated round down — it is the proof you are done.
The minimal DFAone state per block; read its row from any one memberCells name blocks, not members: AE, not A.
Start and acceptingstart = the block holding q₀; a block accepts when its members didA block is never half accepting — round 0 saw to that.
Unreachable statesa state no arrow path from q₀ reaches is not part of the machineCross it off before round 0.

Moore and Mealy machines

M = (Q, Σ, Δ, δ, λ, q₀) — they print, they do not accept

Δthe set of output symbolsThere is no F. Nothing is accepted or rejected.
λ — MooreQ → Δ, drawn inside the state: A/0Output belongs to the state.
λ — MealyQ × Σ → Δ, drawn on the arrow: input/outputOutput belongs to the transition.
Output lengthMoore: n + 1 for an input of n. Mealy: nThe Moore start state prints before anything is read.
Moore → Mealyeach arrow takes the output of the state it enters; Q is unchangedThe state it enters, not the state it leaves.
Mealy → Moore, 1list the outputs on the arrows into each stateSelf-loops are arrows in too.
Mealy → Moore, 2a state entered with k different outputs becomes k states: B0, B1Up to |Q| × |Δ| states. One entered with a single output stays whole.
Mealy → Moore, 3q —a/x→ p becomes an arrow to the copy of p that prints xEvery copy of q keeps all of q's outgoing arrows.

Designing a machine

From a language description

starts with pspell p out, then accept everythingAny mismatch goes to a dead state and stays there.
ends with pNFA: loop Σ, then spell p. DFA: track how much of p the tail matchesAfter a mismatch you often land part-way into p, not back at the start.
contains pspell p; the accepting state loops on all of ΣOnce seen, it cannot be unseen — the final state is absorbing.
length exactly kk + 1 states in a chain, plus a dead stateSymbol k+1 must go somewhere non-accepting.
count of a ≡ r (mod m)m states in a ring; other symbols self-loopOnly the counted symbol advances the ring.
every x followed by yok / owing / dead — the owing state is not acceptingA string that ends while still owing must be rejected.