
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: I CM (Counter Machine Model) I Unlimited Register Machine Model I RAM (Random Access Machine Model) I 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 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 7 1 [r1; r2; r3]1[r4]4[r5; r6; r7]5[0; 0; 0;:::]8 or simply 3 4 7 [r1; r2; r3]1[r4]4[r5; r6; r7]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 rn by 0. Successor S(n) Add 1 to rn. Transfer T (m; n) Copy rm to Rn. Jump J(m; n; q) If rm = rn, 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 ... R1 R2 R3 R4 R5 R6 R7 Program: 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) 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 a1; a2; a3;::: are the numbers stored in the registers. I P(a1; a2; a3;:::) is the initial configuration. I P(a1; a2; a3;:::) # means that the computation converges. I P(a1; a2; a3;:::) " means that the computation diverges. I P(a1; a2;:::; am) is P(a1; a2;:::; am; 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 (ex) be an n-ary partial function. What does it mean that a URM computes f (ex)? Computability Theory, by Y. Fu V. Register Machine 14 / 35 URM-Computable Function Suppose P is the program of a URM and a1;:::; an; b 2 !. The computation P(a1;:::; an) converges to b if P(a1;:::; an) # and r1 = b in the final configuration. In this case we write P(a1;:::; an) # b. P URM-computes f if, for all a1;:::; an; b 2 !, P(a1;:::; an) # b iff f (a1;:::; an) = 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 I1 : J(3; 2; 5) I2 : S(1) I3 : S(3) I4 : J(1; 1; 1) 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. I1 : J(3; 2; 5) I2 : S(1) I3 : S(3) I4 : J(1; 1; 1) Computability Theory, by Y. Fu V. Register Machine 16 / 35 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) 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: 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) Computability Theory, by Y. Fu V. Register Machine 17 / 35 I1 : J(1; 2; 6) I2 : S(3) I3 : S(2) I4 : S(2) I5 : J(1; 1; 1) I6 : T (3; 1) 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: I1 : J(1; 2; 6) I2 : S(3) I3 : S(2) I4 : S(2) I5 : J(1; 1; 1) I6 : T (3; 1) Computability Theory, by Y. Fu V. Register Machine 18 / 35 Function Defined by Program n b; if P(a1;:::; an) # b; fP (a1;:::; an) = undefined; if P(a1;:::; an) " : Computability Theory, by Y. Fu V. Register Machine 19 / 35 Program in 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. 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 Ri is not used by the program P. Computability Theory, by Y. Fu V. Register Machine 22 / 35 Some 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) 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 (y1;:::; yk ) and g1(ex);:::; gk (ex) are URM-definable, then the composition function h(ex) given by h(ex) ' f (g1(ex);:::; gk (ex)) is URM-definable. Computability Theory, by Y. Fu V. Register Machine 25 / 35 Definability of Composition Let F ; G1;:::; Gk be programs that compute f ; g1;:::; gk . Let m be maxfn; k; ρ(F ); ρ(G1); : : : ; ρ(Gk )g. Registers: m m+n m+n+1 m+n+k [:::]1 [ex]m+1[g1(ex)]m+n+1 ::: [gk (ex)]m+n+k Computability Theory, by Y. Fu V. Register Machine 26 / 35 Definability of Composition The program for h: I1 : T (1; m + 1) . In : T (n; m + n) In+1 : G1[m + 1; m + 2;:::; m + n ! m + n + 1] . In+k : Gk [m + 1; m + 2;:::; m + n ! m + n + k] In+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 (ex) and g(ex; y; z) are URM-definable. The recursion function h(ex; y) defined by the following recursion h(ex; 0) ' f (ex); h(ex; y + 1) ' g(ex; y; h(ex; 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 maxfn; ρ(F ); ρ(G)g. m m+n m+n+1 m+n+2 m+n+3 Registers: [:::]1 [ex]m+1[y]m+n+1[k]m+n+2[h(ex; k)]m+n+3. Program: I1 : T (1; m + 1) . In+1 : T (n + 1; m + n + 1) In+2 : F [1; 2;:::; n ! m + n + 3] In+3 : J(m + n + 2; m + n + 1; n + 7) In+4 : G[m + 1;:::; m + n; m + n + 2; m + n + 3 ! m + n + 3] In+5 : S(m + n + 2) In+6 : J(1; 1; n + 3) In+7 : T (m + n + 3; 1) Computability Theory, by Y. Fu V. Register Machine 29 / 35 Definability of Minimization Fact. If f (ex; y) is URM-definable, then the minimization function µy(f (ex; y) = 0) is URM-definable. Computability Theory, by Y. Fu V. Register Machine 30 / 35 Definability of Minimization Suppose F computes f (ex; y). Let m be maxfn + 1; ρ(F )g. m m+n m+n+1 m+n+2 Registers: [:::]1 [ex]m+1[k]m+n+1[0]m+n+2. Program: I1 : T (1; m + 1) . In : T (n; m + n) In+1 : F [m + 1; m + 2;:::; m + n + 1 ! 1] In+2 : J(1; m + n + 2; n + 5) In+3 : S(m + n + 1) In+4 : J(1; 1; n + 1) In+5 : T (m + n + 1; 1) Computability Theory, by Y.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages39 Page
-
File Size-