Size Invariant and Ranking Function Synthesis in a Functional Language

Size analysis is concerned with the compile-time determination of upper bounds to the size of program variables, including the size of the results returned by functions. It is useful in many situations and also as a prior step to facilitate other analyses, such as termination proofs. Ranking function synthesis is one way of proving termination of loops or of recursive definitions. We present a result in automatic inference of size invariants, and of ranking functions proving termination of functional programs, by adapting linear techniques developed for other languages. The results are accurate and allow us to solve some problems left open in previous works on automatic inference of safe memory bounds.

[1]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[2]  Henny B. Sipma,et al.  Practical Methods for Proving Program Termination , 2002, CAV.

[3]  Michael Codish,et al.  A SAT-Based Approach to Size Change Termination with Global Ranking Functions , 2008, TACAS.

[4]  Nicolas Halbwachs,et al.  Combining Widening and Acceleration in Linear Relation Analysis , 2006, SAS.

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

[6]  Kousha Etessami,et al.  Analysis of Recursive Game Graphs Using Data Flow Equations , 2004, VMCAI.

[7]  Brian Campbell,et al.  Amortised Memory Analysis Using the Depth of Data Structures , 2009, ESOP.

[8]  Clara Segura,et al.  A Simple Region Inference Algorithm for a First-Order Functional Language , 2009, WFLP.

[9]  Ricardo Peña-Marí,et al.  A Space Consumption Analysis by Abstract Interpretation , 2009, FOPARA.

[10]  Neil D. Jones,et al.  Termination Analysis of Higher-Order Functional Programs , 2005, APLAS.

[11]  Mario Rodríguez-Artalejo,et al.  Functional and Constraint Logic Programming , 2001, CCL.

[12]  Frédéric Mesnard,et al.  Computing convex hulls with a linear solver , 2003, Theory and Practice of Logic Programming.

[13]  Andreas Podelski,et al.  A Complete Method for the Synthesis of Linear Ranking Functions , 2004, VMCAI.

[14]  Amir M. Ben-Amram,et al.  Program termination analysis in polynomial time , 2002, TOPL.

[15]  Neil D. Jones,et al.  The size-change principle for program termination , 2001, POPL '01.

[16]  Rajeev Alur,et al.  A Temporal Logic of Nested Calls and Returns , 2004, TACAS.

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

[18]  Clara Segura,et al.  A type system for safe memory management and its proof of correctness , 2008, PPDP.

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

[20]  Roberto Bagnara,et al.  Precise Widening Operators for Convex Polyhedra , 2003, SAS.

[21]  Paul Feautrier,et al.  Multi-dimensional Rankings, Program Termination, and Complexity Bounds of Flowchart Programs , 2010, SAS.

[22]  A. Rybalchenko,et al.  Transition invariants , 2004, LICS 2004.