V. Register Machine Yuxi Fu BASICS, Shanghai Jiao Tong University
Register Machines are more abstract than Turing Machines. Computability Theory, by Y. Fu V. Register Machine 1 / 35
Register Machine Models can be classified into three groups: ◮ CM (Counter Machine Model) ◮ Unlimited Register Machine Model ◮ RAM (Random Access Machine Model) ◮ RASP (Random Access Stored Program Machine Model) Computability Theory, by Y. Fu V. Register Machine 2 / 35
Synopsis 1. Unlimited Register Machine 2. Definability in URM 3. Simulation of TM by URM Computability Theory, by Y. Fu V. Register Machine 3 / 35
1. Unlimited Register Machine Computability Theory, by Y. Fu V. Register Machine 4 / 35
Unlimited Register Machine Model Unlimited Register Machines are introduced by Shepherdson and Sturgis in Computability and Recursive Functions. Journal of Symbolic Logic, 32:1-63, 1965. Computability Theory, by Y. Fu V. Register Machine 5 / 35
Register An Unlimited Register Machine (URM) has an infinite number of register labeled R 1 , R 2 , R 3 , . . . . r 1 r 2 r 3 r 4 r 5 r 6 r 7 . . . R 1 R 2 R 3 R 4 R 5 R 6 R 7 . . . Every register can hold a natural number at any moment. The registers can be equivalently written as for example [ r 1 , r 2 , r 3 ] 3 1 [ r 4 ] 4 4 [ r 5 , r 6 , r 7 ] 7 5 [0 , 0 , 0 , . . . ] ∞ 8 or simply [ r 1 , r 2 , r 3 ] 3 1 [ r 4 ] 4 4 [ r 5 , r 6 , r 7 ] 7 5 . Computability Theory, by Y. Fu V. Register Machine 6 / 35
Program A URM also has a program, which is a finite list of instructions. Computability Theory, by Y. Fu V. Register Machine 7 / 35
Instruction type instruction response of URM Zero Z ( n ) Replace r n by 0. Successor S ( n ) Add 1 to r n . Transfer T ( m , n ) Copy r m to R n . Jump J ( m , n , q ) If r m = r n , go to the q -th instruction; otherwise go to the next instruction. Computability Theory, by Y. Fu V. Register Machine 8 / 35
Computation Registers: 9 7 0 0 0 0 0 . . . R 1 R 2 R 3 R 4 R 5 R 6 R 7 Program: I 1 : J (1 , 2 , 6) I 2 : S (2) I 3 : S (3) I 4 : J (1 , 2 , 6) I 5 : J (1 , 1 , 2) I 6 : T (3 , 1) Computability Theory, by Y. Fu V. Register Machine 9 / 35
Configuration and Computation Configuration: register contents + current instruction number. Initial configuration, computation, final configuration. Computability Theory, by Y. Fu V. Register Machine 10 / 35
Some Notation Suppose P is the program of a URM and a 1 , a 2 , a 3 , . . . are the numbers stored in the registers. ◮ P ( a 1 , a 2 , a 3 , . . . ) is the initial configuration. ◮ P ( a 1 , a 2 , a 3 , . . . ) ↓ means that the computation converges. ◮ P ( a 1 , a 2 , a 3 , . . . ) ↑ means that the computation diverges. ◮ P ( a 1 , a 2 , . . . , a m ) is P ( a 1 , a 2 , . . . , a m , 0 , 0 , . . . ). Computability Theory, by Y. Fu V. Register Machine 11 / 35
Every URM uses only a fixed finite number of registers, no matter how large an input number is. Computability Theory, by Y. Fu V. Register Machine 12 / 35
2. Definability in URM Computability Theory, by Y. Fu V. Register Machine 13 / 35
URM-Computable Function Let f ( � x ) be an n -ary partial function. What does it mean that a URM computes f ( � x )? Computability Theory, by Y. Fu V. Register Machine 14 / 35
URM-Computable Function Suppose P is the program of a URM and a 1 , . . . , a n , b ∈ ω . The computation P ( a 1 , . . . , a n ) converges to b if P ( a 1 , . . . , a n ) ↓ and r 1 = b in the final configuration. In this case we write P ( a 1 , . . . , a n ) ↓ b . P URM-computes f if, for all a 1 , . . . , a n , b ∈ ω , P ( a 1 , . . . , a n ) ↓ b iff f ( a 1 , . . . , a n ) = b . The function f is URM-definable if there is a program that URM-computes f . Computability Theory, by Y. Fu V. Register Machine 15 / 35
Example of URM Construct a URM that computes x + y . Computability Theory, by Y. Fu V. Register Machine 16 / 35
Example of URM Construct a URM that computes x + y . I 1 : J (3 , 2 , 5) I 2 : S (1) I 3 : S (3) I 4 : J (1 , 1 , 1) Computability Theory, by Y. Fu V. Register Machine 16 / 35
Example of URM � x − 1 , if x > 0 , Construct a URM that computes x ˙ − 1 = 0 , if x = 0 . Computability Theory, by Y. Fu V. Register Machine 17 / 35
Example of URM � x − 1 , if x > 0 , Construct a URM that computes x ˙ − 1 = 0 , if x = 0 . I 1 : J (1 , 4 , 8) I 2 : S (3) I 3 : J (1 , 3 , 7) I 4 : S (2) I 5 : S (3) I 6 : J (1 , 1 , 3) I 7 : T (2 , 1) Computability Theory, by Y. Fu V. Register Machine 17 / 35
Example of URM Construct a URM that computes � x / 2 , if x is even , x ÷ 2 = undefined , if x is odd . Computability Theory, by Y. Fu V. Register Machine 18 / 35
Example of URM Construct a URM that computes � x / 2 , if x is even , x ÷ 2 = undefined , if x is odd . I 1 : J (1 , 2 , 6) I 2 : S (3) I 3 : S (2) I 4 : S (2) I 5 : J (1 , 1 , 1) I 6 : T (3 , 1) Computability Theory, by Y. Fu V. Register Machine 18 / 35
Function Defined by Program � b , if P ( a 1 , . . . , a n ) ↓ b , f n P ( a 1 , . . . , a n ) = undefined , if P ( a 1 , . . . , a n ) ↑ . Computability Theory, by Y. Fu V. Register Machine 19 / 35
Program in Standard Form A program P = I 1 , . . . , I s is in standard form if, for every jump instruction J ( m , n , q ) we have q ≤ s + 1. For every program there is a program in standard form that computes the same function. We will focus exclusively on programs in standard form. Computability Theory, by Y. Fu V. Register Machine 20 / 35
Program 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. Computability Theory, by Y. Fu V. Register Machine 21 / 35
Some Notations Suppose the program P computes f . Let ρ ( P ) be the least number i such that the register R i is not used by the program P . Computability Theory, by Y. Fu V. Register Machine 22 / 35
Some Notations The notation P [ l 1 , . . . , l n → l ] stands for the following program I 1 : T ( l 1 , 1) . . . I n : T ( l n , n ) : Z ( n + 1) I n +1 . . . I ρ ( P ) : Z ( ρ ( P )) : P : T (1 , l ) Computability Theory, by Y. Fu V. Register Machine 23 / 35
Definability of Initial Function Fact . The initial functions are URM-definable. Computability Theory, by Y. Fu V. Register Machine 24 / 35
Definability of Composition Fact . If f ( y 1 , . . . , y k ) and g 1 ( � x ) , . . . , g k ( � x ) are URM-definable, then the composition function h ( � x ) given by h ( � x ) ≃ f ( g 1 ( � x ) , . . . , g k ( � x )) is URM-definable. Computability Theory, by Y. Fu V. Register Machine 25 / 35
Definability of Composition Let F , G 1 , . . . , G k be programs that compute f , g 1 , . . . , g k . Let m be max { n , k , ρ ( F ) , ρ ( G 1 ) , . . . , ρ ( G k ) } . Registers: x ] m + n x )] m + n +1 x )] m + n + k [ . . . ] m 1 [ � m +1 [ g 1 ( � m + n +1 . . . [ g k ( � m + n + k Computability Theory, by Y. Fu V. Register Machine 26 / 35
Definability of Composition The program for h : : T (1 , m + 1) I 1 . . . I n : T ( n , m + n ) I n +1 : G 1 [ m + 1 , m + 2 , . . . , m + n → m + n + 1] . . . : G k [ m + 1 , m + 2 , . . . , m + n → m + n + k ] I n + k I n + k +1 : F [ m + n + 1 . . . , m + n + k → 1] Computability Theory, by Y. Fu V. Register Machine 27 / 35
Definability of Recursion Fact . Suppose f ( � x ) and g ( � x , y , z ) are URM-definable. The recursion function h ( � x , y ) defined by the following recursion h ( � x , 0) ≃ f ( � x ) , h ( � x , y + 1) ≃ g ( � x , y , h ( � x , y )) is URM-definable. Computability Theory, by Y. Fu V. Register Machine 28 / 35
Definability of Recursion Let F compute f and G compute g . Let m be max { n , ρ ( F ) , ρ ( G ) } . x ] m + n m +1 [ y ] m + n +1 m + n +1 [ k ] m + n +2 x , k )] m + n +3 Registers: [ . . . ] m 1 [ � m + n +2 [ h ( � m + n +3 . Program: I 1 : T (1 , m + 1) . . . I n +1 : T ( n + 1 , m + n + 1) I n +2 : F [1 , 2 , . . . , n → m + n + 3] I n +3 : J ( m + n + 2 , m + n + 1 , n + 7) I n +4 : G [ m + 1 , . . . , m + n , m + n + 2 , m + n + 3 → m + n + 3] : S ( m + n + 2) I n +5 I n +6 : J (1 , 1 , n + 3) : T ( m + n + 3 , 1) I n +7 Computability Theory, by Y. Fu V. Register Machine 29 / 35
Definability of Minimization Fact . If f ( � x , y ) is URM-definable, then the minimization function µ y ( f ( � x , y ) = 0) is URM-definable. Computability Theory, by Y. Fu V. Register Machine 30 / 35
Definability of Minimization Suppose F computes f ( � x , y ). Let m be max { n + 1 , ρ ( F ) } . x ] m + n m +1 [ k ] m + n +1 m + n +1 [0] m + n +2 Registers: [ . . . ] m 1 [ � m + n +2 . Program: I 1 : T (1 , m + 1) . . . I n : T ( n , m + n ) I n +1 : F [ m + 1 , m + 2 , . . . , m + n + 1 → 1] I n +2 : J (1 , m + n + 2 , n + 5) I n +3 : S ( m + n + 1) : J (1 , 1 , n + 1) I n +4 I n +5 : T ( m + n + 1 , 1) Computability Theory, by Y. Fu V. Register Machine 31 / 35
Main Result Theorem . All recursive functions are URM-definable. Computability Theory, by Y. Fu V. Register Machine 32 / 35
3. Simulation of TM by URM Computability Theory, by Y. Fu V. Register Machine 33 / 35
Recommend
More recommend