Concrete Process Categories Wolfgang Jeltsch Concrete Process Categories Introduction Processes Causality Causality wanted Wolfgang Jeltsch Concrete process categories Consequences Conclusions TT¨ U K¨ uberneetika Instituut Teooriaseminar 4 October 2012
Concrete Process Categories Wolfgang Jeltsch Introduction 1 Introduction Processes Processes 2 Causality Causality wanted Concrete process categories Causality 3 Consequences Conclusions Conclusions 4
Concrete Process Categories Wolfgang Jeltsch Introduction 1 Introduction Processes Processes 2 Causality Causality wanted Concrete process categories Causality 3 Consequences Conclusions Conclusions 4
Functional reactive programming Concrete Process Categories extension of functional programming Wolfgang Jeltsch supports description of temporal behavior Introduction two key concepts: Processes time-dependent type membership Causality special type constructors: Causality wanted Concrete process ✷ time-varying values categories Consequences ✸ events Conclusions Curry–Howard correspondence to temporal logic: time-dependent trueness special operators: ✷ will always hold ✸ will eventually hold
Categorical models of simply typed calculus Concrete models are cartesian closed categories with coproducts Process Categories use of basic category structure: Wolfgang Jeltsch type object Introduction operation morphism Processes Causality type object Causality wanted Concrete process categories Consequences use of CCCC structure: Conclusions product type τ 1 × τ 2 A × B product sum type τ 1 + τ 2 A + B coproduct function type τ 1 → τ 2 B A exponential unit type 1 1 terminal object empty type 0 0 initial object
Categorical models of FRP Concrete Process Categories ingredients: Wolfgang Jeltsch totally ordered set ( T , � ) time scale Introduction CCCC B simple types and functions Processes product category B T models FRP types and operations Causality with indices denoting inhabitation times: Causality wanted Concrete process categories Consequences � t † � � t ‡ � · · · τ 1 A A Conclusions � t † � � t ‡ � ϕ f f t † � · · · � � t ‡ � B B τ 2
Meanings of FRP type constructors Concrete general picture: Process Categories Wolfgang simple type constructors Jeltsch CCCC structure of B T type constructors ✷ and ✸ Introduction functors ✷ and ✸ Processes Causality CCCC structure of B T from CCCC structure of B Causality wanted Concrete process categories with operations working pointwise Consequences Conclusions functors ✷ and ✸ defined as follows: � � t ′ � ( ✷ A )( t ) = A t ′ ∈ [ t , ∞ ) � t ′ � � ( ✸ A )( t ) = A t ′ ∈ [ t , ∞ )
Concrete Process Categories Wolfgang Jeltsch Introduction 1 Introduction Processes Processes 2 Causality Causality wanted Concrete process categories Causality 3 Consequences Conclusions Conclusions 4
From “until” to processes Concrete Process more temporal operators from linear-time temporal logic: Categories Wolfgang ✄ strong “until” Jeltsch ◮ weak “until” Introduction semantics given by functors ✄ and ◮ : Processes Causality Causality wanted � � t ′′ � t ′ � Concrete process � � ( A ✄ B )( t ) = × B A categories Consequences t ′ ∈ [ t , ∞ ) t ′′ ∈ [ t , t ′ ) Conclusions � t ′ � � ( A ◮ B )( t ) = ( A ✄ B )( t ) + A t ′ ∈ [ t , ∞ ) FRP analogs of “until” proofs are processes: normally finite-length time-varying value plus terminal event in the case of ◮ also nontermination possible
Applications of processes Concrete Process stereo playback with different guarantees: Categories Wolfgang ( R × R ) ◮ 1 none Jeltsch ( R × R ) ✄ 1 termination Introduction ( R × R ) ◮ 0 nontermination Processes stereo playback with additional information: Causality Causality wanted ( R × R ) ◮ (1 + 1) reason of termination Concrete process categories (end of track vs. abort) Consequences Conclusions alternating stereo/mono playback with different guarantees: νσ . ( R × R ) ◮ R ◮ σ nontermination νσ . ( R × R ) ✄ R ✄ σ switch, nontermination νσ . ( R × R ) ◮ (1 + R ◮ (1 + σ )) none νσ . ( R × R ) ✄ (1 + R ✄ (1 + σ )) switch µσ . ( R × R ) ✄ (1 + R ✄ (1 + σ )) termination
Processes as the core concept of FRP Concrete Process Categories Wolfgang Jeltsch introduction of processes increases expressiveness Introduction Processes processes cover time-varying values and events Causality as special cases: Causality wanted Concrete process categories ✷ A ∼ Consequences = A ◮ 0 Conclusions ✸ A ∼ = 1 ✄ A
Concrete Process Categories Introduction Wolfgang 1 Jeltsch Introduction Processes 2 Processes Causality Causality wanted Causality 3 Concrete process categories Causality wanted Consequences Concrete process categories Conclusions Consequences Conclusions 4
Concrete Process Categories Introduction Wolfgang 1 Jeltsch Introduction Processes 2 Processes Causality Causality wanted Causality 3 Concrete process categories Causality wanted Consequences Conclusions Concrete process categories Consequences Conclusions 4
An example program component Concrete looks for the next key press up to a certain timeout Process Categories emits a value of type ✸ (Key + 1) when it starts: Wolfgang Case 1 key press before timeout: Jeltsch Introduction K Processes Causality t ∗ t t k Causality wanted Concrete process categories Consequences ι 1 ( K ) @ t k Conclusions Case 2 no key press before timeout: t ∗ t ι 2 (tt) @ t ∗
A noncausal operation Concrete Process Categories hypothetical polymorphic operation d from ✸ ( τ 1 + τ 2 ) Wolfgang to ✸ τ 1 + ✸ τ 2 : Jeltsch ι 1 ( x ) @ t ′ �→ ι 1 ( x @ t ′ ) Introduction Processes ι 2 ( y ) @ t ′ �→ ι 2 ( y @ t ′ ) Causality Causality wanted Concrete process applying d to the output of the key press listener categories Consequences gives value of type ✸ Key + ✸ 1: Conclusions 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
Semantics allow for noncausal operations Concrete Process Categories polymorphic operations from ✸ ( τ 1 + τ 2 ) to ✸ τ 1 + ✸ τ 2 Wolfgang Jeltsch modeled by natural transformations τ with Introduction τ A , B : ✸ ( A + B ) → ✸ A + ✸ B Processes Causality there is such a τ (which is even an isomorphism): Causality wanted Concrete process categories Consequences � t ′ �� ∼ � � � � t ′ � � � t ′ � � t ′ � A + B = A + B Conclusions t ′ � t t ′ � t t ′ � t reason: semantics do not deal with time-dependent knowledge about values
Concrete Process Categories Introduction Wolfgang 1 Jeltsch Introduction Processes 2 Processes Causality Causality wanted Causality 3 Concrete process categories Causality wanted Consequences Conclusions Concrete process categories Consequences Conclusions 4
Knowledge-aware semantics replace category B T by category B I where Concrete Process Categories I = { ( t , t o ) ∈ T × T | t � t o } Wolfgang Jeltsch dealing with knowledge at t o : Introduction Processes knowledge type A ( t , t o ) Causality Causality wanted Concrete process f ( t , t o ) knowledge transformation categories Consequences Conclusions knowledge type B ( t , t o ) ( A ◮ B )( t , t o ) defined as follows: � � + � � t ′′ , t o � � t ′ , t o � � t ′ , t o � A × B A t ′ ∈ [ t , t o ] t ′′ ∈ [ t , t ′ ) t ′ ∈ [ t , t o ]
Compatibility of knowledge transformations Concrete knowledge transformations may be incompatible Process Categories extend set I to category I by adding morphisms Wolfgang ( t , t o , t ′ o ) : ( t , t ′ o ) → ( t , t o ) Jeltsch for t � t o � t ′ Introduction o replace product category B I by functor category B I Processes Causality objects A ( t , t o , t ′ o ) model knowledge reduction Causality wanted morphisms of B I are natural transformations Concrete process categories Consequences means that knowledge transformations are compatible: Conclusions 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 )
Upper bounds for occurrence times Concrete Process definition of functor ✄ not directly possible Categories B I � B I ×B I Wolfgang � introduction of new functor ✄ − : T → Jeltsch where T is the category of ( T , � ) Introduction ✄ t b models a process type constructor with upper bound t b Processes for termination time Causality Causality wanted ( A ✄ t b B )( t , t o ) defined as follows: Concrete process categories Consequences Conclusions 0 if t b < t �� � t ′′ ∈ [ t , t ′ ) A ( t ′′ , t o ) × B ( t ′ , t o ) � if t � t b � t o t ′ ∈ [ t , t b ] ( A ◮ B )( t , t o ) it t o < t b ✄ ( t b , t ′ b ) models type conversion
Recommend
More recommend