skip to main content
10.1145/2951913.2951950acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

A type theory for incremental computational complexity with control flow changes

Published:04 September 2016Publication History

ABSTRACT

Incremental computation aims to speed up re-runs of a program after its inputs have been modified slightly. It works by recording a trace of the program's first run and propagating changes through the trace in incremental runs, trying to re-use as much of the original trace as possible. The recent work CostIt is a type and effect system to establish the time complexity of incremental runs of a program, as a function of input changes. However, CostIt is limited in two ways. First, it prohibits input changes that influence control flow. This makes it impossible to type programs that, for instance, branch on inputs that may change. Second, the soundness of CostIt is proved relative to an abstract cost semantics, but it is unclear how the semantics can be realized.

In this paper, we address both these limitations. We present DuCostIt, a re-design of CostIt, that combines reasoning about costs of change propagation and costs of from-scratch evaluation. The latter lifts the restriction on control flow changes. To obtain the type system, we refine Flow Caml, a type system for information flow analysis, with cost effects. Additionally, we inherit from CostIt index refinements to track data structure sizes and a co-monadic type. Using a combination of binary and unary step-indexed logical relations, we prove DuCostIt's cost analysis sound relative to not only an abstract cost semantics, but also a concrete semantics, which is obtained by translation to an ML-like language.

References

  1. A type theory for incremental computational complexity with control flow changes (technical appendix). Online at http://www. mpi-sws.org/~ecicek/ducostit_appendix.pdf.Google ScholarGoogle Scholar
  2. U. A. Acar. Self-Adjusting Computation. PhD thesis, Department of Computer Science, Carnegie Mellon University, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. U. A. Acar, G. E. Blelloch, and R. Harper. Adaptive functional programming. ACM Trans. Program. Lang. Syst., 28(6), 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. U. A. Acar, G. E. Blelloch, M. Blume, R. Harper, and K. Tangwongsan. An experimental analysis of self-adjusting computation. ACM Trans. Program. Lang. Syst., 32(1):3:1–3:53, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. A. Ahmed. Step-indexed syntactic logical relations for recursive and quantified types. In Proceedings of the 15th European Conference on Programming Languages and Systems, ESOP’06, pages 69–83, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Y. Cai, P. G. Giarrusso, T. Rendel, and K. Ostermann. A theory of changes for higher-order languages: Incrementalizing λ-calculi by static differentiation. In Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’14, pages 145–155, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. M. Carlsson. Monads for incremental computing. In Proceedings of the 7th International Conference on Functional Programming, ICFP ’02, pages 26–35, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Y. Chen, J. Dunfield, and U. A. Acar. Type-directed automatic incrementalization. In Proceedings of the 33rd Conference on Programming Language Design and Implementation, PLDI ’12, pages 299– 310, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Y. Chen, J. Dunfield, M. A. Hammer, and U. A. Acar. Implicit selfadjusting computation for purely functional programs. J. Functional Programming, 24(1):56–112, 2014.Google ScholarGoogle ScholarCross RefCross Ref
  10. W.-N. Chin and S.-C. Khoo. Calculating sized types. In Proceedings of the Workshop on Partial Evaluation and Semantics-based Program Manipulation, PEPM ’00, pages 62–72, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. E. Çiçek, D. Garg, and U. A. Acar. Refinement types for incremental computational complexity. In Programming Languages and Systems - 24th European Symposium on Programming Proceedings, pages 406– 431, 2015.Google ScholarGoogle Scholar
  12. U. Dal Lago and M. Gaboardi. Linear dependent types and relative completeness. In Proceedings of the 2011 IEEE 26th Annual Symposium on Logic in Computer Science, LICS ’11, pages 133–142, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. U. Dal lago and B. Petit. The geometry of types. In Proceedings of the 40th Annual Symposium on Principles of Programming Languages, POPL ’13, pages 167–178, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. N. Danner, D. R. Licata, and R. Ramyaa. Denotational cost semantics for functional languages with inductive types. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming, ICFP 2015, pages 140–151, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. Gaboardi, A. Haeberlen, J. Hsu, A. Narayan, and B. C. Pierce. Linear dependent types for differential privacy. In Proceedings of the 40th Annual Symposium on Principles of Programming Languages, POPL ’13, pages 357–370, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. S. Gulwani, K. K. Mehra, and T. Chilimbi. Speed: Precise and efficient static estimation of program computational complexity. In Proceedings of the 36th Annual Symposium on Principles of Programming Languages, POPL ’09, pages 127–139, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. A. Hammer, U. A. Acar, and Y. Chen. Ceal: A C-based language for self-adjusting computation. In Proceedings of the 2009 Conference on Programming Language Design and Implementation, PLDI ’09, pages 25–37, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. A. Hammer, K. Y. Phang, M. Hicks, and J. S. Foster. Adapton: Composable, demand-driven incremental computation. In Proceedings of the 35th Conference on Programming Language Design and Implementation, PLDI ’14, pages 156–166, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. A. Heydon, R. Levin, and Y. Yu. Caching function calls using precise dependencies. In Proceedings of the Conference on Programming Language Design and Implementation, PLDI ’00, pages 311–320, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. J. Hoffmann, K. Aehlig, and M. Hofmann. Multivariate amortized resource analysis. In Proceedings of the 38th Annual Symposium on Principles of Programming Languages, POPL ’11, pages 357–370, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. J. Hughes and L. Pareto. Recursion and dynamic data-structures in bounded space: Towards embedded ML programming. In Proceedings of the Fourth International Conference on Functional Programming, ICFP ’99, pages 70–81, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. C. Koch. Incremental query evaluation in a ring of databases. In Proceedings of the Twenty-ninth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS ’10, pages 87–98, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. R. Ley-Wild, U. A. Acar, and M. Fluet. A cost semantics for selfadjusting computation. In Proceedings of the 36th Annual Symposium on Principles of Programming Languages, POPL ’09, pages 186–199, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Y. A. Liu and T. Teitelbaum. Systematic derivation of incremental programs. Science of Computer Programming, 24(1):1–39, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. R. Paige and S. Koenig. Finite differencing of computable expressions. ACM Trans. Program. Lang. Syst., 4(3):402–454, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. F. Pottier and V. Simonet. Information flow inference for ML. ACM Trans. Prog. Lang. Sys., 25(1):117–158, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. P. B. Vasconcelos and K. Hammond. Inferring cost equations for recursive, polymorphic and higher-order functional programs. In Implementation of Functional Languages, 15th International Workshop, IFL 2003, pages 86–101, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. H. Xi and F. Pfenning. Dependent types in practical programming. In Proceedings of the 26th Symposium on Principles of Programming Languages, POPL ’99, pages 214–227, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A type theory for incremental computational complexity with control flow changes

        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
          ICFP 2016: Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming
          September 2016
          501 pages
          ISBN:9781450342193
          DOI:10.1145/2951913

          Copyright © 2016 Owner/Author

          Permission to make digital or hard copies of part or all 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 third-party components of this work must be honored. For all other uses, contact the Owner/Author.

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 4 September 2016

          Check for updates

          Qualifiers

          • research-article

          Acceptance Rates

          Overall Acceptance Rate333of1,064submissions,31%

          Upcoming Conference

          ICFP '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader