Collected Size Semantics for Functional Programs over Lists

This work introduces collected size semantics of strict functional programs over lists. The collected size semantics of a function definition is a multivalued size function that collects the dependencies between every possible output size and the corresponding input sizes. Such functions annotate standard types and are defined by conditional rewriting rules generated during type inference. We focus on the connection between the rewriting rules and lower and upper bounds on the multivalued size functions, when the bounds are given by piecewise polynomials. We show how, given a set of conditional rewriting rules, one can infer bounds that define an indexed family of polynomials that approximates the multivalued size function. Using collected size semantics we are able to infer nonmonotonic and non-linear lower and upper polynomial bounds for many functional programs. As a feasibility study, we use the procedure to infer lower and upper polynomial size-bounds on typical functions of a list library.

[1]  Kenneth MacKenzie,et al.  Mobile Resource Guarantees and Policies , 2005, CASSIS.

[2]  Kazushige Terui,et al.  Verification of Ptime Reducibility for system F Terms: Type Inference in Dual Light Affine Logic , 2007, Log. Methods Comput. Sci..

[3]  Elvira Albert,et al.  Automatic Inference of Upper Bounds for Recurrence Relations in Cost Analysis , 2008, SAS.

[4]  Marko C. J. D. van Eekelen,et al.  Inferring static non-monotonous size-aware types through testing , 2007 .

[5]  Olha Shkaravska,et al.  Size Analysis of Algebraic Data Types , 2008, TFP 2008 2008.

[6]  O. Shkaravska,et al.  Collected Size Semantics for Functional Programs ? , 2008 .

[7]  Pedro B. Vasconcelos Space cost analysis using sized types , 2008 .

[8]  Marco Gaboardi,et al.  A logical account of pspace , 2008, POPL '08.

[9]  Chris Okasaki,et al.  Purely functional data structures , 1998 .

[10]  Roberto M. Amadio Synthesis of max-plus quasi-interpretations , 2005, Fundam. Informaticae.

[11]  Nao Hirokawa,et al.  Polynomial Interpretations with Negative Coefficients , 2004, AISC.

[12]  Olha Shkaravska,et al.  Inferring static non-monotonically sized types through testing , 2007 .

[13]  Marko C. J. D. van Eekelen,et al.  Polynomial Size Analysis of First-Order Functions , 2007, TLCA.

[14]  Bart Jacobs,et al.  AHA: Amortized Heap Space Usage Analysis , 2007, Trends in Functional Programming.

[15]  Elvira Albert,et al.  Cost Analysis of Java Bytecode , 2007, ESOP.

[16]  Martin Hofmann,et al.  Static prediction of heap space usage for first-order functional programs , 2003, POPL '03.