<<

Effective Procedures Unlimited Register Machine Computable and Decidable Notations

Unlimited Register Machine∗

Xiaofeng Gao

Department of Science and Engineering Shanghai Jiao Tong University, P.R.China

CS363- Theory

∗ Special thanks is given to Prof. Yuxi Fu for sharing his teaching materials. CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 1/45 Effective Procedures Unlimited Register Machine Computable and Decidable Notations Outline

1 Effective Procedures Basic Concepts 2 Unlimited Register Machine Definition Instruction An Example 3 Computable and Decidable URM-Computable Function Decidable and Computable 4 Notations Register Machine Joining Programs Together

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 2/45 Effective Procedures Unlimited Register Machine Basic Concepts Computable and Decidable Computable Function Notations Outline

1 Effective Procedures Basic Concepts Computable Function 2 Unlimited Register Machine Definition Instruction An Example 3 Computable and Decidable URM-Computable Function Decidable and Computable 4 Notations Register Machine Joining Programs Together

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 3/45 Effective Procedures Unlimited Register Machine Basic Concepts Computable and Decidable Computable Function Notations What is Effective Procedure

Methods for addition, multiplication ⊲ Given n, finding the nth prime number. ⊲ Differentiating a polynomial. ⊲ Finding the highest common factor of two numbers HCF(x, y) → Euclidean ⊲ Given two numbers x, y, deciding whether x is a multiple of y. Their implementation requires no ingenuity, intelligence, inventiveness.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 4/45 Effective Procedures Unlimited Register Machine Basic Concepts Computable and Decidable Computable Function Notations Intuitive Definition

An algorithm or effective procedure is a mechanical rule, or automatic method, or programme for performing some mathematical operations.

Blackbox: input −→ −→ output

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 5/45 Effective Procedures Unlimited Register Machine Basic Concepts Computable and Decidable Computable Function Notations What is “effective procedure”?

An Example: Consider the function g(n) defined as follows:

1, if there is a run of exactly n consecutive 7′s g(n) =  in the decimal expansion of π,  0, otherwise.  Question: Is g(n) effective?

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 6/45 Effective Procedures Unlimited Register Machine Basic Concepts Computable and Decidable Computable Function Notations What is “effective procedure”?

An Example: Consider the function g(n) defined as follows:

1, if there is a run of exactly n consecutive 7′s g(n) =  in the decimal expansion of π,  0, otherwise.  Question: Is g(n) effective? ⊲ The answer is unknown = the answer is negative.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 6/45 Effective Procedures Unlimited Register Machine Basic Concepts Computable and Decidable Computable Function Notations What is “effective procedure”?

An Example: Consider the function g(n) defined as follows:

1, if there is a run of exactly n consecutive 7′s g(n) =  in the decimal expansion of π,  0, otherwise.  Question: Is g(n) effective? ⊲ The answer is unknown = the answer is negative.

Other Examples: Theorem Proving is in general not effective/algorithmic. Proof Verification is effective/algorithmic.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 6/45 Effective Procedures Unlimited Register Machine Basic Concepts Computable and Decidable Computable Function Notations Algorithm

An algorithm is a procedure that consists of a finite set of instructions which, given an input from some set of possible inputs, enables us to obtain an output through a systematic execution of the instructions that terminates in a finite number of steps.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 7/45 Effective Procedures Unlimited Register Machine Basic Concepts Computable and Decidable Computable Function Notations Outline

1 Effective Procedures Basic Concepts Computable Function 2 Unlimited Register Machine Definition Instruction An Example 3 Computable and Decidable URM-Computable Function Decidable and Computable 4 Notations Register Machine Joining Programs Together

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 8/45 Effective Procedures Unlimited Register Machine Basic Concepts Computable and Decidable Computable Function Notations Computable Function

When an algorithm or effective procedure is used to calculate the value of a numerical function then the function in question is effectively calculable (or algorithmically computable, effectively computable, computable).

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 9/45 Effective Procedures Unlimited Register Machine Basic Concepts Computable and Decidable Computable Function Notations Computable Function

When an algorithm or effective procedure is used to calculate the value of a numerical function then the function in question is effectively calculable (or algorithmically computable, effectively computable, computable).

Examples: HCF(x, y) is computable; g(n) is non-computable.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 9/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Outline

1 Effective Procedures Basic Concepts Computable Function 2 Unlimited Register Machine Definition Instruction An Example 3 Computable and Decidable URM-Computable Function Decidable and Computable 4 Notations Register Machine Joining Programs Together

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 10/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Unlimited Register Machine

An Unlimited Register Machine (URM) is an idealized computer. ⊲ No limitation in the size of the numbers it can receive as input. ⊲ No limitation in the amount of working space available. ⊲ Inputs and outpus are restricted to natural numbers. (coding for others) From Shepherdson & Sturgis [1963]’s description. ⊲ Shepherdson, J. C. & Sturgis, H.E., Computability of Recursive Functions, Journal of Association for Computing Machinery (Journal of ACM), 10, 217-55, 1963.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 11/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Register

A URM has an infinite number of register labeled R1, R2, R3,....

R1 R2 R3 R4 R5 R6 R7

r1 r2 r3 r4 r5 r6 r7

Every register can hold a natural number at any moment.

The registers can be equivalently written as for example

3 4 ∞ [r1r2r3]1[r4]4[r5r6r7 . . .]5

or simply 3 4 7 [r1, r2, r3]1[r4]4[r5, r6, r7]5.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 12/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Outline

1 Effective Procedures Basic Concepts Computable Function 2 Unlimited Register Machine Definition Instruction An Example 3 Computable and Decidable URM-Computable Function Decidable and Computable 4 Notations Register Machine Joining Programs Together

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 13/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Program

A URM also has a program, which is a finite list of instructions.

An instruction is a recognized simple operations (calculation with numbers) to alter the contents of the registers. (I1, , Is)

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 14/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Instruction

Type Instruction Response of the URM

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 15/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Instruction

Type Instruction Response of the URM

Zero Z(n) Replace rn by 0. (0 → Rn, or rn := 0)

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 15/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Instruction

Type Instruction Response of the URM

Zero Z(n) Replace rn by 0. (0 → Rn, or rn := 0) Successor S(n) Add 1 to rn. (rn + 1 → Rn, or rn := rn + 1)

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 15/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Instruction

Type Instruction Response of the URM

Zero Z(n) Replace rn by 0. (0 → Rn, or rn := 0) Successor S(n) Add 1 to rn. (rn + 1 → Rn, or rn := rn + 1) Transfer T(m, n) Copy rm to Rn. (rm → Rn, or rn := rm)

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 15/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Instruction

Type Instruction Response of the URM

Zero Z(n) Replace rn by 0. (0 → Rn, or rn := 0) Successor S(n) Add 1 to rn. (rn + 1 → Rn, or rn := rn + 1) Transfer T(m, n) Copy rm to Rn. (rm → Rn, or rn := rm) Jump J(m, n, q) If rm = rn, go to the q-th instruction; otherwise go to the next instruction.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 15/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Instruction

Type Instruction Response of the URM

Zero Z(n) Replace rn by 0. (0 → Rn, or rn := 0) Successor S(n) Add 1 to rn. (rn + 1 → Rn, or rn := rn + 1) Transfer T(m, n) Copy rm to Rn. (rm → Rn, or rn := rm) Jump J(m, n, q) If rm = rn, go to the q-th instruction; otherwise go to the next instruction.

Z(n), S(n), T(m, n) are arithmetic instructions.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 15/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Outline

1 Effective Procedures Basic Concepts Computable Function 2 Unlimited Register Machine Definition Instruction An Example 3 Computable and Decidable URM-Computable Function Decidable and Computable 4 Notations Register Machine Joining Programs Together

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 16/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Configuration and Instructions

Example: The initial registers are:

R1 R2 R3 R4 R5 R6 R7 9 7 0 0 0 0 0 ...

The program is:

I1 : J(1, 2, 6) I2 : S(2) I3 : S(3) I4 : J(1, 2, 6) I5 : J(1, 1, 2) I6 : T(3, 1)

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 17/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Configuration and Computation

Configuration: the contents of the registers + the current instruction number.

Initial configuration, computation, final configuration.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 18/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Operation of URM under a program P

P = {I1, I2, , Is}→ URM

URM starts by obeying instruction I1 When URM finishes obeying Ik, it proceeds to the next instruction in the computation,

⊲ if Ik is not a jump instruction, then the next instruction is Ik+1; ⊲ if Ik = J(m, n, q) then next instruction is (1) Iq, if rm = rn; or (2) Ik+1, otherwise. Computation stops when the next instruction is Iv, where v > s. ⊲ if k = s, and Is is an arithmetic instruction; ⊲ if Ik = J(m, n, q), rm = rn and q > s; ⊲ if Ik = J(m, n, q), rm = rn and k = s.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 19/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Flow Diagram

START Typical configuration J(m, m, q) is R1 R2 R3 alertunconditional jump x y z ... r1=r2? Computations that never stop No START r2:=r2+1 After k cycles round the loop in this program r1:=r1+1 No r3:=r3+1 Yes R1 R2 R3 x y+k z+k ...

r1=r2? If x = y+k: Yes R1 R2 R3

r3R1 z+k y+k z+k ...

STOP

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 20/45 Effective Procedures Definition Unlimited Register Machine Instruction Computable and Decidable An Example Notations Some Notation

Suppose P is the program of a URM and a1, a2, a3,... are the numbers stored in the registers.

P(a1, a2, a3,...) is the initial configuration.

P(a1, a2, a3,...) ↓ means that the computation converges.

P(a1, a2, a3,...) ↑ means that the computation diverges.

P(a1, a2,..., am) is P(a1, a2,..., am, 0, 0,...).

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 21/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Outline

1 Effective Procedures Basic Concepts Computable Function 2 Unlimited Register Machine Definition Instruction An Example 3 Computable and Decidable URM-Computable Function Decidable and Computable 4 Notations Register Machine Joining Programs Together

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 22/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations URM-Computable Function

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 23/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations URM-Computable Function

What does it mean that a URM computes a (partial) n-ary function f ?

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 24/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations URM-Computable Function

What does it mean that a URM computes a (partial) n-ary function f ?

Let P be the program of a URM and a1,..., an, b ∈ N. When computation P(a1,..., an) converges to b if P(a1,..., an) ↓ and r1 = b in the final configuration. We write P(a1,..., an) ↓ b.

P URM-computes f if, for all a1,..., an, b ∈ N,

P(a1,..., an) ↓ b iff f (a1,..., an)= b

Function f is URM-computable if there is a program that URM-computes f . (We abbreviate “URM-computable” to “computable”)

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 24/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Computable Functions

Let

C be the set of computable functions and

Cn be the set of n-ary computable functions.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 25/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Examples

Construct a URM that computes x + y.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 26/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Examples

Construct a URM that computes x + y.

I1 : J(3, 2, 5) I2 : S(1) I3 : S(3) I4 : J(1, 1, 1)

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 26/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Examples

Construct a URM that computes x + y.

START I1 : J(3, 2, 5) I2 : S(1) r Yes I3 : S(3) 3=r2? STOP k=y? I4 : J(1, 1, 1) No

r1:=r1+1

r3:=r3+1 k:=k+1

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 26/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Examples x − 1, if x > 0, Construct a URM that computes x−˙ 1 = 0, if x = 0.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 27/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Examples x − 1, if x > 0, Construct a URM that computes x−˙ 1 = 0, if x = 0.

I1 : J(1, 4, 8) I2 : S(3) I3 : J(1, 3, 7) I4 : S(2) I5 : S(3) I6 : J(1, 1, 3) I7 : T(2, 1)

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 27/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Examples x − 1, if x > 0, Construct a URM that computes x−˙ 1 = 0, if x = 0.

START Typical configuration I1 : J(1, 4, 8) R1 R2 R3 =0? x 0 0 ... I2 : S(3) r1 x=0? I3 : J(1, 3, 7) Yes I4 : S(2) r3:=1 k=0 I5 : S(3) R1 R2 R3 x 0 1 ... I6 : J(1, 1, 3) r1=r3? I7 : T(2, 1) x=k+1? R1 R2 R3 No Yes x k k+1 ...

r2:=r2+1 kR1 STOP k:=k+1

r3:=r3+1

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 27/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Examples

x/2, if x is even, Construct a URM that computes x ÷ 2 = undefined, if x is odd.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 28/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Examples

x/2, if x is even, Construct a URM that computes x ÷ 2 = undefined, if x is odd.

I1 : J(1, 2, 6) I2 : S(3) I3 : S(2) I4 : S(2) I5 : J(1, 1, 1) I6 : T(3, 1)

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 28/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Examples

x/2, if x is even, Construct a URM that computes x ÷ 2 = undefined, if x is odd.

START I1 : J(1, 2, 6) I2 : S(3) r =r ? Yes r3R1 I3 : S(2) 1 2 STOP x=2k? kR1 I4 : S(2) No I5 : J(1, 1, 1) I : T(3, 1) r3:=r3+1 6 k:=k+1

r2:=r2+2 2k:=2k+2

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 28/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Function Defined by Program

Given any program P and n ≥ 1, by thinking of the effect of P on initial configurations of the form a1, , an, 0, 0, , there is a (n) unique n-ary function that P computes, denoted by fP .

(n) b, if P(a1,..., an) ↓ b, fP (a1,..., an)= undefined, if P(a1,..., an) ↑ .

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 29/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Outline

1 Effective Procedures Basic Concepts Computable Function 2 Unlimited Register Machine Definition Instruction An Example 3 Computable and Decidable URM-Computable Function Decidable and Computable 4 Notations Register Machine Joining Programs Together

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 30/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Predicate and Decision Problem

The value of a predicate is either ‘true’ or ‘false’. The answer of a decision problem is either ‘yes’ or ‘no’.

Example: Given two numbers x, y, check whether x is a multiple of y. Input: x, y; Output: ‘Yes’ or ‘No’.

The operation amounts to calculation of the function

1, if x is a multiple of y, f (x, y)= 0, if otherwise. Thus the property or predicate ‘x is a multiple of y’ is algorithmically or effectively decidable, or just decidable if function f is computable.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 31/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Decidable Predicate and Decidable Problem

Suppose that M(x1,..., xn) is an n-ary predicate of natural numbers. The characteristic function cM(x), where x = x1,..., xn, is given by

(n) 1, if M(x) holds, f (a1,..., an)= P 0, if otherwise.

The predicate M(x) is decidable if cM is computable; it is undecidable otherwise.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 32/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Computability on other Domains

Suppose D is an object domain. A coding of D is an explicit and effective injection α : D → N. We say that an object d ∈ D is coded by the natural number α(d).

A function f : D → D extends to a numeric function f ∗ : N → N. We say that f is computable if f ∗ is computable.

∗ − f = α ◦ f ◦ α 1

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 33/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Example

Consider the domain Z. An explicit coding is given by the function α where

2n, if n ≥ 0, α(n)= −2n − 1, if n < 0. Then α−1 is given by

1 −1 2 m, if m is even, α (m)= 1 − 2 (m + 1), if m is odd.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 34/45 Effective Procedures Unlimited Register Machine URM-Computable Function Computable and Decidable Decidable and Computable Notations Example (Continued)

Consider the function f (x)= x − 1 on Z, then f ∗ : N → N is given by

1 if x = 0 (i.e. x = α(0)), ∗ f (x)=  x − 2 if x > 0 and x is even (i.e. x = α(n), n > 0),  x + 2 if x is odd (i.e. x = α(n), n < 0).  It is a routine exercise to write a program that computes f ∗, hence x − 1 is a computable function on Z.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 35/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Outline

1 Effective Procedures Basic Concepts Computable Function 2 Unlimited Register Machine Definition Instruction An Example 3 Computable and Decidable URM-Computable Function Decidable and Computable 4 Notations Register Machine Joining Programs Together

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 36/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Remark

Register Machines are more advanced than Turing Machines.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 37/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Remark

Register Machines are more advanced than Turing Machines.

Register Machine Models can be classified into three groups: CM ( Model). RAM (Random Access Machine Model). RASP (Random Access Stored Program Machine Model).

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 37/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Remark

Register Machines are more advanced than Turing Machines.

Register Machine Models can be classified into three groups: CM (Counter Machine Model). RAM (Random Access Machine Model). RASP (Random Access Stored Program Machine Model).

The Unlimited Register Machine Model belongs to the CM class.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 37/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Finiteness

Every URM uses only a fixed finite number of registers, no matter how large an input number is.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 38/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Finiteness

Every URM uses only a fixed finite number of registers, no matter how large an input number is.

This is a fine property of Counter Machine Model.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 38/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Outline

1 Effective Procedures Basic Concepts Computable Function 2 Unlimited Register Machine Definition Instruction An Example 3 Computable and Decidable URM-Computable Function Decidable and Computable 4 Notations Register Machine Joining Programs Together

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 39/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Sequential Composition

Given Programs P and Q, how do we construct the sequential composition P; Q?

The jump instructions of P and Q must be modified.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 40/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Sequential Composition

Given Programs P and Q, how do we construct the sequential composition P; Q?

The jump instructions of P and Q must be modified.

Standard Form: A program P = I1,..., Is is in standard form if, for every jump instruction J(m, n, q) we have q ≤ s + 1.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 40/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Lemma

For any program P there is a program P∗ in standard form such that any computation under P∗ is identical to the corresponding computation under P. In particular, for any a1, , an, b,

∗ P(a1, , an) ↓ b if and only if P (a1, , an) ↓ b,

(n) (n) and hence fP = fP∗ for every n > 0.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 41/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Proof

∗ ∗ ∗ ∗ Suppose that P = I1, I2, , Is. Put P = I1 , I2 , , Is where

∗ if Ik is not a jump instruction, then Ik = Ik;

∗ Ik if q ≤ s + 1, if Ik is not a jump instruction, then I = k J(m, n, s + 1) if q > s + 1.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 42/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Join/Concatenation

Let P and Q be programs of lengths s, t respectively, in standard form. P The join or concatenation of P and Q, written PQ or Q , is a program I1, I2, , Is, Is+1, , Is+t where P = I1, , Is and the instructions Is+1, , Is+t are the instructions of Q with each jump J(m, n, q) replaced by J(m, n, s + q).

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 43/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations Program as Subroutine

Suppose the program P computes f .

Let ρ(P) be the least number i such that the register Ri is not used by the program P.

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 44/45 Effective Procedures Unlimited Register Machine Register Machine Computable and Decidable Joining Programs Together Notations

The notation P[l1,..., ln → l] stands for the following program:

I1 : T(l1, 1) . .

In : T(ln, n)

In+1 : Z(n + 1) . .

Iρ(P) : Z(ρ(P)) _ : P _ : T(1, l)

CSC363-ComputabilityTheory@SJTU XiaofengGao UnlimitedRegisterMachine 45/45