A safe recursion scheme for exponential time

Report 0 Downloads 46 Views
A safe recursion scheme for exponential time Peter Clote Abstract

Using a function algebra characterization of exponential time due to Monien [5], in the style of Bellantoni-Cook [2], we characterize exponential time functions of linear growth via a safe course-of-values recursion scheme.

1 Introduction In 1991 [2], S. Bellantoni and S.A. Cook characterized the class FP of polynomial time computable functions as the smallest class of functions containing certain initial functions, and closed under safe composition and safe recursion on notation. In 1965, A. Cobham had earlier characterized FP in a similar manner using composition and bounded recursion on notation, where f is de ned by bounded recursion on notation from g, h0 , h1 , k, if f (0; ~y) = g(~y) f (2x; ~y) = h0 (x; ~y; f (x; ~y)); if x 6= 0 f (2x + 1; ~y) = h1 (x; ~y; f (x; ~y)); provided that f (x; ~y)  k(x; ~y). In addition to removing an initial function required by Cobham for polynomial growth rate, the novelty of the Bellantoni-Cook construction was to remove the bounding requirement f (x; ~y)  k(x; ~y) by imposing a syntactic restriction on the manner in which variables can be used in the recursion | variables are either normal or safe, whereby only normal variables can be used as the principal variable x in a de nition by recursion in f (x; ~y). Since publication of the Bellantoni-Cook characterization of polynomial time, many function complexity classes have been similarly characterized by safe recursion schemes without a bounding requirement: linear space, levels of the polynomial time hierarchy, logarithmic space, NC (S. Bellantoni1 [1]; alternating logarithmic time and polylogarithmic time (S. Bloch [3]), and other classes. The purpose of this note is to similarly characterize the class of exponential time computable functions of linear growth.

2 Preliminaries Following [2], variables are designated as normal or safe and distinguished by their position in a function f (x1 ; : : : ; xn ; y1 ; : : : ; ym ) | variables xi occurring to the left of the semi-colon are normal, whereas the variables yi occurring to the right are  Research supported in part by NSF CCR-9408090 and US-Czech Science and Technology Grant 93-205. [email protected] Institut f ur Informatik, Ludwig-Maximilians-Universitat Munchen, Oettingenstrae 67, D-80538 Munchen, Germany. Key words and phrases: exponential time, safe recursion, function algebra 1 Linear space was characterized in a similar manner as well by W. Handley and independently D. Leivant.)

1

called safe. Often we will write normal variables as x; y; z; etc. and safe variables as a; b; c; etc. Following Bellantoni [1], de ne the following initial functions. 1. (0-ary constant function) 0, or more formally 0( ; ).  if 1  j  n n;m 2. (projections) Ij (x1 ; : : : ; xn ; a1 ; : : : ; am ) = xaj j ?n if n < j  n + m 3. (successor) S (; a) = a + 1  4. (predecessor) Pr(; a) = a0 ? 1 ifelsea > 0  a=0 5. (conditional) C (; a; b; c) = bc ifelse. We designate the collection of all projection functions by I , and de ne the function algebra [f; g; h : O1 ; O2 ] as the smallest class of functions containing the initial functions f; g; h and closed under the operations O1 and O2 . If F is a function algebra, then by F we denote the class of predicates whose characteristic function belongs to F . De nition 1 (Bellantoni [1]) The function f is de ned by safe composition (scomp) from g; u1; : : : ; un; v1 ; : : : ; vm if f (~x; ~a) = g(u1(~x; ); : : : ; un(~x; ); v1 (~x; ~a); : : : ; vm (~x; ~a)): The function f is de ned by safe recursion (sr) from functions g; h if f (0; ~y; ~a) = g(~y; ~a) f (x + 1; ~y; ~a) = h(x; ~y; ~a; f (x; ~y; ~a)): It is important to note that in safe composition, no function having safe variables may be substituted into a normal position of another function. Note that if f (x; y) is de ned, then scomp allows us to de ne g(x; y; ) = f (I12;0 (x; y; ); I22;0 (x; y; )) = f (x; y): Thus normal variables can be moved into safe positions, but not vice-versa. As well, note that in de ning f (x + 1; ~y; ~a), the previous value f (x; ~y; ~a) must be placed into a safe position in the function h. The intutition is that a safe variable cannot be used as the principal variable of an induction, and by constraining composition as above, the role played by a safe variable in a function is limited to composition. By ([0; I; S; Pr; C : scomp; sr] \ Normal) we denote the class of functions f (~x; ) having only normal variables, such that f belongs to the function algebra [0; I; S; Pr; C : scomp; sr]. Theorem 2 (Bellantoni [1]) The class E 2 of linear space computable functions equals ([0; I; S; Pr; C : scomp; sr] \ Normal): De ne the function m0 (0; x) = x m0 (y + 1; x) = Pr(; m0 (y1 ; x)) M (x; y; ) = m0 (I22;0 (x; y; ); I12;0 (x; y; )) Thus M (x; y; ) = x ?. y, where modi ed di erence (sometimes called monus) of x and y is 0 if x ? y is negative, else x ? y. The recursion scheme investigated in this paper is de ned as follows. 2

De nition 3 The function f is de ned from g; h; r by safe value recursion2 (svr)

if

f (0; ~y; ~a) = g(~y; ~a) f (x + 1; ~y; ~a) = h(x; ~y; ~a; f (x; ~y; ~a); f (M (x; r(x; ~y ; ); ); ~y; ~a)): This recursion scheme is the safe version of a scheme investigated by Monien [5] (see [6] or [4] for a presentation). Our use of the function M (x; r(x; ~y ; ); ) is to ensure that this argument is at most x.

3 Main result

De nition 4 Let F denote the class of functions f (~x) computable in exponential

time ETIME = TIME (2O(n)) on a multitape Turing machine, which are of linear growth rate, i.e.

j(f (x1 ; : : : ; xn )j  c  max(jx1 j; : : : ; jxn j) + d for constants c; d independent of ~x.

The main result is the following. Theorem 5 F equals ([0; I; S; Pr; C : scomp; sr; vsr] \ Normal):

Corollary 6 ETIME equals ([0; I; S; Pr; C : scomp; sr; vsr] \ Normal) The corollary is immediate from the theorem. The remainder of the paper consists of the proof of the theorem. Consider the direction from left to right. Suppose that L 2 ETIME , and that the Turing machine M = (Q; ; ?; ; q0; B; qa ; qr ) accepts L in exponential time, where 1. q0 ; qa ; qr 2 Q are respectively the initial, accepting and rejecting states; 2. B 62  is the blank symbol,  is the input tape alphabet, and ? is the work tape alphabet; 3.  is the transition function for M . For simplicity, assume that M has only one tape, and that the transition function  : (Q ? fqa ; qr g)  ( [ fB g) ! Q  ( [ fB g)  f?1; 0; 1g: W.l.o.g. we take Q; ; ?  N, B 2 N, and that q0 = 0. Since M is xed, using case statements, we can de ne a simple bijection 3 mapping Q  ( [ fB g) f?1; 0; 1g onto a nite set A = f0; : : : ; kM g of integers. Denote the inverse projection functions corresponding to 3 by 31 , 32 , and 33 . Clearly the transition function , as well as 3 and its inverse projections can be de ned by safe composition from C (; a; b; c); Pr(; a); S (; a); 0(; ), and we have

3 (; 31 (; d); 32 (; d); 33 (; d)) = d 2

This is a course-of-values recursion on two values.

3

for all d  kM . We may assume that  satis es (; q; ) = 3 (; newstate(; q; ); newsymbol(; q; ); direction(; q; )) for suitable functions newstate, newsymbol, direction de ned by newstate(; q; ) = 31 ((; q; )) newsymbol(; q; ) = 32 ((; q; )) direction(; q; ) = 33 ((; q; )): The initial con guration of M on input x = x1    xn is as follows:

B x1 : : : x n B

where M starts in state q0 on the leftmost tape square. W.l.o.g. we may assume that the head movements of M on any input are of the following form (if not, then an equivalent Turing M 0 with these head movements can be given which P2cn machine runs in time 2  i=0 i  2dn).

`````1 2 `````3 `````4 0s s

s s

5s

s

`````7 `````8`

6s

s

11s

`````13`

12s

s

s

10s

````9

s

````14`` ```15``` s

..

s

``16

s

The idea is to describe a function for the arithmetization of the computation of M P on input x. To this end, de ne g(n) = 2  i, and  (t) = max n  t[g(n)  t]. in Note that  (t) can alternately be de ned as min n  t[g(n + 1) > t]. De ne p(t) = min(t ? g( (t)); g( (t) + 1) ? t) and note that p(t) gives the position of M 's head at time t. De ne  if (8i < t)[p(i) 6= p(t)] `(t) = 01 + max i < t[p(i) = p(t)] else and note that `(t) is 0 if at time t, M 's head is on a tape square never visited before, while otherwise `(t) is the most recent time t0 < t for which M 's head visited the same tape square. Using svr, we will de ne f (t; x; ) = 3 (; s(t; x; ); a(t; x; ); b(t; x; )) (1) where s(t; x; ) is the state of M at time t before invoking , and a(t; x; ) is the symbol under M 's head at time t before invoking , and b(t; x; ) is the symbol which M writes upon invoking  at time t ; i.e. b(t; x; ) = newsymbol(; s(t; x; ); a(t; x; )): 4

To show that functions a; b 2 F , we introduce some auxiliary functions. De ne call that p (position), ` (last time), and M (x; y; ) = x ?. y have already been de ned. Functions `; p; jxj; msp; ?. and relation  are representable in F via functions having only normal variables (by applying Bellantoni's theorem, since these functions are in linear space). De ne h(t; x; c; d) by

msp(x; y) = bx=2y c, jxj = dlog2 x +1e (length of binary representation of x), and re-

3 (; newstate(; 31 (; c); 32 (; c)); a(t; x; ); b(t; x; )) where

8 if `(t) = 0 ^ p(t) > jxj jxj 3. newsymbol(; newstate(; 31 (; c); 32 (; c)); msp(x; jxj ?. p(t)), if `(t) = 0 ^ p(t)  jxj It follows that h(t; x; c; d) 2 F . Note that we do not claim that h can be written in the form h(; t; x; c; d). De ne r(t; ) = M (t; `(t; ); ), so that M (t; r(t; ); ) = t ?. r(t; ) = `(t; ) Using svr de ne

f (0; x; ) = 3 (; 0; B; nextsymbol(; 0; B )) f (t + 1; x; ) = h(t; x; f (t; x; ); f (M (t; r(t; ); ); x; ) = h(t; x; f (t; x; ); f (`(t; ); x; ) By induction on t, it is easy to verify that f (t; x; ) satis es Equation (1). We may suppose that the Turing machine M terminates its computation in q(x) ' 2cjxj steps, where q is a polynomial. Polynomials are clearly computable in linear space, so by Bellantoni's theorem q 2 F . It follows that M accepts input x i qa = 31 (; f (q(x; ); x; )): Using a simple case statement, we obtain that the characteristic function of L

belongs to F . Now if g 2 etime and jg(x)j = O(j~xj), then using standard techniques one can de ne g in F . This concludes the direction from left to right. Now consider the direction from right to left. We show by induction on term formation in the function algebra F that every function in F has linear growth rate and is computable in ETIME . The following lemma is a trivial modi cation of [1].

Lemma 7 For each f (~x; ~a) 2 F there is a monotone increasing polynomial pf such that for all ~x;~a f (~x; ~a)  pf (~x) + max(~a):

Proof: By induction on term formation in algebra F . If f is any of n P 0; Iin;m; S; Pr; C , then f (~x; ~a)  xi + max(~a). Suppose that f is de ned by i=1 scomp from g; u1; : : : ; um; v1 ; : : : ; vn

f (~x; ~a) = g(u1(~x; ); : : : ; um(~x; ); v1 (~x; ~a); : : : ; vn (~x; ~a)): 5

By the induction hypothesis, assume that there exist polynomials pg ; pui ; pvi such that g(y1; : : : ; ym ; b1; : : : ; bn )  pg (y1 ; : : : ; ym ) + max(b1 ; : : : ; bn)

ui (~x; )  pui (~x) vi (~x; ~a)  pvi (~x) + max(~a): Then

f (~x; ~a)  pg (u1 (~x; ); : : : ; um (~x; )) + max(v1 (~x; ~a); : : : ; vn (~x; ~a))  pg (pu1 (~x); : : : ; pum (~x)) + maxi (pvi (~x) + max(~a))  pg (pu1 (~x); : : : ; pum (~x)) + pv1 (~x) + : : : + pvn (~x) + max(~a):

If we de ne

pf (~x) = pg (pu1 (~x); : : : ; pum (~x)) +

n X i=1

pvi (~x)

then we have f (~x; ~a)  pf (~x) + max(~a): Now suppose that f is de ned by svr from g; h; r so that f (0; ~x; ~a) = g(~x; ~a)

f (t + 1; ~x; ~a) = h(t; ~x; ~a; f (t; ~x; a); f (M (t; r(t; ~x; )); ~x; ~a)): By the induction hypothesis, assume there exist monotone increasing polynomials pg ; ph such that g(~x; ~a)  pg (~x) + max(~a) h(t; ~x; ~a; b; c)  ph (t; ~x) + max(~a; b; c): De ne pf (t; ~x) = t  ph (t; ~x) + pg (~x): We show by induction on t that f (t; ~x; ~a)  pf (t; ~x) + max(~a): Now f (0; ~x; ~a) = g(~x; ~a)  pg (~x) + max(~a) = pf (0; ~x) + max(~a) so the base of the induction is established. Assume that f (t; ~x; ~a)  pf (t; ~x) + max(~a): Then f (t + 1; ~x; ~a) = h(t; ~x; ~a; f (t; ~x; ~a); f (M (t; r(t; ~x; ); ); ~x; ~a))  ph (t; ~x) + max(~a; f (t; ~x; ~a); f (M (t; r(t; ~x; ); ); ~x; ~a))  ph (t; ~x) + max(~a; pf (t; ~x) + max(~a); pf (M (t; r(t; ~x; ); ); ~x) + max(~a))  ph (t; ~x) + max(~a) + max(pf (t; ~x); pf (M (t; r(t; ~x; ); ); ~x))  ph (t; ~x) + max(~a) + pf (t; ~x) by monotonicity of pf  ph (t; ~x) + max(~a) + (t  ph (t; ~x) + pg (~x))  (t + 1)  ph (t; ~x) + pg (~x) + max(~a)  pf (t; ~x) + max(~a): 6

This establishes the claim when f is de ned by svr from g; h; r. In the case where f is de ned by sr from g; h f (t + 1; ~x; ~a) = h(t; ~x; ~a; f (t; ~x; a)) an identical argument establishes that f (t; ~x; ~a)  t  ph (t; ~x) + pg (~x) + max(~a) = pf (t; ~x) + max(~a): By induction on term formation in the algebra F , the lemma now follows.

Proposition 8 If f (~x; ~a) 2 F then f 2 etime and jf (~x; ~a)j = O(max (jxi j); max (jaj j)): i j Proof: From the preceding lemma, f (~x; ~a)  c  max(~x)k + max(~a) + d, for appro-

priate k; c; d, so the bound on jf (~x; ~a)j follows immediately. We show by induction on term formation that if f (~x; ~a) 2 F then f 2 etime. This is clearly true if f is any of 0; Iin;m; S; Pr; C . For functions g; u; : : : ; um; v1 ; : : : ; vn of linear growth rate which belong to etime, it is clear that f (~x; ~a) = g(u1(~x; ); : : : ; um(~x; ); v1 (~x; ~a); : : : ; vn (~x; ~a)) belongs to etime. If f is de ned from g; h; r by svr, where g; h; r belong to etime and are of linear growth rate, then by standard techniques the function F (t; ~x;~a) := hf (0; ~x; ~a); : : : ; f (t ? 1; ~x; ~a)i encoding the sequence of f 's previous values can be computed in time t  2cmax(jxi j;jaj j) + d which is bounded by 2c max(jtj;jxij;jaj j) + d0 : The proposition now follows. This concludes the proof of the theorem. 0

We end with the following open question whether there is a safe characterization of the class of rudimentary (coined constructive arithmetic by Smullyan) functions. De nition 9 Let comp denote the scheme of ordinary composition, and bmin to denote the scheme of bounded minimization. The class rf of rudimentary functions is [0; I; s; +; ; comp; bmin]. An equivalent de nition of rf is to replace bounded recursion by bounded minimization in Grzegorczyk's class E 2 . (See [4] for more information about such function algebras.) De nition 10 (S. Bellantoni) The function f is de ned by safe minimization (smin) from the function g, denoted f (~x; ~b) = s1 (a[g(~x; a; ~b) mod 2 = 0)]), if  ~ such exists, ~ f (~x; b) = 0s1 (minfa : g(~x; a; b)  0 mod 2g); ifelse. Question 11 Can one characterize rf by [0; I; S; Pr; C ; scomp; smin]?

4 Acknowledgements I would like to thank Karl-Heinz Niggl, and especially Thorsten Altenkirch for comments on this paper. Thorsten Altenkirch pointed out that the pairing function could be de ned by cases, since the function values are bounded in the case at hand. This observation is crucial to our proof. Finally, thanks to Irmgard Mignani for typing assistance. 7

References

[1] S. Bellantoni. Predicative recursion and computational complexity. Technical Report 264/92, University of Toronto, Computer Science Department, September 1992. 164 pages. [2] S. Bellantoni and S. Cook. A new recursion-theoretic characterization of the polytime functions. Computational Complexity, 2:97{110, 1992. [3] S. Bloch. Function-algebraic characterizations of log and polylog parallel time. Computational Complexity, 4(2):175{205, 1994. [4] P. Clote. Computation models and function algebras. In E. Gri or, editor, Handbook of Recursion Theory. North Holland, in preparation. [5] B. Monien. A recursive and grammatical characterization of exponential time languages. Theoretical Computer Science, 3:61{74, 1977. [6] K. Wagner and G. Wechsung. Computational Complexity. Reidel Publishing Co., 1986.

8