combining URMs

combining URMs

Combining URMs

The basic idea of combining existing URMs is to produce URMs that can perform more complicated

computations

. Suppose we are given two URMs

M

=

I

1

,

…

,

I

m

and

N

=

I

1

′

,

…

,

I

n

′

, define

M

,

N

to be the URM

M

,

N

:=

I

1

,

I

2

,

…

,

I

m

+

n

where

I

m

+

i

=

I

i

′

, where

i

∈

{

1

,

…

,

n

}

. In other words, the instructions of

N

are re-indexed and appended to the last instruction of

M

.

In theory, we would like

M

,

N

to first go through the instructions of

M

, and if the computations of

M

terminate, go through the computations of

N

. In order to achieve this goal, modifications to

M

and

N

need to be made so computations of

M

are kept apart from the computations of

N

:

1.

If

I

k

=

J

⁢

(

i

,

j

,

q

)

is in

N

, then change

I

k

to

J

⁢

(

i

,

j

,

q

+

m

)

. This is clearly necessary as the indices of the instructions of

N

have been shifted by

m

. Let the modified

N

be denoted by

N

⁢

(

m

)

.

2.

If

I

k

=

J

⁢

(

i

,

j

,

p

)

is in

M

, and

p

>

m

, then change

I

k

to

J

⁢

(

i

,

j

,

m

+

1

)

. The purpose of this change is to ensure that computations of

M

do not accidentally jump to an instruction of

N

. Furthermore, when

M

halts,

N

starts. Call this modified

machine

M

′

. It is easy to see that every

M

can be modified to

M

′

.

When

M

computes a

function

f

:

ℕ

n

→

ℕ

and

N

computes a function

g

:

ℕ

→

ℕ

, we would further want the combined machine to compute

g

∘

f

. In essence, if

r

is an input, and if

f

⁢

(

r

)

is computed by

M

, we want

f

⁢

(

r

)

to be the input of the machine

N

, so that

g

⁢

(

f

⁢

(

r

)

)

may be computed. To get the desired result, one more modification should be made:

3.

Suppose

M

computes

f

:

ℕ

n

→

ℕ

. Define

k

=

max

⁡

(

n

,

ρ

⁢

(

M

)

)

. Then

M

*

is defined as the URM

M

′

,

Z

⁢

[

k

]

, where

M

′

is defined in 2. above, and

Z

⁢

[

k

]

is the machine with instructions

Z

⁢

(

2

)

,

Z

⁢

(

3

)

,

⋯

,

Z

⁢

(

k

)

.

In other words, whenever

f

⁢

(

r

)

is computed by

M

,

M

*

resets the

contents

of all registers potentially used by

M

to

0

, except the first one, which contains the result

f

⁢

(

r

)

. As a result, the input for

N

has

0

in all but possibly the first register.

With the three modifications above, let us define

M

∘

N

to be the machine

M

*

,

N

⁢

(

|

M

|

)

. It is easy to see that

∘

is an

associative

operation

. We can summarize our discussion above into the following:

Proposition 1

.

Let

M

,

N

be URMs that compute

f

:

N

n

→

N

and

g

:

N

→

N

respectively, then

M

∘

N

computes

g

∘

f

. In other words, if

f

and

g

are

URM computable

, so is

g

∘

f

.

For example, if

M

computes

f

⁢

(

r

,

s

)

:=

r

+

s

for any

r

,

s

∈

ℕ

, and

N

computes

g

⁢

(

r

)

:=

r

⁢

-

˙

⁢

1

for any

r

∈

ℕ

, then

M

∘

N

computes

(

g

∘

f

)

⁢

(

r

,

s

)

=

(

r

+

s

)

⁢

-

˙

⁢

1

. In

addition

, with input

r

, the URM

N

∘

N

∘

⋯

∘

N

⏟

s

computes

g

s

⁢

(

r

)

:=

r

⁢

-

˙

⁢

s

. Note that

g

s

is unary, and therefore not the same as the

binary operation

h

⁢

(

r

,

s

)

:=

r

⁢

-

˙

⁢

s

. To construct a URM computing

h

using the URM

N

, the method described above does not work, and a more general construction is needed.

URM as a Subroutine

Another way of generating URMs from existing ones is by inserting the existing URMs, so called subroutines, as part of a larger URM. Given a URM

M

=

I

1

,

…

,

I

m

, a

subroutine

of

M

is defined as a block of consecutive instructions in

M

. Based on this definition, we see that combining machines can be seen as a special case: the URMs

M

and

N

are subroutines of the URM

M

,

N

. In fact, each instruction in a URM can be considered as a subroutine.

As in the case with combining two URMs, when inserting a URM as a subroutine in a larger URM, one would like to keep the computations done within the subroutine isolated from the remaining computations. Since only one tape is allowed, one can allocate a portion of the tape reserved only for subroutine computations, another portion for storage, while the rest for computations by the main

program

. This can be done as follows:

4.

For any URM

N

, define

ρ

*

⁢

(

N

)

:=

max

⁡

(

ρ

⁢

(

N

)

,

n

⁢

(

N

)

)

, where

ρ

⁢

(

N

)

is the number of registers used for computations by

N

, and

n

⁢

(

N

)

is the arity of the function computed by

N

.

5.

Suppose

N

1

,

…

,

N

k

are to be inserted as subroutines in a program

M

, define

n

:=

max

⁡

{

ρ

*

⁢

(

N

i

)

∣

i

=

1

,

…

,

k

}

.

Allocate the first

n

registers for computations by the subroutines

N

i

.

6.

Allocate the next

n

*

registers for storage, where

n

*

=

n

1

+

⋯

+

n

k

.

7.

For any URM

N

, and any positive integers

R

1

,

…

,

R

s

,

R

t

, define the following URM:

N

⁢

[

R

1

,

…

,

R

s

;

R

t

]

:=

T

⁢

(

R

1

,

1

)

,

T

⁢

(

R

2

,

2

)

,

…

,

T

⁢

(

R

s

,

s

)

,

N

,

T

⁢

(

1

,

R

t

)

,

Z

⁢

(

1

)

,

…

,

Z

⁢

(

k

)

,

where

k

=

ρ

*

⁢

(

N

)

.

8.

Computations of by the remaining instructions of

M

will take place in registers

n

+

n

*

+

1

or beyond.

9.

For each

N

i

to be inserted, insert

N

⁢

[

R

1

,

…

,

R

s

;

R

t

]

instead, where each

R

j

is determined by the computations done by instructions just prior to the point of

insertion

.

The above only serves as a guideline, not a definite rule to follow. The following example serves as an illustration: let

N

1

,

…

,

N

k

be URMs that compute

m

-ary functions

f

1

,

…

,

f

k

, and let

M

be a URM that computes a

k

-ary function

g

. Define an

m

-ary function

h

:

ℕ

m

→

ℕ

as the

composition

of the

f

’s and

g

:

h

⁢

(

r

1

,

…

,

r

m

)

:=

g

⁢

(

f

1

⁢

(

r

1

,

…

,

r

m

)

,

…

,

f

k

⁢

(

r

1

,

…

,

r

m

)

)

,

provided, of course, that the

right hand side

is defined. We show that

h

is URM-computable by finding a suitable URM

P

that computes

h

:

1.

Given input

r

occupying the first

n

registers, first copy contents of the input to the storage area by the following instructions:

P

1

:=

T

⁢

(

1

,

n

+

1

)

,

T

⁢

(

2

,

n

+

2

)

,

…

,

T

⁢

(

m

,

n

+

m

)

2.

Insert programs

P

2

:=

N

1

⁢

[

n

+

1

,

…

,

n

+

m

;

n

+

m

+

1

]

,

…

,

N

k

⁢

[

n

+

1

,

…

,

n

+

m

;

n

+

m

+

k

]

This has the effect of computing

f

1

⁢

(

r

1

,

…

,

r

m

)

,

…

,

f

k

⁢

(

r

1

,

…

,

r

m

)

, and putting the results in registers

n

+

m

+

1

,

n

+

m

+

2

,

…

,

n

+

m

+

k

.

3.

Insert the program

P

3

:=

M

⁢

[

n

+

m

+

1

,

…

,

n

+

m

+

k

;

1

]

so the results are copied to the first

k

registers, and

g

⁢

(

f

1

⁢

(

r

1

,

…

,

r

m

)

,

…

,

f

k

⁢

(

r

1

,

…

,

r

m

)

)

is computed.

4.

Then

P

:=

P

1

,

P

2

,

P

3

computes

h

.

Note that

r

∈

dom

⁡

(

h

)

iff

N

1

(

r

)

↓

,

…

,

N

k

(

r

)

↓

and

M

⁢

(

f

1

⁢

(

r

1

,

…

,

r

m

)

,

…

,

f

k

⁢

(

r

1

,

…

,

r

m

)

)

↓

.

What we have shown above is summarized as follows:

Proposition 2

.

If

m

-ary functions

f

1

,

…

,

f

k

and a

k

-ary function

g

are URM-computable, then so is

g

⁢

(

f

1

,

…

,

f

k

)

.

As a corollary, the following function is URM-computable:

Corollary 1

.

If

f

⁢

(

x

1

,

…

,

x

n

)

is URM-computable, so is

f

⁢

(

x

σ

⁢

(

1

)

,

…

,

x

σ

⁢

(

n

)

)

, where

σ

is a

permutation

on

{

1

,

…

,

n

}

.

Proof.

For each

i

∈

{

1

,

…

,

n

}

, the function

g

i

⁢

(

x

1

,

…

,

x

n

)

=

x

σ

⁢

(

i

)

is computed by

T

⁢

(

σ

⁢

(

i

)

,

1

)

, and

f

⁢

(

x

σ

⁢

(

1

)

,

…

,

x

σ

⁢

(

n

)

)

=

f

⁢

(

g

1

,

…

,

g

n

)

. ∎

References

1

N. Cutland,

Computability: An

Introduction

to

Recursive Function

Theory

. Cambridge University Press, (1980).

Title

combining URMs

Canonical name

CombiningURMs

Date of creation

2013-03-22 19:04:07

Last modified on

2013-03-22 19:04:07

Owner

CWoo (3771)

Last modified by

CWoo (3771)

Numerical id

16

Author

CWoo (3771)

Entry type

Application

Classification

msc 68Q05

Classification

msc 03D10

Generated on Sat Feb 10 12:39:35 2018 by

LaTeXML