Computability Theory

Computability Theory

CSC 438F/2404F Notes (S. Cook) Fall, 2008 Computability Theory This section is partly inspired by the material in \A Course in Mathematical Logic" by Bell and Machover, Chap 6, sections 1-10. Other references: \Introduction to the theory of computation" by Michael Sipser, and \Com- putability, Complexity, and Languages" by M. Davis and E. Weyuker. Our first goal is to give a formal definition for what it means for a function on N to be com- putable by an algorithm. Historically the first convincing such definition was given by Alan Turing in 1936, in his paper which introduced what we now call Turing machines. Slightly before Turing, Alonzo Church gave a definition based on his lambda calculus. About the same time G¨odel,Herbrand, and Kleene developed definitions based on recursion schemes. Fortunately all of these definitions are equivalent, and each of many other definitions pro- posed later are also equivalent to Turing's definition. This has lead to the general belief that these definitions have got it right, and this assertion is roughly what we now call \Church's Thesis". Our first definition will be based on a simple computer model called Register Machines, something proposed by Shepherdson and Sturgis in the 1960's. Then we will give a recursion- theoretic definition due to Kleene, and prove our two definitions are equivalent. A natural definition of computable function f on N allows for the possibility that f(x) may not be defined for all x 2 N, because algorithms do not always halt. Thus we will use the symbol 1 to mean “undefined". Definition: A partial function is a function n f :(N [ f1g) ! N [ f1g; n ≥ 0 such that f(c1; :::; cn) = 1 if some ci = 1. In the context of computability theory, whenever we refer to a function on N, we mean a partial function in the above sense. Definitions: Domain(f) = f~x 2 Nn j f(~x) 6= 1g n where ~x = (x1 ··· xn) We say f is total iff Domain(f) = N (i.e. if f is always defined when all its arguments are defined). Definition: A Register Machine (abbreviated RM) is a computer model specified by a program P = hc0; :::; ch−1i, consisting of a finite sequence of commands (described below). Intuitively, the commands operate on registers R1;R2; :::, each capable of storing an arbitrary natural number. 54 The possible commands are command Ri 0 Abbreviation: Zi i = 1; 2 ··· Ri Ri + 1 Si i = 1; 2 ··· goto k if Ri = Rj Ji;j;k i; j = 1; 2; ··· and k = 0; 1; 2; ··· ; h Example of a program Copy: Rj Ri (Here i and j should be specific numbers from f1; 2; 3; · · · g.) c0: Rj 0 Zj c1: goto 4 if Ri = Rj Jij4 c2 Rj Rj + 1 Sj c3 goto 1 if R1 = R1 J111 c4 Formally, we write the above program as hZj;Jij4;Sj;J111i Semantics of RM's A state is an m + 1-tuple hK; R1; :::; Rmi of natural numbers, where intuitively K is the instruction counter (i.e. the number of the next command to be executed) and R1; :::; Rm are the current values of the registers. (Here m must be as least as large as any register index referred to in the associated program.) Given a state s = hK; R1; :::; Rmi and a 0 program P = hc0; :::; ch−1i, the next state s = NextP (s) is intuitively the state resulting when command cK is applied to the register values given by s. We say that s is a halting state if K = h, and in this case s0 = s. Example: Suppose the state s = hK; R1; ··· ;Rmi and the command cK is Sj, where 1 ≤ j ≤ m. Then NextP (s) = hK + 1;R1; ··· ;Rj−1;Rj + 1;Rj+1; ··· ;Rmi Exercise 1 Give a formal definition of the function NextP for the cases in which cK is Zi and cK is Ji;j;k. A computation of a program P is a finite or infinite sequence s0; s1; ::: of states such that si+1 = NextP (si) for each si+1 in the sequence. If the sequence is finite, then the last state must be a halting state, and in this case we say that the computation is halting. We say that a program P halts starting in state s0 if there is a halting computation of P starting in state s0. Input/Output conventions: A program P computes a (partial) function f(a1; : : : ; an) as follows. Initially place a1; :::; an in R1; :::; Rn and set all other registers to 0. Start execution with command c0. That is, the initial state is s0 = h0; a1; :::; an; 0; :::; 0i 55 If P halts starting in state s0, the final value of R1 must be f(a1; :::; an) (which then must be defined). If P fails to halt, then f(a1; :::; an) = 1. Thus for each program P and each n ≥ 0 we associate an n-ary function fP;n: namely the n-ary function computed by P. Definition: If f is an n-ary function, we say that f is RM-computable (or just computable) if f is computed by some RM program. Our form of Church's Thesis: Every algorithmically computable function is RM-computable. Here the notion \algorithmically computable" is not a precise mathematical notion, but rather an intuitive notion. It is understood that the algorithms in question have unlimited memory. In the case of register machines, this means that each register can hold an arbitrarily large natural number. Church's Thesis will be discussed further at the end of this section, after we have given many examples of computable functions. Exercise 2 Show P = hJ234;S1;S3;J110i computes f(x; y) = x + y. Exercise 3 Write register machine programs to compute each of the following functions: : f1(x) = x 1 f2(x; y) = x · y Be sure to respect our input/output conventions for RM's. Primitive Recursive Functions Primitive recursion is a simple form of recursion defined as follows: Definition f is defined from g and h by primitive recursion iff f(~x; 0) = g(~x) f(~x;y + 1) = h(~x;y; f(~x;y)) We allow n = 0 so ~x could be missing. As an example, f+(x; y) = x + y can be defined by primitive recursion as follows: x + 0 = x x + (y + 1) = (x + y) + 1 In this case, g(x) = x, and h(x; y; z) = z + 1. If f is defined from g and h by primitive recursion, we can compute f from g and h by the following high-level program: 56 u g(~x) for z : 0::y − 1 u h(~x;z; u) end for The final value of u is f(~x;y) Definition f is defined from g and h1 ··· hm by composition iff f(~x) = g(h1(~x); : : : ; hm(~x)) where f; h1 : : : hm are each n-ary functions, g is m-ary. Initial Functions: Z 0-ary function equal to 0 SS(x) = x + 1 In;i(x1 ··· xn) = xi 1 ≤ i ≤ n infinite class of projection functions Definition f is primitive recursive iff f can be obtained from the initial functions by finitely many applications of primitive recursion and composition. Examples: f+(x; y) (see above) is primitive recursive, since it is defined from primitive recursion from g and h, where g = I1;1 and h can be defined by composition as follows: h(x; y; z) = S(I3;3(x; y; z)) As another example, let Z1 be the unary zero function, so Z1(x) = 0 for all x. Then we can define Z1 by primitive recursion Z1(0) = Z = g, Z1(y + 1) = Z1(y) = h(y; Z1(y)); here h = I2;2. All constant functions Kn;i(x1; ··· ; xn) = i are primitive recursive. For example, K2;3(x; y) = 3, and we show it is primitive recursive by repeated composition as follows: K2;3(x; y) = S(S(S(Z1(I2;1(x; y))))) Exercise 4 Show that x · y and xy are each primitive recursive functions of x and y. Show that SQ(x) = x2 is primitive recursive. Proposition: Every primitive recursive function is total. (f is total if f(~x) 6= 1 for all ~x 2 Nn.) Proof: The initial functions are all total, and the two operations composition and primitive recursion preserve totality. Hence all primitive recursive functions are total. (Formally the proof is by induction on the definition of primitive recursive function; see the following proof.) 57 Theorem: Every primitive recursive function is computable (on a RM). Proof: We show that each primitive recursive function f is computable by a program which upon halting leaves all registers 0 except R1 (which contains the output). We do this by induction on the definition of primitive recursive function. That is, the proof is by induction on the number of applications of composition and primitive recursion needed to derive f from the initial functions. The base case: Each initial function is easily shown to be computable by such a program. Exercise 5 For each initial function, give an RM program which computes it and leaves all registers 0 except R1. Induction Step: We show that composition and primitive recursion each preserve computabil- ity by such programs. a) Composition: Assume that g; h1,..., hm are computable by programs Pg; P1; :::; Pm, respectively, where these programs leave all registers 0 except R1. We are to show that f is computable by such a program Pf , where f(~x) = g(h1(~x); ··· ; hm(~x)) At the start x1; ··· ; xn are in registers R1; ··· ;Rn, with all other registers 0.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    17 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