Abstract

Determining upper bounds on the time complexity of a program is a fundamental problem with a variety of applications, such as performance debugging, resource certification, and compile-time optimizations. Automated techniques for cost analysis excel at bounding the resource complexity of programs that use integer values and linear arithmetic. Unfortunately, they fall short when execution traces become more involved, esp. when data dependencies may affect the termination conditions of loops. In such cases, state-of-the-art analyzers have shown to produce loose bounds, or even no bound at all.We propose a novel technique that generalizes the common notion of recurrence relations based on ranking functions. Existing methods usually unfold one loop iteration, and examine the resulting relations between variables. These relations assist in establishing a recurrence that bounds the number of loop iterations. We propose a different approach, where we derive recurrences by comparing whole traces with whole traces of a lower rank, avoiding the need to analyze the complexity of intermediate states. We offer a set of global properties, defined with respect to whole traces, that facilitate such a comparison, and show that these properties can be checked efficiently using a handful of local conditions. To this end, we adapt state squeezers, an induction mechanism previously used for verifying safety properties. We demonstrate that this technique encompasses the reasoning power of bounded unfolding, and more. We present some seemingly innocuous, yet intricate, examples where previous tools based on cost relations and control flow analysis fail to solve, and that our squeezer-powered approach succeeds.

Highlights

  • Cost analysis is the problem of estimating the resource usage of a given program, over all of its possible executions

  • When used in combination with functional verification, cost analysis ensures that a program is correct, but completes its processing in a reasonable amount of time, uses a reasonable amount of memory, communication bandwidth, etc

  • Together with rank-bounding functions, are used for extracting recurrence relations whose solutions overapproximate the length of executions of the input program. – We formalize the notions of state squeezers, partitioned simulation and rank bounding functions that underlie the approach, and establish conditions that ensure soundness of the recurrence relations. – We demonstrate that squeezers and rank bounding functions can be efficiently synthesized and verified, due to their compactness, especially relative to explicit ranking functions. – We implemented our approach and applied it successfully to several small but intricate programs, some of which could not have been handled by existing techniques

Read more

Summary

Introduction

Cost analysis is the problem of estimating the resource usage of a given program, over all of its possible executions. Every step of the program, called a ranking function In this case, an upper bound on the measure of the initial states comprises an upper bound on the program’s time complexity. While [22] limits each trace to relate to a single lower-rank trace, we have found that it is sometimes beneficial to employ a decomposition of the original trace into several consecutive trace segments, so that each segment corresponds to some (possibly different) lower-rank trace.The segmentation simplifies the analysis of the length of the entire trace, since it creates sub-analyses that are easier to carry out, and the sum of which gives the desired recurrence formula This enables a richer set of recurrences to be constructed automatically, namely non-single recurrences (meaning that the recursive reference may appear more than once on the right hand side of the equation). Together with rank-bounding functions, are used for extracting recurrence relations whose solutions overapproximate the length of executions of the input program. – We formalize the notions of state squeezers, partitioned simulation and rank bounding functions that underlie the approach, and establish conditions that ensure soundness of the recurrence relations. – We demonstrate that squeezers and rank bounding functions can be efficiently synthesized and verified, due to their compactness, especially relative to explicit ranking functions. – We implemented our approach and applied it successfully to several small but intricate programs, some of which could not have been handled by existing techniques

Overview
Complexity Analysis based on Squeezers
Time complexity as a function of rank
Complexity decomposition by partitioned simulation
Extraction of recurrence relations over ranks
Establishing the requirements of the recurrence relations extraction
Synthesis
Verification
Empirical Evaluation
Experiments
Case study
Related Work
Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call