Famous Theorems of Mathematics/Logic

Gödel's completeness theorem
In the following, we state two equivalent forms of the theorem, and show their equivalence.

Later, we prove the theorem. This is done in the following steps:


 * 1) Reducing the theorem to sentences (formulas with no free variables) in prenex form, i.e. with all quantifiers ($$\forall$$ and $$\exists$$) at the beginning. Furthermore, we reduce it to formulas whose first quantifier is $$\forall$$. This is possible because for every sentence, there is an equivalent one in prenex form whose first quantifier is $$\forall$$.
 * 2) Reducing the theorem to sentences of the form $$\forall x_1 \forall x_2 ... \forall x_k \exists y_1 \exists y_2... \exists y_m \phi(x_1...x_k, y_1...y_m)$$. While we cannot do this by simply rearranging the quantifiers, we show that it is yet enough to prove the theorem for sentences of that form.
 * 3) Finally we prove the theorem for sentences of that form.
 * 4) * This is done by first noting that a sentence such as $$B = \exists x_1 \exists x_2 ... \exists x_k \exists y_1 \exists y_2... \exists y_m \phi(x_1...x_k, y_1...y_m)$$ is either refutable or has some model in which it holds; this model is simply assigning truth values to the subpropositions from which B is built of. The reason for that is the completeness of propositional logic, with the existential quantifiers playing no role.
 * 5) * We extend this result to more and more complex and lengthy sentences, Dn (n=1,2...), built out from B, so that either any of them is refutable and therefore so is &phi;, or all of them are not refutable and therefore each holds in some model.
 * 6) * We finally use the models in which the Dn hold (in case all are not refutable) in order to build a model in which &phi; holds.

Theorem 1. Every formula valid in all structures is provable.

This is the most basic form of the completeness theorem. We immediately restate it in a form more convenient for our purposes:

Theorem 2. Every formula &phi; is either refutable or satisfiable in some structure.

"&phi; is refutable" means by definition "¬&phi; is provable".

Equivalence of both theorems
To see the equivalence, note first that if Theorem 1 holds, and &phi; is not satisfiable in any structure, then ¬&phi; is valid in all structures and therefore provable, thus &phi; is refutable and Theorem 2 holds. If on the other hand Theorem 2 holds and &phi; is valid in all structures, then ¬&phi; is not satisfiable in any structure and therefore refutable; then ¬¬&phi; is provable and then so is &phi;, thus Theorem 1 holds.

Proof of theorem 2: first step
We approach the proof of Theorem 2 by successively restricting the class of all formulas &phi; for which we need to prove "&phi; is either refutable or satisfiable". At the beginning we need to prove this for all possible formulas &phi; in our language. However, suppose that for every formula &phi; there is some formula &psi; taken from a more restricted class of formulas C, such that "&psi; is either refutable or satisfiable" &rarr; "&phi; is either refutable or satisfiable". Then, once this claim (expressed in the previous sentence) is proved, it will suffice to prove "&phi; is either refutable or satisfiable" only for &phi;'s belonging to the class C. Note also that if &phi; is provably equivalent to &psi; (i.e., (&phi;&equiv;&psi;) is provable), then it is indeed the case that "&psi; is either refutable or satisfiable" &rarr; "&phi; is either refutable or satisfiable" (the soundness theorem is needed to show this).

There are standard techniques for rewriting an arbitrary formula into one which does not use function or constant symbols, at the cost of introducing additional quantifiers; we will therefore assume that all formulas are free of such symbols. In Gödel's paper, he uses a version of first-order predicate calculus which has no function or constant symbols to begin with.

Next we consider a generic formula &phi; (which no longer uses function or constant symbols) and apply the prenex form theorem to find a formula &psi; in normal form such that &phi;&equiv;&psi; (&psi; being in normal form means that all the quantifiers in &psi;, if there are any, are found at the very beginning of &psi;). It follows now that we need only prove Theorem 2 for formulas &phi; in normal form.

Next, we eliminate all free variables from &phi; by quantifying them existentially: if, say, x1...xn are free in &phi;, we form $$\psi=\exists x_1 ... \exists x_n \phi$$. If &psi; is satisfiable in a structure M, then certainly so is &phi; and if &psi; is refutable, then $$\neg \psi = \forall x_1 ... \forall x_n \neg \phi$$ is provable, and then so is ¬&phi;, thus &phi; is refutable. We see that we can restrict &phi; to be a sentence, that is, a formula with no free variables.

Finally, we would like, for reasons of technical convenience, that the prefix of &phi; (that is, the string of quantifiers at the beginning of &phi;, which is in normal form) begin with a universal quantifier and end with an existential quantifier. To achieve this for a generic &phi; (subject to restrictions we have already proved), we take some one-place relation symbol F unused in &phi;, and two new variables y and z.. If &phi; = (P)&Phi;, where (P) stands for the prefix of &phi; and &Phi; for the matrix (the remaining, quantifier-free part of &phi;) we form $$\psi = \forall y (P) \exists z ( \Phi \wedge [ F(y) \vee \neg F(z) ] )$$. Since $$\forall y \exists z ( F(y) \vee \neg F(z) )$$ is clearly provable, it is easy to see that $$\phi=\psi$$ is provable.

Reducing the theorem to formulas of degree 1
Our generic formula &phi; now is a sentence, in normal form, and its prefix starts with a universal quantifier and ends with an existential quantifier. Let us call the class of all such formulas R. We are faced with proving that every formula in R is either refutable or satisfiable. Given our formula &phi;, we group strings of quantifiers of one kind together in blocks:


 * $$\phi = (\forall x_1 ... \forall x_{k_1})(\exists x_{k_1+1} ... \exists x_{k_2}).......(\forall x_{k_{n-2}+1} ... \forall x_{k_{n-1}})(\exists x_{k_{n-1}+1} ... \exists x_{k_n}) (\Phi)$$

We define the degree of $$\phi$$ to be the number of universal quantifier blocks, separated by existential quantifier blocks as shown above, in the matrix of $$\phi$$. The following lemma, which Gödel adapted from Skolem's proof of the Löwenheim-Skolem theorem, lets us sharply reduce the complexity of the generic formula $$\phi$$ for which we need to prove the theorem:

Lemma. Let k>=1. If every formula in R of degree k is either refutable or satisfiable, then so is every formula in R of degree k+1.


 * Comment: Take a formula &phi; of degree k+1 of the form $$\phi = (\forall x)(\exists y)(\forall u)(\exist v) (P) \psi$$, where $$(P)\psi$$ is the remainder of $$\phi$$ (it is thus of degree k-1). &phi; states that for every x there is a y such that... (something). It would have been nice to have a predicate Q'  so that for every x, Q'(x,y) would be true if and only if y is the required one to make (something) true. Then we could have written a formula of degree k which is equivalent to &phi;, namely $$(\forall x')(\forall x)(\forall y)(\forall u)(\exist v)(\exist y') (P) Q'(x',y') \wedge (Q'(x,y) \rightarrow \psi)$$. This formula is indeed equivalent to &phi; because it states that for every x, if there is a y which satisfies Q'(x,y), then (something) holds, and furthermore, we know that there is such a y, because for every x', there is a y' which satisfies Q'(x',y'). Therefore &phi; follows from this formula. It is also easy to show that if the formula is false, then so is &phi;. Unfortunately, in general there is no such predicate Q'. However, this idea can be understood as a basis for the following proof of the Lemma.

Proof. Let &phi; be a formula of degree k+1; then we can write it as


 * $$\phi = (\forall x)(\exists y)(\forall u)(\exist v) (P) \psi$$

where (P) is the remainder of the prefix of $$\phi$$ (it is thus of degree k-1) and $$\psi$$ is the quantifier-free matrix of $$\phi$$. x, y, u and v denote here tuples of variables rather than single variables; e.g. $$(\forall x)$$ really stands for $$\forall x_1 \forall x_2 ... \forall x_n$$ where $$x_1 ... x_n$$ are some distinct variables.

Let now x' and y' be tuples of previously unused variables of the same length as x and y respectively, and let Q be a previously unused relation symbol which takes as many arguments as the sum of lengths of x and y; we consider the formula


 * $$\Phi = (\forall x')(\exists y') Q(x',y') \wedge (\forall x)(\forall y)( Q(x,y) \rightarrow (\forall u)(\exist v)(P)\psi )$$

Clearly, $$\Phi \rightarrow \phi$$ is provable.

Now since the string of quantifiers $$(\forall u)(\exists v)(P)$$ does not contain variables from x or y, the following equivalence is easily provable with the help of whatever formalism we're using:


 * $$( Q(x,y) \rightarrow (\forall u )(\exists v)(P) \psi) \equiv (\forall u)(\exists v)(P) ( Q(x,y) \rightarrow \psi )$$

And since these two formulas are equivalent, if we replace the first with the second inside &Phi;, we obtain the formula &Phi;' such that &Phi;&equiv;&Phi;':


 * $$\Phi' = (\forall x')(\exist y') Q(x',y') \wedge (\forall x)(\forall y) (\forall u)(\exists v)(P) ( Q(x,y) \rightarrow \psi )$$

Now &Phi;' has the form $$(S)\rho \wedge (S')\rho'$$, where (S) and (S') are some quantifier strings, &rho; and &rho;' are quantifier-free, and, furthermore, no variable of (S) occurs in &rho;' and no variable of (S') occurs in &rho;. Under such conditions every formula of the form $$(T)(\rho \wedge \rho')$$, where (T) is a string of quantifiers containing all quantifiers in (S) and (S') interleaved among themselves in any fashion, but maintaining the relative order inside (S) and (S'), will be equivalent to the original formula &Phi;'(this is yet another basic result in first-order predicate calculus that we rely on). To wit, we form &Psi; as follows:
 * $$\Psi = (\forall x')(\forall x)(\forall y) (\forall u)(\exists y')(\exists v)(P)Q(x',y') \wedge (Q(x,y) \rightarrow \psi )$$

and we have $$\Phi' \equiv \Psi$$.

Now $$\Psi$$ is a formula of degree k and therefore by assumption either refutable or satisfiable. If $$\Psi$$ is satisfiable in a structure M, then, considering $$\Psi \equiv \Phi' \equiv \Phi \wedge \Phi \rightarrow \phi$$, we see that $$\phi$$ is satisfiable as well. If $$\Psi$$ is refutable, then so is $$\Phi$$ which is equivalent to it; thus $$\neg \Phi$$ is provable. Now we can replace all occurrences of Q inside the provable formula $$\neg \Phi$$ by some other formula dependent on the same variables, and we will still get a provable formula. (This is yet another basic result of first-order predicate calculus. Depending on the particular formalism adopted for the calculus, it may be seen as a simple application of a "functional substitution" rule of inference, as in Gödel's paper, or it may be proved by considering the formal proof of $$\neg \Phi$$, replacing in it all occurrences of Q by some other formula with the same free variables, and noting that all logical axioms in the formal proof remain logical axioms after the substitution, and all rules of inference still apply in the same way.)

In this particular case, we replace Q(x',y') in $$\neg \Phi$$ with the formula $$(\forall u)(\exists v)(P)\psi(x,y|x',y')$$. Here (x,y|x',y') means that instead of &psi; we are writing a different formula, in which x and y are replaced with x' and y'. Note that Q(x,y) is simply replaced by $$(\forall u)(\exists v)(P)\psi$$.

$$\neg \Phi$$ then becomes


 * $$\neg ( (\forall x')(\exists y') (\forall u)(\exists v)(P)\psi(x,y|x',y') \wedge (\forall x)(\forall y) ( (\forall u)(\exists v)(P)\psi \rightarrow (\forall u)(\exists v)(P) \psi ) )$$

and this formula is provable; since the part under negation and after the $$\wedge$$ sign is obviously provable, and the part under negation and before the $$\wedge$$ sign is obviously &phi;, just with x and y replaced by x' and y', we see that $$\neg \phi$$ is provable, and &phi; is refutable. We have proved that &phi; is either satisfiable or refutable, and this concludes the proof of the Lemma.

Notice that we could not have used $$(\forall u)(\exists v)(P)\psi(x,y|x',y')$$ instead of Q(x',y') from the beginning, because $$\Psi$$ would not have been a well-formed formula in that case. This is why we cannot naively use the argument appearing at the comment which precedes the proof.

Proving the theorem for formulas of degree 1
As shown by the Lemma above, we only need to prove our theorem for formulas &phi; in R of degree 1. &phi; cannot be of degree 0, since formulas in R have no free variables and don't use constant symbols. So the formula &phi; has the general form:


 * $$ (\forall x_1...x_k)(\exists y_1...y_m) \phi(x_1...x_k, y_1...y_m) $$

Now we define an ordering of the k-tuples of natural numbers as follows: $$ (x_1...x_k) < (y_1...y_k) $$ should hold if either $$ \Sigma_k (x_1...x_k) < \Sigma_k (y_1...y_k) $$, or $$ \Sigma_k (x_1...x_k) = \Sigma_k (y_1...y_k) $$, and $$ (x_1...x_k) $$ precedes $$ (y_1...y_k) $$ in lexicographic order. [Here $$ \Sigma_k (x_1...x_k) $$ denotes the sum of the terms of the tuple.] Denote the nth tuple in this order by $$ (a^n_1...a^n_k) $$.

Set the formula $$ B_n $$ as $$ \phi(z_{a^n_1}...z_{a^n_k}, z_{(n-1)m+2}, z_{(n-1)m+3}...z_{nm+1}) $$. Then put $$D_n$$ as
 * $$ (\exists z_1...z_{nm+1}) (B_1 \wedge B_2 ... \wedge B_n) $$

Lemma: For every n, $$ \phi \rightarrow D_n$$.

Proof: By induction on n; we have $$ D_k \equiv D_{k-1} \wedge (\exists z_1...z_{nm+1}) B_n \equiv D_{k-1} \wedge (\exists z_{a^n_1}...z_{a^n_k})(\exists y_1...y_m) \phi(z_{a^n_1}...z_{a^n_k}, y_1...y_m) $$, where the latter equivalence holds by variable substitution, since the ordering of the tuples is such that $$(\forall k)({a^n_1}...{a^n_k}) < (n-1)m + 2$$. Each conjunct here obviously follows from &phi;.

For the base case, $$ D_1 \equiv (\exists z_1...z_{m+1}) \phi(z_{a^1_1}...z_{a^1_k}, z_2, z_3...z_{m+1}) \equiv (\exists z_1...z_{m+1}) \phi(z_1...z_1, z_2, z_3...z_{m+1}) $$ is obviously a corollary of &phi; as well. So the Lemma is proven.

Now if $$ D_n $$ is refutable for some n, it follows that &phi; is refutable. On the other hand, suppose that $$ D_n $$ is not refutable for any n. Then for each n there is some way of assigning truth values to the distinct subpropositions $$E_h$$ (ordered by their first appearance in $$D_n$$; "distinct" here means either distinct predicates, or distinct bound variables) in $$ B_k $$, such that $$ B_k $$ will be true when each proposition is evaluated in this fashion. This follows from the completeness of the underlying propositional logic.

We will now show that there is such an assignment of truth values to $$E_h$$, so that all $$D_n$$ will be true: The $$E_h$$ appear in the same order in every $$ D_n $$; we will inductively define a general assignment to them by a sort of "majority vote": Since there are infinitely many assignments affecting $$E_1$$, either infinitely many make $$E_1$$ true, or infinitely many make it false and only finitely many make it true. In the former case, we choose $$E_1$$ to be true in general; in the latter we take it to be false in general. Then from the infinitely many n for which $$E_1 through E_{h-1}$$ are assigned the same truth value as in the general assignment, we pick a general assignment to $$E_h$$ in the same fashion.

This general assignment must lead to every one of the $$B_k$$ and $$D_k$$ being true, since if one of the $$B_k$$ were false under the general assignment, $$D_n$$ would also be false for every n > k. But this contradicts the fact that for the finite collection of general $$E_h$$ assignments appearing in $$D_k$$, there are infinitely many n where the assignment making $$D_n$$ true matches the general assignment.

Now from this general assignment which makes all of the $$D_k$$ true, we construct an interpretation of the language's predicates which makes &phi; true. The universe of the model will be the natural numbers. Each i-ary predicate $$\Psi$$ should be true of the naturals $$(u_1...u_i)$$ precisely when the proposition $$\Psi(z_{u_1}...z_{u_i})$$ is either true in the general assignment, or not assigned by it (because it never appears in any of the $$D_k$$).

In this model, each of the formulas $$ (\exists y_1...y_m) \phi(a^n_1...a^n_k, y_1...y_m) $$, is true by construction. But this implies that &phi; itself is true in the model, since the $$a^n$$ range over all possible k-tuples of natural numbers. So &phi; is satisfiable, and we are done.

Intuitive explanation
We may write each Bi as &Phi;(x1...xk,y1...ym) for some x-s which we may call "first arguments" and y-s which we may call "last arguments".

Take B1 for example. Its "last arguments" are z2,z3...zm+1, and for every possible combination of k of these variables there is some j so that they appear as "first arguments" in Bj. Thus for large enough n1, Dn 1 has the property that the "last arguments" of B1 appear, in every possible combinations of k of them, as "first arguments" in other Bj-s within Dn. For every Bi there is a Dn i with the corresponding property.

Therefore in a model which satisfies all the Dn-s, there are objects corresponding to z1, z2... and each combination of k of these appear as "first arguments" in some Bj, meaning that for every k of these objects zp 1 ...zp k there are zq 1 ...zq m which makes &Phi;(zp 1 ...zp k ,zq 1 ...zq m ) satisfied. By taking a submodel which contains only these z1, z2... objects, we have a model satisfying &phi;.

Gödel's incompleteness theorems
First Theorem: For any consistent formal, computably enumerable theory that proves basic arithmetical truths, an arithmetical statement that is true, but not provable in the theory, can be constructed. That is, any effectively generated theory capable of expressing elementary arithmetic cannot be both consistent and complete.

Second Theorem: For any formal recursively enumerable (i.e. effectively generated) theory T including basic arithmetical truths and also certain truths about formal provability, T includes a statement of its own consistency if and only if T is inconsistent.

Modern Proof
Assuming that a computer exists, and that formal logic can be represented as a computer program, it is easy to prove Gödel's incompleteness theorem from basic lemmas in computer science.

1. The Quine lemma—any computer program can include a subroutine that prints out the entire program's code. This allows any program to write itself into a string variable, or a large enough bigint.
 * proof: Let the printing subroutine be a standard quine, with additional data that contains all the rest of the code.

2. The Halting lemma: There does not exist a computer program PREDICT(P) which takes the code to program P and predicts whether P eventually halts.
 * proof: Write program SPITE, which prints itself into variable R, then calculates PREDICT(R). If the answer is R halts, Spite goes into an infinite loop. If the answer is R does not halt, SPITE halts. Since R is really SPITE in disguise, no matter what PREDICT says, the answer is wrong.

The incompleteness theorem: Suppose that an axiom system describes integers (or any other discrete structure), and that it has enough operations (addition and multiplication are sufficient) to describe the working of a computer. Then this system is either inconsistent or incomplete.


 * proof: Write DEDUCE to deduce all consequences of the axiom system. Let DEDUCE print its own code into the variable R, and search for the theorem R never halts, in the embedding of a computer inside the system. Only if DEDUCE finds this theorem does it halt.


 * If the axiom system proves that DEDUCE doesn't halt, it is inconsistent. If the system is consistent, DEDUCE doesn't halt and the axioms cannot prove it.


 * This argument doesn't explicitly demonstrate the incompleteness, because a consistent axiom system could still prove the $\omega$-inconsistent theorem that DEDUCE halts (even though it doesn't) without contradiction.


 * So write ROSSER: ROSSER prints its code into R, and searches deductions for either 1. R prints something out or 2. R never prints anything out. If it finds 1, it halts without printing anything. If it finds 2, It prints "Hello World!" to the screen and halts.


 * If the axiom system is consistent, it cannot prove either ROSSER eventually prints something nor the negation ROSSER does not print anything. So whatever its conclusions about DEDUCE, the axiom system is incomplete.

To prove the second incompleteness theorem, note that the consistency of the axioms proves that DEDUCE does not halt, so the axiom system cannot prove its own consistency.