expressing causality in categorical models of functional
play

Expressing Causality in Categorical Models of Functional Reactive - PowerPoint PPT Presentation

Introduction Causality Causality in semantics Consequences Conclusions Expressing Causality in Categorical Models of Functional Reactive Programming Wolfgang Jeltsch TT U K uberneetika Instituut Tallinn, Estonia Joint


  1. Introduction Causality Causality in semantics Consequences Conclusions Expressing Causality in Categorical Models of Functional Reactive Programming Wolfgang Jeltsch TT¨ U K¨ uberneetika Instituut Tallinn, Estonia Joint Estonian–Latvian Theory Days at Medz¯ abaki 29 September 2012

  2. Introduction Causality Causality in semantics Consequences Conclusions Functional reactive programming extension of functional programming supports description of temporal behavior two key concepts: computing with time-varying values and events time-dependent type membership new type constructors: ✷ time-varying values ✸ events

  3. Introduction Causality Causality in semantics Consequences Conclusions Categorical models of simply typed programming calculus models are cartesian closed categories with coproducts (CCCCs) use of basic category structure: type object operation morphism type object use of CCCC structure: product type τ 1 × τ 2 A × B product sum type τ 1 + τ 2 A + B coproduct B A function type τ 1 → τ 2 exponential unit type 1 1 terminal object empty type 0 0 initial object

  4. Introduction Causality Causality in semantics Consequences Conclusions Categorical models of FRP ingredients: totally ordered set ( T , � ) time scale CCCC B simple types and functions product category B T models FRP types and operations with indices denoting inhabitation times: t † � t ‡ � � · · · � A A τ 1 � t † � � t ‡ � ϕ f f t † � · · · � � t ‡ � B B τ 2

  5. Introduction Causality Causality in semantics Consequences Conclusions Meanings of FRP type constructors general picture: simple type constructors CCCC structure of B T type constructors ✷ and ✸ functors ✷ and ✸ CCCC structure of B T from CCCC structure of B with operations working pointwise functors ✷ and ✸ defined as follows: � t ′ � � ( ✷ A )( t ) = A t ′ � t � t ′ � � ( ✸ A )( t ) = A t ′ � t

  6. Introduction Causality Causality in semantics Consequences Conclusions An example program component looks for the next key press up to a certain timeout emits a value of type ✸ (Key + 1) when it starts: Case 1 key press before timeout: K t ∗ t t k ι 1 ( K ) @ t k Case 2 no key press before timeout: t ∗ t ι 2 (tt) @ t ∗

  7. Introduction Causality Causality in semantics Consequences Conclusions A noncausal operation hypothetical polymorphic operation d from ✸ ( τ 1 + τ 2 ) to ✸ τ 1 + ✸ τ 2 : ι 1 ( x ) @ t ′ �→ ι 1 ( x @ t ′ ) ι 2 ( y ) @ t ′ �→ ι 2 ( y @ t ′ ) applying d to the output of the key press listener gives value of type ✸ Key + ✸ 1: key press before timeout ι 1 ( K @ t k ) no key press before timeout ι 2 (tt @ t ∗ ) tells us immediately if the user will press a key before the timeout so d cannot exist

  8. Introduction Causality Causality in semantics Consequences Conclusions Semantics allow for noncausal operations polymorphic operations from ✸ ( τ 1 + τ 2 ) to ✸ τ 1 + ✸ τ 2 modeled by natural transformations τ with τ A , B : ✸ ( A + B ) → ✸ A + ✸ B there is such a τ (which is even an isomorphism): � t ′ �� ∼ � t ′ � � t ′ � � t ′ � � � � � + B + A = A B t ′ � t t ′ � t t ′ � t reason: semantics do not deal with time-dependent knowledge about values

  9. Introduction Causality Causality in semantics Consequences Conclusions Knowledge-aware semantics replace category B T by category B I where I = { ( t , t o ) ∈ T × T | t � t o } dealing with knowledge at t o : knowledge type A ( t , t o ) f ( t , t o ) knowledge transformation knowledge type B ( t , t o ) functors ✷ and ✸ defined as follows: � t ′ , t o � � ( ✷ A )( t , t o ) = A t ′ ∈ [ t , t o ] � t ′ , t o � � ( ✸ A )( t , t o ) = A + 1 t ′ ∈ [ t , t o ]

  10. Introduction Causality Causality in semantics Consequences Conclusions Compatibility of knowledge transformations knowledge transformations may be incompatible extend set I to category I by adding morphisms ( t , t o , t ′ o ) : ( t , t ′ o ) → ( t , t o ) for t � t o � t ′ o replace product category B I by functor category B I objects A ( t , t o , t ′ o ) model knowledge reduction morphisms of B I are natural transformations means that knowledge transformations are compatible: A ( t , t o , t ′ o ) A ( t , t ′ A ( t , t o ) o ) f ( t , t o ) f ( t , t ′ o ) B ( t , t ′ B ( t , t o ) o ) B ( t , t o , t ′ o )

  11. Introduction Causality Causality in semantics Consequences Conclusions Upper bounds for occurrence times definition of functor ✸ allows for never occurring events: � t ′ , t o � � ( ✸ A )( t , t o ) = + 1 A t ′ ∈ [ t , t o ] B I � B I � introduction of new functor ✸ − : T → where T is the category of ( T , � ) ✸ t b models an event type constructor with upper bound t b for occurrence times:  0 if t b < t   � t ′ , t o � ( ✸ t b A )( t , t o ) = � if t � t b � t o t ′ ∈ [ t , t b ] A  t ′ , t o � � � t ′ ∈ [ t , t o ] A + 1 it t o < t b  b ) models type conversion ✸ ( t b , t ′

  12. Introduction Causality Causality in semantics Consequences Conclusions Meaning of event type constructor type constructor ✸ is the least upper bound of all ✸ t b -constructors functor ✸ must be a colimit of the functor ✸ − : ✸ ( t b , t ′ b ) ✸ t ′ ✸ t b · · · b ι t ′ ι t b b ✸ τ t b τ t ′ b F

  13. Introduction Causality Causality in semantics Consequences Conclusions The shape of the ✸ -functor Theorem If ( T , � ) has a maximum t max , then ✸ ∼ = ✸ t max . Theorem If ( T , � ) has no maximum, ✸ models an event type constructor that allows for never occurring events.

  14. Introduction Causality Causality in semantics Consequences Conclusions Causality ensured Theorem There are categorical models that do not contain any natural transformation τ with τ A , B : ✸ ( A + B ) → ✸ A + ✸ B .

  15. Introduction Causality Causality in semantics Consequences Conclusions Conclusions categorical models of FRP that express causality by reflecting time-dependancy of knowledge liveness not expressed under certain conditions ultimate goal is an axiomatic semantics with the following properties: expresses causality expresses liveness constraint of ✸ covers the categorical semantics of this talk as a special case models process type constructors, which are a generalization of ✷ and ✸

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