Higher-Order and Symbolic Computation

, Volume 23, Issue 2, pp 227–271 | Cite as

Keeping calm in the face of change

Towards optimisation of FRP by reasoning about change
Article

Abstract

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.

Keywords

Change propagation Domain-specific languages Functional reactive programming Hybrid systems Synchronous data-flow 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Benveniste, A., Caspi, P., Edwards, S., Halbwachs, N., Le Guernic, P., de Simone, R.: The synchronous languages twelve years later. Proc. IEEE 91(1), 64–83 (2003). Special issue on embedded systems CrossRefGoogle Scholar
  2. 2.
    Berry, G., Gonthier, G.: The Esterel synchronous programming language: Design, semantics, implementation. Sci. Comput. Program. 19(2), 87–152 (1992) MATHCrossRefGoogle Scholar
  3. 3.
    Blom, K.J.: Dynamic interactive virtual environments. Ph.D. thesis, University of Hamburg, Department of Informatics (2009) Google Scholar
  4. 4.
    Burchett, K., Cooper, G.H., Krishnamurthi, S.: Lowering: A static optimization technique for transparent functional reactivity. In: Partial Evaluation and Program Manipulation (PEPM ’07), pp. 71–80. ACM, New York (2007) Google Scholar
  5. 5.
    Caspi, P., Pouzet, M.: Synchronous Kahn networks. In: International Conference on Functional Programming (ICFP’96), pp. 226–238. ACM, New York (1996) CrossRefGoogle Scholar
  6. 6.
    Cheong, M.H.: Functional programming and 3D games. BEng thesis, University of New South Wales, Sydney, Australia (2005) Google Scholar
  7. 7.
    Colaço, J.L., Girault, A., Hamon, G., Pouzet, M.: Towards a higher-order synchronous data-flow language. In: Embedded Software (EMSOFT ’04), pp. 230–239. ACM, New York (2004) Google Scholar
  8. 8.
    Cooper, G.H., Krishnamurthi, S.: Embedding dynamic dataflow in a call-by-value language. In: European Symposium on Programming (ESOP ’06), pp. 294–308. Springer, Berlin (2006) Google Scholar
  9. 9.
    Courtney, A.: Modeling user interfaces in a functional language. Ph.D. thesis, Yale University (2004) Google Scholar
  10. 10.
    Courtney, A., Elliott, C.: Genuinely functional user interfaces. In: Haskell Workshop (Haskell’01), pp. 41–69. Elsevier, Amsterdam (2001) Google Scholar
  11. 11.
    Courtney, A., Nilsson, H., Peterson, J.: The Yampa arcade. In: Haskell Workshop (Haskell’03), pp. 7–18. ACM, New York (2003) Google Scholar
  12. 12.
    Daniels, A.: A semantics for functions and behaviours. Ph.D. thesis, University of Nottingham (1999) Google Scholar
  13. 13.
    Elliott, C.: Push-pull functional reactive programming. In: Haskell Symposium (Haskell ’09), pp. 25–36. ACM, New York (2009) CrossRefGoogle Scholar
  14. 14.
    Elliott, C., Hudak, P.: Functional reactive animation. In: International Conference on Functional Programming (ICFP ’97), pp. 263–273. ACM, New York (1997) CrossRefGoogle Scholar
  15. 15.
    Giorgidze, G., Nilsson, H.: Switched-on Yampa: Declarative programming of modular synthesizers. In: Practical Aspects of Declarative Languages (PADL ’08), pp. 282–298. Springer, Berlin (2008) CrossRefGoogle Scholar
  16. 16.
    Giorgidze, G., Nilsson, H.: Mixed-level embedding and JIT compilation for an iteratively staged DSL. In: Functional and (Constraint) Logic Programming (WFLP ’10), pp. 19–34 (2010) Google Scholar
  17. 17.
    Halbwachs, N.: Synchronous Programming of Reactive Systems. The Springer International Series in Engineering and Computer Science. Springer, Berlin (1993) MATHGoogle Scholar
  18. 18.
    Halbwachs, N.: Synchronous programming of reactive systems, a tutorial and commented bibliography. In: Computer Aided Verification (CAV ’98), pp. 1–16. Springer, Berlin (1998) CrossRefGoogle Scholar
  19. 19.
    Halbwachs, N., Caspi, P., Raymond, P., Pilaud, D.: The synchronous data-flow programming language Lustre. Proc. IEEE 79(9), 1305–1320 (1991) CrossRefGoogle Scholar
  20. 20.
    Henzinger, T.A.: The theory of hybrid automata. In: Logics in Computer Science (LICS ’96), pp. 278–292. IEEE Computer Society, Washington (1996) Google Scholar
  21. 21.
    Huth, M., Ryan, M.: Logic in Computer Science: Modelling and Reasoning about Systems. Cambridge University Press, Cambridge (2004). Chap. 3, pp. 172–255 MATHGoogle Scholar
  22. 22.
    Jeltsch, W.: Signals, not generators! In: Trends in Functional Programming (TFP ’09), pp. 145–160. Intellect, Bristol (2010) Google Scholar
  23. 23.
    Lee, E.A., Messerschmitt, D.G.: Static scheduling of synchronous data flow programs for digital signal processing. IEEE Trans. Comput. 36(1), 24–35 (1987) MATHCrossRefGoogle Scholar
  24. 24.
    Liu, H., Cheng, E., Hudak, P.: Causal commutative arrows and their optimization. In: International Conference on Functional Programming (ICFP ’09), pp. 35–46. ACM, New York (2009) CrossRefGoogle Scholar
  25. 25.
    Nilsson, H.: Dynamic optimization for functional reactive programming using generalized algebraic data types. In: International Conference on Functional Programming (ICFP ’05), pp. 54–65. ACM, New York (2005) Google Scholar
  26. 26.
    Nilsson, H., Courtney, A., Peterson, J.: Functional reactive programming, continued. In: Haskell Workshop (Haskell ’02), pp. 51–64. ACM, New York (2002) CrossRefGoogle Scholar
  27. 27.
    Nilsson, H., Peterson, J., Hudak, P.: Functional hybrid modeling. In: Practical Aspects of Declarative Languages (PADL ’03), pp. 376–390. Springer, Berlin (2003) CrossRefGoogle Scholar
  28. 28.
    Nordstrom, B., Petersson, K., Smith, J.M.: Programming in Martin-Löf’s Type Theory: An Introduction. Oxford University Press, Oxford (1990) Google Scholar
  29. 29.
    Norell, U.: Towards a practical programming language based on dependent type theory. Ph.D. thesis, Chalmers University of Technology (2007) Google Scholar
  30. 30.
    Patai, G.: Eventless reactivity from scratch. In: Implementation and Application of Functional Languages (IFL ’09), pp. 126–140 (2009) Google Scholar
  31. 31.
    Patai, G.: Efficient and compositional higher-order streams. In: Functional and (Constraint) Logic Programming (WFLP ’10), pp. 99–113 (2010) Google Scholar
  32. 32.
    Paterson, R.: A new notation for arrows. In: International Conference on Functional Programming (ICFP ’01), pp. 229–240 ACM, New York (2001) Google Scholar
  33. 33.
    Peterson, J., Hudak, P., Elliott, C.: Lambda in motion: Controlling robots with Haskell. In: Practical Aspects of Declarative Languages (PADL ’99), pp. 91–105. Springer, Berlin (1999) Google Scholar
  34. 34.
    Pouzet, M.: Lucid Synchrone, version 3.0: Tutorial and reference manual. Université Paris-Sud, LRI (2006). www.lri.fr/~pouzet/lucid-synchrone
  35. 35.
    Sculthorpe, N., Nilsson, H.: Optimisation of dynamic, hybrid signal function networks. In: Trends in Functional Programming (TFP ’08), pp. 97–112. Intellect, Bristol (2009) Google Scholar
  36. 36.
    Sculthorpe, N., Nilsson, H.: Safe functional reactive programming through dependent types. In: International Conference on Functional Programming (ICFP ’09), pp. 23–34. ACM, New York (2009) CrossRefGoogle Scholar
  37. 37.
    Using Simulink, Version 7.5. 3 Apple Hill Drive, Natick, MA (2010). www.mathworks.com
  38. 38.
    Venema, Y.: Temporal logic. In: The Blackwell Guide to Philosophical Logic. Blackwell, Oxford (2001). Chap. 10, pp. 203–223 Google Scholar
  39. 39.
    Wan, Z., Hudak, P.: Functional reactive programming from first principles. In: Programming Language Design and Implementation (PLDI ’00), pp. 242–252. ACM, New York (2000) Google Scholar

Copyright information

© Springer Science+Business Media, LLC 2011

Authors and Affiliations

  1. 1.School of Computer ScienceUniversity of NottinghamNottinghamUK

Personalised recommendations