## Ultrametric Semantics of Reactive Programs

### Cached

### Download Links

Citations: | 8 - 3 self |

### BibTeX

@MISC{Krishnaswami_ultrametricsemantics,

author = {Neelakantan R. Krishnaswami and Nick Benton},

title = {Ultrametric Semantics of Reactive Programs},

year = {}

}

### OpenURL

### Abstract

Abstract—We describe a denotational model of higher-order functional reactive programming using ultrametric spaces and nonexpansive maps, which provide a natural Cartesian closed generalization of causal stream functions and guarded recursive definitions. We define a type theory corresponding to this semantics and show that it satisfies normalization. Finally, we show how reactive programs written in this language may be implemented efficiently using an imperatively updated dataflow graph, and give a separation logic proof that this low-level implementation is correct with respect to the high-level semantics. I.

### Citations

201 | and P.Hudak, Functional reactive animation
- Elliott
- 1997
(Show Context)
Citation Context ...rrect with respect to the high-level semantics. I. INTRODUCTION There is a broad spectrum of models for reactive programming. Functional reactive programming (FRP), as introduced by Elliott and Hudak =-=[1]-=-, is highly expressive and typically shallowly embedded in powerful general-purpose languages. At the other end, synchronous dataflow languages such as Esterel [2], Lustre [3] and Lucid Synchrone [4] ... |

91 |
The Esterel synchronous programming language and its mathematical semantics
- Berry, Cosserat
- 1985
(Show Context)
Citation Context ..., as introduced by Elliott and Hudak [1], is highly expressive and typically shallowly embedded in powerful general-purpose languages. At the other end, synchronous dataflow languages such as Esterel =-=[2]-=-, Lustre [3] and Lucid Synchrone [4] provide a restricted, domain-specific model of computation supporting specialized compilation strategies and analysis techniques. Synchronous languages have been h... |

78 |
J.I.Zucker: Processes and the Denotational Semantics of Concurrency
- Bakker
- 1982
(Show Context)
Citation Context ..., is available from our websites; we will describe the use of our model for GUI programming in a subsequent publication. (Ultra)metric spaces have appeared before in semantics, notably in concurrency =-=[16]-=- and in connection with the solution of domain equations [17]. Escardo [18] gives a ultrametric space semantics of PCF. His lift monad construction translates quite naturally to our setting, with A⊥ =... |

73 | A concurrent logical framework I: Judgments and properties
- Watkins, Cervesato, et al.
- 2002
(Show Context)
Citation Context ...ted in the full version of the paper. We give a bidirectional (algorithmic) type system in canonical forms style, which types only normal forms our calculus, and then define a hereditary substitution =-=[10]-=- which preserves typing and is compatible with the equational theory. B. Denotational Semantics Figure 2 gives the semantics of our DSL, interpreting types as ultrametric spaces and terms as non-expan... |

68 |
Solving reflexive domain equations in a category of complete metric spaces
- America, Rutten
- 1989
(Show Context)
Citation Context ... our model for GUI programming in a subsequent publication. (Ultra)metric spaces have appeared before in semantics, notably in concurrency [16] and in connection with the solution of domain equations =-=[17]-=-. Escardo [18] gives a ultrametric space semantics of PCF. His lift monad construction translates quite naturally to our setting, with A⊥ = (A × N) + 1, with a metric resembling the recursive type µα.... |

67 | W.: Iterated Inductive Definitions and Subsystems of Analysis - Buchholz, Feferman, et al. - 1981 |

56 | BI-hyperdoctrines, higher-order separation logic, and abstraction
- Biering, Birkedal, et al.
(Show Context)
Citation Context ...act specifications to modules using existential quantifiers to hide program implementations and predicates. The assertions in the pre- and post-conditions are drawn from higher-order separation logic =-=[11]-=-, including spatial connectives like the separating conjunction p ∗ q. The universal Assertion Sorts ω ::= τ | κ | ω ⇒ ω | prop Assertion p ::= e | τ | x | λx : ω. p | p q Constructors | ⊤ | p ∧ q | p... |

52 | Functional Reactive Programming from First Principles
- Wan, Hudak
- 2000
(Show Context)
Citation Context ...g that to an implementation delivering time deltas (instead of ticks, as presently) will be more challenging. We hope our proof framework can extend to proving a sampling theorem, as in Wan and Hudak =-=[23]-=-. There has been much recent work on the foundations of step-indexed logical relations [14]. Our relation demonstrates a very intricate use of higher-order state, and it would be particularly interest... |

50 |
Functional reactive programming, continued
- Nilsson, Courtney, et al.
(Show Context)
Citation Context ...1) → S(N)) to denote very many streams, including such basic ones such as (0, 1, 4, 9, . . .). The original work on FRP [1] was based on unrestricted stream programs. Variations such as arrowized FRP =-=[21]-=- were introduced to give combinators restricting the definable stream transformers to the causal ones, corresponding roughly to the first-order stream programs, with some special operators for dynamic... |

39 |
LUSTRE: A Declarative Language for Real-Time Programming
- Caspi, Pilaud, et al.
- 1987
(Show Context)
Citation Context ...ced by Elliott and Hudak [1], is highly expressive and typically shallowly embedded in powerful general-purpose languages. At the other end, synchronous dataflow languages such as Esterel [2], Lustre =-=[3]-=- and Lucid Synchrone [4] provide a restricted, domain-specific model of computation supporting specialized compilation strategies and analysis techniques. Synchronous languages have been highly succes... |

36 | Embedding dynamic dataflow in a call-by-value language
- Cooper, Krishnamurthi
- 2006
(Show Context)
Citation Context ... restricting the definable stream transformers to the causal ones, corresponding roughly to the first-order stream programs, with some special operators for dynamic behavior. Cooper and Krishnamurthi =-=[22]-=- describe FrTime, a dataflow-based FRP system for PLT Scheme (now Racket). They carefully restrict higher-order features to a set of primitives to simplify implementation and block memory leaks. A not... |

31 | The impact of higher-order state and control effects on local relational reasoning
- Dreyer, Neis, et al.
- 2010
(Show Context)
Citation Context ...e scope of a single computation, we may also need to locally perform updates which do not directly correspond to transitions in the global order, which we write M ′ ⊑ M (c.f. “private transitions” in =-=[15]-=-). Finally, the global clock can advance, and so the ordering M ′ ≪n M asserts that M ′ is a state which can occur n steps in the future of M. The logical relation, which we write V k A (M), does not ... |

25 | A Modality for Recursion
- Nakano
- 2000
(Show Context)
Citation Context ...r delays, interpreted as an endofunctor that shrinks distances by a factor of one-half. This lets us track contractiveness by types, in much the same spirit as Nakano’s calculus for guarded recursion =-=[7]-=-. In the second part of the paper, we give a reasonably efficient implementation of our language in terms of imperative dataflow graphs and prove the correctness of the implementation with respect to ... |

20 |
Lucid Synchrone, version 3. Tutorial and reference manual. Université Paris-Sud
- Pouzet
- 2006
(Show Context)
Citation Context ... [1], is highly expressive and typically shallowly embedded in powerful general-purpose languages. At the other end, synchronous dataflow languages such as Esterel [2], Lustre [3] and Lucid Synchrone =-=[4]-=- provide a restricted, domain-specific model of computation supporting specialized compilation strategies and analysis techniques. Synchronous languages have been highly successful in applications suc... |

18 | V.: The Essence of Dataflow Programming
- Uustalu, Vene
(Show Context)
Citation Context ...c)) 36 ar(M) = Π(A, r) ∈ αM . ([[A]] × (|A|)) 37 ar(M2 ⊑ M1) = λe2. λr ∈ αM1. e2(r) Fig. 9. Orderings on Memories stateful programs in both operational and domain-theoretic settings. Uustalu and Vene =-=[20]-=- observed that streams have a comonad structure whose co-Kleisli category is Cartesian closed, elegantly extending implicit lifting from the first-order setting to the higher-order case. Unfortunately... |

18 | The category-theoretic solution of recursive metric-space quations
- Birkedal, Støvring, et al.
- 2009
(Show Context)
Citation Context ...ic resembling the recursive type µα. 1 + •α. This has obvious applications for modelling features of interactive programs such as timeouts, which we plan to investigate in the future. Birkedal et al. =-=[19]-=- have recently used ultrametric spaces to solve recursive equations arising from modelling1 M ′ ⊑ M = 2 SM 3 reader M 4 DepsM ′ ⊇ DepsM ∧ RM ′ ⊇ SM ∧ IM ′ ⊇ IM ∧ DM ′ ⊇ DM ∧ BM ′ ⊇ BM ∧ ′ ⊇ reader M ... |

16 | Focusing and higher-order abstract syntax - Zeilberger |

15 | Logical step-indexed logical relations
- Dreyer, Ahmed, et al.
- 2009
(Show Context)
Citation Context ...ψ.{H(θ ⊗ ψ)} 20 read(c) 21 {(a, {c}). H(ℜ({c} , θ ′ ) ⊗ ℜ(u ∪ {c} , ψ) ⊗ cell + (c, e, v, rs)) 22 ∧ a = v} Fig. 4. Dataflow Library Specification graphs, we use a step-indexed Kripke logical relation =-=[14]-=-. The relation is parameterized by types, A, step-indices, k, and ‘abstract memories’, M. Step-indexing is necessary because this program uses higher-order store, and so induction on types is not poss... |

14 | Verifying eventdriven programs using ramified frame properties
- Krishnaswami, Birkedal, et al.
- 2010
(Show Context)
Citation Context ...epeated reads of the same cell will not trigger re-evaluation. We give the interface to a dataflow library in Figure 4. We have implemented and given a correctness proof of this library in prior work =-=[13]-=-, [12], but briefly describe the specification here, since we use it as a component of the present work. The interface features two abstract data types, cell and code. Values of type cell α are datafl... |

10 | Safe functional reactive programming through dependent types
- Sculthorpe, Nilsson
- 2009
(Show Context)
Citation Context ...too easy to introduce significant space and time leaks in FRP programs, and one can even write programs that are unimplementable, e.g. because they violate causality. Some recent variants of FRP [5], =-=[6]-=- restrict the model to rule out non-causal functions and ill-formed feedback. In practice, of course, interactive GUIs and the like are usually implemented in general-purpose languages in a very imper... |

9 | Causal commutative arrows and their optimization
- Liu, Cheng, et al.
- 2009
(Show Context)
Citation Context ... all too easy to introduce significant space and time leaks in FRP programs, and one can even write programs that are unimplementable, e.g. because they violate causality. Some recent variants of FRP =-=[5]-=-, [6] restrict the model to rule out non-causal functions and ill-formed feedback. In practice, of course, interactive GUIs and the like are usually implemented in general-purpose languages in a very ... |

7 | Verifying Higher-Order Imperative Programs with Higher-Order Separation Logic
- Krishnaswami
- 2012
(Show Context)
Citation Context ...f sets, we will freely make use of features like subsets, indexed sums, and indexed products, exploiting their definability. Further details of this logic are given in the first author’s dissertation =-=[12]-=-. B. The Implementation and its Correctness Proof The basic idea underlying our implementation is the idea of representing a collection of streams with a dataflow graph. Instead of representing stream... |

4 |
A metric model of guarded recursion
- Birkedal, Schwinghammer, et al.
- 2010
(Show Context)
Citation Context ...ng in streams with the causal metric and making particular use of the delay modality) does reflect the synchronous operational semantics and implementation techniques we have in mind. Birkedal et al. =-=[8]-=- have recently given an ultrametric model of the calculus for guarded recursion due to Nakano [7], and we use the same semantics for types. Our term calculus is different, however, being more in the s... |

1 |
Hybrid Logic and its Proof Theory
- Brauener
- 2011
(Show Context)
Citation Context ...rm of type •A at time i. We remark that the calculus only deals with relative times, and there is no way to define a type valid only at a single moment in time (as might be possible in a hybrid logic =-=[9]-=-). For example, the type of values A, k steps in the future, would be •k (A), but there is no type corresponding to being valid exactly at time k = 17. This property can be formalized in the following... |

1 |
A metric model of
- Escardó
- 1999
(Show Context)
Citation Context ... GUI programming in a subsequent publication. (Ultra)metric spaces have appeared before in semantics, notably in concurrency [16] and in connection with the solution of domain equations [17]. Escardo =-=[18]-=- gives a ultrametric space semantics of PCF. His lift monad construction translates quite naturally to our setting, with A⊥ = (A × N) + 1, with a metric resembling the recursive type µα. 1 + •α. This ... |

1 | means that under their interpretation of streams µα. A×α, the first element of the stream is an element of 1 (A), whereas in our semantics the head is an element of A. This difference arises from the differing operational idea underlying each semantics. T - This |