First-Order Logic
Extending propositions with predicates, quantifiers, and variables — the standard language of mathematics.
First-order logic (FOL), also called predicate logic or quantificational logic, extends the propositional logic introduced in the prerequisite topic by adding predicates, variables ranging over objects, and quantifiers that express statements about “all” or “some” elements of a domain. Where propositional logic can only say “it is raining” or “it is not raining,” first-order logic can say “for every natural number , there exists a prime greater than .” This expressive leap makes FOL the standard formal language of mathematics: virtually every theorem in algebra, analysis, and geometry can be stated as a first-order sentence interpreted over an appropriate structure.
Predicate Logic and Quantification
The language of first-order logic builds on the propositional connectives () established in propositional logic, but introduces three new ingredients: terms, predicates, and quantifiers. Terms are the names for objects — they include constants (like or ), variables (like , , ), and expressions built from function symbols applied to other terms (like or for the successor of the successor of zero). Predicates are the properties and relations we assert about terms: a unary predicate might mean ” is prime,” while a binary predicate might mean ” is less than .” An atomic formula is a predicate applied to the appropriate number of terms, such as or .
The real power of first-order logic comes from the quantifiers. The universal quantifier asserts that a formula holds for every element of the domain, and the existential quantifier asserts that it holds for at least one. A formula like says “for every , if holds, then there exists some such that holds.” The formal syntax of first-order logic is defined recursively: atomic formulas are formulas; if and are formulas, so are , , , , , and .
A crucial distinction arises between free and bound variables. In the formula , the variable is bound by the quantifier , while is free — its value must be supplied externally. A sentence is a formula with no free variables; only sentences have definite truth values in a given structure. Substitution — replacing a free variable with a term in a formula , written — must be done carefully to avoid variable capture, where a free variable in accidentally becomes bound by a quantifier in . Capture-free substitution is essential for the soundness of quantifier rules in proof systems.
Two important syntactic transformations deserve mention. Prenex normal form moves all quantifiers to the front of a formula, producing an equivalent formula of the shape , where each is or and is quantifier-free. Skolemization eliminates existential quantifiers by introducing new function symbols: a formula becomes , where is a fresh Skolem function. This transformation preserves satisfiability (though not logical equivalence) and is fundamental to automated theorem proving.
Historically, first-order logic originates in Gottlob Frege’s Begriffsschrift (1879), a landmark work that introduced quantifiers and variables into formal logic for the first time, breaking decisively from the Aristotelian syllogistic tradition that had dominated logic for over two millennia. Charles Sanders Peirce independently developed a notation for quantified logic in the 1880s. The modern notation and systematic treatment were refined by Giuseppe Peano, Bertrand Russell, and Alfred North Whitehead in the early twentieth century, culminating in the formalization that became standard by the 1930s.
Structures, Interpretations, and Satisfaction
A first-order language is pure syntax — symbols without meaning. To determine whether a sentence is true or false, we need a structure (also called a model or interpretation) that gives meaning to each symbol. Formally, a first-order structure for a language consists of:
- A non-empty set , called the domain (or universe) of the structure.
- For each constant symbol in , an element .
- For each -ary function symbol in , a function .
- For each -ary predicate symbol in , a relation .
For example, the structure interprets the language of arithmetic by taking the natural numbers as the domain, as the constant zero, as the successor function, and , , with their usual meanings.
The definition of truth in a structure is due to Alfred Tarski, who in his seminal 1933 paper formalized the satisfaction relation , read ” satisfies under variable assignment .” Here is a function mapping variables to elements of . The definition proceeds recursively:
where denotes the assignment that agrees with everywhere except that it maps to , and denotes the element of obtained by evaluating term under the interpretation and assignment . The clauses for , , and follow from their definitions in terms of and (as in propositional logic).
A sentence is valid (written ) if for every structure in the appropriate language. A sentence is a logical consequence of a set of sentences (written ) if every structure satisfying all sentences in also satisfies . Two structures and are elementarily equivalent, written , if they satisfy exactly the same first-order sentences. Elementary equivalence is a weaker relation than isomorphism: there exist non-isomorphic structures that satisfy the same sentences, a phenomenon explored further in model theory.
Proof Systems for First-Order Logic
As established in propositional logic, a proof system provides a purely syntactic method for deriving valid formulas and logical consequences without reference to semantic notions like truth and models. First-order proof systems extend propositional ones with rules for the quantifiers.
In natural deduction, there are four quantifier rules, each with important variable conditions. Universal elimination (-elim) allows us to conclude from for any term — we may instantiate a universal statement with any object. Universal introduction (-intro) allows us to conclude from a derivation of in which is an arbitrary variable — meaning does not appear free in any undischarged assumption. This side condition is what prevents us from illegitimately generalizing from a special case. Existential introduction (-intro) allows us to conclude from for any term — if a particular witness satisfies the formula, then something does. Existential elimination (-elim) allows us to derive a conclusion from by assuming for a fresh constant and deriving , provided does not appear in or in any undischarged assumptions other than .
Hilbert-style systems for first-order logic extend propositional Hilbert systems with additional axiom schemas and the rule of universal generalization: from , infer (with the appropriate variable conditions). Typical additional axiom schemas include the instantiation axiom (provided is free for in ) and the distribution axiom . Sequent calculus for FOL extends Gentzen’s propositional sequent calculus with left and right rules for each quantifier, and Gentzen’s cut-elimination theorem (the Hauptsatz) extends to the first-order case, yielding a proof of the subformula property.
A particularly important proof method is resolution, adapted for first-order logic by John Alan Robinson in 1965. Resolution works on formulas in clausal form (a conjunction of disjunctions of literals) and applies a single inference rule: from clauses and , derive , where is a most general unifier (MGU) of and . Robinson’s unification algorithm computes the MGU — the most general substitution that makes two terms identical. Resolution combined with Skolemization forms the basis of automated theorem proving systems and is the engine behind logic programming languages like Prolog.
Completeness and Compactness Theorems
The completeness theorem, proved by Kurt Godel in his 1930 doctoral dissertation, is one of the most important results in mathematical logic. It establishes a perfect correspondence between semantic truth and syntactic provability in first-order logic:
In words: every logically valid first-order sentence has a formal proof, and every logical consequence of a set of axioms can be derived from those axioms using the rules of a sound proof system. Combined with the converse direction — soundness, which states that implies — this means that the syntactic notion of provability and the semantic notion of logical consequence coincide exactly for first-order logic. This is a remarkable and non-obvious fact; as we will see, it fails for stronger logics like second-order logic.
Godel’s original proof constructed a model from syntax. In 1949, Leon Henkin gave an elegant alternative proof strategy, now the standard presentation. Henkin’s method proceeds in three steps: (1) extend the set to a maximally consistent set — one that is consistent and cannot be extended with any new sentence without becoming inconsistent; (2) add Henkin witnesses so that for every sentence in , there is a constant with ; and (3) construct the term model (or Henkin model) whose domain consists of equivalence classes of closed terms and whose interpretation is dictated by . The key insight is that a maximally consistent set with witnesses already encodes a complete description of a model.
The compactness theorem is an immediate corollary of completeness: a set of first-order sentences has a model if and only if every finite subset of has a model. The proof is short — if has no model, then (a contradiction), so by completeness , but any formal proof uses only finitely many premises, so some finite already proves , meaning has no model. Compactness can also be proved directly using ultraproducts, without appealing to completeness.
Compactness has profound and sometimes surprising consequences. It implies the existence of non-standard models of arithmetic — models of the first-order Peano axioms that contain “numbers” greater than every standard natural number. To see this, add to the Peano axioms a new constant and the sentences , , , and so on. Every finite subset has a model (just interpret as a sufficiently large standard number), so by compactness the entire set has a model — but in any such model, must be greater than every standard natural number. This shows that first-order logic cannot pin down the natural numbers up to isomorphism, a limitation explored further in model theory and addressed more precisely by the categoricity results discussed there.
Extensions and Decidability
The Lowenheim-Skolem theorem, one of the earliest results in model theory, reveals a fundamental limitation of first-order logic. The downward Lowenheim-Skolem theorem (Lowenheim, 1915; Skolem, 1920) states that if a first-order theory has a model of any infinite cardinality, then it has a countable model. The upward Lowenheim-Skolem theorem extends this: if a theory in a countable language has an infinite model, then it has models of every infinite cardinality. Together, these results show that first-order logic cannot distinguish between different infinite cardinalities — a consequence known as Skolem’s paradox when applied to set theory, since ZFC (if consistent) has a countable model, yet proves the existence of uncountable sets.
A natural question is whether first-order validity is decidable — is there an algorithm that, given any first-order sentence , determines whether ? The answer is no. In 1936, Alonzo Church and Alan Turing independently proved that the set of valid first-order sentences is undecidable: there is no Turing machine that correctly classifies every sentence as valid or invalid. This result, connecting logic to computability theory, is one of the foundational theorems of theoretical computer science. However, certain restricted fragments of first-order logic are decidable. Monadic first-order logic (where all predicates are unary) was shown decidable by Lowenheim. The two-variable fragment (formulas using at most two distinct variables) is decidable, as is the guarded fragment introduced by Andréka, van Benthem, and Németi in 1998.
Second-order logic extends first-order logic by allowing quantification not just over individual elements but over predicates and functions on the domain. This dramatically increases expressive power: second-order logic can characterize the natural numbers up to isomorphism (via the second-order Peano axioms) and can express properties like “the domain is finite” or “the graph is connected,” which are not first-order expressible. However, this power comes at a steep cost. By Lindstrom’s theorem (1969), first-order logic is the strongest logic satisfying both the compactness theorem and the downward Lowenheim-Skolem theorem. Second-order logic satisfies neither: it lacks compactness, and Godel’s completeness theorem fails for it — there is no sound and complete proof system for second-order validity. This tradeoff between expressive power and metalogical properties is a central theme in the study of logical systems, explored further in model theory and type theory.