s©mantique des syst¨mes distribu©s et embarqu©s -- unsa 20091 temporal logics...

Download S©mantique des Syst¨mes Distribu©s et Embarqu©s -- UNSA 20091 Temporal Logics Temporal Logics (CTL, ACTL) Logic patterns SSDE Eric Madelaine -- mardi 23

Post on 03-Apr-2015

102 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • Page 1
  • Smantique des Systmes Distribus et Embarqus -- UNSA 20091 Temporal Logics Temporal Logics (CTL, ACTL) Logic patterns SSDE Eric Madelaine -- mardi 23 mars 2010 Note: Ce cours comprendra des exercices comptant pour la note de contrle continu
  • Page 2
  • Smantique des Systmes Distribus et Embarqus -- UNSA 20092 Reasoning about Executions We want to reason about execution trees tree node = snap shot of the programs state Reasoning consists of two layers defining predicates on the program states (control points, variable values) expressing temporal relationships between those predicates [L3, (mt3, vr3), .] Explored State-Space (computation tree) Conceptual View [L1, (mt1, vr1), .] [L2, (mt2, vr2), .] [L5, (mt5, vr5), .] L1L4 L2 L3 L5 ?b1 ?err ?b0 ?b1!a1 ?a1 ?b0 ?err !a0
  • Page 3
  • Smantique des Systmes Distribus et Embarqus -- UNSA 20093 Computational Tree Logic (CTL) Relations to process algebras ? Temporal Logics are used to express (user) requirements, in the early stages of the development cycle. Absence of errors, absence of deadlocks, reachability, progress, termination, liveness, Different logics relate to different equivalence relations: LTL Trace equivalence CTL, ACTL Bisimulations Model-checking = Satisfiability of a Logic Formula within a specific model (transition system, program, )
  • Page 4
  • Smantique des Systmes Distribus et Embarqus -- UNSA 20094 Computational Tree Logic (CTL) Clarke & Emerson (early 1980s) ::= P primitive propositions | ! | && | || | -> propositional connectives | AG | EG | AF | EF temporal operators | AX | EX | A[ U ] | E[ U ] Syntax Semantic Intuition AG p along All paths p holds Globally EG p there Exists a path where p holds Globally AF p along All paths p holds at some state in the Future EF p there Exists a path where p holds at some state in the Future path quantifiertemporal operator
  • Page 5
  • Smantique des Systmes Distribus et Embarqus -- UNSA 20095 Computational Tree Logic (CTL) ::= P primitive propositions | ! | && | || | -> propositional connectives | AG | EG | AF | EF path/temporal operators | AX | EX | A[ U ] | E[ U ] Syntax Semantic Intuition AX p along All paths, p holds in the neXt state EX p there Exists a path where p holds in the neXt state A[p U q] along All paths, p holds Until q holds E[p U q] there Exists a path where p holds Until q holds
  • Page 6
  • Smantique des Systmes Distribus et Embarqus -- UNSA 20096 Computation Tree Logic p p p p p p p p p p p pppp AG p
  • Page 7
  • Smantique des Systmes Distribus et Embarqus -- UNSA 20097 Computation Tree Logic EG p p p p p
  • Page 8
  • Smantique des Systmes Distribus et Embarqus -- UNSA 20098 Computation Tree Logic AF p p p pp p p
  • Page 9
  • Smantique des Systmes Distribus et Embarqus -- UNSA 20099 Computation Tree Logic EF p p
  • Page 10
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200910 Computation Tree Logic AX p p p p p pp p p p
  • Page 11
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200911 Computation Tree Logic EX p p p p pp p
  • Page 12
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200912 Computation Tree Logic A[p U q] p p p q q p p q q p p
  • Page 13
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200913 Computation Tree Logic E[p U q] p p q q p p q q q
  • Page 14
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200914 Example CTL Specifications For any state, a request (for some resource) will eventually be acknowledged AG(requested -> AF acknowledged) From any state, it is possible to get to a restart state AG(EF restart) An upwards travelling elevator at the second floor does not changes its direction when it has passengers waiting to go to the fifth floor AG((floor=2 && direction=up && button5pressed) -> A[direction=up U floor=5])
  • Page 15
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200915 Exercices Ecrire en CTL: P est vrai aprs Q P devient vrai aprs Q P rpond Q On ne peut pas aller plus de 2 fois dans un tat vrifiant P
  • Page 16
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200916 Exercices ---Corrections --- Ecrire en CTL: P est vrai aprs QAG(Q -> AG(P)) P devient vrai aprs Q AG (!P U (Q & AF(P))) P rpond QAG(Q -> AF(P)) On ne peut pas aller plus de 2 fois dans un tat vrifiant P !EF (!P & EX(P & EF(!P & EX(P & EF(!P & EX(P))))))
  • Page 17
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200917 Exercice: Minimality It is sufficient to define CTL syntax as: ::= P | ! | && | AX | EX | A[ U ] | E[ U ] Express the other operators as derivatives: f || g = AF g = EF g = AG f = EG f =
  • Page 18
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200918 Exercice: Minimality ---Corrections --- It is sufficient to define CTL syntax as: ::= P | ! | && | AX | EX | A[ U ] | E[ U ] Express the other operators as derivatives: f || g = ! (!f && !g) AF g = A[true U g] EF g = E[true U g] AG f = ! E[true U !f] EG f = ! A[true U !f]
  • Page 19
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200919 Exercice (CC)
  • Page 20
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200920 Semantics: interpretation on Kripke structures Kripke structure K = (S,R,L) S set of states R transition relation L valuation function L( )(s) -> True/False Path = infinite sequence (s 0,s 1, s 2, ) such that i (s i,s i+1 ) R
  • Page 21
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200921 Semantics: interpretation on Kripke structures Formalisation of the semantics : s p iff L(s)(p)where p atomic proposition s !f iff s f s 0 AX f iff for all paths (s 0,s 1, s 2, ), s 1 f s 0 A(f U g) iff for all paths (s 0,s 1, ), for some i, si f and for all j
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200934 Motivation for Specification Patterns Temporal properties are not always easy to write Clearly many specifications can be captured in both CTL and ACTL (or LTL*) * left for personal research LTL: [](P -> Q) CTL: AG(P -> AF Q) Example: action Q must respond to action P Capture the experience base of expert designers Transfer that experience between practitioners. You can use specification patterns to:
  • Page 35
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200935 Pattern Hierarchy Property Patterns OccurrenceOrder Absence UniversalityExistence Bounded Existence Precedence Response Chain Precedence Chain Response Classification Occurrence Patterns: require states/events to occur or not to occur Order Patterns constrain the order of states/events
  • Page 36
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200936 Occurrence Patterns Absence: A given state/event does not occur within a scope Existence: A given state/event must occur within a scope Bounded Existence: A given state/event must occur k times within a scope variants: at least k times in scope, at most k times in scope Universality: A given state/event must occur throughout a scope
  • Page 37
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200937 Order Patterns Precedence: A state/event P must always be preceded by a state/event Q within a scope Response: A state/event P must always be followed a state/event Q within a scope Chain Precedence: A sequence of state/events P1, , Pn must always be preceded by a sequence of states/events Q1, , Qm within a scope Chain Response: A sequence of state/events P1, , Pn must always be followed by a sequence of states/events Q1, , Qm within a scope
  • Page 38
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200938 Pattern Scopes Global Before Q After Q Between Q and R After Q and R State sequence QRQQRQ
  • Page 39
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200939 The Response Pattern To describe cause-effect relationships between a pair of events/states. An occurrence of the first, the cause, must be followed by an occurrence of the second, the effect. Also known as Follows and Leads-to. Intent Mappings: In these mappings, P is the cause and S is the effect [](P -> S) R -> (P -> (!R U (S & !R))) U R [](Q -> [](P -> S)) []((Q & !R & R) -> (P -> (!R U (S & !R))) U R) [](Q & !R -> ((P -> (!R U (S & !R))) W R) Globally: Before R: After Q: Between Q and R: After Q until R: LTL:
  • Page 40
  • Smantique des Systmes Distribus et Embarqus -- UNSA 200940 The Response Pattern (continued) Mappings: In these mappings, P is the cause and S is the effect AG(P -> AF(S)) A[((P -> A[!R U (S & !R)]) | AG(!R)) W R] A[!Q W (Q & AG(P -> AF(S))] AG(Q & !R -> A[((P -> A[!R U (S & !R)]) | AG(!R)) W R]) AG(Q & !R -> A[(P -> A[!R U (S & !R)]) W R]) Globally: Before R: After Q: Between Q and R: After Q until R: CTL: Examples and Known Uses: Response properties occur quite commonly in specifications of concurrent systems. Perhaps the most common example is in describing a requirement that a resource must be granted after it is requested. Relationships Note that a Response property is like a converse of a Precedence property. Precedence says that some cause precedes each effect, and...
  • Page 41
  • Smantique

Recommended

View more >