G¨odel& Recursivity

JACQUES DUPARC

BˆatimentInternef CH - 1015 Lausanne

[email protected] Jacques.Duparc@epfl.ch 2 Contents

Introduction 7

I Recursivity 9

1 Towards Turing Machines 11 1.1 Deterministic Finite Automata ...... 11 1.2 Nondeterministic Finite Automata ...... 12 1.3 Regular Expressions ...... 15 1.4 Non-Regular Languages ...... 19 1.5 Pushdown Automata ...... 20 1.6 Context-Free Grammar ...... 22

2 Turing Machines 27 2.1 Deterministic Turing Machines ...... 27 2.2 Non-Deterministic Turing Machines ...... 32 2.3 The Concept of Algorithm ...... 35 2.4 Universal ...... 37 2.5 The Halting Problem ...... 40 2.6 Turing Machine with Oracle ...... 41

3 Recursive Functions 51 3.1 Primitive Recursive Functions ...... 51 3.2 Variable Substitution ...... 56 3.3 Bounded Minimisation and Bounded Quantification ...... 58 3.4 Coding Sequences of Integers ...... 60 3.5 Partial Recursive Functions ...... 62

II Arithmetic 75

4 Representing Functions 77 4.1 Robinson Arithmetic ...... 77 4.2 Representable Functions ...... 83 4 CONTENTS

5 G¨odelFirst Incompleteness Theorem 111 5.1 G¨odelNumbers ...... 111 5.2 Coding the Proofs ...... 123 5.3 Undecidability of Robinson Arithmetic ...... 138 Introduction

Introduction 7

The basic requirements for this course are contained in the ”Mathematical Logic” course. Among other things, you should have a clear understanding of each of the following: first order language, signature, terms, formulas, theory, proof theory, models, completeness theorem, compactness theorem, L¨owenheim-Skolem theorem. It makes no sense to take this course without this solid background on first order logic.

The title of the course is ”G¨odeland Recursivity” but it should rather be ”Recursivity and G¨odel”since that is the way we are going to go through these topics

(1) Recursivity

(2) G¨odel’sincompleteness theorems (there are two of them)

Recursivity is at the heart of computer science, it represents the mathematical side of what computing is like. It is related to arithmetics and to proof theory. G¨odel’sincompleteness theorems are concerned with number theory (arithmetics) which itself lies at the core of mathematics. They contradict the commonly shared idea that everything that is true can be proved. It ruins the plan, for every mathematical statement ϕ to either prove it or disprove it (by proving ϕ). G¨odel’sfirst incompleteness theorem says that there exists a formula ϕ from number theory such that neither ϕ nor ϕ is provable. More precisely, it says that in Peano Arithmetics (which is a first order axiomatization of arithmetics) there exists a formula ϕ that cannot be proved nor disproved, and if we were to add this formula to Peano Arithmetics, one would find a second one that would not be provable nor disprovable inside their first extension of Peano Arithmetics. And if this new formula would be added again, we could find a third one and so on and so forth. To put it differently, if we want to extend Peano Arithmetics to a larger theory which is complete in the sense that it proves or disproves any given formula, there would not have any understanding of this theory, we would not get hold of it, for it would not be recursive, meaning that we would not have any efficient way of figuring out whether a given closed formula is part of the theory or not (not provable from the theory, but simply part of the theory!). This is precisely where the notion of recursivity plays a crucial role. One does not have the right comprehension of G¨odel’sincompleteness theorems without a proper understanding of what recursivity is like. The formula that we will construct (the one that is not provable nor disprovable in Peano Arith- metics) is rather odd. There is no chance that one might tumble over such a formula during the usual mathematical practice. However, since G¨odel’sincompleteness theorem was proved, there have been several examples of real arithmetic mathematical formulas that are not provable nor disprovable in Peano Arith- metics, although the are formulated in the language of arithmetics. A good example of such a formula is the one related to Goodstein sequences (1944). A Goodstein m m m sequence is of the form Gp0q,Gp1q,Gp2q,..., etc, where m is a positive integer. It is defined the following way (we take m “ 4 as an example, the general case being obtained by replacing 4 m m m Gp0q “ 4 by Gp0q “ m and gathering the other values Gp1q,Gp2q, etc the same way): 8 G¨odel& Recursivity

4 2 ˝ Gp0q “ 4 write 4 in hereditary base 2: 4 “ 2 replace all 2’s by 3’s, then subtract 1: 33 “ 26

4 2 1 0 ˝ Gp1q “ 26 write 26 in hereditary base 3: 26 “ 2 ¨ 3 ` 2 ¨ 3 2 ¨ 3 replace all 3’s by 4’s, then subtract 1: 2 ¨ 42 ` 2 ¨ 412 ¨ 40 ´ 1 “ 41

4 2 1 0 ˝ Gp2q “ 41 write 41 in hereditary base 4: 41 “ 2 ¨ 4 ` 2 ¨ 4 2 ¨ 4 replace all 4’s by 5’s, then subtract 1: 2 ¨ 52 ` 2 ¨ 512 ¨ 50 ´ 1 “ 60

4 ˝ Gp3q “ 60 ... etc

4 402653209 Amazingly, Gpnq increases until n reaches the value 3 ¨ 2 where it reaches the maximum of 3 ¨ 2402653210 ´ 1, it stays there for the next 3 ¨ 2402653209 steps then starts its final descent and eventually reaches 0. m Amazingly, for every integer m, the Goodstein sequence pGpnqqnPN is ultimately constant with value 0, i.e. lim Gm “ 0. nÑ8 pnq However this statement which is easily formalizable in the language of arithmetics is not provable in Peano Arithmetics (Kirby and Paris 1982). It requires a stronger theory to be proved (for instance record order arithmetics). G¨odel’ssecond incompleteness theorem than says that mathematics cannot prove its own con- sistency (unless it is inconsistent in which case it can prove its own consistency for it can prove everything). More precisely, in any recursive extension J of Peano Arithmetics, the formula ”ConspJq” (which is a formula from number theory that asserts that there is no proof of K from J) is not provable unless J is inconsistent i.e.

IfJ&c thenJ&c ConspJq

We will present three different approaches:

˝ Computer Science ÝÑ Turing Machine (one of the abstract model of computer)

k ˝ Arithmetic ÝÑ Recursive functions which are particular functions N Ñ N Part I

Recursivity

Chapter 1

Towards Turing Machines

The whole chapter is highly inspired by Michael Sipser’s book: “Introduction to the Theory of Computation” [36]. It is a dashing introduction to the notions of Finite Automata, PushDown Automata, Turing Machines.

We also recommend “Introduction to , languages, and computation” by John E. Hopcroft, Rajeev Motwani et Jeffrey D. Ullman [22]; “Computational complexity” by Christos H. Papadimitriou [29] and “A mathematical introduction to logic” by Herbert B. Enderton [10].

1.1 Deterministic Finite Automata

We will see that any finite automaton can be regarded as a rudimentary Turing machine: a Turing machine that never writes anything and only goes one direction.

Definition 1 A deterministic finite automaton (DFA) is a 5-tuple pQ, Σ, δ, q0,F q, where

(1) Q is a finite set called the states,

(2) Σ is a finite set called the alphabet,

(3) δ : Q ˆ Σ ÝÑ Q is the transition function,

(4) q0 P Q is the initial state, and

(5) F Ď Q is the set of accepting states.1

We denote by Σăω (or equivalently by Σ˚) the set of finite words on Σ and by ε the empty sequence.

1Accept states sometimes are called final states. 12 G¨odel& Recursivity

ăω Definition 2 A DFA “ pQ, Σ, δ, q0,F q on an alphabet Σ accepts the word w P Σ if and A only if

˝ either w “ ε (the empty sequence) and q0 P F

˝ or w “ xa0, . . . , any with each ai P Σ, and there is a sequence of states r0, . . . , rn`1 such that:

‚ r0 “ q0

‚@ i ă n, δpri, aiq “ ri`1

‚ rn`1 P F .

Notation 3 Given any DFA , A p q “ tw P Σăω : w is accepted by u . L A A p q denotes the language accepted by . L A A Definition 4 Any language recognised by some deterministic finite automata (DFA) is called regular.

1.2 Nondeterministic Finite Automata

Given any alphabet Σ, we both assume that ε R Σ holds and write Σε for Σ Y tεu.

Definition 5 A nondeterministic finite automaton (NFA) is a 5-tuple pQ, Σ, δ, q0,F q, where (1) Q is a finite set of states,

(2) Σ is a finite alphabet,

(3) δ : Q ˆ Σε ÝÑ pQq is the transition function, P (4) q0 P Q is the initial state, and

(5) F Ď Q is the set of accepting states.

ăω Definition 6 Let “ pQ, Σ, δ, q0,F q be an NFA and w P Σ . We say that accepts w if N N and only if

˝ either w “ ε the empty sequence and q0 P F

˝ or w can be written as w “ xa0, . . . , any with each ai P Σε, and there is and a sequence of states r0, . . . , rn`1 such that:

‚ r0 “ q0

‚@ i ă n, ri`1 P δpri, aiq, Recursivity 13

‚ rn`1 P F . Proposition 7 Every NFA has an equivalent DFA. i.e. given any NFA there exists some N DFA such that D p q “ p q. L N L D

Proof of Proposition 7: Given any NFA “ xQ, Σ, δ, q0,F y, we build some DFA “ 1 1 1 1 N D xQ , Σ, δ , q0,F y that recognises the same language. (1) Q1 “ pQq P (2) For S Ď Q and a P Σ we set

ε˚aε˚ δ1pS, aq “ tq1 P Q | Dq P S q ÝÝÝÝÑ q1u

ε˚aε˚ where q ÝÝÝÝÑ q1 stands for the existence of a path in the graph of that goes through N exactly one edge labelled with ”a”, the others being labelled with ”ε”.

1 (3) q0 “ tq0u (4) F 1 “ tS Ď Q | S X F ‰ Hu.

% 7

Definition 8 Let A and B be languages. We define the regular operations union, concatenation, and star as follows. ˝ Union: A Y B “ tx | x P A or x P Bu. ˝ Concatenation: A ˝ B “ txy | x P A and y P Bu.

˚ ˝ Star: A “ tx1x2 . . . xk | k ě 0 and each xi P Au.

Theorem 9 Regular languages are closed under union, concatenation and star.

Proof of Theorem 9: Let 1 “ pQ1, Σ, ∆1, q1,F1q, 2 “ pQ2, Σ, ∆2, q2,F2q be two NFAs N N recognising respectively A1 and A2.

1 N N2 14 G¨odel& Recursivity

Union We need an NFA such that recognises a string if and only if 1 or 2 recognises N N N N it. By working nondeterministically, the automaton is allowed to split into two copies: N we construct in such a way that 1 and 2 work in parallel at the same time. We N N N assume Q1 X Q2 “H and q0 R Q1 Y Q2. Define “ pQ, Σ, ∆, q0,F q where N (1) Q “ tq0u Y Q1 Y Q2.

(2)∆ Ă Q ˆ Σε ˆ Q is defined by: pp, s, rq P ∆ if and only if one of the following is true

(a) p “ q0 (b) p, r P Q1 (c) p, r P Q2 s “ ε pp, s, rq P ∆1 pp, s, rq P ∆2. r P tq1, q2u

(3) F “ F1 Y F2.

The machine splits immediately into two copies of itself, which work exactly as 1 and N 2. It accepts a string if and only if at least one of the two main copies ends up in an N accepting state, i.e. in F1 or in F2, i.e. if and only if 1 or 2 accept it. N N

"

"

N

Concatenation Here we need an NFA that accepts a word w if and only if w can be broken N into two pieces: a prefix and a suffix w “ wpws such that wp is accepted by 1 and ws N is accepted by 2. We set q1 as the initial state and let the machine read the same way N 1 would do. Any time that 1 finds itself in an accepting state, we want to non- N N N deterministically start reading as if it were 2 but still remaining a copy of itself: so we N make it split any time it comes to some final state of 1. The reason is that we want N to be able to check longer sub-strings as well, because it might be the case that the first prefix that is found to be accepted by 1 corresponds to a suffix that is rejected by 2, N N Recursivity 15

while there is a longer prefix which is also accepted by 1 that yields a suffix which is this N time also accepted by 2. Formally, we define ∆ by: pp, s, rq P ∆ if and only if one of the N following is true

(1) p, r P Q1 (2) p, r P Q2 (3) p P F1 pp, s, rq P ∆1 pp, s, rq P ∆2 s “ ε r “ q2

The third condition guarantees the splitting. Finally, we set the accepting set to be F “ F2.

" "

" "

N

Star Here the machine should be able to check if a word w can be broken into a finitely N many pieces w “ w1w2 ¨ ¨ ¨ wk, each of them being accepted by 1. So has to read w1 N N as if it were 1, and when it finds itself in an accepting state, it needs to start all over N again and read w2 and so on and so forth. The construction is similar to the one of the concatenation, but since A˚ contains the empty string, we want to accept ε. So we just 1 N add an initial state q0 which is also an accepting state, and from where the initial state of 1 is reached by an ε move. % 9 N

"

"

"

N 1.3 Regular Expressions

Definition 10 We say that R is a regular expression if R is of one the following form: 16 G¨odel& Recursivity

(1) a (for some a P Σ) (3) H (5) R1 ˝ R2

˚ (2) ε (4) R1 Y R2 (6) R1 where R1 and R2 are regular expressions.

The expression ε represents the language containing a single sequence, namely, the empty se- quence, whereas H represents the language that doesn’t contain any sequence. Notice that

(1) R ˝ H “ H ˝ R “H (2) H˚ “ tεu.

Definition 11 Let R be a regular expression. We define by induction its associated language LpRq as follows:

(1) Lpaq “ tau (4) LpR1 Y R2q “ LpR1q Y LpR2q

(2) Lpεq “ tεu (5) LpR1 ˝ R2q “ LpR1q ˝ LpR2q

˚ ˚ (3) LpHq “ H (6) LpR1 q “ LpR1q .

Theorem 12 A language L is regular if and only if there exists a regular expression R such that L “ LpRq.

Proof of Theorem 12:

(ñ) (1) Lpaq “ tau (4) LpR1 Y R2q “ LpR1q Y LpR2q

(2) Lpεq “ tεu (5) LpR1 ˝ R2q “ LpR1q ˝ LpR2q

˚ ˚ (3) LpHq “ H (6) LpR1 q “ LpR1q

(ð) (1) We go from some n-states DFA to some n ` 2-states Generalized-NFA:

(a) we add (A) an initial state “s” (B) an accepting state “a” ε (C) a transition a ÝÑ q0 ε (D) a transition q ÝÑ a (each accepting state q ‰ a)

(b) we reduce the set of accepting states to tau. Recursivity 17

(2) We go from some k`1`2-states Generalized-NFA 2 to some k`2-states Generalized- NFA by removing one state from the original automaton: qrip R ts, au and for each states qin R ta, qripu and qout R ts, qripu we set the new transition to be:

˚ RinÑrip ˝ pRripÑripq ˝ RripÑout Y RinÑout qin ÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÑ qout

where RinÑrip, RripÑrip, RripÑout and RinÑout denote the following transitions:

RinÑrip RripÑout (a) qin ÝÝÝÝÝÑ qrip (c) qrip ÝÝÝÝÝÝÑ qout

RripÑrip RinÑout (b) qrip ÝÝÝÝÝÑ qrip (d) qin ÝÝÝÝÝÑ qout.

(3) We end up with a 2-states (“s” and “a”) Generalized-NFA with a single transition of R the form s ÝÑ a. The regular expression R gives the solution.

Example 13

0 s 0 "

1 1

" 0, 1 a 0, 1 (a) (b) " s 0 s

0⇤1(0 1)⇤ 1(0 1)⇤ [ [ a a (c) (d)

An other example with an automaton a bit more complicated.

Example 14

(a)

2an NFA whose transitions are labelled with regular expressions. 18 G¨odel& Recursivity

0

1 0

1 0

1

(b) 0

1 s 0 a " " 1 0 " 1

(c)

00 1 0 [ s " a 01 10 0 [ 1 "

11

(d)

0(00 1)⇤ s [ a

0(00 1)⇤01 b (10 0)(00 1)⇤ " [ [ [ [ [

(10 00)(00 1)⇤01 11 [ [ [ (e)

0(00 1)⇤01 b (10 00)(00 1)⇤01 11 ⇤ (10 0)(00 1)⇤ " 0(00 1)⇤ [ [ [ [ [ [ [ [ [ s [ a

% 12 Recursivity 19

1.4 Non-Regular Languages

Notice that any finite word on Σ can be coded by an integer, so that there are only 0 many ℵ regular languages. But there are 2ℵ0 many languages for there are as many as the number of subsets of N. Hence most languages are not regular!

Theorem 15 (Pumping Lemma) If A is a , then there is a number p (the pumping length) where, if s is any sequence in A of length at least p, then s may be divided into three pieces, s “ xyz, satisfying the following conditions:

(1) for each i ě 0, xyiz P A,

(2) |y| ą 0, and

(3) |xy| ď p

Proof of Theorem 15: Let be any DFA such that p q “ A. Set p to be the number of states A L A of . Let s be accepted by . Then s may be broken into three pieces: s “ xyz. Such that the A x A y path q0 ÝÑ q never visits twice the same state. The path q ÝÑ q visits twice the state q but none u of the others twice. This holds since for every word u of length at least p every path q1 ÝÑ q” in visits at least twice the same state. A y

x z

% 15

m m Example 16 The language t0 1 | n P Nu is not regular. m m By contradiction, assume there exists some DFA “ pQ, Σ, δ, q0,F q which recognises t0 1 | A p p n P Nu. We consider p “ |Q| the number of states of . the word 0 1 is accepted by . By A A the previous Pumping Lemma there exist x, y and z such that 0p1p “ xyz and

i m m (1) for each i ě 0, xy z P t0 1 | n P Nu, (2) |y| ą 0, and

(3) |xy| ď p 20 G¨odel& Recursivity

But since |xy| ď p, it turns out that xy P 0˚ and z P 0˚1˚. Therefore, for each integer i ą 1 we have xyi P 0˚, hence xyiz contains too many 0’s compared to 1’s: a contradiction.

1.5 Pushdown Automata

Definition 17 A (PDA) is a 6-tuple pQ, Σ, Γ, δ, q0,F q, where Q, Σ, Γ and F are all finite sets, and

(1) Q is the set of states,

(2) Σ is the input alphabet,

(3) Γ is the stack alphabet,

3 (4) δ : Q ˆ Σε ˆ Γε ÝÑ pQ ˆ Γεq is the transition function , P

(5) q0 P Q is the initial state, and

(6) F Ď Q is the set of accepting states.

Definition 18 A pushdown automaton M “ pQ, Σ, Γ, δ, q0,F q computes as follows. It accepts input w if w can be written as w “ w1w2 . . . wm, where each wi P Σε and sequences of states ˚ r0, r1, . . . , rm P Q and sequences s0, s1, . . . , sm P Γ exist that satisfy the next three conditions. The sequences si represent the sequence of stack contents that M has on the accepting branch of the computation.

(1) r0 “ q0 and s0 “ ε. This condition testifies that M starts out properly: both in the initial state and with an empty stack.

(2) For i “ 0, . . . , m ´ 1, we have pri`1, bq P δpri, wi`1, aq, where si “ at and si`1 “ bt for ˚ some a, b P Γε and t P Γ . This condition states that M moves properly according to the state, stack, and next input symbol.

(3) rm P F . This condition states that an accepting state occurs right at the end of the reading of the input.

(1) One step of a computation:

3 For a deterministic version, replace PpQ ˆ Γεq by Q ˆ Γε. Recursivity 21

a b e e c c ri ri ri+1 ri+1

w1w2w3 wi 1wiwi+1 wm w1w2w3 wi 1wiwi+1 wm ··· ··· ··· ···

(2) The special case where a “ ε and b P Γ (the PDA “pushes” b to the top of the stack)

e c ri ri+1

w1w2w3 wi 1wiwi+1 wm ··· ···

(3) The special case where a P Γ and b “ ε (the PDA “pops off” a from the top of the stack)

e c ri ri+1

w1w2w3 wi 1wiwi+1 wm ··· ···

m m Example 19 (1) The language t0 1 | n P Nu is recognised by a PDA.

", " !? 0, " 0 !

1, 0 " ! ", " ?! 1, 0 " !

(2) The language t0i1j2k | i, j, k ě 0 and i “ j or i “ ku is recognizable by a PDA, however it is not recognizable by a deterministic PDA. 22 G¨odel& Recursivity

1, 0 " 2, " " ! ! 0, " 0 ! ", ?!? , " " " ! ", " !? ", " ! " ", " " ", ! ?!?

1, " " 2, 0 " ! !

1.6 Context-Free Grammar

Definition 20 A context-free grammar is a 4-tuple pV, Σ,R,Sq, where

(1) V is a finite set whose elements are called variables,

(2) Σ is a finite set, disjoint from V . Its elements are called terminals,

(3) R is a finite set of rules. Each rule is a couple of the form pξ, uq where ξ P V and u P pV Y Σq˚.

(4) S P V is the initial variable.

If u, v and w are sequences of variables and terminals, and A Ñ w is a rule of the grammar, we say that uAv yields uwv (written uAv ñ uwv). We write u ñ˚ v if u “ v or if a sequence u1, u2, . . . , uk exists for k ą 0 and

u ñ u1 ñ u2 ñ ... ñ uk ñ v.

The language generated by the grammar is tw P Σ˚ | S ñ˚ wu.

Example 21 Consider pV, Σ,R,Sq the context-free grammar where V “ tS, Bu,Σ “ t0, 1, 7u and R is the following set of production rules:

˝ S ÝÑ 0S1 ˝ S ÝÑ B ˝ B ÝÑ 7

n n This grammar generates the language t0 71 | n P Nu.

Theorem 22 A language is recognised by a PDA if and only if it is context-free. Recursivity 23

Proof of Theorem 22:

(ð) Get a context-free grammar. The Pushdown P works as follows:

(1) Places a marker symbol “K” and the start variable on the stack. (2) Repeat: (a) If the top stack is a variable A it selects non-deterministically one of the rules for A and substitutes A by the string on the right hand side of the rule. (b) If the top stack is a terminal symbol a, it reads the next input symbol from the input and compares it to a. If they don’t match, rejects (for this branch of non-deterministic). If they do, repeat. (c) If the top of stack is the symbol “K” enters the accepting state (If a letter from the input must be read, it rejects).

(ñ) We start from a PDA and construct P an equivalent one such that

(1) P has a single accepting state qacc. (2) It empties its stack before accepting (3) Each transition either pushes a symbol onto the stack or pops one off, but does not do both at the same time so that the the content of the stack never stays put.

From P “ pQ, Σ, Γ, δ, q0, tqacc.uq we construct G.

(1) V “ tApq | p, q P Qu, (2) Σ is unchanged,

(3) the start variable is Aq0, qacc.. (4) The set of rule R is:

(a) For each p, q, r, s P Q, t P Γ and a, b P Σε if δpp, a, εq contains pr, tq and δps, b, tq contains pq, εq put the rule Apq Ñ a Arsb in R.

(b) For each p, q, r P Q put the rule Apq Ñ AprArq in R.

(c) For each p P Q put the rule App Ñ ε in R.

Why is the language recognised by P is the one derived by G?

(ñ) If w is accepted by P , then there exists a computation that accepts it. This compu- tation goes from q0 ÝÑ qacc.. It determines one derivation.

(ð) Any successful derivation induces an accepting computation.

% 22 Every regular language is context-free. But many languages are neither regular nor context-free. 24 G¨odel& Recursivity

Theorem 23 (Pumping Lemma for Context-Free Languages) If A is a context-free lan- guage, then there is a number p (the pumping length) where, if s is any sequence in A of length at least p, then s may be divided into five pieces, s “ vwxyz, satisfying the following conditions:

(1) for each i ě 0, vwixyiz P A,

(2) |wy| ą 0, and

(3) |wxy| ď p

Proof of Theorem 23: See Theorem 2.19 in [36]. We first fix a grammar. Then we concentrate on getting a derivation tree4 large enough so that there is one path – from the root to some leaf – that visits twice the same variable T . For this, if k is the number of variables in the grammar, we need a tree of height at least k ` 1. We take m to be the maximum number of symbols in the right hand side of a rule 5, and take n “ maxp2, mq. Every word of height at least nk`1 that is generated by this grammar has a derivation tree with at least one branch whose length is ě k ` 1. We set p “ nk`1.

Take any word u generated by this grammar such that |u| ď p holds. Consider the smallest – in terms of nodes – derivation tree that produces u, and consider a node T which repeats only once and such that there is no other variable that repeats in the subtree induced by this node. The whole derivation tree is described below:

S

T

T

v w x y z

Notice that |wxy| ď p holds, because the subtree induced by T has never twice the same variable (except for T itself which appears only twice). Hence every branch on this subtree has length at most k ` 1, which guarantees that wxy has length at most p “ nk`1.

Notice also that |wy| ą 0 because otherwise, we would have w “ y “ ε. But then the derivation tree below would also produce the same word which would contradict the minimality of the one we chose.

4notice that in a derivation tree every leaf is a terminal symbol, and very other node is a variable. 5k is the maximum number of immediate successors of a node in the derivation tree. Recursivity 25

S

T

x

v z

We also clearly have, for each i ě 0, vwixyiz P A:

S

S

T

T T

T T v w y z

v w x y z w x y

% 23

Example 24 The following language is not context-free:

n n n ta b c | n P Nu.

Towards a contradiction we assume that this language is context-free so that there exists some integer p that verifies the conditions of Theorem 23. We consider the word u “ 0p1p2p P A. By Theorem 23, there exist words v, w, x, y, z such that u “ vwxyz and

(1) vwixyiz P A (@i ě 0) (2) |wy| ą 0, and (3) |wxy| ď p

Since |wxy| ď p holds, this word cannot contain all three letters 0,1 and 2. We distinguish two different cases:

(1) if wxy P 0˚1˚, then z P 1˚2˚. Therefore for each i ą 1 vwixyiz contains either more 0’s than 2’s or 1’s than 2’s.

(2) if wxy P 1˚2˚, then v P 0˚1˚. Therefore for each i ą 1 vwixyiz contains either more 1’s than 0’s or 2’s than 0’s. 26 G¨odel& Recursivity Chapter 2

Turing Machines

A Turing Machine (TM) is a general model of computation. It consist in an infinite tape and a tape head that can read, write and move around. It can both read the content of the tape and write on it. The read-write head can move both to the left and to the right. The tape is infinite. There are special states for rejecting and accepting which both take immediate effect.

Control

1 0 1 0 0 1 t t t t t

2.1 Deterministic Turing Machines

Definition 25 A (deterministic) TM is a 7-tuple pQ, Σ, Γ, δ, q0, qacc., qrej.q where Q, Σ, Γ are all finite sets and

(1) Q is the set of states,

(2) Σ is the alphabet not containing the blank symbol, \,

(3) Γ is the tape alphabet where \P Γ and Σ Ď Γ

(4) δ : Q ˆ Γ ÝÑ Q ˆ Γ ˆ tL, Ru is the transition function

(5) q0 is the initial state

(6) qacc. is the accepting state

(7) qrej. is the rejecting state 28 G¨odel& Recursivity

Clearly qacc. and qrej. must be different states.

Notice that the head cannot move off the left hand end of the tape. If δ says so, it stays put. A configuration of a TM is a snapshot: it consists in the actual control state (q), the position of the head and what is written on the tape (w). To indicate the position of the head we consider the word w0 which is located to the left of the head and slice the tape content w into the w0w1 “ w. This means that the head is actually positioned on the first letter of w1. Strictly speaking the content of the tape is an infinite word:

w \\\ ...... \\ ... but we forget about the infinite suffix \\\ .... We then write w0qw1 to say that

˝ the tape content is w0w1 \\\ ...

˝ the head is positioned on the first letter of w1 \\\ ...

˝ the actual control state is q.

ăω The initial configuration on input w P Σ is q0w. An halting configuration is

˝ either an accepting configuration of the form w0qacc.w1,

˝ or a rejecting configuration of the form w0qrej.w1.

Given any two configurations C,C1 we write C ñ C1 (for C yields C1 in one step) if there exist a, b, c P Γ, and u, v P Γ˚ such that

1 ˝ either C “ uaqibv, C “ uqjacv and δpqi, bq “ pqj, c, Lq,

1 ˝ or C “ uaqibv, C “ uacqjv and δpqi, bq “ pqj, c, Rq.

Definition 26 A TM accepts input w if there is a sequence of configuration C0,...,Ck such that

(1) C0 “ q0w

(2) Ci yields Ci`1 (for any 0 ă i ă k)

(3) Ck is an accepting configuration.

Definition 27 The set of all words accepted by a TM is the language it recognises: M p q “ tw P Σ˚ | accepts wu. L M M Recursivity 29

Example 28 A Turing machine that recognises tw7w | w P t0, 1u˚u – where w is the mirror of w (for instance 001011 “ 110100). pQ, Σ, Γ, δ, q0, qacc., qrej.q where

(1) Q “ tq0, qremember 0 look for \ go right, qremember 1 look for \ go right, qwrite 0, qwrite 1, qlook for \ go left, qstep rightu

(2)Σ “ t0, 1u

(3)Γ “ t0, 1, \u

(4) δ : Q ˆ Γ ÝÑ Q ˆ Γ ˆ tL, Ru is defined by

pq0, \q ÝÑ qacc. pq0, 0q ÝÑ pqremember 0 look for \ go right, \,Rq pq0, 1q ÝÑ pqremember 1 look for \ go right, \,Rq pqremember 0 look for \ go right, \q ÝÑ pqwrite 0, \,Lq pqremember 0 look for \ go right, 0q ÝÑ pqremember 0 look for \ go right, 0,Rq pqremember 0 look for \ go right, 1q ÝÑ pqremember 0 look for \ go right, 1,Rq pqremember 1 look for \ go right, \q ÝÑ pqwrite 1, \,Lq pqremember 1 look for \ go right, 0q ÝÑ pqremember 1 look for \ go right, 0,Rq pqremember 1 look for \ go right, 1q ÝÑ pqremember 1 look for \ go right, 1,Rq pqwrite 0, \q ÝÑ qrej. pqwrite 0, 0q ÝÑ pqlook for \ go left, \,Lq pqwrite 0, 1q ÝÑ qrej. pqwrite 1, \q ÝÑ qrej. pqwrite 1, 0q ÝÑ qrej. pqwrite 1, 1q ÝÑ pqlook for \ go left, \,Lq pqlook for \ go left, \q ÝÑ pqstep right, \,Rq pqlook for \ go left, 0q ÝÑ pqlook for \ go left, 0,Lq pqlook for \ go left, 1q ÝÑ pqlook for \ go left, 1,Lq pqstep right, \q ÝÑ qacc. pqstep right, 0q ÝÑ pqremember 0 look for \ go right, \,Rq pqstep right, 1q ÝÑ pqremember 1 look for \ go right, \,Rq 30 G¨odel& Recursivity

If we rename the states :

q0 ; q0 qremember 0 look for \ go right ; q1 qremember 1 look for \ go right ; q2 qwrite 0 ; q3 qwrite 1 ; q4 qlook for \ go left ; q5 qstep right ; q6 the transition function becomes:

pq0, \q ÝÑ qacc. pq3, 1q ÝÑ qrej. pq0, 0q ÝÑ pq1, \,Rq pq4, \q ÝÑ qrej. pq0, 1q ÝÑ pq2, \,Rq pq4, 0q ÝÑ qrej. pq1, \q ÝÑ pq3, \,Lq pq4, 1q ÝÑ pq5, \,Lq pq1, 0q ÝÑ pq1, 0,Rq pq5, \q ÝÑ pq6, \,Rq pq1, 1q ÝÑ pq1, 1,Rq pq5, 0q ÝÑ pq5, 0,Lq pq2, \q ÝÑ pq4, \,Lq pq5, 1q ÝÑ pq5, 1,Lq pq2, 0q ÝÑ pq2, 0,Rq pq6, \q ÝÑ qacc. pq2, 1q ÝÑ pq2, 1,Rq pq6, 0q ÝÑ pq1, \,Rq pq3, \q ÝÑ qrej. pq6, 1q ÝÑ pq2, \,Rq pq3, 0q ÝÑ pq5, \,Lq

Definition 29 A language L is Turing recognizable if there exists a TM such that M L “ p q. L M Proposition 30 Turing Machines with bi-infinite tapes are equivalent to Turing machines.

Proof of Proposition 30: Left as an exercise. % 30

Proposition 31 2 stack Pushdown automata are equivalent to Turing machines.

Proof of Proposition 31: Left as an exercise. % 31

Definition 32 A Decider is a TM that halts on all inputs. Recursivity 31

Definition 33 A language is Turing decidable iff there exists a Decider that recognises it.

Turing recognizable is also called recursively enumerable (r.e. for short) and Decidable is also called recursive.

Example 34 A Decider for tanbncn | n P wu:

˝ Scan the input from left to right to be sure that it is a member of a˚b˚c˚ and reject if it isn’t.

˝ Return the head to the left and change one c into an x, then one b into x, then one a into x. Go back to the first blank \. Repeat again until the tape is only composed of x, in which case accept. Otherwise reject.

Definition 35 A k tape TM is the same as a TM except that is composed of k tapes: 1 ,. . . , k , with k independent heads so that the transition function becomes

δ : Q ˆ Γk ÝÑ Q ˆ Γk ˆ tL, Ruk

Notice that a configuration of a k-tape Turing machine is of the form

u qv , u qv , ...... , u qv 1 1 2 2 k k . ´ 1 2 k ¯

Proposition 36 Given any TM there exist

(1) an equivalent TM with a bi-infinite tape,

(2) a multi-tape TM,

(3) a multi-tape with bi-infinite tapes TM.

Proof of Theorem 36: Left as an exercise. % 36

Theorem 37 Every multi-tape TM has an equivalent single tape TM.

Proof of Theorem 37: Let be a multi-tape TM. We will describe a TM that recognises M S the same language. Let pw1, w2, . . . , wkq be the input of on its k tapes. The corresponding M input of will be 7w17w27 ... 7wk7, where 7 does not belong to the alphabet of . To simulate a S M single move of , scans its tape from the first 7 which marks the left-hand end, to the k ` 1th M S 7 (which marks the right-hand end) replacing each letter a right after the 7 symbol (except for the k ` 1th one) bya ˆ to indicate the position of the heads. Then makes a second pass to S 32 G¨odel& Recursivity

update the tapes according to ’s transition functions. If at any point moves one of the M S virtual heads to the right onto a 7, this action signifies that has moved the corresponding M head onto the previously unread blank portion of that tape. So writes a blank symbol on this S tape cell and shifts the tape contents from this cell until the rightmost 7, one unit to the right. Then it continues the simulation as before.

1 0 1 t t t M 1 1 0 0 1 t t t t

1 0 0 0 t t t t

] 1 0ˆ 1 ] 1 1 0 0 1ˆ ] 1 0 0 0 ] t t t t b S % 37

2.2 Non-Deterministic Turing Machines

Definition 38 A non-deterministic TM (NTM) is the same as a deterministic TM except for the transition function which is of the form: δ : Q ˆ Γ ÝÑ pQ ˆ Γ ˆ tL, Ruq. P The computation of a (deterministic) TM is a sequence of configurations

C0 ùñ C1 ùñ ... ùñ Ck ùñ ... that may be finite or infinite. It accepts the input if this sequence is finite and the last configuration is an accepting one. The computation of a non-deterministic TM is no more a sequence of configurations but a tree whose nodes are configurations. This tree may have both infinite and finite branches. The machine accepts the input if and only if there exists some branch that is finite and whose leaf is an accepting configuration. Recursivity 33

Theorem 39 For every NTM there exists a deterministic TM that recognises the same lan- guage.

Proof of Theorem 39:

1 0 1 0 t t t

2 0 1 1 1 0 t t t t M 3 1 4 2 1 3 4 6 2 1 7 1 4 2 1 2 t t t t t

We consider a 3-tape ( 1 , 2 and 3 ) deterministic TM to simulate a NTM : M N ˝ (1) 1 is the input tape, (2) 2 is the simulation tape, and (3) 3 is the address tape.

˝ Initially, 1 contains the input w and 2 and 3 are empty.

˝ 1 always keeps the input w. So the content of 1 is never modified.

˝ 2 simulates on one – initial segment of a – branch of its non-deterministic computation N tree.

˝ 3 contains a finite word which corresponds to a succession of non deterministic choices. For instance the word 132 stands for: among the non-deterministic options choose the first one for the first transition, the third one for the second and the second one for the third. This means that we consider k P N to be maxtCardpδpq, γqq | q P Q, γ P Γu

and for each | q P Q, γ P Γ we fix a total ordering of δpq, γq. Words on 3 all belong to t1, 2, . . . , ku˚. Moreover, during the running time, the content of 3 changes over and over again until the machine accepts. This series gives rise to an enumeration of the infinite k-ary tree in a breadth-first search. This means it enumerates all words in t1, 2, . . . , ku˚ along the following well-ordering:

|u| ă |v| u ă v ðñ or |u| “ |v| and u ălexic. v 34 G¨odel& Recursivity

Which gives:

ε, 1, 2, . . . , k, 11, 12,..., 1k, 21, 22,..., 2k, ...... , k1, k2, . . . , kk, 111, 112,..., 11k,......

˝ At first, Copies the content of 1 (= the input w) to 2 . M ˝ It then uses 2 to simulate with input w on the branch b of its non-deterministic N computation which is lodged on 3 . In case the word b does not correspond to a real computation1 or if the simulation of on 2 either reaches the rejecting state or does not N reach any halting state at all, then erases completely 2 , replaces b on 3 with its the M immediate ă-successor, and starts all over again – by copying 1 on 2 and simulating N on 2 in accordance with the series of choices recorded on 3 .

% 39

Proposition 40

˝ Recursive languages are closed under union, intersection and complementation.

˝ Recursively enumerable languages are closed under union and intersection.

Proof of Proposition 40: Left as an exercise. % 40

Definition 41 An enumerator is a TM. We say that it enumerates a language if the result L of its computation (possibly infinite) is of the form

w0 \ w1 \ w2 \ ... \ wn \ wn`1 \ ...... where twi | i P Nu “ . L We say that a language is “recursively enumerable” if there is an enumerator that enumerates L . L Theorem 42 A language is Turing Recognizable if and only if it is recursively enumerable.

Proof of Theorem 42:

˚ (ñ) from we build that enumerates p q. Fix a recursive enumeration psiqi of Σ . M E L M PN (1) Repeat the following for i “ 1, 2, 3,...

(2) Run for i steps on each input s1, s2, . . . , si M (3) If any computation accepts, print out the corresponding sj.

1 this is the case for instance if from the initial configuration q0w there are only two control states non- deterministically available, whereas the word on 3 reads 3 .... Recursivity 35

(ð) From we build : on input w: run , and every time outputs some word v, find out E M E E whether v “ w or not, and accept if they are the same.

% 42

Proposition 43 For any infinite L Ď Σ˚,

there exits an enumerator that prints out E $ u0 \ u1 \ u2 \ ...... \ ui \ ui`1 \ ...... ’ ’ ’ L “ tui | i P Nu ’ ’ L is Turing decidable ðñ ’ $ ’ ’ and &’ ’ such that ’ ’ ’ &’ |u| ă |v| ’ ’ i ă j ùñ or ’ ’ $ ’ ’ |u| “ |v| and u ălexic. v. ’ ’ & ’ ’ ’ ’ Proof of Proposition 43: Left as an% exercise. % % % 43

2.3 The Concept of Algorithm

In 1900, Hilbert gave a list of the main mathematical problems of the time [20, 21]. The 10th one was the following: given a Diophantine equation with any number of unknown quantities, and with rational integral numerical coefficients, can we derive a process according to which it can be determined in a finite number of operations whether the equation admits a rational integer solution? This corresponds to the intuitive notion of an algorithm. Proving that such an algorithm does not exist requires a formal definition of the notion of “algorithm”. The “Church- Turing thesis” states that the informal notion of an algorithm corresponds exactly to the notion of a λ-calculus formula or equivalently to a Turing machine. In 1970, Yuri Matijasevic proved2 that the 10th problem of Hilbert is undecidable [26]: assuming that the notation P px1, . . . , xnq stands for a polynomial with integer coefficients, then there is no decider for n tP px1, . . . , xnq | Dpa1, . . . anq P N P pa1, . . . , anq “ 0u.

Definition 44 A “coding” is a rule for converting a piece of information into another object. Given any non empty sets E,F , a coding is a one-to-one (total) function

1 1 c : E ÝÝÑ´ F.

2this is combined work of Martin Davis, Yuri Matiyasevich, Hilary Putnam and Julia Robinson 36 G¨odel& Recursivity

1´1 Example 45 E “ t0, 1u˚, F “ N and c : E ÝÝÑ F is a coding defined by:

2 cpwq “ 1w p= the word “1w” read in base 2q.

Notation 46 Given any Turing machine , we write M ˝ pwq Ó to say that the machine stops on input w M M

‚ pwq Ó acc. means that stops in an accepting configuration, and M M

‚ pwq Ó rej. means that stops in a rejecting configuration. M M ˝ pwq Ò to say that the machine never stops on input w. M M

Definition 47 Given any two non-empty finite sets A, B, a partial function f : A˚ ÝÑ B˚ is “Turing computable” if and only if there exists a Turing machine f such that M ˝ on input w R dompfq: f pwq Ò, and M

˝ on input w P dompfq: f pwq Ó acc. with the word “fpwq” on its tape. M Remarks 48

(1) Given any finite alphabet Σ, and any TM whose alphabet is Σ, there exists a Turing ˚ ˚ M computable coding: c :Σ ÝÑ t0, 1, \u and a TM c with tape alphabet t0, 1, \u such M that accepts w if and only if c accepts cpwq. M M (2) Every regular language is decidable because a DFA is nothing but a deterministic TM that always goes right.

(3) Every Context-free language is decidable, because any PDA can be easily simulated by some equivalent non-deterministic TM.

(4) We have the following strict inclusions of languages.

Regular Ĺ Context-Free Ĺ Decidable Ĺ Turing Recognizable. “ “ Recursive Recursively Enumerable

In computer science, a programming language is said be “Turing complete” or “universal” if it can be used to simulate any single-tape Turing machine. Examples of Turing-complete pro- gramming languages include: Recursivity 37

˝ Ada ˝ C++ ˝ Java ˝ Pascal

˝ C ˝ Common Lisp ˝ Lisp ˝ Prolog, etc.

2.4

If we compare a Turing Machine with a computer, on one hand the TM seems much better because it can compute for ever without any chance to breakdown and it has an infinitely large storage facility. But on the other hand, a TM seems to be more of a computer with a single software program, whereas a computer can run different programs. A computer resemble more of a Turing machine with finite capacity but, a Turing machine that we can modify by changing its transition function – every program is like a new transition function for the machine. How are we going to address this issue, since we claimed that a Turing machine is an abstract model of computation ? This answer to this is the Universal Turing Machine. It is a machine that can work just like any other machine provided that we feed it with the right code of the machine. We will employ Turing machines to obtain: (1) a languages that is Turing recognizable but not decidable3,

(2) a language that is not Turing recognizable. From now on, we only consider Turing Machines with fixed alphabets Σ “ t0, 1u, Γ “ t0, 1, \u. Any such TM is of the form:

“ xtq0, q1, . . . , qku, t0, 1u, t0, 1, \u, δ, q0, qacc., qrej.y M Where δ is the description of the transition function of : M

δ “ tpq3, 0, q1, 1,Rq, pq8, 1, q4, 0,Lq, pq3, 0, q3, 0,Lq,...... u

The description of such a machine is a finite sequence M over some finite alphabet A:

x, y,q, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, \,L,R, t, u, p, q,, “ A. ! ) Since CardpAq ă 28 we can code any letter l P A by a sequence of eight 0’s and 1’s, i.e we take any 1-1 mapping C : A ÝÑ t0, 1ur8s and we define a Turing computable coding

c : A˚ ÝÑ t0, 1u˚ by cpa0 . . . apq “ Cpa0qˆCpa1qˆCpa2qˆ...ˆCpapq.

3in other words: a non-recursive recursively enumerable language. 38 G¨odel& Recursivity

We denote by x y the code of , i.e. M M x y “ cp q. M M Clearly, the following language is decidable:

tx y : is a TMu. M M Proposition 49 (Universal Turing Machine) There exists a Turing machine4 such that U on each input of the form vw P t0, 1u˚,

if v “ x y for some Turing machine5 , then works as on input w. M M U M Notice that for any word u P t0, 1u˚, if there is a prefix of u which is the code of a Turing Machine, then this prefix is unique 6. Therefore, in case a word u P t0, 1u˚ can be decomposed into u “ x yw for some Turing machine , this decomposition is then unique. M M This means for instance that on any input w:

˝ pwq Ò if and only if pwq Ò; U M 1 1 ˝ pwq Ó rej. with the word w on its tape if and only if pwq Ó rej. with the word w on its tape; U M 1 1 1 ˝ pw q Ó acc. with w on its tape if and only if pwq Ó acc. with w on its tape. U M

(1) on 1 the input x yw is inserted. It will never be modified during the rest of the compu- M tation. Then copies the code of U (a) the transition function of – xδy – on 2 ; M 7 (b) the initial state of – xq0y – on 3 ; M 8 (c) the accepting state of – xqacc.y – on 4 ; M 9 (d) the rejecting state of – xqrej.y – on 5 . M (2) It then uses 6 to simulate on input w: for each step of M M

(a) reads a letter – say 0 – on 6 , and U (b) using the code of the actual state – say xq3y – on 3 , looks in 2 for the code of the U corresponding transition – say xpq3, 0, q1, 1,Rqy – and then

4 working on alphabets ΣU “ t0, 1u and ΓU “ t0, 1, \u 5 also working on alphabets ΣU “ t0, 1u and ΓU “ t0, 1, \u 6this comes from the fact the last letter of a word that defines a TM is y. Therefore, reading u from left to right by blocks of eight 0’s or 1’s, the first block that corresponds to xyy marks the end of the wanted prefix. 7later on this tape will store the code of the actual state that M is on. 8the content of 4 will never be modified in the future. 9the content of 5 will never be modified in the future. Recursivity 39

(c) verifies that the code of the new state – here xq1y – is different from the content of U 4 and 5 (otherwise if it corresponds to the content of 4 it means that it is xqacc.y, and accepts right away, and if it corresponds to the content of 5 it means it is U xqrej.y, in which case rejects). U (d) If the new state is different from both qacc. and qrej. – in our example q1 is different from both qacc. and qrej. – replaces on 6 the letter it just read with the new one U – here it replaces 0 by 1 – and still on tape 6 it makes the move indicated – here it goes right – and finally,

(e) replaces on 3 the code of the old state by the new one – here it replaces xq3y by U xq1y.

1 1 0 1 1 1 0 U

2 1 1 0 1 1 1 1 0 0

3 1 0 0 0 1 1 1 0

4 1 0 0 0 0 0 0 1

5 1 0 0 0 1 1 1 0

6 1 1 0 1 1 1 1 0 0 1 1 1 0 0 0 0 1 1 t t

M 1 1 0 1 1 1 1 0 0 1 1 1 0 0 0 0 1 1 t t

% 49 40 G¨odel& Recursivity

2.5 The Halting Problem

Proposition 50 The following language is Turing recognizable but not decidable:

tx yw P t0, 1u˚ | is a TM that accepts wu. M M Proof of Proposition 50: Towards a contradiction we assume there exists a Decider that D decides this language. We build a Turing machine which works the following way: H on input w

˝ if accepts ww, then does not halt. D H ˝ if rejects ww, then accepts. D H Notice that

accepts x y ðñ rejects x yx y ðñ does not accept x y. H H D H H H H Or to say it differently

px yq Ó acc. ðñ px yx yq Ó rej. ðñ px yq Ò . H H D H H H H To see things slightly differently, since the machine only stops when it accepts we can refor- H mulate the contradiction in px yq Óðñ px yq Ò . H H H H % 50

Proposition 51 The following language is Turing recognizable but not decidable:

tx y P t0, 1u˚ | pεq Óu. M M Proof of Proposition 51: Left as an exercise. % 51

Corollary 52 The following languages are not recursively enumerable:

˚ (1) x yw P t0, 1u | pwq Ó acc. ; M M (2) x y P t0, 1u˚ | pεq Ó .( M M ( Proof of Corollary 52: Left as an exercise. % 52 Recursivity 41

2.6 Turing Machine with Oracle

A Turing machine with an oracle is one finite object (a Turing machine suitable for any oracle: an almost regular 2-tape Turing Machine) plus one infinite object so that this TM can have access to an infinite amount of information – which a normal one never does.

Definition 53

(1) An oracle is any subset O Ď N. (2) An oracle-compatible-Turing machine (o-c-TM) is a 2-tape Turing machine similar to any 2-tape Turing machine except that it only reads but never writes on tape 2 :

“ pQ, Σ, Γ, δ, q0, qacc., qrej.q O

(3) An oracle-compatible-Turing machine equipped with the oracle O, on input word w P Σ˚ O (in short an oracle TM O on word w P Σ˚) is nothing but the TM whose initial O O configuration is

q0w , q0χO ´ 1 2 ¯

ω where χO P t0, 1u is the infinite word

χOp0qχOp1qχOp2q ...... χOpnqχOpn ` 1q ......

defined by 1 if n P O

χOpnq “ $ and ’ & 0 if n R O. ’ %’ This means that on tape 2 the whole characteristic function of the oracle is already available once the machine starts. So that the machine is granted access to all of this ”external” infor- mation: it knows which integers belong to O and which do not. For instance, in case O is the set of all integers n such that:

(1) n reads “ 1x yw ” in the decimal numeral system, M (2) pεq Ó; M then O may be able to decide the Halting Problem. Of course this does not lead to a contra- O diction since there is no chance that such a Turing machine 10 ever sees its own code onto tape 2 (although the code of – or the code of an equivalent TM – does show on 2 ). O 10we are talking about OO and not just O! 42 G¨odel& Recursivity

O O 1 1 1 0 1 1 1 1 t t

2 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0

Example 54 Let O Ď N be the set of all the codes of Turing machines that halt on the empty input:

2 O “ t1x y P N | pεq Óu. M M We describe an oracle-compatible-TM that, once equipped with the oracle O, decides the O language tx y P t0, 1u˚ | pεq Óu. M M The machine O works this way: O (1) on input w P t0, 1u˚, the TM O checks whether w is the code of a TM O if it is not the case it rejects right away. Otherwise,

2 (2) it computes n “ 1x y , then checks on tape 2 whether χ pnq “ 1 – in which case it M O accepts – or χOpnq “ 0 – in which case it rejects.

Notation 55 ˝ Notice that the mapping f : t0, 1u˚ ÐÑ N is a bijection. 2 w ÞÝÑ 1w ´ 1

For any word w we write xwy for fpwq, and for any integer k we write xky for f ´1k.

2 2 For instance x0010y “ 10010 ´ 1 “ 18 ´ 1 “ 17, and x12y “ 101 since 1101 ´ 1 “ p8 ` 4 ` 1q ´ 1 “ 13 ´ 1 “ 12.

˚ ˝ Given any language L Ď t0, 1u , we write OL Ď N for the set

OL “ xwy P N | w P L “ k P N | xky P L .

! ) ˚ ! ) ˝ Given any subset O Ď N, we write p q Ď t0, 1u for the language L O ˚ ˚ p q “ w P t0, 1u | xwy P O “ xky P t0, 1u | k P O . L O ! ) ! ) Recursivity 43

So OL is the oracle associated with the language L, and p q is the language associated with L O the oracle O. Notice that the oracle for the empty language is the empty set: OH “H. So, we have

(1) a coding for the Turing machines:

˚ ˚ tx, y,q, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, \,L,R, t, u, p, q,, u ÐÑ t0, 1u ÞÝÑ x y M M

(2) a coding for the words: t0, 1u˚ ÐÑ N w ÞÝÑ xwy

(3) a coding for the integers: N ÐÑ t0, 1u˚ k ÞÝÑ xky

We will use the notation x y instead of xx yy which means we consider first the word in t0, 1u˚ M M that codes the Turing machine , then the integer that codes this word. All we mean is that M x y is an integer that codes the Turing machine . M M

Proposition 56 Given any L Ď t0, 1u˚, and any oracle Turing machine OL : O ˝ p OL q is recursively enumerable, and moreover L O ˝ if OL is an oracle Decider11, then p OL q is recursive. O L O Proof of Proposition 56: Left as an exercise. % 56

Definition 57 (Turing Reducibility) Given any A, B Ď N, B A is “Turing reducible” to B – denoted A ďT B – if there exists an o-c-TM which on empty O tape computes χA.

Proposition 58 Given any A, B Ď N, the following are equivalent:

(1) A is Turing reducible to B,

11meaning that OOL halts on every input. 44 G¨odel& Recursivity

(2) for every o-c-TM , there exists an o-c-TM such that A “ B . M N L M L N Moreover, in case A is an oracle Decider, we may ensure that B be one too. M ` N˘ ` ˘ Proof of Proposition 58: Left as an easy exercise. % 58

Notation 59 Given any A, B Ď N, we write

˝ A ďT B if A is Turing reducible to B;

˝ A ”T B if A ďT B and B ďT A;

˝ A ăT B if A ďT B but B ­ďT A.

Notice that we have

˝ A ďT A hence A ”T A ;

˝p A ďT B`and B ďT Cq ùñ˘ A ďT C hence pA ”T B and B ”T Cq ùñ A ”T C ;

˝ A ”T B ðñ B ”T A. ` ˘

So that ”T is an equivalence relation.

Examples 60 Given any language L Ď t0, 1u˚,

(1) OL ”T OLA “ N r OL,

(2) H ďT OL,

(3) L is recursive ðñ OL ”T H,

(4) L is not recursive ðñ H ăT OL.

(5) L ”T L holds since we have L “ L . O O pOLq O O pOLq

An equivalence class – rAs”T “ tB Ď N | B ”T Au for some A Ď N – is called a Turing degree. The ordering on oracles induces an ordering on the set TD of all Turing degrees: given any d, e P TD,

d ď e ðñ A ďT B holds for some A P d and some B P e or equivalently d ď e ðñ A ďT B holds for all A P d and all B P e Recursivity 45

As usual, the notation d ă e ðñ d ď e but e ę d

Examples 61 We list a few basic facts about Turing degrees.

(1) Given any d P TD cardpdq “ 0. ℵ The reason is that there are countably many Turing machines and always infinitely many oracle that are Turing equivalent: for instance, given any A Ď N and any k P N form

Ak “ t2n | n P Au Y t2k ` 1u

We have both A ”T Ak (any k P N) and Ak ‰ Al (any k ‰ l P N).

(2) Given any set A Ď N the set tB Ď N | B ďT Au is countable for the reason that there are only countably many Turing machines.

(3) Given any d P TD card e P TD | e ď d ď 0. ℵ (4) Given any d P TD ( ℵ card e P TD | d ď e “ 2 0 . To see this, observe that if (

d “ rAs”T then given any B Ď N the set A ‘ B “ t2n | n P Au Y t2n ` 1 | n P Bu

satisfies A ďT A ‘ B. Moreover, ℵ card A ‘ B | B Ď N “ 2 0 . Since every Turing degree is countable, we obtain (

A ‘ B | B Ď ℵ0 card N ”T “ 2 ´ ¯ which gives the result. ( L

(5) As Sacks showed in 1961 – see [17] p. 157 and also [33, 34] – the ordering pTD, ďq does not have a familiar shape since every countable partial ordering pP, ďq can be embedded into pTD, ďq. 46 G¨odel& Recursivity

Proposition 62

˚ (1) p q Ď t0, 1u | O ďT H is the class ec. of all recursive languages. L O R ! ) ˚ 12 (2) L Ď t0, 1u | OL ďT Halt Ľ . . (= the class of all r.e. languages) . R E ! ) ˚ (3) p q Ď t0, 1u | O ďT Halt Ľ . . L O R E ! ) Where Halt stands for the set of codes of Turing machines that halt on the empty input:

alt “ H O x yPt0,1u˚ | pεqÓ M M ( “ x y P N | pεq Ó . M M ( Proof of Proposition 62: Left as an exercise. % 62 We now introduce an operation called the “jump” which shows that there is no maximum Turing 1 1 degree, since from any given oracle A it provides us with some oracle A that satisfies A ăT A .

Definition 63 (jump operator) Given any subset A Ď N, the “jump” of A (denoted A1) is

1 A “ A O x yPt0,1u˚ | an o-c-TM, pεqÓ M M M A ( “ x y P N | pεq Ó . M M (

Example 64 1 Halt ”T H .

Proposition 65 For every A Ď N the set

: A A “ α2px y, xwyq P N | pwq Ó M M satisfies ( 1 : A ”T A .

12 A A notice that the inclusion is strict since alt satisfies both alt ”T alt and L A R Rec. H H H pHaltq Recursivity 47

bij. ¨See page 60 for the definition of α2 : N ˆ N ÐÝÑ N ˛ px, yq ÞÝÑ px`yq¨px`y`1q ` y. ˚ 2 ‹ ˝ ‚ Proof of Proposition 65: Left as an easy exercise. % 65

Proposition 66 For every A Ď N, 1 A ăT A .

1 1 1 Proof of Proposition 66: We decompose A ăT A into first A ďT A , then A ­ďT A.

1 (A ďT A ) We need to find an o-c-TM that outputs χA while being equipped with the oracle 1 M A . To compute χApnq this machine proceeds as follows: it computes the code x ny of any N o-c-TM n that, no matter what its input w is, proceeds as follows when it is equipped N with the oracle O:

˝ if χ pnq “ 1, then npwq Ó; O N ˝ if χ pnq “ 0, then npwq Ò. O N 1 Then A outputs M χApnq “ χA1 px nyq. N

1 1 : 1 (A ­ďT A) Towards a contradiction, we assume that A ďT A holds. Since A ”T A we have : A A ďT A holds as well. So, there exists an o-c-TM such that computes χ : . N N A We build an o-c-TM such that A on every input w P t0, 1u˚: H H

(1) computes k “ α2pxwy, xwyq, then

(2) by making use of as a subprogram, computes the value χ : pkq, then N A A ˝ if χA: pkq “ 0, then pwq Ó; HA ˝ if χ : pkq “ 1, then pwq Ò. A H We obtain the following contradiction:

A : A px yq Ó ðñ α2px y, x yq R A ðñ px yq Ò . H H H H H H

Below we show a picture that illustrates this diagonal argument that we have just used. If p iqi is a enumeration of all the oracle-compatible Turing machines, then we made sure M PN that the machine we built is none of them by ensuring that for each i P N, there exists H 48 G¨odel& Recursivity

A an input word (its own code x iy) such that has a completely different behaviour M H than A on this word. Mi

A A A A A A A M0 M1 M2 M3 M4 M5 Mn

x 0y 011010 ... 0 ... M

x 1y 111000 ... 0 ... M

x 2y 1 01000 ... 1 ... M

x 3y 0 0 1010 ... 0 ... M

x 4y 0 1 0 111 ... 0 ... M

x 5y 1 1 0 0 00 ... 0 ... M ......

x ny 1 0 0 0 1 1 ... 1 ... M......

Diagonal argument: swap 0’s and 1’s on the diagonal.

% 66

Corollary 67 The following strict ordering between jumps is satisfied:

n n`1 ω ω`1 1 2 2 ¨ ¨ ¨ 1 2 ¨ ¨ ¨ 1 2 ¨ ¨ ¨ 2 ¨ ¨ ¨ 1 H ăT H ăT H ăT ... ăT H ăT H ăT ... ăT H ăT H ăT .... hkkikkj hkkikkj hkkikkj hkkikkj where pn`mqpn`m`1q k “ 2 ` m ω 2 ¨ ¨ ¨ 1 $ and k PH ðñ ’ hkkikkj ’ n &’ m PH2 ¨ ¨ ¨ 1 . ’ hkkikkj ’ %’ n ω Proof of Corollary 67: Let us use the notations Hpnq for H2 ¨ ¨ ¨ 1 and Hpωq for H 2 ¨ ¨ ¨ . hkkikkj hkkikkj Recursivity 49

The only thing one needs to prove is that

pnq pωq H ăT H holds for every integer n.

pnq pωq H ďW H is almost immediate, since it is straightforward to build an o-c-TM n that pωq O outputs χHpnq when it is equipped with the oracle H since

pn ` mqpn ` m ` 1q χ pnq pmq “ χ pωq ` m . H H 2 ˆ ˙

pωq pnq H ­ďW H it is enough to proceed by contradiction and show that

pωq pnq H ďW H

would imply pn`1q pnq H ďW H .

% 67

Iterating the jump operator into the transfinite

Notice that if for every limit countable ordinal λ we fix some bijection

fλ : N ÐÑ λ ˆ N k ÞÝÑ pα, mq we may then define an uncountable sequence of jumps Hpαq by ordinal induction: αăω1 ` ˘ ˝H p0q “H 1 ˝H pα`1q “Hpαq

pλq pαq ˝H “ tfλpα, mq P N | m PH u.

pαq It is immediate to see that the sequence H is strictly ăT -increasing, or in other words αăω1

` pαq ˘ pβq H ăT H holds for every α ă β ă ω1. 50 G¨odel& Recursivity Chapter 3

Recursive Functions

The whole chapter is highly inspired by Ren´eCori and Daniel Lascar book’s book: “Math- ematical Logic, Part 2, Recursion Theory, G¨odelTheorems, Set Theory, Model Theory” [5].

p Recursive functions are functions from N to N. We will show that they have a strong relation with the Turing computable ones. We define the set of recursive functions by induction. For this purpose, for any integer p, we p p p denote by NpN q the set of all mappings of the form N ÝÑ N. Notice that N is a notation for the set of all mappings ti P N | i ă pu ÝÑ N. When p “ 0, the set ti P N | i ă pu becomes 0 ti P N | i ă 0u “ H. Thus the set N only contains one element: the empty function whose 0 graph is H. Therefore the set of all mappings of the form N ÝÑ N contains all mappings that assign one integer to the empty function:

f : tHu ÝÑ 0 ÝÑ “ N n P . N N H ÝÑ n N " ˇ * ˇ 0 ˇ So, as may be expected, mappings in NpN q are identified withˇ elements of N.

3.1 Primitive Recursive Functions

Definition 68

th p projection: If i is any integer such that 1 ď i ď p holds, the i projection πi is the function p of NpN q defined by p πi px1, . . . , xpq “ xi

1 successor: S P NN is the successor function .

1Spnq “ n ` 1. 52 G¨odel& Recursivity

p pq p nq p pq composition: Given f1, . . . , fn P N N and g P N N , the composition h “ gpf1, . . . , fnq P N N is defined by hpx1, . . . , xpq “ g f1px1, . . . , xpq, . . . , fnpx1, . . . , xpq ÝÑ ` ˘ ÝÑ ÝÑ We often make use the notation x for px1, . . . , xpq so that for instance g f1p x q, . . . , fnp x q stands for g f px , . . . , x q, . . . , f px , . . . , x q . 1 1 p n 1 p ` ˘ ` p pq p p`2q ˘ p p`1q recursion: Given g P N N and h P N N , there exists a unique f P N N such that for all ÝÑ p x P N and y P N satisfies (1) fpÝÑx , 0q “ gpÝÑx q

(2) fpÝÑx , y ` 1q “ h ÝÑx , y, fpÝÑx , yq

We say f is defined by` recursion on˘ both g (for the initial step) and h (for the successor steps).

Definition 69 The set of primitive recursive ( rim. ec.) functions is the least that P R (1) contains:

p p pq ÝÑ (a) All constants N ÝÑ N (all i P N N s.t. ip x q “ i – any i, p P N). p (b) All projections πi (any p P N, any 1 ď i ď p) (c) The successor function S P NN.

(2) and is closed under

(a) composition (b) recursion

We set up these functions in a hierarchy pRnqnPN:

(1) R0 is the set of all functions in (1)(a),(1)(b) and (1)(c).

2 (2) Rn`1 is the closure of Rn under (2)(a) and (2)(b). Clearly R “ Rn. nP ďN

Example 70

2 Rn`1 “ Rn Y th obtained by composition on the basis of functions in Rnu Y th obtained by induction on the basis of functions in Rnu. Recursivity 53

(1) Addition: px, yq ÝÑ x ` y We have: x ` 0 “ x (3.1) x ` py ` 1q “ px ` yq ` 1. " Formally: 1 addpx, 0q “ π1pxq 3 (3.2) # addpx, y ` 1q “ S π3 x, y, addpx, yq . ´ ` ˘¯ (2) Multiplication: px, yq ÝÑ x ¨ y We have x ¨ 0 “ 0 (3.3) x ¨ py ` 1q “ x ¨ y ` x. " Formally:

multpx, 0q “ 0pxq 3 3 (3.4) # multpx, y ` 1q “ add π3 x, y, multpx, yq , π1 x, y, multpx, yq . ´ ` ˘ ` ˘¯ (3) Exponentiation: x ÝÑ nx We have n0 “ 1 (3.5) nx`1 “ nx ¨ n. " Formally: expnp0q “ 1 2 (3.6) # expnpx ` 1q “ mult π2 x, expnpxq , n . ´ ` ˘ ¯ (4) Factorial: x ÝÑ x! We have 0! “ 1 (3.7) px ` 1q! “ x! ¨ px ` 1q. " Formally: factp0q “ 1 2 2 (3.8) $ factpx ` 1q “ mult π2 x, factpxq ,S π1 x, factpxq . & ˆ ˙ ` ˘ ´ ` ˘¯ % 54 G¨odel& Recursivity

2 Example 71 We define ´9 P NpN q by

x ´9 y “ x ´ y if x ą y, “ 0 otherwise. " 2 We show that ´9 P NpN q belongs to rim. ec. by first showing that : x ÝÑ x ´9 1 belongs to P R rim. ec. P R 0 ´9 1 “ 0 (3.9) px ` 1q ´9 1 “ x " Formally: 0 ´9 1 “ 0pxq 2 (3.10) px ` 1q ´9 1 “ π x, x ´9 1 " 1 x ´9 0 “ x ` ˘ (3.11) x ´9 py ` 1q “ x ´9 y ´9 1 " Formally: ` ˘ 1 x ´9 0 “ π1pxq 3 (3.12) # x ´9 py ` 1q “ π3 x, y, x ´9 y ´9 1 ´ ` ˘¯

p Definition 72 A set A Ď N is primitive recursive ( rim. ec.) if its characteristic function p pq P R (χA P N N ) is primitive recursive.

Example 73

(1) The set H is rim. ec. since χ “ 0 is rim. ec. P R H P R (2) The set N is rim. ec. since χ “ 1 is rim. ec. P R N P R

(3) The set ă “ tpx, yq | x ă yu is rim. ec. χă px, yq “ 1 ´9 p1 ´9 py ´9 xqq. N P R N

On computable and partial functions

Definition 74

p p (1) pdomf , fq is a partial function N ÝÑ N if f is a mapping domf ÝÑ N where domf Ď N .

p p (2) pdomf , fq is a total function N ÝÑ N if domf “ N holds. Recursivity 55

We say that f is undefined on x – or fpxq is undefined – if x R domf .

pdomĎ pq p Notation 75 We write f P N N for pdomf , fq is a partial function N ÝÑ N whose domain is domf .

dom p Notice that given any two partial functions f, g P Np ĎN q,

domf “ domg f “ g ðñ and $ & @x fpxq “ gpxq. %

dom p Definition 76 A partial function f P Np ĎN q is “Turing Computable” (TC) if there exists ÝÑ a TM such that on input x “ px1, . . . , xpq: M (1) if fpÝÑx q is not defined, then pÝÑx q Ò; M ÝÑ ÝÑ ÝÑ (2) if p x q P domf , p x q Ó with fp x q written on its tape. M

dom p Proposition 77 Given any partial function f P Np ĎN q,

ÝÑ ÝÑ f is Turing Computable ðñ Gf “ x , fpxq | x P domf is Turing Recognizable.

Proof of Proposition 77: ` ˘ ( ÝÑ (ñ) From that computes f it is immediate to build that recognises Gf . On input p x , yq M ÝÑ N it simulates if p x , yq Ó acc. it compares fpxq with y and if fpxq “ y it accepts, otherwise M M it rejects.

ÝÑ (ð) From that recognises Gf , we build that computes f as follows, on input x repeatedly N M for i “ 1, 2, 3,... it recursively simulates on pÝÑx , 0q, pÝÑx , 1q, pÝÑx , 2q,..., pÝÑx , iq for i many N steps. If accepts pÝÑx , nq, then prints out the value n. N M % 77

p Corollary 78 Given any function f : N ÝÑ N,

f is both total and Turing Computable ùñ Gf is recursive (decidable).

Proof of Corollary 78: Left as an immediate exercise. % 78 56 G¨odel& Recursivity

p dom p f P NpN q f P Np ĎN q

recursive rec. enum. p`1 Gf Ď N || || decidable Turing rec.

Figure 3.1: Relations between Turing computable functions and their graphs

Remark 79 All functions in R0 are total and Turing computable. By induction on n, it is easy to show that all functions in Rn are also total and Turing computable. Therefore ˝ All rim. ec. functions are total and Turing computable. P R ˝ All graphs of rim. ec. functions are recursive P R Even though the class of all rim. ec. functions is included in the class of total and turing P R computable functions, the inverse inclusion does not hold3.

3.2 Variable Substitution

Proposition 80 ( rim. ec. closed under variable substitution) p P R p If f P NpN q, is rim. ec., then given any σ : t1, . . . , pu ÝÑ t1, . . . , pu, the function g P NpN q P R defined by

gpx1, . . . , xpq “ fpxσp1q, . . . , xσppqq is also rim. ec. P R

Proof of Proposition 80: The result is proved for all g P Rn by induction on n. Left as an exercise. % 80

k p kq Proposition 81 If A Ď N is rim. ec. and f1, . . . , fn P N N are rim. ec. then P R P R ÝÑ p ÝÑ ÝÑ t x P N | pf1p x q, . . . , fnp x qq P Au is rim. ec. P R 3 p 2q see exercise on the Ackermann function A P N N defined by n ` 1 if m “ 0, Apm, nq “ Apm ´ 1, 1q if m ą 0 and n “ 0, $ & A m ´ 1,Apm, n ´ 1q if m ą 0 and n ą 0. Apm, nq is fast growing ; for instance% 2`¨ 1019728 ă Ap4, 2q 㢠3 ¨ 1019728. Recursivity 57

ÝÑ p ÝÑ ÝÑ Proof of Proposition 81: Set B “ t x P N | pf1p x q, . . . , fnp x qq P Au. We have ÝÑ ÝÑ ÝÑ χBp x q “ χA f1p x q, . . . , fnp x q . ´ ¯ % 81

p Example 82 If f, g P NpN q are rim. ec., then the following sets are also rim. ec.: P R P R (1) tÝÑx | fpÝÑx q ą gpÝÑx qu (2) tÝÑx | fpÝÑx q “ gpÝÑx qu (3) tÝÑx | fpÝÑx q ă gpÝÑx qu.

p p Proposition 83 If A, B Ď N are rim. ec. then A Y B,A X B,A r B, A∆B and N r A P R are all rim. ec. P R Proof of Proposition 83:

χAYB “ 1 ´9 1 ´9 pχA ` χBq χ “ χ ¨ χ AXB A ` B ˘ χArB “ χA ¨ 1 ´9 χB

χA∆B “ 1 ´9 `χA ¨ χB˘ ¨ 1 ´9 1 ´9 χA ¨ 1 ´9 χB ˆ ˙ χAc `“ 1 ´9 χA. ˘ ´` ˘ ` ˘¯

% 83

p pN q p Proposition 84 (Case study) If f1, . . . , fn`1 P N and A1,...,An P N are all rim. ec., p P R then g P NpN q defined by: ÝÑ ÝÑ f1p x q if x P A1 ÝÑ ÝÑ f2p x q if x P A2 r A1 $ ÝÑ ÝÑ ’ f3p x q if x P A3 r pA1 Y A2q ’ . . . ÝÑ ’ . . . gp x q “ ’ . . . ’ ÝÑ ÝÑ &’ fip x q if x P Ai r pA1 Y A2 Y ... Y Ai´1q . . . ’ . . . ’ ÝÑ ÝÑ ’ fn`1p x q if x R pA1 Y ... Y Anq ’ ’ is also rim. ec. %’ P R

A 84 Proof of Proposition 84: g “ f1 ¨ χA1 ` f2 ¨ χpA2rA1q ` ... ` fn`1 ¨ χ . % A1YA2Y...YAn ` ˘ Corollary 85 sup(x1, . . . , xn) and inf(x1, . . . , xn) are rim. ec. P R 58 G¨odel& Recursivity

Proof of Corollary 85: Left as an exercise. % 85

p`1 p Proposition 86 f P NpN q is rim. ec., then g, h P NpN q below are rim. ec.: P R P R t“y gpx1, . . . , xpq “ fpx1, . . . , xp, tq, t“0 ÿ t“y hpx1, . . . , xpq “ fpx1, . . . , xp, tq. t“0 ź Proof of Corollary 86: Left as an exercise(both are easily defined by induction). % 86

3.3 Bounded Minimisation and Bounded Quantification

p 1 p`1 Proposition 87 (Bounded minimisation) If A Ď N ` is rim. ec., then f P NpN q P R defined below is also rim. ec.: P R 0 if @t ď z pÝÑx , tq R A, fpÝÑx , zq “ the least t ď z such that pÝÑx , tq P A otherwise. " fpÝÑx , zq is denoted by µt ď z pÝÑx , tq P A.

Proof of Proposition 87: f is defined by: fpÝÑx , 0q “ 0 y“z ÝÑ ÝÑ $ fp x , zq if χAp x , yq ě 1 y 0 ’ $ “ ’ yř“z ’ ’ ÝÑ ÝÑ ’ fpÝÑx , z ` 1q “ ’ z ` 1 if χAp x , yq “ 0 and p x , z ` 1q P A ’ ’ y“0 & ’ & yř“z`1 ’ ÝÑ ’ ’ 0 if χAp x , yq “ 0. ’ ’ y“0 ’ ’ ’ ’ ř %’ %’ % 87

Proposition 88 ( rim. ec. closed under bounded quantification) The set of all rim. ec. P R p 1 P R predicates is closed under bounded quantification: i.e. If A Ď N ` is rim. ec., then P R ˝ tpÝÑx , zq : Dt ď z pÝÑx , tq P Au˝ tp ÝÑx , zq : @t ď z pÝÑx , tq P Au are both rim. ec. P R Proof of Proposition 88: Set Recursivity 59

˝ B “ tpÝÑx , zq : Dt ď z pÝÑx , tq P Au, ˝ C “ tpÝÑx , zq : @t ď z pÝÑx , tq P Au.

We have

t“z t“z ÝÑ ÝÑ ÝÑ ÝÑ ˝ χBp x , zq “ 1 ´9 p1 ´9 χAp x , tqq, ˝ χC p x , zq “ χAp x , tqq. t“0 t“0 ř ś % 88

Example 89

˝t 2n : n P Nu is rim. ec. It is defined by recursion P R χp0q “ 0 χ “ 1 ´9 χ " pn`1q pnq

2 x ˝ The mapping P NpN q px, yq ÝÑ defined below is rim. ec.: y P R „  x “ 0 if y “ 0 y $ „  x “ integer part of otherwise. &’ y

Formally %’ x “ 0 if y “ 0 y $ „  & “ µt ď x y ¨ pt ` 1q ą x otherwise. ˝ px, yq | y divides x %P rim. ec.: P R ( x χpx, yq “ 1 ´9 x ´9 y ¨ . y ˜ ˆ „ ˙ ¸

˝ Prime “ tx P N | x is a prime numberu P rim. ec.: P R x ą 1 $ ’ and ’ ’ ’ x P Prime ðñ ’ y “ 1 ’ ’ or & $ @y ď x y “ x ’ ’ ’ or ’ &’ ’ ’ y does not divide x. ’ ’ ’ ’ %’ %’ 60 G¨odel& Recursivity

th ˝ Π: N ÝÑ N defined by Π pnq “ n ` 1 prime number P rim. ec.. P R Π p0q “ 2 Π pn ` 1q “ µz ď pΠ pnq! ` 1q z ą Π pnq and z P Prime. "

3.4 Coding Sequences of Integers

We define rim. ec. functions that allow to treat finite sequences of integers as integers. P R Every sequence xx1, . . . , xpy will be “coded” by a single integer αppx1, . . . , xpq. And from this single integer αppx1, . . . , xpq one will be able to recover the elements of the original sequence by having rim. ec. functions βi that satisfy P R p

i βp αppx1, . . . , xpq “ xi. ´ ¯

1 2 p N Proposition 90 For every non-zero p P N there exists rim. ec. functions βp , βp , . . . , βp P N p pq P R and αp P N N such that p 1´1 and onto αp : N ÐÝÝÝÝÝÝÝÝÑ N $ ’ and ’ &’ ´1 1 p αp pxq “ βp pxq, . . . , βp pxq . ’ ’ %’ ` ˘ 1 Proof of Proposition 90: We start by defining α1 “ β1 “ id. Then we move on to

px ` yq ¨ px ` y ` 1q α2px, yq “ ` y. 2

This is obtained by looking at the following picture and noticing that

(1) α2px, yq “ α2px ` y, 0q ` y, and

(2) α2px ` y, 0q “ 1 ` 2 ` ¨ ¨ ¨ ` px ` yq

1 2 x ` y 1 “ 2 ` ` ` ` ¨ ¨ ¨ ` ` . ˜ x ` y x ` y ´ 1 1 ¸ Recursivity 61

0,4

14 19

0,3 1,3 2,3

9 13 18

0,2 1,2 2,2 3,2

5 8 12 17

0,1 1,1 2,1 3,1 4,1 2 4 7 11 16

0,0 1,0 2,0 3,0 4,0 5,0 0 1 3 6 10 15

We have

1 (1) β2 pnq “ µx ď n Dt ď n α2px, tq “ n

2 (2) β2 pnq “ µy ď n Dt ď n α2pt, yq “ n.

1 2 p´1 p p`1 Then we define αp`1, βp`1, βp`1, ...... , βp`1 , βp`1 and βp`1 by induction on p P N:

˝ αp`1px1, . . . , xp, xp`1q “ αp x1, . . . , xp´1, α2pxp, xp`1q

1 1 ` ˘ ˝ βp`1 “ βp ;

2 2 ˝ βp`1 “ βp ;

. .

p´1 p´1 ˝ βp`1 “ βp ;

p 1 p ˝ βp`1 “ β2 ˝ βp ;

p`1 2 p ˝ βp`1 “ β2 ˝ βp .

% 90 62 G¨odel& Recursivity

Example 91 A different way of coding sequences of integers:

cpεq “ 1 cpx , . . . , x q “ Π p0qx0`1 ¨ Π p1qx1`1 ¨ ¨ ¨ Π ppqxp`1. " 0 p From n P Nrt0u we recover the sequence xx0, . . . , xpy such that cpx0, . . . , xpq “ n by considering 2 the rim. ec. function d P NpN q which yields the exponents of the prime numbers: P R dpi, nq “ µx ď n Π piqx`1 does not divide n.

3.5 Partial Recursive Functions

We recall that

p p (1) pdomf , fq is a partial function N ÝÑ N if f is a mapping domf ÝÑ N where domf Ď N . p p (2) pdomf , fq is a total function N ÝÑ N if domf “ N holds.

We say that f is undefined on x – or fpxq is undefined – if x R domf . pdomĎ pq p We use the notation f P N N to signify that pdomf , fq is a partial function N ÝÑ N whose domain is domf . dom p Notice that for any two partial functions f, g P Np ĎN q:

domf “ domg f “ g holds ðñ and $ & @x fpxq “ gpxq.

% pdomĎ pq pdomĎ nq Definition 92 (composition) Given f1, . . . , fn P N N and g P N N , the composi- p pq tion h “ gpf1, . . . , fnq P N N is defined by ÝÑ x R domfi 1ďiďn $ $ č ’ ÝÑ is undefined iff ’ ’ hp x q ’ or otherwise ’ ’ ’ &’ ’ &’ ÝÑ ÝÑ ’ f1p x q, . . . , fnp x q R domg. ’ ’ ’ ’ ÝÑ %’ ` ÝÑ ˘ÝÑ ÝÑ ’ hp x q is defined otherwise and hp x q “ g f1p x q, . . . , fnp x q . ’ ’ %’ ` ˘ “ g f1px1, . . . , xpq, . . . , fnpx1, . . . , xpq ` ˘ Recursivity 63

dom p dom p`2 Definition 93 (recursion) Given g P Np ĎN q and h P Np ĎN q, there exists a unique pdomĎ p`1q ÝÑ p f P N N such that for all x P N and y P N:

(1) ÝÑ ÝÑ fp x , 0q is undefined if x R domg and $ ÝÑ ÝÑ ÝÑ & fp x , 0q is defined otherwise with fp x , 0q “ gp x q. (2) % ÝÑ p x , yq R domf

$ ÝÑ $ ’ fp x , y ` 1q is undefined if ’ or ’ ’ ’ &’ ’ ÝÑ ÝÑ ’ x , y, fp x , yq R domh. &’ ’ ’ and%’ ` ˘ ’ ’ ÝÑ ÝÑ ÝÑ ÝÑ ’ otherwise fp x , y ` 1q is defined and fp x , y ` 1q “ h x , y, fp x , yq . ’ ’ %’ ` ˘

dom p`1 dom p Definition 94 (minimization) Given f P Np ĎN q, we define g P Np ĎN q by:

gpÝÑx q “ µy fpÝÑx , yq “ 0.

Notice that fpÝÑx , zq is defined! $ @z ă y $ and ’ ’ ÝÑ ÝÑ ’ & fp x , zq ą 0 gp x q “ y ðñ ’ ’ &’ ’ % and ’ ÝÑ ’ fp x , yq “ 0. ’ ’ %’

Definition 95 (partial recursive functions) The set of partial recursive ( art. ec.) func- P R tions is the least that

(1) contains:

p p pq ÝÑ (a) All constants N ÝÑ N (all i P N N s.t. ip x q “ i – any i, p P N). p (b) All projections πi (any p P N, any 1 ď i ď p) (c) The successor function S P NN.

(2) and is closed under 64 G¨odel& Recursivity

(a) composition (b) recursion (c) minimisation.

Our next goal is to show that a function f is in art. ec. if and only if it is Turing computable. P R One direction is easy, the other one is more involved. One side effect of our proof will show that every partial recursive function can be obtained by applying the minimisation at most once.

Lemma 96 Every partial recursive function is Turing computable.

dom p Proof of Lemma 96: We need to show that given any p P N r t0u and any f P Np ĎN q there exists some Turing machine that computes f. This means that on input pn1, . . . , npq it M stops in configuration qacc.fpn1, . . . , npq if pn1, . . . , npq P domf , and it never stops otherwise. Of course, we need to fix a certain representation of both integers and finite sequence of integers. For simplicity, let us say that the integers are represented in base-ten and the sequences as pn1, . . . , npq so that the input alphabet is

Σ “ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, p, q,, . ! ) So, for instance a TM computes Add if on input word “p385, 218q” it returns the word “603”. We do the proof by induction on the number of operation among

˝ composition ˝ recursion ˝ minimisation

dom p that are necessary to obtain f P Np ĎN q on the basis of

˝ all constants ˝ all projections ˝ the successor function.

(1) It is quite obvious that

dom p ˝ if f P Np ĎN q is constant, then there exists some basic TM that computes it. p ˝ Every projection πi (any 1 ď i ď p) is also trivially computable. ˝ The successor function is clearly computable as well.

p pdomĎN q (2) (a) Assume f1, . . . , fn P N are computed respectively by f1 ,..., fn and g P pdomĎ nq p Mpq M N N is computed by g. Then f “ gpf1, . . . , fnq P N N is computed by f M M which works as follows: ÝÑ on input x “ pn1, . . . , npq: ÝÑ ÝÑ successively for each i :“ 1,..., n f simulates f on input x , if f p x q Ó acc. M M i M i with some output mi it stores mi.

(In case all simulation of machines f ,..., f do stop) f finally simulates g M 1 M n M M on input pm1, . . . , mnq.

It is clear that if either Recursivity 65

ÝÑ ÝÑ ÝÑ (A) x R domfi or (B) f1p x q, . . . , fnp x q R domg, 1ďiďn č ´ ¯ ÝÑ ÝÑ then f p x q Ò. In the opposite case, f p x q Ó acc. with the right answer. M M pdomĎ pq pdomĎ p`2q (b) Assume g P N N and h P N N are computed respectively by g and M h. Then f defined by recursion: M (A) fpÝÑx , 0q “ gpÝÑx q (B) fpÝÑx , y ` 1q “ h ÝÑx , y, fpÝÑx , yq

is computed by f which works as follows: M ` ˘ ÝÑ ÝÑ ˝ on input p x , 0q it simply simulates g on input x , and ÝÑ M ÝÑ 4 ÝÑ ˝ on input p x , n ` 1q f first simulates g on input x which gives fp x , 0q. M M Then ÝÑ ÝÑ 5 recursively for i :“ 0,..., n f simulates h on x , i, fp x , iq which yields M M fpÝÑx , i ` 1q. ` ˘ ÝÑ It is clear that f brings the result if and only if every step fp x , iq (i :“ 0, . . . , n`1) M is defined. Otherwise it simply never stops. pdomĎ p`1q ÝÑ (c) Assume g P N N is computed by g. We design f that on input x M M computes µy gpÝÑx , yq “ 0. ÝÑ set i :“ 0 f simulates g on input p x , iq. If g stops and outputs the value of M M M gpÝÑx , iq, ÝÑ ˝ if gp x , iq “ 0 f stops and outputs i, ÝÑ M ˝ if gp x , iq ‰ 0, f starts over again with i :“ i ` 1. M ÝÑ Notice that f stops and outputs n “ µy gp x , yq “ 0 if and only if M ÝÑ ˝@ i ď n p x , iq P domg, ˝@ i ă n gpÝÑx , iq ą 0 and ˝ gpÝÑx , nq “ 0.

% 96

dom p Lemma 97 Every Turing computable partial function f P Np ĎN q is art. ec. P R Proof of Lemma 97: We show an even stronger result: given any Turing Machine and any M recursive coding of words on the tape alphabet Γ we show that the partial function Σ˚ ÝÑ Γ˚ which maps v P Σ˚ to w P Γ˚ if and only if the Turing machine from the initial configuration

4 ÝÑ in case Mgp x q Ó .acc. 5 ÝÑ ÝÑ in case Mh x , i, fp x , iq Ó acc. . ` ˘ 66 G¨odel& Recursivity

q0v stops in some configuration w0qacc.w1 with w0w1 “ w is partial recursive in the code. This dom 1 means the function f 1 P Np ĎN q defined by

1 f codepvq is undefined if pvq Ò or pvq Ó rej. ; M M 1 # f `codepvq˘ “ codepw0w1q if Ó acc. in config. w0qacc.w1. M ` ˘ We first choose a coding of the configurations of : We assume M ˝ Σ “ t1, . . . , k ´ 1u and Γ “ t0, . . . , k ´ 1u with k ą 1 and necessarily 0 “\.

˝ Q “ tq0, . . . , qmu with q0, q1, q2 being respectively the initial state, the rejecting state and the accepting state.

The coding of a word w “ a0 . . . an that we choose is

i xa0 . . . any “ ai ¨ k . 0ďiďn ÿ This coding is not injective (this will not matter for our purpose) for any two word which differ by the tailing blanks in their prefix will have the same encoding:

xa0 . . . any “ xa0 . . . an\y.

But on the other hand, this encoding is surjective. A configuration w0qrw1 of the Turing machine will be coded by

xw0qrw1y “ α4pr, xw0y, xw1y, |w0|q. For instance, that the initial configuration of the Turing machine with input w is:

xq0wy “ α4p0, 0, xwy, 0q

“ α2 0, α2 0, α2pxwy, 0q ´ ` xwypxwy`1q ˘¯ “ α2 0, α2 0, 2 ´ xwypxwy`1q xwypxw¯y`1q ` 2 ˘2 `1 “ α2 0, 2 ` ˘` ˘ ´xwypxwy`1q xwypxwy`1q ¯xwypxwy`1q xwypxwy`1q `1 `1 2 2 ¨ 2 2 `1 ¨ 2 ˛ ¨ 2 ˛ ` ˘` ˘ ` ˘` ˘ “ ˝ ‚˝2 ‚. To say that w is an input word is to say that w P Σ˚ (we will identify words of the form w P Σ˚ with words of the form w \ ... \ since our coding will not be able to distinguish them6 and also because the input word really is the infinite word w \ ... \ ...).

6remember that this is the reason why we chose 0 for the coding of the blank symbol. Recursivity 67

˚ So we see that a word w “ a0 . . . an P Γ is an input word if for no i ă n we have both ai “\ and 0 1 n ai`1 ‰\. This means that xa0 . . . any “ a0 ¨ k ` a1 ¨ k ` ... ` an ¨ k satisfies ai “ 0 ñ ai`1 “ 0 (any i ă n). With our coding, we recover the coefficient ai as

xa0 . . . any xa0 . . . any ai “ ´9 ¨ k . ki ki`1 „  ˆ„  ˙ Therefore the set Input of all the codes of input words of is rim. ec.: M M P R

m m m m if 9 9 χInput pmq “ 1 @i ď m i ´ i`1 ¨ k “ 0 ùñ i`1 ´ i`2 ¨ k ą 0 M k k k k “ 0 otherwise ” ı ´” ı ¯ ” ı ´” ı ¯

Since the coding of words that we choose is surjective, it comes that a configuration C is an initial configuration if and only if there exists m P Input M

mpm`1q mpm`1q mpm`1q mpm`1q 2 2 `1 2 2 `1 2 ¨ 2 ` 1 xCy “ ˆ` ˘` ˘˙ ˆ` ˘` ˘ ˙. 2 Therefore the set Init of all the codes of initial configurations of is rim. ec. M M P R

1 if Dm ď c χInput pmq “ 1 ^ α4p0, 0, m, 0q “ c , M χInit pcq “ M $ 0 otherwise. ` ˘ & % We now describe the transition from a given configuration C to the next configuration C1 (C ñ C1), in other words, we analyse the we obtain the code of C1 on the basis of both the code of C and the transition function δ. A transition yields a move of the head either to the right or to the left: δpqr, alq “ pqr1 , al1 ,Rq or δpqr, alq “ pqr1 , al1 ,Lq. We need to consider differently these two forms, together with differen- tiating also whether the head can or cannot move to the left when the transition function says so7.

1 1 1 When δpqr, alq “ pqr1 , al1 , Rq, we have C ñ C is w0qrw1 ñ w0qr1 w1 with

1 1 1 (1) w0 “ w0al1 (2) |w0| “ 1 ` |w0| (3) alw1 “ w1.

so that

4 1 1 |w0| 2 1 β pxCyq (1) xw0y “ xw0y ` l ¨ k “ β4 pxCyq ` l ¨ k 4

7this means whether or not the head is already in position 0 and the transition is of the form

δpqr, alq “ pqr1 , al1 ,Lq. 68 G¨odel& Recursivity

1 4 (2) |w0| “ |w0| ` 1 “ β4 pxCyq ` 1

3 1 1 β4 pxCyq (3) a w “ w1 so that xw y “ . l 1 1 k „  So, we obtain:

1 β4 pxCyq “ r $ and if ’ ’ 3 ’ 3 β4 pxCyq & β pxCyq ´9 k ¨ “ l, 4 k ’ ˆ „ ˙ ’ %’

then

3 1 1 2 1 β4pxCyq β4 pxCyq 4 xC y “ α4 r , β pxCyq ` l ¨ k 4 , , β pxCyq ` 1 . 4 k 4 ˆ „  ˙

When δpqr, alq “ pqr1 , al1 , Lq, there are two different cases depending on whether the head can move to the left or not.

1 1 1 if w0 “ ε, then we have C ñ C is w0qrw1 ñ w0qr1 w1 with 1 (1) w0 “ ε 1 (2) |w0| “ |w0| “ |ε| 1 (3) w1 “ al1 v and w1 “ alv for some word v. So that we get

1 3 (1) xw y “ xεy “ 0 β4 pxCyq 0 (3) xw1 y “ l1 ` ¨ k. 1 k 1 „  (2) |w0| “ |ε| “ 0

So, all in all we obtain: Recursivity 69

1 β4 pxCyq “ r $ and ’ ’ 3 ’ 3 β4 pxCyq ’ β pxCyq ´9 k ¨ “ l, if ’ 4 ’ k &’ ˆ „ ˙ and ’ ’ 4 ’ β4 pxCyq “ 0 ’ ’ %’

then

3 1 1 1 β4 pxCyq xC y “ α4 r , 0, l ` ¨ k, 0 . k ˆ „  ˙ 1 1 1 if w0 ‰ ε, then we have C ñ C is w0qrw1 ñ w0qr1 w1 with

1 1 (1) w0al “ w0 (3) w1 “ al1 w1. 1 (2) |w0| “ |w0| ´ 1

so that 2 1 2 β4 pxCyq β4pxCyq´9 1 (1) xw y “ β pxCyq ´9 ¨ kp 4 q 0 4 pβ4pxCyq´9 1q „k 4  1 4 (2) |w0| “ β4 pxCyq ´9 1

1 1 3 (3) xw1y “ l ` β4 pxCyq ¨ k.

So, we have found:

1 β4 pxCyq “ r $ and ’ ’ 3 ’ 3 β4 pxCyq ’ β pxCyq ´9 k ¨ “ l, if ’ 4 ’ k &’ ˆ „ ˙ and ’ ’ 4 ’ β4 pxCyq ‰ 0 ’ ’ %’ 70 G¨odel& Recursivity

then

2 β pxCyq 4 1 1 2 4 pβ4 pxCyq´9 1q 1 3 4 xC y “ α4 r , β4 pxCyq ´9 ¨ k , l ` β4 pxCyq ¨ k, β4 pxCyq ´9 1 . pβ4pxCyq´9 1q ˆ „k 4  ˙ 2 To wrap up everything that we did so far, we recursively define a mapping f : N ÝÑ N such ˚ that if n codes a word on Σ – i.e. n “ xwy for some w P Σ – then fpn, tq “ xCn,ty where Cn,t stands for the configuration that the Turing machine reaches after t-many steps from the initial configuration q0w. Since the machine stops if it reaches an accepting or a rejecting configuration, we will simply assume that in any of these two cases the configuration of the Turing machines remains the same: if Cn,t is either an accepting or a rejecting configuration, then Cn,t`x “ Cn,t holds for every x P N. 4 We set δL and δR are the two following finite – hence rim. ec. – subsets of N : P R 1 1 1 1 δL “ pr, l, r , l q P t0, . . . mu ˆ t0 . . . k ´ 1u ˆ t0, . . . mu ˆ t0 . . . k ´ 1u δpr, lq “ pr , l ,Lq ! ) and δR “ t0, . . . mu ˆ t0 . . . k ´ 1u ˆ t0, . . . mu ˆ t0 . . . k ´ 1u r δL. 2 For our convenience we assume that Γ “ Σ Y t\u. This way the mapping f : N ÝÑ N we 2 i pN q i currently construct is total (f P N ). For readability we use the notation k for β4pkq (any k P N, i ď 4). initial case

1 if n R InputM fpn, 0q “ $ α4p0, 0, n, 0q if n P InputM &’

%’ successor case

1 1 fpn, tq if fpn, tq “ 1 or fpn, tq “ 2; $ ’ ’ ’ ’ ’ 3 3 ’ 4 ’ 1 2 1 fpn,tq fpn, tq 4 1 3 fpn, tq 1 1 ’ α4 r , fpn, tq ` l ¨ k , , fpn, tq ` 1 if fpn, tq , fpn, tq ´9 k ¨ , r , l P δR; ’ k k ’ ˜ « ff ¸ ˜ ˜ « ff¸ ¸ ’ ’ ’ ’ ’ ’ ’ ’ 3 ’ 1 3 fpn, tq 1 1 ’ fpn, tq , fpn, tq ´9 k ¨ , r , l P δL ’ k ’ 3 $ ˜ ˜ « ff¸ ¸ fpn, t`1q “ ’ 1 1 fpn, tq ’ ’ α4 r , 0, l ` ¨ k, 0 if ’ ’ ˜ « k ff ¸ ’ and & &’ 4 ’ f n, t 0; ’ ’ p q “ ’ ’ ’ ’ ’ %’ ’ ’ ’ ’ ’ 3 ’ 1 3 f n, t ’ p q 1 1 ’ fpn, tq , fpn, tq ´9 k ¨ , r , l P δL ’ 2 k ’ 4 $ ˜ ˜ « ff¸ ¸ ’ 1 2 fpn, tq fpn,tq ´9 1 1 3 4 ’ α r , f n, t 9 k , l f n, t k, f n, t 9 1 if ’ ’ 4 p q ´ 4 ¨ ` p q ¨ p q ´ ’ ’ ˜ « fpn,tq ´9 1 ff ´ ¯ ¸ ’ and ’ k &’ ’ ´ ¯ ’ 4 ’ ’ fpn, tq ‰ 0. ’ ’ ’ ’ ’ %’ %’ 72 G¨odel& Recursivity

2 pN q Notice that f P N is rim. ec. and that pwq Ó acc. if and only if there exists some t P N 1 P R M such that β4 fpxwy, tq “ 2. Moreover, in this case, we recover the code of the content of the tape w from fpxwy, tq by ` ˘ t

4 2 β4 fpxwy,tq 3 xwty “ β4 fpxwy, tq ` k ¨ β4 fpxwy, tq . ` ˘ ` ˘ ` ˘ Finally, we only need to fix both (1) a recursive representation of the natural numbers and (2) what it means for a machine to compute a partial function.

(1) we fix our coding of integers: every integer n is coded by the word 11 ... 1. The function n loomoon x y : N ÝÑ N n ÞÝÑ xny

such that xny “ 1 ¨ ki (i.e. xny is the code of the word 11 ... 1) is rim. ec.: P R iăn ÿ n x0y “ 0 loomoon

$ xn ` 1y “ xny ` kn. & % n (2) We only consider Turing machines that on any input words of the form 11 ... 1, provided they reach an accepting configuration, they reach one of the form 11 ... 1hkkikkjqacc.. n1 dom r We define the function f P Np ĎN q that computes by: loomoon M M

αrpn1,...,nrq

˝ f pn1, . . . , nrq is undefined if on input 11 ... 1 either Ò or Ó rej. ; M M M αrpn1,...,nrqhkkikkj

˝ f pn1, . . . , nrq “ n if on input 11 ... 1 Ó acc. in configuration 11 ... 1 qacc.. M M hkkikkj n

r loomoon Then the function least P pdomĎN q that picks the minimum number of steps – if any M N – the machine takes before reaching an accepting configuration when starting from the initial one q0 11 ...... 1 is defined by

αrpn1,...,nrq loooomoooon 1 least pn1, . . . , nrq “ µt β ˝ f xαrpn1, . . . , nrqy, t “ 2. M 4 ` ˘ It is undefined if the machine never halts or halts on the rejecting state. Recursivity 73

r At last, we are ready to provide the desired f P pdomĎN q. We make use of the fact the M N position of the head in an accepting configuration indicates precisely the number of 1’s there are on the tape:

4 f pn1, . . . , nrq “ β ˝ f xαrpn1, . . . , nrqy, least pn1, . . . , nrq . M 4 M ´ ¯ % 97

Corollary 98 Every partial recursive function admits a construction that requires at most once minimisation.

Proof of Corollary 98: This is an immediate consequence of the whole proof of Lemma 97. % 98

dom k Theorem 99 For every k ą 0 and every f P Np ĎN q the following are equivalent ˝ f is art. ec., P R ˝ f is Turing computable.

Proof of Theorem 99: Follows immediately from Lemmas 96 and 97. % 99 74 G¨odel& Recursivity Part II

Arithmetic

Chapter 4

Representing Functions

4.1 Robinson Arithmetic

We start by describing a first order theory called Robinson Arithmetic. The language we consider is A “ t0,S, `, ¨u where L (1)0 is a constant symbol,

(2) S is a unary function symbol1,

(3) ` and ¨ are binary function symbols2.

The axioms are axiom 1. @xSx ‰ 0 axiom 2. @x Dy px ‰ 0 Ñ Sy “ xq axiom 3. @x @y pSx “ Sy Ñ x “ yq axiom 4. @x x`0 “ x axiom 5. @x @y x`Sy “ Spx`yq ´ ¯ axiom 6. @x x¨0 “ 0 axiom 7. @x @y x¨Sy “ px¨yq`x ´ ¯

1 for any terms of LA t, we use the notation St instead of Sptq. 2 for any terms of LA t0, t1, we use the notation t0`t1 (respectively t0¨t1) instead of `pt0, t1q (respectively ¨pt0, t1q). 78 G¨odel& Recursivity

Example 100 The standard model of Robinson Arithmetic is

N, 0, S, `, ¨ h i where S is the successor function, ` is the usual addition, and ¨ is the customary multiplication. By abuse of notation we identify N with the model N, 0, S, `, ¨ . So that, for instance, we will h i write N |ù φ instead of the correct notation N, 0, S, `, ¨ |ù φ. h i

Example 101 A very simple non standard model of Robinson arithmetic in which M

˝ S M admits a fixed point.

˝¨ M is not commutative.

“ N Y tau, 0MS M, `M, ¨M M h i Where0 M “ 0 and the operations S M, `M, ¨M are defined the usual way on the integers. i.e

˝ S M æ N “ S ˝` M æ N “ `˝¨ M æ N “ ¨

And when the unique non standard integer a is involved:

˝ S Ma “ a ˝ α¨Ma “ a (any α P N Y tau)

˝ a`Mα “ α`Ma “ a (any α P N Y tau)

˝ a¨M0 “ 0 ˝ a¨Mα “ a (any α P N r t0u Y tau) We verify that ` ˘ |ù ob. M R axiom 1. since the only non standard integer verifies S Ma “ a we have

|ù @xSx ‰ 0 M Arithmetic 79

axiom 2. since every standard integer from 0 has a predecessor, and S Ma “ a, so we have

|ù @x Dy px ‰ 0 Ñ Sy “ xq M axiom 3. holds for standard integers, and for every n P N we have S Ma ‰ S Mn, thus

|ù @x @y pSx “ Sy Ñ x “ yq M axiom 4. holds for standard integers, and we have a`M0 “ a, hence

|ù @x x`0 “ x M axiom 5. if k, n P N, then k`MS Mn “ S Mpk`Mnq holds. If α P N Y tau, we have

˝ a`MS Mα “ a ˝ α`MS Ma “ α`Ma “ a

˝ S Mpa`Mαq “ S Ma “ a ˝ S Mpα`Maq “ S Ma “ a

therefore we have |ù @x @y x`Sy “ Spx`yq . M ´ ¯ axiom 6. if α P N Y tau, we have α¨M0 “ 0. Thus

|ù @x x¨0 “ 0 M axiom 7. if k, n P N and α P N Y tau, then

˝ a¨MS Mα “ a ˝p a¨Mαq`Ma “ a ˝ k¨MS Mn “ pk¨Mnq`Mk

˝ α¨MS Ma “ a ˝p α¨Maq`Mα “ a

so we have

|ù @x @y x¨Sy “ px¨yq`x . M ´ ¯

Notation 102 For any integer n, we write n for the A-term S...S 0. L n loomoon Example 103 Let us show that the following holds for all integers k:

ob. $ @x 0`x “ k ÝÑ x “ k (4.1) R c ` ˘ 80 G¨odel& Recursivity

We will make use of the excluded middle:

$c @x x “ 0 _ x ‰ 0 and distinguish between the two cases. ` ˘ The proof is by induction on k: if k “ 0:

if x “ 0: since $c 0 “ 0 holds, we obtain

ob. $ 0`0 “ 0 ÝÑ 0 “ 0 R c

if x ‰ 0: by 2 @x Dy px ‰ 0 Ñ Sy “ xq it is enough to show

ob. $ @y 0`Sy “ 0 ÝÑ Sy “ 0 R c ` ˘ by 5 @x @y x`Sy “ Spx`yq this comes down to establishing ` ˘ ob. $ @y Sp0`yq “ 0 ÝÑ Sy “ 0 R c ` ˘ which is immediate by 1 @xSx ‰ 0 . if k “ n ` 1:

if x “ 0: we need to show

ob. $ 0`0 “ n ` 1 ÝÑ 0 “ n ` 1. R c By 4 @x x`0 “ x this comes down to showing

ob. $ 0 “ n ` 1 ÝÑ 0 “ n ` 1. R c because of 1 @xSx ‰ 0 we have

ob. $ 0 ‰ n ` 1 R c which yields the result. if x ‰ 0: by 2 @x Dy px ‰ 0 Ñ Sy “ xq it is enough to show

ob. $ @y 0`Sy “ n ` 1 ÝÑ Sy “ n ` 1 R c ` ˘ Arithmetic 81

by 5 @x @y x`Sy “ Spx`yq this comes down to establishing ` ˘ ob. $ @y Sp0`yq “ n ` 1 ÝÑ Sy “ n ` 1 R c which is exactly ` ˘ ob. $ @y Sp0`yq “ Sn ÝÑ Sy “ Sn R c by 3 @x @y pSx “ Sy Ñ x “`yq this amounts to showing ˘

ob. $ @y 0`y “ n ÝÑ Sy “ Sn . R c The induction hypothesis gives ` ˘

ob. $ @y 0`y “ n ÝÑ y “ n R c from where we immediately get what` we want. ˘

Example 104 Let us show that the following holds for all integers k:

ob. $ @x@y Sy`x “ k ÝÑ Spy`xq “ k . (4.2) R c We make use of the excluded middle: ` ˘

$c @x x “ 0 _ x ‰ 0 and distinguish between the two cases. ` ˘ if x “ 0: we need to show

ob. $ @y Sy`0 “ k ÝÑ Spy`0q “ k R c ` ˘ which is immediate by 4 @x x`0 “ x . if x ‰ 0: it is enough to show

ob. $ @y@z Sy`Sz “ k ÝÑ Spy`Szq “ k . R c The proof goes by induction on k: ` ˘

if k “ 0: we need to show

ob. $ @y@z Sy`Sz “ 0 ÝÑ Spy`Szq “ 0 . R c ` ˘ 82 G¨odel& Recursivity

By 5 @x @y x`Sy “ Spx`yq this comes down to ` ˘ ob. $ @y@z SpSy`zq “ 0 ÝÑ Spy`Szq “ 0 R c ` ˘ which trivially holds by 1 @xSx ‰ 0 . if k “ n ` 1: we need to show

ob. $ @y@z Sy`Sz “ n ` 1 ÝÑ Spy`Szq “ n ` 1 . R c ` ˘ By 5 @x @y x`Sy “ Spx`yq this comes down to ` ˘ ob. $ @y@z SpSy`zq “ Sn ÝÑ Spy`Szq “ n ` 1 . R c ` ˘ By 3 @x @y pSx “ Sy Ñ x “ yq this amounts to proving

ob. $ @y@z Sy`z “ n ÝÑ Spy`Szq “ n ` 1 . R c if z “ 0: we need to show ` ˘

ob. $ @y Sy`0 “ n ÝÑ Spy`S0q “ n ` 1 . R c ` ˘ By 4 @x x`0 “ x and 5 @x @y x`Sy “ Spx`yq this comes down to showing ` ˘ ob. $ @y Sy “ n ÝÑ SSy “ n ` 1 . R c which holds by definition. ` ˘ if z ‰ 0: what we need to prove is equivalent to

ob. $ @y@z1 Sy`Sz 1 “ n ÝÑ Spy`SSz 1q “ n ` 1 . R c ` ˘ By 3 @x @y pSx “ Sy Ñ x “ yq this comes down to showing

ob. $ @y@z1 Sy`Sz 1 “ n ÝÑ y`SSz 1 “ n . R c The induction hypothesis yields` ˘

ob. $ @y@z1 Sy`Sz 1 “ n ÝÑ Spy`Sz 1q “ n . R c ` ˘ from where we easily get the result by 5 @x @y x`Sy “ Spx`yq . ` ˘ Arithmetic 83

4.2 Representable Functions

p nq Definition 105 Let f P N N and φpx0, x1, . . . , xnq be any A-formula whose free variables are L among tx0, x1, . . . , xnu. φpx0, x1, . . . , xnq represents the function f if for all i1, . . . , in P N

ob. $c @x0 fpi1, . . . , inq“ x0 ÐÑ φpx0,i 1,...,i nq . R n ´ ¯ Definition 106 Let A Ď N and φpx1, . . . , xnq be any A-formula whose free variables are L among tx1, . . . , xnu. φpx1, . . . , xnq represents the set A if for all i1, . . . , in P N we have:

˝ if pi1, . . . , inq P A, then ob. $c φ i1,...,i n ; R

˝ if pi1, . . . , inq R A, then ob. $c `φ i1,...,i˘n . R n Proposition 107 For any A Ď N , ` ˘

A is representable if and only if χA is representable.

Proof of Proposition 107:

(ñ) If A is represented by φpx1, . . . , xnq, then χA is represented by

x0 “ 1 ^ φpx1, . . . , xnq _ x0 “ 0 ^ φpx1, . . . , xnq . ` ˘ ` ˘ (ð) If χA is represented by φpx0, x1, . . . , xnq, then A is represented by

φpS0, x1, . . . , xnq.

% 107

p nq Example 108 The constant function f P N N defined by fpi1, . . . , inq “ k (any i1, . . . , in P N) is represented by the following formula of the form φpx0,i 1,...,i nq:

x0 “ k.

It is enough to verify

ob. $c @x0 fpi1, . . . , inq“ x0 ÐÑ x0 “ k . R ´ ¯ which is exactly

ob. $c @x0 k “ x0 ÐÑ x0 “ k . R ´ ¯ 84 G¨odel& Recursivity

n n pN q Example 109 The projection πj P N is represented by the formula:

x0 “ ij.

It is enough to verify

n ob. $c @x0 π pi1, . . . , inq“ x0 ÐÑ x0 “ ij . R j ´ ¯ i.e.

ob. $c @x0 ij “ x0 ÐÑ x0 “ ij . R ´ ¯

Example 110 The successor S P NN is represented by the formula:

x0 “ Sx1.

It is enough to verify

ob. $c @x0 Spiq“ x0 ÐÑ x0 “ Si . R i.e. ´ ¯

ob. $c @x0 Si “ x0 ÐÑ x0 “ Si . R ´ ¯

2 Example 111 The addition ` P NpN q is represented by the formula:

x0 “ x1`x2.

It is enough to verify

ob. $c @x0 i1 ` i2 “ x0 ÐÑ x0 “ i1`i2 (4.3) R ´ ¯ The proof is by induction on i2: i2 “ 0 because of 4 @x x`0 “ x we have

ob. $c @x0 i1 “ x0 ÐÑ x0 “ i1`0 R ´ ¯ which is

ob. $c @x0 i1 ` 0 “ x0 ÐÑ x0 “ i1`0 . R ´ ¯ Arithmetic 85

i2 “ i ` 1 by 5 @x @y x`Sy “ Spx`yq we have ` ˘ ob. $c @x0 Spi1`iq “ x0 ÐÑ x0 “ i1`Si R ´ ¯ The induction hypothesis yields

ob. $c @x0 i1 ` i “ x0 ÐÑ x0 “ i1`i R ´ ¯ hence we obtain

ob. $c @x0 Spi1 ` iq “ x0 ÐÑ x0 “ i1`Si R ´ ¯ by the very definition of the terms involved we finally have

ob. $c @x0 i1 ` pi ` 1q“ x0 ÐÑ x0 “ i1`pi ` 1q . R ´ ¯

2 Example 112 The multiplication ¨ P NpN q is represented by the formula:

x0 “ x1¨x2.

It is enough to verify

ob. $c @x0 i1 ¨ i2 “ x0 ÐÑ x0 “ i1¨i2 . (4.4) R ´ ¯ The proof is by induction on i2: i2 “ 0 because of 6 @x x¨0 “ 0 we have

ob. $c @x0 0 “ x0 ÐÑ x0 “ i1¨0 R ´ ¯ which is

ob. $c @x0 i1 ¨ 0 “ x0 ÐÑ x0 “ i1¨0 . R ´ ¯ i2 “ i ` 1 by 7 @x @y x¨Sy “ px¨yq`x we have ` ˘ ob. $c @x0 i1¨Si “ x0 ÐÑ x0 “ pi1¨iq`i1 R ´ ¯ 86 G¨odel& Recursivity

which is exactly

ob. $c @x0 i1¨pi ` 1q“ x0 ÐÑ x0 “ pi1¨iq`i1 R ´ ¯ The induction hypothesis yields

ob. $c @x0 i1 ¨ i “ x0 ÐÑ x0 “ i1¨i R ´ ¯ so we have

ob. $c @x0 i1¨pi ` 1q“ x0 ÐÑ x0 “ pi1 ¨ iq`i1 R ´ ¯ by 7 @x @y x¨Sy “ px¨yq`x and (4.3) we have ` ˘ ob. $c @x0 pi1 ¨ iq ` i1 “ x0 ÐÑ x0 “ pi1 ¨ iq`i1 R ´ ¯ which is exactly

ob. $c @x0 i1 ¨ pi ` 1q“ x0 ÐÑ x0 “ pi1 ¨ iq`i1 R ´ ¯ and we finally obtain

ob. $c @x0 i1 ¨ pi ` 1q“ x0 ÐÑ x0 “ i1¨pi ` 1q . R ´ ¯

Lemma 113 The set of representable functions is closed under composition.

p pq p nq Proof of Lemma 113: Assume f1, . . . , fn P N N and g P N N are represented respectively by φf1 px0, x1, . . . , xpq, . . . , φfn px0, x1, . . . , xpq and φgpx0, x1, . . . , xnq. i.e. we have for all integers i1, . . . , ip, k1, . . . , kn and 1 ď j ď n:

ob. $c @x0 fjpi1, . . . , ipq“ x0 ÐÑ φf px0,i 1,...,i pq R j ´ ¯ and

ob. $c @x0 gpk1, . . . , knq“ x0 ÐÑ φgpx0,k 1,...,k nq . R ´ ¯ The function p pN q h “ gpf1, . . . , fnq P N defined by

hpi1, . . . , ipq “ g f1pi1, . . . , ipq, . . . , fnpi1, . . . , ipq ` ˘ Arithmetic 87

is represented by

φhpx0, x1, . . . , xpq “ Dy1 Dy2 ... Dyn φfj pyj, x1, . . . , xpq ^ φgpx0, y1, . . . , ynq . 1ďjďn ´ ľ ¯ Indeed, by the very definition of h for every i1, . . . , ip P N we have

$c @x0 hpi1, . . . , ipq“ x0 ÐÑ Dy1 Dy2 ... Dyn fjpi1, . . . , ipq“ yj ^ gpy1, . . . , ynq “ x0 . 1ďjďn ˆ ´ ľ ¯˙ Therefore

ob. $c @x0 hpi1, . . . , i1q“ x0 ÐÑ Dy1 Dy2 ... Dyn φf pyj,i 1,...,i 1q ^ φgpx0, y1, . . . , ynq . R j 1ďjďn ˆ ´ ľ ¯˙ % 113 n 1 n We now turn to minimisation. We need to prove that if A Ď N ` is representable and f P NpN q is some total function defined by minimisation the following way:

fpi1, . . . , inq “ µk pk, i1, . . . , inq P A, then f is representable.

This proof requires some good amount of preliminary work.

Example 114 We first notice that

˝ for all non-zero integer i the following holds

ob. $ i ‰ 0. (4.5) R c To see this, let i “ j ` 1, by the very definition of the terms involved we have

$c i “ Sj

hence by 1 @xSx ‰ 0 we obtain

ob. $ Sj ‰ 0 R c which gives the result.

˝ for all integers i, j such that i ‰ j the following holds

ob. $ i ‰ j. (4.6) R c the proof is by induction on minti, ju: 88 G¨odel& Recursivity

minti, ju “ 0 : this is case 4.5 ob. $c i ‰ 0 for all i P N, i ‰ 0 . R minti, ju ą 0 : set k ` 1 “ i and n ` 1 “ j. By 3 @x @y pSx “ Sy Ñ x “ yq we have

ob. $ @x @y px ‰ y Ñ Sx ‰ Syq. R c so that we easily obtain ob. $ k ‰ n Ñ Sk ‰ Sn R c which is precisely ob. $ k ‰ n Ñ k ` 1 ‰ n ` 1 R c i.e. ob. $ k ‰ n Ñ i ‰ j. R c By induction hypothesis we have

ob. $ k ‰ n, R c therefore by modus ponens we finally get

ob. $ i ‰ j. R c ˝ The following holds ob. $ @x@y y ‰ 0 ÝÑ x`y ‰ 0 . (4.7) R c By 2 @x Dy px ‰ 0 Ñ Sy “ xq 5 `@x @y x`Sy “ Spx˘`yq and 1 @xSx ‰ 0 we obtain ` ˘ ob. $ @x@yDz y ‰ 0 ÝÑ py “ Sz ^ x`Sz “ Spx`zq ^ Spx`zq ‰ 0 R c ´ ¯ which immediately yields the result. ˘

˝ The following holds

ob. $ @x@y x`y “ 0 ÝÑ px “ 0 ^ y “ 0q . (4.8) R c ´ ¯ By previous result 4.7 ob. $ @x@y y ‰ 0 ÝÑ x`y ‰ 0 we see that R c ` ˘ ob. $ @x@y x`y “ 0 ÝÑ y “ 0 . R c ` ˘ and by 4 @x x`0 “ x we obtain immediately the result. Arithmetic 89

Notation 115 We introduce “ x ď z” to abbreviate the formula “ Dy y`x “ z”. We also introduce “ x ă z” for the formula “ Dy y`x “ z ^ x ‰ z ”. ` ˘

Example 116 We establish ob. $ @x x ă 0 (4.9) R c We recall that x ă y stands for “ Dz z`x “ y ^ x ‰ y ”. So we need to prove ` ˘ ob. $ @x Dz z`x “ 0 ^ x ‰ 0 R c which is ` ˘ ob. $ @x @z z`x ‰ 0 _ x “ 0 . R c This is logically equivalent to ` ˘

ob. $ @x @z z`x “ 0 ÝÑ x “ 0 . R c ` ˘ Which is also logically equivalent to 4.7 ob. $ @x@y y ‰ 0 ÝÑ x`y ‰ 0 . R c ` ˘

Example 117 For all integer n the following holds:

ob. $ @x x ď n ÐÑ x “ 0 _ x “ S0 _ ... _ x “ n . (4.10) R c ” ı The direction ` ˘

ob. $ @x x “ 0 _ x “ S0 _ ... _ x “ n ÝÑ x ď n R c ´` ˘ ¯ First, by making use of 4 @x x`0 “ x and 5 @x @y x`Sy “ Spx`yq , the very def- inition of k “ S...S 0 and “ x ď z”:= “Dy y`x “ z ^ `x ‰ z ”, it is straightforward˘ to k establish by induction on n ` ˘ loomoon ob. $ @x x “ 0 _ x “ S0 _ ... _ x “ n ÝÑ Dy y`x “ n . R c So it only remains to prove”` ˘ ` ˘ı

ob. $ @x x ď n ÝÑ x “ 0 _ x “ S0 _ ... _ x “ n R c . ” ` ˘ı The proof is by induction on n: 90 G¨odel& Recursivity

n “ 0 : we need to show ob. $ @x x ď 0 ÝÑ x “ 0 R c which is ` ˘ ob. $ @x Dy y`x “ 0 ÝÑ x “ 0 R c i.e. ` ˘ ob. $ @x Dy y`x “ 0 _ x “ 0 R c i.e. ` ˘ ob. $ @x @y y`x ‰ 0 _ x “ 0 R c i.e. ` ˘ ob. $ @x@y y`x ‰ 0 _ x “ 0 R c i.e. ` ˘ ob. $ @x@y y`x “ 0 ÝÑ x “ 0 . R c ` ˘ We easily obtain the result by 4.8 ob. $ @x@y x`y “ 0 ÝÑ px “ 0 ^ y “ 0q R c ` ˘ n “ k ` 1 : we need to show

ob. $ @x x ď k ` 1 ÝÑ x “ 0 _ x “ S0 _ ... _ x “ k _ x “ k ` 1 . R c ´ ` ˘¯ which really is

ob. $ @x Dy y`x “ k ` 1 ÝÑ x “ 0 _ x “ S0 _ ... _ x “ k _ x “ k ` 1 . R c ´ ` ˘¯ i.e.

ob. $ @x@y y`x “ k ` 1 ÝÑ x “ 0 _ x “ S0 _ ... _ x “ k _ x “ k ` 1 . R c ´ ` ˘¯ We make use of the excluded middle:

$c @y y “ 0 _ y ‰ 0 ` ˘ and distinguish between the two cases:

y “ 0: by 4.1 ob. $ @x 0`x “ k ÝÑ x “ k we obtain R c ` ˘ ob. $ @x 0`x “ k ` 1 ÝÑ x “ k ` 1 . R c ` ˘ Arithmetic 91

y ‰ 0: by 2 @x Dy px ‰ 0 Ñ Sy “ xq what we need to show comes down to

ob. $ @x@z Sz`x “ k ` 1 ÝÑ x “ 0 _ x “ S0 _ ... _ x “ k _ x “ k ` 1 . R c ´ ` ˘¯ by 4.2 ob. $ @x@y Sy`x “ k ÝÑ Spy`xq “ k we already know that R c ` ˘ ob. $ @x@z Sz`x “ k ÝÑ Spz`xq “ k R c so that we need to prove ` ˘

ob. $ @x@z Spz`xq “ k ` 1 ÝÑ x “ 0 _ x “ 1 _ ... _ x “ k _ x “ k ` 1 . R c ´ ` ˘¯ By 3 @x @y pSx “ Sy Ñ x “ yq we only need to prove

ob. $ @x@z z`x “ k ÝÑ x “ 0 _ x “ 1 _ ... _ x “ k _ x “ k ` 1 R c ´ ` ˘¯ which is

ob. $ @x Dz z`x “ k ÝÑ x “ 0 _ x “ 1 _ ... _ x “ k _ x “ k ` 1 R c ´ ` ˘¯ i.e.

ob. $ @x x ď k ÝÑ x “ 0 _ x “ 1 _ ... _ x “ k _ x “ k ` 1 . R c ´ ` ˘¯ By induction hypothesis gives

ob. $ @x x ď k ÝÑ x “ 0 _ x “ 1 _ ... _ x “ k R c ´ ` ˘¯ so that we obtain the result very easily.

So we have proved the following two statements:

(1) ob. $ @x@y y “ 0 ÝÑ x`y “ k ` 1 ÝÑ x “ k ` 1 and R c ´ ` ˘¯ (2) ob. $ @x@y y ‰ 0 ÝÑ x`y “ k ` 1 ÝÑ x “ 0 _ x “ 1 _ ... _ x “ k . R c ˆ ˙ ´ ` ˘¯ Therefore, by an immediate application of the excluded middle we have proved the result. 92 G¨odel& Recursivity

Example 118 For all integer n the following holds:

ob. $ @x x ď n _ n ď x . (4.11) R c What we need to show is ` ˘

ob. $ @x Dy y`x “ n _Dy y`n “ x . R c We make use of the excluded middle:` ˘

$c @x x “ 0 _ x ‰ 0 and distinguish between the two cases. ` ˘ if x “ 0: we need to show ob. $ Dy y`0 “ n _Dy y`n “ 0 R c which is immediate by 4 @x x`0 “ x . if x ‰ 0: what wee need to prove comes down to

ob. $ @z Dy y`Sz “ n _Dy y`n “ Sz . R c The proof goes by induction on n`: ˘

if n “ 0 : we need to prove

ob. $ @z Dy y`Sz “ 0 _Dy y`0 “ Sz . R c ` ˘ By 4 @x x`0 “ x this comes down to

ob. $ @z Dy y`Sz “ 0 _Dy y “ Sz R c which is immediate. ` ˘ if n “ k ` 1 : we need to prove

ob. $ @z Dy y`Sz “ k ` 1 _Dy y`pk ` 1q “ Sz . R c ` ˘ By 5 @x @y x`Sy “ Spx`yq and 3 @x @y pSx “ Sy Ñ x “ yq this amounts to proving` ˘ ob. $ @z Dy y`z “ k _Dy y`k “ z R c which is exactly the induction hypothesis.` ˘ Arithmetic 93

We have already proved

p4.1q ob.$ @x 0`x “ k ÝÑ x “ k R c p4.2q ob.$ @x@`y Sy`x “ k ÝÑ S˘py`xq “ k R c

p4.3q ob.$c @x0 i`1 ` i2 “ x0 ÐÑ x0 “ i1`i2 ˘ R

p4.4q ob.$c @x0 `i1 ¨ i2 “ x0 ÐÑ x0 “ i1¨i2 ˘ R ` ˘ p4.5q ob.$c i ‰ 0 (any i P N, i ‰ 0) R

p4.6q ob.$c i ‰ j (any i, j P N, i ‰ j) R p4.7q ob.$ @x@y y ‰ 0 ÝÑ x`y ‰ 0 R c p4.8q ob.$ @x@y `x`y “ 0 ÝÑ px “ 0˘ ^ y “ 0q R c p4.9q ob.$ @x x`ă 0 ˘ R c p4.10q ob.$ @x x ď n ÐÑ px “ 0 _ x “ S0 _ ... _ x “ nq R c p4.11q ob.$ @x `x ď n _ n ď x ˘ R c ` ˘ n 1 n Lemma 119 Let A Ď N ` be representable. If the following function f P NpN q is total, then f is representable. fpi1, . . . , inq “ µk pk, i1, . . . , inq P A,

Proof of Lemma 119: Assume φpx0, x1, . . . , xnq represents the set A. We claim the function f is represented by the formula

φpx0, x1, . . . , xnq ^ @y ă x0 φpy, x1, . . . , xnq.

We need to show that for all i1, . . . , in P N

ob. $c @x0 fpi1, . . . , inq“ x0 ÐÑ φpx0,i 1,...,i nq ^ @y ă x0 φpy,i 1,...,i nq . R ˆ ´ ¯˙ ÝÑ ÝÑ (We write i for i1, . . . , in and i for i1,...,i n)

(ñ) (1) by the very definition of f and the fact that φpx0, x1, . . . , xnq represents A we trivially have : ÝÑ ÝÑ ob. $ φpfp i q, i q R c which is equivalent to ¯ ÝÑ ÝÑ ob. $c @x0 fp i q“ x0 ÝÑ φpx0, i q . R ´ ¯ 94 G¨odel& Recursivity

(2) To show ÝÑ ÝÑ ob. $c @x0 fp i q“ x0 ÝÑ @y ă x0 φpy, i q R we show the equivalent ´ ¯ ÝÑ ÝÑ ob. $ @y y ă fp i q ÝÑ φpy, i q R c ´ ¯ We have two cases ÝÑ if fp i q “ 0: we make use of 4.9 ob. $ @x x ă 0 which settles this case. R c ÝÑ if fp i q “ k ` 1: by the very definition of f and the fact that φpx0, x1, . . . , xnq rep- resents A we trivially have : ÝÑ ÝÑ ÝÑ ob. $ φp0, i q ^ φpS0, i q ^ ... ^ φpk, i q R c which sums up to ÝÑ ob. $ @y y “ 0 _ y “ S0 _ ... _ y “ k ÝÑ φpy, i q R c ´` ˘ ¯ by 4.10 ob. $ @x x ď n ÐÑ px “ 0 _ x “ S0 _ ... _ x “ nq we ob- R c tain “ ‰

ob. $ @y y ă k ` 1 ÝÑ py “ 0 _ y “ S0 _ ... _ y “ kq R c which yields ` ˘ ÝÑ ob. $ @y y ă k ` 1 ÝÑ φpy, i q . R c ´ ¯ (ð) we need to show

ÝÑ ÝÑ ÝÑ ob. $c @x0 φpx0, i q ^ @y ă x0 φpy, i q ÝÑ fp i q“ x0 . R ˆ´ ¯ ˙ We prove the result by contraposition, which means we prove

ÝÑ ÝÑ ÝÑ ob. $c @x0 fp i q‰ x0 ÝÑ φpx0, i q ^ @y ă x0 φpy, i q . R ˆ ´ ¯˙

By 4.11 ob. $ @x x ď n _ n ď x we have R c ` ˘ ÝÑ ÝÑ ob. $c @x0 x0 ď fp i q_ fp i qď x0 R Which is also ` ˘ ÝÑ ÝÑ ÝÑ ob. $c @x0 x0 ă fp i q_ fp i qă x0 _ x0 “ fp i q R ` ˘ Arithmetic 95

so that we only need to prove

ÝÑ ÝÑ ÝÑ ÝÑ ob. $c @x0 x0 ă fp i q^ fp i qă x0 ÝÑ φpx0, i q ^ @y ă x0 φpy, i q . R ˆ ˙ ` ˘ ´ ¯ We will successively prove

ÝÑ ÝÑ ÝÑ (1) ob. $c @x0 x0 ă fp i q ÝÑ φpx0, i q ^ @y ă x0 φpy, i q . R ˆ ˙ We have two cases ´ ¯

ÝÑ if fp i q “ 0: we make use of 4.9 ob. $ @x x ă 0 which settles this case. R c

ÝÑ if fp i q “ k ` 1: by 4.10 ob. $ @x x ď n ÐÑ px “ 0 _ x “ S0 _ ... _ x “ nq R c “ ‰

ob. $c @x0 x0 ă k ` 1 ÝÑ px0 “ 0 _ x0 “ S0 _ ... _ x0 “ kq R ` ˘ and by the very definition of f: ÝÑ ÝÑ ÝÑ ob. $ φp0, i q ^ φpS0, i q ^ ... ^ φpk, i q R c which gives ÝÑ ob. $c @x0 x0 ă k ` 1 ÝÑ φpx0, i q R which settles this case. ` ˘

ÝÑ ÝÑ ÝÑ (2) ob. $c @x0 fp i qă x0 ÝÑ φpx0, i q ^ @y ă x0 φpy, i q . R ˆ ˙ By the very definition of f: ´ ¯ ÝÑ ÝÑ ob. $ φ fp i q, i R c Thus ` ˘ ÝÑ ÝÑ ob. $c @x0 fp i qă x0 ÝÑ Dy ă x0 φpy, i q R ´ ¯ i.e. ÝÑ ÝÑ ob. $c @x0 fp i qă x0 ÝÑ @y ă x0 φpy, i q R ´ ¯ which yields what we want.

(1) and(2) finish the proof.

% 119 96 G¨odel& Recursivity

Theorem 120 (Chinese Remainder Theorem) Suppose n0, n1, . . . , nk are positive integers which are pairwise co-prime. Then, for any given sequence of integers a0, a1, . . . , ak there exists an integer x solving the system of simultaneous congruences

x ” a0 mod n0 x ” a mod n $ 1 1 . ’ . &’ x ” ak mod nk. ’ %’ Proof of Theorem 120: We set

α “ ni iďk ź and notice that for each i ď k the two integers n and α are co-prime. By B´ezoutthere exist i ni coefficients ci, di P Z such that α ci ¨ ni ` di ¨ “ 1 ni if we set α ei “ di ¨ ni we see that

ei ” 1 mod ni

# ei ” 0 mod nj (any j ‰ i) It follows immediately that

β “ ai ¨ ei iďk ÿ is a solution to the system. % 120

3 Lemma 121 (G¨odel β-function) There exists some function β P NpN q which is both repre- sentable and rim. ec. such that for all k P N and every sequence n0, n1, . . . , nk there exists P R a, b P N such that

βp0, a, bq “ n0 βp1, a, bq “ n $ 1 . ’ . &’ βpk, a, bq “ nk. ’ %’ Arithmetic 97

Proof of Lemma 121: The function is defined3 by b βpi, a, bq “ b ´9 ¨ papi ` 1q ` 1q api ` 1q ` 1 ˆ„  ˙ This shows that it is rim. ec.. To show that β is representable we consider the formula P R

x0 ă Spx2¨Sx1q ^ Dy ď x3 y¨Spx2¨Sx1q `x0 “ x3 ´ ¯ To show that this formula represents the function β, we need to show that for all i1, i2, i3 P N

ob. $c @x0 βpi1, i2, i3q“ x0 ÐÑ x0 ă Spi2¨Si1q ^ Dy ď i3 y¨Spi2¨Si1q `x0 “ i3 R ´ ¯ which is left as a tedious but straightforward exercise. ` ˘

Now given n0, n1, . . . , nk, in order to find a and b, we consider any integer m that satisfies both

(1) m ě k ` 1 (2) m! ě maxtn0, n1, . . . , nku.

We set a “ m! so that we make sure that a ` 1, a ¨ 2 ` 1, . . . , a ¨ k ` 1, a ¨ pk ` 1q ` 1 are co-prime. To see this, we proceed by contradiction and consider there exists some prime number p that divides both api ` 1q ` 1 and apj ` 1q ` 1 for some 0 ď i ă j ď k. Then p also divides

apj ` 1q ` 1 ´ api ` 1q ` 1 “ apj ´ iq “ m!pj ´ iq

Since m ą pj ´ iq holds, p divides m!` which contradicts˘ p divides m!pi ` 1q ` 1.

The Chinese Remainder Theorem (120) guarantees that there exists some integer b that satisfies

b ” n0 mod a ` 1 b ” n1 mod a ¨ 2 ` 1 $ . ’ . &’ b ” nk mod a ¨ pk ` 1q ` 1. ’ We chose m such that a “ m%’! ě maxtn0, n1, . . . , nku in order to insure ni ă api ` 1q ` 1 for every integer i ď k. This makes certain that for each i ď k we have βpi, a, bq “ ni. % 121

p p`2 Lemma 122 If both functions g P NpN q and h P NpN q are representable, then the function p`1 f P NpN q defined by recursion below is also representable.

fpÝÑx , 0q “ gpÝÑx q

$ fpÝÑx , y ` 1q “ h ÝÑx , y, fpÝÑx , yq & 3 βpi, a, bq is the remainder of the% division of b by api ` 1`q ` 1. ˘ 98 G¨odel& Recursivity

ÝÑ p pq p p`2q Proof of Lemma 122: We let x stand for x1, . . . , xp and assume g P N N and h P N N are ÝÑ ÝÑ represented respectively by φgpx0, x q and φhpx0, x , xp`1, xp`2q. We also consider the following formula that represents the β-function 4 :

φpx0, x1, x2, x3q :“ x0 ă Spx2¨Sx1q ^ Dy ď x3 y¨Spx2¨Sx1q `x0 “ x3 ´ ¯ Instead of φpx0, x1, x2, x3q we prefer the formula φβpx0, x1, x2, x3q below which also obviously represents β but in a strong way.

φβpx0, x1, x2, x3q :“ φpx0, x1, x2, x3q ^ @y ă x0 φpy, x1, x2, x3q because for any integers i, n we have

˜ ˜ ˜ ob. $c @a˜@b@x0 φβpk,i, a,˜ bq ^ φβpx0,i, a,˜ bq ÝÑ x0 “ k . R ”“ ‰ ı This holds because

ob. $c x0 x0 ‰ k ÝÑ px0 ď k _ k ď x0q _ x0 ă k _ k ă x0 R “ ‰ and by 4.11 ob. $ @x x ď n _ n ď x , this comes down to R c ` ˘

ob. $c x0 x0 ‰ k ÝÑ x0 ă k _ k ă x0 R “ ‰ and by the definition of both φβ and k we have

˜ ˜ ˜ (1) ob. $c @a˜@b@x0 φβpk,i, a,˜ bq ^ x0 ă k ÝÑ φβpx0,i, a,˜ @bq R ”“ ‰ ı ˜ ˜ ˜ (2) ob. $c @a˜@b@x0 φβpk,i, a,˜ bq ^ k ă x0 ÝÑ φβpx0,i, a,˜ @bq . R ”“ ‰ ı which yields the following which is also logically equivalent to what we want:

˜ ˜ ˜ ob. $c @a˜@b@x0 x0 ‰ k ^ φβpk,i, a,˜ bq ÝÑ φβpx0,i, a,˜ bq . R ”“ ‰ ı The formula the we choose to represent f is the following formula φf px0, x1, . . . , xp`1q. We use ÝÑ ÝÑ the notation x “ x1, . . . , xp so that φf px0, x1, . . . , xp`1q :“ φf px0, x , xp`1q

4see the proof of Lemma 121. Arithmetic 99

ÝÑ ˜i “ 0 ÝÑ φgpy, x q ¨ ˛ ˚ ‹ ˚ φ py,Ź˜i, a,˜ ˜bq ‹ ˚ β ‹ ˚ ‹ ˚ ‹ ˚ ‹ ˚ ‹ ˚ ÝÑ ‹ ˚ φhpz,Źx, ˜i, yq ‹ Da˜D˜b@˜i ď xp 1 Dy Dz ˚ ‹ ` ˚ ‹ ˚ ‹ ˚ ‹ ˚ ‹ ˚ ‹ ˚ Ź˜ ˜ ‹ ˚ φβpz,S i, a,˜ bq ‹ ˚ ‹ ˚ ‹ ˚ ‹ ˚ ‹ ˚ ‹ ˚ Ź ˜ ‹ ˚ φβpx0, xp`1, a,˜ bq ‹ ˚ ‹ ˚ ‹ ˝ ‚

ÝÑ In order to show that this formula φf px0, x , xp 1q represents f, we need to prove that for all ÝÑ ` integers i1, . . . , ip, ip`1 (we write i for i1, . . . , ip) we have

ÝÑ ˜i “ 0 ÝÑ φgpy, i q ¨ ¨ ˛ ˛ ˚ ˚ ‹ ‹ ˚ ˚ φ py,Ź˜i, a,˜ ˜bq ‹ ‹ ˚ ˚ β ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ ÝÑ ‹ ‹ ˚ ˜ ˚ φhpz,Źi, ˜i, yq ‹ ÝÑ ‹ ob. $c @x0 ˚Da˜Db@˜i ď ip 1 Dy Dz ˚ ‹ ÐÑ fp i , ip 1q“ x0‹ . R ˚ ` ˚ ‹ ` ‹ ˚ ˚ ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ Ź˜ ˜ ‹ ‹ ˚ ˚ φβpz,S i, a,˜ bq ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ Ź ˜ ‹ ‹ ˚ ˚ φβpx0,i p`1, a,˜ bq ‹ ‹ ˚ ˚ ‹ ‹ ˚ ˚ ‹ ‹ ˝ ˝ ‚ ‚

(ð) We first prove 100 G¨odel& Recursivity

ÝÑ ˜i “ 0 ÝÑ φgpy, i q ¨ ¨ ˛˛ ˚ ˚ ‹‹ ˚ ˚ φ py,Ź˜i, a,˜ ˜bq ‹‹ ˚ ˚ β ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ÝÑ ‹‹ ˚ ÝÑ ˜ ˚ φhpz,Źi, ˜i, yq ‹‹ ob. $c @x0 ˚fp i , ip 1q“ x0 ÝÑ Da˜Db@˜i ď ip 1 Dy Dz ˚ ‹‹ . R ˚ ` ` ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ Ź˜ ˜ ‹‹ ˚ ˚ φβpz,S i, a,˜ bq ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ Ź ˜ ‹‹ ˚ ˚ φβpx0,i p`1, a,˜ bq ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˝ ˝ ‚‚

ÝÑ ÝÑ We consider the sequence of integers fp i , 0q, . . . , fp i , ip`1q. Following the proof of Lemma 121, we obtain two integers a and b to make the β-function work. Since the formulas φβ, φg, φh respectively represent the functions β, g, h, we have

ÝÑ ÝÑ ÝÑ ob. $c φβ gp i q, 0,a,b ^ φg gp i q, i R ` ˘ ` ˘ together with

ÝÑ ob. $c φβ fp i , ip 1q,i p 1,a,b R ` ` ` ˘ and for each integer n ă ip`1

ÝÑ ÝÑ ÝÑ ÝÑ ÝÑ ob. $c φβ fp i , nq,n,a,b ^ φh fp i , n ` 1q, i,n,f p i , nq ^ φβ fp i , n ` 1q,Sn,a,b . R ` ˘ ´ ¯ ` ˘

hence we have Arithmetic 101

ÝÑ ÝÑ k“ 0 ÝÑ φgpgp i q, i q ¨ ¨ ˛˛ ˚ ˚ ÝÑ ‹‹ ˚ ˚ φ pfp i ,Ź kq,k,a,b q ‹‹ ˚ ˚ β ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ÝÑ ÝÑ ÝÑ ‹‹ ˚ ÝÑ ˚ φhpfp i , k ` 1Źq, i,k,f p i , kqq ‹‹ ob. $c @x0 ˚fp i , ip 1q“ x0 ÝÑ ˚ ‹‹ . R ˚ ` ˚ ‹‹ ˚ kďip`1 ˚ ‹‹ ˚ ľ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ÝÑ Ź ‹‹ ˚ ˚ φβpfp i , k ` 1q,Sk,a,b q ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ φβpx0,iŹp`1,a,b q ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˝ ˝ ‚‚

from which we logically derive

ÝÑ k“ 0 ÝÑ φgpy, i q ¨ ¨ ˛˛ ˚ ˚ ‹‹ ˚ ˚ φ py,Źk,a,b q ‹‹ ˚ ˚ β ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ÝÑ ‹‹ ˚ ÝÑ ˚ φhpz,Źi,k,y q ‹‹ ob. $c @x0 ˚fp i , ip 1q“ x0 ÝÑ Dy Dz ˚ ‹‹ . R ˚ ` ˚ ‹‹ ˚ kďip`1 ˚ ‹‹ ˚ ľ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ Ź ‹‹ ˚ ˚ φβpz,Sk,a,b q ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ Ź ‹‹ ˚ ˚ φβpx0,i p`1,a,b q ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˝ ˝ ‚‚

Furthermore, we know from 4.10 ob. $ @x x ď n ÐÑ px “ 0 _ x “ S0 _ ... _ x “ nq R c “ ‰ 102 G¨odel& Recursivity

that

ob. $c @˜i ˜i ď ip 1 ÐÑ ˜i “ 0 _ ˜i “ 1 _ ... _ ˜i “ ip 1 . R ` ` ´ “ ‰¯ Thus we obtain

ÝÑ ˜i “ 0 ÝÑ φgpy, i q ¨ ¨ ˛˛ ˚ ˚ ‹‹ ˚ ˚ φ py,Ź˜i,a,b q ‹‹ ˚ ˚ β ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ÝÑ ‹‹ ˚ ÝÑ ˚ φhpz,Źi, ˜i, yq ‹‹ ob. $c @x0 ˚fp i , ip 1q“ x0 ÝÑ @˜i ď ip 1 Dy Dz ˚ ‹‹ R ˚ ` ` ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ Ź˜ ‹‹ ˚ ˚ φβpz,S i,a,b q ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ Ź ‹‹ ˚ ˚ φβpx0,i p`1,a,b q ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˝ ˝ ‚‚ and finally

ÝÑ ˜i “ 0 ÝÑ φgpy, i q ¨ ¨ ˛˛ ˚ ˚ ‹‹ ˚ ˚ φ py,Ź˜i, a,˜ ˜bq ‹‹ ˚ ˚ β ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ÝÑ ‹‹ ˚ ÝÑ ˜ ˚ φhpz,Źi, ˜i, yq ‹‹ ob. $c @x0 ˚fp i , ip 1q“ x0 ÝÑ Da˜ Db @˜i ď ip 1 Dy Dz ˚ ‹‹ R ˚ ` ` ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ Ź˜ ˜ ‹‹ ˚ ˚ φβpz,S i, a,˜ bq ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˚ ˚ Ź ˜ ‹‹ ˚ ˚ φβpx0,i p`1, a,˜ bq ‹‹ ˚ ˚ ‹‹ ˚ ˚ ‹‹ ˝ ˝ ‚‚ which completes the first part of the proof. Arithmetic 103

(ñ) We need to show

ÝÑ ˜i “ 0 ÝÑ φgpy, i q ¨ » fi ˛ ˚ — ffi ‹ ˚ — φ py,Ź˜i, a,˜ ˜bq ffi ‹ ˚ — β ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ÝÑ ffi ‹ ˚ ˜ — φhpz,Źi, ˜i, yq ffi ÝÑ ‹ ob. $c @x0 ˚Da˜Db@˜i ď ip 1 Dy Dz — ffi ÝÑ fp i , ip 1q“ x0‹ . R ˚ ` — ffi ` ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — Ź˜ ˜ ffi ‹ ˚ — φβpz,S i, a,˜ bq ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — Ź ˜ ffi ‹ ˚ — φβpx0,i p`1, a,˜ bq ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˝ – fl ‚

which is equivalent to

ÝÑ ˜i “ 0 ÝÑ φgpy, i q ¨ » » fifi ˛ ˚ — — ffiffi ‹ ˚ — — φ py,Ź˜i, a,˜ ˜bq ffiffi ‹ ˚ — — β ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ÝÑ ffiffi ‹ ˚ ˜ — — φhpz,Źi, ˜i, yq ffiffi ÝÑ ‹ ob. $c @x0 ˚Da˜Db@˜i —˜i ď ip 1 ÝÑ Dy Dz — ffiffi ÝÑ fp i , ip 1q“ x0‹ . R ˚ — ` — ffiffi ` ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — Ź˜ ˜ ffiffi ‹ ˚ — — φβpz,S i, a,˜ bq ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — Ź ˜ ffiffi ‹ ˚ — — φβpx0,i p`1, a,˜ bq ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˝ – – flfl ‚

By 4.10 ob. $ @x x ď n ÐÑ px “ 0 _ x “ S0 _ ... _ x “ nq this is equivalent R c “ ‰ 104 G¨odel& Recursivity

to ÝÑ ˜i “ 0 ÝÑ φgpy, i q ¨ » » fifi ˛ ˚ — — ffiffi ‹ ˚ — — φ py,Ź˜i, a,˜ ˜bq ffiffi ‹ ˚ — — β ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ÝÑ ffiffi ‹ ˚ ˜ — — φhpz,Źi, ˜i, yq ffiffi ÝÑ ‹ ob. $c @x0 ˚Da˜Db@˜i — ˜i “ k ÝÑ Dy Dz — ffiffi ÝÑ fp i , ip 1q“ x0‹ . R ˚ —¨ ˛ — ffiffi ` ‹ ˚ — kďip`1 — ffiffi ‹ ˚ — ł — ffiffi ‹ ˚ —˝ ‚ — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — Ź˜ ˜ ffiffi ‹ ˚ — — φβpz,S i, a,˜ bq ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — Ź ˜ ffiffi ‹ ˚ — — φβpx0,i p`1, a,˜ bq ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˝ – – flfl ‚

which is equivalent to 5

ÝÑ ˜i “ 0 ÝÑ φgpy, i q ¨ » ¨ » fi˛fi ˛ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — φ py,Ź˜i, a,˜ ˜bq ffi‹ffi ‹ ˚ — ˚ — β ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — ÝÑ ffi‹ffi ‹ ˚ ˜ — ˚ — φhpz,Źi, ˜i, yq ffi‹ffi ÝÑ ‹ ob. $c @x0 ˚Da˜Db@˜i — ˚˜i “ k ÝÑ Dy Dz — ffi‹ffi ÝÑ fp i , ip 1q“ x0‹ . R ˚ — ˚ — ffi‹ffi ` ‹ ˚ —kďip`1 ˚ — ffi‹ffi ‹ ˚ — ľ ˚ — ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — Ź˜ ˜ ffi‹ffi ‹ ˚ — ˚ — φβpz,S i, a,˜ bq ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — Ź ˜ ffi‹ffi ‹ ˚ — ˚ — φβpx0,i p`1, a,˜ bq ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˚ — ˚ — ffi‹ffi ‹ ˝ – ˝ – fl‚fl ‚

which again is equivalent to

5we have pA_Bq ÝÑ C ” pA_Bq_C ” p A^ Bq_C ” p A_Cq^p B _Cq ” pA ÝÑ Cq^pB ÝÑ Cq. Arithmetic 105

ÝÑ k“ 0 ÝÑ φgpy, i q ¨ » » fifi ˛ ˚ — — ffiffi ‹ ˚ — — φ py,Źk, a,˜ ˜bq ffiffi ‹ ˚ — — β ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ÝÑ ffiffi ‹ ˚ ˜ — — φhpz,Źi,k,y q ffiffi ÝÑ ‹ ob. $c @x0 ˚Da˜Db — Dy Dz — ffiffi ÝÑ fp i , ip 1q“ x0‹ . R ˚ — — ffiffi ` ‹ ˚ —kďip`1 — ffiffi ‹ ˚ — ľ — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — Ź ˜ ffiffi ‹ ˚ — — φβpz,Sk, a,˜ bq ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — Ź ˜ ffiffi ‹ ˚ — — φβpx0,i p`1, a,˜ bq ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˝ – – flfl ‚

which is equivalent to

ÝÑ k“ 0 ÝÑ φgpyk, i q ¨ » » fifi ˛ ˚ — — ffiffi ‹ ˚ — — φ py Ź,k, a,˜ ˜bq ffiffi ‹ ˚ — — β k ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ÝÑ ffiffi ‹ ˚ ˜ — — φhpzk, Źi,k,y kq ffiffi ÝÑ ‹ ob. $c @x0 ˚Da˜Db . . . DykDzk ... — — ffiffi ÝÑ fp i , ip 1q“ x0‹ . R ˚ — — ffiffi ` ‹ ˚ —kďip`1 — ffiffi ‹ ˚ kďip`1 — ľ — ffiffi ‹ ˚ — — ffiffi ‹ ˚ loooooomoooooon — — ffiffi ‹ ˚ — — Ź ˜ ffiffi ‹ ˚ — — φβpzk,Sk, a,˜ bq ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — Ź ˜ ffiffi ‹ ˚ — — φβpx0,i p`1, a,˜ bq ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˝ – – flfl ‚

and also to 106 G¨odel& Recursivity

ÝÑ φgpy0, i q ¨ » » fifi ˛ ˚ — — ffiffi ‹ ˚ — — φ py Ź,k, a,˜ ˜bq ffiffi ‹ ˚ — — β k ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ÝÑ ffiffi ‹ ˚ ˜ — — φhpzk, Źi,k,y kq ffiffi ÝÑ ‹ ob. $c @x0 ˚Da˜Db . . . DykDzk ... — — ffiffi ÝÑ fp i , ip 1q“ x0‹ . R ˚ — — ffiffi ` ‹ ˚ —kďip`1 — ffiffi ‹ ˚ kďip`1 — ľ — ffiffi ‹ ˚ — — ffiffi ‹ ˚ loooooomoooooon — — ffiffi ‹ ˚ — — Ź ˜ ffiffi ‹ ˚ — — φβpzk,Sk, a,˜ bq ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — Ź ˜ ffiffi ‹ ˚ — — φβpx0,i p`1, a,˜ bq ffiffi ‹ ˚ — — ffiffi ‹ ˚ — — ffiffi ‹ ˝ – – flfl ‚

and also to ÝÑ φgpy0, i q ¨ » fi ˛ ˚ — ffi ‹ ˚ — φ py Ź,k, a,˜ ˜bq ffi ‹ ˚ — β k ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ÝÑ ffi ‹ ˜ ˚ — φhpzk, Źi,k,y kq ffi ÝÑ ‹ ob. $c @x0@a˜@b . . . @yk@zk ... ˚ — ffi ÝÑ fp i , ip 1q“ x0‹ . R ˚ — ffi ` ‹ ˚kďip`1 — ffi ‹ kďip`1 ˚ ľ — ffi ‹ ˚ — ffi ‹ looooooomooooooon ˚ — ffi ‹ ˚ — Ź ˜ ffi ‹ ˚ — φβpzk,Sk, a,˜ bq ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — Ź ˜ ffi ‹ ˚ — φβpx0,i p`1, a,˜ bq ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˝ – fl ‚

Finally, making use of the following three facts:

(1) φβ represents β in a strong way since we also have for all integers k, n we have

˜ ˜ ˜ ob. $c @a˜@b@x0 φβpn,k, a,˜ bq ^ φβpx0,k, a,˜ bq ÝÑ x0 “ n R ”“ ‰ ı Arithmetic 107

(2) φg represents g

(3) φh represents h

At last, by induction on ip`1 we show

ÝÑ φgpy0, i q ÝÑ ¨ » fi y0 “ gp i q ˛ ˚ — ffi ‹ ˚ — φ py Ź,k, a,˜ ˜bq ffi » fi‹ ˚ — β k ffi ‹ ˚ — ffi ‹ ˚ — ffi — ÝÑ ffi‹ ˜ — yk “ fŹp i , kq ffi ob. $c @a˜@b . . . @yk@zk ... ˚ — ffi ÝÑ — ffi‹ . R ˚ — ffi — ffi‹ ˚kďip`1 — ÝÑ ffi kďip`1 — ffi‹ kďip`1 ˚ — Ź ffi ‹ ˚ ľ — φhpzk, i,k,y kq ffi ľ — ffi‹ ˚ — ffi — ffi‹ looooooomooooooon ˚ — ffi — ÝÑ ffi‹ ˚ — ffi — zk “ fpŹi , k ` 1q ffi‹ ˚ — ffi — ffi‹ ˚ — ffi — ffi‹ ˚ — Ź ˜ ffi — ffi‹ ˚ — φβpzk,Sk, a,˜ bq ffi – fl‹ ˚ — ffi ‹ ˚ — ffi ‹ ˝ – fl ‚

ip`1 “ 0: we only need to prove

ÝÑ φgpy0, i q ÝÑ ¨» fi y0 “ gp i q ˛ ˚— ffi ‹ ˚— φ py Ź, 0, a,˜ ˜bq ffi » fi‹ ˚— β 0 ffi ‹ ˚— ffi ‹ ˚— ffi — ÝÑ ffi‹ ˜ ˚— ffi — y0 “ fŹp i , 0q ffi‹ ob. $c @a˜@b@y0@z0 ˚— ffi ÝÑ — ffi‹ R ˚— ffi — ffi‹ ˚— ŹÝÑ ffi — ffi‹ ˚— φhpz0, i, 0, y0q ffi — ffi‹ ˚— ffi — ffi‹ ˚— ffi — ÝÑ ffi‹ ˚— ffi — z0 “ fŹp i , 1q ffi‹ ˚— ffi — ffi‹ ˚— ffi — ffi‹ ˚— Ź ˜ ffi — ffi‹ ˚— φβpz0,S 0, a,˜ bq ffi – fl‹ ˚— ffi ‹ ˚— ffi ‹ ˝– fl ‚

which directly follows from the fact that φg and φh represent respectively g and h.

ip`1 “ n ` 1: we assume 108 G¨odel& Recursivity

ÝÑ φgpy0, i q ÝÑ ¨ » fi y0 “ gp i q ˛ ˚ — ffi ‹ ˚ — φ py Ź,k, a,˜ ˜bq ffi » fi‹ ˚ — β k ffi ‹ ˚ — ffi ‹ ˚ — ffi — ÝÑ ffi‹ ˜ — yk “ fŹp i , kq ffi ob. $c @a˜@b . . . @yk@zk ... ˚ — ffi ÝÑ — ffi‹ . R ˚ — ffi — ffi‹ ˚kďn — ÝÑ ffi kďn ‹ kďn ˚ — Ź ffi — ffi‹ ˚ľ — φhpzk, i,k,y kq ffi ľ — ffi‹ ˚ — ffi — ffi‹ looooooomooooooon ˚ — ffi — ÝÑ ffi‹ ˚ — ffi — zk “ fpŹi , k ` 1q ffi‹ ˚ — ffi — ffi‹ ˚ — ffi — ffi‹ ˚ — Ź ˜ ffi — ffi‹ ˚ — φβpzk,Sk, a,˜ bq ffi – fl‹ ˚ — ffi ‹ ˚ — ffi ‹ We only need to show ˝ – fl ‚

ÝÑ zn “ fp i , n ` 1q ¨» fi ˛ ˚— ffi ÝÑ ‹ ˚— φ pz ,nŹ` 1, a,˜ ˜bq ffi y “ fp i , n ` 1q ‹ ˚— β n ffi n`1 ‹ ˚— ffi ‹ ˚— ffi ‹ ˜ ˚— ffi » fi‹ ob. $c @a˜@b@zn@yn`1@zn`1 ˚— ffi ÝÑ ‹ . R ˚— ffi ‹ ˚— Ź ˜ ffi — ŹÝÑ ffi‹ ˚— φβpyn`1,n ` 1, a,˜ bq ffi — zn`1 “ fp i , n ` 2q ffi‹ ˚— ffi — ffi‹ ˚— ffi — ffi‹ ˚— ffi – fl‹ ˚— ffi ‹ ˚— ffi ‹ ˚— ÝÑŹ ffi ‹ ˚— φhpzn`1, i,n ` 1, yn`1q ffi ‹ ˚— ffi ‹ ˚— ffi ‹ ˝– fl ‚

which holds because:

(1) since φβ represents β in a strong way we have

˜ ÝÑ ˜ ˜ ÝÑ ob. $c @a˜@b@yn 1 φβpfp i , n ` 1q,n ` 1, a,˜ bq ^ φβpyn 1,n ` 1, a,˜ bq ÝÑ yn 1 “ fp i , n ` 1q R ` ` ` ”“ ‰ ı

(2) since φh represents h we have

˜ ÝÑ ÝÑ ÝÑ ob. $c @a˜@b@yn 1@zn 1 φhpzn 1, i,n ` 1, yn 1q ^ yn 1 “ fp i , n ` 1q ÝÑ zn 1 “ fp i , n ` 2q R ` ` ` ` ` ` ”“ ‰ ı To sum up things, we have obtained Arithmetic 109

ÝÑ φgpy0, i q ¨ » fi ˛ ˚ — ffi ÝÑ ‹ ˚ — φ py Ź,k, a,˜ ˜bq ffi y “ fp i , i q ‹ ˚ — β k ffi ip`1 p`1 ‹ ˚ — ffi ‹ ˚ — ffi » fi‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — ffi — ffi‹ ŹÝÑ Ź ˜ ˜ ˚ — φhpzk, i,k,y kq ffi — φβpyip`1 ,i p`1, a,˜ bq ffi‹ ob. $c @x0@a˜@b . . . @yk@zk ... ˚ — ffi ÝÑ — ffi‹ . R ˚ — ffi — ffi‹ ˚kďip`1 — ffi — ffi‹ kďip`1 ˚ ľ — ffi — ffi‹ ˚ — ffi — ffi‹ looooooomooooooon ˚ — ffi — ffi‹ ˚ — Ź ˜ ffi — Ź ˜ ffi‹ ˚ — φβpzk,Sk, a,˜ bq ffi — φβpx0,i p`1, a,˜ bq ffi‹ ˚ — ffi — ffi‹ ˚ — ffi — ffi‹ ˚ — ffi – fl‹ ˚ — ffi ‹ ˚ — ffi ‹ ˚ — Ź ˜ ffi ‹ ˚ — φβpx0,i p`1, a,˜ bq ffi ‹ ˚ — ffi ‹ ˚ — ffi ‹ ˝ – fl ‚

Once again, since φβ strongly represents β we have

˜ ÝÑ ˜ ˜ ÝÑ ob. $c @x0@a˜@b φβpfp i , ip 1q,i p 1, a,˜ bq ^ φβpx0,i p 1, a,˜ bq ÝÑ x0 “ fp i , n ` 1q R ` ` ` ”“ ‰ ı which finishes the proof.

% 122

Theorem 123 All total recursive functions are representable.

Proof of Theorem 123: An immediate consequence of Examples 108, 109 and 110 and Lemmas 113 , 119 and 122. % 123 110 G¨odel& Recursivity Chapter 5

G¨odelFirst Incompleteness Theorem

5.1 G¨odelNumbers

The idea is the following: intuitively, formulas from arithmetic talk about integers – no matter whether these are standard or not – we ca turn them into formulas that talk about the arithmetic itself by encoding formulas, proofs, etc. by integers. This way a formula φpxq may say something like “x is the code of a closed formula from our language A “ t0,S, `, ¨u” or ψpx, yq may L eventually say “x is the code of a closed formula θ from our language and y is the code of a proof of θ in Robinson arithmetic”. As always we start with the terms: given term t we write xty for its code.

Definition 124 (G¨odelnumbering of the A-terms) The G¨odelnumbering of the terms L from the language A “ t0,S, `, ¨u is L

t “ 0 ùx ty “ α3p0, 0, 0q

t “ xn ùx ty “ α3pn ` 1, 0, 0q

t “ St0 ùx ty “ α3pxty, 0, 1q

t “ t0`t1 ùx ty “ α3pxt0y, xt1y, 2q

t “ t0¨t1 ùx ty “ α3pxt0y, xt1y, 3q

Lemma 125 The set of all codes of terms from A T L “ xty | t is a term from A T L is rim. ec. ( P R

To almost immediately show this result we need to prove that some stronger form of construction by recursion still produces rim. ec. functions. P R 112 G¨odel& Recursivity

p n`p`1q p nq Lemma 126 For all rim. ec. functions h P N N , g P N N , k1, . . . , kp P NN, such that P R every integer y ą 0 kipyq ă y 0ăiďp ľ n`1 the function f P NpN q defined by

(1) fpÝÑx , 0q “ gpÝÑx q

ÝÑ ÝÑ ÝÑ ÝÑ ÝÑ (2) fp x , y ` 1q “ h fp x , k1pyqq, . . . , fp x , kppyqq, x , y, fp x , yq ` ˘ is also rim. ec. P R

2 First, notice that the Ackermann function A P NpN q defined by

n ` 1 if m “ 0, Apm, nq “ Apm ´ 1, 1q if m ą 0 and n “ 0, $ & A m ´ 1,Apm, n ´ 1q if m ą 0 and n ą 0. is not of this form for Apm,% n ´ 1`q ă n certainly does˘ not hold.

Proof of Lemma 126: The idea of the proof is to define by recursion a function that carries all the datas fpÝÑx , zq for z ă y when defining fpÝÑx , yq. To achieve this, we make use of the two rim. ec. functions c and d that we defined in Example 91: P R ω (1) the function c : Nă ÝÑ N codes the finite sequences of integers and is defined by

cpεq “ 1 cpx , . . . , x q “ Π p0qx0`1 ¨ Π p1qx1`1 ¨ ¨ ¨ Π ppqxp`1. " 0 p

2 (2) And the function d P NpN q that allows, from any integer n, to recover every element of the sequence xx0, . . . , xpy that c encodes (i.e. cpx0, . . . , xpq “ n) by

dpi, nq “ µx ď n Π piqx`1 does not divide n.

n`1 We want to define some rim. ec. function θ P NpN q such that P R θpÝÑx , yq “ c fpÝÑx , 0q, fpÝÑx , 1q, . . . , fpÝÑx , yq

This is easily done by recursion: ` ˘

ÝÑ (1) θpÝÑx , 0q “ 2gp x q`1

ÝÑ ÝÑ ÝÑ ÝÑ (2) θpÝÑx , y ` 1q “ θpÝÑx , yq ¨ Π py ` 1qh drk1pyqq,θp x ,yqs,...,drkppyqq,θp x ,yqs, x ,y,fp x ,yq `1. “ ‰ Arithmetic 113

Then, to show that f is also rim. ec., it only remains to set P R fpÝÑx , yq “ d y, θpÝÑx , yq ´9 1.

“ ‰ % 126

Proof of Lemma 125: Its characteristic function χT : N ÝÑ N is defined by: 3 2 1 if β3 pkq “ 0 and β3 pkq “ 0 and β3 pkq “ 0 ù χT pkq “ 1

3 2 1 if β3 pkq “ 0 and β3 pkq “ 0 and β3 pkq ą 0 ù χT pkq “ 1

3 2 1 1 if β3 pkq “ 1 and β3 pkq “ 0 and β3 pkq ą 0 ù χT pkq “ χT ˝ β3 pkq

3 1 2 if β3 pkq “ 2 ù χT pkq “ χT β3 pkq ¨ β3 pkq 3 ` 1 2 ˘ if β3 pkq “ 3 ù χT pkq “ χT β3 pkq ¨ β3 pkq

else ù χT pkq “ 0. ` ˘

By Lemma 126 this definition by case study yields a rim. ec. function. P R % 125

Definition 127 (G¨odelnumbering of the A-formulas) The G¨odelnumbering of the A- L L formulas is

φ “ t0 “ t1 ùx φy “ α3pxt0y, xt1y, 4q

φ “ ψ ùx φy “ α3pxψy, 0, 5q

φ “ pφ0 ^ φ1q ùx φy “ α3pxφ0y, xφ1y, 6q

φ “ pφ0 _ φ1q ùx φy “ α3pxφ0y, xφ1y, 7q

φ “ pφ0 ÝÑ φ1q ùx φy “ α3pxφ0y, xφ1y, 8q

φ “ pφ0 ÐÑ φ1q ùx φy “ α3pxφ0y, xφ1y, 9q

φ “@xn ψ ùx φy “ α3pxψy, n, 10q

φ “Dxn ψ ùx φy “ α3pxψy, n, 11q.

Notice that for every formula φ, we have xφy ą 0.

Lemma 128 The set of all codes of formulas from A L

xφy | φ is a formula from A L is rim. ec. ( P R 114 G¨odel& Recursivity

Proof of Lemma 128: Its characteristic function χF : N ÝÑ N is defined by:

3 1 2 if β3 pkq “ 4 ù χF pkq “ χT ˝ β3 pkq ¨ χT ˝ β3 pkq

3 2 1 if β3 pkq “ 5 and β3 pkq “ 0 ù χF pkq “ χF ˝ β3 pkq

3 1 2 if β3 pkq “ 6 ù χF pkq “ χF β3 pkq ¨ β3 pkq 3 ` 1 2 ˘ if β3 pkq “ 7 ù χF pkq “ χF β3 pkq ¨ β3 pkq 3 ` 1 2 ˘ if β3 pkq “ 8 ù χF pkq “ χF β3 pkq ¨ β3 pkq 3 ` 1 2 ˘ if β3 pkq “ 9 ù χF pkq “ χF β3 pkq ¨ β3 pkq 3 2 ` 1 ˘ if β3 pkq “ 10 and β3 pkq ą 0 ù χF pkq “ χF ˝ β3 pkq

3 2 1 if β3 pkq “ 11 and β3 pkq ą 0 ù χF pkq “ χF ˝ β3 pkq

else ù χF pkq “ 0.

By Lemma 126 this definition by case study yields a rim. ec. function. P R % 128

Lemma 129 The set of all codes of terms from A that contain the variable xn L

x “ pxty, nq | t is a term from A and t contains xn T L ( is rim. ec. P R

2 Proof of Lemma 129: Its characteristic function χT xn : N ÝÑ N is defined by:

3 2 1 if β3 pkq “ 0 and β3 pkq “ 0 and β3 pkq “ n ` 1 ù χT xn pk, nq “ 1

3 2 1 if β3 pkq “ 1 and β3 pkq “ 0 ù χT xn pk, nq “ χT xn β3 pkq, n

3 ` 1˘ 2 if β3 pkq “ 2 ù χT xn pk, nq “ max χT xn β3 pkq, n , χT xn β3 pkq, n ´ ¯ 3 ` 1 ˘ ` 2 ˘ if β3 pkq “ 3 ù χT xn pk, nq “ max χT xn β3 pkq, n , χT xn β3 pkq, n ´ ` ˘ ` ˘¯ else ù χT xn pk, nq “ 0.

By Lemma 126 this definition by case study yields a rim. ec. function. P R % 129 Arithmetic 115

Lemma 130 The set of all codes of terms from A that do not contain the variable xn L x “ pxty, nq | t is a term from A and t does not contain xn T L is rim. ec. ( P R

2 Proof of Lemma 130: Its characteristic function χT xn : N ÝÑ N is defined by :

3 2 1 if β3 pkq “ 0 and β3 pkq “ 0 and β3 pkq ‰ n ` 1 ù χT xn pk, nq “ 1

3 2 1 if β3 pkq “ 1 and β3 pkq “ 0 ù χT xn pk, nq “ χT xn β3 pkq, n 3 ` 1 ˘ 2 if β3 pkq “ 2 ù χT xn pk, nq “ χT xn β3 pkq, n ¨ χT xn β3 pkq, n 3 ` 1 ˘ ` 2 ˘ if β3 pkq “ 3 ù χT xn pk, nq “ χT xn β3 pkq, n ¨ χT xn β3 pkq, n ` ˘ ` ˘ else ù χT xn pk, nq “ 0.

By Lemma 126 this definition by case study yields a rim. ec. function. P R % 130

Lemma 131 The set of all codes of formulas from A that contain the variable xn L x “ xφy, n | φ is a formula from A and φ contains xn F L is rim. ec. ` ˘ ( P R

2 Proof of Lemma 131: Its characteristic function χF xn : N ÝÑ N is defined by:

3 1 2 if β3 pkq “ 4 ù χF xn pk, nq “ max χT xn β3 pkq, n , χT xn β3 pkq, n

3 2 ´ 1 ` ˘ ` ˘¯ if β3 pkq “ 5 and β3 pkq “ 0 ù χF xn pk, nq “ χF xn β3 pkq, n

3 ` 1˘ 2 if β3 pkq “ 6 ù χF xn pk, nq “ max χF xn β3 pkq, n , χF xn β3 pkq, n ´ ¯ 3 ` 1 ˘ ` 2 ˘ if β3 pkq “ 7 ù χF xn pk, nq “ max χF xn β3 pkq, n , χF xn β3 pkq, n ´ ¯ 3 ` 1 ˘ ` 2 ˘ if β3 pkq “ 8 ù χF xn pk, nq “ max χF xn β3 pkq, n , χF xn β3 pkq, n ´ ¯ 3 ` 1 ˘ ` 2 ˘ if β3 pkq “ 9 ù χF xn pk, nq “ max χF xn β3 pkq, n , χF xn β3 pkq, n

3 ´ 1 ` ˘ ` ˘¯ if β3 pkq “ 10 ù χF xn pk, nq “ χF xn β3 pkq, n 3 ` 1 ˘ if β3 pkq “ 11 ù χF xn pk, nq “ χF xn β3 pkq, n ` ˘ else ù χF xn pk, nq “ 0. 116 G¨odel& Recursivity

By Lemma 126 this definition by case study yields a rim. ec. function. P R % 131

Lemma 132 The set of all codes of formulas from A that do not contain the variable xn L

x “ xφy, n | φ is a formula from A and φ does not contain xn F L ` ˘ ( is rim. ec. P R

2 Proof of Lemma 132: Its characteristic function χF xn : N ÝÑ N is defined by :

3 1 2 if β3 pkq “ 4 ù χF xn pk, nq “ χT xn ˝ β3 pkq ¨ χT xn ˝ β3 pkq

3 2 1 if β3 pkq “ 5 and β3 pkq “ 0 ù χF xn pk, nq “ χF xn ˝ β3 pkq

3 1 2 if β3 pkq “ 6 ù χF xn pk, nq “ χF xn ˝ β3 pkq ¨ χF xn ˝ β3 pkq

3 1 2 if β3 pkq “ 7 ù χF xn pk, nq “ χF xn ˝ β3 pkq ¨ χF xn ˝ β3 pkq

3 1 2 if β3 pkq “ 8 ù χF xn pk, nq “ χF xn ˝ β3 pkq ¨ χF xn ˝ β3 pkq

3 1 2 if β3 pkq “ 9 ù χF xn pk, nq “ χF xn ˝ β3 pkq ¨ χF xn ˝ β3 pkq

3 1 if β3 pkq “ 10 ù χF xn pk, nq “ χF xn ˝ β3 pkq

3 1 if β3 pkq “ 11 ù χF xn pk, nq “ χF xn ˝ β3 pkq

else ù χF xn pk, nq “ 0.

By Lemma 126 this definition by case study yields a rim. ec. function. P R % 132

Lemma 133 The set of all codes of formulas from A that contain xn as a free variable L

x free “ xφy, n | φ is a formula from A and xn is free in φ F L ` ˘ ( is rim. ec. P R

Proof of Lemma 2 133: Its characteristic function χFx free : N ÝÑ N is defined by: Arithmetic 117

if 3 1 2 β3 pkq “ 4 ù χFx free pk, nq “ max χFx free β3 pkq, n , χFx free β3 pkq, n ´ ¯ if 3 and 2 1 ` ˘ ` ˘ β3 pkq “ 5 β3 pkq “ 0 ù χFx free pk, nq “ χFx free β3 pkq, n ` ˘ if 3 1 2 β3 pkq “ 6 ù χFx free pk, nq “ max χFx free β3 pkq, n , χFx free β3 pkq, n ´ ` ˘ ` ˘¯ if 3 1 2 β3 pkq “ 7 ù χFx free pk, nq “ max χFx free β3 pkq, n , χFx free β3 pkq, n ´ ` ˘ ` ˘¯ if 3 1 2 β3 pkq “ 8 ù χFx free pk, nq “ max χFx free β3 pkq, n , χFx free β3 pkq, n ´ ` ˘ ` ˘¯ if 3 1 2 β3 pkq “ 9 ù χFx free pk, nq “ max χFx free β3 pkq, n , χFx free β3 pkq, n ´ ¯ if 3 and 2 1 ` ˘ ` ˘ β3 pkq “ 10 β3 pkq ‰ n ù χFx free pk, nq “ χFx free β3 pkq, n if 3 and 2 ` 1 ˘ β3 pkq “ 11 β3 pkq ‰ n ù χFx free pk, nq “ χFx free β3 pkq, n else ` ˘ ù χFx free pk, nq “ 0.

By Lemma 126 this definition by case study yields a rim. ec. function. P R % 133

Lemma 134 The set of all codes of formulas from A that contain xn as a bound variable L

x bound “ xφy, n | φ is a formula from A and xn is bound in φ F L is rim. ec. ` ˘ ( P R

Proof of Lemma 134: we have

x bound “ x r x free F F F % 134

Lemma 135 The set of all codes of closed formulas from A L

closed “ xφy | φ is a closed formula from A F L is rim. ec. ( P R 118 G¨odel& Recursivity

Proof of Lemma 135: We have

k P closed ðñ k P and @n ď k pk, nq R x free. F F F % 135

3 T pN q Lemma 136 The function ub. P N defined below is rim. ec. S P R

xurt{xnsy if nu P , nt P and nu “ xuy, nt “ xty T T T ub. pnu, nt, nq S $ otherwise & 0 . % Proof of Lemma 136: We first recall the definition of xty:

t “ 0 ùx ty “ α3p0, 0, 0q

t “ xn ùx ty “ α3pn ` 1, 0, 0q

t “ St0 ùx ty “ α3pxty, 0, 1q

t “ t0`t1 ùx ty “ α3pxt0y, xt1y, 2q

t “ t0¨t1 ùx ty “ α3pxt0y, xt1y, 3q

3 T pN q ub. P N is defined by S

0 if nu R or nt R T 3 T 2 1 nt if nu, nt P and β pnuq “ 0 and β pnuq “ 0 and β pnuq “ n ` 1 $ T 3 3 3 ’ if and 3 and 2 and 1 ’ nu nu, nt P β3 pnuq “ 0 β3 pnuq “ 0 β3 pnuq ‰ n ` 1 T ’ T ub. pnu, nt, nq “ ’ T 1 3 2 1 S ’ α3p ub. β3 pnuq, nt, n , 0, 1q if nu, nt P and β3 pnuq “ 1 and β3 pnuq “ 0 and β3 pnuq P ’ S T T & T 1 T 2 3 2 1 α3p ub. `β3 pnuq, nt, n˘ , ub. β3 pnuq, nt, n , 2q if nu, nt P and β3 pnuq “ 2 and β3 pnuq P and β3 pnuq P S S T T T ’ T 1 T 2 3 2 1 ’ α3p ub. `β3 pnuq, nt, n˘ , ub. `β3 pnuq, nt, n˘ , 3q if nu, nt P and β3 pnuq “ 3 and β3 pnuq P and β3 pnuq P ’ S S T T T ’ ’ ` ˘ ` ˘ By Lemma% 126 T is rim. ec. Sub. P R % 136

3 F pN q Lemma 137 The function ub. P N defined below is rim. ec. S P R

xφrt{xnsy if nφ “ xφy P , nt “ xty P F F T ub. pnu, nt, nq “ S $ 0 otherwise . & % Proof of Lemma 137: We first recall the definition of xφy: Arithmetic 119

φ “ t0 “ t1 ùx φy “ α3pxt0y, xt1y, 4q

φ “ ψ ùx φy “ α3pxψy, 0, 5q

φ “ pφ0 ^ φ1q ùx φy “ α3pxφ0y, xφ1y, 6q

φ “ pφ0 _ φ1q ùx φy “ α3pxφ0y, xφ1y, 7q

φ “ pφ0 ÝÑ φ1q ùx φy “ α3pxφ0y, xφ1y, 8q

φ “ pφ0 ÐÑ φ1q ùx φy “ α3pxφ0y, xφ1y, 9q

φ “@xn ψ ùx φy “ α3pxψy, n, 10q

φ “Dxn ψ ùx φy “ α3pxψy, n, 11q.

3 F pN q ub. P N is defined by S

0 if nφ R or nt R T 1 T 2 F T 3 α3p β pnφq, nt, n , β pnφq, nt, n , 4q if nφ P and nt P and β pnφq “ 4 $ Sub. 3 Sub. 3 F T 3 F 1 3 ’ α3p ub. `β3 pnφq, nt, n˘ , 0, 5q` ˘ if nφ P and nt P and β3 pnφq “ 5 ’ S F T ’ F 1 F 2 3 ’ α3p ub. `β3 pnφq, nt, n˘ , ub. β3 pnφq, nt, n , 6q if nφ P and nt P and β3 pnφq “ 6 ’ S S F T ’ F 1 F 2 3 ’ α3p ub. `β3 pnφq, nt, n˘ , ub. `β3 pnφq, nt, n˘ , 7q if nφ P and nt P and β3 pnφq “ 7 ’ S S F T ’ F 1 F 2 3 F ’ α3p ub. `β3 pnφq, nt, n˘ , ub. `β3 pnφq, nt, n˘ , 8q if nφ P and nt P and β3 pnφq “ 8 ub. pnφ, nt, nq “ ’ S S F T S ’ F 1 F 2 3 ’ α3p ub. `β3 pnφq, nt, n˘ , ub. `β3 pnφq, nt, n˘ , 9q if nφ P and nt P and β3 pnφq “ 9 & S S F T F 1 2 3 2 α3p ub. `β3 pnφq, nt, n˘ , β3 pn`φq, 10q ˘ if nφ P and nt P and β3 pnφq “ 10 and β3 pnφq ‰ n ’ S F T ’ F 1 2 3 2 ’ α3p ub. `β3 pnφq, nt, n˘ , β3 pnφq, 11q if nφ P and nt P and β3 pnφq “ 11 and β3 pnφq ‰ n ’ S F T ’ 1 3 2 ’ β3 pnφq ` ˘ if nφ P and nt P and β3 pnφq “ 10 and β3 pnφq “ n ’ F T ’ 1 3 2 ’ β3 pnφq if nφ P and nt P and β3 pnφq “ 11 and β3 pnφq “ n ’ F T ’ ’ By Lemma 126% F is rim. ec. Sub. P R % 137 We will now define a way of coding (finite) sets of formulas. We will note really encode the set, but some finite sequence of formulas, because we will not care about the ordering of such a sequence, even if what we really encode is the sequence, we will handle it as if it were a set.

ω Definition 138 (coding and decoding sequences) We define both x y : Nă ÝÑ N and 2 z y : N ÝÑ N by

xεy “ 1 xx , . . . , x y “ Π p0qx0 ¨ Π p1qx1 ¨ ¨ ¨ Π ppqxp . " 0 p Where Π piq enumerates the prime numbers1. And znyi “ µx ď n Π piqx`1 does not divide n.

1 Π p0q “ 2; Π p1q “ 3; Π p2q “ 5; etc. 120 G¨odel& Recursivity

i Notice that for all i ď p we have zxx0, . . . , xpyy “ xi. Furthermore, for every formula φ, the inte- ăω i ger xφy is strictly positive. Therefore, given any sequence x0, . . . , xp P N if zxx0, . . . , xpyy “ 0 h i then we know for sure that xi does not code a formula.

We will say that the integer 1 codes the empty set – which is also an empty set of formulas – xφ0y and another integer codes the set ∆ “ tφ0, φ1, . . . , φpu if this integer is of the form Π pi0q ¨ xφ1y xφpy Π pi1q ¨ ¨ ¨ Π pipq .

Definition 139 (G¨odelnumbering of the A-finite sets of formulas) The G¨odelnumber- L ing of any set ∆ “ tφ0, φ1, . . . , φpu of A-formulas is any integer of the form L xHy “ 1

xφ0y xφ1y xφpy # x∆y “ Π pi0q ¨ Π pi1q ¨ ¨ ¨ Π pipq . We denote the set of codes of finite sets of formulas: CPfin.pFq “ tx∆y | ∆ is some finite set of A formulasu. CPfin.pFq L

Lemma 140 The set of codes of finite sets of formulas is rim. ec. CPfin.pFq P R

Proof of Lemma 140:

1 if n “ 1 1 if n ‰ 1 and @i ď n znyi ą 0 ÝÑ znyi P χCP pFq pnq “ $ fin. ’ F &’ 0 else “ ‰ ’ % 140 %’

2 2 Lemma 141 There exist two rim. ec. functions em. : N ÝÑ N and dd. : N ÝÑ N such P R R A that

x∆ Y φy if n “ xφy P and m “ x∆y P F CPfin.pFq em. pn, mq “ R $ 0 if n R or m R & F CPfin.pFq % x∆ r tφuy if n “ xφy P and m “ x∆y P P pFq F C fin. dd. pn, mq “ A $ 0 if n R or m R & F CPfin.pFq % Arithmetic 121

Proof of Lemma 141:

0 if n R or m R Pfin.pFq pn, mq “ F C dd. n A $ m ¨ Π µi ď m zmyi “ 0 if xφy “ n P and x∆y “ m P . & F CPfin.pFq % ` ˘

0 if n R or m R F CPfin.pFq $ i em. pn, mq “ m if n P and m P Pfin.pFq and @i ď m zmy ‰ n R ’ F C ’ m i & n i if n P and m P Pfin.pFq and Di ď m zmy “ n ¨Π µi ď m zmy “ n F C ’ „  ’ 141 %’ ` ˘ %

Lemma 142 The following set is rim. ec. P R 2 ns. “ pxφy, x∆yq P N | xφy P , x∆y P P pFq and φ P ∆ . I F C fin. ! ) We will use a relation-like notation and write xφy ns. x∆y instead of pxφy, x∆yq P ns.. I I

Proof of Lemma 142: Π piqn divides m

$ 1 if n P and m P P F and Di ď m $ and χ pn, mq “ fin.p q ns. ’ F C ’ I ’ &’ n`1 does not divides &’ Π piq m 0 else. ’ ’ %’ ’ %’ % 142

Lemma 143 The following set is rim. ec. P R 2 qu. “ pxΓy, x∆yq P N | xΓy P P pFq, x∆y P P pFq and Γ “ ∆ . E C fin. C fin. Notice that the equality! “ Γ “ ∆” is between two sets, therefore it relies on extensionality.) We will use a relation-like notation and write xφy qu. x∆y instead of pxφy, x∆yq P qu.. E E Proof of Lemma 143: We have

1 if n, m P P pFq and @i ď maxpn, mq i P Ñ pi ns. n Ø i ns. mq χ pn, mq “ C fin. F I I qu. E # 0 else. ` ˘ % 143 122 G¨odel& Recursivity

p 2q Lemma 144 There exists a rim. ec. function nion P N N such that P R U

0 if n R or m R CPfin.pFq CPfin.pFq nion pn, mq “ U $ 1 1 1 1 xΓ Y ∆ y if n “ xΓy P and m “ x∆y P and xΓ Y ∆ y qu. xΓ Y ∆y & CPfin.pFq CPfin.pFq E

% 3 Proof of Lemma 144: We first define f P NpN q by recursion:

0 0 fpγ, δ, 0q “ Π p0qzγy ¨ Π p1qzδy

$ zγyn zδyn & fpγ, δ, n ` 1q “ Π p2nq ¨ Π p2n ` 1q ¨ fpγ, δ, nq. % Then we set nion pγ, δq “ fpγ, δ, maxpγ, δqq. U % 144

Definition 145 (G¨odelnumbering of the A-sequents from sequent calculus) The G¨odel L numbering of any sequent Γ $ ∆ is

xΓ $ ∆y “ α2pxΓy, x∆yq We denote the set of codes of finite sets of formulas: SQ “ txΓ $ ∆y | Γ, ∆ finite sets of A formulasu. SQ L

l 1 r 2 Given any integer n we use the notation n for β2 pnq and n for β2 pnq. This way, if n “ xΓ $ ∆y, then ln “ xΓy and rn “ x∆y.

Lemma 146 The set of codes of sequents of sequent calculus is rim. ec. SQ P R

Proof of Lemma 146:

1 if ln P and rn P CPfin.pFq CPfin.pFq χSQpnq “ $ else & 0 % 146 % We will now denote the set of codes of axioms of sequent calculus which are not to be AX mistaken for the axiom of Robinson arithmetic. Arithmetic 123

Definition 147 (G¨odelnumbering of the axioms of sequent calculus)

xφy xφy “ α2 2 , 2 | xφy P . AX F ! ` ˘ )

Lemma 148 The set of codes of axioms of sequent calculus is rim. ec. AX P R

Proof of Lemma 148:

1 if β1pnq “ β2pnq and zβ1pnqy0 P 2 2 2 F χAX pnq “ $ 0 else & % 5.2 Coding the Proofs

We recall that a proof in Sequent Calculus is a tree of the form

ax ax @x pφ Ñ ψq $ @x pφ Ñ ψq @x φ $ @x φ @e @e @x pφ ÝÑ ψq $ φry{xs Ñ ψry{xs @x φ $ φry{xs Ñ e @x pφ Ñ ψq, @x φ $ ψry{xs @i @x pφ Ñ ψq, @x φ $ @x ψ Ñ i @x pφ Ñ ψq $ @x φ Ñ@x ψ where the shape of the tree is controlled by the rules of Sequent Calculus.

We are now ready to define for each rule of the Sequent Calculus, a set of tuples of codes of sequents that satisfy the property that the rule defines. We will successively define

(1) ˝ ax P N R 2 2 2 2 (2) ˝ ^l1 P N ˝ Dl P N ˝ @r P N ˝ ctr l&r P N R R R R 2 2 2 2 ˝ ^l2 P N ˝ _r1 P N ˝ Dr P N ˝ cut P N R 2 R 2 R 2 R ˝ l P N ˝ _r2 P N ˝ wknl P N R 2 R 2 R 2 ˝ @l P N ˝ r P N ˝ wknr P N R R R 3 3 3 (3) ˝ _l P N ˝ Ñl P N ˝ ^r P N R R R and for each of them, the fact that it is rim. ec. will derive from its definition. We first recall P R what the rules are. 124 G¨odel& Recursivity

Sequent Calculus

Axioms

ax φ $ φ

Logical Rules Γ, φ $ ∆ Γ, ψ $ ∆ Γ $ φ, ∆ Γ $ ψ, ∆ ^l1 ^l2 ^r Γ, φ ^ ψ $ ∆ Γ, φ ^ ψ $ ∆ Γ $ φ ^ ψ, ∆

Γ, φ $ ∆ Γ, ψ $ ∆ Γ $ φ, ∆ Γ $ ψ, ∆ _l _r1 _r2 Γ, φ _ ψ $ ∆ Γ $ φ _ ψ, ∆ Γ $ φ _ ψ, ∆

Γ $ φ, ∆ Γ, ψ $ ∆ Γ, φ $ ψ, ∆ Ñl Ñr Γ, φ Ñ ψ $ ∆ Γ $ φ Ñ ψ, ∆

Γ $ φ, ∆ Γ, φ $ ∆ l r Γ, φ $ ∆ Γ $ φ, ∆

1 Γ, φrt{xs $ ∆ Γ $ φry{xs, ∆ @l @r Γ, @x φ $ ∆ Γ $ @x φ, ∆ 2

1 Γ, φry{xs $ ∆ Γ $ φrt{xs, ∆ Dl Dr Γ, Dx φ $ ∆ 2 Γ $ Dx φ, ∆

Structural Rules Γ $ ∆ Γ $ ∆ wknl wknr Γ, φ $ ∆ Γ $ φ, ∆

Γ, φ, φ $ ∆ Γ $ φ, φ, ∆ ctrl ctrr Γ, φ $ ∆ Γ $ φ, ∆

Cut Rule Γ $ φ, ∆ Γ1, φ $ ∆1 cut Γ, Γ1 $ ∆, ∆1

1t a term 2y with no free occurrence the sequent concluding the rule (not in Γ, Dx φ nor @x φ, nor ∆) Arithmetic 125

ax φ $ φ

U P ax ðñ U P R AX

......

Γ, φ $ ∆ ^l1 Γ, φ ^ ψ $ ∆

pU, Dq P R^l1 ðñ U P SQ $ and ’ ’ D P ’ SQ ’ ’ and ’ ’ rU rD ’ qu. ’ E & and l l ’ xφy ns. U and xφ ^ ψy ns. D ’ I I ’ l l ’ Dxφy ď U Dxψy ď D ¨ and ˛ ’ ’ l l ’ ˚ em. xφy, U qu. em. xφ ^ ψy, D ‹ ’ ˚ R E R ‹ ’ ˝ ‚ %’ ` ˘ ` ˘ where

˝ “ xφ ^ ψy” stands for “ α3pxφy, xψy, 6q”.

˝ “ Dxφy ď k θ s” stands for “ Dn ď k n P ^ θ ” and more generally rxφy{ys F rn{ys ` ˘ ˝ “ Dxφ1y ď k1 ...... Dxφny ď kn θrxφ1y{y1,...,xφny{yns” stands for i i “ Dp ď αnpk1, . . . , knq β ppq P ^ β ppq ď ki ^ θ 1 n ”. n F n rβnppq{y1,...,βn ppq{yns iďn `ľ ` ˘ ˘

...... 126 G¨odel& Recursivity

Γ, ψ $ ∆ ^l2 Γ, φ ^ ψ $ ∆

pU, Dq P R^l2 ðñ U P SQ $ and ’ ’ D P ’ SQ ’ ’ and ’ ’ rU rD ’ qu. ’ E & and l l ’ xψy ns. U and xφ ^ ψy ns. D ’ I I ’ l l ’ Dxψy ď U Dxφy ď D ¨ and ˛ ’ ’ l l ’ ˚ em. xψy, U qu. em. xφ ^ ψy, D ‹ ’ ˚ R E R ‹ ’ ˝ ‚ %’ ` ˘ ` ˘ ......

Γ, φ $ ∆ Γ, ψ $ ∆ _l Γ, φ _ ψ $ ∆

pUl,Ur, dq P R_l ðñ

Ul,Ur,D P SQ $ and ’ r r r ’ Ul qu. Ur qu. D ’ E E ’ ’ and ’ l l l &’ xφy ns. Ul and xψy ns. Ur and xφ ^ ψy ns. D I I I l l ’ Dxφy ď Ul Dxψy ď Ur ¨ and ˛ ’ ’ l l l ’ ˚ em. xφy, Ul qu. em. xψy, Ur qu. em. xφ ^ ψy, D ‹ ’ ˚ R E R E R ‹ ’ ˝ ‚ %’ ` ˘ ` ˘ ` ˘

...... Arithmetic 127

Γ $ φ, ∆ Γ, ψ $ ∆ Ñl Γ, φ Ñ ψ $ ∆

pUl,Ur,Dq P RÑl ðñ Ul,Ur,D P SQ $ and ’ ’ r r ’ Ur qu. D ’ E ’ and ’ ’ r and l and l ’ xφy ns. Ul xψy ns. Ur xφ ^ ψy ns. D ’ I I I ’ and ’ ¨ ˛ ’ r r &’ em. pxφy, Ulq qu. Ur ˚ R E ‹ r l ˚ ‹ ’ Dxφy ď Ul Dxψy ď Ur ˚ and ‹ ’ ˚ ‹ ’ ˚ l l l ‹ ’ ˚ em. xψy, Ur qu. Ul qu. em. xφ Ñ ψy, D ‹ ’ ˚ R E E R ‹ ’ ˚ ‹ ’ ˚ ` ˘ and ` ˘ ‹ ’ ˚ ‹ ’ ˚ l l ‹ ’ ˚ em. xψy, Ur qu. em. xφ Ñ ψy, D ‹ ’ ˚ R E R ‹ ’ ˝ ‚ %’ ` ˘ ` ˘ ˝ where “ A qu. B qu. C ” stands for “ A qu. B and B qu. C ” E E E E

......

Γ $ φ, ∆ l Γ, φ $ ∆

pU, Dq P R l ðñ U, D P SQ $ and ’ r l ’ xφy ns. U and x φy ns. D ’ I I ’ r & Dxφy ď U ¨ and ˛ r l ’ ˚ em. pxφy, Uq qu. em. x φy, D ‹ ’ ˚ R E R ‹ ’ ˝ ‚ %’ ` ˘ ...... 128 G¨odel& Recursivity

Γ, φrt{xns $ ∆ @l Γ, @xn φ $ ∆

pU, Dq P R@l ðñ U, D P SQ $ and ’ ’ rU rD ’ qu. ’ E ’ and ’ ’ x@x φy lD and xφy, n P ’ n ns. x free ’ I F ’ and ’ ¨ ¨ ` ˘ ˛ ˛ ’ F l ’ pxφy, xty, nq ns. U ’ ˚ ˚ Sub. I ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ and ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ F l l ‹ ‹ ’ ˚ ˚ em. pxφy, xty, nq, U qu. em. x@xnφy, D ‹ ‹ ’ ˚ ˚ R Sub. E R ‹ ‹ ’ ˚ ˝ ‚ ‹ ’ ˚ ` ˘ ` ˘ ‹ ’ ˚ ‹ ’ ˚ or ‹ ’ ˚ ‹ ’ ˚ ‹ &’ ˚ ‹ ˚ l ‹ l l l ˚ x@xnφy ns. D ‹ ’ Dn ď D Dx@xnφy ď D Dxty ď U ˚ ‹ ’ ˚ I ‹ ’ ˚ ¨ and ˛ ‹ ’ ˚ ‹ ’ ˚ ‹ ’ ˚ ˚ xφy, n P x Y x bound ‹ ‹ ’ ˚ ˚ F F ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ ` ˘ ` and ˘ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ l ‹ ‹ ’ ˚ xφy ns. U ‹ ’ ˚ ˚ I ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ and ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ F l ‹ ’ ˚ ˚ ub. pxφy, xty, nq ns. U ‹ ‹ ’ ˚ ˚ S I ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ and ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ l l ‹ ‹ ’ ˚ ˚ em. xφy, U qu. em. x@xnφy, D ‹ ‹ ’ ˚ ˚ R E R ‹ ‹ ’ r r ˝ ˝ ‚ ‚ %’ ˝ “ Dn ď U Dx@xnφy ď U...” stands for ` ˘ ` ˘ “ Dn ď rU Dm ď rU m P ^ β3pmq “ 10 ^ β2pmq “ n ^ β1pmq “ xφy ^ ... ” F 3 3 3 1 ´ ¯ ˝ “ xφy stands for “ β3 x@xnφy ” ˝ “ Dxty ď lU...” stands` for “˘Dv ď lU v P ^ ... ” T ...... ` ˘ Arithmetic 129

Γ, φrxk{xns $ ∆ D 2 l Γ, Dxn φ $ ∆

pU, Dq P RDl ðñ U, D P SQ $ and ’ r r ’ U qu. D ’ E ’ and ’ ’ l l ’ xDxnφy ns. D and xψy ns. U ’ I I ’ ’ ¨ ¨ and ˛ ˛ ’ ’ ’ ˚ ˚ xψy, k P and k ‰ n Ñ xψy, n P Y ‹ ‹ ’ ˚ ˚ x free x x bound ‹ ‹ ’ ˚ ˚ F F F ‹ ‹ ’ ˚ ˚ ´ ¯ ‹ ‹ ’ ˚ ˚ ` ˘ and ` ˘ ` ˘ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ F ‹ ’ ˚ α3p ub. pxψy, xxny, kq , n, 11q “ xDxnφy ‹ ’ ˚ ˚ S ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ and ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ l l ‹ ‹ ’ ˚ ˚ em. xψy, U qu. em. xDxnφy, D ‹ ‹ ’ ˚ ˚ R E R ‹ ‹ ’ ˚ ˚ and ‹ ‹ ’ ˚ ˚ ` ˘ ` ˘ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ l l ‹ ‹ & ˚ ˚ @xθy ď D xθy ns. D Ñ pxθy, kq P x Y x bound ‹ ‹ ˚ ˚ I F k F k ‹ ‹ Dxx y ď lD Dxx y ď lU DxDx φy ď lD Dxψy ď lU ˚ ˚ ‹ ‹ ’ n k n ˚ ˚ ´ and ` ˘¯ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ r r ‹ ‹ ’ ˚ ˚ @xδy ď D xδy ns. D Ñ pxδy, kq P xk Y xk bound ‹ ‹ ’ ˚ ˚ I F F ‹ ‹ ’ ˚ ˚ ´ ¯ ‹ ‹ ’ ˚ ˝ ` ˘ ‚ ‹ ’ ˚ ‹ ’ ˚ ‹ ’ ˚ or ‹ ’ ˚ ‹ ’ ˚ ‹ ’ ˚ ‹ ’ ˚ l l ‹ ’ ˚ xDxnφy ns. D and xψy ns. U and ‹ ’ ˚ I I ‹ ’ ˚ ‹ ’ ˚ ¨ and ˛ ‹ ’ ˚ xψy, k P xk Y xk bound xψy, n P x Y x bound ‹ ’ ˚ F F F F ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ ` ˘ ` and α3pxψy, n,˘ 11q “ xD`xnφy ˘and` ˘ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ l l ‹ ‹ ’ ˚ ˚ em. xψy, U qu. em. xDxnφy, D ‹ ‹ ’ ˚ ˚ R E R ‹ ‹ ’ ˝ ‚ ’ ˝ ` ˘ ` ˘ ‚ where%

r r ˝ “ Dn ď U Dx@xnφy ď U...” stands for “ Dn ď rU Dm ď rU m P ^ β3pmq “ 11 ^ β2pmq “ n ^ β1pmq “ xφy ^ ... ” F 3 3 3 1 ´ ¯ ˝ “ xφy stands for “ β3 x@xnφy ” l l ˝ “ Dxxky ď U...” stands` for˘ “ Dk ď U xxky “ α3pk ` 1, 0, 0q ^ ... ”

...... ` ˘

2 xk has no free occurrence in Γ, Dxn φ and ∆ 130 G¨odel& Recursivity

Γ $ φ, ∆ Γ $ ψ, ∆ ^r Γ $ φ ^ ψ, ∆

pUl,Ur,Dq P R^r ðñ

Ul,Ur,D P SQ $ and ’ l l l ’ Ul qu. Ur qu. D ’ E E ’ ’ and ’ r r r ’ xφy ns. Ul and xψy ns. Ur and xφ ^ ψy ns. D & I I I r r and ’ Dxφy ď Ul Dxψy ď Ur ¨ ˛ ’ r r r ’ em. pxφy, Ulq qu. em. pxψy, Urq qu. em. pxφ ^ ψy, Dq ’ ˚ R E R E R ‹ ’ ˚ ‹ ’ ˝ ‚ %’

......

Γ $ φ, ∆ _r1 Γ $ φ _ ψ, ∆

pU, Dq P R_r1 ðñ U, D P SQ $ and ’ l l ’ U qu. D ’ E ’ ’ and ’ r r ’ xφy ns. U and xφ _ ψy ns. D & I I r r and ’ Dxφy ď U Dxψy ď D ¨ ˛ ’ r r ’ em. pxφy, Uq qu. em. pxφ _ ψy, Dq ’ ˚ R E R ‹ ’ ˚ ‹ ’ ˝ ‚ %’

...... Arithmetic 131

Γ $ ψ, ∆ _r2 Γ $ φ _ ψ, ∆

pU, Dq P R_r2 ðñ U, D P SQ $ and ’ l l ’ U qu. D ’ E ’ ’ and ’ r r ’ xψy ns. U and xφ _ ψy ns. D & I I r r and ’ Dxψy ď U Dxφy ď D ¨ ˛ ’ r r ’ em. pxψy, Uq qu. em. pxφ _ ψy, Dq ’ ˚ R E R ‹ ’ ˚ ‹ ’ ˝ ‚ %’

......

Γ, φ $ ψ, ∆ Ñr Γ $ φ Ñ ψ, ∆

pUl,Ur,Dq P RÑr ðñ

Ul,Ur,D P SQ $ and ’ l r r ’ xφy ns. Ul and xψy ns. Ur and xφ Ñ ψy ns. D ’ I I I ’ ’ ¨ and ˛ ’ ’ l r r r & Dxφy ď Ul Dxψy ď Ur ˚ em. pxψy, Urq qu. em. pxφ Ñ ψy, Dq ‹ ˚ R E R ‹ ’ ˚ and ‹ ’ ˚ ‹ ’ ˚ l l ‹ ’ ˚ em. xφy, Ul qu. D ‹ ’ ˚ R E ‹ ’ ˚ ‹ ’ ˝ ` ˘ ‚ %’

...... 132 G¨odel& Recursivity

Γ, φ $ ∆ r Γ $ φ, ∆

pU, Dq P R r ðñ U, D P SQ $ and ’ l r ’ xφy ns. U and x φy ns. D ’ I I ’ l & Dxφy ď U ¨ and ˛ l r ’ ˚ em. xφy, U qu. em. px φy, Dq ‹ ’ ˚ R E R ‹ ’ ˝ ‚ %’ ` ˘

...... Arithmetic 133

Γ $ φrxk{xns, ∆ @ 2 r Γ $ @xn φ, ∆

pU, Dq P R@r ðñ U, D P SQ $ and ’ l l ’ U qu. D ’ E ’ and ’ ’ r r ’ x@xnφy ns. D and xψy ns. U ’ I I ’ ’ ¨ ¨ and ˛ ˛ ’ ’ ’ ˚ ˚ xψy, k P and k ‰ n Ñ xψy, n P Y ‹ ‹ ’ ˚ ˚ x free x x bound ‹ ‹ ’ ˚ ˚ F F F ‹ ‹ ’ ˚ ˚ ´ ¯ ‹ ‹ ’ ˚ ˚ ` ˘ and ` ˘ ` ˘ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ F ‹ ’ ˚ α3p ub. pxψy, xxny, kq , n, 11q “ x@xnφy ‹ ’ ˚ ˚ S ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ and ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ r r ‹ ‹ ’ ˚ ˚ em. pxψy, Uq qu. em. px@xnφy, Dq ‹ ‹ ’ ˚ ˚ R E R ‹ ‹ ’ ˚ ˚ and ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ r r ‹ ‹ & ˚ ˚ @xθy ď D xθy ns. D Ñ pxθy, kq P x Y x bound ‹ ‹ ˚ ˚ I F k F k ‹ ‹ Dxx y ď rD Dxx y ď rU DxDx φy ď rD Dxψy ď rU ˚ ˚ ‹ ‹ ’ n k n ˚ ˚ ´ and ` ˘¯ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ r r ‹ ‹ ’ ˚ ˚ @xδy ď D xδy ns. D Ñ pxδy, kq P xk Y xk bound ‹ ‹ ’ ˚ ˚ I F F ‹ ‹ ’ ˚ ˚ ´ ¯ ‹ ‹ ’ ˚ ˝ ` ˘ ‚ ‹ ’ ˚ ‹ ’ ˚ ‹ ’ ˚ or ‹ ’ ˚ ‹ ’ ˚ ‹ ’ ˚ ‹ ’ ˚ r r ‹ ’ ˚ x@xnφy ns. D and xψy ns. U and ‹ ’ ˚ I I ‹ ’ ˚ ‹ ’ ˚ ¨ and ˛ ‹ ’ ˚ xψy, k P xk Y xk bound xψy, n P x Y x bound ‹ ’ ˚ F F F F ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ ` ˘ ` and α3pxψy, n,˘ 11q “ x@`xnφy ˘and` ˘ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ r r ‹ ‹ ’ ˚ ˚ em. pxψy, Uq qu. em. px@xnφy, Dq ‹ ‹ ’ R E R ’ ˚ ˚ ‹ ‹ ’ ˝ ˝ ‚ ‚ where%

r r ˝ “ Dn ď U Dx@xnφy ď U...” stands for “ Dn ď rU Dm ď rU m P ^ β3pmq “ 10 ^ β2pmq “ n ^ β1pmq “ xφy ^ ... ” F 3 3 3 1 ´ ¯ ˝ “ xφy stands for “ β3 x@xnφy ” r r ˝ “ Dxxky ď U...” stands` for˘ “ Dk ď U xxky “ α3pk ` 1, 0, 0q ^ ... ”

...... ` ˘

2 xk has no free occurrence in Γ, @xn φ and ∆ 134 G¨odel& Recursivity

Γ $ φrt{xns, ∆ Dr Γ $ Dxn φ, ∆

pU, Dq P RDr ðñ U, D P SQ $ and ’ ’ lU lD ’ qu. ’ E ’ and ’ ’ xDx φy rD and xφy, n P ’ n ns. x free ’ I F ’ and ’ ¨ ¨ ` ˘ ˛ ˛ ’ F r ’ pxφy, xty, nq ns. U ’ ˚ ˚ Sub. I ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ and ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ F r r ‹ ‹ ’ ˚ ˚ em. p pxφy, xty, nq, Uq qu. em. pxDxnφy, Dq ‹ ‹ ’ ˚ ˚ R Sub. E R ‹ ‹ ’ ˚ ˝ ‚ ‹ ’ ˚ ‹ ’ ˚ ‹ ’ ˚ or ‹ ’ ˚ ‹ ’ ˚ ‹ &’ ˚ ‹ ˚ r ‹ r r r ˚ xDxnφy ns. D ‹ ’ Dn ď D DxDxnφy ď D Dxty ď U ˚ ‹ ’ ˚ I ‹ ’ ˚ ¨ and ˛ ‹ ’ ˚ ‹ ’ ˚ ‹ ’ ˚ ˚ xφy, n P x Y x bound ‹ ‹ ’ ˚ ˚ F F ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ ` ˘ ` and ˘ ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ r ‹ ‹ ’ ˚ xφy ns. U ‹ ’ ˚ ˚ I ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ and ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ F r ‹ ’ ˚ ˚ ub. pxφy, xty, nq ns. U ‹ ‹ ’ ˚ ˚ S I ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ and ‹ ‹ ’ ˚ ˚ ‹ ‹ ’ ˚ ˚ r r ‹ ‹ ’ ˚ ˚ em. pxφy, Uq qu. em. pxDxnφy, Dq ‹ ‹ ’ ˚ ˚ R E R ‹ ‹ ’ r r ˝ ˝ ‚ ‚ %’ ˝ “ Dn ď U DxDxnφy ď U...” stands for “ Dn ď rU Dm ď rU m P ^ β3pmq “ 11 ^ β2pmq “ n ^ β1pmq “ xφy ^ ... ” F 3 3 3 1 ´ ¯ ˝ “ xφy stands for “ β3 xDxnφy ” ˝ “ Dxty ď rU...” stands` for “˘ Dv ď rU v P ^ ... ” T ...... ` ˘ Arithmetic 135

Γ $ ∆ wknl Γ, φ $ ∆

pU, Dq P wkn R l ðñ U, D P SQ $ and ’ r r ’ U qu. D ’ E ’ ’ and ’ l &’ xφy ns. D I l ’ Dxφy ď D ¨ and ˛ ’ ’ l l ’ ˚ em. xφy, D qu. U ‹ ’ ˚ R E ‹ ’ ˝ ‚ %’ ` ˘

......

Γ $ ∆ wknr Γ $ φ, ∆

pU, Dq P wkn R r ðñ U, D P SQ $ and ’ l l ’ U qu. D ’ E ’ ’ and ’ r &’ xφy ns. D I r ’ Dxφy ď D ¨ and ˛ ’ ’ r r ’ ˚ em. pxφy, Dq qu. U ‹ ’ ˚ R E ‹ ’ ˝ ‚ %’

...... 136 G¨odel& Recursivity

Γ, φ, φ $ ∆ Γ $ φ, φ, ∆ ctrl ctrr Γ, φ $ ∆ Γ $ φ, ∆

U, D P SQ $ and ’ l l pU, Dq P ctr l&r ðñ ’ U qu. D R ’ E &’ and r r U qu. D ’ E ’ ’ %’

......

Γ $ φ, ∆ Γ1, φ $ ∆1 cut Γ, Γ1 $ ∆, ∆1

pUl,Ur,Dq P cut R ðñ

Ul,Ur,D P SQ $ and ’ r l ’ xφy ns. Ul and xφy ns. Ur ’ I I ’ ’ ¨ and ˛ ’ ’ r l l l & Dxφy ď Ul ˚ nion em. xφy, Ur , Ul qu. D ‹ ˚ U R E ‹ ’ ˚ ` ` and ˘ ˘ ‹ ’ ˚ ‹ ’ ˚ r r r ‹ ’ ˚ nion p em. pxφy, Ulq, Urq qu. D ‹ ’ ˚ U R E ‹ ’ ˚ ‹ ’ ˝ ‚ %’

...... Arithmetic 137

We write

0 “ ax R R

$ ^ Y ^ Y Y @ Y D Y ’ R l1 R l2 R l R l R l ’ 1 “ Y Y Y Y Y ’ R $ R_r1 R_r2 R r R@r RDr ’ wkn Y wkn Y ctr Y cut & & R l R r R l&r R 2 ’ “ %_l Y Ñl Y ^r ’ R R R R ’ %’

We say an integer codes a proof if it is of the form

α4pnode, left proof-tree, right proof-tree, arity of the ruleq.

Definition 149 The set roofs of the codes of all possible proofs is defined by P

k “ α4pn1, n2, n3, n4q P roofs P ðñ 0 n4 “ 0 and n3 “ 0 and n2 “ 0 and n1 P R $ or ’ 1 ’ n4 “ 1 and n3 “ 0 and n2 P roofs and pn2, n1q P ’ P R &’ or 2 ’ n4 “ 2 and n3 P roofs and n2 P roofs and pn3, n2, n1q P . ’ P P R ’ %’

Notation 150 Given any proof P we write xP y for the integer described above that codes this proof.

Lemma 151 The set roofs is rim. ec.. P P R

Proof of Lemma 151:

1 if β4pnq “ 0 and β3pnq “ 0 and β2pnq “ 0 and β1pnq P 0 4 4 4 4 R $ 4 3 2 2 1 1 1 if β4 pnq “ 1 and β4 pnq “ 0 and χProofs β4 pnq “ 1 and β4 pnq, β4 pnq P ’ R χProofs pnq “ ’ ’ 4 3 ` 2 ˘ ` 3 2 ˘ 1 2 ’ 1 if β4 pnq “ 2 and χProofs β4 pnq “ χProofs β4 pnq “ 1 and β4 pnq, β4 pnq, β4 pnq P & R otherwise ` ˘ ` ˘ ` ˘ ’ 0 . ’ ’ %’ 138 G¨odel& Recursivity

By Lemma 126 roofs is rim. ec. P P R % 151

5.3 Undecidability of Robinson Arithmetic

Theorem 152 Given any theory T , the set

2 xP y, xφy P N | P is a proof of T $c φ ! ) is ` ˘

˝ primitive recursive if T is primitive recursive,

˝ recursive if T is recursive.

Proof of Theorem 152: First, P is proof that T $c φ if P is a proof-tree whose root is some sequent “∆ $ φ” for some finite ∆ Ď T . We recall Lemma 135 which stated that the following set is rim. ec. P R

closed “ xφy | φ is a closed formula from A F L Second, let χT P N ÝÑ N be the characteristic function of T . i.e. (

1 if n “ xφy P T χT pnq “ # 0 otherwise. The characteristic function of

2 A “ xP y, xφy P N | P is a proof of T $c φ ! ) is ` ˘

n P roofs P $ $ and ’ ’ ’ ’ m P ’ ’ F ’ ’ and ’ 1 if ’ ’ ’ χApn, mq “ ’ ’ @i ď lβ1pnq zlβ1pnqyi ‰ 0 ÝÑ χ zlβ1pnqyi “ 1 ’ & 4 4 T 4 &’ ’ and ` ˘ ’ ’ ’ ’ ’ @j ď rβ1pnq zrβ1pnqyj “ m ’ ’ 4 4 ’ ’ ’ ’ ` ˘ ’ 0 otherwise. %’ ’ ’ %’ Arithmetic 139

We see that this function is primitive recursive if χT is primitive recursive, and total recursive if χT is total recursive. % 152

Definition 153

(1) A theory T is recursive if the following set is recursive:

xφy | φ P T . ! ) (2) A theory T is decidable if the following set is recursive:

xφy | T $c φ . ! )

Informally, this means that a theory is decidable if one has an algorithm which on any input that represents a formula φ stops and accepts if T proves φ, and stops and rejects if T does not prove φ.

Proposition 154 Given any theory T ,

xψy | ψ P T is recursive ùñ xφy | T $c φ is recursively enumerable. ! ) ! ) Proof of Proposition 154: We set

2 A “ xP y, xφy P N | P is a proof of T $c φ and B “ xφy | T $c φ . !` ˘ ) ! ) By Theorem 152, the set A is recursive. Hence the function

part χB pnq “ 1 ´9 1 ´9 µk χApk, nq “ 1 ´ ` ˘¯ is also art. ec. and it satisfies n P B ðñ χpartpnq “ 1. % 154 P R B We recall that a theory is complete if it is both consistent and satisfies for each formula φ either

T $c φ or T $c φ.

Corollary 155 Let T be any recursive theory.

If T is complete, then T is decidable. 140 G¨odel& Recursivity

Proof of Corollary 155: By Proposition 154 both sets

xφy | T $c φ and x φy | T $c φ ! ) ! ) are recursively enumerable. Since T is complete we have

xφy | T &c φ “ x φy | T $c φ ! ) ! ) Hence

N r xφy | T $c φ “ N r Y x φy | T $c φ F is recursively enumerable, which! yields the) result.` ˘ ! ) % 155

Theorem 156 Let T Ě ob. be any theory, R T is consistent ðñ T is undecidable.

Proof of Theorem 156:

(ð) T inconsistent ñ T decidable is straightforward since in this case we have

xφy | T $ φ “ . c F ! ) (ñ) Towards a contradiction, we assume that T is decidable. We then consider

x “ xφy | φ is a formula whose only free variable is x0 . F 0 !free Since we already know that the set (

x free “ xφy, n | φ is a formula from A and xn is free in φ F L is rim. ec. (see Lemma ` 133)˘ and we have ( P R

xφy P x ðñ xφy, 0 P x free and @n ď xφy n ‰ 0 Ñ xφy, n R x free . F 0 !free F F ` ˘ ´ ` ˘ ¯ an immediate consequence is that x is also rim. ec. F 0 !free P R Then the set2

xφy, n | xφy P x and T $c φrn{x0s F 0 !free !` ˘ ) xφrt{xnsy if nφ “ xφy P F, nt “ xty P T 2 F we recall that on page 118 we defined Sub. pnu, nt, nq “ $ 0 otherwise . & % Arithmetic 141

F xφy, n | xφy P x and pxφy, xny, 0q P xψy | T $c ψ F 0 !free Sub. ! ) is recursive. ` ˘ ( We then consider the following set

˘: iag. “ k P N | pk, kq R xφy, n | xφy P x0 !free and T $c φrn{x0s . D F " * !` ˘ ) : : iag.˘ is clearly recursive, therefore there exists some function φ px0q that represents iag.˘ . D ˘: D This means that for all k P N we have: ˘: ˝ k P iag. ùñ ob. $c φ D R rk{x0s ˘: ˝ k R iag. ùñ ob. $c φ . D R rk{x0s

xφ˘:y It is enough to consider the closed formula φ where xφ y stands for the term S...S 0. rxφ˘:y{x0s ˘: As with the Halting problem where we asked the question whether our machine wouldhkkikkj stop

on its own code as input, here we ask the question whether or not T proves φ˘: . rxφ˘:y{x0s : This depends on whether xφ y belongs to iag.˘ or not. ˘: D ˘: ˘: ˝ xφ˘:y P iag. ùñ ob. $c φ˘:rxφ y{x s ùñ T $c φ˘:rxφ y{x s ùñ xφ˘:y R iag. D R ˘: 0 ˘: 0 D ˘: ˝ xφ˘:y R iag. ùñ ob. $c φ˘:rxφ y{x s ùñ T $c φ˘:rxφ y{x s. D R ˘: 0 ˘: 0 Since T is consistent we cannot have both

T $c φ˘: and T $c φ˘: . rxφ˘:y{x0s rxφ˘:y{x0s

˘: Therefore, we have T &c φ˘:rxφ y{x s which immediately implies xφ˘:y P iag.. ˘: 0 D We obtain : : xφ y P iag.˘ ðñ xφ y R iag.˘ . ˘: D ˘: D This contradiction finishes the proof that T is undecidable.

% 156 This brings to the mind what we did in the proof of Proposition 66.

We propose again a picture that illustrates this diagonal argument. If pφiqiPN is a enumeration of all the formulas with x0 as one and only free variable, we make sure to define a formula which satisfies this requirement although it is none of them. 142 G¨odel& Recursivity

φ0 φ1 φ2 φ3 φ4 φ5 φn

xφ0y 011010 ... 0 ...

xφ1y 111000 ... 0 ...

xφ2y 1 01000 ... 1 ...

xφ3y 0 0 1010 ... 0 ...

xφ4y 0 1 0 111 ... 0 ...

xφ5y 1 1 0 0 00 ... 0 ...

......

xφny 1 0 0 0 1 1 ... 1 ......

There is a 1 on the array – for instance on row 3 and column 2 – if T $c φ2pxφ3yq, and there is a

0 – for instance on row 2 and column 5 – if T &c φ5pxφ2yq.

Now if T is decidable, the whole array is decidable. This means there is a Decider that on any input pn, mq accepts if there is a 1 on position pn, mq, and rejects if there is a 0. Furthermore, for the whole array is decidable, its diagonal is also decidable. Hence the complement of the diagonal is decidable as well. Finally, since all recursive sets are representable, the complement of the diagonal is represented by some formula among the enumeration – say φn – which inevitably stumbles on xφnyq. Arithmetic 143

Theorem 157 (undecidability of first order logic) The set

xφy | $c φ . ! ) is not recursive

Proof of Theorem 157: Since ob. is a finite theory, we let φRob. be the conjunction of the seven R axioms from ob.. For any formula ψ we have R

ob. $c ψ ðñ φRob. $c ψ ðñ $c φRob. Ñ ψ. R

xψy P xφy | ob. $c φ ðñ xφRob. Ñ ψy P xφy | $c φ . R Therefore, if the set of codes! of universally) valid formulas were decidable,! then) Robinson arith- metic would also be decidable. % 157

Theorem 158 (G¨odel’sfirst incompleteness theorem) Let T Ě ob. be any theory both R consistent and recursive.

T is incomplete.

Proof of Theorem 158: By corollary 155 every recursive complete theory is decidable. By Theorem 156 the theory T is undecidable. % 158 144 G¨odel& Recursivity Bibliography

[1] Chiswell, I., and Hodges, W. Mathematical logic. Oxford University Press, 2007.

[2] Church, A. Introduction to Mathematical Logic. (Princeton Landmark in Mathematics. Princeton University Press, 1996.

[3] Cooper, S. B. Computability theory. CRC Press, 2004.

[4] Cori, R., and Lascar, D. Mathematical Logic: Part 1: Propositional Calculus, Boolean Algebras, Predicate Calculus, Completeness Theorems. Oxford University Press, 2000.

[5] Cori, R., and Lascar, D. Mathematical Logic, Part 2, Recursion Theory, G¨odelTheo- rems, Set Theory, Model Theory. Oxford University Press, 2000.

[6] Cori, R., Lascar, D., and Krivine, J.-L. P. Logique math´ematique,tome 1 : Calcul propositionnel; alg`ebre de Boole; calcul des pr´edicats, vol. 1. Dunod, Paris, 2003.

[7] Cori, R., Lascar, D., and Krivine, J.-L. P. Logique math´ematique,tome 2 : Fonctions r´ecursives,th´eor`emede G¨odel,th´eoriedes ensembles, th´eoriedes mod`eles, vol. 2. Dunod, Paris, 2003.

[8] Cutland, N. Computability: An introduction to recursive function theory. Cambridge university press, 1980.

[9] Ebbinghaus, H.-D., Flum, J., and Thomas, W. Einf¨uhrungin die mathematische Logik. Wissenschaftliche Buchgesellschaft Darmstadt, 1978.

[10] Enderton, H. B. A mathematical introduction to logic. Academic Press, 1972.

[11] Enderton, H. B. Computability Theory: An Introduction to Recursion Theory. Academic Press, 2010.

[12] Fitting, M. Incompleteness in the Land of Sets. College Publications, 2007.

[13] Franzen,´ T. G¨odel’sTheorem: an incomplete guide to its use and abuse. AK Peters, 2005.

[14] Godel,¨ K. Die vollstandigkeit der axiome des logischen funktionenkalkuls. Monatshefte fur Mathematik und Physik 37 (1930), 349–360. 146 G¨odel& Recursivity

[15] Godel,¨ K. Uber¨ formal unentscheidbare s¨atzeder principia mathematica und verwandter systeme i. Monatshefte f¨urMathematik 38, 1 (1931), 173–198.

[16] Grattan-Guinness, I. The search for mathematical roots, 1870-1940: logics, set theo- ries and the foundations of mathematics from Cantor through Russell to Godel. Princeton University Press, 2011.

[17] Griffor, E. R. Handbook of computability theory, vol. 140. Elsevier, 1999.

[18] Hardy, G. H., and Wright, E. M. An Introduction to the Theory of Numbers. Oxford University Press, 1979.

[19] Hedman, S. A first course in logic: an introduction to model theory, proof theory, com- putability, and complexity. Oxford University Press Oxford, 2004.

[20] Hilbert, D. Mathematische probleme. Archiv der Mathematik und Physik,(3) 1 (1901), 44–63.

[21] Hilbert, D. Mathematical problems. Bull. Amer. Math. Soc 8 (1902), 437–479.

[22] Hopcroft, J. E., Motwani, R., and Ullman, J. D. Introduction to automata the- ory, languages, and computation. Addison-Wesley Publishing Co., Reading, Mass., 2001. Addison-Wesley Series in Computer Science.

[23] Kaye, R. Models of Peano arithmetic. Clarendon Press Oxford, 1991.

[24] Kleene, S. C. Introduction to Metamathematics. D. Van Nostrand Company, Inc., Prince- ton, New Jersey, 1952.

[25] Kleene, S. C. Mathematical Logic. John Wiley & Sons, 1967.

[26] Matiyasevich, Y. Hilbert’s tenth problem. MIT press, 1993.

[27] Nagel, E., Newman, J. R., Godel,¨ K., and Girard, J.-Y. Le th´eor`emede G¨odel. Editions´ du Seuil, 1989.

[28] Odifreddi, P. Classical recursion theory: The theory of functions and sets of natural numbers. North Holland, 1992.

[29] Papadimitriou, C. H. Computational complexity. John Wiley and Sons Ltd., 2003.

[30] Peter,´ R., and Foldes,¨ I. Recursive functions, vol. 80. Academic Press New York, 1967.

[31] Robinson, R. M. An essentially undecidable axiom system. In Proceedings of the inter- national Congress of Mathematics (1950), vol. 1, pp. 729–730.

[32] Rogers Jr, H. Theory of recursive functions and effective computability. MIT press, 1987. Arithmetic 147

[33] Sacks, G. E. On suborderings of degrees of recursive unsolvability. Mathematical Logic Quarterly 7, 1-5 (1961), 46–56.

[34] Sacks, G. E. Degrees of unsolvability. No. 55 in Annals of Mathematics Studies. Princeton University Press, 1963.

[35] Shoenfield, J. R. Mathematical logic, vol. 21. Addison-Wesley Publishing Co., Reading, Mass., 1967.

[36] Sipser, M. Introduction to the Theory of Computation, vol. 2. Thomson Course Technology Boston, 2006.

[37] Smith, P. An introduction to G¨odel’s theorems. Cambridge University Press, 2013.

[38] Smullyan, R. M. G¨odel’sincompleteness theorems. Oxford University Press New York, 1992.

[39] Smullyan, R. M. Diagonalization and self-reference. Clarendon press Oxford, 1994.

[40] Soare, R. I. The history and concept of computability. Studies in Logic and the Founda- tions of Mathematics 140 (1999), 3–36.

[41] Stillwell, J. Elements of number theory. Springer, 2003.

[42] van Heijenoort, J. From Freege to G¨odel:A Source Book in Mathematical Logic, 1879- 1931. Harvard University Press, 1977.