After a bit of a technical delay, it’s time to finish the repost of incompleteness! Finally, we’re at the end of our walkthrough of Gödel great incompleteness proof. As a refresher, the basic proof sketch is:

- Take a simple logic. We’ve been using a variant of the Principia Mathematica’s logic, because that’s what Gödel used.
- Show that any statement in the logic can be encoded as a number using an arithmetic process based on the syntax of the logic. The process of encoding statements numerically is called Gödel numbering.
- Show that you can express meta-mathematical properties of logical statements in terms of arithemetic properties of their Gödel numbers. In particular, we need to build up the logical infrastructure that we need to talk about whether or not a statement is provable.
- Using meta-mathematical properties, show how you can create an unprovable statement encoded as a Gödel number.

What came before:

- Gödel numbering: The logic of the Principia, and how to encode it as numbers. This was step 1 in the sketch.
- Arithmetic Properties: what it means to say that a property can be expressed arithemetically. This set the groundwork for step 2 in the proof sketch.
- Encoding meta-math arithmetically: how to take meta-mathematical properties of logical statements, and define them as arithmetic properties of the Gödel numberings of the statements. This was step 2 proper.

So now we can move on to step three, where we actually see why mathematical logic is necessarily incomplete.

What I did in the last post was walk through a very laborious process that showed how we could express meta-mathematical properties of logical statements as primitive recursive functions and relations. Using that, we were able to express a non-primitive-recursive predicate `provable`

, which is true for a particular number if and only if that number is the Gödel number representation of a statement which is provable.

pred provable(x) = some y { proofFor(y, x) } }

The reason for going through all of that was that we really needed to show how we could capture all of the necessary properties of logical statements in terms of arithmetic properties of their Gödel numbers.

Now we can get to the target of Gödel’s effort. What Gödel was trying to do was show how to defeat the careful stratification of the Principia’s logic. In the principia, Russell and Whitehead had tried to avoid problems with self-reference by creating a very strict type-theoretic stratification, where each variable or predicate had a numeric level, and could only reason about objects from lower levels. So if natural numbers were the primitive objects in the domain being reasoned about, then level-1 objects would be things like specific natural numbers, and level-1 predicates could reason about specific natural numbers, but not about sets of natural numbers or predicates over the natural numbers. Level-2 objects would be sets of natural numbers, and level-2 predicates could reason about natural numbers and sets of natural numbers, but not about predicates over sets of natural numbers, or sets of sets of natural numbers. Level-3 objects would be sets of sets of natural numbers… and so on.

The point of this stratification was to make self-reference impossible. You couldn’t make a statement of the form “This predicate is true”: the predicate would be a level-N predicate, and only a level N+1 predicate could reason about a level-N predicate.

What Gödel did in the arithmetic process we went through in the last post is embed a model of logical statements in the natural numbers. That’s the real trick: the logic of the principia is designed to work with a collection of objects that are a model of the natural numbers. By embedding a model of logical statements in the natural numbers, he made it possible for a level-1 predicate (a predicate about a specific natural number) to reason about *any* logical statement or object. A level-1 predicate can now reason about a level-7 object! A level-1 predicate can reason about the set defined by a level-1 predicate: a level-1 predicate can reason *about itself!*. A level-1 predicate can, now, reason about any logical statement at all – itself, a level-2 predicate, or a level-27 predicate. Gödel found a way to break the stratification.

Now, we can finally start getting to the point of all of this: incompleteness! We’re going to use our newfound ability to nest logical statements into numbers to construct an unprovable true statement.

In the last post, one of the meta-mathematical properties that we defined for the Gödel-numbered logic was `immConseq`

, which defines when some statement *x* is an *immediate consequence* of a set of statements *S*. As a reminder, that means that *x* can be inferred from statements in *S* in one inferrence step.

We can use that property to define what it means to be a consequence of a set of statements: it’s the closure of immediate consequence. We can define it in pseudo-code as:

def conseq(κ) = { K = κ + axioms added_to_k = false do { added_to_k = false for all c in immConseq(K) { if c not in K { add c to K added_to_k = true } } } while added_to_k return K }

In other words, *Conseq(κ)* is the complete set of everything that can possibly be inferred from the statements in κ and the axioms of the system. We can say that there’s a proof for a statement *x* in κ if and only if *x ∈ Conseq(κ)*.

We can take the idea of *Conseq* use that to define a strong version of what it means for a logical system with a set of facts to be consistent. A system is ω-consistent if and only if there is *not* a statement *a* such that: *a ∈ Conseq(κ) ∧ not(forall(v, a)) ∈ Conseq(κ)*.

In other words, the system is ω-consistent as long as it’s never true that both a universal statement and it. But for our purposes, we can treat it as being pretty much the same thing. (Yes, that’s a bit hand-wavy, but I’m not trying to write an entire book about Gödel here!)

*(Gödel’s version of the definition of ω-consistency is harder to read than this, because he’s very explicit about the fact that Conseq is a property of the numbers. I’m willing to fuzz that, because we’ve shown that the statements and the numbers are interchangable.)*

Using the definition of ω-consistency, we can *finally* get to the actual statement of the incompleteness theorem!

**Gödel’s First Incompleteness Theorem:** For every ω-consistent primitive recursive set κ of formulae, there is a primitive-recursive predicate *r(x)* such that neither *forall(v, r)* nor *not(forall(v, r))* is provable.

To prove that, we’ll construct the predicate *r*.

First, we need to define a version of our earlier `isProofFigure`

that’s specific to the set of statements κ:

pred isProofFigureWithKappa(x, kappa) = { all n in 1 to length(x) { isAxiom(item(n, x)) or item(n, x) in kappa or some p in 0 to n { some q in 0 to n { immedConseq(item(n, x), item(p, x), item(q, x)) } } } and length(x) > 0 }

This is the same as the earlier definition – just specialized so that it ensures that every statement in the proof figure is either an axiom, or a member of κ.

We can do the same thing to specialize the predicate `proofFor`

and `provable`

:

pred proofForStatementWithKappa(x, y, kappa) = { isProofFigureWithKappa(x, kappa) and item(length(x), x) = y } pred provableWithKappa(x, kappa) = { some y { proofForStatementWithKappa(y, x, kappa) } }

If κ is the set of basic truths that we can work with, then provable in κ is equivalent to provable.

Now, we can define a predicate *UnprovableInKappa*:

pred NotAProofWithKappa(x, y, kappa) = { not (proofForKappa(x, subst(y, 19, number(y)))) }

Based on everything that we’ve done so far, *NotAProofWithKappa* is primitive recursive.

This is tricky, but it’s really important. We’re getting very close to the goal, and it’s subtle, so let’s take the time to understand this.

- Remember that in a Gödel numbering, each prime number is a variable. So 19 here is just the name of a free variable in
*y*. - Using the Principia’s logic, the fact that variable 19 is free means that the statement is parametric in variable 19. For the moment, it’s an incomplete statement, because it’s got an unbound parameter.
- What we’re doing in
*NotAProofWithKappa*is substituting the numeric coding of*y*for the value of*y*‘s parameter. When that’s done,*y*is no longer incomplete: it’s unbound variable has been replaced by a binding. - With that substitution,
*NotAProofWithKappa(x, y, kappa)*is true when*x**does not*prove that*y(y)*is true.

What *NotAProofWithKappa* does is give us a way to check whether a specific sequence of statements *x* is **not** a proof of *y*.

We want to expand *NotAProofWithKappa* to something universal. Instead of just saying that a specific sequence of statements *x* isn’t a proof for *y*, we want to be able to say that *no possible sequence of statements* is a proof for *y*. That’s easy to do in logic: you just wrap the statement in a “∀ x ( )”. In Gödel numbering, we defined a function that does exactly that. So the universal form of provability is: *∀ a (NotAProofWithKappa(a, y, kappa))*.

In terms of the Gödel numbering, if we assume that the Gödel number for the variable *a* is 17, and the variable *y* is numbered as 19, we’re talking about the statement *p = forall(17, ProvableInKappa(17, 19, kappa)*.

*p* is the statement that for some logical statement (the value of variable 19, or y in our definition), there is no possible value for variable 17 (a) where *a* proves *y* in κ.

All we need to do now is show that we can make *p* become self-referential. No problem: we can just put *number(p)* in as the value of *y* in *UnprovableInKappa*. If we let *q* be the numeric value of the statement *UnprovableInKappa(a, y)*, then:

r = subst(q, 19, p)

i = subst(p, 19, r)

*i* says that there is no possible value *x* that proves *p(p)*. In other words, *p(p)* is unprovable: there exists no possible proof that there is no possible proof of p!

This is what we’ve been trying to get at all this time: self-reference! We’ve got a predicate *y* which is able to express a property *of itself*. Worse, it’s able to express a *negative property* of itself!

Now we’re faced with two possible choices. Either *i* is provable – in which case, κ is inconsistent! Or else *i* is unprovable – in which case κ is incomplete, because we’ve identified a true statement that can’t be proven!

That’s it: we’ve shown that in the principia’s logic, using nothing but arithmetic, we can create a true statement that cannot be proven. If, somehow, it were to be proven, the entire logic would be inconsistent. So the principia’s logic is incomplete: there are true statements that cannot be proven true.

We can go a bit further: the process that we used to produce this result about the Principia’s logic is actually applicable to other logics. There’s no magic here: if your logic is powerful enough to do Peano arithmetic, you can use the same trick that we demonstrated here, and show that the logic must be either incomplete or inconsistent. (Gödel proved this formally, but we’ll just handwave it.)

Looking at this with modern eyes, it doesn’t seem quite as profound as it did back in Gödel’s day.

When we look at it through the lens of today, what we see is that in the Principia’s logic, proof is a mechanical process: a computation. If every true statement was provable, then you could take any statement *S*, and write a program to search for a proof of either *S* or *¬ S*, and eventually, that program would find one or the other, and stop.

In short, you’d be able to solve the halting problem. The proof of the halting problem is really an amazingly profound thing: on a very deep level, it’s the same thing as incompleteness, only it’s easier to understand.

But at the time that Gödel was working, Turing hadn’t written his paper about the halting problem. Incompletess was published in 1931; Turing’s halting paper was published in 1936. This was a totally unprecedented idea when it was published. Gödel produced one of the most profound and surprising results in the entire history of mathematics, showing that the efforts of the best mathematicians in the world to produce the perfection of mathematics were completely futile.

Simon Wright“In other words, the system is ω-consistent as long as it’s never true that both a universal statement and it.” – ?

James R MeyerThere are several errors in this part 4 (The Payoff) of your explanation of Gödel’s proof which render your account almost impenetrable as well as being completely wrong. The principal error is described below.

When you state r = subst(q, 19, p) and i = subst(p, 19, r), such use of the subst function does not correspond to a valid substitution of a variable of the formal system. A careful examination of the definition of the function shows that the subst function corresponds (by Gödel numbering) to the concept in the meta-language of the substitution of a free variable in a formula of the formal system by ANY string of symbols of the formal system.

Since p corresponds (by Gödel numbering) to a string of symbols that is a formula, not a natural number, your use of the subst function corresponds to the substitution of a variable of a formula of the formal system by a formula of the formal system, whereas it should correspond to the substitution of a variable of a formula of the formal system by a natural number.

Perhaps you actually intended:

r = subst(q, 19, GN(p))

where GN is a function that gives the Gödel number of the formula p, and

i = subst(p, 19, GN(r)) which gives i = subst(p, 19, GN(GN(r)))

But if that was your intention, then your account gives no explanation as to how the Gödel numbering function GN might be included within the formal system itself. Since the Gödel numbering function requires a variable whose domain is all symbol strings of the formal system, and no variable of the formal system has such a domain, this is no trivial matter.

As such, when you say “This is what we’ve been trying to get at all this time: self-reference!”, surely if the point of the exercise is to show how self-reference is generated, then one shouldn’t fudge the crucial step in the process? When you fail to address the crucial point of how the formal system supposedly includes the Gödel numbering function within itself, your account is not an explanation at all. There seems to be little point in going into fine detail in the previous sections if you are simply going to fudge a crucial detail later on.