Lawvere's fixpoint theorem generalizes the diagonal argument, and the incompleteness theorem can be taken as a special case.

The proof can be found in Frumin and Massas's *Diagonal Arguments and Lawvere's Theorem*. Here is a copy.

Definition: A morphism $f: X\times X\to Y$ is weakly point-surjective iff for every $g: X\to Y$, there is a $t: 1\to X$ such that, for all $x: 1\to X$:
$$gx=f\langle x,t\rangle$$

**Lawvere's Fixpoint Theorem:**

Let $\mathbf{C}$ be a category with a terminal object and binary products. If $f: X\times X\to Y$ is weakly point-surjective, then every morphism $\alpha: Y\to Y$ has a fixpoint $y: 1\to Y$.

Consider a first-order theory $\mathrm{T}$. We form $\mathbf{C}_\mathrm{T}$ a classifying category of $\mathrm{T}$ in the following way:

The $\mathbf{C}_\mathrm{T}$-objects are generated by a sort object $A$ (more object if the theory is multi-sorted), and an object $2$.

The $\mathbf{C}_\mathrm{T}$-morphisms are equivalence classes of (tuples of) formulas $A^n\to 2$ or terms $A^n\to A$ of $\mathrm{T}$.

In particular, morphisms $1\to 2$ are sentences, and morphisms $1\to A$ are constant terms.

A theory is complete iff $\operatorname{Hom}(1,2)=\{\top,\bot\}$.

**Undefinability of $\operatorname{sat}$.** Suppose that the satisfiabilty predicate is definable in $\mathrm{T}$: $\vdash \operatorname{sat}(a,\ulcorner\varphi\urcorner)\leftrightarrow\varphi(a)$ for all $\varphi,a$.

In categorical terms, we have a Godel encoding $\ulcorner \urcorner: \operatorname{Hom}(A^n,2)\to \operatorname{Hom}(1,A)$, and a formula $\operatorname{sat}: A^2\to 2$, such that for $\varphi: A\to 2$ and $a: 1\to A$, $\operatorname{sat}\langle a,\ulcorner\varphi\urcorner\rangle=\varphi a$.

But this is exactly the condition for weak point-surjectivity!

**Undefinability of $\operatorname{truth}$.** Suppose that $\mathrm{T}$ has a 'truth' predicate: $\operatorname{true}\circ\ulcorner\varphi\urcorner=\varphi$ for all $\varphi\in \operatorname{Hom}(1,2)$.

Suppose that $\mathrm{T}$ supports 'substitution': $\operatorname{subst}\langle a,\ulcorner\varphi\urcorner\rangle=\ulcorner\varphi(a)\urcorner$.

Then we can define $\operatorname{sat} := \operatorname{true}\circ \operatorname{subst}$.

**Incomplenteness.** Suppose that 'provability' is representable in $\mathrm{T}$: $\mathrm{T}\vdash\varphi\iff\mathrm{T}\vdash\operatorname{prov}(\ulcorner\varphi\urcorner)$.

If $\mathrm{T}$ is complete, then $\varphi=\top$ or $\varphi=\bot$.

And $\varphi=\top\implies \operatorname{prov}(\ulcorner\varphi\urcorner)=\top$, $\varphi=\bot\implies \operatorname{prov}(\ulcorner\varphi\urcorner)=\bot$.

Therefore, for all $\varphi\in \operatorname{Hom}(1,2): \operatorname{prov}\circ\ulcorner\varphi\urcorner=\varphi$, i.e. $\operatorname{true}$ is $\operatorname{prov}$.

4more comments