Software Design, Modelling and Analysis in UML Lecture 19: Live Sequence Charts II 2014-01-29 – 19 – 2014-01-29 – main – Prof. Dr. Andreas Podelski, Dr. Bernd Westphal Albert-Ludwigs-Universit¨ at Freiburg, Germany Contents & Goals Last Lecture: • LSC intuition • LSC abstract syntax This Lecture: • Educational Objectives: Capabilities for following tasks/questions. • What does this LSC mean? • Are this UML model’s state machines consistent with the interactions? • Please provide a UML model which is consistent with this LSC. • What is: activation, hot/cold condition, pre-chart, etc.? • Content: • Symbolic B¨ uchi Automata (TBA) and its (accepted) language. – 19 – 2014-01-29 – Sprelim – • Words of a model. • LSC formal semantics. 2 /65
Course Map N UML W E S = ( T , C , V, atr ) , SM S , SD CD , SM ϕ ∈ OCL CD , SD S ✔ ✔ ✔ ✔ D Model S , → SM ) S , → SD , F SD ) S , A expr ✘ ✔ ✔ ✔ M = (Σ B = ( Q SD , q 0 , A ✔ ✘ ✔ Instances ( cons 0 , Snd 0 ) π = ( σ 0 , ε 0 ) − − − − − − − − → ( σ 1 , ε 1 ) · · · w π = (( σ i , cons i , Snd i )) i ∈ N u 0 ✔ ✘ Mathematics G = ( N, E, f ) – 19 – 2014-01-29 – main – ✔ OD UML 3 /65
Excursus: Symbolic Büchi Automata (over Signature) – 19 – 2014-01-29 – main – 4 /65 Symbolic Büchi Automata Definition. A Symbolic B¨ uchi Automaton (TBA) is a tuple B = ( Expr B ( X ) , X, Q, q ini , → , Q F ) where • X is a set of logical variables, • Expr B ( X ) is a set of Boolean expressions over X , • Q is a finite set of states , • q ini ∈ Q is the initial state, • → ⊆ Q × Expr B ( X ) × Q is the transition relation . Transitions ( q, ψ, q ′ ) from q to q ′ are labelled with an – 19 – 2014-01-29 – Stba – expression ψ ∈ Expr B ( X ) . • Q F ⊆ Q is the set of fair (or accepting) states. 5 /65
TBA Example ( Expr B ( X ) , X, Q, q ini , → , Q F ) , ( q, ψ, q ′ ) ∈→ , q 1 ¬ a ( x, y ) a ( x, y ) b ( x, y ) ∧ ¬ expr q 2 ¬ b ( x, y ) b ( x, y ) ∧ expr q 3 ¬ ( c ( y, x ) ∨ e ( y, z )) c ( y, x ) ∧ e ( y, z ) q 4 ¬ ( d ( y, z ) ∨ f ( y, x )) d ( y, z ) ∧ ¬ f ( y, x ) f ( y, x ) ∧ ¬ d ( y, z ) ¬ f ( y, x ) q 5 q 6 d ( y, z ) ∧ f ( y, x ) ¬ d ( y, z ) – 19 – 2014-01-29 – Stba – f ( y, x ) d ( y, z ) q 7 true 6 /65 Word Definition. Let X be a set of logical variables and let Expr B ( X ) be a set of Boolean expressions over X . A set (Σ , · | = · · ) is called an alphabet for Expr B ( X ) if and only if D ( X ) of logical variables to do- D ( X ) , • for each σ ∈ Σ , • for each expression expr ∈ Expr B , and • for each valuation β : X → main either σ | = β expr or σ �| = β expr . An infinite sequence – 19 – 2014-01-29 – Stba – w = ( σ i ) i ∈ N 0 ∈ Σ ω over (Σ , · | = · · ) is called word for Expr B ( X ) . 7 /65
Word Example q 1 ¬ a ( x, y ) a ( x, y ) b ( x, y ) ∧ ¬ expr q 2 ¬ b ( x, y ) b ( x, y ) ∧ expr q 3 ¬ ( c ( y, x ) ∨ e ( y, z )) c ( y, x ) ∧ e ( y, z ) q 4 ¬ ( d ( y, z ) ∨ f ( y, x )) d ( y, z ) ∧ ¬ f ( y, x ) f ( y, x ) ∧ ¬ d ( y, z ) ¬ f ( y, x ) q 5 q 6 d ( y, z ) ∧ f ( y, x ) ¬ d ( y, z ) – 19 – 2014-01-29 – Stba – d ( y, z ) f ( y, x ) q 7 true 8 /65 Run of TBA over Word Definition. Let B = ( Expr B ( X ) , X, Q, q ini , → , Q F ) be a TBA and w = σ 1 , σ 2 , σ 3 , . . . a word for Expr B ( X ) . D ( X ) An infinite sequence ̺ = q 0 , q 1 , q 2 , . . . ∈ Q ω is called run of B over w under valuation β : X → if and only if • q 0 = q ini , • for each i ∈ N 0 there is a transition ( q i , ψ i , q i +1 ) ∈→ – 19 – 2014-01-29 – Stba – of B such that σ i | = β ψ i . 9 /65
Run Example ̺ = q 0 , q 1 , q 2 , . . . ∈ Q ω s.t. σ i | = β ψ i , i ∈ N 0 . q 1 ¬ a ( x, y ) a ( x, y ) b ( x, y ) ∧ ¬ expr q 2 ¬ b ( x, y ) b ( x, y ) ∧ expr q 3 ¬ ( c ( y, x ) ∨ e ( y, z )) c ( y, x ) ∧ e ( y, z ) q 4 ¬ ( d ( y, z ) ∨ f ( y, x )) d ( y, z ) ∧ ¬ f ( y, x ) f ( y, x ) ∧ ¬ d ( y, z ) ¬ f ( y, x ) q 5 q 6 d ( y, z ) ∧ f ( y, x ) ¬ d ( y, z ) – 19 – 2014-01-29 – Stba – f ( y, x ) d ( y, z ) q 7 true 10 /65 The Language of a TBA Definition. We say B accepts word w (under β ) if and only if B has a run ̺ = ( q i ) i ∈ N 0 over w such that fair (or accepting) states are visited infinitely often by ̺ , i.e., such that ∀ i ∈ N 0 ∃ j > i : q j ∈ Q F . We call the set L β ( B ) ⊆ Σ ω of words for Expr B ( X ) that are accepted by B the language of B . – 19 – 2014-01-29 – Stba – 11 /65
Language of the Example TBA q 1 ¬ a ( x, y ) a ( x, y ) b ( x, y ) ∧ ¬ expr q 2 ¬ b ( x, y ) L β ( B ) consists of the words b ( x, y ) ∧ expr w = ( σ i ) i ∈ N 0 q 3 ¬ ( c ( y, x ) ∨ e ( y, z )) where for 0 ≤ n < m < k < ℓ we have c ( y, x ) ∧ e ( y, z ) = β E ! q 4 • for 0 ≤ i < n , σ i �| ¬ ( d ( y, z ) ∨ f ( y, x )) d ( y, z ) ∧ ¬ f ( y, x ) x,y f ( y, x ) ∧ ¬ d ( y, z ) = β E ! • σ n | x,y ¬ f ( y, x ) = β E ? • for n < i < m , σ i �| q 5 q 6 y d ( y, z ) ∧ f ( y, x ) ¬ d ( y, z ) = β E ? • σ m | y f ( y, x ) d ( y, z ) = β F ! • for m < i < k , σ i �| y,x q 7 true = β F ! • σ k | y,x – 19 – 2014-01-29 – Stba – = β F ? • for k < i < ℓ , σ i �| x,y • . . . 12 /65 Course Map N UML W E S = ( T , C , V, atr ) , SM S , SD CD , SM ϕ ∈ OCL CD , SD S ✔ ✔ ✔ ✔ D Model S , → SM ) S , → SD , F SD ) S , A expr ✘ ✔ ✔ ✔ M = (Σ B = ( Q SD , q 0 , A ( ✔ ) ✔ ✔ Instances ( cons 0 , Snd 0 ) π = ( σ 0 , ε 0 ) − − − − − − − − → ( σ 1 , ε 1 ) · · · w π = (( σ i , cons i , Snd i )) i ∈ N u 0 ✔ ✘ Mathematics G = ( N, E, f ) – 19 – 2014-01-29 – main – ✔ OD UML 13 /65
Back to Main Track: Language of a Model – 19 – 2014-01-29 – main – 14 /65 S = ( T , C , V, atr , E ) be a signature and D a Words over Signature S . A word over S and D is an infinite sequence Definition. Let D D ( C ) × Evs ( E , D ) × D ( C ) × 2 D ( C ) × Evs ( E , D ) × D ( C ) � ω S × 2 structure of ( σ i , cons i , Snd i ) i ∈ N 0 � ∈ Σ . – 19 – 2014-01-29 – Smodellang – 15 /65
Recall : A UML model M = ( C D , S M , O D ) and a structure D denotes a J M K of (initial and consecutive) computations of the form The Language of a Model D ( C ) × Evs ( E , D ) × D ( C ) × 2 D ( C ) × Evs ( E , D ) × D ( C ) × D ( C ) . set a 0 a 1 a 2 ( σ 0 , ε 0 ) − → ( σ 1 , ε 1 ) − → ( σ 2 , ε 2 ) − → . . . where a i = ( cons i , Snd i , u i ) ∈ 2 � �� � =: ˜ A Definition. Let M = ( C D , S M , O D ) be a UML model and D a For the connection between models and interactions, we disregard the config- uration of the ether and who made the step, and define as follows: D S × ˜ J M K } structure. Then A ) ω | – 19 – 2014-01-29 – Smodellang – L ( M ) := { ( σ i , cons i , Snd i ) i ∈ N 0 ∈ (Σ ( cons 0 , Snd 0 ) ∃ ( ε i , u i ) i ∈ N 0 : ( σ 0 , ε 0 ) − − − − − − − − → ( σ 1 , ε 1 ) · · · ∈ u 0 is the language of M . 16 /65 D S × ˜ Example: The Language of a Model J M K } A ) ω | L ( M ) := { ( σ i , cons i , Snd i ) i ∈ N 0 ∈ (Σ ( cons 0 , Snd 0 ) ∃ ( ε i , u i ) i ∈ N 0 : ( σ 0 , ε 0 ) − − − − − − − − → ( σ 1 , ε 1 ) · · · ∈ u 0 – 19 – 2014-01-29 – Smodellang – 17 /65
S = ( T , C , V, atr , E ) be a signature and X a set of logical variables, Signal and Attribute Expressions S ( E , X ) are defined by the • Let • The signal and attribute expressions Expr E , x, y ∈ X . S , E ∈ grammar: ψ ::= true | expr | E ! x,y | E ? x,y | ¬ ψ | ψ 1 ∨ ψ 2 , where expr : Bool ∈ Expr – 19 – 2014-01-29 – Smodellang – 18 /65 D S × ˜ Satisfaction of Signal and Attribute Expressions D ( C ) be a valuation of the logical variables. • Let ( σ, cons , Snd ) ∈ Σ A be a triple consisting of system state , consume set , and send set . • Let β : X → Then • ( σ, cons , Snd ) | = β true • ( σ, cons , Snd ) | = β ¬ ψ if and only if not ( σ, cons , Snd ) | J expr K ( σ, β ) = 1 = β ψ • ( σ, cons , Snd ) | = β ψ 1 ∨ ψ 2 if and only if ( σ, cons , Snd ) | = β ψ 1 or ( σ, cons , Snd ) | = β ψ 2 • ( σ, cons , Snd ) | = β expr if and only if I – 19 – 2014-01-29 – Smodellang – x,y if and only if ∃ � d • ( β ( x ) , ( E, � = β E ! • ( σ, cons , Snd ) | d ) , β ( y )) ∈ Snd x,y if and only if ∃ � d • ( β ( x ) , ( E, � = β E ? • ( σ, cons , Snd ) | d ) , β ( y )) ∈ cons Observation : semantics of models keeps track of sender and receiver at sending and consumption time. We disregard the event identity. Alternative : keep track of event identities. 19 /65
Recommend
More recommend