Source Theories

A signature is a (finite or infinite) set of predicate and function symbols. We fix a signature S. “Formula” means now “formula over the signature S”. A theory is a set of formulas T closed under consequence, i.e., if F ,...,F T and F ,...,F = G then G T . G.S. Boolos, J.P. Burgess, R.C Jeffrey: 1 n ∈ { 1 n} | ∈ Computability and . Cambridge University Press 2002. Fact: Let be a structure suitable for S. The set F of formulas such A that (F )=1 is a theory. A We call them model-based theories. Fact: Let be a set of closed formulas. The set F of formulas such F that = F is a theory. F |

1 2 The signature of arithmetic Decidability, , , . . .

The signature SA of arithmetic contains: A set of formulas is decidable if there is an that decides F a constant 0, for every formula F whether F holds. • ∈ F a unary function symbol s, • Let T be a theory. two binary function symbols + and , and • · T is decidable if it is decidable as a set of formulas. a binary predicate symbol <. • T is consistent if for every closed formula F either F / T or F / T . ∈ ¬ ∈ (slight change over previous definitions) T is complete if for every closed formula F either F T or F T . ∈ ¬ ∈ Arith is the theory containing the set of closed formulas over SA T is (finitely) axiomatizable if there is a (finite) decidable set T X ⊆ that are true in the canonical structure. of axioms such that every closed formula of T is a consequence of . X Arith contains “all the theorems of calculus”.

3 4 Conventions and notation Basic facts

Fact: Every theory contains all valid formulas (because they are consequences of the empty set).

Fact: Model-based theories (like Arith) are consistent and complete. In the following: set of axioms = decidable set of formulas over SA

T denotes the theory of all closed formulas that are consequences of Fact: T is consistent iff there is a formula F such that F / T . X ∈ a set of axioms. Proof: If T is consistent then F / T for some F by definition. ∈ X If T is inconsistent, then there exists a formula F such that F T ∈ and F T . Let G be an arbitrary closed formula. Since F, F = G ¬ ∈ ¬ | and T is closed under consequence, we have G T . ∈

5 6 Basic facts

Lemma: If T is axiomatizable and complete, then T is decidable. If algorithm answers “F T ”, then F T . • ∈ ∈ Proof: If T inconsistent then T contains all closed formulas, and the If algorithm answers “F T ”, then F is syntactic consequence, ∈ algorithm that answers “F T ” for every input F decides T . and so consequence of the axioms. Since T is a theory, F T . ∈ ∈ If T consistent, let consider the following algorithm: If algorithm answers “F / T ”, then F / T . • ∈ ∈ Input: F If algorithm answers “F T ”, then F is consequence of the • ∈ ¬ Enumerate all syntactic consequences of the axioms of T , and axioms and so F T . By consistency, F / T . ¬ ∈ ∈ for each new syntactic consequence G do: The algorithm terminates. • If G = F halt with “F T ” Since T is complete, either F T or F T . − ∈ ∈ ¬ ∈ If G = F halt with “F / T ” Assume w.l.og. F T . − ¬ ∈ ∈ Observe: the syntactic consequences of the axioms can be Since T is axiomatizable, F is a consequence of the axioms. enumerated. So F is a syntactic consequence of the axioms. We prove this algorithm is correct: So eventually G := F and the algorithm terminates.

7 8 Basic facts G¨odel’s first incompleteness theorem

Theorem: Let be any set of axioms such that Arith. Theorem: Arith is undecidable. X X ⊆ Then the theory T is incomplete. Proof: By reduction from the halting problem, similar to X undecidability proof for of predicate logic. Proof: Since Arith is not axiomatizable, there is a formula F Arith such that = F and so F / T . ∈ X 6| ∈ X Theorem: Arith is not axiomatizable. Assume now F T . Then = F and since Arith we get ¬ ∈ X X | ¬ X ⊆ Proof: Since Arith is undecidable, consistent, and complete, it is not F Arith, contradicting F Arith. ¬ ∈ ∈ axiomatizable (see Lemma). So F / T and F / T , which proves that T is incomplete. ∈ X ¬ ∈ X X

9 10 G¨odel’s first incompleteness theorem Minimal arithmetic

Minimal arithmetic Q is the axiom-based theory over SA having the following axioms: Observe: F Arith, i.e., F is true in the canonical structure, but its ∈ truth cannot be proved using any set of axioms (unless some (Q1) x (0 = s(x)) X ∀ ¬ axiom is itself not true!) (Q2) x y s(x) = s(y) x = y ∀ ∀ → (Q3) x x + 0 = x In other words: for every set of true axioms, there are true formulas ∀ that cannot be deduced from the axioms (Q4) x y x + s(y) = s(x + y) ∀ ∀ (Q5) x x 0=0 But we have no idea how such formulas look like ... ∀ · (Q6) x y x s(y) = (x y) + x ∀ ∀ · · Goal: given a set of axioms Arith, construct a formula (Q7) x (x < 0) X ⊆ ∀ ¬ F Arith such that F / T (Q8) x y x

11 12 Peano arithmetic Some theorems of Q (and P)

Peano arithmetic P is the axiom-based theory over SA having Q1-Q9 (0 = sn(0)) for every n 1 as axioms plus all closed formulas of the form ¬ ≥ (sn(0) = sm(0)) for every n, m 1, n = m (I) y F (0, y) x ( F (x, y) F (s(x), y)) ¬ ≥ 6 ∀ ∧ ∀ → x x < 1 x =0 → ∀ ↔ x F (x, y) x x

13 14 G¨odel encodings G¨odel encodings

Example (Wikipedia): the formula

x = y y = x A G¨odel encoding is an injective function that maps every formula → over SA to a natural number called its G¨odel number. written in ASCII as x=y => y=x Simple G¨odel encoding: assign to each symbol of the formula its ASCII code, assign to a formula the concatenation of the ASCII codes corresponds to the sequence of its symbols. 120-061-121-032-061-062-032-121-061-120 of ASCII codes, and so it is assigned the number 120061121032061062032121061120

15 16 G¨odel’s G¨odel encoding What are G¨odel encodings good for?

A formula F (x) over SA with a free variable x defines a property of numbers: the property satisfied exactly by the numbers n such that Let pn denote the n-th prime number. F (sn(0)) is true in the canonical structure. G¨odel’s encoding assigns to each symbol λ a number g(λ), and to a We can easily construct formulas Even(x), Prime(x), sequence λ1 λn of symbols the number Power of two(x) . . . · · · Via the encoding formulas “are” numbers, and so a formula also 2g(λ1) 3g(λ2) 5g(λ3) . . . pg(λn) · · · · n defines a property of formulas! numbers formulas → formula F (x) set of numbers set of formulas → →

17 18 Going further . . . And even further . . .

We can construct (even less easily) a formula We can (less easily) construct formulas like In Q(x) • First symbol is (x) that is true i.t.c.s. for x = sn(0) iff the number n encodes a closed • ∀ At least ten symbols(x) formula F such that F Q. • ∈ Closed(x) The reason is • . . . F Q iff Q1, ..., Q9 = F iff Q1, ..., Q9 F • ∈ | ⊢ that are true i.t.c.s. for x := sn(0) iff the number n encodes a and the derivation procedure amounts to symbol manipulation. formula and the formula satisfies the corresponding property. Same for any other set of axioms. X

19 20 Diagonal Lemma Reaching the goal

Recall our goal: Given a set of axioms Arith, construct a X ⊆ formula F Arith such that F / T ∈ ∈ X Theorem: Let be any set of axioms containing Q1, ...Q9. Let F denote the term sn(0) where n is the G¨odel encoding of the X Let G be the G¨odel formula of In T (x). Then G Arith T . formula F . X ¬ X X ∈ \ X Proof idea: By definition, G is true i.t.c.s iff G / T . Intuition: F is a “name” we give to F X X ∈ X If G is false i.t.c.s. then G T . X X ∈ X Lemma (Diagonal Lemma): Let be any set of axioms containing Since Arith, we have G Arith. X X ⊆ X ∈ Q1, ...Q9. For every formula B(y) there is a closed formula G such But then, by definition of Arith, G is true i.t.c.s. X that G B(G) T . Contradiction! ↔ ∈ X We call G the G¨odel formula of B(x). So G is true i.t.c.s., i.e., G Arith. X X ∈ We have: G true i.t.c.s if and only if G has property B But then G / T , and so G Arith T . Done! X ∈ X X ∈ \ X Intuition: G asserts that G has property B (true or false i.t.c.s.!)

21 22 G¨odel’s second incompleteness theorem Proving the Diagonal Lemma: Diagonalization

For any set of axioms containing Q1 we have 0 = s(0) / T , and X ∈ X so T is consistent iff 0 = s(0) / T . X ∈ X Let F (x) be a formula with a free variable x. The consistency formula for is the formula In T (0=s(0)) The diagonalization of F is the closed formula X ¬ X Intuition: The consistency formula for states that T is consistent. DiagF := x x = F F (x) X X ∃ ∧ Theorem (G¨odel’s second incompleteness theorem): Let be any set X of axioms containing P. Then the consistency formula for does not Intuition: DiagF asserts that F has property F X belong to T . Observe: DiagF and F (F) are logically equivalent, but they have X Intuition: the consistency of a theory cannot be derived from the different G¨odel numbers. axioms of the theory.

23 24 The representation theorem Proof of the Diagonal Lemma I

Lemma: Let be any set of axioms containing Q1, ...Q9. X Theorem : There is a formula Diag(x, y) such that for every formula For every formula B(y) there is a closed formula G such that F G B(G) T . ↔ ∈ X y Diag(F, y) y = DiagF Proof: Let A(x) := y (Diag(x, y) B(y)) and let G := DiagA. ∀ ↔ ∃ ∧ can be derived in Q (and so in P). Intuition: G asserts that the diagonalization of A (the formula Proof: Omitted. asserting that A satisfies A) satisfies B. Observe: the theorem does not hold for every set of axioms. For Explicitely: instance, it does not hold for the system Q1-Q4, since in that system G:= x (x = A A(x)) := x (x = A y (Diag(x, y) B(y))) we cannot infer anything about the product function. ∃ ∧ ∃ ∧∃ ∧

25 26 Proof of the Diagonal Lemma II

The formula G y (Diag(A, y) B(y)) is valid, and so, since valid ↔∃ ∧ formulas belong to every theory, we have

G y (Diag(A, y) B(y)) T ↔∃ ∧ ∈ X Since G := DiagA, we have by the representation theorem:

y (Diag(A, y) y = G) T ∀ ↔ ∈ X And so, since T is closed under consequence, we get X G y (y = G B(y)) T ↔∃ ∧ ∈ X and for the same reason

G B(G) T ↔ ∈ X

27