Diagnosis with Dynamic MSCs · Diagnosis with Dynamic MSCs (Ongoing work) Benedikt Bollig1, Stefan...
Transcript of Diagnosis with Dynamic MSCs · Diagnosis with Dynamic MSCs (Ongoing work) Benedikt Bollig1, Stefan...
Diagnosiswith Dynamic MSCs
(Ongoing work)
Benedikt Bollig1, Stefan Haar2, Loıc Helouet3
1LSV/CNRS,2LSV/INRIA, 3IRISA/INRIA
Diagnosis with Dynamic MSCs – p. 1/43
Motivations
Observation = code instrumentation,traffic sniffing & filtering, ...
Diagnosis = Fault detection, explanation retreival,...
Diagnosis with Dynamic MSCs – p. 2/43
Diagnosis
From a model H and an observation O, find allexplanations for O in H.
01
a
b c
aa
b
a . b . a . a0 1 2 . 3
ObservationModel
00
01 11
12 12
13
a
b b
aa
a
14
a
c
12
13
a
14
a
c
12
Diagnosis
a
14
a
c
13
a
ac
12
1213
14
Unfolding: synchronize execution of the observation withall compatible runs of the model (may not terminate)
Diagnosis with Dynamic MSCs – p. 3/43
Diagnosis
From a model H and an observation O, find allexplanations for O in H.
01
a
b c
aa
b
a . b . a . a0 1 2 . 3
ObservationModel 00
01 11
12
13
a
bb
aa
a
14
a
c
Diagnosis
c
b
ca
Generator: build a new model in which all behaviorsembed the observation (not always feasible)
Diagnosis with Dynamic MSCs – p. 4/43
MotivationsDone for:
Automata (static, fault detection) [Sampath & al]
Petri nets (static archi, unfolding) [Benveniste & al,
Chatain & al]
High-level MSCs (static archi., generator)[Gazagnaire & al]
Graph grammars (dynamic archi., unfolding)[Baldan & al]
Diagnosis with Dynamic MSCs – p. 5/43
MotivationsDiagnosis for :
Partial order model (can avoid costlyinterleavings)
with dynamic aspects + buffering
Compute a generator
Compositionality issues
Diagnosis with Dynamic MSCs – p. 6/43
Motivations
Diagnosis with Dynamic MSCs – p. 7/43
Outline
Message Sequence Charts, Observations
MSC Grammars
MSO for MSCs
Diagnosis
Conclusions
Diagnosis with Dynamic MSCs – p. 8/43
Message SequenceCharts
M = (E,≤, α, ϕ, µ) ∈M :
α ⊆ E × Σ : labeling,
ϕ ⊆ E × N: locality,
µ ⊆ E × E: messages
x ≤ y iff
sequential ordering on a process, or
causal chain from x to y
Diagnosis with Dynamic MSCs – p. 9/43
MSC Concatenation
m
aa
P1 P2
MSC M1
m
P2 P3n
MSC M2P1 P2
MSC M1 o M2P3
n
x ≤1◦2 y iff
x ≤1 y, or
x ≤2 y, or
x ≤1 z, z′ ≤2 y and z, z′ on the same process
Diagnosis with Dynamic MSCs – p. 10/43
ObservationsChoose an observation alphabetΣobs
Every observed process
reports occurrences of actionsin Σobs
can maintain tags to retreivecausality (eg vectorial clocks)
Observer receives collected eventsand buildsO = (EO,≤O, αO, ϕO, µO)
Diagnosis with Dynamic MSCs – p. 11/43
Explanations
O ⊲ΣObsM
Find an embedding h : EO −→ EM that is compatible:with labeling : α(x) = α(h(x))
with ordering : x ≤O y =⇒ h(x) ≤M h(y)
with locality of events :ϕ(x) = ϕ(y)⇐⇒ ϕ(h(x)) = ϕ(h(y))
.... Diagnosis with Dynamic MSCs – p. 12/43
High-level MSCs(HMSCs)
Client Server Client Server
Question
Answer
Close
MSC M1 MSC M2
M1 M2
n0
n1
Record
patial order model, infinite, non-regular behaviors
Diagnosis with generator works [HelouetWodes06]
But : Finite set of processes only
Diagnosis with Dynamic MSCs – p. 13/43
MSC GrammarsThe important in MSC grammars is the shape ofa scenario, not the identity of processes.
Named MSCs : MRely on process identifiers: π1, . . . , πk.
π1
1π2
2start
spawnstart
m
(M1, ν1) =
Diagnosis with Dynamic MSCs – p. 14/43
MSC Grammars
Named PMSCs : M
2 1 4π2
spawnstart
π′2
spawnstart
m
(M2, µ2) =
Process IDs passed from one process to another
the name of non-identified processes is meaningless
Glue a behavior on identified processesDiagnosis with Dynamic MSCs – p. 15/43
MSC GrammarsConcatenation: (M1, ν1) ◦ (M2, µ2)
π1
1 2π2
start
spawnstart
m
Diagnosis with Dynamic MSCs – p. 16/43
MSC GrammarsConcatenation: (M1, ν1) ◦ (M2, µ2)
π1
1 2 3π2
4
π′1 π′
2
start
spawnstart
m
spawnstart
spawnstart
m
Diagnosis with Dynamic MSCs – p. 17/43
MSC GrammarsIn short : context free grammar with namedMSCs and PMSC as terminals
Subset of Dynamic MSCs [Leucker & al 02]
A kind of graph grammar...
Diagnosis with Dynamic MSCs – p. 18/43
MSC GrammarsDerivations:... as usual but writing PMSCs instead ofwords/hypergraphs
Diagnosis with Dynamic MSCs – p. 19/43
MSC GrammarsDerivations:... as usual but writing MSCs instead ofwords/hypergraphs
Diagnosis with Dynamic MSCs – p. 20/43
MSC GrammarsDerivations:... as usual but writing MSCs instead ofwords/hypergraphs
Diagnosis with Dynamic MSCs – p. 21/43
MSC GrammarsDerivations:... as usual but writing MSCs instead ofwords/hypergraphs
Spawn
m
1 2
a
3
m
Spawn
b
4
bn
Spawn
Diagnosis with Dynamic MSCs – p. 22/43
MSC GrammarsParse Tree
Diagnosis with Dynamic MSCs – p. 23/43
MSC GrammarsLanguage of an MSC grammar G :
L(G) = {M ∈ M | ιG =⇒∗G (M ′, ν)
for some M ′ ∼= M and ν}.All the MSCs that can be derived from the axiomof G.
Nb: L(G) does not differentiate betweenisomorphic MSCs.
Diagnosis with Dynamic MSCs – p. 24/43
Tree automata
TA = (Q,QF ,F , δ)
Q : set of states
QF ⊆ Q : set of final states
F symbols (terminal and non terminal)
δ ⊆ F ×⋃
1..K
Qi ×Q : transition relation
f(q1(x1), . . . qn(xn)) −→ q(f(x1), . . . f(xn))
A run of a TA on a tree T = (N,−→) is a mappingr : N −→ Q. r is successful if r(root) ∈ QF
TAs are recognizers for regular tree languages.Diagnosis with Dynamic MSCs – p. 25/43
Tree automata
G =
Axiom −→ M1.A
A −→ M2.B.M3
B −→ M4.B.M5
B −→ M6
The derivation trees of a context free grammar are regulartree languages. The converse does not alway hold, exceptfor local tree languages.
Diagnosis with Dynamic MSCs – p. 26/43
Tree automata
TAG=
⋃Mi −→ qi
Axiom(q1(x), qA(y)) −→ qAx(Axiom(x, y))
A(q2(x), qB(y), q3(z)) −→ qA(A(x, y, z))
B(q4(x), qB(y), q5(z)) −→ qB(B(x, y, z))
B(q6(x)) −→ qB′ (B(x))
G ←→ TAG(local)
Diagnosis with Dynamic MSCs – p. 27/43
MSO over MSCs [Leucker& al02]
ϕ ::= laba(x) x is an event labelled by a
| (u, x)→ (v, y) (x,y) is a message from u to v
| x⋖ y x is the immediate predecessor
of y on some process
| x ∈ X | u ∈ U
| ¬ϕ | ϕ1 ∧ ϕ2
| ∃x ϕ | ∃X ϕ event/event set quantifier
| ∃u ϕ | ∃U ϕ process/process set quantifier
Diagnosis with Dynamic MSCs – p. 28/43
MSO over MSCsTheorem 1 Let O be an observation over a set of eventse1 . . . , en, and M be a MSC and ΣObs be the observationalphabet. Then O ⊲Σobs
M if and only if M |= ϕO, where ϕO
is the formula
∃x1, . . . xn,∧
x≤Oy
causalChain(x, y)
∧∧
i∈1..n
lab(xi) = λO(ei)
∧∧
i∈1..n
∄z, LocalPredecessor(xi, z) ∧ lab(z) ∈ ΣObs
∧ z 6∈ x1, . . . xn
Diagnosis with Dynamic MSCs – p. 29/43
MSO over MSCs
ϕO ::= ∃x, y, z, t, u, v, w,
laba(x) ∧ labb(y) ∧ labb(z) ∧ lab?n(t)
∧LocalPredecessor(x, t)
∧(u, x) ≤ (v, y) ∧ (u, x) ≤ (w, z)Diagnosis with Dynamic MSCs – p. 30/43
Results
Theorem 2 MSO over MSCs is decidable forMSC grammars
Corollary 1 Diagnosis with MSC grammars isdecidable
Diagnosis with Dynamic MSCs – p. 31/43
Proof sketch [Leucker&al]
Interpreted tree automata that recognise parse trees
guess γ : VϕO−→ EM ∪ PM
infer πi ≤ x, x ≤ π′i, ...
infer πi ≤ π′i
infer atoms of ϕO that hold at M
∃x, y, z, u, laba(x), labb(y), labb(z)
π1 ≤ x, y, z ∧ π2 ≤ y, z ∧ x ≤ π′
1, π′
2∧ z ≤ π′
1
π1 ≤ π′
1∧ π1 ≤ π′
2∧ π2 ≤ π′
1∧ π2 ≤ π′
2
Diagnosis with Dynamic MSCs – p. 32/43
Proof sketch [Leucker&al]
x definedx definedx definedx ≤ π′
1
π1 ≤ π′2
y definedπ2 ≤ y
x ≤ y
Accepting states : qax × ϕ such that ϕ =⇒ ϕO
Diagnosis with Dynamic MSCs – p. 33/43
DiagnosisParse trees are decorated with:
Interpretations over VϕOon leaves (MSCs) (finite)
predicates denoting causal chains in a subtree (finite,involves identifiers or chosen proces in the subtree)
Communication structure (mobility of processesidentifiers)
sub-formulae of ϕO that hold in the subtree
Tree automata transitions depend on consistence oflabelings
Diagnosis with Dynamic MSCs – p. 34/43
Conclusion
G(overM ∪N)
��
G′
TA(overM ∪N, closed)
OO
++WWWWWW
WWWW
WWWW
WWWW
WW
TA′(overM × I × 2ϕO ∪N × I × 2ϕO )
?
OO
O // ϕO
33ggggggggggggggggggggggg
We obtain a generator for all explanations of O
Diagnosis with Dynamic MSCs – p. 35/43
ConclusionWe have:
Dynamic scenario model
MSO/diagnosis decidable for it
Generator comes for free as a consequence ofdecorated parse tree
Compositionnality comes for free as a consequenceof embeddings properties (NB : 6= obs. , samegrammar )
Diagnosis with Dynamic MSCs – p. 36/43
Future WorkNot a surprising result:
MSC Grammars are graph grammars : all resultsapply [Courcelle]
also subset of Dynamic MSCs [Leucker]
Decidability only : MSO usually means exponentialblowup !
Diagnosis with Dynamic MSCs – p. 37/43
Future Work... that gives clues for efficient algorithms
MSC Grammars as Hyperedge replacement +activation rule
Not any MSO formula, not any kind of graph :
use the information on the model to avoid uselesstransitions in the TA
formula ≈ looking a sequence on each process,plus some inter process ordering ?
Diagnosis with Dynamic MSCs – p. 38/43
On compositionality
Spawn
1 2 3
Spawn
4
Spawn
O
M
DiagO1,2
O 2,3
O3,4
T 1,2
T 2,3
T 3,4
Diag
Diag
TX
Diagnosis with Dynamic MSCs – p. 39/43
MSC grammars(Formal defs)
Definition 1 A (dynamic) MSC grammar is a quadrupleG = (Π,N , S,−→) where
Π and N and are nonempty finite sets of processidentifiers and non-terminals, respectively,
S ∈ N is the start non-terminal, and
−→ is a finite set of rules
Diagnosis with Dynamic MSCs – p. 40/43
MSC Grammars(Formal defs)
Definition 2 A rule is a triple r = (A,α, f) with
A ∈ N non-terminal,
α expression over N and Π
f : Free(α)→ Π associates processidentifiers to free processes of α.
We may write A −→f α.
Diagnosis with Dynamic MSCs – p. 41/43
MSO over MSCsCausal chain : folklore [Madhusudan&al05]
causalChain(x, y) ::= ∃X,x ∈ X, y ∈ X,
∀Y ⊂ X,∃x′ ∈ max(X \ Y ),
closed(Y ) =⇒ ∃y′ ∈ min(Y ),
x′ ⋖ y′ ∨ x −→ y
closed(Y ) ::= ∄x,∄y ∈ Y, (x⋖ y ∨ x −→ y) ∧ x 6∈ Y
Diagnosis with Dynamic MSCs – p. 42/43
MSC grammars
MSC Grammars vs Dynamic MSCs [Leucker& al02]
Dyn. MSCs more expressive than MSC grammars
L(G) has to be evaluated recursively (LR in MSCgrammars)
Implementation model for MSC grammars
Questions on MSC grammars
L(G) = ∅?
Realizability
ImplementationDiagnosis with Dynamic MSCs – p. 43/43