Fagin's theorem and subsequent results characterize complexity classes via logic: NP = ESO (existential second-order logic), P = FO + LFP (first-order logic plus least fixed-point), PSPACE = SO (full second-order logic). This surprising equivalence shows computational complexity and logical expressibility are two faces of the same phenomenon, connecting computer science directly to mathematical logic.
You already know two languages for describing problems: the algorithmic language of Turing machines (time bounds, space bounds, reductions) and the logical language of first-order sentences (quantifiers, relations, formulas). Descriptive complexity reveals that these are secretly the same language. The central insight is that a complexity class is precisely the collection of problems expressible in some logic — and the richer the logic, the more powerful the complexity class it captures.
Fagin's theorem is the foundational result: a graph property (or any finite combinatorial property) is in NP if and only if it can be expressed as an existential second-order (ESO) sentence. An ESO sentence has the form "there exist some relations R₁, R₂,… such that [first-order condition holds]." The k-colorability of a graph, for instance, can be expressed as: "there exist k color classes such that no two adjacent vertices share a class." That existential guess over relations mirrors exactly what a nondeterministic machine does — guess a certificate, then verify it. Fagin proved these two things are the same class of problems on finite structures.
The correspondence deepens. P equals FO + LFP: first-order logic augmented with a least fixed-point operator captures exactly the problems solvable in polynomial time (on ordered structures). The LFP operator lets you build up a relation by iteratively applying a first-order rule until no new elements are added — like computing reachability in a graph by repeatedly adding edges. Each iteration uses polynomial time, and the fixed point is reached in at most n steps, giving polynomial total time. Similarly, PSPACE equals SO (full second-order logic, with both existential and universal quantification over relations), because universal second-order quantification corresponds to the power of alternating computation, which captures PSPACE.
The machine-independence consequence is striking: these logical characterizations work without specifying any machine model. You prove a problem is in P not by exhibiting an algorithm but by writing an FO + LFP sentence. This sidesteps the usual complexity argument (counting steps on a Turing machine) entirely. The logical perspective also suggests new separation questions: if P ≠ NP, then FO + LFP and ESO must be expressively different — a logical rather than computational barrier.
The deeper lesson is that complexity classes are not just computational artifacts but natural logical categories. Presburger arithmetic and the theory of real closed fields are decidable because their quantifier structure is tame; full arithmetic is undecidable because it can encode NP-hard and harder problems. The logical viewpoint unifies these results: computational limitations are limitations on what can be said in a given logical language. This bridge between complexity theory and model theory opens a rich research program in which logical tools like quantifier elimination, types, and fixed-point calculi become tools for proving — or understanding — complexity separations.
No topics depend on this one yet.