studyhubAutomata Theory

Method sheet

The definitions and the four conversions 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.
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.

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.