Math 280 Incompleteness 1. Definability, Representability and Recursion
We will work with the language of arithmetic: 0˙, S,˙ +˙ , ·˙, <˙ . We will be sloppy and won’t write dots. When we say “formula,”“satisfaction,”“proof,”everything will refer to this language. We will use the standard model of arithmetic N = (ω, 0, S, +, ·, <).
1.1 Definition:
(i) A bounded existential quantification is a quantification of the form
(∃z)(z < x ∧ φ)
which we will abbreviate by (∃z < x)φ.
(ii) A bounded universal quantification has the form
(∀z)(z < x → φ)
which we will abbreviate by (∀z < x)φ.
1.2 Fact: The formulae (∀z < x)φ ↔ ¬(∃z < x)¬φ (∃z < x)φ ↔ ¬(∀z < x)¬φ are provable in predicate calculus. Proof: Exercise.
1.3 Definition:
(i) A formula is bounded iff all definitions of this formula are bounded. We also say “Σ0”or “∆0”for bounded.
(ii) A formula is Σn iff it has the form
(∃x1, ..., x1 )(∀x2, ..., x2 )(∃x3, ..., x3 ) ··· (Q(xn, ..., xn ))ψ 1 l1 1 l2 1 l3 1 ln where ψ is bounded.
(iii) Πn formulae are defined dually. Here we start with a block of universal quantifiers.
(iv) So Σn and Πn can be defined inductively:
φ is Σn+1 iff φ has the form (∃x1) ··· (∃xl)ψ where ψ is Πn. Dually for Πn+1.
1.4 Definition: n A relation R(x1, ..., xn) ⊆ ( N) is Σl−definable iff R has a Σl−definition over N i.e. iff there is a Σl n formula φ(x1, ..., xl) such that for all a1, ..., an ∈ ( N),
R(a1, ..., an) iff N φ[a1, ..., an].
Similarly: R is Πl iff it has a Πl definition over N.
1 We also say that R is ∆l iff R is both Σl and Πl.
1.5 Definition: Robinson Arithmetic is the following set of axioms:
(S1)¬S(x) = 0 (S2)S(x) = S(y) → x = y (L1)¬x < 0 (L2)x < S(y) ↔ (x < y ∨ x = y) (L3)x < y ∨ x = y ∨ y < x (A1)x + 0 = x (A2)x + S(y) = S(x + y) (M1)x · 0 = 0 (M2)x · S(y) = x · y + x
We denote these axioms by RA. We view these axioms as sentences, i.e. we frequently replace them by their universal closures.
1.6 Definition: Let Σ be a set of sentences. We say that a relation R ⊆ (nN) is representable in Σ iff there is a a1 a formula φ(x1, ..., xl) such that for all a1, ..., an ∈ N : if R(a1, ..., an) then Σ ` φ(S (0), ..., S l (0)); if a1 a ¬R(a1, ..., an) then Σ ` ¬φ(S (0), ..., S l (0)). In this situation we say that φ represents R in Σ. Here Sa(0) is the term S(S(··· S(0) ··· )). Obviously (Sa(0))N = a. | {z } a n We say that a formula φ(x1, ..., xn) weakly represents R in Σ iff R = {ha1, ..., ani ∈ ( N)|Σ ` a1 an a1 an φ(S (0), ..., S (0))}. So in the above format: If R(a1, ..., an) then Σ ` φ(S (0), ..., S (0)). If a1 an ¬R(a1, ...an) then Σ 0 φ(S (0), ..., S (0)). n Given a function f :( N) → N we say that a formula φ(x0, x1, ..., xn) represents/weakly represents f in Σ iff φ represents/weakly represents the relation R(y, x1, ..., xn) ≡ y = f(x1, ..., xn). n A formula φ(x1, ..., xn) is numeralwise determined in Σ iff for every a1, ..., an ∈ ( N) either Σ ` φ(Sa1 (0), ..., San (0)) or else Σ ` ¬φ(Sa1 (0), ..., San (0)).
1.7 Remarks: Assume Σ ⊆Th(N), in particular this applies to RA.
n (i) If φ(x1, ..., xn) is numeralwise determined, then φ represents a relation R ⊆ ( N). (This actually holds for any Σ.) (ii) If φ represents R then φ weakly represents R. (Because Σ is consistent.) This actually is true for any consistent Σ.
n (iii) If φ weakly represents R in Σ then φ defines R in N. R = {ha1, ..., ani ∈ ( N)|N φ[a1, ..., an]}.
1.8 Definition:
2 (a) The following functions are called basic:
c0 : N → N defined by c0(x) = 0 S : N → N defined by S(x) = x + 1 n n n For each 1 ≤ k ≤ n : Pk :( N) → N defined by Pk (x1, ..., xn) = xk These functions are called projections. (b) We introduce the following operators on partial functions:
n k - Composition: If we have functions g :( N) → N and f1, ..., fn :( N) → N then the composition k h is a function h :( N) → N defined by h(x1, ..., xk) = g(f1(x1, ..., xk), ..., fn(x1, ..., xk)). - Primitive Recursion: Given functions f :(nN) → N and g :(n+2N) → N we define a function h :(n+1N) → N by h(0, x1, ..., xn) = f(x1, ..., xn)
h(y + 1, x1, ..., xn) = g(y, h(y, x1, ..., xn), x1, ..., xn).
- µ−operator. Given a partial function g :(n+1N) → N we define a partial function f :(nN) → N by f(x1, ..., xn) =the least y such that
(i) all values g(0, x1, ..., xn), ..., g(y, x1, ..., xn) are defined. 0 0 (ii) g(y , x1, ..., xn) 6= 0 for all y < y.
(iii) g(y, x1, ..., xn) = 0.
1.9 Remark: From the point of view of programming:
- Composition corresponds to calling subroutines. - Primitive recursion corresponds to cycles. - µ−operator corresponds to search.
1.10 Definition: A partial function is recursive iff it can be finitely generated from basic functions using the three operators: composition, primitive recursion and the µ−operator. A partial function is primitive recursive iff it can be finitely generated from the basic functions using the operators composition and primitive recursion. For “primitive recursive, ”we write briefly “p.i.” Note: As all basic functions are total and the operators composition and primitive recursion preserve totality, all primitive recursive functions are total.
1.11 Main Theorem:
(a) Let f be a partial function. TFAE:
(i) f is Σ1−definable in N. (ii) f is weakly representable in RA. (iii) f is recursive.
1+n (b) For each n > 0 there is a partial recursive function Φn :( N) → N which is universal for all partial recursive functions with n arguments. This means: if f :(nN) → N is a partial recursive function then there is a number e ∈ N such that for all a1, ..., an ∈ N : f(a1, ..., an) ' Φn(e, a1, ..., an).
3 n 1+m (c) For 1 ≤ m < n there are primitive recursive functions sm :( N) → N such that for every e, a1, ..., an ∈ N :
n Φn(e, a1, ..., an) ' Φn−m(sm(e, a1, ..., am), am+1, ...an).
n Moreover, the functions sm are injective in each coordinate. (c) is called the s-m-n-theorem or the parameter theorem.
1.12 Definition: n Let Φn be the universal function from T.1.11. If f :( N) → N is a partial recursive function, and e ∈ N is such that f(x1, ..., xn) ' φn(e, x1, ..., xn) then e is called a G¨odelnumber of f.
1.13 Corollary:
(a) The functions Φn are not total.
(b) Any partial recursive function f :(nN) → N has infinitely many G¨odelnumbers.
Proof. Do this for n = 1 :
(a) Since Φ1(x0, xn) is recursive, so is the function f(x0) ' Φ1(x0, x0) + 1. This is because f(x0) ' 1 Φ1(x0, p1(x0)) + 1. Now let e be a G¨odelnumber for f. So: f(x0) ' Φ1(e, x0) for all x0.
That is, Φ1(x0, x0)+1 ' Φ(e, x0) for all x0, so in particular x0 = e. Therefore, Φ1(e, e)+1 ' Φ(e, e). (b) Given f : N → N recursive, consider the function g : N × N → N defined by g(x1, x2) ' f(x2). 2 This is again recursive, as g(x1, x2) ' f(p2(x1, x2)). Let e be a G¨odel number for g. So
2 f(x2) ' g(x1, x2) ' Φ2(e, x1, x2) ' Φ1(S1 (e, x1), x2).
2 2 So each S1 (e, x1) is a G¨odelnumber for f. But we also said that S1 is injective in each coordinate. 2 So the set {S1 (e, x1)|x1 ∈ N} is an infinite set of G¨odelnumbers for f.
2. From Σ1−Definability to Representability
2.1 Lemma: For each n > 0: RA` x < Sn+1(0) ↔ x = 0 ∨ x = S(0) ∨ · · · ∨ x = Sn(0).
Proof. Induction on n: for n = 0, the axiom L2 says that x < S(y) ↔ x < y ∨ x = y. Since 0 is substitutable for y in this formula, RA` x < S(0) ↔ (x < 0 ∨ x = 0), using a lemma from predicate logic. But axiom L1 says ¬x < 0. Using propositional logic, we arrive at RA` x < S(0) ↔ x = 0. n → n + 1: This time we substitute Sn+1(0) for y in L2, we get RA` x < Sn+2(0) ↔ (x < Sn+1(0) ∨ x = Sn+1(0)). By the IH: RA` x < Sn(0) ↔ (x = 0 ∨ · · · ∨ x = Sn(0)). Using predicate logic, we can replace x < Sn+1(0) by (x = 0 ∨ · · · ∨ x = Sn(0)).
2.2 Theorem:
a1 an Let φ(x1, ..., xn) be a bounded formula and a1, ..., an ∈ N. If N φ[a1, ..., an] then RA` φ(S (0), ..., S (0)) (∗).
4 Proof. Induction on complexity of φ. We will be showing that (∗) holds at φ and ¬φ at each step of induction. Claim 1: (i) If m = n, then RA` Sm(0) = Sn(0). (ii)If m 6= n, then RA` ¬Sm(0) = Sn(0).
Proof of Claim: (i) is the equality axiom E1 of predicate calculus, as Sm(0),Sn(0) is the same term in this case. (ii) Axiom S1 says ¬S(x) = 0. Now the term Sm−1(0), m > 0, is substitutable for x in S1. So by predicate calculus: (1) RA` ¬Sm(0) = 0. Now assume WLOG that n > m and Let k = n − m. Axiom S2 says: S(x) = S(y) → x = y. So RA` ¬x = y → ¬S(x) = S(y). By substituting Sk(0) for x and 0 for y: RA` ¬Sk(0) = 0 → ¬Sk+1(0) = 0. Using this, (1), and MP: RA` ¬Sk+1(0) = S(0). Repeat this another m times and get RA` ¬Sn(0) = Sm(0).
Claim 2: (i) If m < n then RA` Sm(0) < Sn(0) (ii) If ¬m < n then RA` ¬Sm(0) < Sn(0).
Proof of Claim 2: (i) We already know RA` Sm(0) = Sm(0), hence Sm(0) = 0 ∨ · · · ∨ Sm(0) = Sn−1(0). By L.2.1, RA` (x = 0 ∨ · · · ∨ x = Sn−1(0)) ↔ x < Sn(0). So using predicate logic we can substitute Sm(0) for x. That gives RA` (Sm(0) = 0 ∨ · · · ∨ Sm(0) = Sn−1(0)) ↔ Sm(0) < Sn(0). Now apply (1) and MP to this. (ii) If m < n then m 6= k for all k < n, so by Claim 1 RA` ¬Sk(0) = Sm(0) for all k < m. So RA proves the conjunction of these inequalities, but this conjunction is equivalent to ¬(Sm(0) = 0 ∨ · · · ∨ Sm(0) = Sm−1(0)). By L.2.1, RA` ¬(Sm(0) = 0 ∨ · · · ∨ Sm(0) = Sm−1(0)) → ¬Sm(0) < Sn(0). Apply the above two plus MP to get RA` ¬Sm(0) < Sn(0)
Claim 3: (i) RA` Sn+m(0) = Sn(0) + Sm(0). (ii) RA` Snm(0) = Sn(0) · Sm(0).
Proof: Exercise: induction on m using axioms A1, A2 for (i) and M1, M2 for (ii).
N a1 an Claim 4: If t(x1, ..., xn) is a term, a1, ..., an ∈ N and b = t (a1, ..., an) then RA` t(S (0), ..., S (0)) = Sb(0).
Proof: Exercise: induction on complexity of t.
By induction on complexity of bounded formulae we prove that if φ(x1, ..., xn) is a bounded formulae and a1, ..., an ∈ N then (*):
a1 an IfN φ[a1, ..., an] then RA ` φ(S (0), ..., S (0)).
a1 an IfN ¬φ[a1, ..., an] then RA ` ¬φ(S (0), ..., S (0)).
Atomic formulae: They are of the form t1 = t2 or t1 < t2 where t1, t2 are terms. As an example, we prove:
N N a1 an a1 an ¬t1 [a1, ..., an] < t2 [a1, ..., an] then RA ` ¬t1(S (0), ..., S (0)) < t2(S (0), ..., S (0)).
N N Let b1 = t1 [a1, ..., an] and b2 = t2 [a1, ..., an]. By Claim 4,
5 b1 a1 an (1) RA` S (0) = t1(S (0), ..., S (0))
b2 a1 an (2) RA` S (0) = t2(S (0), ..., S (0)).
b1 b2 By assumption, ¬b1 < b2 so by Claim 2, RA` ¬S (0) < S (0). Then we use the equality axiom (E2) a1 an in predicate logic and (1), (2) to substitute in the above statement. So RA` ¬t1(S (0), ..., S (0)) < a1 an t2(S (0), ..., S (0)).
Induction step: Negation: we assume (*) holds for φ. Want to get (*) for ¬φ. Notice: the second line in (*) for φ is the corresponding first line in (*) for ¬φ. Regarding the second line in (*) for ¬φ: this would read a1 an “If N ¬¬φ[a1, ..., al] then RA` ¬¬φ(S (0), ..., S (0)).”This almost corresponds to the first line. We need to use: ` φ ↔ ¬¬φ.
Conjunction: The first line in (*) is straightforward. The second line in (*): Assume N ` ¬(φ1 ∧ φ2)[a1, ..., an]. By the definition of : N ¬φi[a1, ..., an] for at least one i. By IH, (*) holds for φi, hence a1 an RA` ¬φi(S (0), ..., S (0)) for at least one i. The rest follows from the fact that ` ¬φi → ¬(φ1 ∧ φ2) for i = 1, 2.
Bounded existential quantifier: Assume φ is (∃z < x0)ψ(z, x1, ..., xn). First line: we actually ¯ prove the first line holds for unbounded existential quantifier: if φ has the form (∃z)φ(z, x0, ..., xn) ¯ and we assume that the conclusion holds for φ. If N φ[a1, ..., an] then there is some a0 ∈ N ¯ ¯ a0 an such that N φ[a0, ..., an]. Then by IH, RA` φ(S (0), .., S (0)). Then use the quantifier axiom: φ¯(z/Sa0 (0),Sa1 (0), ..., San (0)) → (∃z)φ¯(z, Sa1 (0), ..., San (0)). By MP, RA` (∃z)φ¯(z, Sa1 (0), ..., San (0)). Now if φ is of the form (∃z < x0)ψ(z, x1, ..., xn) and the conclusion already holds for ψ: notice φ is the formula (∃z)(z < x0 ∧ ψ(z, x1, ..., xn)). Then the conclusion also holds for the formula z < x0, as it is an atomic formula. By the above, the conclusion also holds for their conjunction. Then apply what we just proved about existential quantification.
Second line: Now assume N ¬φ[a0, ..., an] i.e., N ¬(∃z < a0)ψ(z, a1, ..., an). This means (by looking at the definition of ): for every b < a0 : N ¬ψ[b, a1, ..., an]. So by the IH: for each such b we have (1) RA` ¬ψ(Sb(0),Sa1 (0), ..., San (0)). Point: we need to replace “Sb(0)”in the above formula by the variable z, so that we can quantify over it. Here we used the “generalized form”of the equality axiom (E2). We proved: if t1, t2 are substitutable for z in φ: ` t1 = t2 → (φ(z/t1) → φ(z/t2)). We apply this to ψ, z and Sb(0). Notice: obviously z is substitutable for z in ψ. Also, Sb(0) is substitutable for z in ¬ψ as Sb(0) does not involve any variables. So (2) ` Sb(0) = z → (¬ψ(Sb(0),Sa1 (0), ..., San (0)) → ¬ψ(z, Sa1 (0), ..., San (0))). Now, (P → (Q → R)) → (Q → (P → R)) is a tautology. So we have a proof in predicate logic which turns (2) into (3) ¬ψ(Sb(0),Sa1 (0), ..., San (0)) → (Sb(0) = z → ¬ψ(z, Sa1 (0), ..., San (0))). By (1), (3) and MP: (and switching from Sb(0) = z toz = Sb(0)),
b a1 an (4) z = S (0) → ¬ψ(z, S (0), ..., S (0)). Recall again (4) holds for every b < a0. Now in proposi- tional logic, if we have P0 → Q, ..., Pa0−1 → Q then we can derive P0 ∨ · · · ∨ Pa0−1 → Q. If we apply this to (4), we get:
RA ` (z = S0(0) ∨ · · · ∨ z = Sa−1(0)) → ¬ψ(z, Sa1 (0), ..., San (0)).
Now by L.2.1: RA` (z = S0(0) ∨ · · · ∨ z = Sa0−1(0)) ↔ z < Sa0 . Combining these two we can get a proof in RA:
RA ` z < Sa0 → ¬ψ(z, Sa1 (0), ..., San (0)).
Now in predicate logic ra` (∀z)(z < Sa0 (0) → ¬ψ(z, Sa1 (0), ..., San (0))). Therefore RA` ¬(∃z < Sa0 (0))ψ(z, Sa1 (0), ..., San (0)).
6 2.3 Corollary:
a1 an Assume φ(x1, ..., xn) is a Σ1−formula and a1, ..., an ∈ N. If N ` φ[a1, ..., an], then RA` φ(S (0), ..., S (0)). This was essentially proved in the first line of the proof for bounded existential quantifier, where we saw that it holds even for unbounded existential quantifier.
2.4 Corollary: n If a partial function f :( N) → N is Σ1−definable, then it is weakly representable in RA. This means: there is a formula φ(x0, ..., xn) such that for all a0, ..., an ∈ N: a0 = f(a1, ..., an) iff RA` φ(Sa1 (0), ..., San (0)). Proof: Exercise.
2.5 Remark: In this section we did not use the full strength of Robinson Arithmetic, namely we did not use axiom (L3).
2.6 Remark: The axioms of RA cannot prove that < is an ordering relation. On the other hand, it is provable in RA that < is a linear ordering on standard numbers, but this fact connot be expressed by a single formula.
3. Recursive Functions
We develop some basic facts about recursive functions.
3.1 Definition: n n If R ⊆ ( N), the characteristic function of R is the function χR :( N) → N defined by
χR = 1, hx1, ..., xni ∈ R; 0, ow
∗ n The partial characteristic function of R is the partial function χR :( N) → N such that dom(χR) = R ∗ and χR(x1, ..., xn) = 1 for all hx1, ..., xni ∈ R.
3.2 Remark:
∗ (a) The point of D.3.1: it may (and will) happen that χR is recursive while χR not.
(b) It would simplify some computations if we defined χR(~x) = 0 for ~x ∈ R and χR(~x) = 1 for ~x/∈ R, ∗ and similarly χR(~x) = 0 for ~x ∈ R, but we rather stick to general conventions.
3.3 Definition: n A relation R ⊆ ( N) → N is recursive (primitive recursive) iff χR is a recursive (primitive recursive) ∗ function. R is called recursively enumerable iff χR is a partial recursive function.
3.4 Remark: We will show later that R is recursively enumerable ⇐⇒ there is a total recursive function f s.t. R = rng(f).
In the following, we give a list of primitive recursive functions/relations and basic procedures for constructing them.
7 (1) For each n ∈ N the constant function cn : N → N defined by cn(x) = n is primitive recursive.
Proof: Induction on n. c0 is basic. If cn is primitive recursive, then so is cn+1 since cn+1(x) = (S ◦ cn)(x). (2) The two place functions x + y, x · y and xy are primitive recursive. + is defined by primitive recursion: x + 0 = x. x + y + 1 = S(x + y). The identity function is primitive recursive, as it is 1 basic: it’s p1. Primitive recursion works as follows: h(y, ~x) is defined for f(~x) and g(u, v, ~x) by g(0, ~x) = f(~x) 1 and g(y + 1, ~x) = h(y, g(y, ~x), ~x). In our case: f(x) = p1(x), h(u, v, x) = S(v). Similarly for multiplication and exponentiation. (3) The function x−˙ y defined by x−˙ y = x − y if x ≥ y, 0 x < 0 is primitive recursive. First observe: g(x) = x−˙ 1 is primitive recursive: 0 · −1 = 0, (x + 1)−˙ 1 = x. Then x−˙ y is defined by primitive recursion as follows: x−˙ 0 = x, xy +˙ 1 = (x−˙ y)−˙ 1.
(4) The function sg: N → N defined by sg(x) = 1 if x > 0, 0 if x = 0 is primitive recursive. Proof: sg(x)= 1−˙ (1−˙ x).
(5) The binary relations < and = are primitive recursive. Why: χ<(x, y) =sg(y−˙ x). χ=(x, y) = (1 − χ<(x, y))(1 − χ<(y, x)).
n N (6) If t(x1, ..., xn) is a term then the function ft :( N) → N defined by ft(x1, ..., xn) = t [x1, ..., xn]. Proof by induction on complexity of t using the fact that S, +, · are primitive recurstive.
c (7) If R is primitive recursive then so is R . Also if R1,R2 are primitive recursive then so is R1 ∩ R2.
c ˙ Proof: χR (~x) = 1−χR(~x), χR1∩R2 (~x) = χR1 (~x) · χR2 (~x). P (8) Let f(y, x1, ..., xn) the primitive recursive. Then so are sf (y, ~x) = f(z, ~x), sf (0, ~x) = 0; Q z Proof: For sums: sf (0, ~x) = 0, sf (y + 1, ~x) = sf (y, ~x) + f(y, ~x). n (9) Let φ(x1, ..., xn) be a bounded formula. Then Rφ = {hx1, ..., xni ∈ ( N)|N φ[x1, ..., xn]} is primitive recursive. Proof by induction on complexity of φ. Atomic φ: say φ is t1(~x) < t2(~x). χRφ (~x) = χ<(ft1 (~x), ft2 (~x)). Induction step: For propositional connectives this follows from (7). Bounded quantifiers, Say φ(~x) ≡ (∃z < x )ψ(z, x , ..., x ). χ (x , ..., x ) =sg P χ (z, x , ..., x ) . So this follows 0 1 n Rφ 0 n z n (10) Definition by cases. If R1, ..., Rk ⊆ ( N) are (primitive) recursive relations that are mutually n distinct and R1 ∪ · · · ∪ Rk = ( N) and if f1, ..., fk are (primitive) recursive functions then the n function g :( N) → N defined by g(x1, ..., xn) = fi(x1, ..., xn) if Ri(x1, ..., xn) is primitive recursive. Proof: g(~x) = f1(~x) · χR1 (~x) + ··· + fk(~x) · χRk (~x). (11) Bounded µ−operator. Let f(y, ~x) be a primitive recursive function. Then function g(y, ~x) =the least z < y such that f(z, ~x) = 0 if there is one, y otherwise is primitive recursive. Proof: g(0, ~x) = 0. g(y + 1, ~x) = g(y, ~x) if g(y, ~x) < y or f(y, ~x) = 0, y + 1 otherwise. This is a definition by primitive recursion which relies on (10). Exercise: find the function h from the definition by primitive recursion. We are going to code finite sequences of numbers by numbers. Let p0, p1, ..., pn, ... be the increasing enumeration of primes. The codes are as follows: ∅ is coded by 1. 8 s(0)+1 s(n−1)+1 If length(s) = n then s is coded by the product p0 ··· pn−1 . This coding is injective, because all exponents are > 0. So if a is a code, we can retrieve s from a. Note: this coding is not surjective. H is called G¨odelcoding. In the following we show that certain manipulations with finite sequencese can be represented as primitive recursive functions on codes. (10a) If R(y, ~x) is primitive recursive then also the relations R1(y, ~x) ⇐⇒ (∃z < y)R(z, ~x) R2(y, ~x) ⇐⇒ (∀z < y)R(z, ~x) The proof of (10) proves this. The we get G¨odel’scoding of finite sequences. We had hpn|n ∈ Ni the increasing enumeration of a0+1 an−1+1 primes. Then the code of ∅ is 1, the code of ha0, ..., ani is p0 ··· pn−1 . We now show that certain manipulations with codes are primitive recursive. (12) The relation x|y (x divides y) is primitive recursive: x|y ⇐⇒ (∃z < y + 1)(y = x · z) Q(u, y, x) ≡ (∃z < u)(y = x · z) x|y ≡ Q(y + 1, y, x). (13) The relation “p is prime ”is primitive recursive: PRIME(x) ⇐⇒ (∀z < x)(z|x → z = 1) ∧ 1 < x. That is because “z|x”is primitive recursive and the rest is just obtained by Boolean combinations and bounded quantification. (14) The set of codes of all finite sequences is primitive recursive. SEQ(s) ⇐⇒ s 6= 0 ∧ (∀z < s)(∀z0 < z)[(PRIME(z) ∧ PRIME(z0))] → (z|s → z0|s). th (15) The function i 7→ pi “pi is the i prime”is primitive recursive. If we have primes p0, ..., pi we Q i+1 know pi+1 ≤ ( j≤i pi + 1) ≤ pi + 1. So: i 7→ pi is defined by primitive recursion: p0 = 2, i+1 pi+1 = (µx < pi + 1)(pi < x ∧ PRIME(x)). (16) There is a primitive recursive function lh such that whenever s is a code for a sequence: lh(s)= the length of the sequence coded by s. lh(s) = (µx < s)(px 6 |s). th (17) There is a primitive recursive function ()i such that if s is a code for a sequence then (s)i =the i element of the sequence coded by s. z+2 (s)i = (µz < s)(pi 6 |s). 9 (18) There is a primitive recursive function ∗ such that if s, t code sequences then s ∗ t = the code of the a0+1 an−1+1 b0+1 bm−1+1 concatenation s ∧ t. If s = p0 ··· pn−1 and t = p0 ··· pm−1 then a0+1 an−1+1 b0+1 bm−1+1 s ∗ t = p0 ··· pn−1 pn ··· pn+m−1 . So Y (t)i+1 s ∗ t = s · plh(s)+i. i (19) Let f(y, ~x) be a function. We define f¯(y, ~x) as follows: f¯(0, ~x) = 1 f¯(y + 1, ~x) = f¯(y, ~x) ∗ #hf(y, ~x)i where the last term is the code of the one element sequence hf(y, ~x)i. Notice that f¯(y, ~x) is the code of the sequence hf(0, ~x), ..., f(y − 1, ~x)i. Then f is primitive recursive iff f¯ is. (20) Assume g(u, v, ~x) is a primitive recursive function. Then there is a unique primitive recursive function f(y, ~x) such that f(y, ~x) = g(y, f¯(y, ~x), x). This is because f¯ is defined by primitive recursion: f¯(0, ~x) = 1, f¯(y + 1, ~x) = f¯(y, ~x) ∗ g(y, f¯(y, ~x), x). Then f is p.r. by (19). Also f is unique by definition. 4. Arithmetrization of Syntax We code the syntax of the first order logic using the tools in Section 3. We work with our language of arithmetic {0, S, +, ·, <}. We first choose codes for symbols: Variables: #vi = 2i. Logical symbols: #(=) = 3; #(∧) = 5; #(∃) = 7; #(() = 9; #()) = 11; #(¬) = 13. L−symbols: #(0) = 15; #(S) = 17; #(+) = 19; #(·) = 21; #(<) = 23. (1) The relation VBL(x): “x codes a variable”is primitive recursive. (2) The relation TERM(x): “x codes a term”is primitive recursive. TERM(x) ⇐⇒ (∃z < x)(VBL(z) ∧ x = #hzi) ∨ x = #h0i ∨(∃z, z0 < x)[TERM(z)∧TERM(z0)∧(x = #iSh∗#h(i∗z ∗#h)i∨x = #h+i∗#(h(i)∗z ∗z0 ∗#h)i)]. This gives a primitive recursive relation TERM(s) by Section 3, item (20). Another explanation: There are primitive recursive functions Succ, Sum and Prod such that for each s, s1, s2 ∈ N, Succ(s) = #hS(i ∗ s ∗ #h)i Sum(s1, s2) = #h+(i ∗ s1 ∗ s2 ∗ #h)i Prod(s1, s2) = #h·()i ∗ s1 ∗ s2 ∗ #h)i Informally: if s is a code for a term t then Succ(s) is a code for S(t) and similarly for Sum, Prod. Now we can write: 10 TERM(s) iff Seq(s) ∧ [lh(s) = 1 ∧ ((s)0 = #0 ∨ VBL((s)0)) ∨(∃s1, s2 < s)(TERM(s1) ∧ TERM(s2) ∧ (s = Succ(s1) ∨ s = Sum(s1, s2) ∨ s = Prod(s1, s2)))] We need to see that this gives us a primitive recursive definition of the relation TERM. This follows from (20): consider the following relation: ¯ ∗ Q(s, u) = Seq(s) ∧ [Q(s) ∨ (∃s1, s2 < s)((u)s1 = 1 ∧ (u)s2 = 1 ∧ Q (s, s1, s2))]. Then TERM(s) iff Q(s, χ¯T ERM (s)). Actually in (20), χT ERM = χQ(s, χ¯T ERM (s)). (3) There is a primitive recursive relation FML(x) such that FML(x) iff x is a code for a formula. First, there is a primitive recursive relation AFML(x) and primitive recursive functions Neg(x), Conj(x1, x2), Eq(x, v) such that - AFML(x) iff x is a code for an atomic formula, - Neg(x) = #h¬i ∗ x, - Conj(x1, x2) = #h(i ∗ x1 ∗ #h∧i ∗ x2 ∗ #h)i, - Eq(x, v) = #h(∃i ∗ v ∗ #h)i ∗ x. Then