400 likes | 659 Views
Process Algebra Book: Chapter 8. Q: When are two models equivalent? A: When they satisfy different properties. Q: Does this mean that the models have different executions?. The Main Issue. What is process algebra?. An abstract description for nondeterministic and concurrent systems.
E N D
Q: When are two models equivalent? A: When they satisfy different properties. Q: Does this mean that the models have different executions? The Main Issue
What is process algebra? • An abstract description for nondeterministic and concurrent systems. • Focuses on the transitions observed rather than on the states reached. • Main correctness criterion: conformance between two models. • Uses: system refinement, model checking, testing.
Different models may have the same set of executions! d a a e e a d b c b c a-insert coin, b-press pepsi, c-press pepsi-light d-obtain pepsi, e-obtain pepsi-light
Actions: Act={a,b,c,d}{}.Agents: E, E’, F, F1, F2, G1, G2, … F E d a a e e a d F1 F2 E’ b c b c G1 G2 Agent E may evolve into agent E’. Agent F may evolve into F1 or F2.
F E a a a F1 F2 E’ b c b c G1 G2 E—aE’, F—aF1, F—aF2, F1—aG1, F2—aG2. G1—F, G1—F. Events.
F E a a a F1 F2 E’ b c b c G1 G2 Actions and co-actions For each action a, except for , there is a co-action a. a and a interact (a input, a output).The coaction of a is a.
Notation E a.(b+c)(actually, a.((b.0)+(c.0)) E—aFF—bGF—cH 0 – deadlock/termination. a F b c G H a.E – execute a, then continue according to E.E+F – execute according to E or to F.E||F – execute E and F in parallel.
Conventions • “.” has higher priority than “+”. • “.0” or “.(0||0||…||0)” is omitted.
CCS - calculus of concurrent systems [Milner]. Syntax • a,b,c, … actions, A, B, C - agents. • a,b,c, coactions of a,b,c. t-silent action. • nil - terminate. • a.E - execute a, then behave like E. • + - nondeterministic choice. • || - parallel composition. • \L - restriction: cannot use letters of L. • [f] - apply mapping function f between between letters.
Semantics (proof rule and axioms).Structural Operational Semantics SOS • a.p –a p • p—ap’ |-- p+q –a p’ • q—aq’ |-- p+q –a q’ • p—ap’ |-- p|q –a p’|q • q—aq’ |-- p|q –a p|q’ • p—ap’, q—aq’ |-- p|q –t p’|q’ • p—ap’ , a R |-- p\L –a p’\R • p—ap’ |-- p[m]—m(a)p’[m]
Action Prefixing a.E—aE (Axiom) Thus, a.(b.(c||c)+d)—a(b.(c||c)+d).
Choice E—aE’F—aF’ (E+F)—aE’ (E+F)—aF’ b.(c||c)—b(c||c). Thus,(b.(c||c)+e)—b(c||c). If E—aE’ and F—aF’, then E+F has a nondeterministic choice.
Concurrent Composition E—aE’ F—aF’ E||F—aE’||F E||F—aE||F’ E—aE’, F—aF’ ———————— E||F—E’||F’ c—c0, c—c0, c||c—0||0, c||c—c0||c, c||c—cc||0.
Restriction E—aE’, a, aR ————————— E\R –aE’\R In this case: allows only internal interaction of c. c||c—0||0 c||c—c0||c c||c—cc||0 (c||c) \ {c}—(0||0) \{c}
Relabeling E—aE’ ———— E[m] –m(a)E’[m] No axioms/rules for agent 0.
Examples a.E||b.F a b E||b.F a.E||F a b E||F
Derivations a.(b.(c||c)+d) a b.(c||c)+d b d (c||c) 0 c c (0||c) (c||0) c c (0||0)
Modeling binary variable C0=is_0? . C0 + set_1 . C1 + set_0 . C0 C1=is_1? . C1 + set_0 . C0 + set_1 . C1 set_1 C0 C1 set_0 is_0? set_1 is_1? set_0
F E a a a F1 F2 E’ b c b c G1 G2 Equational Definition E=a.(b..E+c..E) E—aE’, A=E F=a.b..F+a.c..F A—aE’
Trace equivalence:Systems have same finite sequences. E F a a a c c b b b E=a.(b+c) F=(a.b)+a.(b+c) Same traces
Failures: comparing also what wecannot do after a finite sequence. E F a a a c b c b b Failure of agent E: (σ, X), where after executing σ from E, none of the events in X is enabled.Agent F has failure (a, {c}), which is not a failure of E.
Simulation equivalence F • Relation over set of agents S. RSS. • E R F • If E’ R F’ and E’—aE’’, then there exists F’’, F’—aF’’, and E’’ R F’’. E a a a b b b b c d c d
Simulation equivalence F • Relation over set of agents S. RSS. • E R F • If E’ R F’ and E’—aE’’, then there exists F’’, F’—aF’’, and E’’ R F’’. E a a a b b b b c d c d
Here, simulation works only in one direction. No equivalence! want to establish F • Relation over set of agents S. RSS. • E R F • If E’ R F’ and E’—aE’’, then there exists F’’, F’—aF’’, and E’’ R F’’. E a a a symmetrically b b b b necessarily c d c d problem!!!
Simulation equivalentbut not failure equivalent Left agent a.b+a has a failure (a,{b}). F E a a a b b
Bisimulation: same relation simulates in both directions Not in this case: different simulation relations. F E a a a b b
Hierarchy of equivalences Bisimulation Simulation Failure Trace
Example: b a s1 s2 c s0 b d s3 t1 t2 a t0 a t4 c A=a.((b.nil)+(c.d.A)) B=(a.(b.nil))+(a.c.d.B) d t3
Bisimulation between G1 and G2 • Let N= N1 U N2 • A relation R : N1 x N2 is a bisumulation ifIf (m,n) in R then1. If m—am’ then $n’:n—an’ and (m’,n’) in R2. If n—an’ then $m’:m—am’ and (m’,n’) in R. • Other simulation relations are possible, I.e., m=a=> m’ when m—t…—a... —tm’.
Algorithm for bisimulation: • Partition N into blocks B1B2…Bn=N. • Initially: one block, containing all of N. • Repeat until no change: Choose a block Bi and a letter a. If some of the transitions of Bi move to some block Bj and some not, partition Bi accordingly. • At the end: Structures bisimilar if initial states of two structures are in same blocks.
Correctness of algorithm • Invariant: if (m,n) in R then m and n remain in the same block throughout the algorithm. • Termination: can split only a finite number of times.
b a s1 s2 c s0 d s3 Example: b t1 t2 a t0 a t4 c d t3 {s0,s1,s2,s3,t0,t1,t2,t3,t4}
Example: b a s1 s2 c s0 b d s3 t1 t2 a t0 a t4 c d t3 {s0,s1,s2,s3,t0,t1,t2,t3,t4} split on a. {s0,t0},{s1,s2,s3,t1,t2,t3,t4}
b a s1 s2 c s0 b d s3 t1 t2 a t0 a t4 c d t3 Example: {s0,t0},{s1,s2,s3,t1,t2,t3,t4} split on b {s0,t0},{s1,t1},{s0,s2,s3,t2,t3,t4}
b a s1 s2 c s0 b d s3 t1 t2 a t0 a t4 c d t3 Example: {s0,t0},{s1,t1},{s2,s3,t2,t3,t4} split on c {s0,t0},{s1},{t1},{s2,s3,t2,t3,t4}
b a s1 s2 c s0 b d s3 t1 t2 a t0 a t4 c d t3 Example: {s0,t0},{s1},{t1},{s2,s3,t2,t3,t4} split on c {s0,t0},{s1},{t1},{t4},{s2,s3,t2,t3}
b a s1 s2 c s0 b d s3 t1 t2 a t0 a t4 c d t3 Example: {s0,t0},{s1},{t1},{t4},{s2,s3,t2,t3} split on d {s0,t0},{s1},{t1},{t4},{s3, t3},{s2,t2}
b a s1 s2 c s0 b d s3 t1 t2 a t0 a t4 c d t3 Example: {s0,t0},{s1},{t1},{t4},{s2,t2},{s3,t3} split on a {s0},{t0},{s1},{t1},{t4},{s3, t3},{s2,t2}
Example: b a s1 s2 c s0 b d s3 t1 t2 a t0 a t4 c d t3 {s0},{t0},{s1},{t1},{t4},{s2,s3,t2,t3} split on d {s0},{t0},{s1},{t1},{t4},{s3},{t3},{s2,t2}