Non-polynomial worst-case analysis of recursive programs

K Chatterjee, H Fu, AK Goharshady - ACM Transactions on …, 2019 - dl.acm.org
ACM Transactions on Programming Languages and Systems (TOPLAS), 2019dl.acm.org
We study the problem of developing efficient approaches for proving worst-case bounds of
non-deterministic recursive programs. Ranking functions are sound and complete for
proving termination and worst-case bounds of non-recursive programs. First, we apply
ranking functions to recursion, resulting in measure functions. We show that measure
functions provide a sound and complete approach to prove worst-case bounds of non-
deterministic recursive programs. Our second contribution is the synthesis of measure …
We study the problem of developing efficient approaches for proving worst-case bounds of non-deterministic recursive programs. Ranking functions are sound and complete for proving termination and worst-case bounds of non-recursive programs. First, we apply ranking functions to recursion, resulting in measure functions. We show that measure functions provide a sound and complete approach to prove worst-case bounds of non-deterministic recursive programs. Our second contribution is the synthesis of measure functions in non-polynomial forms. We show that non-polynomial measure functions with logarithm and exponentiation can be synthesized through abstraction of logarithmic or exponentiation terms, Farkas Lemma, and Handelman’s Theorem using linear programming. While previous methods obtain polynomial worst-case bounds, our approach can synthesize bounds of various forms including O(n log n) and O(nr), where r is not an integer. We present experimental results to demonstrate that our approach can efficiently obtain worst-case bounds of classical recursive algorithms such as (i) Merge sort, Heap sort, and the divide-and-conquer algorithm for the Closest Pair problem, where we obtain O(n log n) worst-case bound, and (ii) Karatsuba’s algorithm for polynomial multiplication and Strassen’s algorithm for matrix multiplication, for which we obtain O(nr) bounds such that r is not an integer and is close to the best-known bound for the respective algorithm. Besides the ability to synthesize non-polynomial bounds, we also show that our approach is equally capable of obtaining polynomial worst-case bounds for classical programs such as Quick sort and the dynamic programming algorithm for computing Fibonacci numbers.
ACM Digital Library