Factorization for Component-Interaction Automata Nikola Beneˇs
ˇ a Ivana Cern´
ˇ Filip Stefaˇ n´ak
ParaDiSe Laboratory Faculty of Informatics Masaryk University Czech Republic
SOFSEM January 24th, 2012
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
1 / 15
Motivation
Component-Based Software Development autonomous (third-party) components hierarchical composition correctness issues Component-Interaction Automata automata-based formalism various kinds of component assembly captures interaction properties
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
2 / 15
Motivation
Factorization Problem dual to composition filling a “gap” in a system
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
3 / 15
Motivation
Factorization Problem dual to composition filling a “gap” in a system Formally: let k be a composition operation let ' be a conformity relation (equivalence, refinement, . . . ) given S, M, find X such that X k M ' S
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
3 / 15
Motivation
Factorization Problem
S
dual to composition filling a “gap” in a system
X
M
Formally: let k be a composition operation let ' be a conformity relation (equivalence, refinement, . . . ) given S, M, find X such that X k M ' S
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
3 / 15
Preliminaries Component-Interaction Automata labelled transition systems equipped with ports and actions
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
4 / 15
Preliminaries Component-Interaction Automata labelled transition systems equipped with ports and actions labels are triples (from, action, to) input: (−, a, 1) output: (1, a, −) internal: (1, a, 1), (1, a, 2)
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
4 / 15
Preliminaries Component-Interaction Automata labelled transition systems equipped with ports and actions labels are triples (from, action, to) input: (−, a, 1) output: (1, a, −) internal: (1, a, 1), (1, a, 2)
Composition ⊗F two CI automata with disjoint ports complementary labels may be combined (1, a, −) + (−, a, 2) → (1, a, 2) composition parameter F – which labels ought to be combined and/or left open Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
4 / 15
Example
(−, req, 1)
A
(1, resp, −)
(2, req, −)
B
(−, resp, 2)
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
5 / 15
Example
(−, req, 1)
A
(1, resp, −)
A ⊗F B (2, req, −)
B
(1, resp, 2)
(2, req, 1)
(−, resp, 2)
F = {(2, req, 1), (1, resp, 2)}
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
5 / 15
Example
(−, req, 1)
A
(1, resp, −)
(−, req, 1)
(1, resp, −)
A ⊗F B (2, req, −)
B
(1, resp, 2)
(2, req, 1)
(−, resp, 2)
F = {(2, req, 1), (1, resp, 2), (−, req, 1), (1, resp, −)}
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
5 / 15
Preliminaries Weak Bisimulation ≈ observational equivalence ignore (in certain sense) internal transitions ≈ p
q (1, b, 1) q1
(1, a, −) qn ≈ p0 Nikola Beneˇs et al.
(1, a, −) q0
Factorization for Component-Interaction Automata
SOFSEM 2012
6 / 15
Our Problem Factorization Problem for Component-Interaction Automata Given two CI automata S, M, find a parameter F and a CI automaton X such that X ⊗F M ≈ S. M
S
(3, y , −)
nc , (− , sy
(2, x, −)
2)
Nikola Beneˇs et al.
c, syn
(3, y , −)
(2, x, −)
, (−
3)
(−, init, 1)
Factorization for Component-Interaction Automata
SOFSEM 2012
7 / 15
Our Solution The “Battle Plan”: Reduction to Similar Problem Qin, H., Lewis, P.: Factorization of finite state machines under observational equivalence. In: CONCUR 90. LNCS, vol. 458. finite automata with τ actions handshake composition a with ¯a weak bisimulation
constraints on S deterministic without τ
the method transform S, M into FSMs solve the FSM factorization transform the result back into a CI automaton
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
8 / 15
Our Solution Transformations f , gF : CI → FSM the goal: A ⊗F B ≈ C if and only if gF (A) k gF (B) ≈ f (C) gF should be invertible Transformation f retain the structure actions of the FSM are labels of the original CI automaton Transformation gF parametrized with a set of labels F external labels allowed by F retained external labels that can be combined are changed and possibly multiplied Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
9 / 15
Our Solution
Transformation gF – Example let F = {(1, a, −), (1, a, 2), (3, b, 1), (4, b, 1)}
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
10 / 15
Our Solution
Transformation gF – Example let F = {(1, a, −), (1, a, 2), (3, b, 1), (4, b, 1)} (1, a, −)
(1, a, −)
(1, a, 2)
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
10 / 15
Our Solution
Transformation gF – Example let F = {(1, a, −), (1, a, 2), (3, b, 1), (4, b, 1)} (−, b, 1)
(3, b, 1)
(4, b, 1)
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
10 / 15
Our Solution Ensuring Invertibility of gF F has to be label injective (r , a, x), (r , a, y ) ∈ F =⇒ x = y where r is a port of X Ensuring Completeness of The Reduction F has to be complete wrt M for every (m, a, −) of M there has to some (m, a, z) ∈ F Finding the Right F mirror the ports of M: r → r 0 set F contains all labels of S plus (r , a, r 0 ) for every (r , a, −) of M
Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
11 / 15
Our Solution The Algorithm input: CI automata M and S such that S is deterministic and Reach(S) contains no internal labels. 1. Let F = Reach(S) ∪ {(r , a, r 0 ) | (r , a, −) ∈ Reach(M)} ∪ {(s 0 , a, s) | (−, a, s) ∈ Reach(M)} 2. Transform M into gF (M) and S into f (S). 3. Solve the factorization problem for FSM gF (M) and f (S) using the algorithm of Qin and Lewis. (If no solution exists, claim that no solution for the original problem exists.) 4. Produce a CI automaton X such that gF (X ) is the solution obtained in previous step. 5. Output F, X as the solution of the original problem. Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
12 / 15
Example Solution M
S
syn c,
(2, x, −)
2)
(− ,
c,
syn
(3, y , −)
, (−
3)
(−, init, 1)
(2, x, −)
(3, y , −)
{(2, x, −), (3, y , −), (2, x, 20 ), (3, y , 30 ), (10 , init, 1), (20 , sync, 2), (30 , sync, 3)} Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
13 / 15
Example Solution X
3)
(10 , init, −)
2)
(− ,
c,
syn
syn c,
) (20 , sync, −)
, (−
(3, y , −)
0
(−, init, 1)
,2
(1 0 , in
it ,
,x (−
−)
M
(2, x, −) (10 , init, −)
y, 0
3)
(1 0 , in it ,
(2, x, −)
, (−
S
−)
(30 , sync, −)
(3, y , −)
{(2, x, −), (3, y , −), (2, x, 20 ), (3, y , 30 ), (10 , init, 1), (20 , sync, 2), (30 , sync, 3)} Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
13 / 15
Example Solution
0
,2
)
(1 0 , in it ,
,x (2
1)
X ⊗F M
(20 , sync, 2) (10 , init, 1)
(2, x, −)
(10 , init, 1)
(3, y , −)
it ,
y, 0
3)
Nikola Beneˇs et al.
(1 0 , in
(3,
1)
(30 , sync, 3)
Factorization for Component-Interaction Automata
SOFSEM 2012
14 / 15
Example Solution
0
,2
)
(1 0 , in it ,
,x (2
1)
X ⊗F M
(20 , sync, 2) (10 , init, 1)
(2, x, −)
(10 , init, 1)
(3, y , −)
it ,
y, 0
3)
Nikola Beneˇs et al.
(1 0 , in
(3,
1)
(30 , sync, 3)
Factorization for Component-Interaction Automata
SOFSEM 2012
14 / 15
Example Solution
0
,2
)
(1 0 , in it ,
,x (2
1)
X ⊗F M
S
(20 , sync, 2) (10 , init, 1)
(2, x, −) (3, y , −)
(2, x, −)
(10 , init, 1)
(3, y , −)
it ,
y, 0
3)
Nikola Beneˇs et al.
(1 0 , in
(3,
1)
(30 , sync, 3)
Factorization for Component-Interaction Automata
SOFSEM 2012
14 / 15
Conclusion Component-Interaction Automata modelling component-based systems flexible (parametrized) composition Factorization Problem dual to composition given S and M, find F and X such that X ⊗F M ≈ S Our Solution reduction to FSMs, solved by Qin and Lewis (CONCUR 1990) requires deterministic S with no internal transitions Future Work port minimization general description of all solutions (modal transition system?) Nikola Beneˇs et al.
Factorization for Component-Interaction Automata
SOFSEM 2012
15 / 15