Calculating Sized Types

Many program optimizations and analyses, such as array-bounds checking, termination analysis, etc., depend on knowing the size of a function's input and output. However, size information can be difficult to compute. Firstly, accurate size computation requires detecting a size relation between different inputs of a function. Secondly, different optimizations and analyses may require slightly different size information, and thus slightly different computation. Literature in size computation has mainly concentrated on size checking, instead of size inference. In this paper, we provide a generic framework on which different size variants can be expressed and computed. We also describe an effective algorithm for inferring, instead of checking, size information. Size information are expressed in terms of Presburger formulae, and our algorithm utilizes the Omega Calculator to compute as exact a size information as possible, within the linear arithmetic capability.

[1]  Nicolas Halbwachs,et al.  Dynamic Partitioning in Analyses of Numerical Properties , 1999, SAS.

[2]  William Pugh,et al.  A practical algorithm for exact array dependence analysis , 1992, CACM.

[3]  Carsten Kehler Holst,et al.  Finiteness Analysis , 1991, Conference on Functional Programming Languages and Computer Architecture.

[4]  Nicolas Halbwachs,et al.  Automatic discovery of linear restraints among variables of a program , 1978, POPL.

[5]  Alexander Schrijver,et al.  Theory of linear and integer programming , 1986, Wiley-Interscience series in discrete mathematics and optimization.

[6]  Wei-Ngan Chin,et al.  Deriving Pre-Conditions for Array Bound Check Elimination , 2001, APLAS.

[7]  P. Bernays,et al.  Grundlagen der Mathematik , 1934 .

[8]  Danny De Schreye,et al.  Termination of Logic Programs: The Never-Ending Story , 1994, J. Log. Program..

[9]  Nicolas Halbwachs,et al.  Verification of Real-Time Systems using Linear Relation Analysis , 1997, Formal Methods Syst. Des..

[10]  Andy King,et al.  Lower-bound Time-complexity Analysis of Logic Programs , 1997, ILPS.

[11]  Annalisa Bossi,et al.  Typed Norms , 1992, ESOP.

[12]  Amr Sabry,et al.  Proving the correctness of reactive systems using sized types , 1996, POPL '96.

[13]  Allen Van Gelder,et al.  Termination detection in logic programs using argument sizes (extended abstract) , 1991, PODS.

[14]  William Pugh,et al.  Transitive Closure of Infinite Graphs and its Applications , 1995, Int. J. Parallel Program..

[15]  Frank Pfenning,et al.  Dependent types in practical programming , 1999, POPL '99.

[16]  Wei-Ngan Chin,et al.  A bounds inference method for vector-based memoization , 1997, ICFP '97.

[17]  Yehoshua Sagiv,et al.  Inference of Inequality Constraints in Logic Programs. , 1991, PODS 1991.

[18]  A. Tarski,et al.  Cylindric Algebras. Part II , 1988 .

[19]  Zoltan Somogyi,et al.  Termination Analysis for Mercury , 1997, SAS.

[20]  Neil D. Jones,et al.  BTA Algorithms to Ensure Termination of Off-Line Partial Evaluation , 1996, Ershov Memorial Conference.

[21]  Yehoshua Sagiv,et al.  Inference of inequality constraints in logic programs (extended abstracts) , 1991, PODS '91.

[22]  Frank Pfenning,et al.  Eliminating array bound checking through dependent types , 1998, PLDI.

[23]  Fritz Henglein,et al.  Type inference with polymorphic recursion , 1993, TOPL.

[24]  William Pugh,et al.  The Omega test: A fast and practical integer programming algorithm for dependence analysis , 1991, Proceedings of the 1991 ACM/IEEE Conference on Supercomputing (Supercomputing '91).

[25]  Jeffrey D. Ullman,et al.  Efficient tests for top-down termination of logical rules , 1988, JACM.

[26]  Lutz Plümer Termination Proofs for Logic Programs , 1990, Lecture Notes in Computer Science.

[27]  Martin Odersky,et al.  Type Inference with Constrained Types , 1999, Theory Pract. Object Syst..

[28]  Nicolas Halbwachs,et al.  About Synchronous Programming and Abstract Interpretation , 1998, Sci. Comput. Program..

[29]  Andy King,et al.  Inferring Argument Size Relationships with CLP(R) , 1996, LOPSTR.