Computation Club: Gödel’s theorem The big picture ● ● ● ●
mathematicians do a lot of reasoning and write a lot of proofs formal systems try to capture the ideas of “reasoning” and “proof” in a purely mechanical set of rules that operate on strings we would like to have a formal system that can “reason about” any mathematical idea, and is always able to “prove it” if it’s true but Kurt Gödel discovered that this is impossible, even if we restrict ourselves to very simple mathematical ideas
The main pieces This chapter is about formal systems , which are a way of generating strings. A formal system consists of: ● a syntax for the strings it can generate (“formulas”); ● some rules for generating new strings from old ones; and ● some builtin strings to get us started (“axioms”). We normally have a way of interpreting the meaning of a string generated by a formal system. Without an interpretation, a string is just a meaningless sequence of symbols. Some formal systems are complete : for every string with a true meaning, there is always some way of generating that string by starting with the builtin strings and repeatedly applying the rules (“every true formula can be proved mechanically”). Vice versa is called sound . In 1900, David Hilbert asked: How do we design a complete formal system for all of mathematics? That is: what are the syntax, rules and builtin strings of a system that can generate all true mathematical statements? For philosophical reasons, most people assumed that this formal system was complicated but feasible. In 1936, Kurt Gödel answered: ● If we did design a formal system for all of mathematics, is it even possible for it to be complete? No . ● If instead we designed a much simpler formal system for very basic arithmetic, is it possible for that to be complete? No . This was very upsetting.
Previously on Computation Club: Predicate calculus In Chapter 58 we learned about the predicate calculus, which is one kind of formal system.
Syntax Terms : constants, variables, functions on terms Formulas : predicates on terms (“atomic formula”), ∧ (“and”), ∨ (“or”), → (“implies”), ¬ (“not”), ∀ (“for all”), ∃ (“there exists”)
Semantics ● ● ●
●
The logical connectives (∧, ∨, →, ¬) have a builtin meaning (standard truth tables) The quantifiers (∀, ∃) have a builtin meaning too The other symbols don’t mean anything by themselves ○ e.g. we can’t say whether the formula “∀x(∀y(P(x, f(y))))” is true or false, because it depends what “P” and “f” mean We need an interpretation to give meaning to the predicates and functions ○ interpretation = a “universe” of values + an interpretation function ○ the interpretation function maps predicates onto relations (i.e. booleanvalued functions) on U, functions onto functions in U > U ○ think of the interpretation function as “the method definitions” for the predicate and function names: each predicate is implemented as a method that returns booleans, each function is implemented as a method that returns values
Previously on Computation Club: river puzzle In Chapter 58, we saw how to use the predicate calculus to build a formal system for reasoning about a puzzle: a man transferring a wolf, a goat and a cabbage across a river. The syntax for this formal system is given by the predicate calculus description above. The predicates are E(x, y), which means “equals”, and P(m, w, g, c), which means that the m an, the w olf, the g oat and the c abbage can safely reach a particular configuration (with the symbol 0 representing the near side of the river, and the symbol 1 representing the far side). The only function is f, which represents crossing the river; our interpretation says that f(0) = 1 and f(1) = 0. The builtin strings (“axioms”) for this formal system are: 1. E(x, x) x equals x 2. ¬E(x, f(x)) x does not equal f(x)
3. 4. 5. 6. 7.
P(x, x, y, z) ∧ ¬E(y, z) → P(f(x), f(x), y, z) P(x, y, x, z) → P(f(x), y, f(x), z) P(x, y, z, x) ∧ ¬E(y, z) → P(f(x), y, z, f(x)) P(x, y, x, y) ∧ ¬E(x, y) → P(f(x), y, x, y) P(0, 0, 0, 0)
if goat opposite cabbage, man & wolf cross man & goat cross if wolf opposite goat, man & cabbage cross if man & goat opposite wolf & cabbage, man cross everything on the near bank
The rules for this formal system are traditional rules of logic: De Morgan’s laws, implication introduction/elimination, Skolemization, substitution, resolution. These can all be written as mechanical rules about symbol manipulation; for example, De Morgan’s laws for ∧ and ∨: 1. if we’ve generated ¬( X ∧ Y ), then we can also generate (¬ X ∨ ¬ Y ) 2. if we’ve generated (¬ X ∨ ~ Y ), then we can also generate ¬( X ∧ Y ) 3. if we’ve generated ¬( X ∨ Y ), then we can also generate (¬ X ∧ ¬ Y ) 4. if we’ve generated (¬ X ∧ ¬ Y ), then we can also generate ¬( X ∨ Y ) By applying all of these rules mechanically in our meeting, we managed to generate these strings: ● P(1, 0, 1, 0) man and goat on the far bank ● P(0, 0, 1, 0) goat on the far bank These strings tell us that it’s possible for the man to cross the river with the goat and then come back again. If we’d carried on, we’d eventually have generated P(1, 1, 1, 1), and shown that it was possible for the man to get to the other side with all of the objects. This formal system is both complete and sound : it can generate every true string, and all the strings it generates are true. That means it can generate every possible arrangement of objects where the goat and cabbage are safe, and all the arrangements it generates are possible and keep the goat and cabbage safe.
Basic arithmetic The formal system used in the river puzzle is not powerful enough to do arithmetic: it has no representation of numbers (the 0 and 1 are really just “near” and “far”) or operations on them. By choosing a different set of builtin strings and rules, we can perform operations like “add two numbers together” or “multiply two numbers together” instead of “carry a cabbage across the river”. A formal system for doing mathematics needs one set of builtin strings to represent logical reasoning, and another set to represent numbers. It has rules that support implication and induction. (See the chapter for all of these.)
The details aren’t important. What matters is that we can use these builtin strings and rules to generate new strings that represent true statements about numbers. For example, we can use them to generate the new string s0 + s0 = ss0 (i.e. prove that 1 + 1 = 2): 1. axiom: ∀x(∀y(x + sy = s(x + y))) 2. axiom: ∀x(F(x)) → F(y) , if y is not quantified when substituted 3. from 1 and 2: ∀x(∀y(x + sy = s(x + y))) → ∀y(s0 + sy = s(s0 + y)) ○ taking F(x) to be ∀y(x + sy = s(x + y)) ○ substituting s0 for x 4. rule: if we’ve generated F and F → G, then we can also generate G 5. from 1, 3, 4: ∀y(s0 + sy = s(s0 + y)) ○ taking F to be ∀x(∀y(x + sy = s(x + y))) ○ taking G to be ∀y(s0 + sy = s(s0 + y)) 6. from 5 and 2: ∀y(s0 + sy = s(s0 + y)) → s0 + s0 = s(s0 + 0) ○ taking F(x) to be ∀y(s0 + sy = s(s0 + y)) ○ substituting 0 for x 7. from 5, 6, 4: s0 + s0 = s(s0 + 0) ○ taking F to be ∀y(s0 + sy = s(s0 + y)) ○ taking G to be s0 + s0 = s(s0 + 0) 8. axiom: ∀x(x + 0 = x) 9. from 8 and 2: ∀x(x + 0 = x) → s0 + 0 = s0 ○ taking F(x) to be x + 0 = x ○ substituting s0 for x 10. from 4, 8, 9: s0 + 0 = s0 ○ taking F to be ∀x(x + 0 = x) ○ taking G to be s0 + 0 = s0 11. axiom: ∀x(∀y(x = y → (A(x, x) → A(x, y)))) 12. from 11 and 2: ∀y(s0 + 0 = y → (s0 + s0 = s(s0 + 0) → s0 + s0 = sy)) ○ taking A(x, y) to be s0 + s0 = sy ○ taking F(x) to be ∀y(x = y → (s0 + s0 = sx → s0 + s0 = sy)) ○ substituting s0 + 0 for x 13. from 12 and 2: s0 + 0 = s0 → (s0 + s0 = s(s0 + 0) → s0 + s0 = ss0) ○ taking F(x) to be s0 + 0 = y → (s0 + s0 = s(s0 + 0) → s0 + s0 = sy) ○ substituting s0 for x 14. from 10, 13, 4: s0 + s0 = s(s0 + 0) → s0 + s0 = ss0 ○ taking F to be s0 + 0 = s0 ○ taking G to be s0 + s0 = s(s0 + 0) → s0 + s0 = ss0 15. from 7, 14, 4: s0 + s0 = ss0 ○ taking F to be s0 + s0 = s(s0 + 0) ○ taking G to be s0 + s0 = ss0
Gödel numbering All strings in a formal system are just sequences of symbols, and those symbols are drawn from a finite selection. We can assign each symbol a code number, and use those numbers to give every possible string a unique code, called its Gödel number. By a similar technique, we can also represent a list of strings as a number.
Gödel’s theorem ● ● ● ● ● ●
●
● ● ● ●
●
we have a formal system that can generate strings which represent statements in basic arithmetic every string can be represented by a Gödel number every list of strings can be represented by a Gödel number if a list of strings can be generated by following the rules of the formal system, than that list serves as a proof that its final element can be generated every rule of a formal system is completely mechanical, and can be expressed in terms of basic arithmetic operations on Gödel numbers it is possible (but very complicated) to use basic arithmetic operations to check whether: ○ a Gödel number represents a list of strings ○ that list of strings can be generated by following the rules of the formal system it is possible (but very complicated) to write a string which uses basic arithmetic to say: ○ take three variables: x, y and z ○ x is the Gödel number of a list of strings ○ that list of strings can be generated by following the rules of the formal system ○ y is the Gödel number of a string with one free variable ○ when the value of z is substituted into the string represented by y in place of its free variable, the resulting string is the final element in the list represented by x as a shorthand, call that huge string Proof(x, y, z) Proof(x, y, z) means “x is the Gödel number of a proof of the string represented by y (with its free variable replaced by the number z)” Proof(x, y, z) has its own Gödel number Proof(x, y, z) is a string, so ¬∃x(Proof(x, y, y)) is also (syntactically) a string ○ ¬∃x(Proof(x, y, y)) is a modified version of Proof(x, y, z) where the first variable has been quantified and the other two have been made the same ○ ¬∃x(Proof(x, y, y)) has one free variable ○ ¬∃x(Proof(x, y, y)) means “no proof exists of the string represented by y (with its free variable replaced by the number y)” ¬∃x(Proof(x, y, y)) has its own Gödel number — pretend it’s 123 (although in the usual Gödel numbering scheme it would actually be something much larger! the book calls this number “g”)
●
● ●
● ●
if we replace the free variable in ¬∃x(Proof(x, y, y)) with 123, we get ¬∃x(Proof(x, 123, 123)) ○ ¬∃x(Proof(x, 123, 123)) means “no proof exists of the string represented by 123 (with its free variable replaced by the number 123)” ○ in other words, it means “no proof of ¬∃x(Proof(x, 123, 123)) exists”, i.e. “this string cannot be proven” Gödel’s theorem: ¬∃x(Proof(x, 123, 123)) is true but has no proof in the formal system why? a proof by contradiction: ○ assume the contrary, that ¬∃x(Proof(x, 123, 123)) has a proof ○ that means ¬∃x(Proof(x, 123, 123)) is the final element of a list of strings that can be generated by following the rules of the formal system ○ that list of strings has a Gödel number — say it’s 456 (again, in the normal system it would be something much larger! the book calls this number “p”) ○ if 456 is the Gödel number of a proof of ¬∃x(Proof(x, 123, 123)), then Proof(456, 123, 123) must be true: ■ Proof(456, 123, 123) means “456 is the Gödel number of a proof of the string represented by 123 (with its free variable replaced by the number 123)” ■ the string represented by 123 is ¬∃x(Proof(x, y, y)) ■ if we replace the free variable in ¬∃x(Proof(x, y, y)) with 123, we get ¬∃x(Proof(x, 123, 123)) ○ so a proof does exist of the string represented by 123 (with its free variable replaced by the number 123) ■ that proof is the list of strings represented by 456 ○ but ¬∃x(Proof(x, 123, 123)) means “no proof exists of the string represented by 123 (with its free variable replaced by the number 123)” ○ and that’s a contradiction, so this hypothetical proof represented by 456 can’t exist ¬∃x(Proof(x, 123, 123)) claims it cannot be proven, which is true so ¬∃x(Proof(x, 123, 123)) is a true string that can’t be proved by the formal system