skip to main content
10.1145/1328438.1328457acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Lightweight semiformal time complexity analysis for purely functional data structures

Published:07 January 2008Publication History

ABSTRACT

Okasaki and others have demonstrated how purely functional data structures that are efficient even in the presence of persistence can be constructed. To achieve good time bounds essential use is often made of laziness. The associated complexity analysis is frequently subtle, requiring careful attention to detail, and hence formalising it is valuable. This paper describes a simple library which can be used to make the analysis of a class of purely functional data structures and algorithms almost fully formal. The basic idea is to use the type system to annotate every function with the time required to compute its result. An annotated monad is used to combine time complexity annotations. The library has been used to analyse some existing data structures, for instance the deque operations of Hinze and Paterson's finger trees.

References

  1. Ralph Benzinger. Automated higher-order complexity analysis. Theoretical Computer Science, 318:79--103, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Bror Bjerner and Sören Holmström. A compositional approach to time analysis of first order lazy functional programs. In FPCA '89, pages 157--165, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Bror Bjerner. Time Complexity of Programs in Type Theory. PhD thesis, Department of Computer Science, University of Göteborg, 1989.Google ScholarGoogle Scholar
  4. Edwin Brady and Kevin Hammond. A dependently typed framework for static analysis of program execution costs. In IFL 2005, volume 4015 of LNCS, pages 74--90, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Edwin Brady, Conor McBride, and James McKinna. Inductive families need not store their indices. In TYPES 2003: Types for Proofs and Programs, volume 3085 of LNCS, pages 115--129, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  6. Venanzio Capretta. General recursion via coinductive types. Logical Methods in Computer Science, 1(2):1--28, 2005.Google ScholarGoogle ScholarCross RefCross Ref
  7. Robert L. Constable and Karl Crary. Reflections on the Foundations of Mathematics: Essays in Honor of Solomon Feferman, chapter Computational Complexity and Induction for Partial Computable Functions in Type Theory. A K Peters Ltd, 2002.Google ScholarGoogle Scholar
  8. Karl Crary and Stephanie Weirich. Resource bound certification. In POPL '00, pages 184--198, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Nils Anders Danielsson. A formalisation of the correctness result from "Lightweight semiformal time complexity analysis for purely functional data structures". Technical Report 2007:16, Department of Computer Science and Engineering, Chalmers University of Technology, 2007.Google ScholarGoogle Scholar
  10. Peter Dybjer. Inductive families. Formal Aspects of Computing, 6(4):440--465, 1994.Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Ralf Hinze and Ross Paterson. Finger trees: A simple general-purpose data structure. Journal of Functional Programming, 16(2):197--217, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Martin Hofmann and Steffen Jost. Type-based amortised heap-space analysis. In ESOP 2006, volume 3924 of LNCS, pages 22--37, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. John Hughes, Lars Pareto, and Amr Sabry. Proving the correctness of reactive systems using sized types. In POPL '96, pages 410--423, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Haim Kaplan, Chris Okasaki, and Robert E. Tarjan. Simple confluently persistent catenable lists. SIAM Journal on Computing, 30(3):965--977, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Haim Kaplan and Robert E. Tarjan. Purely functional, real-time deques with catenation. Journal of the ACM, 46(5):577--603, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. John Launchbury. A natural semantics for lazy evaluation. In POPL '93, pages 144--154, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Daan Leijen and Erik Meijer. Domain specific embedded compilers. In 2nd USENIX Conference on Domain--Specific Languages (DSL '99), pages 109--122, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Andrew Moran and David Sands. Improvement in a lazy context: an operational theory for call-by-need. In POPL '99, pages 43--56, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Ulf Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers University of Technology and Göteborg University, 2007.Google ScholarGoogle Scholar
  20. Chris Okasaki. Purely Functional Data Structures. Cambridge University Press, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Christine Paulin-Mohring. Extracting Fω's programs from proofs in the calculus of constructions. In POPL '89, pages 89--104, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Simon Peyton Jones, editor. Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, 2003.Google ScholarGoogle Scholar
  23. Álvaro J. Rebón Portillo, Kevin Hammond, Hans-Wolfgang Loidl, and Pedro Vasconcelos. Cost analysis using automatic size and time inference. In IFL 2002, volume 2670 of LNCS, pages 232--247, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. David Sands. A naïve time analysis and its theory of cost equivalence. Journal of Logic and Computation, 5(4):495--541, 1995.Google ScholarGoogle ScholarCross RefCross Ref
  25. The Agda Team. The Agda Wiki. Available at http://www.cs.chalmers.se/~ulfn/Agda/, 2007.Google ScholarGoogle Scholar
  26. Philip Wadler. Strictness analysis aids time analysis. In POPL '88, pages 119--132, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Lightweight semiformal time complexity analysis for purely functional data structures

                  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
                  • Published in

                    cover image ACM Conferences
                    POPL '08: Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
                    January 2008
                    448 pages
                    ISBN:9781595936899
                    DOI:10.1145/1328438
                    • cover image ACM SIGPLAN Notices
                      ACM SIGPLAN Notices  Volume 43, Issue 1
                      POPL '08
                      January 2008
                      420 pages
                      ISSN:0362-1340
                      EISSN:1558-1160
                      DOI:10.1145/1328897
                      Issue’s Table of Contents

                    Copyright © 2008 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: 7 January 2008

                    Permissions

                    Request permissions about this article.

                    Request Permissions

                    Check for updates

                    Qualifiers

                    • research-article

                    Acceptance Rates

                    Overall Acceptance Rate824of4,130submissions,20%

                    Upcoming Conference

                    POPL '25

                  PDF Format

                  View or Download as a PDF file.

                  PDF

                  eReader

                  View online with eReader.

                  eReader