A Theory of Changes for Higher-Order Languages - Incrementalizing {\lambda}-Calculi by Static Differentiation

If the result of an expensive computation is invalidated by a small change to the input, the old result should be updated incrementally instead of reexecuting the whole computation. We incrementalize programs through their derivative. A derivative maps changes in the program's input directly to changes in the program's output, without reexecuting the original program. We present a program transformation taking programs to their derivatives, which is fully static and automatic, supports first-class functions, and produces derivatives amenable to standard optimization. We prove the program transformation correct in Agda for a family of simply-typed {\lambda}-calculi, parameterized by base types and primitives. A precise interface specifies what is required to incrementalize the chosen primitives. We investigate performance by a case study: We implement in Scala the program transformation, a plugin and improve performance of a nontrivial program by orders of magnitude.

[1]  Guy E. Blelloch,et al.  An experimental analysis of self-adjusting computation , 2009 .

[2]  Umut A. Acar,et al.  Implicit self-adjusting computation for purely functional programs , 2011, J. Funct. Program..

[3]  Robert Harper Self-adjusting computation , 2004, LICS 2004.

[4]  Guy E. Blelloch,et al.  Traceable data types for self-adjusting computation , 2010, PLDI '10.

[5]  Lieven Eeckhout,et al.  Statistically rigorous java performance evaluation , 2007, OOPSLA.

[6]  Guy E. Blelloch,et al.  Adaptive functional programming , 2006 .

[7]  Robert Paige,et al.  Finite Differencing of Computable Expressions , 1982, TOPL.

[8]  Ralf Lämmel,et al.  Google's MapReduce programming model - Revisited , 2007, Sci. Comput. Program..

[9]  Inderpal Singh Mumick,et al.  The Stanford Data Warehousing Project , 1995 .

[10]  Martin Odersky,et al.  Lightweight modular staging: a pragmatic approach to runtime code generation and compiled DSLs , 2010, GPCE '10.

[11]  Martin Odersky,et al.  Higher-Order Reactive Programming with Incremental Lists , 2013, ECOOP.

[12]  Andrew W. Appel,et al.  Shrinking lambda Expressions in Linear Time , 1997, J. Funct. Program..

[13]  John C. Mitchell,et al.  Foundations for programming languages , 1996, Foundation of computing series.

[14]  Torsten Grust,et al.  Incremental Updates for Materialized OQL Views , 1997, DOOD.

[15]  Christoph Koch,et al.  Incremental query evaluation in a ring of databases , 2010, PODS.

[16]  Mira Mezini,et al.  Reactive behavior in object-oriented applications: an analysis and a research roadmap , 2013, AOSD.

[17]  James Noble,et al.  Caching and incrementalisation in the java query language , 2008, OOPSLA.

[18]  Thomas W. Reps,et al.  A categorized bibliography on incremental computation , 1993, POPL '93.

[19]  Umut A. Acar Self-adjusting computation: (an overview) , 2009, PEPM '09.

[20]  Georg Neis,et al.  Self-adjusting stack machines , 2011, OOPSLA '11.

[21]  Paul Hudak,et al.  Functional reactive animation , 1997, ICFP '97.