Keeping calm in the face of change

Functional Reactive Programming (FRP) is an approach to reactive programming where systems are structured as networks of functions operating on signals (time-varying values). FRP is based on the synchronous data-flow paradigm and supports both (an approximation to) continuous-time and discrete-time signals (hybrid systems). What sets FRP apart from most other languages for similar applications is its support for systems with dynamic structure and for higher-order reactive constructs.This paper contributes towards advancing the state of the art of FRP implementation by studying the notion of signal change and change propagation in a setting of structurally dynamic networks of n-ary signal functions operating on mixed continuous-time and discrete-time signals. We first define an ideal denotational semantics (time is truly continuous) for this kind of FRP, along with temporal properties, expressed in temporal logic, of signals and signal functions pertaining to change and change propagation. Using this framework, we then show how to reason about change; specifically, we identify and justify a number of possible optimisations, such as avoiding recomputation of unchanging values. Note that due to structural dynamism, and the fact that the output of a signal function may change because time is passing even if the input is unchanging, the problem is significantly more complex than standard change propagation in networks with static structure.

[1]  Nicolas Halbwachs,et al.  Synchronous Programming of Reactive Systems , 1992, CAV.

[2]  Gérard Berry,et al.  The Esterel Synchronous Programming Language: Design, Semantics, Implementation , 1992, Sci. Comput. Program..

[3]  Stephen A. Edwards,et al.  The synchronous languages 12 years later , 2003, Proc. IEEE.

[4]  Mun Hon Cheong,et al.  Functional Programming and 3D Games , 2005 .

[5]  Gergely Patai,et al.  Efficient and Compositional Higher-Order Streams , 2010, WFLP.

[6]  Pascal Raymond,et al.  The synchronous data flow programming language LUSTRE , 1991, Proc. IEEE.

[7]  Marc Pouzet,et al.  Lucid Synchrone - version 2.0: Tutorial and reference manual , 2001 .

[8]  Alasdair Urquhart,et al.  Temporal Logic , 1971 .

[9]  Henrik Nilsson,et al.  Functional reactive programming, continued , 2002, Haskell '02.

[10]  Paul Hudak,et al.  Causal commutative arrows and their optimization , 2009, ICFP.

[11]  Bengt Nordström,et al.  Programming in Martin-Löf's Type Theory , 1990 .

[12]  N. Halbwachs,et al.  Synchronous programming of reactive systems: A tutorial and commented bibliography , 1998, CAV 1998.

[13]  Peter Øhrstrøm,et al.  Temporal Logic , 1994, Lecture Notes in Computer Science.

[14]  Marc Pouzet,et al.  Synchronous Kahn networks , 1996, ICFP '96.

[15]  Henrik Nilsson,et al.  Safe functional reactive programming through dependent types , 2009, ICFP.

[16]  Conal Elliott,et al.  Push-pull functional reactive programming , 2009, Haskell.

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

[18]  L. Goble The Blackwell guide to philosophical logic , 2001 .

[19]  Thomas A. Henzinger,et al.  The theory of hybrid automata , 1996, Proceedings 11th Annual IEEE Symposium on Logic in Computer Science.

[20]  Henrik Nilsson,et al.  Switched-On Yampa Declarative Programming of Modular Synthesizers , 2007 .

[21]  Henrik Nilsson,et al.  Mixed-Level Embedding and JIT Compilation for an Iteratively Staged DSL , 2010, WFLP.

[22]  Paul Hudak,et al.  Lambda in Motion: Controlling Robots with Haskell , 1999, PADL.

[23]  Krzysztof R. Apt,et al.  Logic Programming , 1990, Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics.

[24]  Paul Hudak,et al.  Functional Hybrid Modeling , 2003, PADL.

[25]  U. Norell,et al.  Towards a practical programming language based on dependent type theory , 2007 .

[26]  Henrik Nilsson,et al.  Dynamic optimization for functional reactive programming using generalized algebraic data types , 2005, ICFP '05.

[27]  Marc Pouzet,et al.  Towards a higher-order synchronous data-flow language , 2004, EMSOFT '04.

[28]  Antony Courtney,et al.  Genuinely Functional User Interfaces , 2001 .

[29]  Edward A. Lee,et al.  Static Scheduling of Synchronous Data Flow Programs for Digital Signal Processing , 1989, IEEE Transactions on Computers.

[30]  Ross Paterson,et al.  A new notation for arrows , 2001, ICFP '01.

[31]  Henrik Nilsson,et al.  Optimisation of Dynamic, Hybrid Signal Function Networks , 2008, Trends in Functional Programming.

[32]  Wolfgang Jeltsch Signals, Not Generators! , 2009, Trends in Functional Programming.

[33]  Susan Eitelman,et al.  Matlab Version 6.5 Release 13. The MathWorks, Inc., 3 Apple Hill Dr., Natick, MA 01760-2098; 508/647-7000, Fax 508/647-7001, www.mathworks.com , 2003 .

[34]  Shriram Krishnamurthi,et al.  Lowering: a static optimization technique for transparent functional reactivity , 2007, PEPM '07.

[35]  Paul Hudak,et al.  Functional reactive programming from first principles , 2000, PLDI '00.

[36]  Valentin Goranko,et al.  Logic in Computer Science: Modelling and Reasoning About Systems , 2007, J. Log. Lang. Inf..

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

[38]  Paul Hudak,et al.  Modeling user interfaces in a functional language , 2004 .

[39]  Bengt Nordström,et al.  Programming in Martin-Lo¨f's type theory: an introduction , 1990 .

[40]  BerryGérard,et al.  The ESTEREL synchronous programming language , 1992 .

[41]  Shriram Krishnamurthi,et al.  Embedding Dynamic Dataflow in a Call-by-Value Language , 2006, ESOP.

[42]  Henrik Nilsson,et al.  The Yampa arcade , 2003, Haskell '03.

[43]  Michael Huth,et al.  Logic in computer science - modelling and reasoning about systems , 2000 .

[44]  Anthony Charles Daniels,et al.  A semantics for functions and behaviours , 1999 .

[45]  Kristopher J. Blom,et al.  Dynamic, interactive virtual environments , 2009 .

[46]  Stephen A. Edwards,et al.  The Synchronous Languages Twelve Years Later , 1997 .