lusteral
play

Lusteral Uniform and Modular Composition of Data-flow & - PowerPoint PPT Presentation

Lusteral Uniform and Modular Composition of Data-flow & Control-flow in the Lazy -Calculus joint work with Marc Pouzet M. Mendler, University of Bamberg Synchron 2008 CPL Aussois Synchron 2008 CPL Aussois 1 Constructive Data


  1. Lusteral Uniform and Modular Composition of Data-flow & Control-flow in the Lazy λ -Calculus joint work with Marc Pouzet M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 1

  2. Constructive Data Flow Introduction M. Mendler, The Otto-Friedrich University of Bamberg Synchron 2008 – CPL Aussois Lusterel-2

  3. Data Flow Programming Signal, Lustre, SCADE V4, LabView, Simulink, ... M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 3

  4. Control Flow Programming ABSync Detection 1 WaitAandB idle arm wA wB Reset Timer A/arm B /arm 2 T / disarm cnt 2 eot dA dB disarm Inhib / AB done signal arm signal disarm Esterel, SyncCharts, Argos, Stateflow, Statemate, ... M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 4

  5. Starting the 3rd Millennium ... � ... we are looking at hybrid engines with tight integration of data flow and control flow: ReLuC, Lucide Synchrone, SCADE 6, 7, 8, Synoptic, ... Synchron 2008 – CPL Aussois

  6. Starting the 3rd Millennium ... � ... we need to understand the semantical mechanics of such a hybrid (4 education, certification, verification,...) � Recent work (2005): J.-L. Colaço, B. Pagano, M. Pouzet give semantics of Scade V6 by • syntactic compilation of • SF � DF using states-as-activation-clocks with explicit absence values � Open Question: Can SF and DF be unified into a • compositional semantic model • on equal footing, without „absence“ values ? M. Mendler, The Otto-Friedrich University of Bamberg Synchron 2008 – CPL Aussois Lusterel-6

  7. The Lusteral Experiment We aim to integrate • Lustre-style DF + Esterel-style SF under the same (co- recursive, functional) reactive process model • shallow embedding in Haskell, aka lazy λ -calculus separation control ≠ data (no absence values) • • simple set of well-understood functional combinators Lusterel Language Design Workbench polymorphic equational reasoning higher-order extensible Lustre DF Esterel SF strong typing declarative smooth morphing between data and control-flow M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 7

  8. Kahn Principle • At any time, a computing station is either computing or waiting for information on one of its input lines • Each computation station follows a sequential program Working Hypothesis : • Stream processing functions of Haskell are Kahn processes: Lazy rewriting is deterministic and sequential ! • Kahn processes can be coded in Haskell. Kahn processes exhibit parallelism of expression not of execution! M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 8

  9. Constructive Data Flow The Role of Laziness M. Mendler, The Otto-Friedrich University of Bamberg Synchron 2008 – CPL Aussois Lusterel-9

  10. Orthogonality in Time and Space M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 10

  11. Data Flow data flow M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 11

  12. Data Flow Q: How do we treat the cyclic DF dependencies ? data flow A: Fixpoints on prefix-ordering, lazy recursion on streams! M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 12

  13. State Flow state flow M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 13

  14. State Flow Q: How do we treat the cyclic SF dependencies ? state flow A: Scott information-ordering, lazy recursion on state M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 14

  15. Fixed-point on Partial States xs = f (3 fby (fst zs), snd zs) ys = h (snd xs) zs = g (ys, fst xs) fby 3 xs f xs = 5 3 h ys = 6 ys 2 zs = g 0 zs M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 16

  16. Fixed-point on Partial States xs = f (3 fby (fst zs), snd zs) ys = h (snd xs) zs = g (ys, fst xs) fby 3 4 xs f xs = 5 0 3 h ys = 6 1 ys 2 9 zs = g 0 9 zs M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 17

  17. Fixed-point on Partial States xs = f (3 fby (fst zs), snd zs) ys = h (snd xs) zs = g (ys, fst xs) fby 3 4 3 5 xs f xs = 5 0 7 7 3 h ys = 6 1 5 2 ys 2 9 2 1 zs = g 0 9 5 1 zs M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 18

  18. Where Eagerness is not Productive ... xs = f (3 fby (fst zs), snd zs) fby xs f ys = h (snd xs) 3 zs = g (ys, fst xs) h Eager Evaluation ys fst xs � fst (f(3 fby (fst zs), snd zs)) g zs � fst (f(3:(fst zs), snd zs)) � fst (f(3:(fst zs), snd(g(ys,fst xs)))) � fst (f(3:(fst zs), snd(g(h(snd xs ),fst xs)) � fst (f(3:fst zs), snd(g(h(snd(f(3 fby (fst zs), snd zs))),fst xs) � … loop ! M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 19

  19. ... Lazy Function Evaluation may be. xs = f (3 fby (fst zs), snd zs) fby xs f ys = h (snd xs) 3 zs = g (ys, fst xs) h Lazy Evaluation ys fst xs � fst(f(3 fby (fst zs), snd zs)) g zs � fst((f 1 × f 2 )(3 fby (fst zs), snd zs)) � fst(( λ w.(f 1 (fst w), f 2 (snd w))(3 fby (fst zs), snd zs)) � fst(f 1 (fst(3 fby (fst zs), snd zs)), f 2 (snd(3 fby (fst zs), snd zs))) � f 1 (fst(3 fby (fst zs), snd zs)) lazy on state (data) � f 1 (3 fby (fst zs)) lazy on streams � f 1 (3:(fst zs)) where H[v] = f 1 (g 1 (h(f 2 (g 2 (v)))) � f 1 (3) : f 1 (fst zs) � ... f 1 (3) : H(f 1 (3)) : H(H(f 1 (3))) : H(H(H(f 1 (3)))) : ... M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 20

  20. Constructive Data Flow SF ≠ Clocked DF M. Mendler, The Otto-Friedrich University of Bamberg Synchron 2008 – CPL Aussois Lusterel-21

  21. Clock Schedules are Implicit xs = x 0 x 1 ⊥ x 2 ⊥ x 3 x 4 ⊥ x 5 x 6 ... xs when zs cs cs = T F ⊥ F ⊥ T F ⊥ T T ... zs = x 0 ⊥ ⊥ ⊥ ⊥ x 3 ⊥ ⊥ x 5 x 6 ... loop loop read c from cs; read c from cs; cs?c c=T if c then if c then c=F read x from xs; xs?x read x from xs; tick write x to zs; write x to zs; tick else pause; else pause; zs!x pause; pause; end loop absence ⊥ is not communicated ! end loop M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 28

  22. Absence = Identity Reaction on ‘State Bus‘ xs = x 0 x 1 ⊥ x 2 ⊥ x 3 x 4 ⊥ x 5 x 6 ... xs when cs 1 zs cs 1 = T F ⊥ F ⊥ T F ⊥ T T ... zs = x 0 ⊥ ⊥ ⊥ ⊥ x 3 ⊥ ⊥ x 5 x 6 ... zs = ⊥ y 1 ⊥ y 2 ⊥ ⊥ y 4 ⊥ ⊥ ⊥ ... ys when cs 2 zs cs 2 = F T ⊥ T ⊥ F T ⊥ F F ... ys = y 0 y 1 ⊥ y 2 ⊥ y 3 y 4 ⊥ y 5 y 6 ... M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 29

  23. Absence = Identity Reaction on ‘State Bus‘ xs when cs 1 zs zs = x 0 ⊥ ⊥ ⊥ ⊥ x 3 ⊥ ⊥ x 5 x 6 ... ``state bus´´ zs = ⊥ y 1 ⊥ y 2 ⊥ ⊥ y 4 ⊥ ⊥ ⊥ ... ys when cs 2 zs zs = x 0 y 1 ⊥ y 2 ⊥ x 3 y 4 ⊥ x 5 x 6 ... zs state bus values = response functions: parallel emits = function composition: The last value dominates the bus M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 30

  24. Absence = Identity Reaction on ‘State Bus‘ xs when cs 1 zs zs = x 0 ⊥ ⊥ ⊥ ⊥ x 3 ⊥ ⊥ x 5 x 6 ... ``state bus´´ zs = ⊥ y 1 ⊥ y 2 ⊥ ⊥ y 4 ⊥ ⊥ ⊥ ... ys when cs 2 zs zs = x 0 y 1 ⊥ y 2 ⊥ x 3 y 4 ⊥ x 5 x 6 ... zs x ◦ y same as x default y (Signal) but deeply coded ! non-termination Ω ≠ identity ⊥ ≠ absence ∗ DF SF DF M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 31

  25. Absence = Identity Reaction on ‘State Bus‘ M. Fourman [1989]: Response functions (cpo) zs = x 0 ⊥ ⊥ ⊥ ⊥ x 3 ⊥ ⊥ x 5 x 6 ... to model bi-directional instantaneous zs = ⊥ y 1 ⊥ y 2 ⊥ ⊥ y 4 ⊥ ⊥ ⊥ ... communication. zs = x 0 y 1 ⊥ y 2 ⊥ x 3 y 4 ⊥ x 5 x 6 ... x ◦ y same as x default y (Signal) but deeply coded ! non-termination Ω ≠ identity ⊥ ≠ absence ∗ DF SF DF M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 32

  26. Constructive Data Flow Synchronous Processes M. Mendler, The Otto-Friedrich University of Bamberg Synchron 2008 – CPL Aussois Lusterel-33

  27. SF/DF Reaction Relations State Flow SF::SSM a b E::a R::b Data Flow DF::SDF (a,b) c E::a R::b v::c M. Mendler, University of Bamberg Synchron 2008 – CPL Aussois Synchron 2008 – CPL Aussois 37

  28. Constructive Data Flow SF/DF Process Language M. Mendler, The Otto-Friedrich University of Bamberg Synchron 2008 – CPL Aussois Lusterel-39

  29. State Flow state flow variable signal input signal emission wait branching weak preemption parallel binding DF to signal local signal iteration M. Mendler, The Otto-Friedrich University of Bamberg Synchron 2008 – CPL Aussois Lusterel-40

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend