primitive recursion - department of mathematicsorion.math.iastate.edu/jdhsmith/math/jgknf4cf.pdf ·...

143
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

Upload: vannhan

Post on 25-Apr-2018

255 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Primitive recursion

DefinitionGiven 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 builtdirectly into the definition of primitive recursion.

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

DMACC John M. Gillespie 1

Page 2: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Primitive recursion

DefinitionGiven 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 builtdirectly into the definition of primitive recursion.

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

DMACC John M. Gillespie 2

Page 3: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Primitive recursion

DefinitionGiven 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 builtdirectly into the definition of primitive recursion.

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

substitution andprimitive recursion.

DMACC John M. Gillespie 3

Page 4: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Primitive recursion

DefinitionGiven 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 builtdirectly into the definition of primitive recursion.

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

andprimitive recursion.

DMACC John M. Gillespie 4

Page 5: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Primitive recursion

DefinitionGiven 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 builtdirectly into the definition of primitive recursion.

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

DMACC John M. Gillespie 5

Page 6: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Two surprisingly useful functions

We define by primitive recursion sg and s̄g.

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

I s̄g(0) = 1 with s̄g(n + 1) = 0.

I Exponent notation is used e.g. 11sg = 1 and 2s̄g = 0.

DMACC John M. Gillespie 6

Page 7: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Two surprisingly useful functions

We define by primitive recursion sg and s̄g.

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

I s̄g(0) = 1 with s̄g(n + 1) = 0.

I Exponent notation is used e.g. 11sg = 1 and 2s̄g = 0.

DMACC John M. Gillespie 7

Page 8: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 primefactorization of n ∈ N.

3. The residue res(a,n) of a modulo n.

4. Restricted subtraction a ·− b.

DMACC John M. Gillespie 8

Page 9: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 primefactorization of n ∈ N.

3. The residue res(a,n) of a modulo n.

4. Restricted subtraction a ·− b.

DMACC John M. Gillespie 9

Page 10: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 primefactorization of n ∈ N.

3. The residue res(a,n) of a modulo n.

4. Restricted subtraction a ·− b.

DMACC John M. Gillespie 10

Page 11: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 primefactorization of n ∈ N.

3. The residue res(a,n) of a modulo n.

4. Restricted subtraction a ·− b.

DMACC John M. Gillespie 11

Page 12: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Examples

I If we let

S(n) =n∑

i=1

s̄g(res(n, i))

then S(n) yields the number of divisors of n.

I If we let

π(n) =n∑

i=2

s̄g(S(n) ·− 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 12

Page 13: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Examples

I If we let

S(n) =n∑

i=1

s̄g(res(n, i))

then S(n) yields the number of divisors of n.

I If we let

π(n) =n∑

i=2

s̄g(S(n) ·− 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 13

Page 14: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Examples

I If we let

S(n) =n∑

i=1

s̄g(res(n, i))

then S(n) yields the number of divisors of n.

I If we let

π(n) =n∑

i=2

s̄g(S(n) ·− 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 14

Page 15: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Examples

I If we let

S(n) =n∑

i=1

s̄g(res(n, i))

then S(n) yields the number of divisors of n.

I If we let

π(n) =n∑

i=2

s̄g(S(n) ·− 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 15

Page 16: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Examples

I If we let

S(n) =n∑

i=1

s̄g(res(n, i))

then S(n) yields the number of divisors of n.

I If we let

π(n) =n∑

i=2

s̄g(S(n) ·− 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

Page 17: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Bounded search

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

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

Then the smallest n for which τ(a1, ..., ar , n) = 0 is given by theexpression below.

B∑i=0

i∏j=0

τ(~a, j)sg

= τ(~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 17

Page 18: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Bounded search

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

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

Then the smallest n for which τ(a1, ..., ar , n) = 0 is given by theexpression below.

B∑i=0

i∏j=0

τ(~a, j)sg

= τ(~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 18

Page 19: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Bounded search

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

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

Then the smallest n for which τ(a1, ..., ar , n) = 0 is given by theexpression below.

B∑i=0

i∏j=0

τ(~a, j)sg

= τ(~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

Page 20: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Bounded search

The following notation is fairly standard.

µj [τ(~a, j) = 0] =B∑i=0

i∏j=0

τ(~a, j)sg

I The bound B is specific to the function τ .

I For example the nth prime pn satisfies pn < 22n .

I This provides the bound B = 22n .

DMACC John M. Gillespie 20

Page 21: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Bounded search

The following notation is fairly standard.

µj [τ(~a, j) = 0] =B∑i=0

i∏j=0

τ(~a, j)sg

I The bound B is specific to the function τ .

I For example the nth prime pn satisfies pn < 22n .

I This provides the bound B = 22n .

DMACC John M. Gillespie 21

Page 22: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Bounded search

The following notation is fairly standard.

µj [τ(~a, j) = 0] =B∑i=0

i∏j=0

τ(~a, j)sg

I The bound B is specific to the function τ .

I For example the nth prime pn satisfies pn < 22n .

I This provides the bound B = 22n .

DMACC John M. Gillespie 22

Page 23: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Bounded search

The following notation is fairly standard.

µj [τ(~a, j) = 0] =B∑i=0

i∏j=0

τ(~a, j)sg

I The bound B is specific to the function τ .

I For example the nth prime pn satisfies pn < 22n .

I This provides the bound B = 22n .

DMACC John M. Gillespie 23

Page 24: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

The length of n ∈ N

Consider the problem of finding the index l of the largest primedividing 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 24

Page 25: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

The length of n ∈ N

Consider the problem of finding the index l of the largest primedividing 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 25

Page 26: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

The length of n ∈ N

Consider the problem of finding the index l of the largest primedividing 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

Page 27: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

The length of n ∈ N

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

long(n) =n∑

k=0

k∏j=0

sg

n∑l=j+1

expl(n)

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 27

Page 28: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

The length of n ∈ N

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

long(n) =n∑

k=0

k∏j=0

sg

n∑l=j+1

expl(n)

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 28

Page 29: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

The length of n ∈ N

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

long(n) =n∑

k=0

k∏j=0

sg

n∑l=j+1

expl(n)

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

Page 30: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Other forms of recursion

Course-of-values recursion

DefinitionGiven a binary function β and any a ∈ N define ϕ as follows;

ϕ(0) = a and ϕ(n + 1) = β(n∏

i=0

pϕ(i)i , n).

We can prove that such a definition yields a primitive recursivefunction.

DMACC John M. Gillespie 30

Page 31: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Course-of-values recursion

Definition of ϕ

ϕ(0) = a and ϕ(n + 1) = β(n∏

i=0

pϕ(i)i , n)

Define a function ψ(n) =∏n

i=0 pϕ(n)i . Then ψ(0) = 2a and

ψ(n + 1) = ψ(n) · pϕ(n+1)n+1

= ψ(n) · pβ(ψ(n),n)n+1

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

DMACC John M. Gillespie 31

Page 32: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Course-of-values recursion

Definition of ϕ

ϕ(0) = a and ϕ(n + 1) = β(n∏

i=0

pϕ(i)i , n)

Define a function ψ(n) =∏n

i=0 pϕ(n)i . Then ψ(0) = 2a and

ψ(n + 1) = ψ(n) · pϕ(n+1)n+1

= ψ(n) · pβ(ψ(n),n)n+1

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

DMACC John M. Gillespie 32

Page 33: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Course-of-values recursion

Definition of ϕ

ϕ(0) = a and ϕ(n + 1) = β(n∏

i=0

pϕ(i)i , n)

Define a function ψ(n) =∏n

i=0 pϕ(n)i . Then ψ(0) = 2a and

ψ(n + 1) = ψ(n) · pϕ(n+1)n+1

= ψ(n) · pβ(ψ(n),n)n+1

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

DMACC John M. Gillespie 33

Page 34: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Course-of-values recursion

Definition of ϕ

ϕ(0) = a and ϕ(n + 1) = β(n∏

i=0

pϕ(i)i , n)

Define a function ψ(n) =∏n

i=0 pϕ(n)i . Then ψ(0) = 2a and

ψ(n + 1) = ψ(n) · pϕ(n+1)n+1

= ψ(n) · pβ(ψ(n),n)n+1

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

DMACC John M. Gillespie 34

Page 35: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Another form of recursion

Simultaneous recursion

DefinitionGiven 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 recursivefunctins σ1 and σ2.

DMACC John M. Gillespie 35

Page 36: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Another form of recursion

Simultaneous recursion

DefinitionGiven 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 recursivefunctins σ1 and σ2.

DMACC John M. Gillespie 36

Page 37: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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)).

Define a function ψ(n) = pσ1(n)1 ·pσ2(n)

2 . So then ψ(0) = pa1 ·pb2 and

ψ(n + 1) = pσ1(n+1)1 · pσ2(n+1)

2

= pβ1(σ1(n),σ2(n))1 · pβ2(σ1(n),σ2(n)

2

= pβ1(exp1 ψ(n),exp2 ψ(n))1 · pβ2(exp1 ψ(n),exp2 ψ(n))

2

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

DMACC John M. Gillespie 37

Page 38: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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)).

Define a function ψ(n) = pσ1(n)1 ·pσ2(n)

2 . So then ψ(0) = pa1 ·pb2 and

ψ(n + 1) = pσ1(n+1)1 · pσ2(n+1)

2

= pβ1(σ1(n),σ2(n))1 · pβ2(σ1(n),σ2(n)

2

= pβ1(exp1 ψ(n),exp2 ψ(n))1 · pβ2(exp1 ψ(n),exp2 ψ(n))

2

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

DMACC John M. Gillespie 38

Page 39: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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)).

Define a function ψ(n) = pσ1(n)1 ·pσ2(n)

2 . So then ψ(0) = pa1 ·pb2 and

ψ(n + 1) = pσ1(n+1)1 · pσ2(n+1)

2

= pβ1(σ1(n),σ2(n))1 · pβ2(σ1(n),σ2(n)

2

= pβ1(exp1 ψ(n),exp2 ψ(n))1 · pβ2(exp1 ψ(n),exp2 ψ(n))

2

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

DMACC John M. Gillespie 39

Page 40: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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)).

Define a function ψ(n) = pσ1(n)1 ·pσ2(n)

2 . So then ψ(0) = pa1 ·pb2 and

ψ(n + 1) = pσ1(n+1)1 · pσ2(n+1)

2

= pβ1(σ1(n),σ2(n))1 · pβ2(σ1(n),σ2(n)

2

= pβ1(exp1 ψ(n),exp2 ψ(n))1 · pβ2(exp1 ψ(n),exp2 ψ(n))

2

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

DMACC John M. Gillespie 40

Page 41: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 multiplevariables then your function may no longer be PR.

DMACC John M. Gillespie 41

Page 42: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 multiplevariables then your function may no longer be PR.

DMACC John M. Gillespie 42

Page 43: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 multiplevariables then your function may no longer be PR.

DMACC John M. Gillespie 43

Page 44: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

General recursive functions

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

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

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

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

I In general the problem is undecidable.

DMACC John M. Gillespie 44

Page 45: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

General recursive functions

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

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

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

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

I In general the problem is undecidable.

DMACC John M. Gillespie 45

Page 46: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

General recursive functions

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

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

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

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

I In general the problem is undecidable.

DMACC John M. Gillespie 46

Page 47: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

General recursive functions

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

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

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

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

I In general the problem is undecidable.

DMACC John M. Gillespie 47

Page 48: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

General recursive functions

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

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

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

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

I In general the problem is undecidable.

DMACC John M. Gillespie 48

Page 49: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

General recursive functions

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

The index of the function being defined σs and the number Aof 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 49

Page 50: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

General recursive functions

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

The index of the function being defined σs and the number Aof 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 50

Page 51: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

General recursive functions

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

The index of the function being defined σs and the number Aof 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 51

Page 52: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

General recursive functions

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

The index of the function being defined σs and the number Aof 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

Page 53: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 53

Page 54: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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

Page 55: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 55

Page 56: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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

Page 57: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

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

Deductions

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.

DMACC John M. Gillespie 57

Page 58: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

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

Deductions

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.

DMACC John M. Gillespie 58

Page 59: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

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

Deductions

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.

DMACC John M. Gillespie 59

Page 60: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

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

Deductions

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.

DMACC John M. Gillespie 60

Page 61: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

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

Deductions

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.

DMACC John M. Gillespie 61

Page 62: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

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

Deductions

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.

DMACC John M. Gillespie 62

Page 63: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

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

Deductions

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.

DMACC John M. Gillespie 63

Page 64: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 intoequation j at the kth position.

DMACC John M. Gillespie 64

Page 65: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 intoequation j at the kth position.

DMACC John M. Gillespie 65

Page 66: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 intoequation j at the kth position.

DMACC John M. Gillespie 66

Page 67: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

σ1(0, x2) = x2 (1)σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (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 67

Page 68: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

σ1(0, x2) = x2 (1)σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (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 68

Page 69: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

σ1(0, x2) = x2 (1)σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (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 69

Page 70: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

σ1(0, x2) = x2 (1)σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (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 70

Page 71: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

σ1(0, x2) = x2 (1)σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (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 71

Page 72: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

σ1(0, x2) = x2 (1)σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (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 72

Page 73: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

σ1(0, x2) = x2 (1)σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (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 73

Page 74: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

σ1(0, x2) = x2 (1)σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (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 74

Page 75: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Computations as deductions

Axioms

σ1(0, x2) = x2 (1)σ1(σ0(x1), x2) = σ0(σ1(x1, x2)) (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

Page 76: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Key component of the Kleene normal form

The Kleene operator

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

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

This is the unbounded search.

limB→∞

B∑i=0

i∏j=0

τ(~a, j)sg

We will use this Kleene operator later to search throughcomputations.

DMACC John M. Gillespie 76

Page 77: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Key component of the Kleene normal form

The Kleene operator

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

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

This is the unbounded search.

limB→∞

B∑i=0

i∏j=0

τ(~a, j)sg

We will use this Kleene operator later to search throughcomputations.

DMACC John M. Gillespie 77

Page 78: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Key component of the Kleene normal form

The Kleene operator

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

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

This is the unbounded search.

limB→∞

B∑i=0

i∏j=0

τ(~a, j)sg

We will use this Kleene operator later to search throughcomputations.

DMACC John M. Gillespie 78

Page 79: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Key component of the Kleene normal form

The Kleene operator

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

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

This is the unbounded search.

limB→∞

B∑i=0

i∏j=0

τ(~a, j)sg

We will use this Kleene operator later to search throughcomputations.

DMACC John M. Gillespie 79

Page 80: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

The Kleene operator as a general recursive function

Suppose a function τ(a1, ..., ar , n) is already given. We define anew 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 80

Page 81: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

The Kleene operator as a general recursive function

Suppose a function τ(a1, ..., ar , n) is already given. We define anew 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

Page 82: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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

ϕ = ψ(µ[τ ])

where µ is the Kleene operator and ψ and τ are primitiverecursive.

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 theKleene operator this yields the class of all computablefunctions.

DMACC John M. Gillespie 82

Page 83: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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

ϕ = ψ(µ[τ ])

where µ is the Kleene operator and ψ and τ are primitiverecursive.

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 theKleene operator this yields the class of all computablefunctions.

DMACC John M. Gillespie 83

Page 84: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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

ϕ = ψ(µ[τ ])

where µ is the Kleene operator and ψ and τ are primitiverecursive.

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 theKleene operator this yields the class of all computablefunctions.

DMACC John M. Gillespie 84

Page 85: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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

ϕ = ψ(µ[τ ])

where µ is the Kleene operator and ψ and τ are primitiverecursive.

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 theKleene operator this yields the class of all computablefunctions.

DMACC John M. Gillespie 85

Page 86: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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, 9xn 2n + 9, n = 1, 2, ...

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

DMACC John M. Gillespie 86

Page 87: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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, 9xn 2n + 9, n = 1, 2, ...

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

Furthermore we can hone in on those computations which areactually correct.

DMACC John M. Gillespie 87

Page 88: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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, 9xn 2n + 9, n = 1, 2, ...

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

DMACC John M. Gillespie 88

Page 89: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

More on Godel numbers

Some examples of symbol sequences and their Godel numbers.

Example

1. σ0(0) has Godel number p21p

52p

13p

74

2. σ0(σ0(0)) has Godel number p21p

52p

23p

54p

15p

76p

77

3. σ2(x1) = x1 has Godel number p41p

52p

113 p7

4p35p

116

4. σ0(xi ) has Godel number p21p

52p

2i+93 p7

4

DMACC John M. Gillespie 89

Page 90: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

More on Godel numbers

Some examples of symbol sequences and their Godel numbers.

Example

1. σ0(0) has Godel number p21p

52p

13p

74

2. σ0(σ0(0)) has Godel number p21p

52p

23p

54p

15p

76p

77

3. σ2(x1) = x1 has Godel number p41p

52p

113 p7

4p35p

116

4. σ0(xi ) has Godel number p21p

52p

2i+93 p7

4

DMACC John M. Gillespie 90

Page 91: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

More on Godel numbers

Some examples of symbol sequences and their Godel numbers.

Example

1. σ0(0) has Godel number p21p

52p

13p

74

2. σ0(σ0(0)) has Godel number p21p

52p

23p

54p

15p

76p

77

3. σ2(x1) = x1 has Godel number p41p

52p

113 p7

4p35p

116

4. σ0(xi ) has Godel number p21p

52p

2i+93 p7

4

DMACC John M. Gillespie 91

Page 92: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

More on Godel numbers

Some examples of symbol sequences and their Godel numbers.

Example

1. σ0(0) has Godel number p21p

52p

13p

74

2. σ0(σ0(0)) has Godel number p21p

52p

23p

54p

15p

76p

77

3. σ2(x1) = x1 has Godel number p41p

52p

113 p7

4p35p

116

4. σ0(xi ) has Godel number p21p

52p

2i+93 p7

4

DMACC John M. Gillespie 92

Page 93: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Godel numbering a computation

This is the first example computation.

Axioms

{q1 := p4

1p52p

13p

94p

135 p7

6p37p

138

. . .

Deductions

q3 := p4

1p52 . . . p

1313p

714

...q7 := p4

1p52 . . . p

719p

720

The entire computation is encoded in the Godel numberpq1

1 pq22 . . . pq7

7 .

DMACC John M. Gillespie 93

Page 94: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Basic strategy

I Every computation is assigned a Godel number pe11 pe2

2 . . . pell .

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 fromprevious equations.

I We require functions which can detect such deductions.

DMACC John M. Gillespie 94

Page 95: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Basic strategy

I Every computation is assigned a Godel number pe11 pe2

2 . . . pell .

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 fromprevious equations.

I We require functions which can detect such deductions.

DMACC John M. Gillespie 95

Page 96: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Basic strategy

I Every computation is assigned a Godel number pe11 pe2

2 . . . pell .

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 fromprevious equations.

I We require functions which can detect such deductions.

DMACC John M. Gillespie 96

Page 97: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Basic strategy

I Every computation is assigned a Godel number pe11 pe2

2 . . . pell .

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 fromprevious equations.

I We require functions which can detect such deductions.

DMACC John M. Gillespie 97

Page 98: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Basic strategy

I Every computation is assigned a Godel number pe11 pe2

2 . . . pell .

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 fromprevious equations.

I We require functions which can detect such deductions.

DMACC John M. Gillespie 98

Page 99: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Basic strategy

I Every computation is assigned a Godel number pe11 pe2

2 . . . pell .

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 fromprevious equations.

I We require functions which can detect such deductions.

DMACC John M. Gillespie 99

Page 100: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 thecomputation ω.

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 theith equation of ω is some proper deduction.

DMACC John M. Gillespie 100

Page 101: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 thecomputation ω.

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 theith equation of ω is some proper deduction.

DMACC John M. Gillespie 101

Page 102: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 thecomputation ω.

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 theith equation of ω is some proper deduction.

DMACC John M. Gillespie 102

Page 103: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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 thecomputation ω.

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 theith equation of ω is some proper deduction.

DMACC John M. Gillespie 103

Page 104: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Admissable deduction step z

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

z(e, i) =

long(e)∏j=1

pj

1 if expj(e) = 2i + 9expj(e) else

This function is primitive recursive.

DMACC John M. Gillespie 104

Page 105: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Admissable deduction step z

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

z(e, i) =

long(e)∏j=1

pj

1 if expj(e) = 2i + 9expj(e) else

This function is primitive recursive.

DMACC John M. Gillespie 105

Page 106: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Admissable deduction step z

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

z(e, i) =

long(e)∏j=1

pj

1 if expj(e) = 2i + 9expj(e) else

This function is primitive recursive.

DMACC John M. Gillespie 106

Page 107: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Admissable deduction step n

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

n(e, i) =

long(e)⊗j=1

{q if expj(e) = 2i + 9

pexpj(e)1 else

}

This function is primitive recursive. What is q?

DMACC John M. Gillespie 107

Page 108: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Admissable deduction step n

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

n(e, i) =

long(e)⊗j=1

{q if expj(e) = 2i + 9

pexpj(e)1 else

}

This function is primitive recursive. What is q?

DMACC John M. Gillespie 108

Page 109: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Admissable deduction step n

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

n(e, i) =

long(e)⊗j=1

{q if expj(e) = 2i + 9

pexpj(e)1 else

}

This function is primitive recursive.

What is q?

DMACC John M. Gillespie 109

Page 110: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Admissable deduction step n

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

n(e, i) =

long(e)⊗j=1

{q if expj(e) = 2i + 9

pexpj(e)1 else

}

This function is primitive recursive. What is q?

DMACC John M. Gillespie 110

Page 111: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Useful formulas

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

eq(m) = µj[j ≤ long(m) ∧ expj(m) = 3]

Bounded search =⇒ PR.

eq(m) = 1 +

long(m)∑i=1

i∏j=1

sg(sg(expj(m) ·− 3) + sg(3 ·− expj(m))

)

DMACC John M. Gillespie 111

Page 112: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Useful formulas

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

eq(m) = µj[j ≤ long(m) ∧ expj(m) = 3]

Bounded search =⇒ PR.

eq(m) = 1 +

long(m)∑i=1

i∏j=1

sg(sg(expj(m) ·− 3) + sg(3 ·− expj(m))

)

DMACC John M. Gillespie 112

Page 113: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Useful formulas

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

β(m) =

eq(m) ·−1∏j=1

pexpj (m)

j

DMACC John M. Gillespie 113

Page 114: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Useful formulas

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

γ(m) =

long(m) ·−eq(m)∏j=1

pexpj+eq(m)(m)

j

DMACC John M. Gillespie 114

Page 115: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Does a given equation contain some term?

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

long(β(m))∑i=1

sg( expi+j(n) ·− expi β(m) ) + sg( expi β(m) ·− expi+j(n) )

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

I So β(m, n, j) = 0 iff the expression for n contains theexpression 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 115

Page 116: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Does a given equation contain some term?

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

long(β(m))∑i=1

sg( expi+j(n) ·− expi β(m) ) + sg( expi β(m) ·− expi+j(n) )

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

I So β(m, n, j) = 0 iff the expression for n contains theexpression 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 116

Page 117: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Does a given equation contain some term?

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

long(β(m))∑i=1

sg( expi+j(n) ·− expi β(m) ) + sg( expi β(m) ·− expi+j(n) )

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

I So β(m, n, j) = 0 iff the expression for n contains theexpression 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 117

Page 118: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Does a given equation contain some term?

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

long(β(m))∑i=1

sg( expi+j(n) ·− expi β(m) ) + sg( expi β(m) ·− expi+j(n) )

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

I So β(m, n, j) = 0 iff the expression for n contains theexpression 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

Page 119: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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))∑i=1

sg( expi+j(n) ·− expi β(m) ) + sg( expi β(m) ·− expi+j(n) )

simplifies to

β(m, n, j) =

long(β(m))∑i=1

eq(expi+j(n), expi β(m)).

DMACC John M. Gillespie 119

Page 120: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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))∑i=1

sg( expi+j(n) ·− expi β(m) ) + sg( expi β(m) ·− expi+j(n) )

simplifies to

β(m, n, j) =

long(β(m))∑i=1

eq(expi+j(n), expi β(m)).

DMACC John M. Gillespie 120

Page 121: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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))∑i=1

sg( expi+j(n) ·− expi β(m) ) + sg( expi β(m) ·− expi+j(n) )

simplifies to

β(m, n, j) =

long(β(m))∑i=1

eq(expi+j(n), expi β(m)).

DMACC John M. Gillespie 121

Page 122: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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))∑i=1

sg( expi+j(n) ·− expi β(m) ) + sg( expi β(m) ·− expi+j(n) )

simplifies to

β(m, n, j) =

long(β(m))∑i=1

eq(expi+j(n), expi β(m)).

DMACC John M. Gillespie 122

Page 123: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Admissable deduction step sub

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

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

sub(m, n, j) =

j∏i=1

pexpi (n)i ∗ γ(m) ∗

long(n) ·−(j+longβ(m))∏i=1

pexpj+longβ(m)+i(n)

i

otherwise sub(m, n, j) = n.

This is a primitive recursive function.

DMACC John M. Gillespie 123

Page 124: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Admissable deduction step sub

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

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

sub(m, n, j) =

j∏i=1

pexpi (n)i ∗ γ(m) ∗

long(n) ·−(j+longβ(m))∏i=1

pexpj+longβ(m)+i(n)

i

otherwise sub(m, n, j) = n.

This is a primitive recursive function.

DMACC John M. Gillespie 124

Page 125: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Valid deduction

The natural number ω is the Godel number of a valid deduction iffor 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 thatexpi (ω) = z(expj(ω), k).

I There exists j < i and some k such thatexpi (ω) = n(expj(ω), k)).

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

DMACC John M. Gillespie 125

Page 126: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Valid deduction

The natural number ω is the Godel number of a valid deduction iffor 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 thatexpi (ω) = z(expj(ω), k).

I There exists j < i and some k such thatexpi (ω) = n(expj(ω), k)).

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

DMACC John M. Gillespie 126

Page 127: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Valid deduction

The natural number ω is the Godel number of a valid deduction iffor 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 thatexpi (ω) = z(expj(ω), k).

I There exists j < i and some k such thatexpi (ω) = n(expj(ω), k)).

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

DMACC John M. Gillespie 127

Page 128: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Valid deduction

The natural number ω is the Godel number of a valid deduction iffor 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 thatexpi (ω) = z(expj(ω), k).

I There exists j < i and some k such thatexpi (ω) = n(expj(ω), k)).

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

DMACC John M. Gillespie 128

Page 129: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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.

τ1(ω, i) =i ·−1∏j=1

ω∏k=1

eq( expi ω, z(expj ω, k) )

DMACC John M. Gillespie 129

Page 130: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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.

τ1(ω, i) =i ·−1∏j=1

ω∏k=1

eq( expi ω, z(expj ω, k) )

DMACC John M. Gillespie 130

Page 131: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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.

τ2(ω, i) =i ·−1∏j=1

ω∏k=1

eq( expi ω,n(expj ω, k) )

DMACC John M. Gillespie 131

Page 132: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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.

τ2(ω, i) =i ·−1∏j=1

ω∏k=1

eq( expi ω,n(expj ω, k) )

DMACC John M. Gillespie 132

Page 133: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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.

τ3(ω, i) =i ·−1∏m=1

i ·−1∏n=1

long(n)∏j=1

eq(expi ω, sub(expm ω, expn ω, j))

DMACC John M. Gillespie 133

Page 134: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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.

τ3(ω, i) =i ·−1∏m=1

i ·−1∏n=1

long(n)∏j=1

eq(expi ω, sub(expm ω, expn ω, j))

DMACC John M. Gillespie 134

Page 135: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Useful formula

The symbol sequence σ0(0) represents the natural number oneand in general if σn

0 (0) then σ0(σn0 (0)) represents n + 1.

The Godel numbers of these expressions have a primitiverecursive formula.

ζ(0) = p11 and ζ(n + 1) = p2

1p52 ∗ ζ(n) ∗ p7

1

DMACC John M. Gillespie 135

Page 136: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Useful formula

The symbol sequence σ0(0) represents the natural number oneand in general if σn

0 (0) then σ0(σn0 (0)) represents n + 1.

The Godel numbers of these expressions have a primitiverecursive formula.

ζ(0) = p11 and ζ(n + 1) = p2

1p52 ∗ ζ(n) ∗ p7

1

DMACC John M. Gillespie 136

Page 137: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Useful formula

The symbol sequence σ0(0) represents the natural number oneand in general if σn

0 (0) then σ0(σn0 (0)) represents n + 1.

The Godel numbers of these expressions have a primitiverecursive formula.

ζ(0) = p11 and ζ(n + 1) = p2

1p52 ∗ ζ(n) ∗ p7

1

DMACC John M. Gillespie 137

Page 138: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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

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

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

I Where Φ(a) := p2s+91 p5

2 ∗ ζ(a1) ∗ . . . ∗ ζ(ar ) ∗ p71p

32 ∗ ζ(a))

τ4(a1, ..., ar , ω) =

γ(explongω(ω))∏a=0

eq(explongω(ω),Φ(a))

DMACC John M. Gillespie 138

Page 139: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

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

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

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

I Where Φ(a) := p2s+91 p5

2 ∗ ζ(a1) ∗ . . . ∗ ζ(ar ) ∗ p71p

32 ∗ ζ(a))

τ4(a1, ..., ar , ω) =

γ(explongω(ω))∏a=0

eq(explongω(ω),Φ(a))

DMACC John M. Gillespie 139

Page 140: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

PR detection of a valid computation

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

long(ω)∑i=1+A

τ1(ω, i)τ2(ω, i)τ3(ω, i) + τ4(a1, ..., ar , ω)

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

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

DMACC John M. Gillespie 140

Page 141: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

PR detection of a valid computation

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

long(ω)∑i=1+A

τ1(ω, i)τ2(ω, i)τ3(ω, i) + τ4(a1, ..., ar , ω)

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

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

DMACC John M. Gillespie 141

Page 142: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

PR detection of a valid computation

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

long(ω)∑i=1+A

τ1(ω, i)τ2(ω, i)τ3(ω, i) + τ4(a1, ..., ar , ω)

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

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

DMACC John M. Gillespie 142

Page 143: Primitive recursion - Department of Mathematicsorion.math.iastate.edu/jdhsmith/math/JGKNF4CF.pdf · General recursive functions General recursive functions are de ned in terms of

Kleene normal form

Let ψ(ω) denote the function

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

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

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

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

DMACC John M. Gillespie 143