Software Design, Modelling and Analysis in UML
Lecture 13: Core State Machines IV
2012-12-12
- Prof. Dr. Andreas Podelski, Dr. Bernd Westphal
Albert-Ludwigs-Universit¨ at Freiburg, Germany
– 13 – 2012-12-12 – main –
Software Design, Modelling and Analysis in UML Lecture 13: Core - - PowerPoint PPT Presentation
Software Design, Modelling and Analysis in UML Lecture 13: Core State Machines IV 2012-12-12 13 2012-12-12 main Prof. Dr. Andreas Podelski, Dr. Bernd Westphal Albert-Ludwigs-Universit at Freiburg, Germany Contents & Goals
– 13 – 2012-12-12 – main –
– 13 – 2012-12-12 – Sprelim –
2/48
– 13 – 2012-12-12 – main –
3/48
– 12 – 2011-12-11 – Sstmsem –
9/60
– 13 – 2012-12-12 – Sstmsem –
4/48
– 13 – 2012-12-12 – Sstmsem –
5/48
s1 s2 s3
E[n = ∅]/x := x + 1; n ! F /n := ∅ F/x := 0
(cons,Snd)
(i) Introduce transformer as the semantics of action annotions. Intuitively, (σ′, ε′) is the effect of applying the transformer
(ii) Explain how to choose transitions depending on ε and when to stop taking transitions — the run-to-completion “algorithm”.
– 12 – 2011-12-11 – Sstmsem –
14/60
– 13 – 2012-12-12 – Sstmsem –
6/48
∪ {∗,+},D)× D( C).
– 12 – 2011-12-11 – Sstmsem –
15/60
– 13 – 2012-12-12 – Sstmsem –
7/48
– 13 – 2012-12-12 – Sstmsem –
8/48
– 13 – 2012-12-12 – Sstmsem –
9/48
abstract syntax concrete syntax
update(expr 1, v, expr 2)
intuitive semantics
Update attribute v in the object denoted by expr 1 to the value denoted by expr 2.
well-typedness
expr 1 : τC and v : τ ∈ atr(C); expr 2 : τ; expr 1, expr 2 obey visibility and navigability
semantics
tupdate(expr1,v,expr2)[ux](σ, ε) = {(σ′, ε)} where σ′ = σ[u → σ(u)[v → I
Jexpr 2 K(σ, β)]] withu = I
Jexpr 1 K(σ, β), β = {this → ux}.Obsupdate(expr1,v,expr2)[ux] = ∅
(error) conditions
Not defined if I
Jexpr 1 K(σ, β) or I Jexpr 2 K(σ, β) not defined.– 13 – 2012-12-12 – Sstmsem –
10/48
update(expr 1, v, expr 2) tupdate(expr1,v,expr2)[ux](σ, ε) = (σ[u → σ(u)[v → I
Jexpr 2 K(σ, β)]], ε),u = I
Jexpr 1 K(σ, β)– 13 – 2012-12-12 – Sstmsem –
11/48
abstract syntax concrete syntax
send(E(expr 1, ..., exprn), expr dst)
intuitive semantics
Object ux : C sends event E to object expr dst, i.e. create a fresh signal instance, fill in its attributes, and place it in the ether.
well-typedness
expr dst : τD, C, D ∈
C \ E ; E ∈ E ;atr(E) = {v1 : τ1, . . . , vn : τn}; expr i : τi, 1 ≤ i ≤ n; all expressions obey visibility and navigability in C
semantics
tsend(E(expr1,...,exprn),exprdst)[ux](σ, ε) = (σ′, ε′) where σ′ = σ ˙ ∪ {u → {vi → di | 1 ≤ i ≤ n}}; ε′ = ε ⊕ (udst, u); if udst = I
Jexpr dst K(σ, β) ∈ dom(σ);di = I
Jexpr i K(σ, β) for1 ≤ i ≤ n; u ∈
D(E) a fresh identity, i.e. u ∈ dom(σ),and where (σ′, ε′) = (σ, ε) if udst ∈ dom(σ); β = {this → ux}.
Obssend[ux] = {(ux, u, (E, d1, . . . , dn), udst)}
(error) conditions
I
Jexpr K(σ, β) not defined for anyexpr ∈ {expr dst, expr 1, . . . , expr n}
– 13 – 2012-12-12 – Sstmsem –
12/48
send(E(expr 1, ..., exprn), exprdst) tsend(exprsrc,E(expr1,...,exprn),exprdst)[ux](σ, ε) = ...
– 13 – 2012-12-12 – Sstmsem –
13/48
abstract syntax concrete syntax
intuitive semantics
well-typedness
i | 1 ≤ i ≤ n}
semantics
(error) conditions
expressive power, but moving creation to the expression language raises all kinds of other problems such as order of evaluation (and thus creation).
tor). Adding them is straightforward (but somewhat tedious).
– 13 – 2012-12-12 – Sstmsem –
14/48
create(C, expr, v) tcreate(C,expr,v)(σ, ε) = ...
– 13 – 2012-12-12 – Sstmsem –
15/48
– 13 – 2012-12-12 – Sstmsem –
16/48
abstract syntax concrete syntax
intuitive semantics
well-typedness
i | 1 ≤ i ≤ n}
semantics
i
K(σ, β) if expr 0i = ‘’ and arbitrary
(error) conditions
– 13 – 2012-12-12 – Sstmsem –
17/48
abstract syntax concrete syntax
intuitive semantics
well-typedness
semantics
(error) conditions
– 13 – 2012-12-12 – Sstmsem –
18/48
destroy(expr) tdestroy(expr)[ux](σ, ε) = ...
– 13 – 2012-12-12 – Sstmsem –
19/48
– 13 – 2012-12-12 – Sstmsem –
20/48
abstract syntax concrete syntax
intuitive semantics
well-typedness
semantics
(error) conditions
– 13 – 2012-12-12 – Sstmsem –
21/48
– 13 – 2012-12-12 – Sstmsem –
22/48
– 13 – 2012-12-12 – Sstmsem –
23/48
– 13 – 2012-12-12 – main –
24/48
a0
a1
a2
– 13 – 2012-12-12 – Sstmrtc –
25/48
– 13 – 2012-12-12 – Sstmrtc –
26/48
∪ {⊥})Evs( E ,D)× D( C)2
(cons,Snd)
u
(i) an event with destination u is discarded, (ii) an event is dispatched to u, i.e. stable object processes an event, or (iii) run-to-completion processing by u commences, i.e. object u is not stable and continues to process an event, (iv) the environment interacts with object u,
(cons,∅)
– 13 – 2012-12-12 – Sstmrtc –
27/48
(cons,Snd)
u
– 13 – 2012-12-12 – Sstmrtc –
28/48
C
x, z : Int y : Int env
0, 1
c : C x = 1, z = 0, y = 2 st = s1 stable = 1
∃ uE ∈
D(E ) : uE ∈ ready(ε, u)F = E ∨ I
Jexpr K(σ) = 0– 13 – 2012-12-12 – Sstmrtc –
29/48
(cons,Snd)
u
– 13 – 2012-12-12 – Sstmrtc –
30/48
C
x, z : Int y : Int env
0, 1
c : C x = 1, z = 0, y = 2 st = s1 stable = 1
∃ uE ∈
D(E ) : uE ∈ ready(ε, u)F = E ∧ I
Jexpr K(˜σ) = 1
σ = σ[u.paramsE → uE].
σ, ε ⊖ uE)
σ, ε ⊖ uE)
– 13 – 2012-12-12 – Sstmrtc –
31/48
(cons,Snd)
u
– 13 – 2012-12-12 – Sstmrtc –
32/48
C
x, z : Int y : Int env
0, 1
c : C x = 2, z = 0, y = 2 st = s2 stable = 0
σ′ = σ′′[u.st → s′, u.stable → b]
– 13 – 2012-12-12 – Sstmrtc –
33/48
(cons,Snd)
env
– 13 – 2012-12-12 – Sstmrtc –
34/48
C
x, z : Int y : Int env
0, 1
c : C x = 0, z = 0, y = 2 st = s2 stable = 1
∪ {uE → {vi → di | 1 ≤ i ≤ n}
∈ dom(σ) and atr(E) = {v1, . . . , vn}.
d))}.
– 13 – 2012-12-12 – Sstmrtc –
35/48
(cons,Snd)
u
E[x/0]/act E[true]/act
E[expr]/x := x/0
– 13 – 2012-12-12 – Sstmrtc –
36/48
C
x, z : Int y : Int env
0, 1
c : C x = 0, z = 0, y = 27 st = s2 stable = 1
– 13 – 2012-12-12 – Sstmrtc –
37/48
(cons,Snd)
u
– 13 – 2012-12-12 – Sstmrtc –
38/48
: C x = 2
– 13 – 2012-12-12 – Sstmrtc –
39/48
– 13 – 2012-12-12 – main –
47/48
– 13 – 2012-12-12 – main –
48/48