course-of-values recursion

course-of-values recursion

In defining a

function

by

primitive recursion

, the value of the next

argument

f

⁢

(

n

+

1

)

depends only on the value of the

current

argument

f

⁢

(

n

)

. Definition of functions by

course-of-values recursion

,

f

⁢

(

n

+

1

)

depends on value(s) of some or all of the preceding arguments

f

⁢

(

n

)

,

…

,

f

⁢

(

0

)

. Two very basic examples of definition by course-of-values recursion are

1.

(

Fibonacci numbers

).

F

⁢

(

0

)

=

F

⁢

(

1

)

=

1

, and

F

⁢

(

n

+

1

)

=

F

⁢

(

n

)

+

F

⁢

(

n

-

1

)

.

2.

f

⁢

(

0

)

=

1

, and

f

⁢

(

n

+

1

)

=

f

⁢

(

n

)

+

f

⁢

(

n

-

1

)

+

⋯

+

f

⁢

(

0

)

.

In the first example, we may write

F

⁢

(

n

+

1

)

=

g

⁢

(

F

⁢

(

n

)

,

F

⁢

(

n

-

1

)

)

, where

g

is the familiar

addition

function, a function of two arguments. In other words, value of the current argument of

F

depends on the values of a fixed number of preceding arguments (in this case,

2

). In the second example, value of the current argument of

f

depends on the values of all of the values of the preceding arguments. Suppose we write

f

⁢

(

n

+

1

)

=

h

⁢

(

f

⁢

(

n

)

,

…

,

f

⁢

(

0

)

)

, where

h

is the

(

n

+

1

)

-ary addition function. This

h

is different from

g

in the sense that

g

has a fixed arity, whereas the arity of

h

depends on the argument of

f

. In other words, as

n

varies, a “different”

h

is required! Is it possible to define

f

via a fixed function as in the first example? Moreover, what is the

relation

between course-of-values recursion and primitive recursion?

The answer to the first question is yes. To get around the difficulty of “varying arity”, we employ the technique of

encoding

the entire

sequence

of values of the preceding arguments of

f

by a “code number”, and come up with a function

h

that depends on the this code number.

h

then can be used to define

f

.

Pick an encoding of

finite sequences

of non-negative

integers

, preferably a

primitive recursive encoding

. As usual, we set

⟨

a

1

,

…

,

a

m

⟩

as the code, or sequence number of the sequence

a

1

,

…

,

a

m

, and if

x

=

⟨

a

1

,

…

,

a

m

⟩

, we set

(

x

)

i

:=

a

i

if

i

≤

m

, and

0

otherwise.

For this entry, we choose the

multiplicative encoding

of Gödel (see this entry (

http://planetmath.org/ExamplesOfPrimitiveRecursiveEncoding

) for more detail) because of its convenience. Then

⟨

a

1

,

…

,

a

m

⟩

:=

p

1

s

⁢

(

a

1

)

⁢

⋯

⁢

p

m

s

⁢

(

a

m

)

,

where

p

i

is the

i

-th

prime number

, and

⟨

⟩

:=

1

.

Definition

. For any function

f

:

ℕ

k

+

1

→

ℕ

, define the

course-of-values function

f

¯

of

f

as follows:

f

¯

has the same arity as

f

, and for any

𝒙

∈

ℕ

k

,

1.

f

¯

⁢

(

𝒙

,

0

)

:=

⟨

⟩

, and

2.

f

¯

⁢

(

𝒙

,

y

+

1

)

:=

⟨

f

⁢

(

𝒙

,

0

)

,

…

,

f

⁢

(

𝒙

,

y

)

⟩

.

For example, if

F

⁢

(

n

)

is the

n

-th Fibonacci number, then

F

¯

⁢

(

0

)

=

1

,

F

¯

⁢

(

1

)

=

⟨

1

⟩

=

4

, and

F

¯

⁢

(

2

)

=

⟨

4

,

1

⟩

=

2

5

⋅

3

2

=

288

, etc… It is evident that

F

¯

grows very rapidly.

Definition

. A function

f

:

ℕ

k

+

1

→

ℕ

is said to be defined by

course-of-values recursion

via function

h

:

ℕ

k

+

2

→

ℕ

if, for any

𝒙

∈

ℕ

k

:

f

⁢

(

𝒙

,

y

)

=

h

⁢

(

𝒙

,

y

,

f

¯

⁢

(

𝒙

,

y

)

)

.

The two examples above are defined by course-of-values recursion:

•

F

⁢

(

n

)

=

h

⁢

(

n

,

F

¯

⁢

(

n

)

)

, where

h

⁢

(

x

,

y

)

:=

(

y

)

x

+

(

y

)

x

⁢

-

˙

⁢

1

.

•

f

⁢

(

n

)

=

h

⁢

(

n

,

f

¯

⁢

(

n

)

)

, where

h

⁢

(

x

,

y

)

=

∑

i

=

0

x

⁢

-

˙

⁢

1

(

y

)

i

.

The second question posed at the beginning can now be answered:

Proposition 1

.

f

is

primitive recursive

iff

f

¯

is.

Proof.

By definition, and using multiplicative encoding, we have

f

¯

⁢

(

𝒙

,

0

)

:=

⟨

⟩

=

1

, and

f

¯

⁢

(

𝒙

,

y

+

1

)

:=

p

1

f

⁢

(

𝒙

,

0

)

⁢

⋯

⁢

p

y

+

1

f

⁢

(

𝒙

,

y

)

=

f

¯

⁢

(

𝒙

,

y

)

⁢

p

y

+

1

f

⁢

(

𝒙

,

y

)

Thus, if

f

is primitive recursive, so is

f

¯

by primitive recursion.

Conversely

, if

f

¯

is primitive recursive, so is

f

⁢

(

𝒙

,

y

)

=

(

f

¯

⁢

(

𝒙

,

y

+

1

)

)

y

+

1

.
∎

Proposition 2

.

If

h

:

N

k

+

1

→

N

is primitive recursive, so is

f

defined by course-of-values recursion via

h

.

Proof.

From the proof of the

proposition

above, we see that

f

¯

⁢

(

𝒙

,

y

+

1

)

=

f

¯

⁢

(

𝒙

,

y

)

⁢

p

y

+

1

f

⁢

(

𝒙

,

y

)

=

f

¯

⁢

(

𝒙

,

y

)

⁢

p

y

+

1

h

⁢

(

𝒙

,

y

,

f

¯

⁢

(

𝒙

,

y

)

)

.

Thus, as

h

is primitive recursive, so is

f

¯

by primitive recursion, and hence

f

is primitive recursive by the previous proposition.
∎

Remark

. If the value of the next argument of

f

depends on values of a

fixed set

of prior arguments, then the primitive recursiveness of

f

can be proved via

mutual recursion

. For example, suppose

f

⁢

(

k

+

1

)

=

h

⁢

(

f

⁢

(

k

-

1

)

,

f

⁢

(

k

-

3

)

,

f

⁢

(

k

-

4

)

)

. By setting

f

i

⁢

(

n

)

:=

f

⁢

(

n

+

i

)

for

i

=

0

,

1

,

2

,

3

, we see that

f

i

⁢

(

n

+

1

)

=

f

⁢

(

n

+

i

+

1

)

=

f

i

+

1

⁢

(

n

)

for

⁢

i

=

0

,

1

,

2

.

Furthermore,

f

3

⁢

(

n

+

1

)

=

f

0

⁢

(

n

+

4

)

=

f

⁢

(

n

+

4

)

=

h

⁢

(

f

⁢

(

n

+

2

)

,

f

⁢

(

n

+

1

)

,

f

⁢

(

n

)

)

=

h

⁢

(

f

0

⁢

(

n

+

2

)

,

f

0

⁢

(

n

+

1

)

,

f

0

⁢

(

n

)

)

=

h

⁢

(

f

2

⁢

(

n

)

,

f

1

⁢

(

n

)

,

f

0

⁢

(

n

)

)

.

So the

f

i

are defined by mutual recursion, and if

h

is primitive recursive, so is each

f

i

.

Title

course-of-values recursion

Canonical name

CourseofvaluesRecursion

Date of creation

2013-03-22 19:06:13

Last modified on

2013-03-22 19:06:13

Owner

CWoo (3771)

Last modified by

CWoo (3771)

Numerical id

11

Author

CWoo (3771)

Entry type

Definition

Classification

msc 03D20

Synonym

course-of-value

Synonym

course-of-values

Generated on Thu Feb 8 20:02:44 2018 by

LaTeXML