---
title: First-Order Languages
module: First-Order Languages and Structures
moduleNumber: 3
lessonNumber: 1
order: 301
summary: >
  Sentential logic cannot see inside a simple statement, so it misses valid
  arguments that turn on quantifiers and predicates. A first-order language adds
  a quantifier, variables, and a chosen vocabulary of predicate, function, and
  constant symbols. Terms and well-formed formulas are built by recursion over
  this alphabet, and a variable occurs free or bound according to the
  quantifiers that reach it.
topics: [First-Order Languages and Structures]
sources:
  - book: Enderton
    ref: "Ch. 2 — First-Order Logic; §2.0 Preliminary Remarks"
  - book: Enderton
    ref: "§2.1 First-Order Languages"
draft: false
---

[Sentential logic](/logic/sentential-logic/formal-languages-and-well-formed-formulas)
treats a sentence as an indivisible atom. A sentence symbol $A$ is either true
or false, and the connectives combine those verdicts, but nothing in the
apparatus looks _inside_ $A$. That coarseness is fatal for ordinary
mathematical reasoning. Consider the classic syllogism:

- All men are mortal.
- Socrates is a man.
- Therefore Socrates is mortal.

Anyone accepts this as valid. Yet if we translate the three sentences into
sentential logic we must assign them three unrelated symbols $A$, $B$, $C$,
and $\{A, B\} \models C$ is false: a truth assignment making $A$ and $B$ true
and $C$ false is available, because sentential logic cannot represent that the
three sentences share the subject "Socrates" and the predicates "man" and
"mortal." The validity turns on structure the model cannot express.[^prelim]

First-order logic supplies exactly that structure. It keeps the connectives of
sentential logic and adds three devices: **variables** that range over a
domain, a **quantifier** $\forall$ ("for all"), and a vocabulary of
**predicate, function, and constant symbols** that describe the objects in the
domain. The Socrates argument becomes

$$
\{\, \forall v_1 (H v_1 \rightarrow M v_1),\ H s \,\} \models M s,
$$

with $H$ for "is a man," $M$ for "is mortal," and $s$ naming Socrates. This
consequence holds once
[satisfaction](/logic/first-order-languages/structures-truth-and-satisfaction)
is defined. Almost any argument a working mathematician writes in a proof can
be mirrored in a first-order language; that expressive reach is why first-order
logic, rather than a weaker system, is the standard object of metamathematics.

## Two simplifications

Before listing symbols we adopt two simplifications, each justified by results
from sentential logic, each reducing the symbol set with no loss of
expressive power.

- **One adequate pair of connectives.** We keep only $\neg$ and $\rightarrow$.
  The set $\{\neg, \rightarrow\}$ is
  [expressively complete](/logic/sentential-logic/expressive-completeness-and-normal-forms),
  so $\wedge$, $\vee$, $\leftrightarrow$ are recovered as abbreviations and
  never enter the official alphabet.
- **One quantifier.** We keep only the universal quantifier $\forall$. The
  existential quantifier is definable: "there is something rotten in Denmark"
  says "it is not the case that everything is un-rotten," so $\exists x$
  abbreviates $\neg\, \forall x\, \neg$. A single quantifier symbol suffices.

These are conveniences of presentation. Every theorem below holds unchanged
under the richer alphabet; the shorter one keeps inductions and case analyses
to a minimum.

## The alphabet

A first-order language draws its symbols from two pools. One pool is fixed and
present in every first-order language; the other is chosen when we decide
_which_ language we are studying.[^params]

> **Definition (Logical symbols).** The symbols common to every first-order
> language: the parentheses $(\ )$; the connective symbols $\neg$ and
> $\rightarrow$; a variable $v_n$ for each positive integer $n$; and, in
> languages _with equality_, the equality symbol $=$.

> **Definition (Parameters).** The symbols that vary from language to
> language: the quantifier symbol $\forall$; for each $n$ a set (possibly
> empty) of **$n$-place predicate symbols**; a set of **constant symbols**;
> and for each $n$ a set of **$n$-place function symbols**.

The equality symbol occupies a middle position. It is a two-place predicate,
but it is classified as a _logical_ symbol rather than a parameter, because
its interpretation is fixed once and for all as genuine identity, not left
open the way an ordinary predicate is. A language either has $=$ or does not;
we say so explicitly when we name the language. We do assume at least one
predicate symbol is present for some arity, so that formulas can be built at
all. Constant symbols are treated uniformly as **$0$-place function symbols**,
which spares us separate clauses for constants in many later arguments.

$$
% caption: The symbols split into a fixed logical core, present in every
% first-order language, and a chosen parameter vocabulary that names the
% subject matter.
\begin{tikzpicture}[font=\small,
  box/.style={draw, align=center, minimum height=8mm, inner sep=3pt},
  hdr/.style={font=\footnotesize\bfseries}]
  \definecolor{acc}{HTML}{4A6FA5}
  % logical column
  \node[hdr] at (0,3.2) {Logical symbols (shared)};
  \node[box, minimum width=42mm] (l1) at (0,2.5) {parentheses};
  \node[box, minimum width=42mm] (l2) at (0,1.7) {connectives: not, implies};
  \node[box, minimum width=42mm] (l3) at (0,0.9) {one variable $v_n$ per $n$};
  \node[box, minimum width=42mm] (l4) at (0,0.1) {equals (optional)};
  % parameter column
  \node[hdr] at (6,3.2) {Parameters (chosen)};
  \node[box, draw=acc, minimum width=42mm] (p1) at (6,2.5) {the for-all symbol};
  \node[box, draw=acc, minimum width=42mm] (p2) at (6,1.7) {predicate symbols};
  \node[box, draw=acc, minimum width=42mm] (p3) at (6,0.9) {constant symbols};
  \node[box, draw=acc, minimum width=42mm] (p4) at (6,0.1) {function symbols};
  \draw[black] (2.6,-0.4) -- (2.6,3.0);
\end{tikzpicture}
$$

The connective symbols carry their sentential readings unchanged. The three
defined connectives are abbreviations, spelled out in the last section.

| Symbol | Reading | Status |
| --- | --- | --- |
| $\neg$ | not | primitive |
| $\rightarrow$ | implies | primitive |
| $\wedge$ | and | abbreviation |
| $\vee$ | or | abbreviation |
| $\leftrightarrow$ | if and only if | abbreviation |
| $\forall$ | for all | primitive (parameter) |
| $\exists$ | there exists | abbreviation |

## Naming a language

To specify a particular first-order language, as distinct from every other, we
answer two questions: is the equality symbol present, and what are the
parameters? Four languages recur throughout these notes.

- **Pure predicate language.** Equality: no. For each $n$, predicate symbols
  $A^n_1, A^n_2, \dots$; constant symbols $a_1, a_2, \dots$; no function
  symbols of positive arity. The barest setting, used for counterexamples.
- **Language of set theory.** Equality: yes. One two-place predicate symbol
  $\in$; no function symbols (occasionally a constant $\varnothing$). Nearly
  all of mathematics embeds here: statements become sentences of set theory,
  and theorems follow from the set-theoretic axioms.
- **Language of elementary number theory.** Equality: yes. A two-place
  predicate $<$; a constant $0$; a one-place function symbol $S$ (successor);
  two-place function symbols $+$, $\cdot$, and $E$ (exponentiation). This is
  the language of [Chapter 3](/logic/arithmetic-and-definability/definability-in-arithmetic).
- **Language of group theory.** Equality: yes. A two-place function symbol
  $\circ$ (the group operation), and optionally a constant for the identity.

### Translation

A sentence like "there is no set of which every set is a member" translates in
stages, from English through a mixed idiom to the official symbols. In the
language of set theory, reading $\forall$ as "for all sets" and $\in$ as
"membership," we pass through

$$
\neg\, \exists v_1\, \forall v_2\; v_2 \in v_1
\quad\longrightarrow\quad
\bigl(\neg\,(\neg\, \forall v_1\, (\neg\, \forall v_2\; {\in}v_2 v_1))\bigr).
$$

Two conventions of the official syntax appear here. Predicate symbols go on
the _left_ of their arguments, so $v_2 \in v_1$ is really ${\in}v_2 v_1$; and
$\exists v_1$ expands to $\neg\, \forall v_1\, \neg$. The finished string is
hard to read, and the abbreviations below exist to avoid it. But the finished
string is what the definitions govern.

Two patterns account for most quantified translations. A claim that everything
in a category has a property takes $\forall v\,(\alpha \rightarrow \beta)$; a
claim that some object in the category has a property takes $\exists v\,(\alpha
\wedge \beta)$. Swapping the connective between the two patterns changes the
meaning drastically.

> **Worked example.** In an ad hoc language with $A v$ for "$v$ is an apple"
> and $B v$ for "$v$ is bad," translate "All apples are bad" and "Some apples
> are bad," then read the two mismatched forms back into English.
>
> "All apples are bad" is a universal claim, so it uses the implication
> pattern:
> $$
> \forall v_1\,(A v_1 \rightarrow B v_1).
> $$
> "Some apples are bad" is an existential claim, so it uses the conjunction
> pattern:
> $$
> \exists v_1\,(A v_1 \wedge B v_1),
> $$
> which unabbreviated is $(\neg\, \forall v_1\,(\neg\,(A v_1 \rightarrow (\neg\,
> B v_1)))).$
>
> Now read the forms with the connectives swapped. The formula $\forall
> v_1\,(A v_1 \wedge B v_1)$ says "everything is an apple and is bad" — far
> stronger than the first sentence, since it claims the whole universe consists
> of bad apples. The formula $\exists v_1\,(A v_1 \rightarrow B v_1)$ says
> "something is bad if it is an apple," which is far weaker than the second: it
> holds vacuously as soon as the universe contains one non-apple, whether or not
> any apple is bad.[^params]

$$
% caption: The two translation templates; a universal claim binds the category
% and the property with an implication, an existential claim with a conjunction.
% Swapping the connective between them changes the assertion.
\begin{tikzpicture}[font=\small,
  box/.style={draw, align=center, minimum height=9mm, inner sep=4pt},
  hdr/.style={font=\footnotesize\bfseries}]
  \definecolor{acc}{HTML}{4A6FA5}
  \node[hdr] at (0,2.4) {universal claim};
  \node[box, draw=acc, minimum width=54mm] (u) at (0,1.6) {for all $v$: apple $v$ implies bad $v$};
  \node[font=\footnotesize, black, align=center] at (0,0.7) {reads too strong\\ with a conjunction};
  \node[hdr] at (0,-0.6) {existential claim};
  \node[box, draw=acc, minimum width=54mm] (e) at (0,-1.4) {some $v$: apple $v$ and bad $v$};
  \node[font=\footnotesize, black, align=center] at (0,-2.3) {reads vacuous\\ with an implication};
\end{tikzpicture}
$$

## Terms

The **terms** are the noun phrases of the language: the expressions that name
objects. They are built from the variables and constant symbols by prefixing
function symbols. To reuse the recursion of
[Chapter 1](/logic/sentential-logic/induction-and-recursion), each $n$-place
function symbol $f$ carries a **term-building operation** $F_f$ on expressions,

$$
F_f(\varepsilon_1, \dots, \varepsilon_n) = f\,\varepsilon_1 \cdots \varepsilon_n,
$$

which writes $f$ at the front and concatenates its arguments — **Polish
notation**, with no parentheses and no commas.

> **Definition (Term).** The set of terms is the least set of expressions that
> contains every variable and every constant symbol and is closed under the
> operations $F_f$ for every function symbol $f$.

If the only "function symbols" are constants, no recursion is needed: the
terms are just the variables and the constants. With genuine function symbols
present, a term is any expression assembled by finitely many prefixings. In
the language of number theory, $S S 0$ names $2$ (the successor of the
successor of zero), and $+\, S S 0\, S S 0$ names "$2 + 2$" — again the
function symbol leads. A term never contains a connective or a quantifier;
those belong to formulas.

$$
% caption: The term $+\, v_1\, f\, S 0\, v_2$ (infix $v_1 + f(S0,\, v_2)$ for a
% two-place function symbol $f$) parsed as a tree; every internal node is a
% function symbol, every leaf a variable or constant.
\begin{tikzpicture}[font=\small, level distance=12mm,
  every node/.style={draw, circle, inner sep=1.5pt, minimum size=6mm},
  edge from parent/.style={draw, black}]
  \definecolor{acc}{HTML}{4A6FA5}
  \node[draw=acc] {$+$}
    child {node {$v_1$}}
    child {node {$f$}
      child {node {$S$}
        child {node {$0$}}}
      child {node {$v_2$}}};
\end{tikzpicture}
$$

## Atomic formulas and well-formed formulas

Atomic formulas are the smallest complete assertions. Unlike terms and
compound formulas, they are defined _explicitly_, not by recursion.

> **Definition (Atomic formula).** An expression $P\, t_1 \cdots t_n$, where
> $P$ is an $n$-place predicate symbol and $t_1, \dots, t_n$ are terms.

Thus ${=}v_1 v_2$ is atomic (equality is a two-place predicate), as is
${\in}v_5 v_3$ in the language of set theory. Atomic formulas play the role
that sentence symbols played in sentential logic: they are the base of the
recursion that builds every formula.

The compound formulas are built from atomic ones by the connectives and the
quantifier. As with terms, we phrase the construction through
formula-building operations on expressions,

$$
\mathcal{E}_\neg(\gamma) = (\neg\, \gamma),
\qquad
\mathcal{E}_\rightarrow(\gamma, \delta) = (\gamma \rightarrow \delta),
\qquad
\mathcal{Q}_i(\gamma) = \forall v_i\, \gamma.
$$

> **Definition (Well-formed formula).** The set of **wffs** (or formulas) is
> the least set of expressions that contains every atomic formula and is
> closed under $\mathcal{E}_\neg$, $\mathcal{E}_\rightarrow$, and
> $\mathcal{Q}_i$ for every $i$.

The expression $\neg v_3$ is not a wff: $v_3$ is a term, not a formula, so
$\mathcal{E}_\neg$ cannot apply to it. By contrast the following string is a
wff, built up atom by atom — it happens to be the axiom of regularity for set
theory:

$$
\forall v_1\bigl(\neg\, \forall v_3(\neg\, {\in}v_3 v_1) \rightarrow
\neg\, \forall v_2({\in}v_2 v_1 \rightarrow \neg\, \forall v_4({\in}v_4 v_2 \rightarrow \neg\, {\in}v_4 v_1))\bigr).
$$

Its structure is that of a formation tree, atomic formulas at the leaves and
one building operation at each internal node.

$$
% caption: A formation tree for the wff $\forall v_1 (H v_1 \rightarrow M v_1)$;
% the quantifier node binds $v_1$ over the implication below it.
\begin{tikzpicture}[font=\small, level distance=13mm,
  level 1/.style={sibling distance=34mm},
  level 2/.style={sibling distance=22mm},
  every node/.style={draw, inner sep=3pt, align=center, font=\footnotesize},
  edge from parent/.style={draw, black}]
  \definecolor{acc}{HTML}{4A6FA5}
  \node[draw=acc] {for all $v_1$}
    child {node {implies}
      child {node {$H\, v_1$}}
      child {node {$M\, v_1$}}};
\end{tikzpicture}
$$

## Free and bound variables

Compare two wffs of set theory:

$$
\forall v_2\; {\in}v_2 v_1
\qquad\text{and}\qquad
\neg\, \forall v_1\,(\neg\, \forall v_2\; {\in}v_2 v_1).
$$

The second reads "there is a set of which every set is a member," a complete
statement. The first can only be read "every set is a member of ___," with a
blank we cannot fill until we know what $v_1$ refers to. The difference is that
$v_1$ **occurs free** in the first wff and does not in the second, where the
prefix $\forall v_1$ has captured it. We make this precise without appeal to
English by recursion on the wff.

> **Definition (Free occurrence).** For a variable $x$, the relation "$x$
> occurs free in $\alpha$" is defined by recursion:
>
> - for atomic $\alpha$, $x$ occurs free in $\alpha$ iff $x$ occurs in
>   $\alpha$;
> - $x$ occurs free in $\neg\, \alpha$ iff $x$ occurs free in $\alpha$;
> - $x$ occurs free in $\alpha \rightarrow \beta$ iff $x$ occurs free in
>   $\alpha$ or in $\beta$;
> - $x$ occurs free in $\forall v_i\, \alpha$ iff $x$ occurs free in $\alpha$
>   **and** $x \neq v_i$.

The last clause is where binding happens: a $\forall v_i$ prefix removes $v_i$
from the free variables of whatever it governs. The definition is legitimate
because every wff has a unique formation tree, a fact proved in the
[parsing lesson](/logic/first-order-languages/terms-substitution-and-parsing);
the recursion theorem of
[Chapter 1](/logic/sentential-logic/induction-and-recursion) then guarantees a
unique free-variable function on all wffs.

$$
% caption: Each variable occurrence in $\forall v_1 (P v_1 \rightarrow \forall
% v_2\, R v_1 v_2)$ tagged bound or free; the two $v_1$'s are bound by the outer
% quantifier, both $v_2$'s by the inner one.
\begin{tikzpicture}[font=\small, node distance=0pt]
  \definecolor{acc}{HTML}{4A6FA5}
  % the string laid out horizontally
  \node (q1) {for all $v_1$};
  \node[right=6mm of q1] (lp) {$($};
  \node[right=2mm of lp] (p) {$P\,v_1$};
  \node[right=4mm of p] (imp) {implies};
  \node[right=4mm of imp] (q2) {for all $v_2$};
  \node[right=4mm of q2] (r) {$R\,v_1 v_2$};
  \node[right=1mm of r] (rp) {$)$};
  % binder arrows drawn below
  \draw[acc, ->] (q1.south) .. controls +(0,-0.7) and +(0,-0.7) .. (p.south);
  \draw[acc, ->] (q1.south) .. controls +(0,-1.1) and +(0,-1.1) .. ([xshift=-2pt]r.south west);
  \draw[black, ->] (q2.south) .. controls +(0,-0.5) and +(0,-0.5) .. ([xshift=3pt]r.south);
  \node[acc, font=\scriptsize] at (2.4,-1.55) {binds $v_1$};
  \node[black, font=\scriptsize] at (7.2,-1.05) {binds $v_2$};
\end{tikzpicture}
$$

> **Definition (Sentence).** A wff in which no variable occurs free. Given an
> interpretation of the parameters, a sentence translates into English with no
> blanks — it makes a definite assertion.

Sentences are the wffs of primary interest; the others exist mainly as
building blocks. The two examples $\forall v_2 (A v_2 \rightarrow B v_2)$ and
$\forall v_3(P v_3 \rightarrow \forall v_3\, Q v_3)$ are sentences, whereas
$v_1$ occurs free in $\forall v_1\, A v_1 \rightarrow B v_1$ — note that the
second $v_1$ lies outside the reach of $\forall v_1$ once outermost
parentheses are read correctly.

> **Worked example.** Which variables occur free in $\exists v_1\, P v_1 \wedge
> P v_1$? Apply the recursion, using the derived clauses for the abbreviations
> $\exists$ (free in $\exists v_i\,\alpha$ iff free in $\alpha$ and $x \neq
> v_i$) and $\wedge$ (free in $\alpha \wedge \beta$ iff free in either).
>
> Precedence reads $\exists v_1$ as binding as little as possible, so the wff
> parses as $(\exists v_1\, P v_1) \wedge (P v_1)$ — a conjunction, not a single
> quantified formula.
>
> - Left conjunct $\exists v_1\, P v_1$: the sole occurrence of $v_1$ sits under
>   $\exists v_1$, so the binding clause removes it. No variable occurs free.
> - Right conjunct $P v_1$: atomic, so every variable in it occurs free. Here
>   $v_1$ occurs free.
> - Conjunction: $v_1$ occurs free in the whole iff it occurs free in either
>   conjunct. It does, through the right one.
>
> So $v_1$ occurs free in $\exists v_1\, P v_1 \wedge P v_1$, and the formula is
> not a sentence. The trap is the scope: the leftmost $\exists v_1$ captures
> only the $v_1$ inside its own $P v_1$, never the copy standing outside the
> parentheses.[^params]

The particular variables in a sentence do not matter. "All apples are bad"
translates equally well as $\forall v_1(A v_1 \rightarrow B v_1)$ or
$\forall v_{27}(A v_{27} \rightarrow B v_{27})$; the variable is used as a
pronoun. Because the choice is immaterial, we often write $\forall x\,(A x
\rightarrow B x)$, where $x$ stands for some unspecified variable. The same
pattern appears wherever mathematicians use a dummy index, as $i$ in a sum
$\sum_i a_{ij}$ is bound while $j$ occurs free.

## Notational conventions

The official syntax is complete but hard to read. We therefore fix ways
of _naming_ wffs more readably, without changing the definition of what a wff
is. Here $\alpha, \beta$ are formulas, $x$ a variable, $u, t$ terms.

- $(\alpha \vee \beta)$ abbreviates $((\neg\, \alpha) \rightarrow \beta)$.
- $(\alpha \wedge \beta)$ abbreviates $(\neg\,(\alpha \rightarrow (\neg\, \beta)))$.
- $(\alpha \leftrightarrow \beta)$ abbreviates
  $((\alpha \rightarrow \beta) \wedge (\beta \rightarrow \alpha))$.
- $\exists x\, \alpha$ abbreviates $(\neg\, \forall x\,(\neg\, \alpha))$.
- $u = t$ abbreviates ${=}u t$; likewise $2 < 3$ abbreviates ${<}2\,3$ and
  $2 + 2$ abbreviates $+\,2\,2$, restoring familiar infix placement for chosen
  two-place symbols.
- $u \neq t$ abbreviates $(\neg\, {=}u t)$.

Parentheses are dropped by rules of precedence: outermost parentheses go;
$\neg$, $\forall$, $\exists$ bind as little as possible; $\wedge$ and $\vee$
bind less than $\neg$; and a repeated connective groups to the right, so
$\alpha \rightarrow \beta \rightarrow \gamma$ means $\alpha \rightarrow (\beta
\rightarrow \gamma)$. Under these conventions the regularity axiom above reads
$\forall x\,(\exists y\, y \in x \rightarrow \exists y\,(y \in x \wedge \neg\,
\exists z\,(z \in y \wedge z \in x)))$ — the same wff, now legible.

These abbreviations are naming devices only. In the rare cases where the exact
sequence of symbols matters, drop the conventions and revert to primitive
notation. A wff carries no meaning until a
[structure interprets its parameters](/logic/first-order-languages/structures-truth-and-satisfaction)
and fixes when it is satisfied.

[^prelim]: Enderton, §2.0 — the passage from sentential to first-order logic, and the economy measures reducing the connectives to $\{\neg, \rightarrow\}$ and the quantifiers to $\forall$ alone.
[^params]: Enderton, §2.1 — the division of symbols into logical symbols and parameters, the status of equality as a distinguished logical symbol, and the recursive definitions of terms, atomic formulas, wffs, and free occurrence.
