Book Math Cutland Computability
Book Math Cutland Computability
Book Math Cutland Computability
tis posible to have. notion ofm-complet sets for lasesother than the cass of ‘reset its then necessary to Keep the reference or. here.9 Reducibility and degrees 166 (6) Aism-complete iff A=mK iff Ais re. and K Sq A, (c) Om consists exacily of all m-complete sets. Applying this we have the following: 3.3. Examples ‘The following sets are m-complete. (a) (zc W,} (example 1.2(15)), (b) any non-trivial rc. set of the form (x:4_€ @} where Bc @, (the proofs of theorems 7-3.4 and 3.8 show that K'<»such aset), (©) (e:@s(0)=0)) @) exer) eerie 1.700). ‘The reader may have realised that m-reducibility appeared implicitly in the statement of theorem 7-3.2, which implies immediately that 3.4. Theorem Any m-complete set is creative. Proof. If A is m-complete, then K =A, 80 K Re ‘The URMO, with y in its oracle and obeying the instruction O(n) may be envisaged as shown in fig. 95. ‘A program is, as before, a finite sequence of instructions. The URMO operates under a URMO program P in the same way as the URM, with the following additional stipulation: after obeying an oracle instruction [, in P the next instruction is I, We emphasise that ina URMO program P no particular function x is mentioned. Thus the meaning of P varies according to the function supplied in the oracle. However, a computation under P can be carried out only when @ particular function y is supplied, so we write P* to denote the program P when used with the function y in the oracle. Thus we write PH(ay,...54n) for the computation by P, with x in the oracle, and with initial configura- tion a3, 425... dq, 0,0,...5 and we write Pr(a)ib to mean that the computation P*(a) stops with the number b in register R. if definitions (parallel with definition Fig. 9 Oracle ee at mR RR R ‘With resulting configuration nlele .)4 Relative computability 169 42. Definition Let x be a unary total function, and suppose that f is a partial funetion from N° to N. (a) Let P be a URMO program. Then P URMO-computes f relative 10 x (or f is y-computed by P) if, for every aN" and ben, PY(a)ib iff fla) (b) The function f is URMO-computable relative to x (or just x-compuiable) if there is a URMO program that URMO- computes it relative to x. We write ‘* to denote the class of all y-computable functions. We are now in a position where we could define Turing-reducibility. However, to aid a better understanding of this concept when we come to it, we shall first outline a little of the development of the theory of relative computability. Most methods and results from unrelativised computability have counterparts in relative computability. Thus in many of the theorems that follow we supply only a sketch proof or a reference to the unrelativised version of the same result, Throughout this section x stands for a total unary function. 43. Theorem (a) xe", () @c#, (c) ifxis computable, then % =, (d) €* isclosed under substitution, recursion and minimalisation, (e) if bis a total unary function that is y-computable, then Ce. Proof. (a) Use the URMO program O(1) (b) Any URM program is a URMO program. () Inview of (6), we need only show that @ < Suppose that f is y-computable and that y is computable. Proceeding informally, we can compute any value of f as follows: use the ‘algorithm for f, and whenever a value of x is requested simply compute it using the algorithm for x. Tis is an effective pro- cedure, so by Church's thesis / is computable. (We leave the reader to provide @ formal proof of this result; see exercise 4.1013),)9 Reduciblity and degrees 170 (d) The proofs are idemtical to those of theorems 2-3.1, 2-4.4 and 2-5.2. (e) The proof is similar to that for (c) (which is really a special case of (e)). Other approaches 10 relativised computability Any alternative approach to computability can be modified to provide a corresponding, notion of relative computability. A relativised version of the Fundamen- tal result (theorem 3-1.1) can then be proved, and this leads to the formulation of Church's thesis for relativised computability. We mention here only the relativised notion of partial recursive function: 44. Definition The class J” of x-partal recursive functions is the smallest class of functions such that (a) the basic functions are in 3”, (b) xe", {c) ®* is closed under substitution, recursion and minimalisa- tion. The phrases partial recursive in x or partial recursive relative to x are also used with the same meaning as x-partiat recursive. ‘The notions y-recursive (or recursive in, oF relative to, x) and y-primitive recursive (oF primitive recursive in oF relative to, x) are defined in the obvious way. Corresponding to theorem 3-2.2 (and proved in the same way) we have 4.5. Theorem For any x, RY = €", Numbering program: and functions URMO programs can be effectively numbered or coded by an easy adaptation of the method used in chapter 4 for URM programs. Let us assume that this has been done, so that we have a fixed effective enumeration (without repetitions) Qo, O1, Qa, of all URMO programs.’ Then we write 4" for the n-ary function y-computed by Qn, Bach URM program P appears in this ist: in most cases, however, its number here wilt he diferent from that assigned tit in chapter 44 Relative computability 1 bh for os, W4 for Domi¢3), Ek, for Ran(o) ‘The s-m-n theorem (4-4.3) has a relativised counterpart with identical proof: 4.6. Theorem (The relativised s-m-n theorem) For each m, n= 1 there isa total computable (m + 1)-ary function le, x) suck that for any x BER ¥)~ bIBieni(P)- Note. The function 57 here differs, of course, from the function given the same name in theorem 4-4.3. Note, however, that si" here is still computable (not merely x-computable) and does not depend on x. Universal programs for relative computability Relativisation of the proof of theorem 5-1.2 gives immediately: 4.7. Theorem For each n, the universal function Wi" for n-ary x-compuiable functions given by PS (ex) =O2" (x) fs y-compurable Remark. & careful examination of the full formal proof of theorem S-1.2 would show that there is a URMO program Qu, independent of x, that computes wi" for any x. ne.sets The relativised notions of recursive and rc a-recursive and x: sets are given by: 4.8, Definition Let A be a set (a) A is x-recursive (or recursive in x) if ca is x-computable, (b) Ais y-re. (or re. in x) if the partial characteristic func ( ifxea, undefined ifxe A, is x-computable. fle9 Reducibility and degrees 72 ‘The following selection of basicresults about y-recursive and y-r.e. sets is proved by the addition of the prefix y- at the appropriate places in the proofs of the corresponding unrelativised results in chapter 7: 4.9. Theorem (a) For any set A, A is x-recursive iff A and A are x-r. (6) For any set A, the following are equivalent (i) Ais x-re, Gi) A=W, for some m, i E's, for some m, (iv) A= © or A is the range of a total x-computable function, (W) for some x-decidable predicate R(x, y), xeA © ByRix,y) (R is y-decidable if its characteristic function is y-computable).. (€) Let K* ={x:x € Wi}; then K* is yore, but not x-recursive, Computability relative to a set For any set A, we define computability relative to A (or just A-computability) to mean computability relative to ay the characteristic function of A. Thus we write P* for P* (if Pisa URMO program), €A fore, On for O54, Wa for Wie, Ed for Ess, K* fork, A-recu fe for ca-recursive, Ante. for cate ete, In the next section we shall define Turing reducibility in terms of computability relative to a set. For a set A, we can summarise the basic idea that we have presented in this section, in a nutshell, as follows: A-computability is computability for anyone who knows all about A. To. be a little more precise, we should expand this to: for anyone who can answer any question of the form ‘x ¢ A. This excludes knowledge of ‘infinite’ facts about A, such as whether A has infinitely many even members.4.10. 10. 4 Relative computability 173 Exercises Let x, ¥ be total unary functions, and suppose that 6? i total. I, 2 necessarily total? Suppose that xi,2,---+Xe are total unary functions. Define Ae to be the smallest class of functions containing the basic functions and y1,..., xx and closed under substitutions, recursion and minimalisation, Formulate a definition of the set <@*™ of functions computable relative to x3, Xx Such that, ere gh", (Hint, Either define @ machine having & oracles, or find a single unary funetion yy such that d=" = aR) Provide a full formal proof of theorem 4.3(c): if x is compu table, then € = © Show that there isa total computable function k (independent of, 2x) such that Wijasy = WS UWS for al indices a 5. Verity theorem 4.9, Let A be any set (a) Show that for any re. set B, there is an index such that B=We, (6) Show that if A is recursive , then W2 is re. for all (c) Show that if A is recursive, then K* is re. but not Let A, B, C, be sets. Prove that (a) if A is B-recursive and B is C-recursive, then A is C- recursive, (6) if A is Bere. and B is C-recursive, then A is Cre., (c) if Ais B-recursive and B is C-r.e., then A is not necessarily Cre (Relativisation of theorem 1.6.) Let A be any set, Show that for any set B, Bis Are. @ BSqK* ). Show that there is a single number d such that K*=W forall sets A. (a) We say that a set A is y-simple if (i) A is x-re., ii) A is infinite, (ii) A contains no infinite y-r.e. subset. Show that there is a x-simple set. (b) Formulate the definition of a y-creative set. Show that a -simple set is not y-creative.9 Reducibility and degrees 174 5. Turing reducibility and Turing degrees Using relative computability we make the following definitions: 5.1, Definitions (a) The set A is Turing reducible (or just T-reducible) to the set Bif Ais B-recursive (equivalently, if ca is B-computable). Thisis written As1B, (6) The sets A, B are Turing equivalent (or T-equivatent) if ASB and B=rA. (The use of the word equivalent is justified in theorem 5.2() below.) We write this A =rB. Let us consider informally the meaning of Turing reduciblity. Suppose that A <1B and that P is a URMO program that computes ca relative to 2B. Then for any x, P®(x) converges and Pe) ifxed, PP)|0 fee. During any completed computation P(x) there will have been a finite number of requests to the oracle for a value cp(n) of cp, as dictated by P and the progress of the computation. These requests amount to a finite number of questions of the form n €B". So for any x,"x €Ais settled in a mechanical way by answering a finite number of questions about B. Thus we see that Turing reducibilty accords with the informal notion of reducbility discussed at the beginning of § 4 Some of the basic properties ofthe relations = and = are given in the next theorem 5.2. Theorem (a) =r is reflexive and transitive, (0) =r is an equivatence relation, (©) fA=mB then A=rB, (d) A=rA forall A, (¢) if A is recursive, then A: again, we think of a degree as a collection of sets all having the same degree of difficulty. SA. Definitions (a) Let A be a set; the equivalence class dy(A)={B:B=rA} is called the Turing degree of A, abbreviated the T-degree of A. () Any T-degree containing a recursive set is called a recursive Tedegree. (c) Any T-degree containing an r.e. setis called an re. T-degree. The notions of Turing reducibility and Turing degree are widely accepted as the most basic among all other similar notions. Hence the term reducible without qualification is often used to mean Turing reducible; similarly, Turing degrees are often referred to merely as degrees, or degrees of unsolvability. We shall adopt this practice in the remainder of our chapter. As before, the letters a, b,¢, etc. are used for degrees. ‘The relation = on sets induces a partial ordering on degrees, as with Sa:9 Reducibility and degrees 176 5.5. Definition Let a, 6 be degrees, (a) ab if for some (equivalently, for all) Aca and Bed, AS=rB; ()) a x and fy) , there is an r.e. degree b such that bla. 5.15. Sacks’ Density theorem For any rc, degrees a <6 there isan r.e, degree e with a 0 there are r.e, degrees 6, ¢ such that b 0 such that 0 is the greatest lower bound of a and b. (6) There are re. degrees a, & having no greatest lower bound (either among all degrees or among re. degrees). ‘Turning to non r.e. degrees, a surprising result is 5.18 Theorem (Shoenfield) There is a non-r.e. degree a <0 A minimal degree is a degree m > 0 such that there is no degree a with 0 Om, there isan re, m-degree bsuch that bla. Proof. Let Aca; A iste. so by theorem 5.14 take an re. T-degree ¢ such that dy(A)|e. Let B be an re. set in ¢, and let b=d.(B). Then if @Sqb OF bSma, by theorem 5.6(c) we have dr(A)=e or e Fy3the letters &, ¥,.... will invariably denote operators in this chapter. We shall confine our attention to totally defined operators : Fy > F,; ie. such that the domain of @ is the whole of Fn. ‘The chief problem when trying to formulate the idea of a computable (or effective) operator &:F;-» F;, say, is that both an ‘input function f and the ‘output’ function (f) are likely to be infinite objects, and hence incapable of being given in a finite time. Yet our intuition about effective processes is that in some sense they should be completed within a finite To see how this problem can be overcome, consider the following operators from Fy to FI Recursive operators 183 (6) @2()= g, where g(x) =Syexfl. ‘These operators are certainly down to earth and explicit. Intuitively we might regard them as effective operators: but why? Let fe Fi and let i= ®i(f)s notice that any particular value gi(x) (if defined) can be calculated in finite time from the single value f(x) of f; if we set g2= :(f), then to calculate g2(x) fi defined) we need to know the finite number of values /(0), f(1),...,f(x). Thus in both cases any defined value of the output function (,(f) or 2(/)) can be effectively calculated in a finite time using only @ finite part of the input function f. This is essentially the definition of a recursive operator given below. ‘One consequence of the definition will be the following: suppose that ‘(/\(x) = y is calculated using only a finite part @ of f; then if g is any other function having @ as a finite part we must expect that (g(x) = also. To frame our definition precisely there are some technical considera- tions. First, let us agree that by a “finite part’ of a function f we mean a finite function @ extended by /. (We say that @ is a finite function if its domain is a finite set.) For convenience we adopt the convention @ always denotes a finite function in this chapter. ‘The above discussion shows that the definition of recursive operator will involve effective calculations with finite functions. We make this precise by coding each finite function @ bya number # and using ordinary computability. A suitable coding for our purposes is defined as follows: suppose that 0c F,. The n-tuple x = (xis...) 8 coded by the number pir’; then define the code 8 for @ by pic"! provided that Dom(6)4 2, it Dom(a)= 2 (in which case 8 = fa). ‘There isa simple effective procedure to decide for any number z whether 2 =4 for some finite function 9; and if so, to decide whether a given x belongs to Dom(9}, and calculate 6(x) if it does. Now we have our definition: Ll. Definition Let ©: F_>F,. Then @ is a recursive operator if there is a computable function (z, x) such that'for all fe Fy and xeN", yeN10 Effective operations on partial functions 184 O(Plx)~y iff there is finite 0 f such that (4, x)~y. (Note that o is not required to be total.) 1.2. Example ‘The operator (/)=2/ is recursive operator: to see this define b(z.x) by 20(x) itz = Gand xe Dom(@), #2)" Lundefined otherwise. By Church’ thesis, 6 is computable: now for any f, x, y we have (Px) ~y $2 x= Domif) and y =2ftx) ¢> there is @< f with x F, be an operator. (a) @ is continuous if for any fé Fy, and all x, O( f(x) =y iff there is finite @ Fq be a recursive operator, with computable funetion 4 as required by the definition. Suppose that (/)(x) = y, and let Of such that 4(6,x)=y. Since @<8, it follows immediately that (0x) = y. Conversely if 6 f and ®(8)(x)~ y, there is 8, < @ such that 6(d;, x)= yi but then @/, 50 we have that (f(x)=y. Hence @ is continuous. Monotonicity follows directly from continuity: suppose that f< g and P(N(a)~y. Take @Sf such that P(O)(x)~y; then 9c, so by continuity, ®(g)x)=y.1 Recursive operators 185 The use of the term continuous to describe the property 1.3(a) is justified informally as follows. Suppose that : FF, satisfies 1.3(a) and fF. Then given any x1,... 34 for which @(f)(x,) (1=/=k) are defined, using 1.3(a) we can obtain a finite @=/ such that P(6)(x:) = (fix) (1Si F, by D(/)=gef. Obviously ® is continuous, and 4 (6, x) ~ g(6()) is computable. (d) (The Ackermann operator). Let ®: F,-> #2 be given by O(N10,y)=y +1, (Pix +1,0)=Fle 1), D(x +1, y+ 1)= Fs fle #L, yD). To see that # is continuous, note that (f)tx, y) depends on at ‘most two particular values off. For recursiveness, itis immediate by Church's thesis that the funetion @ given by $6.0, y)=y41 (6, x+1,0)~6(x,1) OO x+1, y+ 1)~ Ox, Ax +1, 9) is computable. (e) (The p-operator.) Consider @: Fyu1>Fqy given by P(filx)=ny( fix, y)=0). It is immediate that this operator is continuous, and that the funetion @ given by $16.) =ny(O(x, ») = 0) is computable.1 Recursive operators 187 ‘When the definition 1.1 of arecursive operator : FF; isextended to the case n=0, we have what is called a recursive functional. The members of Fo are O-ary functions; ie. constants. Just as F, (n= 1) includes the function that is defined nowhere, Fo includes the “undefined” constant, which is denoted by @. Thus %=Nu{o}, and an operator ©: Fy, Foisa recursive functional if there is a computable function (x) such that for any f¢ Fy, and y € Ns O(f\~y iff 30/0 Sf and 6(4)=y). We write 0(f)=a if P(/) is undefined; this emphasises that @ is still ‘thought of as being a total operator. We should point out that in some texts the term partial recursive functional F,,-> F, is used to describe recursive operators, including the case n =0. In such contexts the word partial describes the kind of object being operated on rather than the domain of definition of the operation. ‘We shall not discuss here the extension of the ideas of this section t0 partially defined operators and the corresponding partial recursive opera~ tors ©: Fy» Fq. The reader is referred to Rogers [1967] for a full discussion of these and related matters. 17, Exercises 1, Show that the following operators are recursive, (a) O(=F (fe Fu, (b) O(f)=g (fe Fah where g isa fixed computable function in Fy (c) @(f)=feg (fe Fx) where ¢ isa fixed computable function in S, define (d) Let he Fs be a fixed computable fun DF. Fas BY 0 thle y)=0, {fix+1,y)+1 if h(x, y)is defined and +0, ‘undefined otherwise (The significance of this operator will be sen Inter.) 2. Prove that if @ is «recursive operator and/ is computable then so is Of). 3. Decide whether the following operators @:F1>F: are (i) monotonic, (i) continuous, (i) recursive ffix) if Domi) isfinite, (2) 9.8) ndetaed item) nine Pls)8. 10 Effective operations on partial functions 188 0 if f(x) is defined, lundefined otherwise. Oit fix)eK] (©) @(Alx) fit faye K lundefined otherwise. fundefined if Dom(f) is finite, Yo if Dom({) is infinite. Suppose that ®:F,,— F, and W:F, +> F, are recursive opera- tors. Prove that W°@:F, » F, is recursive, Show how to extend the definition of recursive operator to include operators ®: Fp, Fy... Fm, > Fy and prove appropriate versions of theorems 1,4 and 1.5 for your definition. Prove that the following operators are recursive: (a) ®: FXG, >F, given by Hf, g)=fog (ct. question 1c above); (b) Fy. % Fysr> Fass given by 6) ene{ if f(x) is defined, (d) G(P\x)~4 0 if ht, y)=0, PUFA) y)={ fle+1, y)+1 if h(x, y)is defined and is not 0, undefined otherwise (cl. 1d above) (For those who know some topology.) (a) Prove that an operator is continuous in the sense of definition 1.3(a) iff it is continuous in the positive information topology. (b) Prove that the following are equivalent for Vc &, {) Vis open in the positive information topology, ii) fe V iff 30(6Sf and 8€ V), Let @: F,+F, and V: F, > F, be continuous operators; prove that Vo: F_ > F, is continuous. Let P(N) denote the class of all subsets of N; formulate a definition of a recursive operator @: (NN) > P(N) that parallels the notion of a recursive operator from #;-F;. Frame and Prove theorems corresponding to theorems 1.4 and 1.5. (Hint, The question of membership x€ (A) should depend effectively on @ finite amount of positive information about membership of the set A.) (Effective operators P(N)-+ P(N) are called enumeration operators and are discussed in full in Rogers [1967].)2 Effective operations on computable functions 189 2. Effective operations on computable functions In chapter 5 §3 we considered that certain operations on computable functions should be called effective because they can be given by total computable functions acting on indices. For instance, in example '5-3.1(2) we saw that there is a total computable function g such that for all €€N, (6-)° = bee ‘We shall see in this section that any recursive operator ®, when restricted to computable functions, yields an effective operation of this kind on indices. This is the first part of a theorem of Myhill and Shepherdson. They proved, moreover, that all such operations on indices of computable functions arise in this way. We shall prove the two parts of the Myhill-Shepherdson result separately, taking the easier part first. 2.1, Theorem (Mybill-Shepherdson, part 1) Suppose that ¥: F > Fy is a recursive operator. Then there is a total computable function k such that vis" Proof. Let ¥ be a computable function showing that ¥ is a recursive operator according to definition 1.1. Then for any ¢ we have ohn (ee). VSL” )ix)= y @ 3019 SH” and YG, x)~y). ‘We shall show that the function g defined by gle) = LV) is computable, by showing that the relation g(e, x) ~y is partially deci- dable. To this end, consider the relation R(z, e, x, y) given by Rlz,e,x, y) = 46(z =0 and 6.62” and YG, x)=y). ‘Then R is partially decidable, with the following informal partial decision. procedure. (1) Decide whether z = 4 for some 8; if so obtain x,..., IN" and ys, +» 9x such that Dom(@) (1sisk);then (2) for compute #2""(x,):if, for 11k." defined and equals ye then (G) compute u(z, x) and if defined check whether it equals y. IER(z, ¢,, y) holds, this is a mechanical procedure that will tell uso in finite time, as required. ty vos Re} and BC) = Yi (x) is10 Effective operations on partial functions 190 Since R(z,eay) is partially decidable, so is the relation 32 R(z,¢, x, y) (by theorem 6-6.5): but Bz Riz, €, x, y) € Wd," )(x)~ y (from the definition of R) gle,x)~y (from the definition of g), ‘Thus g(e, x) ~ y is partially decidable, so by theorem 6-6.13 g is comput- able. Now the s-m-n theorem provides a total computable function h such that phthie)=elex) = Worx), from which we have #'%) = Wié!"). Notice that the function h given by this theorem for a recursive operator VF,» F; is extensional in the following sense. 2.2. Definition A total function h:N->1N is extensional if for all a, if 6, then ya Now we can state the other half of Myhill and Shepherdson’s result. 23. Theorem (Myhill-Shepherdson, part It) Suppose that h is an extensional total computable function. Then there isa unique recursive operator Y such that W\d,)= dy foralle. Proof. Atte heat of our proof Hes an application of the Rice Shapiro. | theorem (theorem 7-216. | Leth be an extensional total computable function. Then h defines an operator Wo: 6; > €, by Vode) = dies ‘ois well defined since his extensional. We have to show that ther unique recursive operator Wi: = F that extends Vo First note that Yo(0) is defined for ll ite since fnite functions are computable, Thus any recursive operator extending Ys, being continuous, must be defined by (24) Wifilx)=y = 30(8 cf and ¥(8)(x)= y). So such @ Vit exists, 6 unique. To prove the theorem we must now show that (i) (2.4) does define an operator ¥, Gi) Wenends Ye |2 Effective operations on computable functions 191 ii) V is recursive, We first use the Rice-Shapiro theorem to show that Yo is continuous in the following sense: for computable functions f (2.5) Vol f\lx)=y €9 34(Sf and Wol6\(x)=y)- To see this, fix x, y and let sf ={fe€y: Yolfx)~y) Then the set A= (e:de€ sf) = (0: dy(t)~ y) isr.€.;50 by the Rice-Shapiro theorem, if fis computable then fed @ 36(0S/and Gest), which is precisely (2.5). Now we establish (i), i), (ii) above. (i) Let f be any partial function; we must show that for any x, (2.4) defines W(f\(x) uniquely (if at all). Suppose then that @),62¢/ and ‘Wo(0,)ix) —y1 and Yo(02)(x) ya: Take a finite function 0.2 91, 2 (Say, @ = f|Dom(9,)s Dom(6s)); by (2.5) yi= ol @sNx) = Vo(O))~ WolG}(4) = y2- ‘Thus (2.4) defines an operator ¥" unambiguously. (i) This is immediate from (2.5) and the definition (2.4, (Gi) We show that V satisfies the conditions of theorem 1.5. Clearly ¥ is continuous, from the definition. For the other condition we must show that the function y given by WG, x) ~ WAN), W(z, x) is undefined if 2 #6, is computable, Now itis easily seen by using Church's thesis that theres @ computable function c such that for any finite function 4, c(@) isan index for 6; ie. 8 = dey. Thus WG, x)= Hibs) = Sricinh3)o so vis computable, since h and c are, Hence W is @ recursive operator. Remarks 1. The proof of theorem 2.3 actually shows that for any extensional computable there isa unique continuous operator W: Fs F; such that Wg.) = buen all e, and that this operator is recursive. 2. Theorem 2,3 extends in a natural way to cover operators from Fn Fy. The proof is almost identical, using the natural extension of the Rice-Shapiro theorem to subsets of €q; see exercise 2.6(2) below.10 Effective operations on partial functions 192 26. Exercises 1, Suppose that , ¥ are recursive operators > F,; knowing that « ¥’is continuous (exercise 1.7(7)) use the two parts of the Myhill-Shepherdson theorem together with the first remark above to show that eV is recursive. 2 State and prove a general version of theorem 2.3 for operators from €q > €q. 3. Formulate and prove versions of the Myhill-Shepherdson theorem (both parts) appropriate for the operators you have defined (a) in exercise 1.7(5), (6) in exercise 1.7(8), 3. The first Recursion theorem | The first Recursion theorem of Kleene is a fixed point theorem for recursive operators, and is often referred to as the Fixed point theorem (of recursion theory). We shall see later that it isa very useful result B.A. The first Recursion theorem (Kleene) Suppose that ©: Fy. -> F» is a recursive operator. Then there is a computable function fe that is te least fied point of ®; Le (a) © fe)= fo () 7 O1g)=6, then foe. Hence, if fg is total, it is the only fixed point of @. Proof. We use the continuity and monotonicity of & to construct the least fixed point fp as follows. Define a ‘sequence of functions {f,} (nN) by fo fo (the function with empty domain), fun = O(f)- Then fo foSfis and il fu fur, by monotonicity we have that f..y Pf) S OUFnat)= fea. Hence fy & fury for all n, Now let fo= U fw by which we mean Folx)~y iff In such that fy(x)~y. We shall show that fo is a fixed point for & For all. n,3 The first Recursion theorem 193, hence furr= OU) = OUfo)s thus foS (fa). Conversely, suppose that (fe)(x)=y; then there is finite @< fo such that ®(6)(x) =; taken such that @ < fx; then by continuity 0 f.)(x That i, fues(t)= y: Hence falx)~ y. Thus ®(fo)< fox and so fe as required. ‘To see that fo isthe least fixed point of ®, suppose that (gg; then clearly fo fo &, and by induction we sce that fx 0; ° itx=0, (c) CC flx,y)) ifx>0. 2. (McCarthy) Show that the function m(x) given by 91 ifx 100, x10 otherwise, is the only fixed point of the recursive operator ® given by {ive if x= 100, xpi tn x-10 otherwise.10 Effective operations on partial functions 196 3. Suppose that @ and ¥ are recursive operators F; x Fi > Fi (in the sense you have defined in exercise 1.7(5)), Show that there is a least pair of functions f, g such that f= O(h8) a= (he) and f, g are computable. 4, Suppose that ©: %, x Fn» Fy is a recursive operator (in the sense you have defined in exercise 1.7(5)). For each ge Fy let Gp: F.-> F, be the operator given by Df) = Pf, g) Show that the operator W(g) =least fixed point of ©, is a recursive operator Fu, > Fr 4. Am application to the semantics of programming languages ‘We shall seein this section how the first Recursion theorem helps to resolve @ problem in the semantics of computer programming languages ~ the area that deals with the question of giving meaning to programs. Our discussion is necessarily given in terms of a general and unspecified programming language, but this is adequate to explain the basic idea. Suppose, then, that L is a general programming language. The basic symbols of L will have been chosen with a particular meaning in mind, so that the meaning of compound expressions built from them is also clear. We may then envisage a simple program for a function as follows. Suppose that r(x) is an expression of L such that whenever the variables x ae given particular values a, then z(a) can be unambiguously evaluated to the semantics of L. If we now take a function symbol f of L that does not occur in 7, then (4.1) faa)= 7) isa simple program fora function f, that has the obvious meaning: for any numbers a, f,(a) is obtained by evaluating the expression r(a) according to the semantics of L. Suppose now that 7 is an expression in which the symbol f does occur We indicate this by writing +(x). Then the program (4.1) becomes (42) fla)=rtf.2), Thisis now what is called a recursive program. Situations occur where this isthe most natural and economical way to describe a function that we may desire the computer to compute, Yet the meaning ofthe ‘program (4.2)is not entirely clear. The fundamental problem with any recursive program4 An application to programming languages 197 is: how do we give ita pre until this question is settled. There are basically two approaches that provide an answer to this question; (a) The computational approach. Here the function taken to be defined by a recursive program is given in terms of a method of computing it. This approach reflects the fact that the computer scientist needs to know not only what a program means, but also how to implement it. (b) The fixed point approach gives a meaning to a recursive program by an application of the first Recursion theorem. The fixed point theory also resolves some problems raised by the computational approach, and actually shows that the two approaches may be viewed as complementary rather than competing, Let us now briefly explain these two approaches and sce how first Recursion theorem enters the picture. meaning? It can hardly be called a program The computational approach This is best described by giving some examples. Consider the recursive program _p itr=0 43) fa)= 2flx-1) ifx>0. (We are assuming that in L we can formulate conditional expressions such as this.) Using the equation (4.3) we can formally evaluate the value /(3), for instance, as follows: f(3)=2% f(2) =2 2 f(1)=2x2*2xf(0)=8; here we have made successive substitutions and simplifications using the formal equation (4.3). Hence i fis the function deemed to be given by the program (4.3) we would have f.(3)=8. With more complicated recursive programs there may be more than fone way to use the formal equation f(x) = r(f,) in such an evaluation procedure. Consider, for instance, the recursive program 1 itx=0, flr-1, fle y)) ifx>0. ‘Suppose that we try formally to evaluate f(1, 0). We have (4.5) f4,0)=f(0, £11, 0). But now there is a choice of occurrences of f for which to substitute (4.4) flu y=10 Effective operations on partial functions 198 7(f,x). Choosing the leftmost one and simplifying we have £01, 0)~f(0, FL, 0))=1 (since x =0). If, on the other hand, we substitute for the rightmost occurrence of feach time, we obtain from (4.5) FC, 0)=f(0, £1, 0) ~f00, 0, f41, 0))) =F(0, FO, (0, f(1, 0)))= and in this case no ‘value for f(1, 0) emerges. A computation rule is a rule R that specifies how to proceed when confronted with such a choice of possible substitutions during any formal evaluation procedure. The computational rules we considered for the recursive program (4.4) were ‘leftmost’ (LM) and ‘rightmost’ (RM). ‘There are many other possible rules. For any computation rule R, and recursive program f(x)= 7(f,x) we define the function fn by: f(a) is ‘the value obtained when f(a) is formally evaluated using the rule R. If no value is thus obtained, f,e(a) is undefined. (Thus for the recursive Program (4.4) we have f..4(1, 0)= 1, and f.nyi(1, 0) is undefined.) So we see that each computation rule gives a meaning to any recursive rogram (and, at the same time, a method of implementing it) ‘The above example demonstrates that different computation rules may sive different meanings to any particular recursive program. The problem ‘now for the computer scientist who chooses this computational approach is to decide which computation rule to choose. Moreover, for any rule R, there isthe question of determining in what sense, if any, the function f.. satisfies the equation fa)=r(f.x). The fixed point approach, using the first Recursion theorem, avoids these problems, and in fact sheds light on both of them, as we shall see. The fixed point approach An expression r(f, x) of L gives rise to an operator b:F, > F, by setting Pig)lx)=r(g,x) for any g¢ F,. Morcover, in most programming languages the finite and explicit nature of the expression r(f,.x) ensures that @ is a recursive operator. The first Recursion theorem now tells us that ® has a compu- table least fixed point, which we may denote by f.. Thus we may define the function given by the program (4.2) as f,. This is quite reasonable, because f, is computable, and moreover we know that f,(x)~r(f,.x), which is surely what the programmer intended.4 An application to programming languages 199 ‘There remains the matter of finding good practical procedures for implementing the program (4.2) with its meaning defined in this way. It ‘can be shown that for any computation rule R, f,.e ¢f-; further, there are ‘computation rules R for which f.x = f- for all. Any one of these may be ‘chosen as a practical way of implementing recursive programs. Then we can say that the computational and fixed point approaches are comple- mentary rather than opposed to each other: the fixed point approach, via the first Recursion theorem, gives theoretical justification for the parti- cular computation rule chosen ‘There are further advantages in adopting the fixed point approach (or @ computation rule equivalent to it): there is a variety of useful induction techniques for proving correctness, equivalence, and other properties of recursive programs with fixed point semantics, and these can all be rigorously justified. For a full discussion of this whole topic the reader is referred to the books of Bird [1976] and Manna [1974]. Here we have slightly simplified the framework within which the computer scientist works; in fact the fixed point f, he chooses is least in a slightly different sense (but still given by a version of the first Recursion theorem).11 The second Recursion theorem The first Recursion theorem, together with the Myhill-Shepherdson theorem in the previous chapter, shows that for any extensional total computable function f there is a number n such that bp ‘The second Recursion theorem says that there is such an n even when fis ‘not extensional: we shall prove this in § 1 of this chapter. This theorem (and its proof) may seem a litte strange at first, Never- theless it plays an important role in more advanced parts of the theory of computability. We shall use it in the promised proof of Myhill’s theorem (theorem 9-3.5) and in the proof of the Speed-up theorem in the next chapter. In § 1, after proving the simplest version of the second Recursion theorem, we describe some applications and interpretations of it; § 2 is devoted to a discussion of the idea underlying the proof of the theorem, and other matters, including the relationship between the two Recursion theorems. A more general version of the second Recursion theorem is proved in § 3, and is used to give the proof of Myhill’s theorem. 1. The second Recursion theorem First let us prove the theorem, and then see how we can under- stand it 1.1, Theorem (The second Recursion theorem) Let be. total unary computable function; then there isa numbern such that bpm) = bn Proof. By the s-m-n theorem there is a total computable function s(x) such that for all x OD branienY = Fueald1 The second Recursion theorem 201 (If é.(2) is undefined, we mean the expression on the left of (*) to be undefined; alternatively, we can take the left of (*) to denote wol(be(2)) 9) Now take any m such that s= dq; rewriting (*) we have Spain) =baq¢00(9) ‘Then, putting x =m and taking m = dm(m) (which is defined, since dm is total) we have brm¥) = Oa) as required, 0 In spite of its appearance, for non-extensional functions f this is not a senuine fixed-point theorem: there is no induced mapping, > dyuy of computable functions for which $4 could be called a fixed point. However, we do have an induced mapping f* of programs given by PAUP.) = Pron ‘To expecta fixed point for /* in general would be too much: this would be ‘program P, such that f*(P,) and P, are the same; ve. f(n) =n. Butwhat theorem 1.1 saysis that there isa program P, such that /*(P,) and P, have the same effect (when computing unary functions);i.e. dy.) 4. Thus the second Recursion theorem is loosely called a pseudo-fixed point theorem; and for convenience, any number n such that dj .)= 4. is called a fixed point or fixed point value for f. “The second Recursion theorem is result about indices for computable functions; it may be thought therefore that the proof rests on some special feature of the particular numbering of programs that has been chosen. Inspection of the proof shows, however, that we used only the s-m-n theorem and the computability ofthe universal function; neither of these results depends in any essential way on the details of our numbering Moreover, theorem 1.1 can be used to establish the second Recursion theorem corresponding to any suitable numbering of programs; see exercise 1.10(9) below. There are various ways in which theorem 1.1 can be generalised, although the idea underlying the proof remains the same. In exercise 1.10(7) we have the generalisation to k-ary functions for k>1; in theorem 3.1 it is shown that a fixed point can be calculated effectively from various parameters that may be connected with f. ‘We continue this section with some corollaries and applications of the second Recursion theorem11 The second Recursion theorem 202 1.2. Corollary If fis a total computable function, there is a number n such that Wray Wa and Ey) = Exe Proof. UE dyn) ny then Whny= Wy and Exn) = 13. Corollary If f is a total computable function there are arbitrarily large numbers n such that bn) = bn: Proof. Pick any number k; take a number ¢ such that b.# bon bree bie Define a function g by ¢ =k, fix) ifx>k. Then g is computable; let m be a fixed point for g. If m=k, then en) = be ¥ by, 8 contradiction. Hence n> k, so fin)= gin) and n is a fixed point for. O sor{ (in exercise 1.10(8) we shall indicate how the proof of theorem 1.1 can be modified to obtain an increasing effective enumeration of fixed points for f) The following corollary summarises the way that the second Recursion theorem is often applied, in conjunction with the s-m-n theorem, 1.4. Corollary Let fx, y) be any computable function; then there is an index e such that ly) =fle, y). Proof. Use the s-m-n theorem to obtain a total computable funetion s such that dyco(y)~f(x, y); now apply theorem 1.1, taking ¢ as a fixed point for s. As simple applications of this corollary, we have LS. Examples (a) There is a number n such that 4,(x)= 2x", all x: apply corollary 1.4 with f(m, x)= x";1 The second Recursion theorem 203 (5) there is a number m such that Wy with fasi={ lundefined otherwise, in}: apply corollary 1.4 0 ity=x, obtaining an index m such that ¢,(y) is defined iff y=. ‘The second Recursion theorem received its name because, like the first Recursion theorem, it justifies certain very general definitions “by recur- sion’, Consider, for example, the following ‘definition’ of a function @., in terms of a given total computable function f' b= bp The function 4, is ‘defined’ effectively in terms of an algorithm for computing itself (coded by the number e). In spite of its appearance as a circular definition, we are told by the second Recursion theorem that there are computable functions ¢ satisfying such a definition. Itis often useful in advanced computability theory to be able to make an even more general definition of afunction d, ‘by recursion’ of the kind bx) = gle), where g is @ given total computable function, Again, think of 8, as defined’ effectively in terms of a code for its own algorithm. Then the second Recursion theorem, in the guise of corollary 1.4, makes this kind of definition meaningful also, We shall use this fact in the Speed-up theorem in the next chapter. ‘We continue this section with some further straightforward, but some~ times surprising, consequences of theorem 1.1. First, we show how itean bbe used to give a simple proof of Rice’s theorem (6-1.7). 1.6. Theorem (Rice). Suppose that Bex G, and let A={x:6,€f}, Then A is not recursive Proof. Leta A and be A.If A is recursive, then the function f given by fix {° iftxeA, > ifxea, is computable, Further, f has the property that eA @ f(x) A, forall x (On the other hand, by theorem 1.1, there is a number n such that bin) = by, 80 fine A & me A, a contradiction.11 The second Recursion theorem 204 Another application of the second Recursion theorem shows, as prom- ised in chapter 4 §2, that the ‘natural’ enumeration of computable functions without repetitions is not computable. 1.7. Theorem Suppose that fs a total increasing function such that (a) ifm An, then bm) rin (8) flr) is the least index of the function dua. Then fis not computable. Proof. Suppose that f satisfies the conditions of the theorem. By (a), f cannot be the identity function, so there must be a number k such that fon (nek), whence, by (6) bam Abn (nZk), On the other hand, iff is computable, then by corollary 1.3 there is a number n= k such that 4yi.)= qa contradiction. Applications of the second Recursion theorem such as the following can be interpreted in anthropomorphic terms. Let P be a program. We can regard the code number y(P) as a description of P. We could regard the program P as capable of self- reproduction if for all inputs x the computation P(x) gave as output its ‘own description, y(P). At frst glance, it would seem difficult to construct, a self-reproducing program P, since to construct P we would need to know y(P), and hence P itself, in advance. Nevertheless, the second Recursion theorem shows that there are such programs, 1.8. Theorem There is a program P such that for all x, P(x) ¥(P); ie. P is self-reproducing. Proof. Ifwe write n for y(P), the theorem says that there is a number such that u(x) n (for all x) ‘To establish this, simply apply corollary 1.4 to the function f(m, x) = m O We turn now to psychology! Recall the notation and terminology of chapter 5. There we defined a total computable function oe, x, ) that1 The second Recursion theorem 205 codes the state of the computation P(x) after 1 steps; oe, x, #) contains information about the contents of the registers and the number of the next instruction to be obeyed at stage ¢. It is clear, then, that complete b(n) ae Proof. The reader should not be surprised to find that fis obtained by a diagonal construction. The essence of the construction isto ensure that if ‘(m)=(m) for infinitely many values m, then f differs from d; at one of those values. We define f by recursion as follows. At cach stage m in the construction of f we shall either define an index 4 or decide ina finite amount of time that i, is to be undefined. We then censure that f(x) differs rom @, (n) if i is defined. In detail, assuming that £10), -. fl) have been thus defined, we put (uili (m) for almost all m. Suppose tem ha fw) 6m) for intel many m Let p= Lemke ndcnedandl, b(n) for all m; this is because for any f we can always write a program that computes f quickly for some particular value a, simply by specifying the value of f(a) in a preface to the program. For example, suppose that f(a)=1; let F be a program that computes f: Then the program F’ based on the flow diagram in fig. 12a also computes . Clearly we have fp(a)=a+3, Thus, if 6 is a computable function such that b(x)> x +3 for some x, then we cannot obtain the conclusion of theorem 1.4 with f6(n)>8(n) for all n, Using a similar idea we can write a program that computes f quickly for any given finite number of values: see exercise 1.8(1) below. This shows that {.(n)> b(n) ace. is the best possible conclusion in theorem 1.4. Other computational complexity measures There are many other natural ways to measure the complexity of a computation, of which the following are a few examples. For simplicity we restrict our discussion to unary computations. Fig. 120 a-R;12 Complexity of computation 216 15. Examples 1 (number of jumps made" in executing P.(2), a6 + P(e, undefined otherwise, This measure is closely associated with the number of loops performed when executing P,(x), which is in turn related to the time of computation «(x). 2 the maximum number held in any of the registers at any time during the computation P.(x) x)= iP, undefined otherwise ‘This measure obviously relates to the amount of storage space needed to carry out the computation P,(x) on a real computer. 3. With the Turing machine approach, two natural complexity ‘measures are (i) the number of steps needed to perform a Turing, computation and (i) the amount of tape used to perform a computation. In general, an abstract computational complexity measure (for unary computations) is defined to be any collection of functions ®, having the abstract properties that were given by lemma 1.2 for t. 1.6. Definition A computational complexity measure is a collection of functions ©, with the following properties: (a) Dom(#,) = Dom(4,), for all e; (b) The predicate “(x)= y" is decidable. 17. Lemma The functions given in examples 1.5 above are computational complexity measures. Proof. We give sketch proofs for the examples 1.5(1) and 1.5(2), leaving 1.5(3) as an exercise (1.8(3) below). In each case itis only part (b) of definition 1.6 that requires any thought. (1) To decide “(x)= y', where ®, (x) = number of jumps made during P.(x), Suppose that P, has s instructions; then at most s " Wemean here that ifa jump instruction Irs) 8 encountered, then ajump (to 14) is made ifr =r: But not otherwise,1 Complexity measures 27 consecutive steps of P,(x) can be performed without making a jump. So run P.(x) for up to 1+ (y+ 1)s steps. If P,(x) stops in fewer than this number of steps, then count the number of jumps made to sec if it is y, Otherwise (i. if P.(1r) has not stopped after 1+(y + D)s steps) Pe(x) will have performed at least y + 1 jumps, so we conclude that &,(x) # y. (2) To decide “®,(x) = y’, where &,(x) = maximum number held in any register during P.(x). Let w=p(P,), and consider all possible non-halting states under the program P, with Piyevevtu Sys There are s(y +1)" such states that are distinct Run P.(x) for up to 1+ s(y +1)" steps. If Pe(x) stops after this number of steps or fewer, then find the maximum number that hhas occurred in any of the registers and see if it is y. Otherwise (if P(x) has not stopped) one of two possibilities will have occurred: (i) the computation has been in the same state on two separate ‘occasions, so P,(x) is in a loop and ®,(x) is undefined: (i) there thas been no repetition of states, in which case some register has contained a number greater than y. In both cases we conclude that &.(x)4y. 0 Note that in proving theorem 1.4 we used only the properties of given by lemma 1,2. Thus theorem 1.4 holds for any computational complexity measure, There are many other results in complexity theory which do not depend on any particular measure of complexity. Such results are said to bbe machine independent. The Speed-up theorem of the next section and. the Gap theorem of § 3 are further examples of such results. 18. Exercises 1. Let f be a total computable function that takes only the values 0, 1. Show that for any m there is a program F for f such that telx) 52x -+3 for all xm, Deduce that if b is a computable function such that A(x) >2x +3, then the restriction to almost all, nn in theorem 1.4 cannot be improved. 2. Let ®, be the complexity measure given in example 1.5(2). Show that whenever d,(2) is defined, then ®.(1r)=max(x, $e(t)). Let f be any total computable function, and let X be a finite subset of Dom(f), Prove that there is a program P, for f that is the best possible on X (for this measure); ie. @(t)= max(x, d(x) for xX.2. 12 Complexity of computation 218 3. For the complexity measures given in example 1.5(3), verify Jemma 1.6, expressed in the following terms. For any Turing machine M, let fy be the unary function computed by M. Then show that (a) Dom(®yq) = Dom( far), (6) “@ye(x) y"is decidable ( when ‘the number of steps taken in computing fa(x) uy iff fre(x) is defined, undefined otherwise. (i) when the length of tape actually used” in the out |sertal if fu(x) is defined, undefined, otherwise. 4. Suppose that &,(x) and W(x) are two abstract computational complexity measures. Show that ®, and W. are recursively related in the following sense: there isa recursive function r such that for anye Vln) = rin, @e(o)) and &,(n)=r(n, We(n)) for almost all n for which ®,(n) and W.(n) are defined. (Hint. Consider the function r defined by rin, m) = max{@.(n), Welt): sn and &,(n)=m or ¥,(n)=mb,) Show further that if ®,(n), ¥.(n)=n whenever defined, there is a recursive function r such that ¥e(rr)=r(B,(n)) and @.(n) = 7(¥.(n)) whenever ®,(n) and ¥;(n) are defined. ‘The Speed-up theorem Suppose that P and Q are programs for computing a total function f, such that for any x 2to (x) < tala) We would naturally say that Q is more than twice as fast as P, One instance of the Speed-up theorem tells us that there is a total function f with the following property: if P is any program for f, then there is another program for f that is more than twice as fast on almost all inputs. ‘Thus, in particular, there can be no best program for computing f. * Wesay that square onthe tape is used if itis seanned during the computation or lies between the outermost non-blank squares onthe intial tape lineliding these ‘outermost squares)2 The Speed-up theorem 219 ‘The Speed-up theorem will give speed-up by any preassigned (computable) factor: the example above represents speed-up by a factor of 2, given by the computable function r(x)=2x. The proof of this theorem is probably the most difficult in this book. First we prove a pseudo-speed-up theorem, which contains most of the work. The Speed- up theorem then follows quite easily. 2.1. The pseudo-Speed-up theorem (Blum) Let r be a total computable function, There is a total computable function f such that given any program P, for f, we can find a P, with the properties (a) 6 is total and d(x) =flx) ae (8) rUG(x)) v we have Co, S{u,u+1,...,2—1}, and hence Cp, ‘This means that @(0, x)= g(x) for x>v. Thus golx)= ae. B02)2 The Speed-up theorem 221 (c) Suppose that i is an index for f; taking j=s(e, (+1) we have that 4, = bjeis1) = Si+1 (from above), $0 jis an index for g..s. We can prove that yl) =e) i If this were not the case, then / would have been cancelled in the definition of g(0, x) for some x >i; i. there would have been x >i with i € Co,.. But then, by construction of g, we would have (0, x) 6x), a contradiction. This completes the proof. Note that the pseudo-Speed-up theorem is effective: given a program P for f we can effectively find another program that computes f almost everywhere, and is almost everywhere faster than P. ‘We now show how to modify the above proof to obtain 2.2, The Speed-up theorem (Blum) Letrbe any total computable function. There isa total computable Function fsuch that, given any program P, for, there is another program Py for f such that r(y(x)) <1(x) ae. Proof. We may assume without any loss of generality that r is an increasing function (or else replace r by a larger increasing computable function), First, by a slight modification of the proof of theorem 2.1 we obtain a total computable function f such that given any program P, for f, there is a program P, such that (a) 6; is total and 4,(x)=/0) ae, (8) rlgtx) +x) <0) ac. To do this, simply rewrite the definition of C,. replacing *... and 142) $ rtyoier (2) By «and 414) r(byosens(t)+)), We shall show that the function f so obtained is the function required by the theorem. Suppose then that f=, and j is chosen with the properties (a), (4) above. Our aim now is to modify P, 10 produce a program Py. that computes f for ail x. Suppose that d)(x)= (x) for all x >, Let flm)= Dy for m=e. We modify P, by writing some extra instructions at the beginning designed to give these values for m =v. Specifically, let P= be the program that embodies the flow diagram given in fig. 126. Clearly Pj- computes f; moreover, there isa number ¢ such that the extra instructions add at most c steps to any computation; ic. for all x tlasyix+e.12 Complexity of computation 222 Fig, 126, Speed-up from pseudo-Speed-up. o> Yes Gan, Se ‘Thus we have rlt(x))-Sr(Gj(x)+e) (since r is increasing) Sri (x) +x) forx ze b(x) forall x, we would naturally expect that Cy. contains some new functions not in G,, especially if 6'(x) is much larger than b(x). The next theorem shows that this intuition is false: we can find 4, b° with b’ greater than b by any preassigned computable factor, such that ©, = G,; in fact, the theorem shows that b, 6’ can be chosen so that there is no running time #<(x) that lies between 6(r) and 6'(x) for more than finitely many x. Thus the theorem is called the Gap theorem, 3.1. The Gap theorem (Borodin) Let rbe a total computable function such that r(x)= x. Then there is @ total computable function b such that (a) for any e and x>, if te(x) is defined and 1,(x)=b(x), then tex) > r(x); hence () Gy = Gow Proof. We define 6(x) informally as follows. Define a sequence of numbers ko e and {(x) = B(x); by construction of B(x), we have f(x) (B(x), r(b(x))}. Hence fe(x)> r(b(x)), > By the imerval [c,d] we mean the set of natural numbers (rie 6(3) infinitely often (otherwise f G,). This clearly contradicts (a), Hence €,=C,.. O Note. This proof is based on that given by Young [1973]. Itis easy to see that the function 6 in the theorem can be made larger than any pre~ assigned computable function c, simply by setting ko=c(x) instead of ko=0/in the proof. Itis also clear from the proof that the Gap theorem is machine independent. 4. The elementary functions In this final section we introduce the class of elementary functions as an ‘example of a class of computable functions that can be characterised very neatly in terms of the complexity classes corresponding to time of computation, The elementary functions form a natural and extensive subclass of the primitive recursive functions, as we shall see. They have been studied in some depth, and are of interest in their own right, quite apart from complexity theory, 4.1. Definition (a) The class of elementary functions is the smallest class such that aqxe Gln) (i) the functions x +1, UU. y) snr sy(xsg((x(z +1)+y)=0), (ii) rm. em(x, y)= yx atte, y). Gv) Px Assuming that the function Pr(x) (the characteristic function of ‘x is prime’) has been proved elementary, we have P. = Hy =2” (x =Oor y is the xth prime) -122"(e= 5 m)) may s2"(|— ¥ prizi|=0). (The bound p, =2” is easily proved by induction, using the fact that esr SPyps... Px #1.) We leave the proofs for the other functions as an exercise for the reader.4 The elementary functions 227 We now show that & is even closed under definitions by primitive recursion, provided that we know in advance some elementary bound on the funetion being defined by the recursion equations. 4.4. Theorem Let f(x) and g(x, y, 2) be elementary and let h be the function defined from f. 8 by A(x, 0) = fla), Ux, 941) = ela, y6 ACY). Suppose that there is an elementary function B(x, y) such that h(x, y)= x.y) forall x,y. Then h is elementary. Proof. Fixx, y; then the calculation of h(x, y) in the usual way requires the calculation of the sequence of numbers h(x, 0), (x, 1)... (8,9) These can be coded by the single number s where: péeanghiat) hiss) = T] pit = ele, »), say, where c(x, y) is an elementary function. The key facts about s are () (r= Als, O)= fla), (id) for 2 dalk+2), so there is no k such that f(x) t] 28 x+y cutoff subtraction 36Notation 242 sax), 5B) signum functions 36 rm(x, y), qt(x, ») remainder and quotient functions 36,37 wz You might also like
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good LifeFrom EverandThe Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good LifeRating: 4 out of 5 stars4/5 (5985) The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You AreFrom EverandThe Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You AreRating: 4 out of 5 stars4/5 (1112) Never Split the Difference: Negotiating As If Your Life Depended On ItFrom EverandNever Split the Difference: Negotiating As If Your Life Depended On ItRating: 4.5 out of 5 stars4.5/5 (898) Grit: The Power of Passion and PerseveranceFrom EverandGrit: The Power of Passion and PerseveranceRating: 4 out of 5 stars4/5 (619) Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space RaceFrom EverandHidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space RaceRating: 4 out of 5 stars4/5 (932) Shoe Dog: A Memoir by the Creator of NikeFrom EverandShoe Dog: A Memoir by the Creator of NikeRating: 4.5 out of 5 stars4.5/5 (546) The Hard Thing About Hard Things: Building a Business When There Are No Easy AnswersFrom EverandThe Hard Thing About Hard Things: Building a Business When There Are No Easy AnswersRating: 4.5 out of 5 stars4.5/5 (357) Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic FutureFrom EverandElon Musk: Tesla, SpaceX, and the Quest for a Fantastic FutureRating: 4.5 out of 5 stars4.5/5 (477) The Emperor of All Maladies: A Biography of CancerFrom EverandThe Emperor of All Maladies: A Biography of CancerRating: 4.5 out of 5 stars4.5/5 (275) The World Is Flat 3.0: A Brief History of the Twenty-first CenturyFrom EverandThe World Is Flat 3.0: A Brief History of the Twenty-first CenturyRating: 3.5 out of 5 stars3.5/5 (2272) The Yellow House: A Memoir (2019 National Book Award Winner)From EverandThe Yellow House: A Memoir (2019 National Book Award Winner)Rating: 4 out of 5 stars4/5 (99) Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New AmericaFrom EverandDevil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New AmericaRating: 4.5 out of 5 stars4.5/5 (270) A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True StoryFrom EverandA Heartbreaking Work Of Staggering Genius: A Memoir Based on a True StoryRating: 3.5 out of 5 stars3.5/5 (232) Team of Rivals: The Political Genius of Abraham LincolnFrom EverandTeam of Rivals: The Political Genius of Abraham LincolnRating: 4.5 out of 5 stars4.5/5 (235) We Have Lost Even An Analysis of Pablo NerudaDocument2 pagesWe Have Lost Even An Analysis of Pablo Nerudaapi-406099947No ratings yet On Fire: The (Burning) Case for a Green New DealFrom EverandOn Fire: The (Burning) Case for a Green New DealRating: 4 out of 5 stars4/5 (75) The Unwinding: An Inner History of the New AmericaFrom EverandThe Unwinding: An Inner History of the New AmericaRating: 4 out of 5 stars4/5 (45) Sri Lalitha Ashtothara SathanamavaliDocument8 pagesSri Lalitha Ashtothara Sathanamavaliiyer34100% (3) The Art of Ordinal Analysis: Michael RathjenDocument25 pagesThe Art of Ordinal Analysis: Michael RathjenKarl AnderssonNo ratings yet Plotkin. Lambda - Definability in The Full Type HierarchyDocument11 pagesPlotkin. Lambda - Definability in The Full Type HierarchyKarl AnderssonNo ratings yet Odd Nordland - A Critical Look at The CENELEC Railway Application StandardsDocument7 pagesOdd Nordland - A Critical Look at The CENELEC Railway Application StandardsKarl AnderssonNo ratings yet The Yellow WallpaperDocument21 pagesThe Yellow WallpaperKarl AnderssonNo ratings yet Kreisel 1976 BewesitheorieDocument49 pagesKreisel 1976 BewesitheorieKarl AnderssonNo ratings yet PPN379931524 0016 Log 0001Document192 pagesPPN379931524 0016 Log 0001Karl AnderssonNo ratings yet Unfold FaDocument40 pagesUnfold FaKarl AnderssonNo ratings yet Hilbert's Program RevisitedDocument22 pagesHilbert's Program RevisitedKarl AnderssonNo ratings yet Untersuchungen Über Das Logische Schließen IDocument36 pagesUntersuchungen Über Das Logische Schließen IKarl AnderssonNo ratings yet Letters of J.R.R. TolkienDocument81 pagesLetters of J.R.R. TolkienmilithebillyNo ratings yet Gnomish LexiconDocument76 pagesGnomish LexiconKarl Andersson100% (1) David Hilbert and Paul Bernays Grundlagen Der Mathematik I and IIDocument35 pagesDavid Hilbert and Paul Bernays Grundlagen Der Mathematik I and IIKarl Andersson100% (1) Natural LogicDocument104 pagesNatural LogicKarl Andersson100% (1) Halmos - Naive Set TheoryDocument110 pagesHalmos - Naive Set TheoryBrandy GambyNo ratings yet Tennant NaturalismDocument23 pagesTennant NaturalismAlan BakerNo ratings yet Rev MaddenDocument7 pagesRev MaddenKarl AnderssonNo ratings yet Gifted ChildrenDocument16 pagesGifted ChildrenSneh ParbhatNo ratings yet Basics of PanchangaDocument23 pagesBasics of PanchangaChandan Singh0% (1) 10 - Locating and Collating Translated Short Stories of Rabindranath Tagore - Swati DattaDocument18 pages10 - Locating and Collating Translated Short Stories of Rabindranath Tagore - Swati DattaMd Intaj AliNo ratings yet Foundations of Curriculum Development: Lesson 4Document19 pagesFoundations of Curriculum Development: Lesson 4Sergio R. ManugasNo ratings yet Fil PsychDocument6 pagesFil PsychAnnie Ofo-obNo ratings yet Antecedents and Consequences of Sustainable Human Resource ManagementDocument4 pagesAntecedents and Consequences of Sustainable Human Resource ManagementMubashir AnwarNo ratings yet Class Observation # 1Document3 pagesClass Observation # 1RDRI100% (1) Rhetorical Analysis Final DraftDocument3 pagesRhetorical Analysis Final Draftapi-471696658No ratings yet Report On English WeekDocument10 pagesReport On English WeekMaslan MasuariNo ratings yet History of Latin Christianity (A)Document570 pagesHistory of Latin Christianity (A)siggalt100% (1) Imaginary Homelands Revisited in Kazuo IshiguroDocument11 pagesImaginary Homelands Revisited in Kazuo Ishiguromleaze100% (2) 2110002-CS - 26092017 - 061408am PDFDocument129 pages2110002-CS - 26092017 - 061408am PDFNasir KhanNo ratings yet WRITING B1-CẤU TRÚC TỰ SOẠNDocument3 pagesWRITING B1-CẤU TRÚC TỰ SOẠNpthuynh709No ratings yet Instructional Lesson Plan #3 - Wangari Maathai Reading Language Arts Grade: 05 Unit Title: Earth - A Fine BalanceDocument14 pagesInstructional Lesson Plan #3 - Wangari Maathai Reading Language Arts Grade: 05 Unit Title: Earth - A Fine BalanceSilvia MontesNo ratings yet New Microsoft Word DocumentDocument3 pagesNew Microsoft Word Documentadenur 77100% (1) Tone Audio 044Document89 pagesTone Audio 044kilimandzaro70No ratings yet Monster Hunters On Main StreetDocument20 pagesMonster Hunters On Main StreetTiurNo ratings yet Chapter 7Document13 pagesChapter 7Keena Joy Awisan - PinasNo ratings yet bk9 3 PDFDocument0 pagesbk9 3 PDFBasit FarooqNo ratings yet Merton Abbey Primary School: Summary of Key Findings For Parents and PupilsDocument9 pagesMerton Abbey Primary School: Summary of Key Findings For Parents and PupilsVanessa MatthewsNo ratings yet Nursing ResearchDocument37 pagesNursing ResearchGodfrey FrancoNo ratings yet Lesson Planning FilipinoDocument4 pagesLesson Planning FilipinoKhevin De CastroNo ratings yet On Swami VivekanandaDocument17 pagesOn Swami VivekanandaKaran ChoudharyNo ratings yet Ethics Reviewer 1Document4 pagesEthics Reviewer 1JEROME MICHAEL LAZARONo ratings yet Identifying Forces LabDocument2 pagesIdentifying Forces LabKelli Yukiko Quan-MartinNo ratings yet Presentation IkeaDocument24 pagesPresentation IkeaEl SalvadorNo ratings yet Guide To Kulchur 1938Document374 pagesGuide To Kulchur 1938Jonathan CarsonNo ratings yet SEN301Document76 pagesSEN301shyrazkhanNo ratings yet