Article · Wikipedia archive · Last revised Jun 5, 2026

Diagonal lemma

In mathematical logic, the diagonal lemma establishes the existence of self-referential sentences in certain formal theories.

Last revised
Jun 5, 2026
Read time
≈ 9 min
Length
2,128 w
Citations
10
Source

In mathematical logic, the diagonal lemma (also known as diagonalization lemma, self-reference lemma or fixed point theorem) establishes the existence of self-referential sentences in certain formal theories.

A particular instance of the diagonal lemma was used by Kurt Gödel in 1931 to construct his proof of the incompleteness theorems as well as in 1933 by Tarski to prove his undefinability theorem. In 1934, Carnap was the first to publish the diagonal lemma at some level of generality.1 The diagonal lemma is named in reference to Cantor's diagonal argument in set theory and number theory.

The diagonal lemma applies to any sufficiently strong theories capable of representing the diagonal function. Such theories include first-order Peano arithmetic P A {\displaystyle {\mathsf {PA}}} , the weaker Robinson arithmetic Q {\displaystyle {\mathsf {Q}}} as well as any theory containing Q {\displaystyle {\mathsf {Q}}} (i.e. that interprets it).2 A common statement of the lemma (as given below) makes the stronger assumption that the theory can represent all (total) computable functions, but all the theories mentioned have that capacity, as well.

Background

Gödel numbering

The diagonal lemma also requires a Gödel numbering α {\displaystyle \alpha } . We write α ( φ ) {\displaystyle \alpha (\varphi )} for the code assigned to φ {\displaystyle \varphi } by the numbering. For n ¯ {\displaystyle {\overline {n}}} , the standard numeral of n {\displaystyle n} (i.e. 0 ¯ = d f 0 {\displaystyle {\overline {0}}=_{df}{\mathsf {0}}} and n + 1 ¯ = d f S ( n ¯ ) {\displaystyle {\overline {n+1}}=_{df}{\mathsf {S}}({\overline {n}})} ), let φ {\displaystyle \ulcorner \varphi \urcorner } be the standard numeral of the code of φ {\displaystyle \varphi } (i.e. φ {\displaystyle \ulcorner \varphi \urcorner } is α ( φ ) ¯ {\displaystyle {\overline {\alpha (\varphi )}}} ). We assume a standard Gödel numbering

Representation theorem

Let N {\displaystyle \mathbb {N} } be the set of natural numbers. A first-order theory T {\displaystyle T} in the language of arithmetic containing Q {\displaystyle {\mathsf {Q}}} represents the k {\displaystyle k} -ary (total) computable function f : N k N {\displaystyle f:\mathbb {N} ^{k}\rightarrow \mathbb {N} } if there is a formula φ f ( x 1 , , x k , y ) {\displaystyle \varphi _{f}(x_{1},\dots ,x_{k},y)} in the language of T {\displaystyle T} such that for all m 1 , , m k N {\displaystyle m_{1},\dots ,m_{k}\in \mathbb {N} } , if f ( m 1 , , m k ) = n {\displaystyle f(m_{1},\dots ,m_{k})=n} then T y ( φ f ( m 1 ¯ , , m k ¯ , y ) y = n ¯ ) {\displaystyle T\vdash \forall y(\varphi _{f}({\overline {m_{1}}},\dots ,{\overline {m_{k}}},y)\leftrightarrow y={\overline {n}})} .

The representation theorem is true, i.e. every computable function is representable in T {\displaystyle T} .3

The diagonal lemma and its proof

Diagonal Lemma: Let T {\displaystyle T} be a first-order theory containing Q {\displaystyle {\mathsf {Q}}} (Robinson arithmetic) and let ψ ( x ) {\displaystyle \psi (x)} be any formula in the language of T {\displaystyle T} with only x {\displaystyle x} as free variable. Then there is a sentence φ {\displaystyle \varphi } in the language of T {\displaystyle T} such that T φ ψ ( φ ) {\displaystyle T\vdash \varphi \leftrightarrow \psi (\ulcorner \varphi \urcorner )} .

Intuitively, φ {\displaystyle \varphi } is a self-referential sentence that "says of itself that it has the property ψ {\displaystyle \psi } ."

Proof: Let d i a g T : N N {\displaystyle diag_{T}:\mathbb {N} \to \mathbb {N} } be the computable function that associates the code of each formula φ ( x ) {\displaystyle \varphi (x)} with only one free variable x {\displaystyle x} in the language of T {\displaystyle T} with the code of the closed formula φ ( φ ) {\displaystyle \varphi (\ulcorner \varphi \urcorner )} (i.e. the substitution of φ {\displaystyle \ulcorner \varphi \urcorner } into φ {\displaystyle \varphi } for x {\displaystyle x} ) and 0 {\displaystyle 0} for other arguments. (The fact that d i a g T {\displaystyle diag_{T}} is computable depends on the choice of the Gödel numbering, here the standard one.)

By the representation theorem, T {\displaystyle T} represents every computable function. Thus, there is a formula δ ( x , y ) {\displaystyle \delta (x,y)} representing d i a g T {\displaystyle diag_{T}} , in particular, for each φ ( x ) {\displaystyle \varphi (x)} , T δ ( φ , y ) y = φ ( φ ) {\displaystyle T\vdash \delta (\ulcorner \varphi \urcorner ,y)\leftrightarrow y=\ulcorner \varphi (\ulcorner \varphi \urcorner )\urcorner } .

Let ψ ( x ) {\displaystyle \psi (x)} be an arbitrary formula with only x {\displaystyle x} as free variable. We now define χ ( x ) {\displaystyle \chi (x)} as y ( δ ( x , y ) ψ ( y ) ) {\displaystyle \exists y(\delta (x,y)\land \psi (y))} , and let φ {\displaystyle \varphi } be χ ( χ ) {\displaystyle \chi (\ulcorner \chi \urcorner )} . Then the following equivalences are provable in T {\displaystyle T} :

φ χ ( χ ) y ( δ ( χ , y ) ψ ( y ) ) y ( y = χ ( χ ) ψ ( y ) ) y ( y = φ ψ ( y ) ) ψ ( φ ) {\displaystyle \varphi \leftrightarrow \chi (\ulcorner \chi \urcorner )\leftrightarrow \exists y(\delta (\ulcorner \chi \urcorner ,y)\land \psi (y))\leftrightarrow \exists y(y=\ulcorner \chi (\ulcorner \chi \urcorner )\urcorner \land \psi (y))\leftrightarrow \exists y(y=\ulcorner \varphi \urcorner \land \psi (y))\leftrightarrow \psi (\ulcorner \varphi \urcorner )} .

Some generalizations

There are various generalizations of the diagonal lemma. We present only some of them; in particular, combinations of the first three generalizations below yield new generalizations.4 Let T {\displaystyle T} be a first-order theory containing Q {\displaystyle {\mathsf {Q}}} (Robinson arithmetic).

Diagonal lemma with parameters

Let ψ ( x , y 1 , , y n ) {\displaystyle \psi (x,y_{1},\dots ,y_{n})} be any formula with free variables x , y 1 , , y n {\displaystyle x,y_{1},\dots ,y_{n}} .

Then there is a formula φ ( y 1 , y n ) {\displaystyle \varphi (y_{1},\dots y_{n})} with free variables y 1 , , y n {\displaystyle y_{1},\dots ,y_{n}} such that T φ ( y 1 , , y n ) ψ ( φ ( y 1 , , y n ) , y 1 , , y n ) {\displaystyle T\vdash \varphi (y_{1},\dots ,y_{n})\leftrightarrow \psi (\ulcorner \varphi (y_{1},\dots ,y_{n})\urcorner ,y_{1},\dots ,y_{n})} .

Uniform diagonal lemma

Let ψ ( x , y 1 , , y n ) {\displaystyle \psi (x,y_{1},\dots ,y_{n})} be any formula with free variables x , y 1 , , y n {\displaystyle x,y_{1},\dots ,y_{n}} .

Then there is a formula φ ( y 1 , y n ) {\displaystyle \varphi (y_{1},\dots y_{n})} with free variables y 1 , , y n {\displaystyle y_{1},\dots ,y_{n}} such that for all m 1 , , m n N {\displaystyle m_{1},\dots ,m_{n}\in \mathbb {N} } , T φ ( m 1 ¯ , , m n ¯ ) ψ ( φ ( m 1 ¯ , , m n ¯ ) , m 1 ¯ , , m n ¯ ) {\displaystyle T\vdash \varphi ({\overline {m_{1}}},\dots ,{\overline {m_{n}}})\leftrightarrow \psi (\ulcorner \varphi ({\overline {m_{1}}},\dots ,{\overline {m_{n}}})\urcorner ,{\overline {m_{1}}},\dots ,{\overline {m_{n}}})} .

Simultaneous diagonal lemma

Let ψ 1 ( x 1 , x 2 ) {\displaystyle \psi _{1}(x_{1},x_{2})} and ψ 2 ( x 1 , x 2 ) {\displaystyle \psi _{2}(x_{1},x_{2})} be formulae with free variables x 1 {\displaystyle x_{1}} and x 2 {\displaystyle x_{2}} .

Then there are sentence φ 1 {\displaystyle \varphi _{1}} and φ 2 {\displaystyle \varphi _{2}} such that T φ 1 ψ 1 ( φ 1 , φ 2 ) {\displaystyle T\vdash \varphi _{1}\leftrightarrow \psi _{1}(\ulcorner \varphi _{1}\urcorner ,\ulcorner \varphi _{2}\urcorner )} and T φ 2 ψ 2 ( φ 1 , φ 2 ) {\displaystyle T\vdash \varphi _{2}\leftrightarrow \psi _{2}(\ulcorner \varphi _{1}\urcorner ,\ulcorner \varphi _{2}\urcorner )} .

The case with n {\displaystyle n} many formulae is similar.

Strong diagonal lemma

Let ψ ( x ) {\displaystyle \psi (x)} be any formula in the language of T {\displaystyle T} with only x {\displaystyle x} as free variable. Then there is a term t {\displaystyle t} in the language of T {\displaystyle T} such that T t = ψ ( t ) {\displaystyle T\vdash t=\ulcorner \psi (t)\urcorner } .

Trivially, the diagonal lemma follows from the strong diagonal lemma (take φ ( x ) {\displaystyle \varphi (x)} to be ψ ( t ) {\displaystyle \psi (t)} ). Note however that the strong diagonal lemma depends on the language of T {\displaystyle T} , particularly on whether there is such a term t {\displaystyle t} . Typically, the strong diagonal lemma fails for theories in the basic language of arithmetic (such as Q {\displaystyle {\mathsf {Q}}} or P A {\displaystyle {\mathsf {PA}}} ), but holds for primitive recursive arithmetic P R A {\displaystyle {\mathsf {PRA}}} which has a function symbol for each primitive recursive functions.5

History

The lemma is called "diagonal" because it bears some resemblance to Cantor's diagonal argument.6 The terms "diagonal lemma" or "fixed point" do not appear in Kurt Gödel's 1931 article or in Alfred Tarski's 1936 article.

In 1934, Rudolf Carnap was the first to publish the diagonal lemma in some level of generality, which says that for any formula ψ ( x ) {\displaystyle \psi (x)} with x {\displaystyle x} as free variable (in a sufficiently expressive language), then there exists a sentence φ {\displaystyle \varphi } such that φ ψ ( φ ) {\displaystyle \varphi \leftrightarrow \psi (\ulcorner \varphi \urcorner )} is true (in some standard model).7 Carnap's work was phrased in terms of truth rather than provability (i.e. semantically rather than syntactically).8 Moreover, the concept of computable functions was not yet developed in 1934.

The diagonal lemma is closely related to Kleene's recursion theorem in computability theory, and their respective proofs are similar.9 In 1952, Léon Henkin asked whether sentences that state their own provability are provable. His question led to more general analyses of the diagonal lemma, especially with Löb's theorem and provability logic.10

See also

See also

Notes

Notes

  1. See Smoryński 2022, Sec. 3.
  2. See Hájek and Pudlák 2016, Chap. III.
  3. See Hinman 2005, Chap 4.6 for additional details and a proof of this theorem.
  4. See Smoryński 2022, Sec. 3 or Hájek and Pudlák 2016, III.2.a
  5. See e.g. Jeroslow 1973, Sec. 1. for more details on the strong diagonal lemma and one of its proof.
  6. See, for example, Gaifman (2006).
  7. See Carnap, 1934, and Gödel, 1986, p. 363, fn 23.
  8. See Smoryński 2022, Sec. 3.
  9. See Gaifman, 2006 or Smoryński 2022, Sec. 3.
  10. See Smoryński 2022, Sec. 3.
References

References

  • Robert G. Jeroslow, 1973. 'Redundancies in the Hilbert-Bernays Derivability Conditions for Gödel's Second Incompleteness Theorem'. The Journal of Symbolic Logic, 38.3: 359–367.
  • Petr Hájek & Pavel Pudlák, 2016 (first edition 1998). Metamathematics of First-Order Arithmetic. Springer Verlag.