Implicit self-adjusting computation for purely functional programs

Computational problems that involve dynamic data, such as physics simulations and program development environments, have been an important subject of study in programming languages. Building on this work, recent advances in self-adjusting computation have developed techniques that enable programs to respond automatically and efficiently to dynamic changes in their inputs. Self-adjusting programs have been shown to be efficient for a reasonably broad range of problems, but the approach still requires an explicit programming style, where the programmer must use specific monadic types and primitives to identify, create, and operate on data that can change over time. We describe techniques for automatically translating purely functional programs into self-adjusting programs. In this implicit approach, the programmer need only annotate the (top-level) input types of the programs to be translated. Type inference finds all other types, and a type-directed translation rewrites the source program into an explicitly self-adjusting target program. The type system is related to information-flow type systems and enjoys decidable type inference via constraint solving. We prove that the translation outputs well- typed self-adjusting programs and preserves the source program's input–output behavior, guaranteeing that translated programs respond correctly to all changes to their data. Using a cost semantics, we also prove that the translation preserves the asymptotic complexity of the source program.

[1]  Analysis and caching of dependencies , 1996, ICFP '96.

[2]  Umut A. Acar,et al.  Adaptive Bayesian inference , 2007, NIPS 2007.

[3]  Jon G. Riecke,et al.  The SLam calculus: programming with secrecy and integrity , 1998, POPL '98.

[4]  Henrik Nilsson,et al.  Keeping calm in the face of change , 2010, High. Order Symb. Comput..

[5]  Andrew C. Myers,et al.  JFlow: practical mostly-static information flow control , 1999, POPL '99.

[6]  Thomas W. Reps,et al.  Incremental evaluation for attribute grammars with application to syntax-directed editors , 1981, POPL '81.

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

[8]  Guy E. Blelloch,et al.  Space profiling for parallel functional programs , 2008, ICFP.

[9]  Rastislav Bodík,et al.  DITTO: automatic incrementalization of data structure invariant checks (in Java) , 2007, PLDI '07.

[10]  Guy E. Blelloch,et al.  An experimental analysis of self-adjusting computation , 2006, PLDI '06.

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

[12]  David Sands,et al.  Calculi for time analysis of functional programs , 1990 .

[13]  Umut A. Acar,et al.  CEAL: a C-based language for self-adjusting computation , 2009, PLDI '09.

[14]  Tim Teitelbaum,et al.  Incremental reduction in the lambda calculus , 1990, LISP and Functional Programming.

[15]  Guy E. Blelloch,et al.  Adaptive functional programming , 2002, POPL '02.

[16]  Frank Pfenning,et al.  A monadic analysis of information flow security with mutable state , 2005, J. Funct. Program..

[17]  William Pugh,et al.  Incremental computation via function caching , 1989, POPL '89.

[18]  Simon L. Peyton Jones,et al.  Time and space profiling for non-strict, higher-order functional languages , 1995, POPL '95.

[19]  Philip Wadler,et al.  A practical subtyping system for Erlang , 1997, ICFP '97.

[20]  François Pottier,et al.  Information flow inference for ML , 2003, TOPL.

[21]  Thomas W. Reps,et al.  Generating Language-Based Environments , 1982 .

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

[23]  Marvin V. Zelkowitz,et al.  Programming Languages: Design and Implementation , 1975 .

[24]  Paul Hudak,et al.  Plugging a Space Leak with an Arrow , 2007, Festschrift honoring Gary Lindstrom.

[25]  Gilles Dowek,et al.  Principles of programming languages , 1981, Prentice Hall International Series in Computer Science.

[26]  Vincent Simonet,et al.  Type Inference with Structural Subtyping: A Faithful Formalization of an Efficient Constraint Solver , 2003, APLAS.

[27]  Mariangiola Dezani-Ciancaglini,et al.  A filter lambda model and the completeness of type assignment , 1983, Journal of Symbolic Logic.

[28]  Joseph O'Rourke,et al.  Handbook of Discrete and Computational Geometry, Second Edition , 1997 .

[29]  Magnus Carlsson Monads for incremental computing , 2002, ICFP '02.

[30]  Andrew C. Myers,et al.  Language-based information-flow security , 2003, IEEE J. Sel. Areas Commun..

[31]  Frank Pfenning,et al.  A judgmental reconstruction of modal logic , 2001, Mathematical Structures in Computer Science.

[32]  Guy E. Blelloch,et al.  A Library for Self-Adjusting Computation , 2006, Electron. Notes Theor. Comput. Sci..

[33]  Jeffrey S. Foster,et al.  Flow-insensitive type qualifiers , 2006, TOPL.

[34]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[35]  Martin Odersky,et al.  Type Inference with Constrained Types , 1999, Theory Pract. Object Syst..

[36]  Paul Hudak,et al.  Event-Driven FRP , 2002, PADL.

[37]  X. Liy Dynamic Algorithms in Computational Geometry , 2007 .

[38]  R. Bellman Dynamic programming. , 1957, Science.

[39]  Umut A. Acar,et al.  Compiling self-adjusting programs with continuations , 2008, ICFP.

[40]  Thomas Reps,et al.  The Synthesizer Generator: A System for Constructing Language-Based Editors , 1988 .

[41]  A. Stillings Modeling Motion , 2005 .