Test-based inference of polynomial loop-bound functions

This paper presents an interpolation-based method of inferring arbitrary degree loop-bound functions for Java programs. Given a loop, by its "loop-bound function" we mean a function with the numeric program variables as its parameters, that is used to bound the number of loop-iterations. Using our analysis, loop-bound functions that are polynomials with natural, rational or real coefficients can be found. Analysis of loop bounds is important in several different areas, including worst-case execution time (WCET) and heap consumption analysis, optimising compilers and termination-analysis. While several other methods exist to infer numerical loop bounds, we know of no other research on the inference of non-linear loop-bound functions. Additionally, the inferred bounds are provable using external tools, e.g. KeY. To infer a loop-bound function for a given loop it is instrumented with a counter and executed on a well-chosen set of values of the numerical program variables. By well-chosen we mean that using these test values and the corresponding values of the counter, one can construct a unique interpolating polynomial. The uniqueness and the existence of the interpolating polynomial is guaranteed if the input values are in the so-called NCA-configuration, known from multivariate-polynomial interpolation theory. The constructed interpolating polynomial presumably bounds the dependency of the number of loop iterations on arbitrary values of the program variables. This hypothesis is verified by a third-party proof assistant. A prototype tool has been developed which implements this method. This prototype can infer piecewise polynomial loop-bound functions for a large class of loops in Java programs. Applicability of the prototype has been tested on a series of safety-critical case studies. For most of the loops in the case studies, loop-bound functions could be inferred (and verified using a proof assistant).

[1]  Peter H. Schmitt,et al.  Provably correct loops bounds for realtime Java programs , 2006, JTRES '06.

[2]  Eric Jenn,et al.  Use of PERC Pico in the AIDA avionics platform , 2009, JTRES '09.

[3]  Jan Gustafsson,et al.  Loop Bound Analysis based on a Combination of Program Slicing, Abstract Interpretation, and Invariant Analysis , 2007, WCET.

[4]  Bernhard Beckert,et al.  Verification of Object-Oriented Software. The KeY Approach - Foreword by K. Rustan M. Leino , 2007, The KeY Approach.

[5]  Daniel Cordes,et al.  A Fast and Precise Static Loop Analysis Based on Abstract Interpretation, Program Slicing and Polytope Models , 2009, 2009 International Symposium on Code Generation and Optimization.

[6]  Amir M. Ben-Amram Size-Change Termination, Monotonicity Constraints and Ranking Functions , 2009, CAV.

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

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

[9]  Jedrzej Fulara,et al.  Practically Applicable Formal Methods , 2009, SOFSEM.

[10]  Jan Vitek,et al.  CDx: a family of real-time Java benchmarks , 2009, JTRES '09.

[11]  Marko C. J. D. van Eekelen,et al.  Polynomial Size Analysis of First-Order Shapely Functions , 2009, Log. Methods Comput. Sci..

[12]  Sumit Gulwani,et al.  SPEED: Symbolic Complexity Bound Analysis , 2009, CAV.

[13]  E. Albert,et al.  Dealing with Numeric Fields in Termination Analysis of Java-like Languages ⋆ , 2008 .

[14]  Pascal Sainrat,et al.  Static Loop Bound Analysis of C Programs Based on Flow Analysis and Abstract Interpretation , 2008, 2008 14th IEEE International Conference on Embedded and Real-Time Computing Systems and Applications.

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

[16]  Gary T. Leavens,et al.  Beyond Assertions: Advanced Specification and Verification with JML and ESC/Java2 , 2005, FMCO.

[17]  Sumit Gulwani,et al.  Control-flow refinement and progress invariants for bound analysis , 2009, PLDI '09.