skip to main content
research-article

Multivariate amortized resource analysis

Published:26 January 2011Publication History
Skip Abstract Section

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 paper we generalize this to arbitrary multivariate polynomial functions thus allowing bounds of the form mn which had to be grossly overestimated by m2+n2 before. Our framework even encompasses bounds like i,j≤n m_i mj where the mi 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 super-linear 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 super-linear 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.

Skip Supplemental Material Section

Supplemental Material

33-mpeg-4.mp4

mp4

281.4 MB

References

  1. E. Albert, P. Arenas, S. Genaim, G. Puebla, and D. Zanardini. Cost Analysis of Java Bytecode. In 16th Euro. Symp. on Prog. (ESOP'07), pages 157--172, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. E. Albert, P. Arenas, S. Genaim, and G. Puebla. Automatic Inference of Upper Bounds for Recurrence Relations in Cost Analysis. In 15th Static Analysis Symp. (SAS'08), pages 221-- 237, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. E. Albert, P. Arenas, S. Genaim, M. G´omez-Zamalloa, G. Puebla, D. Ram´1rez, G. Rom´an, and D. Zanardini. Termination and Cost Analysis with COSTA and its User Interfaces. Electr. Notes Theor. Comput. Sci., 258(1):109--121, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. R. Atkey. Amortised Resource Analysis with Separation Logic. In 19th Euro. Symp. on Prog. (ESOP'10), pages 85-- 103, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. R. Benzinger. Automated Higher-Order Complexity Analysis. Theor. Comput. Sci., 318(1--2):79--103, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. L. Beringer, M. Hofmann, A. Momigliano, and O. Shkaravska. Automatic Certification of Heap Consumption. In Log. f. Prog., AI, and Reas., 11th Conf. (LPAR'04), pages 347--362, 2004.Google ScholarGoogle Scholar
  7. B. Campbell. Amortised Memory Analysis using the Depth of Data Structures. In 18th Euro. Symp. on Prog. (ESOP'09), pages 190--204, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. W.-N. Chin and S.-C. Khoo. Calculating Sized Types. High.- Ord. and Symb. Comp., 14(2--3):261--300, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. K. Crary and S. Weirich. Resource Bound Certification. In 27th ACM Symp. on Principles of Prog. Langs. (POPL'00), pages 184--198, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. N. A. Danielsson. Lightweight Semiformal Time Complexity Analysis for Purely Functional Data Structures. In 35th ACM Symp. on Principles Prog. Langs. (POPL'08), pages 133--144, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. P. Flajolet, B. Salvy, and P. Zimmermann. Automatic Average-case Analysis of Algorithms. Theoret. Comput. Sci., 79(1):37--109, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. B. Grobauer. Cost Recurrences for DML Programs. In 6th Int. Conf. on Funct. Prog. (ICFP'01), pages 253--264, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. B. S. Gulavani and S. Gulwani. A Numerical Abstract Domain Based on Expression Abstraction and Max Operator with Application in Timing Analysis. In Comp. Aid. Verification, 20th Int. Conf. (CAV '08), pages 370--384, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. S. Gulwani and F. Zuleger. The Reachability-Bound Problem. In Conf. on Prog. Lang. Design and Impl. (PLDI'10), pages 292--304, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. S. Gulwani, K. K. Mehra, and T. M. Chilimbi. SPEED: Precise and Efficient Static Estimation of Program Computational Complexity. In 36th ACM Symp. on Principles of Prog. Langs. (POPL'09), pages 127--139, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. Hoffmann and M. Hofmann. Amortized Resource Analysis with Polynomial Potential. In 19th Euro. Symp. on Prog. (ESOP'10), pages 287--306, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. J. Hoffmann and M. Hofmann. Amortized Resource Analysis with Polymorphic Recursion and Partial Big-Step Operational Semantics. In 8th Asian Symp. on Prog. Langs. (APLAS'10), 2010. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. Hofmann and S. Jost. Static Prediction of Heap Space Usage for First-Order Functional Programs. In 30th ACM Symp. on Principles of Prog. Langs. (POPL'03), pages 185-- 197, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. M. Hofmann and S. Jost. Type-Based Amortised Heap-Space Analysis. In 15th Euro. Symp. on Prog. (ESOP'06), pages 22--37, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. M. Hofmann and D. Rodriguez. Efficient Type-Checking for Amortised Heap-Space Analysis. In 18th Conf. on Comp. Science Logic (CSL'09). LNCS, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. J. Hughes and L. Pareto. Recursion and Dynamic Datastructures in Bounded Space: Towards Embedded ML Programming. In 4th Int. Conf. on Funct. Prog. (ICFP'99), pages 70--81, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. J. Hughes, L. Pareto, and A. Sabry. Proving the Correctness of Reactive Systems Using Sized Types. In 23th ACM Symp. on Principles of Prog. Langs. (POPL'96), pages 410--423, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. S. Jost, H.-W. Loidl, K. Hammond, N. Scaife, and M. Hofmann. Carbon Credits for Resource-Bounded Computations using Amortised Analysis. In 16th Symp. on Form. Meth. (FM'09), pages 354--369, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. S. Jost, K. Hammond, H.-W. Loidl, and M. Hofmann. Static Determination of Quantitative Resource Usage for Higher- Order Programs. In 37th ACM Symp. on Principles of Prog. Langs. (POPL'10), pages 223--236, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. O. Shkaravska, R. van Kesteren, and M. C. van Eekelen. Polynomial Size Analysis of First-Order Functions. In Typed Lambda Calc. Apps. (TLCA'07), pages 351--365, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. R. E. Tarjan. Amortized Computational Complexity. SIAM J. Algebraic Discrete Methods, 6(2):306--318, 1985.Google ScholarGoogle Scholar
  27. R. Wilhelm et al. The Worst-Case Execution-Time Problem Overview of Methods and Survey of Tools. ACM Trans. Embedded Comput. Syst., 7(3), 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Multivariate amortized resource analysis

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 46, Issue 1
          POPL '11
          January 2011
          624 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/1925844
          Issue’s Table of Contents
          • cover image ACM Conferences
            POPL '11: Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
            January 2011
            652 pages
            ISBN:9781450304900
            DOI:10.1145/1926385

          Copyright © 2011 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 26 January 2011

          Check for updates

          Qualifiers

          • research-article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader