280 likes | 450 Views
Process Algebra (2IF45) Extending the Basic Process Algebra: Parallel composition. Dr. Suzana Andova. Extended BPA(A). TCP(A, ) Signature: constants 0,1 action prefix a._ non-deterministic choice _+_ sequential composition _ _
E N D
Process Algebra (2IF45)Extending the Basic Process Algebra:Parallel composition Dr. Suzana Andova
Extended BPA(A) TCP(A, ) Signature: constants 0,1 action prefix a._ non-deterministic choice _+_ sequential composition _ _ parallel composition _ || _ communication composition. _ | _
Parallel composition and communication by intuition (recap) in_plate || = cut_cake water cut_cake water water water cut_cake in_plate in_plate coffee coffee coffee coffee cut_cake in_plate sit_sofa in_cup in_cup in_cup in_cup cut_cake in_plate watchTV sit_sofa on_sofa_together watchTV watchTV_together communication function (sit_sofa, sit_sofa) = on_sofa_together (watchTV, watchTV) = watchTV_together
Term deduction system for parallel composition and communication • Deduction rules a a y y’ x || y x || y’ x x’ x || y x’ || y x y x | y x y x || y a a a b x x’ y y’, (a,b) = c x || y x’ || y’ a b x x’ y y’, (a,b) = c x | y x’ || y’ c c Process Algebra (2IF45)
Parallel composition and communication by the SOS rules in_plate || = cut_cake sit_sofa water cut_cake water water water sit_sofa cut_cake in_plate in_plate coffee coffee coffee ... ... … coffee cut_cake sit_sofa in_plate sit_sofa in_cup in_cup in_cup in_cup cut_cake in_plate sit_sofa watchTV sit_sofa sit_sofa sit_sofa on_sofa_together ... watchTV watchTV_together communication function (sit_sofa, sit_sofa) = on_sofa_together (watchTV, watchTV) = watchTV_together
Parallel composition and communication by the SOS rules in_plate || = cut_cake sit_sofa X water cut_cake water water water sit_sofa cut_cake in_plate X in_plate coffee coffee coffee ... ... … coffee cut_cake sit_sofa in_plate X sit_sofa in_cup in_cup in_cup in_cup cut_cake in_plate sit_sofa X watchTV sit_sofa sit_sofa sit_sofa on_sofa_together X X ... watchTV watchTV_together communication function (sit_sofa, sit_sofa) = on_sofa_together (watchTV, watchTV) = watchTV_together
Encapsulation (action blocking) • TCP(A, ) • Signature: constants 0,1 • action prefix a._ • non-deterministic choice _+_ • sequential composition _ _ • parallel composition _ || _ • communication composition. _ | _ • encapsulation H(_), where H A • Deduction rules a x x’ H(x) H(x’) a x H(x)
Encapsulation (action blocking) • TCP(A, ) • Signature: constants 0,1 • action prefix a._ • non-deterministic choice _+_ • sequential composition _ _ • parallel composition _ || _ • communication composition. _ | _ • encapsulation H(_), where H A • Deduction rules a x x’ , a H H(x) H(x’) a x H(x)
Parallel composition, communication and encalsulation in_plate || = cut_cake water cut_cake water water water cut_cake in_plate in_plate coffee coffee coffee coffee cut_cake in_plate sit_sofa in_cup in_cup in_cup in_cup cut_cake in_plate watchTV sit_sofa on_sofa_together communication function (sit_sofa, sit_sofa) = on_sofa_together (watchTV, watchTV) = watchTV_together watchTV watchTV_together Blocked actions: H = {sit_sofa, watchTV}
Deduction system vs. Equational theory • TCP(A, ) • Signature: constants 0,1 • action prefix a._ • non-deterministic choice _+_ • sequential composition _ _ parallel composition _ || _ communication composition. _ | _ encapsulation H(_), where H A Deduction rules term label term1 term2 ? Equivalence relation Set of Axioms (basic equalities) term1 = term2 Derivation gives more (derived) equalities Axiom ├ term1= term4 consistency Process Algebra (2IF45)
TCP(A) – Axiomatization TCP(A, ) Signature: constants 0,1 action prefix a._ non-deterministic choice _+_ sequential composition _ _ parallel composition _ || _ communication composition. _ | _ encapsulation H(_), where H A if (a,b) = c a.0 | b.1 = ? a.1 | b.1 = ? if (a,d) is not defined a.0 | d.1 = ? 0 | a.1 = ? (b.0 + d.1) | a.0 = ? b.1 | a.0 = ? 1 | 1 = ? a.0 | 1 = ? a.x | b.y = c.(x || y) if (a,b) = c a.x | b.y = 0 if (a,b) not defined 0 | x = 0 (x + y) | z = x | z + y | z x | y = y | x (x | y) | z = x | (y | z) 1 | 1 = 1 a.x | 1 = 0
TCP(A) – Axiomatization (cont.) TCP(A, ) Signature: constants 0,1 action prefix a._ non-deterministic choice _+_ sequential composition _ _ parallel composition _ || _ communication composition. _ | _ encapsulation H(_), where H A leftmerge╙ x || y = x╙ y + y╙ x + x | y x || 1 = x (x || y) || z = x || (y || z) 0╙ x = 0 1╙ x = 0 a.x╙ y = a.(x || y) (x + y) ╙ z = x ╙ z + y ╙ z (x ╙ y) ╙ z = (x | y) ╙ z = x | (y ╙ z) • a.0|| (b.0 + c.1) = ? • a.b.0 || 1 = ? • 0╙ a.1 = ? • 1╙ a.1 = ? • a.b.0╙ c.0 = ? x ╙ (y || z) Process Algebra (2IF45)
TCP(A) – Axiomatization (cont.) TCP(A, ) Signature: constants 0,1 action prefix a._ non-deterministic choice _+_ sequential composition _ _ parallel composition _ || _ communication composition. _ | _ encapsulation H(_), where H A leftmerge╙ • H(a.b.c.0) = ? • H(a.0 + b.c.0) = ? • H(0) = ? • H(1) = ? H(0) = 0 H(1) = 1 H(a. x) = 0 if a H H(a. x) = a.H(x) if aH H(x + y) = H(x) + H(y) Process Algebra (2IF45)
Example: Specifying a Buffer Assume a set of data elements D = {0,1} • One place buffer BufOne = r1(0).s2(0).BufOne + r1(1).s2(1).BufOne 1 BufOne 2 Process Algebra (2IF45)
Example: Buffer 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 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 OnePlaceBuf OnePlaceBuf communication at port 3 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: 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: 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 ) DONE?! Process Algebra (2IF45)
Example: Buffer !Computation/Derivation! 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 = ∂H( BufOne13 || BufOne32 ) = ∂H( BufOne13 ||_ BufOne32 + BufOne32 ||_ BufOne13+ BufOne13 | BufOne32 ) = ∂H(BufOne13 ||_ BufOne32) +∂H(BufOne32 ||_ BufOne13) + ∂H(BufOne13 | BufOne32 ) = r1(0).∂H(s3(0).BufOne13 || BufOne32) + r1(1).∂H(s3(1).BufOne13 || BufOne32) +0 +0= r1(0).∂H(s3(0).BufOne13 ||_ BufOne32 + BufOne32 ||_s3(0).BufOne13 + s3(0).BufOne13 | BufOne32) + r1(1).∂H(s3(1).BufOne13 ||_ BufOne32 + BufOne32 ||_s3(1).BufOne13 + s3(1).BufOne13 || BufOne32 ) = r1(0).c3(0).∂H(BufOne13 || s2(0).BufOne32 + 0) + r1(1).c3(1).∂H(BufOne13 || s2(1).BufOne32 + 0 ) =
Example: Buffer !Computation/Derivation! (cont.) 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 = ∂H( BufOne13 || BufOne32 ) = r1(0).c3(0).∂H(BufOne13 || s2(0).BufOne32 + 0) + r1(1).c3(1).∂H(BufOne13 || s2(1).BufOne32 + 0 ) = r1(0).c3(0).X0 + r1(1).c3(1).X1 X0 = ∂H(BufOne13 || s2(0).BufOne32) = ∂H(BufOne13 ||_ s2(0).BufOne32) + ∂H(s2(0).BufOne32 ||_ BufOne13) = ( r1(0).∂H(s3(0).BufOne13 || s2(0).BufOne32)+r1(1).∂H(s3(1).BufOne13|| s2(0).BufOne32) + s2(0). ∂H(BufOne32 || BufOne13) = ( r1(0).s2(0).∂H(s3(0).BufOne13 || BufOne32) + r1(1).s2(0).∂H(s3(1).BufOne13|| BufOne32) + s2(0). ∂H(BufOne32 || BufOne13)
Example: Buffer !Computation/Derivation! (cont.) 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 = ∂H( BufOne13 || BufOne32 ) = r1(0).c3(0).∂H(BufOne13 || s2(0).BufOne32 + 0) + r1(1).c3(1).∂H(BufOne13 || s2(1).BufOne32 + 0 ) = r1(0).c3(0).X0 + r1(1).c3(1).X1 X0 = ∂H(BufOne13 || s2(0).BufOne32) = ( r1(0).s2(0).c3(0).∂H(.BufOne13 || s2(0).BufOne32) + r1(1).s2(0). c3(1).∂H(.BufOne13|| s2(1).BufOne32) + s2(0). ∂H(BufOne32 || BufOne13) = r1(0).s2(0).c3(0).X0 + r1(1).s2(0). c3(1). X1 + s2(0). BufTwoInOne
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
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 ?
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). + r1(1). • B ……. 1 2
Example: Specifying a Bag with a finite specification? • 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). + r1(1). • …….