General Models of Computation

General Models of Computation

General Models of Computation Introduction When thinking of the meaning of computation, we are often led to the notion of algorithm, i.e. a process or set of rules to be followed in a step-by-step manner for the purpose of producing a desired outcome. This definition may seem somewhat vague and informal, and for this reason, over the past century, mathematicians and computer scientists have formally defined several models of computation that attempt to capture the notion of algorithm. Moreover, a general model of computation (GMC), is one that purports to encompass all possible algorithms. As an example, a general programming language, such as Java, is a general model of computation, since every Java program induces a process that can be followed in a step-by-step manner by adhering to the program's control statements. However, how do we know that any algorithm can be realized by some Java program? A GMC is said to be complete provided it can realize all possible algorithms. The problem with proving that a GMC is complete lies in the fact that, again, there is no a priori formal definition of algorithm. Now, suppose A and B are two different GMC's. Then we write 1. A ≤ B iff every algorithm realizable by A can also be realized by B 2. A < B iff there is an algorithm that can be realized by B, but not by A 3. A ≡ B, read as \A is equivalent to B" iff both A ≤ B and B ≤ A. Then the best we can do is to modify our definition of completeness to mean that A is complete iff there is some complete B for which A ≡ B. The only problem with this approach is that it requires an initial GMC for which we hypothesize as being complete. And in computer science we tend to regard the Turing machine as that initial model. In fact the Church-Turing Thesis states that any problem that can be solved by following an algorithm can be solved by a Turing machine. Since the advent of the Church-Turing thesis, hundreds if not thousands of complete GMC's have been introduced. 1 Algorithms Compute Functions Whenever an algorithmic process begins, the system being enacted upon is in some initial state. Then, after the process has been completed, the system is in some final state. Furthermore, we may think of this final state as the output that is associated with the initial state (i.e. input). Thinking of an algorithm in this manner, then we may define the purpose of an algorithm as to compute a function f whose domain is the set of possible initial system states, and whose codomain is the set of possible final states. Moreover, all classical general models of computation assume a countable number of possible system states s0; s1;:::, and so we may consider the function being computed as having domain and codomain equal to the set of natural numbers N = f0; 1; 2;:::g. We write this as f : N!N , meaning that for any input x 2 N , f assigns x to some value f(x) 2 N . And if this assignment is algorithmically performed, then f is said to be computable. Note that it is sometimes more convenient to assume m inputs to function f. In this case we write m m f : N !N , meaning that for any input vector (x1; : : : ; xm) 2 N , f assigns it to some value f(x1; : : : ; xm) 2 N . Note also that, even if the a system state consists of other non-integer types, such as real numbers, strings, lists, etc., with the help of appropriate encoding functions we may still assume that the function being computed assigns natural numbers to natural numbers. Thus, we see that natural-number-valued functions are central to algorithms, since the computing of such functions serves as a unifying purpose for all algorithms. Therefore, the question of \what problems can be solved by a computer?" can be re-stated as \which functions can be computed by an algorithm?". 2 The Unlimited Register Machine The first GMC that we study is the Unlimited Register Machine (URM) first introduced by Shepherdson and Sturgis (See Chapter 2 of Cutland). The purpose of a URM is to compute an m-ary function f : N m !N , from the set of m-tuples of nonnegative integers to nonnegative integers. To begin, a register is a memory component that is capable of storing nonnegative integers of arbitrary length. Registers form basis of URM's. Indeed, a URM M consists of 1. r registers R1;:::;Rr, 2. a finite program P = I1;:::;Is consisting of s instructions that are used for step-by-step manipulation of the registers, and 3.a program counter, denoted pc, that stores the index of the next program instruction to be executed. A URM M takes as input m nonnegative integers ~x = x1; : : : ; xm, performs a computation on this input, and outputs a nonnegative integer, denoted M(~x). The computation of M on input ~x involves generating a (possibly infinte) sequence of machine configurations σ0; σ1;:::. Moreover, each configuration σ can be represented with an r + 1-dimensional tuple whose first r components equal the integers currently stored in registers R1;:::;Rr, and whose final component is the index of the next instruction. Thus, it is not surprising that the initial configuration is always σ0 = (x1; : : : ; xm; 0;:::; 0; 1). In words, the initial configuration consists of the input being placed in registers R1;:::;Rm, with all other registers being initialized to 0, and the program counter set to 1. Now suppose the computation of M on input ~x has reached configuration σi = (y1; : : : ; yr; pc), for some i ≥ 0. If pc > s, then σi is the final computation configuration. Moreover, the output M(~x) is equal to the integer stored in R1. In this case the computation is finite, and i represents the number of steps used by M to compute M(~x). On the other hand, if pc ≤ s, then Ipc is executed, which may have the effect of changing the value of one or more registers. Finally, after execution, the value of pc is incremented (unless Ipc is a Jump instruction, in which case pc may be set to some other index). Then σi+1 is equal to the r + 1-dimensional tuple that reflects the updated register and pc values. We write M(~x) # (respectively, M(~x) ") in case the computation of M on input ~x is finite (respectively infinite). 3 URM Instruction Set The following is a description of the different types of URM instructions, and how each affects the current machine configuration. Zero Z(i), 1 ≤ i ≤ r, assigns 0 to register Ri: Ri 0. Sum S(i), 1 ≤ i ≤ r, increments by 1 the value stored in Ri: Ri Ri + 1. Transfer T(i; j), 1 ≤ i; j ≤ r, assigns to Rj the value stored in Ri: Rj Ri. Jump J(i; j; k), 1 ≤ i; j ≤ r, 1 ≤ k ≤ s, has the effect of setting pc to k in case Ri and Rj store the same integer. Otherwise pc is incremented by one. 4 Example 1. Consider a URM M with r = 3 registers and the following 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) Show the sequence of configurations produced by the computation M(9; 7). 5 We say that an m-ary function f : N m !N is URM-computable iff there exists a URM M for which, for all ~x 2 N m, i) if f(~x) is defined, then M(~x) = f(~x), and ii) if f(~x) is undefined, then M(~x) ". If f is defined on all inputs, then it is called total URM-computable. Otherwise, it is called partially URM-computable. Note: when we say a function is partially computable, it still may be possible that it is total computable. In other words, totally computable implies partially computable, but the converse is not necessarily true. Example 2a. Show that the function f(x; y) = x + y is URM-computable. 6 Example 2b. By designing an appropriate URM M, show that the function bx=2c if x is even f(x) = " otherwise is URM-computable. Show the computations M(2) and M(3). 7 A predicate function is any function f : N m ! f0; 1g whose output values are either 0 or 1. A predicate function is said to be URM-decidable iff there is a URM program that computes (i.e. decides) f. Moreover, a unary (i.e. single-input) predicate function is often referred to as a \property of the nonnegative integers". For example, the property of being at least 5 can be represented by the function 1 if x ≥ 5 GTE5(x) = 0 otherwise Example 2c. Provide a URM M that proves that the property of being greater than or equal to 5 is URM-decidable. 8 Primitive Recursive Functions URM's have the following advantages when studying the theory of computation: 1. as we'll see in the next lecture, it seems relatively easy to encode a URM program as an integer, 2. the configuration of a URM can be simply described with an r + 1 tuple of integers, and 3. at times a theorem will require a proof that warrants writing a general program, which seems a relatively easy task with the URM model. On the other hand, writing URM programs for specific computable functions can get complicated in a hurry.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    32 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us