230 likes | 393 Views
Process Algebra (2IF45) Extending Process Algebra: Parallel composition More examples. Dr. Suzana Andova. TCP language. TCP(A, ) A is a pre-defied set of atomic actions is a pre-defined communication function Signature: (constructs of the language) constants 0,1
E N D
Process Algebra (2IF45)Extending Process Algebra:Parallel composition More examples Dr. Suzana Andova
TCP language • TCP(A, ) • A is a pre-defied set of atomic actions • is a pre-defined communication function • Signature: (constructs of the language) • constants 0,1 • action prefix a._ • non-deterministic choice _+_ • sequential composition _ _ • Process behaviour specification described by process equations, • recursive specifications • guarded recursive process variables and guarded process specifications • uniqueness of the process defined by a guarded Rspec • Additional mechanism for “equating” recursive specifications: RDP and RSP, where “equating” = they define the same (up to bisimulation) process parallel composition _ || _ communication composition. _ | _ encapsulation H(_), where H A
System specification manipulation (recap) reduction on specification components’ specifications reduction on specification the whole system specification composition by axiom • simpler • smaller • in a particular form (basic) • … reduction on LTSs the state space SOS rules Process Algebra (2IF45)
Example: Specifying a Bag • Assume a set of data elements D = {0,1} • Bn,m is the process that specify the current content of B • n is the number of 0s • m is the number of 1s • B0,0 = r1(0). B1,0 + r1(1). B0,1 • B0, m+1 = r1(0). B1,m+1 + r1(1). B0,m+2 + s2(1). B0,m • Bn+1,0 = r1(0). Bn+2,0 + r1(1). Bn+1,1 + s2(0). Bm,0 • Bn+1, m+1 = r1(0). Bn+2,m+1 + r1(1). Bn+1,m+2 • + s2(0). Bn,m+1 + s2(1).Bn+1, m 2 1
Example: Specifying a Bag • Assume a set of data elements D = {0,1} • Bn,m is the process that specify the current content of B • n is the number of 0s • m is the number of 1s • B0,0 = r1(0). B1,0 + r1(1). B0,1 • B0, m+1 = r1(0). B1,m+1 + r1(1). B0,m+2 + s2(1). B0,m • Bn+1,0 = r1(0). Bn+2,0 + r1(1). Bn+1,1 + s2(0). Bn,0 • Bn+1, m+1 = r1(0). Bn+2,m+1 + r1(1). Bn+1,m+2 • + s2(0). Bn,m+1 + s2(1).Bn+1, m • This is an infinite recursive specification! • Can we do better? 2 1
Example: Specifying a Bag • Assume a set of data elements D = {0,1} • Bn,m is the process that specify the current content of B • n is the number of 0s • m is the number of 1s • Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1)) Do they define the same process, namely a bag process? TCP, RSP, RDP |- Bag = B0,0?
Example: Specifying a Bag Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1)) B0,0 = r1(0). B1,0 + r1(1). B0,1 B0, m+1 = r1(0). B1,m+1 + r1(1). B0,m+2 + s2(1). B0,m Bn+1,0 = r1(0). Bn+2,0 + r1(1). Bn+1,1 + s2(0). Bn,0 Bn+1, m+1 = r1(0). Bn+2,m+1 + r1(1). Bn+1,m+2 + s2(0). Bn,m+1 + s2(1).Bn+1, m 1. Define new equations Dn,m using Bag such that Bag is exactly D0,0 2. and prove that TCP, RSP, RDP |- D0,0 = B0,0!
Example: Specifying a Bag Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1)) B0,0 = r1(0). B1,0 + r1(1). B0,1 B0, m+1 = r1(0). B1,m+1 + r1(1). B0,m+2 + s2(1). B0,m Bn+1,0 = r1(0). Bn+2,0 + r1(1). Bn+1,1 + s2(0). Bn,0 Bn+1, m+1 = r1(0). Bn+2,m+1 + r1(1). Bn+1,m+2 + s2(0). Bn,m+1 + s2(1).Bn+1, m n (n0) • Define new equations Dn,m using Bag • Dn,m = Bag || (s2(0).s2(0)…. s2(0).1 ) • || (s2(1).s2(1).… s2(1).1 ) • such that Bag is exactly D0,0 • 2. and prove that TCP, RSP, RDP |- D0,0 = B0,0? m (m0)
Example: Specifying a Bag Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1)) Observe that D0,0 = Bag Dn,m = Bag || s2(0) n1 || s2(1) m1 for n,m 0 • Our goal is to show that Dn,m = Bn,m, for any n and any m • Namelly to show that • D0,0 = B0,0 • D0,m+1 = B, 0, m+1 (only this case on the next slides) • Dn+1, 0 = Bn+1,0 • Dn+1,m+1 = Bn+1,m+1 ?
Example: Specifying a Bag Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1)) Observe that D0,0 = Bag Dn,m = Bag || s2(0) n1 || s2(1) m1 for n,m 0 II. D0,m+1 = Bag || (s2(1) m+11) = Bag ||_ s2(1) m+11 + s2(1) m+11 ||_ Bag = (r1(0). (Bag || s2(0) ) + r1(1). (Bag || s2(1))) ||_ (s2(1) m+11) + (s2(1) m+11) ||_ Bag = (r1(0). (Bag || s2(0))) ||_ (s2(1) m+11)+ (r1(1). (Bag || s2(1))) ||_ (s2(1) m+11) + (s2(1) m+11) ||_ Bag = no communication
Example: Specifying a Bag Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1)) Observe that D0,0 = Bag Dn,m = Bag || s2(0) n1 || s2(1) m1 for n,m 0 II. D0,m+1 = Bag || s2(1) m+11 = Bag ||_ s2(1) m+11 + s2(1) m+11 ||_ Bag = (r1(0). (Bag || s2(0) ) + r1(1). (Bag || s2(1))) ||_ (s2(1) m+11) + (s2(1) m+11) ||_ Bag = (r1(0). (Bag || s2(0)))||_ s2(1) m+11+ (r1(1). (Bag || s2(1)))||_ s2(1) m+11 + s2(1) m+11 ||_ Bag = r1(0). ((Bag || s2(0))|| s2(1) m+11)+ r1(1). ((Bag || s2(1)) || s2(1) m+11) + s2(1). (s2(1)m1|| Bag) s2(1) m+11 ||_Bag = s2(1).s2(1) m1 ||_Bag =s2(1). (s2(1)m1|| Bag)
Example: Specifying a Bag Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1)) Observe that D0,0 = Bag Dn,m = Bag || s2(0) n1 || s2(1) m+11 for n,m 0 II. D0,m+1 = Bag || s2(1) m+11 = Bag ||_ s2(1) m+11 + s2(1) m+11 ||_ Bag = (r1(0). (Bag || s2(0) ) + r1(1). (Bag || s2(1))) ||_ (s2(1) m+11) + (s2(1) m+11) ||_ Bag = (r1(0). (Bag || s2(0)))||_ s2(1) m+11+ (r1(1). (Bag || s2(1)))||_ s2(1) m+11 + s2(1) m+11 ||_ Bag = r1(0). ((Bag || s2(0))|| s2(1) m+11)+ r1(1). ((Bag || s2(1)) || s2(1) m+11) + s2(1). (s2(1)m1|| Bag) = r1(0). (D1,m+1)+ r1(1). (D0,m+2) + s2(1). (D0,m) s2(1).1 || s2(1) m+11 = s2(1) m+11
Example: Specifying a Bag - Conclusion Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1)) Observe that D0,0 = Bag Dn,m = Bag || s2(0) n1 || s2(1) m+11 From RDP and RSP it follows that I. D0,0 = B0,0 II. D0,m+1 = B0,m+1 III. Dn+1,0= Bn+1,0 IV. Dn+1,m+1 = Bn+1,m+1 Final conclusion: B0,0 = Bag
Example: Buffer - Revision Assume a set of data elements D = {0,1} II. Two place buffer BufTwo = r1(0).B0 + r1(1).B1 B0 = s2(0).BufTwo + r1(0).s2(0).B0 + r1(1).s2(0).B1 B1 = s2(1).BufTwo + r1(0).s2(1).B0 + r1(1).s2(1).B1 1 2 BufTwo Process Algebra (2IF45)
Example: Buffer Assume a set of data elements D = {0,1} III. Implementing a Two place buffer with Two One place buffers 1 3 2 BufOne13 = r1(0).s3(0).BufOne13 + r1(1).s3(1).BufOne13 BufOne32 = r3(0).s2(0).BufOne32 + r3(1).s2(1).BufOne32 communication: (r3(x), s3(x)) = c3(x), for x D blocking: H = {r3(x), s3(x) | x D} BufTwoInOne = ∂H( BufOne13 || BufOne32 ) Process Algebra (2IF45)
Example: BufTwoInOne Recursive Specification III. Implementing a Two place buffer with Two One place buffers BufOne13 = r1(0).s3(0).BufOne13 + r1(1).s3(1).BufOne13 BufOne32 = r3(0).s2(0).BufOne32 + r3(1).s2(1).BufOne32 • communication: (r3(x), s3(x)) = c3(x), for x D • blocking: H = {r3(x), s3(x) | x D} BufTwoInOne = r1(0).c3(0).X0 + r1(1).c3(1).X1 X0 = r1(0).s2(0).c3(0).X0 + r1(1).s2(0). c3(1). X1 + s2(0). BufTwoInOne X1 = r1(0).s2(1).c3(0).X0 + r1(1).s2(1).c3(1). X1 + s2(1). BufTwoInOne II. Back to our original specification: Two place buffer BufTwo = r1(0).B0 + r1(1).B1 B0 = s2(0).BufTwo + r1(0).s2(0).B0 + r1(1).s2(0).B1 B1 = s2(0).BufTwo + r1(0).s2(0).B0 + r1(1).s2(0).B1 NOT YET!
Process Algebra (2IF45)Extending Process Algebra:Abstraction Dr. Suzana Andova
System specification manipulation (recap) reduction on specification components’ specifications reduction on specification the whole system specification composition by axiom • simpler • smaller • in a particular form (basic) • … reduction on LTSs the state space SOS rules Process Algebra (2IF45)
TCP language extended with hiding feature • TCP(A, ) • A is a pre-defied set of atomic actions • internal (silent) action , A • is a pre-defined communication function • Signature: (constructs of the language) • constants 0,1 • action prefix a._ • non-deterministic choice _+_ • sequential composition _ _ • hiding operator I for I A • Process behaviour specification described by process equations, • guarded recursive process variables and guarded process specifications • equivalence relation that treats differently parallel composition _ || _ communication composition. _ | _ encapsulation H(_), where H A
Towards equivalence relation(s) Think about different ways to reduce these processes? hiding reducing ? in50c in1euro in50c !coffee !coffee !coffee !coffee hiding reducing ? 50c 40c !coffee !coffee !tea !tea Which reduced process preserves “the same moment of choice” as in the original process with s? Process Algebra (2IF45)
Towards equivalence relation(s) reducing hiding ? insert insert 40c coffee coffee reducing hiding ? insert insert coin card coffee coffee Process Algebra (2IF45)
Towards our equivalence relation -Conclusions • Some internal steps cannot be removed. • Some internal steps can be removed. They are called inert! • Inert internal steps occur in following situations: … … reduces to a a Q P P + + Q P +
Towards our equivalence relation -Conclusions • Some internal steps cannot be removed. • Some internal steps can be removed. They are called inert! • Inert internal steps occur in following situations: • Relation to be established is: … … reduces to a a Q P P + + Q P +