← all subjects

Theory of Computation

Before asking how to compute something efficiently, theory asks whether it can be computed at all — and if so, how powerful a machine that requires.

FIG_002
101010start
q0q_0
q1q_1
q2q_2
111000
A finite automaton reading its input, symbol by symbol.

Start small. A finite automaton has no memory beyond its current state, yet it already captures every regular language — the patterns a regex can match, the tokens a lexer can split.

Finite automata, grammars, and Turing machines form a hierarchy of increasing power. Each level fixes exactly which problems its model can and cannot solve — the foundation under every parser, regex, and compiler.

FIG_003
q1q_1
101101
The tape: unbounded memory, one cell at a time.

Add a stack and you get a pushdown automaton — enough to parse balanced brackets and the grammars behind real languages. Add an unbounded tape and you get a Turing machine: the most powerful model we have, and, we believe, the most powerful there is.

That belief is the Church–Turing thesis: anything any reasonable machine can compute, a Turing machine can compute too. It is why one simple model defines computation itself.

FIG_004
regularcontext-freedecidablerecognizableHALTundecidable
The ladder of languages — and a wall: HALT.
FIG_001
▸ computing n + 1 — binary increment10111011R/Wstart
q0q_{0}
q1q_{1}
qHq_{H}
␣→L0→10,1→R1→0,L
tape — infinite, both wayshaltfinite control[ THE TURING MACHINE ]
The Turing machine: a tape, a head, and a finite control.

Undecidability follows. Once a model is powerful enough to describe itself, there are questions about itself it cannot answer — the halting problem is the first and sharpest of them.

FIG_005
ET+TidF*Fidid
A grammar parses a string into a tree.

It also draws hard limits. Some problems — like deciding whether an arbitrary program halts — are provably unsolvable by any computer, ever. Knowing where those limits are saves the effort of trying.

Theory delimits what is possible. It replaces “I couldn’t get it to work” with a proof that it cannot work — or that it can.

Coming soonNotes for this subject are in progress — check back later.