Introduction Operators Example Properties Summary Temporal-Logic Combinators Neil Sculthorpe Functional Programming Laboratory School of Computer Science University of Nottingham United Kingdom nas@cs.nott.ac.uk Functional Programming Laboratory Away Day Buxton, England 8th July 2011 Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary What is Temporal Logic? A modal logic where propositions are quantified over time. Also known as tense logic. Useful for reasoning about time-varying values. Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary What is Time? A temporal logic has an underlying time domain. The nature of the time domain can vary. E.g. Continuous or Discrete Linear, Cyclic or Branching Finite or Infinite But we assume it is a pre-order. Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Agda Encoding Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Agda Encoding Temporal Predicates TPred = Time → Set Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Agda Encoding Temporal Predicates TPred = Time → Set The standard temporal-logic combinators can then be encoded directly in Agda. Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Logical Operators Lifted Operators : TPred → TPred → TPred ∧ ( ϕ ∧ ψ ) t = ϕ t × ψ t : TPred → TPred → TPred ∨ ( ϕ ∨ ψ ) t = ϕ t ⊎ ψ t : TPred → TPred → TPred ⇒ ( ϕ ⇒ ψ ) t = ϕ t → ψ t ⊥ : TPred ⊥ t = False ⊤ : TPred ⊤ t = True Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Logical Operators Defining Negation ¬ : TPred → TPred ¬ ϕ = ϕ ⇒ ⊥ Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Priorean Operators First devised by Arthur Prior [Pri67]. Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Priorean Operators First devised by Arthur Prior [Pri67]. Global ‘‘At all points in the future’’ G : TPred → TPred G ϕ t = ( t ′ : Time ) → ( t ′ > t ) → ϕ t ′ Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Priorean Operators First devised by Arthur Prior [Pri67]. Global ‘‘At all points in the future’’ G : TPred → TPred G ϕ t = ( t ′ : Time ) → ( t ′ > t ) → ϕ t ′ History ‘‘At all points in the past’’ H : TPred → TPred H ϕ t = ( t ′ : Time ) → ( t ′ < t ) → ϕ t ′ Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Priorean Operators Future ‘‘At some point in the future’’ F : TPred → TPred F ϕ t = Σ [ t ′ : Time ] (( t ′ > t ) × ϕ t ′ ) Past ‘‘At some point in the past’’ P : TPred → TPred P ϕ t = Σ [ t ′ : Time ] (( t ′ < t ) × ϕ t ′ ) syntax Σ A ( λ a → B ) = Σ [ a : A ] B Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Reflexive Priorean Operators G r : TPred → TPred G r ϕ = ϕ ∧ G ϕ H r : TPred → TPred H r ϕ = ϕ ∧ H ϕ F r : TPred → TPred F r ϕ = ϕ ∨ F ϕ P r : TPred → TPred P r ϕ = ϕ ∨ P ϕ Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Since/Until Operators There are also more expressive binary operators, such as Since and Until [Bur82]. Since : TPred → TPred → TPred S ϕ S ψ ≈ ϕ has held since ψ held Until U : TPred → TPred → TPred ϕ U ψ ≈ ϕ will hold until ψ holds Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Properties of Time It is possible to state temporal formulae that hold if and only if the underlying time domain has a specific property [Ven01]. Time-Domain Properties FirstPoint : TPred FirstPoint = P r ( H ⊥ ) EndPoint : TPred EndPoint = F r ( G ⊥ ) Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Properties of Time It is possible to state temporal formulae that hold if and only if the underlying time domain has a specific property [Ven01]. Time-Domain Properties FirstPoint : TPred FirstPoint = P r ( H ⊥ ) EndPoint : TPred EndPoint = F r ( G ⊥ ) Density : Set Density = ( ϕ : TPred ) → Always ( F ϕ ⇒ F ( F ϕ )) where Always : TPred → Set Always ϕ = ( t : Time ) → ϕ t Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Functional Reactive Programming (FRP) FRP is based around time-varying values called signals: Signal A = Time → A Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Functional Reactive Programming (FRP) FRP is based around time-varying values called signals: Signal A = Time → A Typically, an FRP time domain: is linear; has a start point; does not have an end point; may be either continuous or discrete. Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Functional Reactive Programming (FRP) Time-Varying Equality . = : Signal A → Signal A → TPred . ( s 1 = s 2 ) t = s 1 t ≡ s 2 t Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Functional Reactive Programming (FRP) Time-Varying Equality . = : Signal A → Signal A → TPred . ( s 1 = s 2 ) t = s 1 t ≡ s 2 t Causality Causal : ( Signal A → Signal B ) → Set . . Causal f = ∀ ( s 1 s 2 ) → Always ( H r ( s 1 = s 2 ) ⇒ f s 1 = f s 2 ) Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Functional Reactive Programming (FRP) Time-Varying Equality . = : Signal A → Signal A → TPred . ( s 1 = s 2 ) t = s 1 t ≡ s 2 t Causality Causal : ( Signal A → Signal B ) → Set . . Causal f = ∀ ( s 1 s 2 ) → Always ( H r ( s 1 = s 2 ) ⇒ f s 1 = f s 2 ) Causal f = ∀ ( s 1 s 2 t t ′ ) → t ′ � t → s 1 t ′ ≡ s 2 t ′ → f s 1 t ≡ f s 2 t Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Functional Reactive Programming (FRP) Time-Varying Equality . = : Signal A → Signal A → TPred . ( s 1 = s 2 ) t = s 1 t ≡ s 2 t Causality Causal : ( Signal A → Signal B ) → Set . . Causal f = ∀ ( s 1 s 2 ) → Always ( H r ( s 1 = s 2 ) ⇒ f s 1 = f s 2 ) Causal f = ∀ ( s 1 s 2 t t ′ ) → t ′ � t → s 1 t ′ ≡ s 2 t ′ → f s 1 t ≡ f s 2 t Decoupledness Decoupled : ( Signal A → Signal B ) → Set . . Decoupled f = ∀ ( s 1 s 2 ) → Always ( H ( s 1 = s 2 ) ⇒ f s 1 = f s 2 ) Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary Summary Temporal-logic combinators are a useful notation for expressing and reasoning about time-varying properties. They (often) allow definitions to be stated intuitively and concisely. See my thesis for more FRP-based examples [Scu11]. Neil Sculthorpe Temporal-Logic Combinators
Introduction Operators Example Properties Summary References John P. Burgess. Axioms for tense logic. I. “Since” and “Until”. Notre Dame Journal of Formal Logic , 23(4):367–374, 1982. Arthur N. Prior. Past, Present and Future . Oxford University Press, 1967. Neil Sculthorpe. Towards Safe and Efficient Functional Reactive Programming . PhD thesis, School of Computer Science, University of Nottingham, 2011. Yde Venema. Temporal logic. In The Blackwell Guide to Philosophical Logic , chapter 10, pages 203–223. Blackwell, 2001. Neil Sculthorpe Temporal-Logic Combinators
Recommend
More recommend