<<

I Note how the successor σ0(n) = n + 1 is built directly into the definition of primitive recursion.

I The class PR is built up from σ0 the constant functions and the projections πi (a1, ..., ai , ..., an) = ai by substitution and primitive recursion.

Primitive recursion

Definition Given a binary function β(m, n) and any a ∈ N define the function ϕ(n) as follows;

ϕ(0) := a and ϕ(n + 1) := β(n, ϕ(n)).

DMACC John M. Gillespie 1 I The class PR is built up from σ0 the constant functions and the projections πi (a1, ..., ai , ..., an) = ai by substitution and primitive recursion.

Primitive recursion

Definition Given a binary function β(m, n) and any a ∈ N define the function ϕ(n) as follows;

ϕ(0) := a and ϕ(n + 1) := β(n, ϕ(n)).

I Note how the successor function σ0(n) = n + 1 is built directly into the definition of primitive recursion.

DMACC John M. Gillespie 2 substitution and primitive recursion.

Primitive recursion

Definition Given a binary function β(m, n) and any a ∈ N define the function ϕ(n) as follows;

ϕ(0) := a and ϕ(n + 1) := β(n, ϕ(n)).

I Note how the successor function σ0(n) = n + 1 is built directly into the definition of primitive recursion.

I The class PR is built up from σ0 the constant functions and the projections πi (a1, ..., ai , ..., an) = ai by

DMACC John M. Gillespie 3 and primitive recursion.

Primitive recursion

Definition Given a binary function β(m, n) and any a ∈ N define the function ϕ(n) as follows;

ϕ(0) := a and ϕ(n + 1) := β(n, ϕ(n)).

I Note how the successor function σ0(n) = n + 1 is built directly into the definition of primitive recursion.

I The class PR is built up from σ0 the constant functions and the projections πi (a1, ..., ai , ..., an) = ai by substitution

DMACC John M. Gillespie 4 Primitive recursion

Definition Given a binary function β(m, n) and any a ∈ N define the function ϕ(n) as follows;

ϕ(0) := a and ϕ(n + 1) := β(n, ϕ(n)).

I Note how the successor function σ0(n) = n + 1 is built directly into the definition of primitive recursion.

I The class PR is built up from σ0 the constant functions and the projections πi (a1, ..., ai , ..., an) = ai by substitution and primitive recursion.

DMACC John M. Gillespie 5 sg sg¯ I Exponent notation is used e.g. 11 = 1 and 2 = 0.

Two surprisingly useful functions

We define by primitive recursion sg andsg ¯ .

I sg(0) = 0 with sg(n + 1) = 1.

I sg¯ (0) = 1 withsg ¯ (n + 1) = 0.

DMACC John M. Gillespie 6 Two surprisingly useful functions

We define by primitive recursion sg andsg ¯ .

I sg(0) = 0 with sg(n + 1) = 1.

I sg¯ (0) = 1 withsg ¯ (n + 1) = 0. sg sg¯ I Exponent notation is used e.g. 11 = 1 and 2 = 0.

DMACC John M. Gillespie 7 2. The exponent expl (n) of the l-th prime in the prime factorization of n ∈ N. 3. The residue res(a, n) of a modulo n. 4. Restricted a −· b.

Examples

Well known primitive recursive functions. Takes some work!

1. The n-th prime pn

DMACC John M. Gillespie 8 3. The residue res(a, n) of a modulo n. 4. Restricted subtraction a −· b.

Examples

Well known primitive recursive functions. Takes some work!

1. The n-th prime pn

2. The exponent expl (n) of the l-th prime in the prime factorization of n ∈ N.

DMACC John M. Gillespie 9 4. Restricted subtraction a −· b.

Examples

Well known primitive recursive functions. Takes some work!

1. The n-th prime pn

2. The exponent expl (n) of the l-th prime in the prime factorization of n ∈ N. 3. The residue res(a, n) of a modulo n.

DMACC John M. Gillespie 10 Examples

Well known primitive recursive functions. Takes some work!

1. The n-th prime pn

2. The exponent expl (n) of the l-th prime in the prime factorization of n ∈ N. 3. The residue res(a, n) of a modulo n. 4. Restricted subtraction a −· b.

DMACC John M. Gillespie 11 then S(n) yields the number of divisors of n.

I If we let n X π(n) = sg¯ (S(n) −· 2) i=2 then π(n) yields the number of primes among 2, ..., n.

Then the nth prime is the least j such that π(j) = n + 1.

Examples

I If we let n X S(n) = sg¯ (res(n, i)) i=1

DMACC John M. Gillespie 12 I If we let n X π(n) = sg¯ (S(n) −· 2) i=2 then π(n) yields the number of primes among 2, ..., n.

Then the nth prime is the least j such that π(j) = n + 1.

Examples

I If we let n X S(n) = sg¯ (res(n, i)) i=1 then S(n) yields the number of divisors of n.

DMACC John M. Gillespie 13 then π(n) yields the number of primes among 2, ..., n.

Then the nth prime is the least j such that π(j) = n + 1.

Examples

I If we let n X S(n) = sg¯ (res(n, i)) i=1 then S(n) yields the number of divisors of n.

I If we let n X π(n) = sg¯ (S(n) −· 2) i=2

DMACC John M. Gillespie 14 Then the nth prime is the least j such that π(j) = n + 1.

Examples

I If we let n X S(n) = sg¯ (res(n, i)) i=1 then S(n) yields the number of divisors of n.

I If we let n X π(n) = sg¯ (S(n) −· 2) i=2 then π(n) yields the number of primes among 2, ..., n.

DMACC John M. Gillespie 15 Examples

I If we let n X S(n) = sg¯ (res(n, i)) i=1 then S(n) yields the number of divisors of n.

I If we let n X π(n) = sg¯ (S(n) −· 2) i=2 then π(n) yields the number of primes among 2, ..., n.

Then the nth prime is the least j such that π(j) = n + 1.

DMACC John M. Gillespie 16 Then the smallest n for which τ(a1, ..., ar , n) = 0 is given by the expression below. B i X Y τ(~a, j)sg i=0 j=0

= τ(~a, 0)sg + τ(~a, 0)sgτ(~a, 1)sg + τ(~a, 0)sgτ(~a, 1)sgτ(~a, 2)sg + ...

+ τ(~a, 0)sgτ(~a, 1)sg . . . τ(~a, B)sg

Bounded search

Suppose a function τ(a1, ..., ar , n) is given which satisfies the following formula.

(∀a1 ... ∀ar ∃n)(τ(~a, n) = 0)

DMACC John M. Gillespie 17 = τ(~a, 0)sg + τ(~a, 0)sgτ(~a, 1)sg + τ(~a, 0)sgτ(~a, 1)sgτ(~a, 2)sg + ...

+ τ(~a, 0)sgτ(~a, 1)sg . . . τ(~a, B)sg

Bounded search

Suppose a function τ(a1, ..., ar , n) is given which satisfies the following formula.

(∀a1 ... ∀ar ∃n)(τ(~a, n) = 0)

Then the smallest n for which τ(a1, ..., ar , n) = 0 is given by the expression below. B i X Y τ(~a, j)sg i=0 j=0

DMACC John M. Gillespie 18 Bounded search

Suppose a function τ(a1, ..., ar , n) is given which satisfies the following formula.

(∀a1 ... ∀ar ∃n)(τ(~a, n) = 0)

Then the smallest n for which τ(a1, ..., ar , n) = 0 is given by the expression below. B i X Y τ(~a, j)sg i=0 j=0

= τ(~a, 0)sg + τ(~a, 0)sgτ(~a, 1)sg + τ(~a, 0)sgτ(~a, 1)sgτ(~a, 2)sg + ...

+ τ(~a, 0)sgτ(~a, 1)sg . . . τ(~a, B)sg

DMACC John M. Gillespie 19 I The bound B is specific to the function τ. 2n I For example the nth prime pn satisfies pn < 2 . 2n I This provides the bound B = 2 .

Bounded search

The following notation is fairly standard.

B i X Y sg µj [τ(~a, j) = 0] = τ(~a, j) i=0 j=0

DMACC John M. Gillespie 20 2n I For example the nth prime pn satisfies pn < 2 . 2n I This provides the bound B = 2 .

Bounded search

The following notation is fairly standard.

B i X Y sg µj [τ(~a, j) = 0] = τ(~a, j) i=0 j=0

I The bound B is specific to the function τ.

DMACC John M. Gillespie 21 2n I This provides the bound B = 2 .

Bounded search

The following notation is fairly standard.

B i X Y sg µj [τ(~a, j) = 0] = τ(~a, j) i=0 j=0

I The bound B is specific to the function τ. 2n I For example the nth prime pn satisfies pn < 2 .

DMACC John M. Gillespie 22 Bounded search

The following notation is fairly standard.

B i X Y sg µj [τ(~a, j) = 0] = τ(~a, j) i=0 j=0

I The bound B is specific to the function τ. 2n I For example the nth prime pn satisfies pn < 2 . 2n I This provides the bound B = 2 .

DMACC John M. Gillespie 23 I Take the sign of the sum

sg(expl(n) + exp2(n) + ... + expn(n)).

I What we seek is the smallest j such that

sg(expj+1(n) + expj+2(n) + ... + expn(n)) = 0.

The length of n ∈ N

Consider the problem of finding the index l of the largest prime dividing n ∈ N and suppose n > 1.

DMACC John M. Gillespie 24 I What we seek is the smallest j such that

sg(expj+1(n) + expj+2(n) + ... + expn(n)) = 0.

The length of n ∈ N

Consider the problem of finding the index l of the largest prime dividing n ∈ N and suppose n > 1. I Take the sign of the sum

sg(expl(n) + exp2(n) + ... + expn(n)).

DMACC John M. Gillespie 25 The length of n ∈ N

Consider the problem of finding the index l of the largest prime dividing n ∈ N and suppose n > 1. I Take the sign of the sum

sg(expl(n) + exp2(n) + ... + expn(n)).

I What we seek is the smallest j such that

sg(expj+1(n) + expj+2(n) + ... + expn(n)) = 0.

DMACC John M. Gillespie 26 I The bound n is sufficient since n < pn.

I This yields the smallest j such that expl (n) = 0 if l > j.

The length of n ∈ N

The following primitive recursive function yields the index of the largest prime divisor of the n.

n k  n  X Y X long(n) = sg  expl(n) k=0 j=0 l=j+1

DMACC John M. Gillespie 27 I This yields the smallest j such that expl (n) = 0 if l > j.

The length of n ∈ N

The following primitive recursive function yields the index of the largest prime divisor of the natural number n.

n k  n  X Y X long(n) = sg  expl(n) k=0 j=0 l=j+1

I The bound n is sufficient since n < pn.

DMACC John M. Gillespie 28 The length of n ∈ N

The following primitive recursive function yields the index of the largest prime divisor of the natural number n.

n k  n  X Y X long(n) = sg  expl(n) k=0 j=0 l=j+1

I The bound n is sufficient since n < pn.

I This yields the smallest j such that expl (n) = 0 if l > j.

DMACC John M. Gillespie 29 Other forms of recursion

Course-of-values recursion

Definition Given a binary function β and any a ∈ N define ϕ as follows; n Y ϕ(i) ϕ(0) = a and ϕ(n + 1) = β( pi , n). i=0

We can prove that such a definition yields a primitive recursive function.

DMACC John M. Gillespie 30 Qn ϕ(n) a Define a function ψ(n) = i=0 pi . Then ψ(0) = 2 and

ϕ(n+1) ψ(n + 1) = ψ(n) · pn+1 β(ψ(n),n) = ψ(n) · pn+1

Thus ψ is primitive recursive and ϕ(n) = expn ψ(n) hence ϕ is also primitive recursive.

Course-of-values recursion

Definition of ϕ

n Y ϕ(i) ϕ(0) = a and ϕ(n + 1) = β( pi , n) i=0

DMACC John M. Gillespie 31 ϕ(n+1) ψ(n + 1) = ψ(n) · pn+1 β(ψ(n),n) = ψ(n) · pn+1

Thus ψ is primitive recursive and ϕ(n) = expn ψ(n) hence ϕ is also primitive recursive.

Course-of-values recursion

Definition of ϕ

n Y ϕ(i) ϕ(0) = a and ϕ(n + 1) = β( pi , n) i=0

Qn ϕ(n) a Define a function ψ(n) = i=0 pi . Then ψ(0) = 2 and

DMACC John M. Gillespie 32 Thus ψ is primitive recursive and ϕ(n) = expn ψ(n) hence ϕ is also primitive recursive.

Course-of-values recursion

Definition of ϕ

n Y ϕ(i) ϕ(0) = a and ϕ(n + 1) = β( pi , n) i=0

Qn ϕ(n) a Define a function ψ(n) = i=0 pi . Then ψ(0) = 2 and

ϕ(n+1) ψ(n + 1) = ψ(n) · pn+1 β(ψ(n),n) = ψ(n) · pn+1

DMACC John M. Gillespie 33 Course-of-values recursion

Definition of ϕ

n Y ϕ(i) ϕ(0) = a and ϕ(n + 1) = β( pi , n) i=0

Qn ϕ(n) a Define a function ψ(n) = i=0 pi . Then ψ(0) = 2 and

ϕ(n+1) ψ(n + 1) = ψ(n) · pn+1 β(ψ(n),n) = ψ(n) · pn+1

Thus ψ is primitive recursive and ϕ(n) = expn ψ(n) hence ϕ is also primitive recursive.

DMACC John M. Gillespie 34 We can prove that such a definition yields primitive recursive functins σ1 and σ2.

Another form of recursion

Simultaneous recursion

Definition Given a, b ∈ N and binary functions β1 and β2 define σ1 and σ2; σ1(0) = a, σ2(0) = b with

σ1(n + 1) = β1(σ1(n), σ2(n))

σ2(n + 1) = β2(σ1(n), σ2(n)).

DMACC John M. Gillespie 35 Another form of recursion

Simultaneous recursion

Definition Given a, b ∈ N and binary functions β1 and β2 define σ1 and σ2; σ1(0) = a, σ2(0) = b with

σ1(n + 1) = β1(σ1(n), σ2(n))

σ2(n + 1) = β2(σ1(n), σ2(n)).

We can prove that such a definition yields primitive recursive functins σ1 and σ2.

DMACC John M. Gillespie 36 σ1(n) σ2(n) a b Define a function ψ(n) = p1 · p2 . So then ψ(0) = p1 · p2 and

σ1(n+1) σ2(n+1) ψ(n + 1) = p1 · p2 β1(σ1(n),σ2(n)) β2(σ1(n),σ2(n) = p1 · p2 β1(exp1 ψ(n),exp2 ψ(n)) β2(exp1 ψ(n),exp2 ψ(n)) = p1 · p2

Hence ψ is primitive recursive ⇒ σ1 and σ2 are primitive recursive.

Simultaneous recursion

σ1(0) = a and σ2(0) = b

σ1(n + 1) = β1(σ1(n), σ2(n))

σ2(n + 1) = β2(σ1(n), σ2(n)).

DMACC John M. Gillespie 37 σ1(n+1) σ2(n+1) ψ(n + 1) = p1 · p2 β1(σ1(n),σ2(n)) β2(σ1(n),σ2(n) = p1 · p2 β1(exp1 ψ(n),exp2 ψ(n)) β2(exp1 ψ(n),exp2 ψ(n)) = p1 · p2

Hence ψ is primitive recursive ⇒ σ1 and σ2 are primitive recursive.

Simultaneous recursion

σ1(0) = a and σ2(0) = b

σ1(n + 1) = β1(σ1(n), σ2(n))

σ2(n + 1) = β2(σ1(n), σ2(n)).

σ1(n) σ2(n) a b Define a function ψ(n) = p1 · p2 . So then ψ(0) = p1 · p2 and

DMACC John M. Gillespie 38 Hence ψ is primitive recursive ⇒ σ1 and σ2 are primitive recursive.

Simultaneous recursion

σ1(0) = a and σ2(0) = b

σ1(n + 1) = β1(σ1(n), σ2(n))

σ2(n + 1) = β2(σ1(n), σ2(n)).

σ1(n) σ2(n) a b Define a function ψ(n) = p1 · p2 . So then ψ(0) = p1 · p2 and

σ1(n+1) σ2(n+1) ψ(n + 1) = p1 · p2 β1(σ1(n),σ2(n)) β2(σ1(n),σ2(n) = p1 · p2 β1(exp1 ψ(n),exp2 ψ(n)) β2(exp1 ψ(n),exp2 ψ(n)) = p1 · p2

DMACC John M. Gillespie 39 Simultaneous recursion

σ1(0) = a and σ2(0) = b

σ1(n + 1) = β1(σ1(n), σ2(n))

σ2(n + 1) = β2(σ1(n), σ2(n)).

σ1(n) σ2(n) a b Define a function ψ(n) = p1 · p2 . So then ψ(0) = p1 · p2 and

σ1(n+1) σ2(n+1) ψ(n + 1) = p1 · p2 β1(σ1(n),σ2(n)) β2(σ1(n),σ2(n) = p1 · p2 β1(exp1 ψ(n),exp2 ψ(n)) β2(exp1 ψ(n),exp2 ψ(n)) = p1 · p2

Hence ψ is primitive recursive ⇒ σ1 and σ2 are primitive recursive.

DMACC John M. Gillespie 40 I This function is indeed primitive recursive.

I But in such a definition if you have induction on multiple variables then your function may no longer be PR.

Nested recursion

Example Given known functions α, β and γ define ϕ(0, a) = α(a) with

ϕ(n + 1, a) = β(n, ϕ(n, γ(n, a, ϕ(n, a)))).

DMACC John M. Gillespie 41 I But in such a definition if you have induction on multiple variables then your function may no longer be PR.

Nested recursion

Example Given known functions α, β and γ define ϕ(0, a) = α(a) with

ϕ(n + 1, a) = β(n, ϕ(n, γ(n, a, ϕ(n, a)))).

I This function is indeed primitive recursive.

DMACC John M. Gillespie 42 Nested recursion

Example Given known functions α, β and γ define ϕ(0, a) = α(a) with

ϕ(n + 1, a) = β(n, ϕ(n, γ(n, a, ϕ(n, a)))).

I This function is indeed primitive recursive.

I But in such a definition if you have induction on multiple variables then your function may no longer be PR.

DMACC John M. Gillespie 43 I The class of general recursive functions coincides with the class of all computable functions.

I Hence functions of the λ-calculus, Turing computable functions, and so on are all general recursive functions.

I Given a defining system of equations you may not be able to tell if you have a working definition.

I In general the problem is undecidable.

General recursive functions

General recursive functions are defined in terms of a system of equations.

DMACC John M. Gillespie 44 I Hence functions of the λ-calculus, Turing computable functions, and so on are all general recursive functions.

I Given a defining system of equations you may not be able to tell if you have a working definition.

I In general the problem is undecidable.

General recursive functions

General recursive functions are defined in terms of a system of equations.

I The class of general recursive functions coincides with the class of all computable functions.

DMACC John M. Gillespie 45 I Given a defining system of equations you may not be able to tell if you have a working definition.

I In general the problem is undecidable.

General recursive functions

General recursive functions are defined in terms of a system of equations.

I The class of general recursive functions coincides with the class of all computable functions.

I Hence functions of the λ-calculus, Turing computable functions, and so on are all general recursive functions.

DMACC John M. Gillespie 46 I In general the problem is undecidable.

General recursive functions

General recursive functions are defined in terms of a system of equations.

I The class of general recursive functions coincides with the class of all computable functions.

I Hence functions of the λ-calculus, Turing computable functions, and so on are all general recursive functions.

I Given a defining system of equations you may not be able to tell if you have a working definition.

DMACC John M. Gillespie 47 General recursive functions

General recursive functions are defined in terms of a system of equations.

I The class of general recursive functions coincides with the class of all computable functions.

I Hence functions of the λ-calculus, Turing computable functions, and so on are all general recursive functions.

I Given a defining system of equations you may not be able to tell if you have a working definition.

I In general the problem is undecidable.

DMACC John M. Gillespie 48 The index of the function being defined σs and the number A of .

Example

1. σ1(0, x2) = x2

2. σ1(σ0(x1), x2) = σ0(σ1(x1, x2))

3. σ2(0, x2) = 0

4. σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2)

5. σ3(x1) = σ2(x1, x1)

I For this example s = 3, A = 5 and σ3 is the square function.

General recursive functions

Given a defining system of equations there are two numbers which are noteworthy.

DMACC John M. Gillespie 49 Example

1. σ1(0, x2) = x2

2. σ1(σ0(x1), x2) = σ0(σ1(x1, x2))

3. σ2(0, x2) = 0

4. σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2)

5. σ3(x1) = σ2(x1, x1)

I For this example s = 3, A = 5 and σ3 is the square function.

General recursive functions

Given a defining system of equations there are two numbers which are noteworthy.

The index of the function being defined σs and the number A of axioms.

DMACC John M. Gillespie 50 I For this example s = 3, A = 5 and σ3 is the square function.

General recursive functions

Given a defining system of equations there are two numbers which are noteworthy.

The index of the function being defined σs and the number A of axioms.

Example

1. σ1(0, x2) = x2

2. σ1(σ0(x1), x2) = σ0(σ1(x1, x2))

3. σ2(0, x2) = 0

4. σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2)

5. σ3(x1) = σ2(x1, x1)

DMACC John M. Gillespie 51 General recursive functions

Given a defining system of equations there are two numbers which are noteworthy.

The index of the function being defined σs and the number A of axioms.

Example

1. σ1(0, x2) = x2

2. σ1(σ0(x1), x2) = σ0(σ1(x1, x2))

3. σ2(0, x2) = 0

4. σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2)

5. σ3(x1) = σ2(x1, x1)

I For this example s = 3, A = 5 and σ3 is the square function.

DMACC John M. Gillespie 52 I For this example s = 3, A = 6. Can you identify the function σ3?

General recursive functions

Example

1. σ1(0) = 0

2. σ1(σ0(x1)) = x1

3. σ2(0, x2) = x2

4. σ2(σ0(x1), x2) = σ0(σ2(x1, x2))

5. σ3(0) = 1

6. σ3(σ0(x1)) = σ2(ϕ(x1), ϕ(σ1(x1)))

DMACC John M. Gillespie 53 General recursive functions

Example

1. σ1(0) = 0

2. σ1(σ0(x1)) = x1

3. σ2(0, x2) = x2

4. σ2(σ0(x1), x2) = σ0(σ2(x1, x2))

5. σ3(0) = 1

6. σ3(σ0(x1)) = σ2(ϕ(x1), ϕ(σ1(x1)))

I For this example s = 3, A = 6. Can you identify the function σ3?

DMACC John M. Gillespie 54 I For this example s = 2 and A = 4.

I σ2(x1, x2) = x1 −· x2.

General recursive functions

Example

1. σ1(0) = 0

2. σ1(σ0(x1)) = x1

3. σ2(x1, 0) = x1

4. σ2(x1, σ0(x2)) = σ1(σ2(x1, x2))

DMACC John M. Gillespie 55 General recursive functions

Example

1. σ1(0) = 0

2. σ1(σ0(x1)) = x1

3. σ2(x1, 0) = x1

4. σ2(x1, σ0(x2)) = σ1(σ2(x1, x2))

I For this example s = 2 and A = 4.

I σ2(x1, x2) = x1 −· x2.

DMACC John M. Gillespie 56 n(1, 2) σ1(0, σ0(x2)) = σ0(x2) (3) z(3, 2) σ1(0, σ0(0)) = σ0(0) (4) n(2, 2) σ1(σ0(x1), σ0(x2)) = σ0(σ1(x1, σ0(x2))) (5) z(5, i) σ1(σ0(0), σ0(0)) = σ0(σ1(0, σ0(0))) (6) sub(4, 6, 15) σ1(σ0(0), σ0(0)) = σ0(σ0(0)) (7)

This illustrates the three admissable steps in any computation; n, z and sub.

Computations as deductions

 σ (0, x ) = x (1) Axioms 1 2 2 σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (2)     Deductions   

DMACC John M. Gillespie 57 z(3, 2) σ1(0, σ0(0)) = σ0(0) (4) n(2, 2) σ1(σ0(x1), σ0(x2)) = σ0(σ1(x1, σ0(x2))) (5) z(5, i) σ1(σ0(0), σ0(0)) = σ0(σ1(0, σ0(0))) (6) sub(4, 6, 15) σ1(σ0(0), σ0(0)) = σ0(σ0(0)) (7)

This illustrates the three admissable steps in any computation; n, z and sub.

Computations as deductions

 σ (0, x ) = x (1) Axioms 1 2 2 σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (2)  n(1, 2) σ (0, σ (x )) = σ (x ) (3)  1 0 2 0 2   Deductions   

DMACC John M. Gillespie 58 n(2, 2) σ1(σ0(x1), σ0(x2)) = σ0(σ1(x1, σ0(x2))) (5) z(5, i) σ1(σ0(0), σ0(0)) = σ0(σ1(0, σ0(0))) (6) sub(4, 6, 15) σ1(σ0(0), σ0(0)) = σ0(σ0(0)) (7)

This illustrates the three admissable steps in any computation; n, z and sub.

Computations as deductions

 σ (0, x ) = x (1) Axioms 1 2 2 σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (2)  n(1, 2) σ (0, σ (x )) = σ (x ) (3)  1 0 2 0 2   z(3, 2) σ1(0, σ0(0)) = σ0(0) (4) Deductions   

DMACC John M. Gillespie 59 z(5, i) σ1(σ0(0), σ0(0)) = σ0(σ1(0, σ0(0))) (6) sub(4, 6, 15) σ1(σ0(0), σ0(0)) = σ0(σ0(0)) (7)

This illustrates the three admissable steps in any computation; n, z and sub.

Computations as deductions

 σ (0, x ) = x (1) Axioms 1 2 2 σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (2)  n(1, 2) σ (0, σ (x )) = σ (x ) (3)  1 0 2 0 2   z(3, 2) σ1(0, σ0(0)) = σ0(0) (4) Deductions n(2, 2) σ1(σ0(x1), σ0(x2)) = σ0(σ1(x1, σ0(x2))) (5)   

DMACC John M. Gillespie 60 sub(4, 6, 15) σ1(σ0(0), σ0(0)) = σ0(σ0(0)) (7)

This illustrates the three admissable steps in any computation; n, z and sub.

Computations as deductions

 σ (0, x ) = x (1) Axioms 1 2 2 σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (2)  n(1, 2) σ (0, σ (x )) = σ (x ) (3)  1 0 2 0 2   z(3, 2) σ1(0, σ0(0)) = σ0(0) (4) Deductions n(2, 2) σ1(σ0(x1), σ0(x2)) = σ0(σ1(x1, σ0(x2))) (5)   z(5, i) σ1(σ0(0), σ0(0)) = σ0(σ1(0, σ0(0))) (6) 

DMACC John M. Gillespie 61 This illustrates the three admissable steps in any computation; n, z and sub.

Computations as deductions

 σ (0, x ) = x (1) Axioms 1 2 2 σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (2)  n(1, 2) σ (0, σ (x )) = σ (x ) (3)  1 0 2 0 2   z(3, 2) σ1(0, σ0(0)) = σ0(0) (4) Deductions n(2, 2) σ1(σ0(x1), σ0(x2)) = σ0(σ1(x1, σ0(x2))) (5)  z(5, i) σ1(σ0(0), σ0(0)) = σ0(σ1(0, σ0(0))) (6)   sub(4, 6, 15) σ1(σ0(0), σ0(0)) = σ0(σ0(0)) (7)

DMACC John M. Gillespie 62 Computations as deductions

 σ (0, x ) = x (1) Axioms 1 2 2 σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (2)  n(1, 2) σ (0, σ (x )) = σ (x ) (3)  1 0 2 0 2   z(3, 2) σ1(0, σ0(0)) = σ0(0) (4) Deductions n(2, 2) σ1(σ0(x1), σ0(x2)) = σ0(σ1(x1, σ0(x2))) (5)  z(5, i) σ1(σ0(0), σ0(0)) = σ0(σ1(0, σ0(0))) (6)   sub(4, 6, 15) σ1(σ0(0), σ0(0)) = σ0(σ0(0)) (7)

This illustrates the three admissable steps in any computation; n, z and sub.

DMACC John M. Gillespie 63 I n(i, j) denotes non-zero evaluation; We are plugging σ0(xj ) into equation i in the variable j.

I sub(i, j, k) denotes substitution of RHS of equation i into equation j at the kth position.

The admissable steps

I z(i, j) denotes plugging zero into the j variable of equation i.

DMACC John M. Gillespie 64 I sub(i, j, k) denotes substitution of RHS of equation i into equation j at the kth position.

The admissable steps

I z(i, j) denotes plugging zero into the j variable of equation i.

I n(i, j) denotes non-zero evaluation; We are plugging σ0(xj ) into equation i in the variable j.

DMACC John M. Gillespie 65 The admissable steps

I z(i, j) denotes plugging zero into the j variable of equation i.

I n(i, j) denotes non-zero evaluation; We are plugging σ0(xj ) into equation i in the variable j.

I sub(i, j, k) denotes substitution of RHS of equation i into equation j at the kth position.

DMACC John M. Gillespie 66 n(1, 2) σ1(0, σ0(x2)) = σ0(x2) (5) z(5, 2) σ1(0, σ0(0)) = σ0(0) (6) n(4, 2) σ2(σ0(x1), σ0(x2)) = σ1(σ2(x1, σ0(x2)), σ0(x2)) (7) z(7, i) σ2(σ0(0), σ0(0)) = σ1(σ2(0, σ0(0)), σ0(0)) (8) n(3, 2) σ2(0, σ0(x2)) = 0 (9) z(9, 2) σ2(0, σ0(0)) = 0 (10) sub(10, 8) σ2(σ0(0), σ0(0))) = σ1(0, σ0(0)) (11) sub(6, 11) σ2(σ0(0), σ0(0))) = σ0(0) (12)

Computations as deductions

 σ (0, x ) = x (1)  1 2 2  σ (σ (x ), x ) = σ (σ (x , x )) (2) Axioms 1 0 1 2 0 1 1 2 σ2(0, x2) = 0 (3)   σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2) (4)             

DMACC John M. Gillespie 67 z(5, 2) σ1(0, σ0(0)) = σ0(0) (6) n(4, 2) σ2(σ0(x1), σ0(x2)) = σ1(σ2(x1, σ0(x2)), σ0(x2)) (7) z(7, i) σ2(σ0(0), σ0(0)) = σ1(σ2(0, σ0(0)), σ0(0)) (8) n(3, 2) σ2(0, σ0(x2)) = 0 (9) z(9, 2) σ2(0, σ0(0)) = 0 (10) sub(10, 8) σ2(σ0(0), σ0(0))) = σ1(0, σ0(0)) (11) sub(6, 11) σ2(σ0(0), σ0(0))) = σ0(0) (12)

Computations as deductions

 σ (0, x ) = x (1)  1 2 2  σ (σ (x ), x ) = σ (σ (x , x )) (2) Axioms 1 0 1 2 0 1 1 2 σ2(0, x2) = 0 (3)   σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2) (4)  n(1, 2) σ (0, σ (x )) = σ (x ) (5)  1 0 2 0 2           

DMACC John M. Gillespie 68 n(4, 2) σ2(σ0(x1), σ0(x2)) = σ1(σ2(x1, σ0(x2)), σ0(x2)) (7) z(7, i) σ2(σ0(0), σ0(0)) = σ1(σ2(0, σ0(0)), σ0(0)) (8) n(3, 2) σ2(0, σ0(x2)) = 0 (9) z(9, 2) σ2(0, σ0(0)) = 0 (10) sub(10, 8) σ2(σ0(0), σ0(0))) = σ1(0, σ0(0)) (11) sub(6, 11) σ2(σ0(0), σ0(0))) = σ0(0) (12)

Computations as deductions

 σ (0, x ) = x (1)  1 2 2  σ (σ (x ), x ) = σ (σ (x , x )) (2) Axioms 1 0 1 2 0 1 1 2 σ2(0, x2) = 0 (3)   σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2) (4)  n(1, 2) σ (0, σ (x )) = σ (x ) (5)  1 0 2 0 2  z(5, 2) σ (0, σ (0)) = σ (0) (6)  1 0 0         

DMACC John M. Gillespie 69 z(7, i) σ2(σ0(0), σ0(0)) = σ1(σ2(0, σ0(0)), σ0(0)) (8) n(3, 2) σ2(0, σ0(x2)) = 0 (9) z(9, 2) σ2(0, σ0(0)) = 0 (10) sub(10, 8) σ2(σ0(0), σ0(0))) = σ1(0, σ0(0)) (11) sub(6, 11) σ2(σ0(0), σ0(0))) = σ0(0) (12)

Computations as deductions

 σ (0, x ) = x (1)  1 2 2  σ (σ (x ), x ) = σ (σ (x , x )) (2) Axioms 1 0 1 2 0 1 1 2 σ2(0, x2) = 0 (3)   σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2) (4)  n(1, 2) σ (0, σ (x )) = σ (x ) (5)  1 0 2 0 2  z(5, 2) σ (0, σ (0)) = σ (0) (6)  1 0 0  n(4, 2) σ (σ (x ), σ (x )) = σ (σ (x , σ (x )), σ (x )) (7)  2 0 1 0 2 1 2 1 0 2 0 2       

DMACC John M. Gillespie 70 n(3, 2) σ2(0, σ0(x2)) = 0 (9) z(9, 2) σ2(0, σ0(0)) = 0 (10) sub(10, 8) σ2(σ0(0), σ0(0))) = σ1(0, σ0(0)) (11) sub(6, 11) σ2(σ0(0), σ0(0))) = σ0(0) (12)

Computations as deductions

 σ (0, x ) = x (1)  1 2 2  σ (σ (x ), x ) = σ (σ (x , x )) (2) Axioms 1 0 1 2 0 1 1 2 σ2(0, x2) = 0 (3)   σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2) (4)  n(1, 2) σ1(0, σ0(x2)) = σ0(x2) (5)   z(5, 2) σ1(0, σ0(0)) = σ0(0) (6)   n(4, 2) σ2(σ0(x1), σ0(x2)) = σ1(σ2(x1, σ0(x2)), σ0(x2)) (7)   z(7, i) σ2(σ0(0), σ0(0)) = σ1(σ2(0, σ0(0)), σ0(0)) (8)      

DMACC John M. Gillespie 71 z(9, 2) σ2(0, σ0(0)) = 0 (10) sub(10, 8) σ2(σ0(0), σ0(0))) = σ1(0, σ0(0)) (11) sub(6, 11) σ2(σ0(0), σ0(0))) = σ0(0) (12)

Computations as deductions

 σ (0, x ) = x (1)  1 2 2  σ (σ (x ), x ) = σ (σ (x , x )) (2) Axioms 1 0 1 2 0 1 1 2 σ2(0, x2) = 0 (3)   σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2) (4)  n(1, 2) σ1(0, σ0(x2)) = σ0(x2) (5)   z(5, 2) σ1(0, σ0(0)) = σ0(0) (6)   n(4, 2) σ2(σ0(x1), σ0(x2)) = σ1(σ2(x1, σ0(x2)), σ0(x2)) (7)   z(7, i) σ2(σ0(0), σ0(0)) = σ1(σ2(0, σ0(0)), σ0(0)) (8)  n(3, 2) σ2(0, σ0(x2)) = 0 (9)     

DMACC John M. Gillespie 72 sub(10, 8) σ2(σ0(0), σ0(0))) = σ1(0, σ0(0)) (11) sub(6, 11) σ2(σ0(0), σ0(0))) = σ0(0) (12)

Computations as deductions

 σ (0, x ) = x (1)  1 2 2  σ (σ (x ), x ) = σ (σ (x , x )) (2) Axioms 1 0 1 2 0 1 1 2 σ2(0, x2) = 0 (3)   σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2) (4)  n(1, 2) σ1(0, σ0(x2)) = σ0(x2) (5)   z(5, 2) σ1(0, σ0(0)) = σ0(0) (6)   n(4, 2) σ2(σ0(x1), σ0(x2)) = σ1(σ2(x1, σ0(x2)), σ0(x2)) (7)   z(7, i) σ2(σ0(0), σ0(0)) = σ1(σ2(0, σ0(0)), σ0(0)) (8)  n(3, 2) σ2(0, σ0(x2)) = 0 (9)   z(9, 2) σ2(0, σ0(0)) = 0 (10)   

DMACC John M. Gillespie 73 sub(6, 11) σ2(σ0(0), σ0(0))) = σ0(0) (12)

Computations as deductions

 σ (0, x ) = x (1)  1 2 2  σ (σ (x ), x ) = σ (σ (x , x )) (2) Axioms 1 0 1 2 0 1 1 2 σ2(0, x2) = 0 (3)   σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2) (4)  n(1, 2) σ1(0, σ0(x2)) = σ0(x2) (5)   z(5, 2) σ1(0, σ0(0)) = σ0(0) (6)   n(4, 2) σ2(σ0(x1), σ0(x2)) = σ1(σ2(x1, σ0(x2)), σ0(x2)) (7)   z(7, i) σ2(σ0(0), σ0(0)) = σ1(σ2(0, σ0(0)), σ0(0)) (8)  n(3, 2) σ2(0, σ0(x2)) = 0 (9)   z(9, 2) σ2(0, σ0(0)) = 0 (10)   sub(10, 8) σ2(σ0(0), σ0(0))) = σ1(0, σ0(0)) (11) 

DMACC John M. Gillespie 74 Computations as deductions

 σ (0, x ) = x (1)  1 2 2  σ (σ (x ), x ) = σ (σ (x , x )) (2) Axioms 1 0 1 2 0 1 1 2 σ2(0, x2) = 0 (3)   σ2(σ0(x1), x2) = σ1(σ2(x1, x2), x2) (4)  n(1, 2) σ1(0, σ0(x2)) = σ0(x2) (5)   z(5, 2) σ1(0, σ0(0)) = σ0(0) (6)   n(4, 2) σ2(σ0(x1), σ0(x2)) = σ1(σ2(x1, σ0(x2)), σ0(x2)) (7)   z(7, i) σ2(σ0(0), σ0(0)) = σ1(σ2(0, σ0(0)), σ0(0)) (8)  n(3, 2) σ2(0, σ0(x2)) = 0 (9)   z(9, 2) σ2(0, σ0(0)) = 0 (10)   sub(10, 8) σ2(σ0(0), σ0(0))) = σ1(0, σ0(0)) (11)  sub(6, 11) σ2(σ0(0), σ0(0))) = σ0(0) (12)

DMACC John M. Gillespie 75 ϕ(a1, ..., ar ) = µj [τ(a1, ..., ar ) = 0]

This is the unbounded search.

B i X Y lim τ(~a, j)sg B→∞ i=0 j=0

We will use this Kleene operator later to search through computations.

Key component of the Kleene normal form

The Kleene operator

Given a function τ(a1, ..., ar , n) in which for every ~a there exists an n such that τ(~a, n) = 0 we can define a new function ϕ(~a).

DMACC John M. Gillespie 76 This is the unbounded search.

B i X Y lim τ(~a, j)sg B→∞ i=0 j=0

We will use this Kleene operator later to search through computations.

Key component of the Kleene normal form

The Kleene operator

Given a function τ(a1, ..., ar , n) in which for every ~a there exists an n such that τ(~a, n) = 0 we can define a new function ϕ(~a).

ϕ(a1, ..., ar ) = µj [τ(a1, ..., ar ) = 0]

DMACC John M. Gillespie 77 We will use this Kleene operator later to search through computations.

Key component of the Kleene normal form

The Kleene operator

Given a function τ(a1, ..., ar , n) in which for every ~a there exists an n such that τ(~a, n) = 0 we can define a new function ϕ(~a).

ϕ(a1, ..., ar ) = µj [τ(a1, ..., ar ) = 0]

This is the unbounded search.

B i X Y lim τ(~a, j)sg B→∞ i=0 j=0

DMACC John M. Gillespie 78 Key component of the Kleene normal form

The Kleene operator

Given a function τ(a1, ..., ar , n) in which for every ~a there exists an n such that τ(~a, n) = 0 we can define a new function ϕ(~a).

ϕ(a1, ..., ar ) = µj [τ(a1, ..., ar ) = 0]

This is the unbounded search.

B i X Y lim τ(~a, j)sg B→∞ i=0 j=0

We will use this Kleene operator later to search through computations.

DMACC John M. Gillespie 79 Then µj [τ(a1, ..., ar , j) = 0] = σ(0, a1, ..., ar , τ(a1, ..., ar , 0)).

The Kleene operator as a general recursive function

Suppose a function τ(a1, ..., ar , n) is already given. We define a new function σ.

I σ(j, a1, ..., ar , 0) = j

I σ(j, a1, ..., ar , n + 1) = σ(j + 1, a1, ..., ar , τ(a1, ..., ar , j + 1))

DMACC John M. Gillespie 80 The Kleene operator as a general recursive function

Suppose a function τ(a1, ..., ar , n) is already given. We define a new function σ.

I σ(j, a1, ..., ar , 0) = j

I σ(j, a1, ..., ar , n + 1) = σ(j + 1, a1, ..., ar , τ(a1, ..., ar , j + 1))

Then µj [τ(a1, ..., ar , j) = 0] = σ(0, a1, ..., ar , τ(a1, ..., ar , 0)).

DMACC John M. Gillespie 81 I This is the normal form we wish to prove exists.

I This proves the Kleene operator cannot be primitive recursive.

I This also proves that if we augment the class PR with the Kleene operator this yields the class of all computable functions.

Kleene’s theorem states that any general recursive function ϕ can be put in the form

ϕ = ψ(µ[τ]) where µ is the Kleene operator and ψ and τ are primitive recursive.

DMACC John M. Gillespie 82 I This proves the Kleene operator cannot be primitive recursive.

I This also proves that if we augment the class PR with the Kleene operator this yields the class of all computable functions.

Kleene’s theorem states that any general recursive function ϕ can be put in the form

ϕ = ψ(µ[τ]) where µ is the Kleene operator and ψ and τ are primitive recursive.

I This is the normal form we wish to prove exists.

DMACC John M. Gillespie 83 I This also proves that if we augment the class PR with the Kleene operator this yields the class of all computable functions.

Kleene’s theorem states that any general recursive function ϕ can be put in the form

ϕ = ψ(µ[τ]) where µ is the Kleene operator and ψ and τ are primitive recursive.

I This is the normal form we wish to prove exists.

I This proves the Kleene operator cannot be primitive recursive.

DMACC John M. Gillespie 84 Kleene’s theorem states that any general recursive function ϕ can be put in the form

ϕ = ψ(µ[τ]) where µ is the Kleene operator and ψ and τ are primitive recursive.

I This is the normal form we wish to prove exists.

I This proves the Kleene operator cannot be primitive recursive.

I This also proves that if we augment the class PR with the Kleene operator this yields the class of all computable functions.

DMACC John M. Gillespie 85 By Godel numbering the symbols used in computations we can employ standard to sort through sets of computations. Furthermore we can hone in on those computations which are actually correct.

Arithmetization of computations

We begin with the basic Godel numbering of symbols.

Individual symbol Godel number σn 2n + 2, n = 0, 1, ... 0 1 = 3 ( 5 ) 7 , 9 xn 2n + 9, n = 1, 2, ...

DMACC John M. Gillespie 86 Furthermore we can hone in on those computations which are actually correct.

Arithmetization of computations

We begin with the basic Godel numbering of symbols.

Individual symbol Godel number σn 2n + 2, n = 0, 1, ... 0 1 = 3 ( 5 ) 7 , 9 xn 2n + 9, n = 1, 2, ...

By Godel numbering the symbols used in computations we can employ standard arithmetic to sort through sets of computations.

DMACC John M. Gillespie 87 Arithmetization of computations

We begin with the basic Godel numbering of symbols.

Individual symbol Godel number σn 2n + 2, n = 0, 1, ... 0 1 = 3 ( 5 ) 7 , 9 xn 2n + 9, n = 1, 2, ...

By Godel numbering the symbols used in computations we can employ standard arithmetic to sort through sets of computations. Furthermore we can hone in on those computations which are actually correct.

DMACC John M. Gillespie 88 2 5 2 5 1 7 7 2. σ0(σ0(0)) has Godel number p1p2p3p4p5p6p7 4 5 11 7 3 11 3. σ2(x1) = x1 has Godel number p1p2p3 p4p5p6 2 5 2i+9 7 4. σ0(xi ) has Godel number p1p2p3 p4

More on Godel numbers

Some examples of symbol sequences and their Godel numbers. Example

2 5 1 7 1. σ0(0) has Godel number p1p2p3p4

DMACC John M. Gillespie 89 4 5 11 7 3 11 3. σ2(x1) = x1 has Godel number p1p2p3 p4p5p6 2 5 2i+9 7 4. σ0(xi ) has Godel number p1p2p3 p4

More on Godel numbers

Some examples of symbol sequences and their Godel numbers. Example

2 5 1 7 1. σ0(0) has Godel number p1p2p3p4 2 5 2 5 1 7 7 2. σ0(σ0(0)) has Godel number p1p2p3p4p5p6p7

DMACC John M. Gillespie 90 2 5 2i+9 7 4. σ0(xi ) has Godel number p1p2p3 p4

More on Godel numbers

Some examples of symbol sequences and their Godel numbers. Example

2 5 1 7 1. σ0(0) has Godel number p1p2p3p4 2 5 2 5 1 7 7 2. σ0(σ0(0)) has Godel number p1p2p3p4p5p6p7 4 5 11 7 3 11 3. σ2(x1) = x1 has Godel number p1p2p3 p4p5p6

DMACC John M. Gillespie 91 More on Godel numbers

Some examples of symbol sequences and their Godel numbers. Example

2 5 1 7 1. σ0(0) has Godel number p1p2p3p4 2 5 2 5 1 7 7 2. σ0(σ0(0)) has Godel number p1p2p3p4p5p6p7 4 5 11 7 3 11 3. σ2(x1) = x1 has Godel number p1p2p3 p4p5p6 2 5 2i+9 7 4. σ0(xi ) has Godel number p1p2p3 p4

DMACC John M. Gillespie 92 Godel numbering a computation

This is the first example computation.

 q := p4p5p1p9p13p7p3p13 Axioms 1 1 2 3 4 5 6 7 8 ...

 4 5 13 7  q3 := p1p2 ... p13p14  . Deductions .  4 5 7 7  q7 := p1p2 ... p19p20

The entire computation is encoded in the Godel number q1 q2 q7 p1 p2 ... p7 .

DMACC John M. Gillespie 93 e1 e2 el I Every computation is assigned a Godel number p1 p2 ... pl . I Each exponent ei is the Godel number of an equation.

I The first A equations e1,...,eA are the axioms.

I The rest eA+1,...,el are expected to be deductions from previous equations.

I We require functions which can detect such deductions.

Basic strategy

DMACC John M. Gillespie 94 I Each exponent ei is the Godel number of an equation.

I The first A equations e1,...,eA are the axioms.

I The rest eA+1,...,el are expected to be deductions from previous equations.

I We require functions which can detect such deductions.

Basic strategy

e1 e2 el I Every computation is assigned a Godel number p1 p2 ... pl .

DMACC John M. Gillespie 95 I The first A equations e1,...,eA are the axioms.

I The rest eA+1,...,el are expected to be deductions from previous equations.

I We require functions which can detect such deductions.

Basic strategy

e1 e2 el I Every computation is assigned a Godel number p1 p2 ... pl . I Each exponent ei is the Godel number of an equation.

DMACC John M. Gillespie 96 I The rest eA+1,...,el are expected to be deductions from previous equations.

I We require functions which can detect such deductions.

Basic strategy

e1 e2 el I Every computation is assigned a Godel number p1 p2 ... pl . I Each exponent ei is the Godel number of an equation.

I The first A equations e1,...,eA are the axioms.

DMACC John M. Gillespie 97 I We require functions which can detect such deductions.

Basic strategy

e1 e2 el I Every computation is assigned a Godel number p1 p2 ... pl . I Each exponent ei is the Godel number of an equation.

I The first A equations e1,...,eA are the axioms.

I The rest eA+1,...,el are expected to be deductions from previous equations.

DMACC John M. Gillespie 98 Basic strategy

e1 e2 el I Every computation is assigned a Godel number p1 p2 ... pl . I Each exponent ei is the Godel number of an equation.

I The first A equations e1,...,eA are the axioms.

I The rest eA+1,...,el are expected to be deductions from previous equations.

I We require functions which can detect such deductions.

DMACC John M. Gillespie 99 I (∃j∃k)[ (j < i) ∧ (k < ω) ∧ (ei = z(j, k)) ]

I We will construct similar primitive recursive functions τ2 and τ3 for the other deduction steps n and sub.

I Then τ1(ω, i)τ2(ω, i)τ3(ω, i) will equal zero if and only if the ith equation of ω is some proper deduction.

Basic strategy

I We will construct a primitive recursive function τ1 such that τ1(ω, i) = 0 if and only if ei = z(j, k) for j < i in the computation ω.

DMACC John M. Gillespie 100 I We will construct similar primitive recursive functions τ2 and τ3 for the other deduction steps n and sub.

I Then τ1(ω, i)τ2(ω, i)τ3(ω, i) will equal zero if and only if the ith equation of ω is some proper deduction.

Basic strategy

I We will construct a primitive recursive function τ1 such that τ1(ω, i) = 0 if and only if ei = z(j, k) for j < i in the computation ω.

I (∃j∃k)[ (j < i) ∧ (k < ω) ∧ (ei = z(j, k)) ]

DMACC John M. Gillespie 101 I Then τ1(ω, i)τ2(ω, i)τ3(ω, i) will equal zero if and only if the ith equation of ω is some proper deduction.

Basic strategy

I We will construct a primitive recursive function τ1 such that τ1(ω, i) = 0 if and only if ei = z(j, k) for j < i in the computation ω.

I (∃j∃k)[ (j < i) ∧ (k < ω) ∧ (ei = z(j, k)) ]

I We will construct similar primitive recursive functions τ2 and τ3 for the other deduction steps n and sub.

DMACC John M. Gillespie 102 Basic strategy

I We will construct a primitive recursive function τ1 such that τ1(ω, i) = 0 if and only if ei = z(j, k) for j < i in the computation ω.

I (∃j∃k)[ (j < i) ∧ (k < ω) ∧ (ei = z(j, k)) ]

I We will construct similar primitive recursive functions τ2 and τ3 for the other deduction steps n and sub.

I Then τ1(ω, i)τ2(ω, i)τ3(ω, i) will equal zero if and only if the ith equation of ω is some proper deduction.

DMACC John M. Gillespie 103    1 if exp (e) = 2i + 9  long(e) j Y  expj (e) else  z(e, i) = pj j=1 This function is primitive recursive.

Admissable deduction step z

Substituting zero for the variable xi in the equation e altars the Godel number as follows.

DMACC John M. Gillespie 104 This function is primitive recursive.

Admissable deduction step z

Substituting zero for the variable xi in the equation e altars the Godel number as follows.

   1 if exp (e) = 2i + 9  long(e) j Y  expj (e) else  z(e, i) = pj j=1

DMACC John M. Gillespie 105 Admissable deduction step z

Substituting zero for the variable xi in the equation e altars the Godel number as follows.

   1 if exp (e) = 2i + 9  long(e) j Y  expj (e) else  z(e, i) = pj j=1 This function is primitive recursive.

DMACC John M. Gillespie 106 long(e) ( ) O q if expj(e) = 2i + 9 n(e, i) = pexpj(e) else j=1 1

This function is primitive recursive. What is q?

Admissable deduction step n

Substituting a non-zero value σ0(xi ) in the variable xi of equation e altars the Godel number as follows.

DMACC John M. Gillespie 107 This function is primitive recursive. What is q?

Admissable deduction step n

Substituting a non-zero value σ0(xi ) in the variable xi of equation e altars the Godel number as follows.

long(e) ( ) O q if expj(e) = 2i + 9 n(e, i) = pexpj(e) else j=1 1

DMACC John M. Gillespie 108 What is q?

Admissable deduction step n

Substituting a non-zero value σ0(xi ) in the variable xi of equation e altars the Godel number as follows.

long(e) ( ) O q if expj(e) = 2i + 9 n(e, i) = pexpj(e) else j=1 1

This function is primitive recursive.

DMACC John M. Gillespie 109 Admissable deduction step n

Substituting a non-zero value σ0(xi ) in the variable xi of equation e altars the Godel number as follows.

long(e) ( ) O q if expj(e) = 2i + 9 n(e, i) = pexpj(e) else j=1 1

This function is primitive recursive. What is q?

DMACC John M. Gillespie 110 long(m) i X Y  eq(m) = 1 + sg sg(expj(m) −· 3) + sg(3 −· expj(m)) i=1 j=1

Useful formulas

If m is the Godel number of an equation then eq(m) locates the equality sign.

eq(m) = µj[j ≤ long(m) ∧ expj(m) = 3] Bounded search =⇒ PR.

DMACC John M. Gillespie 111 Useful formulas

If m is the Godel number of an equation then eq(m) locates the equality sign.

eq(m) = µj[j ≤ long(m) ∧ expj(m) = 3] Bounded search =⇒ PR.

long(m) i X Y  eq(m) = 1 + sg sg(expj(m) −· 3) + sg(3 −· expj(m)) i=1 j=1

DMACC John M. Gillespie 112 Useful formulas

If m is the Godel number of an equation then β(m) denotes the Godel number of the left-hand side of the equation.

eq(m)−· 1 Y expj (m) β(m) = pj j=1

DMACC John M. Gillespie 113 Useful formulas

Then the right-hand side of equation m which we denote by γ(m) is the following.

long(m)−· eq(m) Y expj+eq(m)(m) γ(m) = pj j=1

DMACC John M. Gillespie 114 I Hence β(m, n, j) = 0 iff expi (β(m)) = expi+j (n) for every 1 ≤ i ≤ long(β(m)).

I So β(m, n, j) = 0 iff the expression for n contains the expression for β(m) precisely after the jth symbol.

I Note that β(m, n, j) 6= 0 if long(n) − j < long(β(m)).

Does a given equation contain some term?

Here we are testing for a copy of β(m) in the expression n beginning at location j + 1. Denote this predicate β(m, n, j).

long(β(m)) X sg( expi+j(n) −· expi β(m) ) + sg( expi β(m) −· expi+j(n)) i=1

DMACC John M. Gillespie 115 I So β(m, n, j) = 0 iff the expression for n contains the expression for β(m) precisely after the jth symbol.

I Note that β(m, n, j) 6= 0 if long(n) − j < long(β(m)).

Does a given equation contain some term?

Here we are testing for a copy of β(m) in the expression n beginning at location j + 1. Denote this predicate β(m, n, j).

long(β(m)) X sg( expi+j(n) −· expi β(m) ) + sg( expi β(m) −· expi+j(n)) i=1

I Hence β(m, n, j) = 0 iff expi (β(m)) = expi+j (n) for every 1 ≤ i ≤ long(β(m)).

DMACC John M. Gillespie 116 I Note that β(m, n, j) 6= 0 if long(n) − j < long(β(m)).

Does a given equation contain some term?

Here we are testing for a copy of β(m) in the expression n beginning at location j + 1. Denote this predicate β(m, n, j).

long(β(m)) X sg( expi+j(n) −· expi β(m) ) + sg( expi β(m) −· expi+j(n)) i=1

I Hence β(m, n, j) = 0 iff expi (β(m)) = expi+j (n) for every 1 ≤ i ≤ long(β(m)).

I So β(m, n, j) = 0 iff the expression for n contains the expression for β(m) precisely after the jth symbol.

DMACC John M. Gillespie 117 Does a given equation contain some term?

Here we are testing for a copy of β(m) in the expression n beginning at location j + 1. Denote this predicate β(m, n, j).

long(β(m)) X sg( expi+j(n) −· expi β(m) ) + sg( expi β(m) −· expi+j(n)) i=1

I Hence β(m, n, j) = 0 iff expi (β(m)) = expi+j (n) for every 1 ≤ i ≤ long(β(m)).

I So β(m, n, j) = 0 iff the expression for n contains the expression for β(m) precisely after the jth symbol.

I Note that β(m, n, j) 6= 0 if long(n) − j < long(β(m)).

DMACC John M. Gillespie 118 Hence eq(m, n) = 0 if and only if m = n. Then

long(β(m)) X sg( expi+j(n) −· expi β(m) ) + sg( expi β(m) −· expi+j(n)) i=1 simplifies to

long(β(m)) X β(m, n, j) = eq(expi+j(n), expi β(m)). i=1

The binary function eq(m, n)

We will use eq also to denote the binary function given below.

eq(m, n) = sg(m −· n) + sg(n −· m)

DMACC John M. Gillespie 119 Then

long(β(m)) X sg( expi+j(n) −· expi β(m) ) + sg( expi β(m) −· expi+j(n)) i=1 simplifies to

long(β(m)) X β(m, n, j) = eq(expi+j(n), expi β(m)). i=1

The binary function eq(m, n)

We will use eq also to denote the binary function given below.

eq(m, n) = sg(m −· n) + sg(n −· m)

Hence eq(m, n) = 0 if and only if m = n.

DMACC John M. Gillespie 120 simplifies to

long(β(m)) X β(m, n, j) = eq(expi+j(n), expi β(m)). i=1

The binary function eq(m, n)

We will use eq also to denote the binary function given below.

eq(m, n) = sg(m −· n) + sg(n −· m)

Hence eq(m, n) = 0 if and only if m = n. Then

long(β(m)) X sg( expi+j(n) −· expi β(m) ) + sg( expi β(m) −· expi+j(n)) i=1

DMACC John M. Gillespie 121 The binary function eq(m, n)

We will use eq also to denote the binary function given below.

eq(m, n) = sg(m −· n) + sg(n −· m)

Hence eq(m, n) = 0 if and only if m = n. Then

long(β(m)) X sg( expi+j(n) −· expi β(m) ) + sg( expi β(m) −· expi+j(n)) i=1 simplifies to

long(β(m)) X β(m, n, j) = eq(expi+j(n), expi β(m)). i=1

DMACC John M. Gillespie 122 This is a primitive recursive function.

Admissable deduction step sub

Substituting γ(m) for β(m) in equation n altars it’s Godel number as follows.

If β(m, n, j) = 0 then

j long(n)−· (j+longβ(m)) exp (n) Y expi (n) Y j+longβ(m)+i sub(m, n, j) = pi ∗ γ(m) ∗ pi i=1 i=1 otherwise sub(m, n, j) = n.

DMACC John M. Gillespie 123 Admissable deduction step sub

Substituting γ(m) for β(m) in equation n altars it’s Godel number as follows.

If β(m, n, j) = 0 then

j long(n)−· (j+longβ(m)) exp (n) Y expi (n) Y j+longβ(m)+i sub(m, n, j) = pi ∗ γ(m) ∗ pi i=1 i=1 otherwise sub(m, n, j) = n.

This is a primitive recursive function.

DMACC John M. Gillespie 124 I There exists j < i and some k such that expi (ω) = z(expj (ω), k). I There exists j < i and some k such that expi (ω) = n(expj (ω), k)).

I ∃m, n < i and j where expi (ω) = sub(expm(ω), expn(ω), j)).

Valid deduction

The natural number ω is the Godel number of a valid deduction if for every i ≤ long(ω) one of the following is true;

I expi (ω) is the Godel number of one of the defining equations.

DMACC John M. Gillespie 125 I There exists j < i and some k such that expi (ω) = n(expj (ω), k)).

I ∃m, n < i and j where expi (ω) = sub(expm(ω), expn(ω), j)).

Valid deduction

The natural number ω is the Godel number of a valid deduction if for every i ≤ long(ω) one of the following is true;

I expi (ω) is the Godel number of one of the defining equations. I There exists j < i and some k such that expi (ω) = z(expj (ω), k).

DMACC John M. Gillespie 126 I ∃m, n < i and j where expi (ω) = sub(expm(ω), expn(ω), j)).

Valid deduction

The natural number ω is the Godel number of a valid deduction if for every i ≤ long(ω) one of the following is true;

I expi (ω) is the Godel number of one of the defining equations. I There exists j < i and some k such that expi (ω) = z(expj (ω), k). I There exists j < i and some k such that expi (ω) = n(expj (ω), k)).

DMACC John M. Gillespie 127 Valid deduction

The natural number ω is the Godel number of a valid deduction if for every i ≤ long(ω) one of the following is true;

I expi (ω) is the Godel number of one of the defining equations. I There exists j < i and some k such that expi (ω) = z(expj (ω), k). I There exists j < i and some k such that expi (ω) = n(expj (ω), k)).

I ∃m, n < i and j where expi (ω) = sub(expm(ω), expn(ω), j)).

DMACC John M. Gillespie 128 I Thus τ1(ω, i) is primitive recursive and, as formulated below, equals zero iff the property holds true. i−· 1 ω Y Y τ1(ω, i) = eq( expi ω, z(expj ω, k)) j=1 k=1

Valid deduction

Let τ1(ω, i) denote the predicate

(∃j∃k)[ (j < i) ∧ (k ≤ ω) ∧ eq(expi ω, z(expj ω, k)) ]

DMACC John M. Gillespie 129 Valid deduction

Let τ1(ω, i) denote the predicate

(∃j∃k)[ (j < i) ∧ (k ≤ ω) ∧ eq(expi ω, z(expj ω, k)) ]

I Thus τ1(ω, i) is primitive recursive and, as formulated below, equals zero iff the property holds true. i−· 1 ω Y Y τ1(ω, i) = eq( expi ω, z(expj ω, k)) j=1 k=1

DMACC John M. Gillespie 130 I Thus τ2(ω, i) is primitive recursive and, as formulated below, equals zero iff the property holds true. i−· 1 ω Y Y τ2(ω, i) = eq( expi ω, n(expj ω, k)) j=1 k=1

Valid deduction

Let τ2(ω, i) denote the predicate

(∃j∃k)[ (j < i) ∧ (k ≤ ω) ∧ eq(expi ω, n(expj ω, k)) ]

DMACC John M. Gillespie 131 Valid deduction

Let τ2(ω, i) denote the predicate

(∃j∃k)[ (j < i) ∧ (k ≤ ω) ∧ eq(expi ω, n(expj ω, k)) ]

I Thus τ2(ω, i) is primitive recursive and, as formulated below, equals zero iff the property holds true. i−· 1 ω Y Y τ2(ω, i) = eq( expi ω, n(expj ω, k)) j=1 k=1

DMACC John M. Gillespie 132 I Thus τ3(ω, i) is primitive recursive and, as formulated below, equals zero iff the property holds true.

i−· 1 i−· 1 long(n) Y Y Y τ3(ω, i) = eq(expi ω, sub(expm ω, expn ω, j)) m=1 n=1 j=1

Valid deduction

Let τ3(ω, i) denote the predicate

(∃m)(∃n)(∃j)[ (m, n < i) ∧ (j ≤ long(n)) ∧ expi ω = sub(expm ω, expn ω, j)]

DMACC John M. Gillespie 133 Valid deduction

Let τ3(ω, i) denote the predicate

(∃m)(∃n)(∃j)[ (m, n < i) ∧ (j ≤ long(n)) ∧ expi ω = sub(expm ω, expn ω, j)]

I Thus τ3(ω, i) is primitive recursive and, as formulated below, equals zero iff the property holds true.

i−· 1 i−· 1 long(n) Y Y Y τ3(ω, i) = eq(expi ω, sub(expm ω, expn ω, j)) m=1 n=1 j=1

DMACC John M. Gillespie 134 The Godel numbers of these expressions have a primitive recursive formula.

1 2 5 7 ζ(0) = p1 and ζ(n + 1) = p1p2 ∗ ζ(n) ∗ p1

Useful formula

The symbol sequence σ0(0) represents the natural number one n n and in general if σ0 (0) then σ0(σ0 (0)) represents n + 1.

DMACC John M. Gillespie 135 1 2 5 7 ζ(0) = p1 and ζ(n + 1) = p1p2 ∗ ζ(n) ∗ p1

Useful formula

The symbol sequence σ0(0) represents the natural number one n n and in general if σ0 (0) then σ0(σ0 (0)) represents n + 1.

The Godel numbers of these expressions have a primitive recursive formula.

DMACC John M. Gillespie 136 Useful formula

The symbol sequence σ0(0) represents the natural number one n n and in general if σ0 (0) then σ0(σ0 (0)) represents n + 1.

The Godel numbers of these expressions have a primitive recursive formula.

1 2 5 7 ζ(0) = p1 and ζ(n + 1) = p1p2 ∗ ζ(n) ∗ p1

DMACC John M. Gillespie 137 2s+9 5 7 3 I Where Φ(a) := p1 p2 ∗ ζ(a1) ∗ ... ∗ ζ(ar ) ∗ p1p2 ∗ ζ(a))

γ(explongω(ω)) Y τ4(a1, ..., ar , ω) = eq(explongω(ω), Φ(a)) a=0

The valid deduction of ϕ(a1, ..., ar )

Let τ4(a1, ..., ar , ω) denote the predicate

(∃a)[ (a < γ(explongω(ω)) ∧ eq(explongω(ω), Φ(a)) ]

DMACC John M. Gillespie 138 The valid deduction of ϕ(a1, ..., ar )

Let τ4(a1, ..., ar , ω) denote the predicate

(∃a)[ (a < γ(explongω(ω)) ∧ eq(explongω(ω), Φ(a)) ]

2s+9 5 7 3 I Where Φ(a) := p1 p2 ∗ ζ(a1) ∗ ... ∗ ζ(ar ) ∗ p1p2 ∗ ζ(a))

γ(explongω(ω)) Y τ4(a1, ..., ar , ω) = eq(explongω(ω), Φ(a)) a=0

DMACC John M. Gillespie 139 I Thus ω is the Godel number of a valid computation of ϕ(~a) iff τ(a1, ..., ar , ω) = 0.

I The function µω[τ(a1, ..., ar , ω) = 0] denotes the unbounded search for a valid computation of ϕ(~a).

PR detection of a valid computation

Let τ(a1, ..., ar , ω) denote the following formula

long(ω) X τ1(ω, i)τ2(ω, i)τ3(ω, i) + τ4(a1, ..., ar , ω) i=1+A

DMACC John M. Gillespie 140 I The function µω[τ(a1, ..., ar , ω) = 0] denotes the unbounded search for a valid computation of ϕ(~a).

PR detection of a valid computation

Let τ(a1, ..., ar , ω) denote the following formula

long(ω) X τ1(ω, i)τ2(ω, i)τ3(ω, i) + τ4(a1, ..., ar , ω) i=1+A

I Thus ω is the Godel number of a valid computation of ϕ(~a) iff τ(a1, ..., ar , ω) = 0.

DMACC John M. Gillespie 141 PR detection of a valid computation

Let τ(a1, ..., ar , ω) denote the following formula

long(ω) X τ1(ω, i)τ2(ω, i)τ3(ω, i) + τ4(a1, ..., ar , ω) i=1+A

I Thus ω is the Godel number of a valid computation of ϕ(~a) iff τ(a1, ..., ar , ω) = 0.

I The function µω[τ(a1, ..., ar , ω) = 0] denotes the unbounded search for a valid computation of ϕ(~a).

DMACC John M. Gillespie 142 Kleene normal form

Let ψ(ω) denote the function

µj [j < γ(explongω(ω)) ∧ ζ(j) = γ(explong(ω)(ω)) ]

Since j < γ(explongω(ω)) the function ψ is primitive recursive and finally we have the normal form below.

ϕ = ψ(µω[τ(a1, ..., ar , ω) = 0])

Thus every GR function can be written as above where ψ is a PR function and τ is a PR predicate on which the Kleene operator acts.

DMACC John M. Gillespie 143