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 2016 Publication 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.
[2]
U. A. Acar. Self-Adjusting Computation. PhD thesis, Department of Computer Science, Carnegie Mellon University, 2005.
[3]
U. A. Acar, G. E. Blelloch, and R. Harper. Adaptive functional programming. ACM Trans. Program. Lang. Syst., 28(6), 2006.
[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.
[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.
[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.
[7]
M. Carlsson. Monads for incremental computing. In Proceedings of the 7th International Conference on Functional Programming, ICFP ’02, pages 26–35, 2002.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[24]
Y. A. Liu and T. Teitelbaum. Systematic derivation of incremental programs. Science of Computer Programming, 24(1):1–39, 1995.
[25]
R. Paige and S. Koenig. Finite differencing of computable expressions. ACM Trans. Program. Lang. Syst., 4(3):402–454, 1982.
[26]
F. Pottier and V. Simonet. Information flow inference for ML. ACM Trans. Prog. Lang. Sys., 25(1):117–158, 2003.
[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.
[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.

Cited By

View all
  • (2021)Relational cost analysis in a functional-imperative settingJournal of Functional Programming10.1017/S095679682100007131Online publication date: 2-Nov-2021
  • (2019)On the expressiveness and semantics of information flow typesJournal of Computer Security10.3233/JCS-191382(1-28)Online publication date: 6-Dec-2019
  • (2019)Relational cost analysis for functional-imperative programsProceedings of the ACM on Programming Languages10.1145/33416963:ICFP(1-29)Online publication date: 26-Jul-2019
  • Show More Cited By

Index Terms

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

        Recommendations

        Comments

        Information & Contributors

        Information

        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
        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.

        Sponsors

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        Published: 04 September 2016

        Check for updates

        Author Tags

        1. Complexity analysis
        2. incremental computation
        3. type and effect systems

        Qualifiers

        • Research-article

        Conference

        ICFP'16
        Sponsor:

        Acceptance Rates

        Overall Acceptance Rate 333 of 1,064 submissions, 31%

        Upcoming Conference

        ICFP '25
        ACM SIGPLAN International Conference on Functional Programming
        October 12 - 18, 2025
        Singapore , Singapore

        Contributors

        Other Metrics

        Bibliometrics & Citations

        Bibliometrics

        Article Metrics

        • Downloads (Last 12 months)3
        • Downloads (Last 6 weeks)0
        Reflects downloads up to 27 Feb 2025

        Other Metrics

        Citations

        Cited By

        View all
        • (2021)Relational cost analysis in a functional-imperative settingJournal of Functional Programming10.1017/S095679682100007131Online publication date: 2-Nov-2021
        • (2019)On the expressiveness and semantics of information flow typesJournal of Computer Security10.3233/JCS-191382(1-28)Online publication date: 6-Dec-2019
        • (2019)Relational cost analysis for functional-imperative programsProceedings of the ACM on Programming Languages10.1145/33416963:ICFP(1-29)Online publication date: 26-Jul-2019
        • (2019)Closure conversion is safe for spaceProceedings of the ACM on Programming Languages10.1145/33416873:ICFP(1-29)Online publication date: 26-Jul-2019
        • (2019)Bidirectional type checking for relational propertiesProceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3314221.3314603(533-547)Online publication date: 8-Jun-2019
        • (2019)Incremental $$\lambda $$ -Calculus in Cache-Transfer StyleProgramming Languages and Systems10.1007/978-3-030-17184-1_20(553-580)Online publication date: 6-Apr-2019
        • (2018)Types for Information Flow Control: Labeling Granularity and Semantic Models2018 IEEE 31st Computer Security Foundations Symposium (CSF)10.1109/CSF.2018.00024(233-246)Online publication date: Jul-2018
        • (2017)TiML: a functional language for practical complexity analysis with invariantsProceedings of the ACM on Programming Languages10.1145/31339031:OOPSLA(1-26)Online publication date: 12-Oct-2017
        • (2017)Relational cost analysisACM SIGPLAN Notices10.1145/3093333.300985852:1(316-329)Online publication date: 1-Jan-2017
        • (2017)Relational cost analysisProceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages10.1145/3009837.3009858(316-329)Online publication date: 1-Jan-2017
        • Show More Cited By

        View Options

        Login options

        View options

        PDF

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader

        Figures

        Tables

        Media

        Share

        Share

        Share this Publication link

        Share on social media