ArticleslgStudy

mathematics

Fagin's theorem

Fagin's theorem is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Fagin's theorem rather than just read about it. In short: Fagin's theorem is the oldest result of descriptive complexity theory, a branch of computational complexity theory that characterizes complexity classes in terms of logic-based descriptions of their problems rather than by the behavior of algorithms for solving those problems. The theorem states that the set of all properties expressible in existential second-order logic is precisely the complexity class NP.

Key takeaways

  • Fagin's theorem belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Fagin's theorem to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Fagin's theorem from memory before moving on to harder problems.

Reference excerpt

Fagin's theorem is the oldest result of descriptive complexity theory, a branch of computational complexity theory that characterizes complexity classes in terms of logic-based descriptions of their problems rather than by the behavior of algorithms for solving those problems. The theorem states that the set of all properties expressible in existential second-order logic is precisely the complexity class NP. It was proven by Ronald Fagin in 1973 in his doctoral thesis, and appears in his 1974 paper. The arity required by the second-order formula was improved (in one direction) by James Lynch in 1981, and several results of Étienne Grandjean have provided tighter bounds on nondeterministic random-access machines.

Example For example, consider the problem of deciding if a graph is 3-colorable. This is NP-complete. By Fagin’s theorem, there is a second order existential formula ϕ, such that a graph is 3-colorable if and only if the graph, as a finite model for ϕ, semantically implies ϕ. Explicitly, here is one such formula:(∃A, B, C)(∀v)[(A(v) ∨ B(v) ∨ C(v)) ∧ (∀w)(E(v, w) → ¬(A(v) ∧ A(w)) ∧ ¬(B(v) ∧ B(w)) ∧ ¬(C(v) ∧ C(w)))]In this formula, A, B, or C are to be interpreted as the sets of vertices colored with the 3 colors, and E(v, w) is to be interpreted as saying the vertices v, w share an edge. The formula then states that no two adjacent vertices have the same color. Note that there is no need to explicitly enforce each vertex to have exactly 1 color, just at least 1 color. Since, if we allow more than 1 color per vertex, and no two adjacent vertices have the same color, then we certainly can have each vertex to have exactly 1 color, and still no two adjacent vertices have the same color.

Proof The 1999 textbook by Immerman provides a detailed proof of the theorem. A sketch is given here. In one direction, given an existential second-order formula, and a purported model, the model can be checked in NP, by nondeterministically choosing the value of all existentially-quantified variables In the other direction, given a language in NP, we describe it by an existential second-order formula. To do so, one can use second-order existential quantifiers to arbitrarily choose a computation tableau. In more detail, for every timestep of an execution trace of a non-deterministic Turing machine, this tableau encodes the state of the Turing machine, its position in the tape, the contents of every tape cell, and which nondeterministic choice the machine makes at that step. Then, we write down a first-order formula, so that a tableau is a valid execution trace iff it satisfies the formula. Next, we perform an existential quantification over all possible tableaus of the given size. A key lemma used in the proof is that it is possible to encode a linear order of length nk (such as the linear orders of timesteps and tape contents at any timestep) as a 2k-ary relation R on a universe A of size n. One way to achieve this is to choose a linear ordering L of A and then define R to be the lexicographical ordering of k-tuples from A with respect to L.

See also Spectrum of a sentence

Notes

References Fagin, Ronald (1974). "Generalized first-order spectra and polynomial-time recognizable sets". In Karp, Richard M. (ed.). Complexity of Computation: Proceedings of a Symposium in Applied Mathematics of the American Mathematical Society and the Society for industrial and Applied Mathematics held in New York City, April 18–19, 1973. SIAM–AMS Proceedings. Vol. 7. American Mathematical Society. pp. 43–73. ISBN 978-0-8218-1327-0. MR 0371622. Grandjean, Étienne (1985). "Universal quantifiers and time complexity of random access machines". Mathematical Systems Theory. 18 (2): 171–187. doi:10.1007/BF01699468. MR 0797194. Grandjean, Étienne; Olive, Frédéric (1998). "Monadic logical definability of nondeterministic linear time". Computational Complexity. 7 (1): 54–97. doi:10.1007/PL00001594. MR 1628153. Immerman, Neil (1999). Descriptive Complexity. New York: Springer-Verlag. pp. 113–119. ISBN 0-387-98600-6. Lynch, James (December 1981). "Complexity classes and theories of finite models". Mathematical Systems Theory. 15: 127–144. doi:10.1007/BF01786976. S2CID 496247. Grädel, Erich; Kolaitis, Phokion G.; Libkin, Leonid; Marx, Maarten; Spencer, Joel; Vardi, Moshe Y.; Venema, Yde; Weinstein, Scott (2007). Finite model theory and its applications. Texts in Theoretical Computer Science. An EATCS Series. Berlin: Springer-Verlag. ISBN 978-3-540-00428-8. Zbl 1133.03001.

Worked examples

Example 1 — a first encounter with Fagin's theorem

Start with the simplest possible case. Write down what Fagin's theorem claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Fagin's theorem before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Fagin's theorem ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Fagin's theorem

In research
Fagin's theorem appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Fagin's theorem in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Fagin's theorem is common in secondary-school and first-year university syllabi. It links to neighbouring topics Descriptive complexity, Theorems in computational complexity theory, so understanding it makes those chapters shorter.
In everyday life
Look for Fagin's theorem outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Fagin's theorem” →

How to study Fagin's theorem in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Fagin's theorem means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Fagin's theorem out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Fagin's theorem in simple terms?

Fagin's theorem is the oldest result of descriptive complexity theory, a branch of computational complexity theory that characterizes complexity classes in terms of logic-based descriptions of their problems rather than by the behavior of algorithms for solving those problems. The theorem states th…

Why does Fagin's theorem matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Fagin's theorem?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Fagin's theorem.

Tags

  • Descriptive complexity
  • Theorems in computational complexity theory

Keep exploring