Affiliation:
1. Yale University, New Haven, CT
2. Ludwig-Maximilians-Universität München, Germany
Abstract
We study the problem of automatically analyzing the worst-case resource usage of procedures with several arguments. Existing automatic analyses based on amortization or sized types bound the resource usage or result size of such a procedure by a sum of unary functions of the sizes of the arguments.
In this article we generalize this to arbitrary multivariate polynomial functions thus allowing bounds of the form
mn
which had to be grossly overestimated by
m
2
+
n
2
before. Our framework even encompasses bounds like ∑
i,j≤ n
m
i
m
j
where the
m
i
are the sizes of the entries of a list of length
n
.
This allows us for the first time to derive useful resource bounds for operations on matrices that are represented as lists of lists and to considerably improve bounds on other superlinear operations on lists such as longest common subsequence and removal of duplicates from lists of lists. Furthermore, resource bounds are now closed under composition which improves accuracy of the analysis of composed programs when some or all of the components exhibit superlinear resource or size behavior.
The analysis is based on a novel multivariate amortized resource analysis. We present it in form of a type system for a simple first-order functional language with lists and trees, prove soundness, and describe automatic type inference based on linear programming.
We have experimentally validated the automatic analysis on a wide range of examples from functional programming with lists and trees. The obtained bounds were compared with actual resource consumption. All bounds were asymptotically tight, and the constants were close or even identical to the optimal ones.
Funder
Defense Advanced Research Projects Agency
Division of Computer and Network Systems
Publisher
Association for Computing Machinery (ACM)
Cited by
94 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献