unlimited register machinegao-xf/computability/document/slide03-urm.pdfeffective procedures...

64
Effective Procedures Unlimited Register Machine Computable and Decidable Notations Unlimited Register Machine Xiaofeng Gao Department of Computer Science and Engineering Shanghai Jiao Tong University, P.R.China CS363-Computability Theory * Special thanks is given to Prof. Yuxi Fu for sharing his teaching materials. CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 1/45

Upload: others

Post on 20-Jul-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Unlimited Register Machine∗

Xiaofeng Gao

Department of Computer Science and EngineeringShanghai Jiao Tong University, P.R.China

CS363-Computability Theory

Special thanks is given to Prof. Yuxi Fu for sharing his teaching materials.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 1/45

Page 2: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Outline

1 Effective ProceduresBasic ConceptsComputable Function

2 Unlimited Register MachineDefinitionInstructionAn Example

3 Computable and DecidableURM-Computable FunctionDecidable and Computable

4 NotationsRegister MachineJoining Programs Together

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 2/45

Page 3: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Basic ConceptsComputable Function

Outline

1 Effective ProceduresBasic ConceptsComputable Function

2 Unlimited Register MachineDefinitionInstructionAn Example

3 Computable and DecidableURM-Computable FunctionDecidable and Computable

4 NotationsRegister MachineJoining Programs Together

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 3/45

Page 4: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Basic ConceptsComputable Function

What is Effective Procedure

Methods for addition, multiplication· · ·

⊲ Givenn, finding thenth prime number.⊲ Differentiating a polynomial.⊲ Finding the highest common factor of two numbersHCF(x, y) →

Euclidean algorithm⊲ Given two numbersx, y, deciding whetherx is a multiple ofy.

Their implementation requires no ingenuity, intelligence,inventiveness.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 4/45

Page 5: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Basic ConceptsComputable Function

Intuitive Definition

An algorithmor effective procedureis amechanical rule, or automaticmethod, or programmefor performing some mathematical operations.

Blackbox: input−→ −→ output

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 5/45

Page 6: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Basic ConceptsComputable Function

What is “effective procedure”?

An Example: Consider the functiong(n) defined as follows:

g(n) =

1, if there is a run of exactlyn consecutive 7′sin the decimal expansion ofπ,

0, otherwise.

Question: Isg(n) effective?

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 6/45

Page 7: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Basic ConceptsComputable Function

What is “effective procedure”?

An Example: Consider the functiong(n) defined as follows:

g(n) =

1, if there is a run of exactlyn consecutive 7′sin the decimal expansion ofπ,

0, otherwise.

Question: Isg(n) effective?

⊲ The answer is unknown6= the answer is negative.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 6/45

Page 8: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Basic ConceptsComputable Function

What is “effective procedure”?

An Example: Consider the functiong(n) defined as follows:

g(n) =

1, if there is a run of exactlyn consecutive 7′sin the decimal expansion ofπ,

0, otherwise.

Question: Isg(n) effective?

⊲ The answer is unknown6= the answer is negative.

Other Examples:

Theorem Provingis in general not effective/algorithmic.

Proof Verificationis effective/algorithmic.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 6/45

Page 9: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Basic ConceptsComputable Function

Algorithm

An algorithm is a procedure that consists of a finite set ofinstructionswhich, given aninput from some set of possible inputs, enables us toobtain anoutputthrough a systematic execution of the instructionsthat terminatesin a finite number of steps.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 7/45

Page 10: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Basic ConceptsComputable Function

Outline

1 Effective ProceduresBasic ConceptsComputable Function

2 Unlimited Register MachineDefinitionInstructionAn Example

3 Computable and DecidableURM-Computable FunctionDecidable and Computable

4 NotationsRegister MachineJoining Programs Together

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 8/45

Page 11: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Basic ConceptsComputable Function

Computable Function

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

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 9/45

Page 12: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Basic ConceptsComputable Function

Computable Function

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

Examples:

HCF(x, y) is computable;

g(n) is non-computable.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 9/45

Page 13: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Outline

1 Effective ProceduresBasic ConceptsComputable Function

2 Unlimited Register MachineDefinitionInstructionAn Example

3 Computable and DecidableURM-Computable FunctionDecidable and Computable

4 NotationsRegister MachineJoining Programs Together

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 10/45

Page 14: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

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 RecursiveFunctions,Journal of Association for Computing Machinery(Journal of ACM), 10, 217-55, 1963.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 11/45

Page 15: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Register

A URM has an infinite number ofregisterlabeledR1,R2,R3, . . ..

R1 R2 R3 R4 R5 R6 R7 · · ·

r1 r2 r3 r4 r5 r6 r7 · · ·

Every register can hold anatural numberat any moment.

The registers can be equivalently written as for example

[r1r2r3]31[r4]

44[r5r6r7 . . .]

5

or simply[r1, r2, r3]

31[r4]

44[r5, r6, r7]

75.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 12/45

Page 16: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Outline

1 Effective ProceduresBasic ConceptsComputable Function

2 Unlimited Register MachineDefinitionInstructionAn Example

3 Computable and DecidableURM-Computable FunctionDecidable and Computable

4 NotationsRegister MachineJoining Programs Together

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 13/45

Page 17: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Program

A URM also has aprogram, which is a finite list ofinstructions.

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

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 14/45

Page 18: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Instruction

Type Instruction Response of the URM

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 15/45

Page 19: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Instruction

Type Instruction Response of the URM

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

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 15/45

Page 20: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Instruction

Type Instruction Response of the URM

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

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 15/45

Page 21: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Instruction

Type Instruction Response of the URM

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

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 15/45

Page 22: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Instruction

Type Instruction Response of the URM

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

Jump J(m,n,q) If rm = rn, go to theq-th instruction;otherwise go to the next instruction.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 15/45

Page 23: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Instruction

Type Instruction Response of the URM

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

Jump J(m,n,q) If rm = rn, go to theq-th instruction;otherwise go to the next instruction.

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

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 15/45

Page 24: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Outline

1 Effective ProceduresBasic ConceptsComputable Function

2 Unlimited Register MachineDefinitionInstructionAn Example

3 Computable and DecidableURM-Computable FunctionDecidable and Computable

4 NotationsRegister MachineJoining Programs Together

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 16/45

Page 25: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

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-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 17/45

Page 26: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Configuration and Computation

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

Initial configuration, computation, final configuration.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 18/45

Page 27: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Operation of URM under a programP

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

URM starts by obeying instructionI1

When URM finishes obeyingIk, it proceeds to the nextinstruction in the computation,

⊲ if Ik is not a jump instruction, then the next instruction isIk+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 isIv, wherev > s.⊲ if k = s, andIs is an arithmetic instruction;⊲ if Ik = J(m, n, q), rm = rn andq > s;⊲ if Ik = J(m, n, q), rm 6= rn andk = s.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 19/45

Page 28: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Flow Diagram

START

r1=r2?

No

r2:=r2+1

r3:=r3+1

r1=r2?

No

Yes

r3�R1

STOP

Yes

x y z ...

R1 R2 R3

Typical configuration

After k cycles round the

loop in this program

x y+k z+k ...

R1 R2 R3

If x = y+k:

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

R1 R2 R3

J(m,m,q) isalertunconditional jump

Computations that never stop

START

r1:=r1+1

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 20/45

Page 29: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

DefinitionInstructionAn Example

Some Notation

SupposeP is the program of a URM anda1,a2,a3, . . . are thenumbers stored in the registers.

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

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

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

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

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 21/45

Page 30: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Outline

1 Effective ProceduresBasic ConceptsComputable Function

2 Unlimited Register MachineDefinitionInstructionAn Example

3 Computable and DecidableURM-Computable FunctionDecidable and Computable

4 NotationsRegister MachineJoining Programs Together

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 22/45

Page 31: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

URM-Computable Function

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 23/45

Page 32: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

URM-Computable Function

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

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 24/45

Page 33: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

URM-Computable Function

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

Let P be the program of a URM anda1, . . . ,an,b ∈ N. WhencomputationP(a1, . . . ,an) converges tob if P(a1, . . . ,an) ↓ andr1 = b in the final configuration. We writeP(a1, . . . ,an) ↓ b.

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

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

Functionf is URM-computableif there is a program thatURM-computesf .

(We abbreviate “URM-computable” to “computable”)

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 24/45

Page 34: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Computable Functions

Let

C be the set of computable functions and

Cn be the set ofn-ary computable functions.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 25/45

Page 35: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Examples

Construct a URM that computesx+ y.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 26/45

Page 36: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Examples

Construct a URM that computesx+ y.

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

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 26/45

Page 37: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Examples

Construct a URM that computesx+ y.

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

START

r3=r2?k=y?

No

r1:=r1+1

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

STOPYes

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 26/45

Page 38: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Examples

Construct a URM that computesx−̇1 =

{

x− 1, if x > 0,0, if x = 0.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 27/45

Page 39: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Examples

Construct a URM that computesx−̇1 =

{

x− 1, if x > 0,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-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 27/45

Page 40: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Examples

Construct a URM that computesx−̇1 =

{

x− 1, if x > 0,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)

START

r1=0?x=0?

r3:=1

r3:=r3+1

STOP

Yes

x 0 0 ...

R1 R2 R3

Typical configuration

x 0 1 ...

R1 R2 R3

x k k+1 ...

R1 R2 R3

r1=r3?x=k+1?

r2:=r2+1k:=k+1

k�R1

YesNo

k=0

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 27/45

Page 41: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Examples

Construct a URM that computesx÷ 2 =

{

x/2, if x is even,undefined, if x is odd.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 28/45

Page 42: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Examples

Construct a URM that computesx÷ 2 =

{

x/2, if x is even,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-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 28/45

Page 43: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Examples

Construct a URM that computesx÷ 2 =

{

x/2, if x is even,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)

START

r1=r2?x=2k?

No

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

STOPYes

r3:=r3+1

k:=k+1

r3�R1

k�R1

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 28/45

Page 44: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Function Defined by Program

Given any programP andn ≥ 1, by thinking of the effect ofP oninitial configurations of the forma1, · · · ,an,0,0, · · · , there is auniquen-ary function thatP computes, denoted byf (n)P .

f (n)P (a1, . . . ,an) =

{

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

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 29/45

Page 45: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Outline

1 Effective ProceduresBasic ConceptsComputable Function

2 Unlimited Register MachineDefinitionInstructionAn Example

3 Computable and DecidableURM-Computable FunctionDecidable and Computable

4 NotationsRegister MachineJoining Programs Together

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 30/45

Page 46: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Predicate and Decision Problem

The value of a predicate is either ‘true’ or ‘false’.

The answer of adecision problemis either ‘yes’ or ‘no’.

Example: Given two numbersx, y, check whetherx is a multiple ofy.Input: x, y;Output: ‘Yes’ or ‘No’.

The operation amounts to calculation of the function

f (x, y) =

{

1, if x is a multiple ofy,0, if otherwise.

Thus the property or predicate ‘x is a multiple ofy’ is algorithmicallyor effectively decidable, or justdecidableif function f is computable.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 31/45

Page 47: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Decidable Predicate and Decidable Problem

Suppose thatM(x1, . . . , xn) is ann-ary predicate of natural numbers.Thecharacteristic functioncM(x), wherex = x1, . . . , xn, is given by

f (n)P (a1, . . . ,an) =

{

1, if M(x) holds,0, if otherwise.

The predicateM(x) is decidableif cM is computable; it isundecidableotherwise.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 32/45

Page 48: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Computability on other Domains

SupposeD is an object domain. Acodingof D is an explicit andeffective injectionα : D → N. We say that an objectd ∈ D is codedby the natural numberα(d).

A function f : D → D extends to a numeric functionf ∗ : N → N. Wesay thatf is computable iff ∗ is computable.

f ∗ = α ◦ f ◦ α−1

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 33/45

Page 49: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Example

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

α(n) =

{

2n, if n ≥ 0,−2n− 1, if n < 0.

Thenα−1 is given by

α−1(m) =

{ 12m, if m is even,−1

2(m+ 1), if m is odd.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 34/45

Page 50: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

URM-Computable FunctionDecidable and Computable

Example (Continued)

Consider the functionf (x) = x− 1 onZ, thenf ∗ : N → N is given by

f ∗(x) =

1 if x = 0 (i.e. x = α(0)),x− 2 if x > 0 andx 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 computesf ∗, hencex− 1 is a computable function onZ.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 35/45

Page 51: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Outline

1 Effective ProceduresBasic ConceptsComputable Function

2 Unlimited Register MachineDefinitionInstructionAn Example

3 Computable and DecidableURM-Computable FunctionDecidable and Computable

4 NotationsRegister MachineJoining Programs Together

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 36/45

Page 52: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Remark

Register Machinesare more advanced than Turing Machines.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 37/45

Page 53: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Remark

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

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 37/45

Page 54: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Remark

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

TheUnlimited Register MachineModel belongs to the CM class.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 37/45

Page 55: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Finiteness

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

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 38/45

Page 56: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Finiteness

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

This is a fine property of Counter Machine Model.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 38/45

Page 57: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Outline

1 Effective ProceduresBasic ConceptsComputable Function

2 Unlimited Register MachineDefinitionInstructionAn Example

3 Computable and DecidableURM-Computable FunctionDecidable and Computable

4 NotationsRegister MachineJoining Programs Together

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 39/45

Page 58: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Sequential Composition

Given ProgramsP andQ, how do we construct the sequentialcompositionP;Q?

The jump instructions ofP andQ must be modified.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 40/45

Page 59: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Sequential Composition

Given ProgramsP andQ, how do we construct the sequentialcompositionP;Q?

The jump instructions ofP andQ must be modified.

Standard Form: A programP = I1, . . . , Is is in standard formif, forevery jump instructionJ(m,n,q) we haveq ≤ s+ 1.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 40/45

Page 60: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Lemma

For any programP there is a programP∗ in standard form such thatany computation underP∗ is identical to the correspondingcomputation underP. In particular, for anya1, · · · ,an, b,

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

and hencef (n)P = f (n)P∗ for everyn > 0.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 41/45

Page 61: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Proof

Suppose thatP = I1, I2, · · · , Is. PutP∗ = I∗1, I∗

2 , · · · , I∗

s where

if Ik is not a jump instruction, thenI∗k = Ik;

if Ik is not a jump instruction, thenI∗k =

{

Ik if q ≤ s+ 1,J(m,n, s+ 1) if q > s+ 1.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 42/45

Page 62: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Join/Concatenation

Let P andQ be programs of lengthss, t respectively, in standard form.The join or concatenationof P andQ, writtenPQor P

Q, is a programI1, I2, · · · , Is, Is+1, · · · , Is+t whereP = I1, · · · , Is and the instructionsIs+1, · · · , Is+t are the instructions ofQ with each jumpJ(m,n,q)replaced byJ(m,n, s+ q).

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 43/45

Page 63: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

Program as Subroutine

Suppose the programP computesf .

Let ρ(P) be the least numberi such that the registerRi is not used bythe programP.

CSC363-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 44/45

Page 64: Unlimited Register Machinegao-xf/computability/Document/Slide03-URM.pdfEffective Procedures Unlimited Register Machine Computable and Decidable Notations Basic Concepts Computable

Effective ProceduresUnlimited Register MachineComputable and Decidable

Notations

Register MachineJoining Programs Together

The notationP[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-Computability Theory@SJTU Xiaofeng Gao Unlimited Register Machine 45/45