Characterizing Complexity Classes by Higher Type Primitive Recursive Definitions, Part II AndreasGoerdt Universi~t -GH- Duisburg Fachbereich Mathematik Fachgebiet Praktische Informatik Lotharstrasse 65 D-4100 Duisburg 1 West-Germany Helmut Seidl Fachbereich Informatik Universit~t des Saartandes Im Stadtwald D-6600 Saarbriicken 11 West-Germany ABSTRACT Higher type primitive recursive definitions (also known as G~del's system T) defining first-order functions (i.e. functions of type ind---~...~ind--~ind, ind for individuals, higher types occur in between) can be classified into an infinite syntactic hierarchy: A definition is in the n'th stage of this hierarchy, a so called rank-n-definition, iff n is an upper bound on the levels of the types occurring in it. We interpret these definitions over finite structures and show for n>l: Rank-(2n+2)definitions characterize (in the sense of [Gu83], say) the complexity class DTIME(expn(poly)) whereas rank-(2n+3)-definitions characterize DSPACE(expn(poly)) (here exp0(x ) = x, exp~+l(x) = 2~xp~(x~). This extends the results that rank-l-definitions characterize LOGSPACE [Gu83], rank-2-definitions characterize PTIME, rank-3definitions characterize PSPACE, rank-4-definitions characterize EXPTIME [Go89a]. 0. Introduction The characterization of complexity classes by considering definitional devices (logical formulas, programming languages, automata computing in an interpretation) in finite structures is a topic well known in the literature [Sa80, TiUr83, Gu83, Gu84, Ti86, Im87, Lei87, Go89a, Go89b]. In notation and results we build on [Gu83, Gu84, Go89a, Go89b]. Higher type primitive recursive definitions were introduced by G ~ e l in 1958 (see [Ba84], p. 568 ff for history and introduction). Their expressive strength when interpreted over 1N was studied (with a proof theoretical motivation in mind) in [Schw75, Te82]. The idea to interpret definitional devices using higher order objects in finite structures occurs several times in the literature. In [Im87] it is shown that second order logic plus transitive closure 149 characterizes PSPACE, Leivant [Lei87] introduces Turing machines with pointers to higher order objects computing in finite structures, Tiuryn [Ti86] characterizes iterated exponential space complexity classes by higher order arrays and iterated exponential time complexity classes by higher order stacks. We interpret higher type primitive recursive definitions in finite structures and get the unexpected alternation of time and space complexity classes as mentioned above. The results here should be contrasted with those in [Go89b] where we show for r~>0: general recursive definitions in higher types of rank n+l characterize DTIME(exp~(poly)). The results of the present paper are not obtained by a straight forward extension of the proof techniques from [Go89a]. Instead, we have to combine the methods of [Go89a] with the concept of "infinite terms" used in proof theoretical contexts. We learned it from [Schw75]. "Infinite terms" in the context of finite structures have the appearance of families of related terms: Instead of one term we consider one term for each structure. Moreover, we use an observation relating size and depth of terms before and after some (essentially ~-) reduction steps. In section 1 we introduce basic definitions and results. The results in section 2 are prerequisites to showing that primitive recursive definitions can be evaluated in the required time and space bounds. In section 3 we give our characterization of time complexity classes, in section 4 of space complexity classes. We recommend to read the first halfs of the proofs of the main theorems 3.1 and 4.1 before the rest of the paper. In the conclusion we point out the new ideas of the present proofs when compared to the proofs in [Go89a]. 1 Basics The family of types, Type = (Typenln~ 1N-) is given by: ind~ Type°; if x~ Type m and c e Type n then "r---)~Typek where k=max{m+l,n}. ---) associates to the right, level "c = n iff x~Type n. Var = (Var~ Ixe Type) denotes a typed family of variables, Opsym = ( O p s y m n l n ~ -) a finite signature of operation symbols. The family of terms or primitive recursive definitions Term = (Term s I'cE Type) is given by: Var~_cTerm ~, NEXTE Term ind'oind, MIN, MAX E Term ~a, Opsymm~ Term ind-~'--oind. These are the atomic terms. If t : x ~ a and s:x (meaning: t~ Term ~-~° and s~ Term~) then t(s):~. If t:~ and y:'c then ~.y.t : x--~o. If t:'~---)ind---ycthen R(t):x---)ind---)x (primitive recursion). A term is of level n iff iff its type is of level n, first-order terms are terms of level _<1. A term is of rank n iff all its subterms are of level <n. fr t is the set of free variables of t. Writing t(Y) or t(X-,y-)we mean that the free variables of t are contained in x or x,y. Closed terms are terms without free variables. For t:zl--~..--)xn--)ind (each type can be uniquely decomposed like this), it is t$ = t(xi)..(x~):ind , xk new and pairwise different. We always assume that bound variables are different from free ones, and variables bound at different places are different. For s, y of the same type t[s/y] denotes the substitution as usual. Semantics: We only consider finite interpretations I with: Set of individuals I = {0,...,n}, and interpretation I(op) of operation symbols op. I~ = (D~l'~Type) denotes the full type structure over I, i.e. D~~a -{0,...,n}, I~x~o = {f:Di~-~I~}. Usually C ( for cardinality) stands both for the last element of an interpretation and for an interpretation with last element C. We tend to omit indices indicating the interpretation. Let p be a fixed representation of D c as follows: For i<C, p(i) is i in binary, for de Dx--~, p(d) = (p(el),p(d(el))) ... (p(e~),p(d(e~))) if D~ = {eb...,e~}. If ~ is of level _<n then the length of p(d) for d e D ~'-~ is bounded by exp,_l(p(C)), p a polynomial depending on x---)a. In algorithmic 150 contexts we implicitly refer to this representation and will only distinguish between p(d) and d itself if necessary. The semantics of a term t in C w.r.t, to the type respecting assi~ament of variables in D, tt is given by: c+l C[[y]lg = g ( y ) , C~qEXT~g(m) = ifm<C otherwise CI[MIN]tt = 0 , C [ M A X ] g = C , C~op]]~t = C(op) for ope Opsym CI[t(s)ll~t = C H ~ t ( C l r s ~ t ) , C~.y.t~t(d) = ClrtN[d/y] (Ix[d/y] the variant of I.t by assigning d to y) ¢ , C~R(t)]g(d)(m) = t C~t]g(C~-R(t)]]g(d)(m-1))(m-1) if m>0 if m=0 A global function [Gu83] G is a function which takes an interpretation C and individuals il .....in from C as arguments and maps these to the individual C(G)(il)...(i~) - the value of G in C (therefore "C(G)" instead of "G(C)" as perhaps expected). We represent the interpretation C as input of a Turing machine in a natural way (see [Gu83] for some details). The length of the representation of C is polynomially related to the number C at least if there is a non-nullary operation symbol. A Turing machine TM computes G iff TM with input C and ib...,in gives C(G)(il)...(i~) as output. G is computable in DTIME(expn(poly)) or SPACE(exp~(poly)) if there is a Turing machine for G which computes G in time or space exp,(p(C)) respectively for some polynomial p. Conversely w.r.t, a fixed number n and a fixed signature Opsym containing at least one non-nullary operation symbol, the input of an arbitrary Turing machine TM may be interpreted as (a coding of) C, ib...,i~. Thus, TM can be viewed as a realization of some global function G. This allows us to consider complexity classes of global functions as usual complexity classes. Closed primitive recursive first-order definitions t define global functions in a natural way by: C(G)(il)...(i~) = C[t~(il)...(i~). The following notion of terms over C is crucial for showing that terms can be evaluated within certain bounds. We use terms over C in a similar way as infinite terms are used in [Schw75]: to eliminate recursion which in turn allows us to lower the rank of a primitive recursive definition in a controlled way (section 2). 1.1 Terms over C The family of terms over C, Term c = (Term~ Ix~ Type) is defined by (we omit the C): Var~cTerm x, D~cTerm x, NEXT~ Term ind--'ina,MIN, MAX E Term ina, Opsymm~ Term ind~''-~ind. These are the atomic terms from Termc. If t~ Term o, y~ Var ~, then ~y.t~ Term~-~°. If to,...,tce Term ~d, then <t0,...,tc>¢ Term ~''i~a (sequence). We have no primitive recursion. W.r.t. an interpretation C primitive recursiun can be represented by a sequence (unwinding the recursion). Term and Term c are to be carefully distinguished. All notions defined for Term are naturally transferred to Termc. For to,...,tc : x, x = ol~..---~n-~ind, <to,...,tc> 151 abbreviates Xy0,yl,..,yn.<t0(yl)..(yn),...,tc(yl)..(yn)>(y0). For teTermc the semantics of t, C~t]~t is given by ClI<to,...,tc>]]l.t(j) = C[[tj]l.t. The rest is as for ordinary terms. The denotational semantics induces an obvious reduction relation on terms over C: NEXT(m)--+m+I if m<C, NEXT(C)-->C, MIN-->0, MAX-->C, (Xy.0(s)--->t[sdy] ~-reduction), <to,...,tc>(j)-+tj, p(d)(p(e))-->p(d(e)). Standard X-calculus techniques prove that for t closed of type ind, C[[t~ = d iff t reduces to d. 1.2 Depth and Length One may represent terms as trees as follows: Abstraction becomes a node with one son, application a node with two sons, sequence a node with C+I sons. Then the depth corresponds to the length of the longest branch. Thus, the depth of t~ Term c, Dp t, is defined by: Dp t = 1 if t is atomic; Dp r(s) = l+max{Dp r, Dp s}; Dp (Xy.t) = l+Dp s; Dp <to,...,tc> = l+max{Dp tj}. The length counts the number of internal nodes and adds the sum of the lengths of the leafs. Therefore, the length of t~Termc, Lg t, is defined by: Lg t = 1 if t is atomic and t~D; Lg d is the length of the encoding p(d); Lg r(s) = Lg r +Lg s; Lg (Xy.t) = l+Lg t; Lg <to,...,tc> = I + ~ Lg 15. J An easy induction on the structure of terms shows: Fact Dpt<Lgt Dp t[s/y] < Dp t +Dp s Lg t[s/y] _< Lg t .Lg s [] 2 Lowering the Rank The first transformation of this section shows how to use the sequencing operator to eliminate recursion l~om a given primitive recursive definition w.r.t, an interpretation C. The transformation is inspired by 2.4 in [Schw75]. The second transformation shows how to lower the rank of a given term over C without recursion, such that length and depth increase in a controlled way (cf. 2.10 o f [Schw75]). 2.1 Elimination of Reeursion Recursion elimination w.r.t. C is the transformation REc:Term--->Termc given by the following induction on the syntax of terms (we omit the index C): RE t = t if t is atomic; RE t(s) = RE t (RE s); R E (Xy.0 = %y.(RE 0; RE R(t) = Xx.<to,...,tc> with to = x:x, 15+1= (RE t)(15)(j):'~ where t:'c--->ind->x. Fact C~-REct~Vt (1) Cfft]~t = (2) Lg 0REc0 < p(C) for some polynomial p depending on t. [] 152 2.2 Lowering the Rank For r~>l and an interpretation C the Wansformation to lower the rank LR"+~:Termc---~Termcis defined inductively on the syntax of terms by (omitting the n+l): LR t = t ff t is atomic; LR r(s) = r'[LR s/y] provided level r > n+l and LR r = ~,y.r' and LR r(s) = (LR r)(LR s) otherwise; LR ky.s = ~,y.(LR s); LR <t0,...,tc> = <LR to,...,LR to>. An induction on the structure of t shows: Fact Assume t is of rank n+l without atomic subterms of level n+ 1. Then (I) Cl[t]g = CI[LR t]llx. (2) LR "+1 t contains no subterms of the form r(s) where r is of level n+l. (3) If level t _<n , then LR *+1 t has rank n. (4) Lg (LR "+1 0 < 2L~ t, Dp (LRr'+l t) -< Lg t. [] 3 TIME 3.1 Theorem Let N > 1. A global function G is computable in time expN(p(C)) for a polynomial p iff there is a primitive recursive rank-(2N+2)-definition which defines G. Proof: Let G be computed by the Turing machine TM in time exl~(P(X)). A primitive recursive definition of rank 2N+2 to simulate TM: The configurations of TM with input C are bounded in their length by expN(p(x)). Hence, their contents can be represented by a level-(N+l)-variable conf:x over C. As the single step function of TM involves only simple syntactic manipulations, we can define a primitive recursive definition SING:x--ox (of level N+2) to simulate this function. Nesting primitive recursion and using N-fold iterated copying made possible by the term COPY = ~,y,z.y(y(z)) for the levels 2N+2 through N+3, we can generate SING(...(SING(INIT))_.) where IN1T represents the initial configuration of TM and SING is applied expN(p(C)) times. This term simulates TM. The proof of the opposite direction makes up 3.2 to 3.4. 3.2 The Evaluation Algorithm From now on, N_>I is fixed, T is a fixed closed primitive recursive definition of first-order type and rank 2N+2. The evaluation algorithm EVALT takes an interpretation C and a vector of individuals T as arguments and computes EVALT[C ~ = (N+2)--CBV-(N+I) [Sc] where Sc = LRN+3[...[LR2N+2[REc T]]...] The function procedure RE eliminates the rccursions in one bottom-up left-to-right pass over the term T using the definitional equations of 2.1. Since the final term and all intermediate terms are of length 153 polynomial in C, RE uses time q(C) for some polynomial q. The function procedure LR l applied to a term t reduces redices (%y.r)(s) where ~y.r is of level j also in one bottom-up left-to-fight pass (this is possible since no new such redices are generated). Therefore, at most Lg t substitutions have to be performed where the length of occurring terms is bounded by 2Lg t. Therefore, LRJ[t] can be computed in time expl(q(Lg t)) for some polynomial q. From this we conclude: Sc is computed in time exlN(r(C)) for some polynomial r depending only on T where Lg Sc < exlN(r(C)) and Dp Sc < exlN_l(r(C)) (see proposition of 2.2). This difference of one exponentiation between length and depth is crucial for our analysis. CBV or (N+2)-CBV-(N+I), evaluates rank-(N+2)-terms call-by-value for arguments of level < N+I, i.e. CBV reduces the head redex in Q~y.r)(tl)..(ta) only if tieD. If tieD, the value of tt, d = Cl[tlll e D is computed first; then CBV proceeds to evaluate t[d/y](tz)..(t0. Clearly, EVALT[C,~ = CI[T]](T). A straight forward application of the reduction rules from 1.1 would give us another evaluation strategy. But, in this sllategy there can occur an exp2N+l(q(C))-fold growth due to iterated copying. This growth is avoided by our call-by-value strategy. Note that an evaluation strategy where arguments of level >__ N+2 are evaluated call-by-value also does not stay within the required time bounds. We show that EVALT[Cj) takes time < exphX,p(C)) for some polynomial p depending on T. CBV is only applied to particular terms of Termc: To closed terms of type ind which do not contain elements from Dc of level _> N+2. The types occurring in these terms are only those which .occur as subtypes in Sc. In fact, the set of occurring types is contained even in the set of subtypes occurring in T which is independent of C. If we talk of terms in relation with CBV, we mean terms occurring as subterms (to allow for inductive arguments) of the terms as described above, in particular they only contain free variables and elements from D of level < N+I. The maximal number of argument tuples (w.r.t. C) is given by Maxargc = max{Card Dc 1 • ...- Card Dc~ I xl-o...---~n---)ind is of level _<N+I and occurs in Sc}. The maximal length of an element is Maxelc =max{Lg d I deD~ for a type x of level < N+I in Sc}. We have Maxargc < expN(q(C)) and Maxelc < exlN(q(C)) for a suitable polynomial q. To estimate the time complexity of CBV we prove upper bounds on the total number of recursive calls recursive calls of CBV when evaluating some term t. For a closed term te Term~ a, Calls t denotes the total number of calls of CBV necessary to compute C~tll. For t not closed and/or of type ~ ind, we define Calls t = max{calls t$(d) I d a suitable vector from Dc for g}. 3.3 Theorem Calls t _<Lg t • Maxargc~' t for every term t over C. As the claim is defined for terms of any type with free variables, it is amenable to an inductive argument on the syntax of terms. It reflects the CBV-strategy in that argument terms (being of level _<N+I) are evaluated for all of their arguments. The remarks on length and depth of Sc imply an expN(.P(C)) bound on the number of calls of CBV. 154 Proof: Let C be fixed, we sometimes omit the index C. Induction step: Assume t is a non-atomic term where t$ = t$(-~) = t(ul)..(un), i.e. ~ contains the free variables of t plus the new ul,..,un. Let d be a vector of elements from D corresponding to ~. Let t$(d) = t(d)(dl)...(d,). We distinguish three cases according to the syntactical structure of t. Application: Let t = r(s). Then tS(~) = r('g)(sfg))(ul)..(un). If s(d) = e E D, we have Calls t$(d) = Calls r$(d)(e)(dl)..(d0 which implies the claim by induction hypothesis. If s(d)~ D, we have Calls t$(d) < Calls s(d).Maxargc + Calls r(d) {The value of CI[s~)] is computed first} < Lg r(s)-Maxarg~ r~s) by ind. hyp. The remaining cases sequence and abstraction follow easily with the induction hypothesis. [] 3.4 Corollary EVALr[C,]'] takes expn(p(C)) time for a polynomial p. Proof: According to 3.3 the computation of Sc = LRN+a[...[LR2N+2[RE T]]...] takes expN(r(C)) time for some polynomial r depending on T where Lg Sc < exPN(r(C)) and Dp Sc < expN-1(r(C)). By 3.4 the computation of CBV[Sc(]')] uses exp~q(C)) recursive calls of CBV for some polynomial q. Since during the computation every variable is substituted only by some value of D, it follows that all terms to which CBV is applied are bounded in length by Lg Sc • Maxelc _<eXPN(q'(C)) for some polynomial q'. Thus, a Turing machine using the standard pushdown implementation of CBV returns the result in time expN(p(C)) for some polynomial p. [] 4 SPACE 4.1 Theorem Let N_>I. A global function G is computable in space expN(p(C)) for a polynomial p iff there is a primitive recursive rank-(2N+3)-definition which defines G. Proof: Let G be computed by the Turing machine TM in space expN(p(C)). A primitive recursive definition of rank 2N+3 to simulate TM: There is a polynomial q such that TM makes at most exp~l(q(C)) steps on inputs (C,]-) without looping. We proceed as in the time-case. Configurations are represented by the variable conf:'r of level N+I. SING:x---~z simulates the single step function of TM. To generate SING(...(SING(INIT))...) with ext~+1(q(C)) many SINGs we make use of the (N+l)-fold iterated copying ability by using the term COPY (cf. proof of 3.1) for levels 2N+3 through N+3 and nested primitive recursion to generate sufficiently many initial COPYs (of level 2N+3). Note, we have here one level more than in 3.1 for iterated copying. The proof of the opposite direction makes up the rest of the paper. 155 4.2 The Evaluation Algorithm From now on, N>I is fixed, T is a fixed closed primitive recursive definition of first-order type and rank 2N+3. As in the time-case we define the evaluation algorithm EVALT and show that EVALT[C~ as described below takes space _<exp~(p(C)) for some polynomial p depending on T. The evaluation algorithm EVALT takes an interpretation C and a vector of individuals T as arguments and computes EVALT[C~ = (N+3)-CBV-(N+I) [Sc] where Sc = LRN+4[...[LR~+S[REc T]]...] The definition of RE and LRJ is as in the time case. The analysis in 3.2 shows that Sc is computed in space exl~(q(C)) for some polynomial q where Lg Sc -< expN(q(C)) and Dp Sc -< expN_l(q(C)). After execution of RE and the LRs (N+3)-CBV-(N+I) evaluates terms of rank N+3 "call-by-value for arguments of level _< N+I". Hence, arguments of level N+2 are not evaluated caU-by-value. Note that elements from D of level N+2 cannot be represented within the required space bounds. Let t be a closed term from Term~ d . (N+3)-CBV-(N+I) (again CBV for short) differs from (N+2)C B V - ~ + I ) only in the case where t is an application t = s(h)..(tn) with s not an application i.e. s = ~.y.r. In this case (N+3)-CBV-(N+I) behaves as follows: If: level tl = N+2 Then: CBV[r[h/y](t2)..(t0]; {i.e. t 1 is not evaluated in advance} Else: as in the time-case; {i.e. h is evaluated in advance} Fi; Again, CBV is only applied to particular terms of Termc: To closed terms of type ind which do not contain dements from D c of level > N+I. The types occurring in these terms are only those which occur as subtypes in Sc. In fact, the set of occurring types is contained even in the set of subtypes occurring in T which is independent of C. If we talk of terms in relation with CBV, we mean terms occurring as subterms (to allow for inductive arguments) of the terms as described above, in particular they only contain free variables of level _< N+2 and elements from D of level < N+I. The maximal length of an element (w.r.t. C) is given by Maxelc =max{Lg d I deD~ for a type x of level < N+I in Sc}. We have Maxelc < exI~q(C)) for a suitable polynomial q. For te Term~nd, t closed, Ncalls t is the maximal number of pending calls to CBV (i.e. the depth of the recursion stack) when evaluating CBV[t]; Parl t is the maximal length of terms (including t) occurring as actual parameters of CBV when evaluating CBV[t]. For arbitrary tE Term c with t$ = t$(y) where y only contains variables of level at most N+I, we define Ncatls t = max{Ncalls t$(d) I d suitable vector for y} Parl t = max{Parl t$(d) I d suitable vector fory} . Clearly, the space needed for computing CBV[t] is polynomially related to the product Ncalls t .(Parl t +Maxelc). 156 4.3 Theorem Let te Termc, t$ = tSfK,y-) (cf. 4.2) where 2 contains the variables of level N+2, y contains the variables of level < N+I. Let U = U~,..,Uk be a vector of closed terms over C corresponding to 2. Let M > Ncalls Uj, K > Parl Uj, L > Lg Uj, Maxelc. Then Ncalls t$CU,y-)<- Lg tDpt + M, Parl t$~,y-O -< max{Lg top t-L, K}. These formulas reflect our evaluation strategy in that the Uj are evaluated only after their arguments, being of level < N+I, are already evaluated. The evaluation of the Uj takes place independent of the evaluation of t. That implies that the numbers of pending calls and the parameter lengthes occurring in evaluating Uj mix in a controlled and simple way with the numbers of pending calls and parameter lengthes inside of t. The remarks in 4.2 imply an exI~(p(C)) bound both on the number of pending calls of CBV in EVALv[C~ and on the lengthes of actual parameters of these calls. Proof: If t is atomic the assertion trivially is true. Induction step: Let t be a non-atomic term with t,[,~,y--) = (tCx,y--'))(Ul)..(Lh). Let d a vector of elements from Dc corresponding to y and t$(U,d) = (t(U,d))(dl)..(d0. We distinguish three cases. Application: Let t = r(s). Let r,], = r$(uo,2,y--)= r(uo)(ul)..(th). Let level s < N + I . If s(U,d) = e e D , then Ncalls t$(U,d) = Ncalls r$(e,U,d) Parl t$('U2) = Parl r$(e,U,d) which implies the claim by the induction hypothesis. If s(U,d) ~ D then NcaUs t$(U,d) = NcaUs r$(s(U,d),U,d) _<max{ l+Ncalls s(U,d-), Ncalls r$(uo,U,d)} by definition of CBV _<Lg tDpt+M by ind. hyp. earl t$(l'~,d) = Parl r$(s(U,d),U,d) _<max{Lg t,[.(rJ,d), Parl sCU,d), Parl r(uo,U,d)} by definition of CBV <_max{Lg tDPt-L, K} by ind. hyp. Now, assume level s = N+2. Then Ncalls t$CtT,d) = Ncalls r$(s(U,d),U,d) _<Lg rDP%max{M, Ncalls s('U,d)} by ind. hyp. < Lg rDp%Lg sDp%M _<Lg tDp%M Pail t$Ct'~,d) = Parl r$(s(U,d),U,a) < max{Lg t,l,(U,d), Lg rDpr'Lg s.L, Lg sDp'-L, K} by ind. hyp, 157 < max{Lg r(s)DV~(O'L,K} The other cases are easier and follow with the definition of CBV and the induction hypothesis. [] Analogously to 3.4 we derive: 4.4 Corollary EVALr[C,~ takes ex~(p(C)) space for a polynomial p. [] Conclusion The time case compared to [Go89a]: In [Go89a] we have shown that rank-2-definitions characterize PTIME. To show that rank-2-definitions can be evaluated in polynomial time, we used the strategy 2CBV-1. In the present paper we showed for N>_I that rank-(2N+2)-definitions are in DTIME(expr~4,poty)). We could not generalize the methods of [Go89a] in an obvious way to higher ranks and use (2N+2)-CBV-(N+I): for this, one somehow has to keep track of all the reductions occurring at levels _>N+2. Instead, we first eliminate primitive recursion and lower the rank to N+2. Then we apply (N+2)-CBV-(N+I). The price to be paid is, that one rank-(2N+2)-delinition induces a different rank-(N+2)-term for each C. This means that our inductive analysis must be uniform in some features (here length and depth) of the term. In [Go89a] this was not necessary. Similar arguments apply to the space case. Conversely note, that the method used here to show that primitive recursive definitions can be evaluated within certain bounds: Eliminate recursion first, lower rank, then evaluate,- does not yield the results of [Go89a] for rank 2 and rank 3 either. The reason is that in eliminating primitive recursion, the depth of the resulting term becomes polynomial in C. Since in our inductive arguments of 3.3 and 4.3 the depth occurs in the exponent, no polynomial resource bound can be derived. Literature [Ba84] [Go89a] [Go89b] [Gu83] [Gu84] [Im87] [KfTiUrg7] [I~i87] [P177] [Schw75] Barendregt, H., The lambda calculus. North Holland 1984. Goerdt, A., Characterizing complexity classes by higher type primitive recursive definitions, LICS (1989), 364-374. Goerdt, A., Characterizing complexity classes by finitely typed k-terms, Workshop Computer Science Logic 1988, LNCS, to appear. Gurevich, Y., Algebras of feasible functions, 24th FOCS (1983), 210-214. Gurevich, Y., Toward logic taylored for computational complexity, computation and proof theory, LNM 1104 (1984), 175-216. lmmerman, N., Expressibility as a complexity measure: results and directions, 2nd Conf. Structure in Complexity Theory (1987), 194-202. Kfoury, A., Tiuryn, L,Urzyczyn, P., The hierarchy of finitely typed functional programs, LICS (1987), 225-235. Leivant, D., Characterization of complexity classes in higher order logic, 2nd conf. Structure in Complexity Theory (1987), 203-218. Plotkin, G., LCF considered as a programminglanguage, TCS 5 (1977), 223-257. Schwichtenberg, H., Elimination of higher type levels in definitions of primitive recursive functions by means of transfinite recursion, Logic Colloquium 1973, North Holland. 158 [Sa80] [Te82] ~i86] [TiUr83] Sazonov, V., Polynomiai computability and rccursivity in finite domains, EIK 16 (1980), 319-323. Terlouw, J., On the definition trees of ordinal recursive functionals: reduction of recursion orders by means of type level raising, J. Symbolic Logic 47 (1982), 395403. Tiuryn, J., Higher order arrays and stacks in programming: An application of complexity theory to logics of programs, 12th MFCS (1986), LNCS 233, 177-198. Tiuryn, J.,Urzyczyn, P., Some connections between logic of programs and complexity theory. 24th FOCS (1983), 180-184.