Type-two Iteration with Bounded Query Revision
TThomas Seiller & Steffen Jost (Eds.): DICE-FOPARA 2019EPTCS 298, 2019, pp. 61–73, doi:10.4204/EPTCS.298.5
Type-two Iteration with Bounded Query Revision
Bruce M. Kapron ∗ University of VictoriaVictoria, BC, Canada [email protected]
Florian SteinbergINRIASaclay, ˆIle-de-France [email protected]
Motivated by recent results of Kapron and Steinberg (LICS 2018) we introduce new forms of it-eration on length in the setting of applied lambda-calculi for higher-type poly-time computability.In particular, in a type-two setting, we consider functionals which capture iteration on input lengthwhich bound interaction with the type-one input parameter, by restricting to a constant either thenumber of times the function parameter may return a value of increasing size, or the number of timesthe function parameter may be applied to an argument of increasing size. We prove that for anyconstant bound, the iterators obtained are equivalent, with respect to lambda-definability over type-one poly-time functions, to the recursor of Cook and Urquhart which captures Cobham’s notion oflimited recursion on notation in this setting.
Recursion on notation is a fundamental tool for syntactic characterizations of feasible computation, inparticular capturing the notion of bounding the number of steps of a computation in terms of input size.However, as a constraint, it is too weak on its own to capture feasibility as characterized by polynomialtime computability. A well-known example is the following: consider a function ϕ , mapping binarystrings to binary strings, which for any input string a returns the string concatenated with itself: ϕ ( a ) = aa . The function ϕ should clearly be accepted as feasible, but recursion on notation allows the definitionof a new function which, on input b of length n returns ϕ n ( ) , which is a string of length 2 n . Tocapture feasibility through a recursion scheme, further restrictions are required to prevent this kind ofexponential blowup. Indeed, Cobham, in perhaps one of the earliest works mentioning polynomial-time computability, gives a characterization using a scheme of limited recursion on notation [3]. Here,definition of a new function through recursion on functions already known to be from the class is allowedonly in case the length of the resulting function may be a priori bounded by the length of a functionalready known to be in the class. Cobham’s approach is a canonical example of explicit bounding. It isalso possible to formulate forms of limited recursion with implicit bounding and recover the same classof polynomial time functions [13, 1].It is possible to consider feasibility in the type-two setting, which allows computation with respect toan arbitrary function oracle. The original definition of type-two polynomial time was given by Mehlhornusing a straightforward generalization of Cobham’s scheme [14]. Just like the polynomial time functions,this class of functionals allows for a number of different characterizations and is accepted as capturingfeasibility at type level two appropriately: Cook and Urquhart gave a formulation of Mehlhorn’s class,and in fact generalized it to all finite types by use of an applied typed lambda calculus with constantsymbols for a collection of basic type-one poly-time functions, as well as a recursor R , which capturesMehlhorn’s scheme as a type-two functional [6]. Kapron and Cook showed that Mehlhorn’s class may ∗ Research supported in part by an NSERC Discovery Grant
OTM s) whose run-time is bounded by a second-order polynomial [9]. Both of these characterizations have lead to a multitude of applications and furthercharacterizations.The content of this paper is inspired by a recent description of Mehlhorn’s class given by Kapronand Steinberg [10]. For this it is instructive to think of an analogue of unrestricted recursion on notationin the
OTM setting. Informally, this corresponds to Cook’s notion of oracle polynomial time ( OPT ) [4],which bounds the running time of
OTM s by a polynomial in the size of the input and the largest answerreturned by any call to the oracle. Here, a higher time consumption can be justified by an increasingchain of oracle return values and in particular it is possible to recover the example above within
OPT .To force feasibility, Kapron and Steinberg use restrictions of
OPT based on query-size revisions . Theyconsidered two forms of revision: a length revision occurs when a query to the oracle returns an answerwith size larger than the size of the input or the answer to any previous query, a lookahead revision occurswhen the size of a query provided to the oracle is larger than the size of any previous such query.
Strongpolynomial time ( SPT ) allows only a constant number of length revisions, while moderate polynomialtime ( MPT ) allows only a constant number of lookahead revisions. Kapron and Steinberg prove thatboth of the classes
SPT and
MPT give proper subsets of Mehlhorn’s class even when restricted to thefunctionals of the type that they are meant to capture, but that Mehlhorn’s class can be recovered fromeach of the classes by closing under λ -abstraction and application. It should be noted that length revisionsand SPT make an earlier apparent in a somewhat different setting in work of Kawamura and Steinberg[12].The outline of this paper is as follows: In the first section we describe the setting. Namely we workin a simply typed lambda-calculus with constant symbols for all type-1 polynomial-time computablefunctions. This is identical to the setting Cook and Urquhart chose for their characterization of higher-order polynomial time through the recursor R and means that we reason about higher-order complexitymodulo the availability of the full strength of a first-order bounded recursion scheme. The paper startsfrom the observation that the bounded recursor R is meant to model Mehlhorn’s scheme, which is strictlymore expressive than the first order scheme that is already available through the constants. Clearly R adds something, as the class of functionals expressible without its presence has been classified by Sethand is considerably restricted in its access of the oracle [16]. Thus, one may ask for functionals that areless expressive and still generate the same class given the context. Section 2 weakens R in two stepsby first simplifying the way in which the bounding is done and afterwards by restricting the data thatis available to the step-function. This leaves us with a functional I that no longer captures boundedrecursion but is better understood as doing bounded iteration.Section 3 starts involving the ideas of length revisions: Inspired by the definitions of the classes SPT and
MPT we change the way in which iteration is bounded. The new conditions intuitively provide morefreedom than the direct bounding the iterator I uses and do so in a way that is somewhat orthogonal tohow Cook and Urquhart’s original recursor R did more complicated bounding. We are lead to considera family of operators I k where the condition that is imposed becomes less restrictive as k grows. Overthe chosen background theory, all of the operators I k as well as R and I are of equal expressive power.However, the parameter k is tightly connected to runtime-bounds for I k in the OTM setting, and theuse of higher values should allow expressing some functionals that feature more complicated interactionwith the oracle more concisely. The proof that all considered operators are equivalent additionally coversa similarly defined family of iterators based on the idea of lookahead revisions that is introduced inSection 4. The final section specifies an efficient generation scheme for the values of the new iterators.Kapron and Steinberg define the classes
SPT and
MPT using the
OTM framework which is boundto a specific machine model. This paper transfers the notions of length and lookahead revisions to the.M.Kapron and F.Steinberg 63machine independent setting of iteration schemes, where the number of iterations is determined by thelength of a specified input parameter (which is a string over some finite alphabet). Our proofs introducesome interesting and useful idioms for programming in this setting.
Let Σ denote a finite alphabet that contains symbols and , and Σ ∗ the set of finite strings over Σ .The empty string is denoted ε , and arbitrary elements of Σ ∗ are denoted a , b , c , . . . . We attempt to bindnames of string variables to their meanings as far as possible: a is associated with initial values, b withsize-bounds c with values that a recursion or iteration is carried out over and t the previous values in arecursion or iteration. For a ∈ Σ ∗ let | a | to denote the length of a and a i its digits, i.e., a = a . . . a | a | . Wewrite b ⊆ a to indicate that b is an initial segment of a . We assume that we have symbols for all type-1poly-time functions, for instance: • Truncation : The 2-ary function sending b and c = c c . . . c | c | , to c ≤| b | : = c . . . c | b | , if | b | ≤ | c | and c otherwise. Note that always c ≤| b | ⊆ c and c ≤| ε | = ε . For c ≤| c |− we use the shorthand c ≫ • Tupling and projection functions h· , . . . , ·i and π i , such that tupling is monotone with respect tolength in each argument. Namely if | a i | = | b i | for all i apart from k , then | a k | ≤ | b k | if and only if |h a , . . . , a n i| ≤ |h b , . . . , b n i| . • Length minimum : We adopt the convention used by Cook and Urquart, i.e. lmin ( c , b ) : = ( c if | c | < | b | b otherwise.We also use definition by cases extensively, relying on the fact that there is a polynomial-time conditionaland avoid over-use of λ -abstractions via explicit function definition. Tupling functions that satisfy thedemands above exist and are 1-1, but not bijective. In spite of this we still write λ h a , . . . , a k i . t [ a , . . . , a k ] as short hand for λ b . t [ π b , . . . , π k b ] . This is all done for the sake of readability. λ -Definability The treatment of the typed λ -calculus here follows that used by Cook and Urquart for their characteriza-tion of Mehlhorn’s class [6]. The set of types is defined inductively as follows: • • ( σ → τ ) is a type, if σ and τ are types.The set Fn ( τ ) of functionals of type τ is defined by induction on τ : • Fn ( ) = Σ ∗ • Fn ( σ → τ ) = { F | F : Fn ( σ ) → Fn ( τ ) } .It is not hard to show that each type τ has a unique normal form τ = τ → τ → · · · → τ k → F of type τ is considered in a natural way as a function of variables X , . . . , X k , with X i ranging over Fn ( τ i ) , andreturning a natural number value: F ( X )( X ) . . . ( X k ) = F ( X , . . . , X k ) . level of a type is defined inductively: The level of type 0 is 0, and the level of the type τ writtenin the above normal form is 1 + the maximum of the levels of τ , . . . , τ k . This paper is mostly onlyconcerned with functionals of type level smaller or equal two.Let X be a class of functionals. The set of λ - terms over X , denoted λ ( X ) is defined as follows: • For each type σ there are infinitely many variables X σ , Y σ , Z σ , . . . of type σ , and each such variableis a term of type σ . • For each functional F (of type σ ) in X there is a term F σ of type σ . • If T is a term of type τ and X is a variable of type σ , then ( λ X . T ) is a term of type ( σ → τ ) (anabstraction). • If S is a term of type ( σ → τ ) and T is a term of type σ , then ( ST ) is a term of type τ (anapplication).For readability, we write S ( T ) for ( ST ) ; we also write S ( T , . . . , T k ) for ( . . . (( ST ) T ) . . . T k ) , and λ X . . . λ X k . T for ( λ X . ( λ X . ( . . . ( λ X k . T ) . . . ))) .The set of free variables of a lambda term can be defined inductively and are those that are not boundby a lambda abstraction. A term is called closed, if it has no free variables. In a natural way each closed λ -term T of type τ represents a functional in Fn ( τ ) . This correspondence is demonstrated in the standardway, by showing that a mapping of variables to functionals with corresponding type can be extended toa mapping of terms to functionals with corresponding type.An assignment is a mapping ϕ taking variables to functionals with corresponding type. Suppose ϕ is an assignment and T a λ -term over X . The value V ϕ ( T ) of T with respect to ϕ is defined by inductionon T as follows.When T is a variable, V ϕ ( T ) is ϕ ( T ) . If T = F σ is a constant symbol for some F ∈ X , then V ϕ ( T ) = F . Suppose that τ = τ → . . . → τ k →
0. When T has the form λ X σ . S τ , F is a type σ functional and F i are type τ i functionals, then V ϕ ( T )( F , F , . . . , F k ) : = V ϕ ′ ( S )( F , . . . , F k ) , where ϕ ′ ( X σ ) = F , but ϕ ′ is otherwise identical to ϕ . When T has the form S σ → τ R σ , V ϕ ( T )( F , . . . , F k ) = V ϕ ( S )( V ϕ ( R )( F , . . . , F k )) . (cid:3) It is not hard to show that if T , S are terms such that T is a β or η redex and S is its contractum,then for all ϕ , V ϕ ( T ) = V ϕ ( S ) . A functional F is represented by a term T relative to an assignment ϕ if F = V ϕ ( T ) .Our goal in this paper is to prove the equivalence, with respect to λ -representability in the presenceof poly-time type-1 functions, of type-2 functionals capturing different forms of recursion on notation.To this end we have the following definitions. Definition 1.1.
Let P be the class of (type-1) poly-time functions, and F , G be functionals. We say that F is P - reducible to G , denoted F (cid:22) λ P G if F is representable by a term of λ ( P ∪ { G } ) , and that F is P - equivalent to G , denoted F ≡ λ P G , if F (cid:22) λ P G and G (cid:22) λ P F .We regularly use that P -reducibility is a transitive relation, which is easily verified. We refer to theclass of functionals representable by a term from λ ( P ∪ { G } ) as the class of functionals generated by G .Clearly two functionals are P -equivalent if and only if they generate the same classes of functionals..M.Kapron and F.Steinberg 65 Our starting point is the recursor that Cook and Urquart use to characterize a class of higher-orderpolynomial-time functionals [6]. This recursor is patterned on the scheme of limited recursion on nota-tion introduced by Cobham [3] and its second-order variant, introduced by Mehlhorn [14]. In [11] it isproved that the type-two functionals definable in the Cook-Urquhart system coincide with Mehlhorn’sclass. The recursor is defined as follows: R ( ϕ , ψ , a , ε ) : = a and R ( ϕ , ψ , a , c i ) : = lmin ( ϕ ( c i , t ) , ψ ( c i )) , where t = R ( ϕ , ψ , a , c ) . Here, the length minimum lmin returns its left argument if it has strictly smaller length and the rightargument otherwise as defined in the preliminaries. The schemes used by Cobham and Mehlhorn featureexplicit external bounding that captures almost directly the notion of bounding by a polynomial (in thefirst-order setting we could easily use a scheme with explicit bounding by polynomials in the argumentsize, and as shown by [8] this may be extended to the second-order setting as well). In the Cook-Urquartrecursor, this limiting is realized via an additional type-1 input ψ . Our first observation is that the limitingmay instead be realized through a type-0 input. Lemma 2.1 ( R ≡ λ P R ) . The Cook-Urquart recursor and its restriction to constant bounding functionsgenerate the same class of functionals. More specifically R is P -equivalent to the functional R ( ϕ , b , a , c ) : = R ( ϕ , λ d . b , a , c ) . Proof.
From the definition of R it is immediate that R (cid:22) λ P R . To see that also R (cid:22) λ P R arguethat it suffices to show that max (cid:22) λ P R , where max is the functional that maximizes return values of afunction over the initial segments of a string, i.e. is recursively defined via max ( ψ , ε ) : = ψ ( ε ) and max ( ψ , c i ) : = ( ψ ( c i ) if lmin ( max ( ψ , c ) , ψ ( c i )) = max ( ψ , c ) max ( ψ , c ) otherwise.Indeed, once this is proven R (cid:22) λ P R follows from the equality R ( ϕ , ψ , a , c ) = R ( λ d . λ t . lmin ( ϕ ( d , t ) , ψ ( d )) , max ( ψ , c ) , a , c ) , where the second argument is the maximum with an additional digit added to make sure it is alwaysstrictly bigger than any value of ψ on an initial segement of c . This equality can be proven by aninduction where the crucial point in the induction step is that the outer of the nested minima alwayschooses its left argument as value.To see that the length maximization functional is definable using R , note that the argmax functional,which returns the smallest initial segment where a given input-function assumes its maximum, can bedefined from R via argmax ( ψ , c ) = R ( λ d . λ t . A ( ψ , d , t ) , c , ε , c ) where A ( ψ , d , t ) = d if lmin ( ψ ( t ) , ψ ( d )) = ψ ( t ) and t otherwise. Since max ( ψ , c ) = ψ ( argmax ( ψ , c )) ,it follows that max can be expressed and thus that R (cid:22) λ P R .As a further simplification of R , it is possible to eliminate the reference to the current value of therecursion parameter at each step, that is, to replace a functional capturing a form primitive recursionon notation with one that captures functional iteration. This is known as a folklore result, but to the6 Type-two Iteration withBounded Query Revisionbest of our knowledge does not appear explicitly in any previous work in this setting. The most similarcharacterization we are aware of is one based on typed loop-programs and appeared in [5]. In the caseof primitive recursion, the equivalence with iteration was first explictly proved in [15].For a function ϕ : Σ ∗ → Σ ∗ let the n -fold iteration ϕ n be inductively defined by ϕ ( a ) : = a and ϕ n + ( a ) : = ϕ ( ϕ n ( a )) . An unbounded iterator would be a functional that takes n , a and ϕ as inputs andreturns ϕ n ( a ) . Recall from the introduction, that there are polynomial-time computable ϕ such that thefunction λ a . λ b . ϕ | b | ( a ) exhibits exponential growth and is in particular not polynomial time computable.Thus, to capture the class of feasible functionals, the considered iterator needs to be bounded. We definethe bounded iterator I by I ( ϕ , b , a , c ) : = ( λ t . lmin ( ϕ ( t ) , b )) | c | ( lmin ( a , b )) . That is: I performs | c | iterations of the input function ϕ on starting value lmin ( a , b ) , truncating theresulting value after each iteration to be no longer than the bound b .Before we go on to prove the bounded iterator equivalent to the Cook-Urquart recursor, let us brieflydiscuss the choices we have taken in bounding. First off, it is easy to see that whether or not the startingvalue is truncated is irrelevant up to P -equivalence. Furthermore, the definition of I is such that thebounding is done after ϕ is applied. Another possibility would be to consider an iterator where thebounding is done on the argument side of ϕ , i.e. before its application. We give a short proof that theresulting iterator is equivalent. Lemma 2.2. ( I ≡ λ P I ′ ) Output-bounded iteration generates the same class of functionals as argument-bounded iteration. More specifically I is P -equivalent to the functional I ′ ( ϕ , b , a , c ) : = ( λ t . ϕ ( lmin ( t , b ))) | c | ( a ) . Proof.
We prove that for all ϕ , b , a , c , I ( ϕ , b , a , c ) = lmin ( I ′ ( ϕ , b , a , c ) , b ) (*) I ′ ( ϕ , b , a , c ) = (cid:26) b if c = ε ; ϕ ( I ( ϕ , b , a , c ′ )) if c = c ′ i . (**)We prove (*) and (**) simultaneously by induction on | c | . The case when | c | = c ′ with | c ′ | = k ≥
1. Consider c with | c | = k +
1, say c = c ′ i where | c ′ | = k . Then I ( ϕ , b , a , c ) = lmin ( ϕ ( I ( ϕ , b , a , c ′ )) , b )= lmin ( I ′ ( ϕ , b , a , c ) , b ) (By IH (**))and I ′ ( ϕ , b , a , c ) = ϕ ( lmin ( I ′ ( ϕ , b , a , c ′ ) , b ))= ϕ ( I ( ϕ , b , a , c ′ )) . (By IH (*))We end the section with the proof that the bounded iterator, and its modification from the precedinglemma, generate the basic feasible functionals. That is, that they generate the same class of functionalsas the Cook-Urquart recursor..M.Kapron and F.Steinberg 67 Lemma 2.3 ( R ≡ λ P I ) . The Cook-Urquart recursor and the bounded iterator are P -equivalent.Proof. The first implication, namely that I (cid:22) λ P R , follows from the equality I ( ϕ , b , a , c ) = R ( λ d . λ t . ϕ ( t ) , λ d . b , lmin ( a , b ) , c ) , that can be proven through a simple induction.For the converse note that, by Lemma 2.1 the recursor is equivalent to its version R where thebounding is done via a constant instead of a function. Thus it suffices to prove that R (cid:22) λ P I . Further-more note how close the expanded definition of the iterator is to the definition of R : I ( ϕ , b , a , ε ) : = lmin ( a , b ) and I ( ϕ , b , a , c i ) : = lmin ( ϕ ( t ) , b ) , where t = I ( ϕ , b , a , c ) The main difference is that for the recursor the step function ϕ is additionally given access to the valueof the recursion parameter c . We postpone the discussion of how to accomodate the additional boundingof the initial value to the end of the proof and show that the operator R ′ defined by R ′ ( ϕ , a , b , ε ) : = lmin ( a , b ) and R ′ ( ϕ , a , b , c i ) : = lmin ( ϕ ( c i , t ) , b ) , where t = R ′ ( ϕ , a , b , c ) . can be expressed by using the bounded iterator. To achieve this define Φ ( ϕ , b , c ) : = λ h u , v i . h u , lmin ( ϕ ( c ≤| u | + , v ) , b ) i . In the above ϕ has the type of a functional input of the recursor R ′ and Φ ( ϕ , b , c ) has the type of afunctional input for the bounded iterator for fixed ϕ , b and c . We claim that for any c , and c ′ ⊆ c , I ( Φ ( ϕ , b , c ) , h | c | , b i , h ε , a i , c ′ ) = h | c ′ | , R ′ ( ϕ , b , a , c ′ ) i (*)and so, in particular R ′ ( ϕ , b , a , c ) = π ( I ( Φ ( ϕ , b , c ) , h | c | , b i , h ε , a i , c )) , which proves the P -reducibility of R ′ to I . The equality (*) can be verified by fixing c , an proving thefollowing statement by induction on c ′ : if c ′ ⊆ c , then (*) holds for c ′ . The base case of this inductionfollows from the properties we demanded the pairing functions to have. Next suppose that the assertionis true for c ′ . If c ′ i ⊆ c , then it is also the case that c ′ ⊆ c , and the induction hypothesis implies that (*)holds for c ′ . But then I ( Φ ( ϕ , b , c ) , h | c | , b i , h ε , a i , c ′ i ) = lmin ( Φ ( ϕ , b , c )( h | c ′ | , R ′ ( ϕ , b , a , c ′ ) i ) , h | c | , b i )= lmin ( h | c ′ | , lmin ( ϕ ( c ≤| c ′ | + , R ′ ( ϕ , b , a , c ′ )) , b ) i , h | c | , b i )= lmin ( h | c ′ i | , lmin ( ϕ ( c ′ i , R ′ ( ϕ , b , a , c ′ )) , b ) i , h | c | , b i )= lmin ( h | c ′ i | , R ′ ( ϕ , b , a , c ′ i )) i , h | c | , b i )= h | c ′ i | , R ′ ( ϕ , b , a , c ′ i )) i Where the last equality uses the properties of the tupling functions again and the fact that R ′ ( ϕ , b , a , c ′ i ) is either strictly shorter than b or equal to b .Finally, to change the initial value, define H as follows: H ( ϕ , d , t , a ) = ( ϕ ( d , t ) if | t | > ϕ ( d , a ) otherwise, . R ( ϕ , a , b , c ) = (cid:26) a if c = ε ; R ′ ( λ t . λ d . H ( ϕ , d , t , a ) , a , b , c ) otherwiseand thus we obtain that R (cid:22) λ P R ′ (cid:22) λ P I and with the fact R (cid:22) λ P R from Lemma 2.1 also thedesired P -reducibility R (cid:22) λ P I . Both the Cook-Urquart recursor R as well as the bounded iterator I require an absolute bound on thesize of intermediate value encountered during a recursion. Specifying such a bound a priori can becumbersome and this section provides an alternative way of bounding an iteration that is inspired bythe classes SPT and
MPT we considered in earlier work [12, 10]. The elementary notion used in thedefinition of
SPT is that of a length revision. In an
OTM computation a length revision is encounteredwhenever the answer to an oracle query is longer than any previous response. This notion of a lengthrevision can easily be translated to the realm of recursion schemes: in a recursive definition a lengthrevision happens when the return value of the step function is bigger than any of the values returnedearlier. In particular, define ϕ n ! k ( a ) : = ϕ ( ϕ ( . . . ϕ | {z } ℓ times ( a ) . . . )) where ℓ ≤ n is maximum such that the sequence of applications contains no more than k length revisions ,that is an application ϕ ( t ) where | ϕ ( t ) | exceeds | a | and | ϕ ( t ′ ) | for any previous call. In particular, when k =
0, this means that no calls return a value that exceeds | a | . For k ≥
0, the k-revision iterator I k is thefunctional defined by I k ( ϕ , a , c ) : = ϕ | c | ! k ( a ) Superficially, this definition is similar to that of the bounded iterator I from the last section. Thefunctional I k iterates a function where the iteration is bounded by k just like the bounded iterator doesfor each fixed bounding argument b . The essential difference is that k is a statically fixed parameter,i.e., I k constitutes a family of iterators. Our goal is to show that for each fixed k the operator I k is P -equivalent to the bounded iterator I (Theorem 4.3 below).Without restrictions on k , neither of the reducibilities required to prove that I k ≡ λ P I are obvious.However, the claim that I k (cid:22) λ P I should appear reasonable given the OTM -based characterization ofthe basic feasible functionals [9]. As proven in the last section, I is P -equivalent to R and thus it isenough to check that I k is a basic feasible functional, i.e., that I k is computable by an OTM whoserun-time is bounded by a second-order polynomial. This may be done in a straightforward way, but it isimportant to note that the complexity of the bounding polynomial (in terms of the depth of calls to thefunction input, rather than the degree) increases with k . In particular, while I k is P -equivalent to I forevery k , the revision parameter k provides a finer delineation of expressive power.Without an appeal to the OTM -based characterization, showing the P -equivalence of I k and I becomes more of a challenge, although the case for I is relatively straightforward: Lemma 3.1 ( I (cid:22) λ P I ) . The -revision iterator is P -reducible to the bounded iterator.Proof. The main hurdle is to account for the difference in how the violation of the bound is realized: I defaults to the previous value in the iteration while I defaults to the value it is given as bound. Set G ( ϕ , t , b ) : = t G ( ϕ , t , b ) : = (cid:26) ϕ ( t ) if | ϕ ( t ) | ≤ | b | ; t otherwise..M.Kapron and F.Steinberg 69Then I ( ϕ , a , c ) can be obtained from I ( λ t . G ( ϕ , t , a ) , a , a , c ) by simply dropping the last bit. Sincethe definition of G only uses type-1 polynomial time operations and application, the P -reducibility fol-lows.Note that for unrestricted iteration it holds that ϕ n ( ϕ n ′ ( a )) = ϕ n + n ′ ( a ) . The following observationpoints out a similar additivity property for ϕ n ! k and is the starting point for recursively constructing P -reductions of I k to I : Lemma 3.2.
For given ϕ , a and numbers k and n set ℓ : = min { i | ∀ j , i ≤ j ≤ n ⇒ ϕ i ! k ( a ) = ϕ j ! k ( a ) } , then ℓ ≤ n and it holds that ϕ n ! ( k + ) ( a ) = ϕ n − ℓ !1 ( ϕ ℓ ! k ( a )) . ( ∗ ) Proof.
Since n always fulfills the condition in the minimization, it follows that ℓ ≤ n . To prove ( ∗ ) wefirst note that the minimization condition may be satisfied in two different ways. It may be the casethat ϕ gives the same return value on all of the strings ϕ ℓ ! k ( a ) , . . . , ϕ n − k ( a ) . In this case there will be nofurther length revisions, and so ϕ n − ℓ !1 ( ϕ ℓ ! k ( a )) = ϕ n − ℓ ( ϕ ℓ ! k ( a )) = ϕ n ! ( k + ) ( a ) . Thus suppose that it is not thecase that ϕ is constant on these strings and let j be such that ℓ ≤ j ≤ n − ϕ ( ϕ j ! k ( a )) = ϕ ℓ + k ( a ) . Bydefinition of ℓ , the strings ϕ ℓ ! k ( a ) , . . . , ϕ n ! k ( a ) are still all equal. Then ϕ ( ϕ j ! k ( a )) = ϕ ( ϕ l ! k ( a )) and ϕ ( ϕ l ! k ( a )) and ϕ l + k ( a ) can only be different if the ( ℓ + ) -st call to ϕ triggers the ( k + ) -st length revision. Thus,in this case ϕ m !1 ( ϕ ℓ k ( a )) = ϕ ( ϕ ℓ ! k ( a )) = ϕ ℓ + m ! ( k + ) ( a ) for any m and in particular ( ∗ ) must hold.In fact, the above proof proves the following slightly stronger statement. Corollary 3.3.
The equality in the last Lemma may be replaced by ϕ n ! ( k + ) ( a ) = ϕ n − ℓ − ( ϕ ( ϕ ℓ ! k ( a ))) . This allows us to establish the following.
Lemma 3.4 ( I k (cid:22) λ P I ) . For k ≥ , the k-revision iterator is P -reducible to the bounded iterator.Proof. We proceed by induction on k . The case of k = k . We must now define I k + using I . By Lemma 3.2 it is sufficient to showthat there exists a function that on inputs ϕ , a , k and n returns the value ℓ and is P -reducible to I . Firstnote that the condition ϕ ik ( a ) = ϕ jk ( a ) can be checked by a function from λ ( P ∪ { I k } ) ⊆ λ ( P ∪ { I } ) ,where the inclusion follows by the induction hypothesis. Now all that remains is to use I to characterizethe bounded quantification and search used to define ℓ in Corollary 3.3. Define the following functionals: U ( ψ , a , c ) : = (cid:26) ε if ∀ i ≤| c | (cid:0) ψ ( | i , a ) | = (cid:1) ; otherwise. M ( ψ , a , c ) : = j where j = µ i ≤| c | (cid:0) | ψ ( i , a ) | > (cid:1) if such i exists, and i + U (cid:22) λ P R and appeal to Lemma 2.3 to see that it is P -reducible to I . Define V ( ψ , a , t , d ) : = (cid:26) ε if t = ε and | ψ ( | d | , a ) | = otherwise.0 Type-two Iteration withBounded Query RevisionThen U ( ψ , a , c ) = R ( λ t . λ d . V ( ψ , a , t , d ) , λ d . , ε , c ) . Since the definition of V only uses polynomial-time computable type-1 functions and application we conclude U (cid:22) λ P R . To show that M (cid:22) λ P I , firstdefine N ( ψ , a , t ) : = t N ( ψ , a , t ) : = (cid:26) t if | ψ ( | t | ˙ − , a ) | ≤ t ≫ A ( ψ , a ) : = (cid:26) if | ψ ( ε , a ) | > otherwise.Then M ( ψ , a , c ) = m = I ( λ t . N ( ψ , a , t ) , A ( ψ , a ) , c , c ) ≫
1. In particular, if m ends in , then m = j + and if it ends in then m = | c | + . Moving to lookahead revision, the definition is similar. Consider the following variant of function itera-tion ϕ n ? k ( a ) : = ϕ ( ϕ ( . . . ϕ | {z } ℓ times ( a ) . . . )) where ℓ ≤ n is maximum such that the sequence of applications contains no more than k lookaheadrevisions , that is an application ϕ ( t ) where | t | exceeds | t ′ | for any previous call | ϕ ( t ′ ) | . Note that wehave not included the initial call ϕ ( a ) as a lookahead revision (choosing to do so would not change anyresults below.) Then, for k ≥
0, the k-lookahead revision iterator I ′ k is the functional such that I ′ k ( ϕ , a , c ) = ϕ | c | ? k ( a ) We now consider the relative power of I ′ k . Lemma 4.1.
For any k ≥ , I ′ k (cid:22) λ P I k .Proof. We claim that I ′ k ( ϕ , a , c ) = ϕ ( I k ( ϕ , a , c ≫ )) . This is clear in the case that there are no morethan k length revisions in the evaluation of I k ( ϕ , a , b , c ≫ ) , as any lookahead revision correspondsexactly to a preceding length revision, and so I ′ k ( ϕ , a , c ) = ϕ | c | ( a ) = ϕ ( I k ( ϕ , a , c ≫ )) . Otherwisesuppose that I k ( ϕ , a , b , c ≫ ) = ϕ ℓ ( a ) , which means in particular that ℓ is the minimum value lessthan | c | such that evaluating ϕ ℓ + ( a ) results in k + ℓ is the minimum valueless than | c | such that ϕ ℓ + ( a ) results in k + I ′ k ( ϕ , a , c ) = ϕ ℓ + ( a ) = ϕ ( I k ( ϕ , a , c ≫ )) . Lemma 4.2.
For any k ≥ , I ′ (cid:22) λ P I ′ k .Proof. Unfortunately, the situation is a little less straightforward than we might hope, as I ′ and I ′ k differ slightly in the way they do bounding. I ′ k expects queries to be bounded in length by previousqueries while I ′ uses an explicit bound b . Define ψ as follows: ψ ( t , a , b ) : = lmin ( a , b ) ψ ( t , a , b ) : = lmin ( ϕ ( t ) , b ) Claim . For all a , b , c , I ′ k ( λ t . ψ ( t , a , b ) , b , c ) = lmin ( I ′ ( ϕ , a , b , c ) , b ) To prove this claim, first note the in the iteration on the left, the first call to ψ is b , of length | b | +
1. Allsubsequent calls are clearly bounded by | b | +
1. So there will be no lookahead revisions in this iteration.M.Kapron and F.Steinberg 71and it remains to prove equality without consideration of the lookahead bound k . We use induction on c .When c = ε , I ′ k ( λ t . ψ ( t , a , b ) , b , c ) = I ′ k ( λ t . ψ ( t , a , b ) , b , )= ψ ( I ′ k ( λ t . ψ ( t , a , b ) , b , ε ) , a , b )= ψ ( b , a , b )= lmin ( a , b ) = lmin ( I ′ ( ϕ , a , b , c ) , b ) . Now assume that the claim holds for c . Then I ′ k ( λ t . ψ ( t , a , b ) , b , c i ) = ψ ( I ′ k ( λ t . ψ ( t , a , b ) , b , c ) , a , b )= ψ ( lmin ( I ′ ( ϕ , a , b , c ) , b ) , a , b )= lmin ( ϕ ( lmin ( I ′ ( ϕ , a , b , c ) , b )) , b ) = lmin ( I ′ ( ϕ , a , b , c i ) , b ) Now define I ′′ as follows: I ′′ ( ϕ , a , b , c ) = (cid:26) a if c = ε ; ϕ ( I ′ k ( λ t . ψ ( t , a , b ) , b , ( c ≫ )) ≫ ) otherwise.First note that I ′′ (cid:22) λ P I ′ k , as definition by cases is a poly-time operation. When c = ε , I ′′ ( ϕ , a , b , c ) = a = I ′ ( ϕ , a , b , c ) . Otherwise, by the claim, I ′ k ( λ t . ψ ( t , a , b ) , b , ( c ≫ )) ≫ = lmin ( I ′ ( ϕ , a , b , c ≫ ) , b ) , so that I ′′ ( ϕ , a , b , c ) = ϕ ( lmin ( I ′ ( ϕ , a , b , c ≫ ) , b )) = I ′ ( ϕ , a , b , c ) . Putting everything together, we have a characterization which is the main result of this paper.
Theorem 4.3.
For every k ≥ , I ≡ λ P I k ≡ λ P I ′ k ≡ λ P I ′ . The implementation of I k by I given in Lemma 3.4 requires considerable overhead, involving abounded quanitification and bounded search at each step. An implementation which directly followsthis definition is poly-time, but is needlessly complex. The following observation (which in this set-ting correpsonds to tail-recursion elimination) will simplify things considerably. In particular, we notean alternate characterization of ϕ n : ϕ ( a ) = a and ϕ n + ( a ) = ϕ n ( ϕ ( a )) . This leads to the followingcharacterization of ϕ n ! k . Lemma 5.1.
For all n , k ≥ we have ϕ k ( a ) = a ϕ n + ( a ) = (cid:26) a if | ϕ ( a ) | > | a | ; ϕ n !0 ( ϕ ( a )) otherwise. ϕ n + ( k + ) ( a ) = (cid:26) ϕ n ! k ( ϕ ( a )) if | ϕ ( a ) | > | a | ; ϕ n ! ( k + ) ( ϕ ( a )) otherwise. Proof.
We prove by induction on k that the claim holds for all n . When k =
0, iteration stops (absolutely)if | ϕ ( a ) | > | a | , otherwise it proceeds to the next step. Now assume for k that the claim holds for all n .We show that for k + n , by induction on n . When n = n , and consider ϕ n + ( k + ) ( a ) . Clearly, if | ϕ ( a ) | ≤ | a | , no length revision occurs on the first call,and so k + n calls. Otherwise, only k length revisions are availablefor the remaining calls.We also note that, implicit in the proof of Lemma 3.4, is an implementation which is also efficient– in particular, if we “unwind” the induction, we are eventually left relying only on I . As describedin [10], § We have provided a new linguistic characterization of the higher-order polynomial time via iterationschemes that restrict the number of times a step function, presented as an oracle, may return an answer orbe presented an input which in length exceeds all previous answers (resp. queries). The characterizationand the methods used to prove it lead to a number of questions and potential directions for future research.The characterization provided in this paper could be termed intrinsic , in that no external boundingis present in the iteration schemes I k and I ′ k . The condition itself, however, appears to depend on thedynamics of a particular computation. On its face it is not a structural/syntactic restriction, as is usualin implicit computational complexity. This suggests two directions for further research. The first is toinvestigate the possibility of statically deriving bounds on query revision. The second is to investigatedistinctions on how computational resources are bounded as suggested by this and related work, forexample intrinsic versus extrinsic, dynamic versus static, and feasibly constructive versus non-feasiblyconstructive (an example of non-feasibly constructive bounding would be the second-order polynomialsof [9]). A related observation is that iteration with bounded query revision appears to be a generalizationof non-size-increasing computation [7]. This apparent connection merits further investigation.In § catch and throw ) may be relevant to the characterization of complexity classes in thissetting. We note that such control operators have been shown in [2] to be relevant to the general character-ization of sequential higher-order computation. Here we only scratch the surface. Further investigationof these and related techniques in the context of linguistic characterizations of computational complexitycould prove fruitful.As noted at several points in our development, there are issues of finer-grained complexity that arisefrom our translations. This gives rise to natural questions on the efficiency, or syntactic complexity, oftranslations, which bear further investigation.Finally, while we have drawn an analogy between OTM s with bounded query revision (as intro-duced in [10]) and certain recursion schemes, we have not investigated just how closely related they are.While the equivalences proved in [10] and in this paper imply an equivalence for all the models, a directproof would be very interesting in furthering our understanding of poly-time
OTM s. It would be veryrewarding if a simplified proof of the equivalence of [9] could be obtained in this setting..M.Kapron and F.Steinberg 73
References [1] Stephen Bellantoni & Stephen A. Cook (1992):
A New Recursion-Theoretic Characterization of the PolytimeFunctions . ComputationalComplexity 2, pp. 97–110, doi:10.1007/BF01201998.[2] R. Cartwright, P.L. Curien & M. Felleisen (1994):
Fully Abstract Semantics for Observably Sequential Lan-guages . InformationandComputation 111(2), pp. 297 – 401, doi:10.1006/inco.1994.1047.[3] A. Cobham (1965):
The intrinsic computational difficulty of functions . In Yehoshua Bar-Hillel, editor: Logic,Methodologyand Philosophy of Science: Proc. 1964 Intl. Congress (Studies in Logic and the FoundationsofMathematics), North-Holland Publishing, pp. 24–30.[4] S.A. Cook (1992):
Computability and complexity of higher type functions . In: Logic from com-puter science (Berkeley, CA, 1989), Math. Sci. Res. Inst. Publ. 21, Springer, New York, pp. 51–72,doi:10.1007/978-1-4612-2822-6 3.[5] S.A. Cook & B.M. Kapron (1990):
Characterizations of the basic feasible functionals of finite type . In:Feasible mathematics (Ithaca, NY, 1989), Progr. Comput. Sci. Appl. Logic 9, Birkh¨auser, pp. 71–96,doi:10.1007/978-1-4612-3466-1 5.[6] S.A. Cook & A. Urquhart (1993):
Functional interpretations of feasibly constructive arithmetic . Ann. PureAppl.Logic63(2), pp. 103–200, doi:10.1016/0168-0072(93)90044-E.[7] Martin Hofmann (2003):
Linear types and non-size-increasing polynomial time computation . Inf. Comput.183(1), pp. 57–85, doi:10.1016/S0890-5401(03)00009-9.[8] A. Ignjatovic & A. Sharma (2004):
Some applications of logic to feasibility in higher types . ACM TOCL5(2), pp. 332–350, doi:10.1145/976706.976713.[9] B.M. Kapron & S.A. Cook (1996):
A new characterization of type- feasibility . SIAMJ.Comput.25(1), pp.117–132, doi:10.1137/S0097539794263452.[10] B.M. Kapron & F. Steinberg (2018): Type-two polynomial-time and restricted lookahead . In: Proceedingsofthe33rdAnnualACM/IEEESymposiumonLogicinComputerScience(Oxford,UK),2018, ACM, NewYork, pp. 579–598, doi:10.1145/3209108.3209124.[11] Bruce M. Kapron (1991):
Feasible Computation in Higher Types . Technical Report 249/91, Computer Sci-ence Department, University of Toronto.[12] Akitoshi Kawamura & Florian Steinberg (2017):
Polynomial Running Times for Polynomial-Time OracleMachines . In: 2nd International Conference on Formal Structures for Computation and Deduction, FSCD2017,September3-9,2017,Oxford,UK, pp. 23:1–23:18, doi:10.4230/LIPIcs.FSCD.2017.23.[13] Daniel Leivant (1991):
A Foundational Delineation of Computational Feasiblity . In: Proceedings of theSixthAnnualIEEESymposiumonLogicin ComputerScience(Amsterdam,TheNetherlands),1991, IEEEComputer Society, pp. 2–11, doi:10.1109/LICS.1991.151625.[14] K. Mehlhorn (1976):
Polynomial and abstract subrecursive classes . J. Comp.Sys. Sci. 12(2), pp. 147–178,doi:10.1016/S0022-0000(76)80035-9.[15] Raphael M. Robinson (1947):
Primitive recursive functions . Bull. Amer. Math. Soc. 53(10), pp. 925–942,doi:10.1090/S0002-9904-1947-08911-4.[16] Anil Seth (1993):