190 likes | 369 Views
Process Algebra (2IF45) Extending the Basic Process Algebra. Dr. Suzana Andova. Guarded recursive specification. What do we still miss? Consider three specifications: E = {X = a.Y, Y = a.X} and F = {Z = a.a.Z} G = {U n = a.U n+1 , n 0}. Can we derive
E N D
Process Algebra (2IF45)Extending the Basic Process Algebra Dr. Suzana Andova
Guarded recursive specification What do we still miss? Consider three specifications: E = {X = a.Y, Y = a.X} and F = {Z = a.a.Z} G = {Un = a.Un+1, n 0} Can we derive BPA(A), E, F, G ├ X = Z or BPA(A), E, F, G ├ X = U0 or BPA(A), E, F, G ├ Z = U0 X Z NOT DIRECTLY a a a a Y a.Z a a a … U0 U1 U2 consistency Process Algebra (2IF45)
Deriving equalities of recursive variables Consider three specifications: E = {X = a.Y, Y = a.X} and F = {Z = a.a.Z} G = {Un = a.Un+1, n 0} 1. BPA(A), E, F, G ├ X = a.a.X which is exactly the form of Z 2. BPA(A), E, F, G ├ X = U0 cannot be derived directly. We introduce new variables X0, X1, … which are defined using X, as: X0 = X, X1= a.X, X2 = a.a.X, …, Xn = an X, …., Now, we want to show that Xn can be rewritten in the form of Un for any n 0! BPA(A), E, F, G ├ X0 = X = a.a.X = a.X1 BPA(A), E, F, G ├ X1 = a.X = a.a.a.X = a.X2 and in general BPA(A), E, F, G ├ Xn = an X = an a.a.X = a.Xn+1 We conclude that Xn is in the same form as Un for any n 0 Process Algebra (2IF45)
Recursive principles for Deriving equalities of recursive variables • Every guarded recursive specification has a solution, this is called Restricted Recursive Definition Principle (RDP-) • Every guarded recursive specification has a unique solution, this is called Recursive Specification Principle (RSP) • BPA(A), E, F, G ├ X = a.a.X which is exactly the form of Z. • Directly from the RSP and RDP- we can conclude • BPA(A), E, F, G, RDP-, RSP ├ X = Z • 2. BPA(A), E, F, G ├ X = U0 cannot be derived directly. We introduce new variables X0, X1, … which are defined using X, as: • X0 = X, X1= a.X, X2 = a.a.X, …, Xn = an X, …., • Now, we want to show that Xn can be rewritten in the form of Un for any n 0! • BPA(A), E, F, G ├ X0 = X = a.a.X = a.X1 • BPA(A), E, F, G ├ X1 = a.X = a.a.a.X = a.X2 • and in general • BPA(A), E, F, G ├Xn = an X = ana.a.X = a.Xn+1 • We conclude that Xn is in the same form as Un for any n 0. Directly from the RSP and RDP- we can conclude • BPA(A), E, F, G, RDP-, RSP ├ X0 = U0 • and also BPA(A), E, F, G, RDP-, RSP ├ X = X0 = U0
Specifying a Stack Consider a finite set of data elements D = {d1, d2, …, dn} for some n natural number. Define a recursive specification that describes a stack with unlimited capacity. Elements from D can be added or removed from the stack from the top of the stack. Steps: 1. First, define the set of atomic actions. 2. As a short hand notation you can use universal sum dD 3. Reason how many recursive variables you may need. 4. Specify the behaviour of the stack process.
Specifying a Stack Consider a finite set of data elements D = {d1, d2, …, dn} for some n natural number. Define a recursive specification that describes a stack with unlimited capacity. Elements from D can be added or removed from the stack from the top of the stack. Steps: 1. First, define the set of atomic actions. 2. As a short hand notation you can use universal sum dD 3. Reason how many recursive variables you may need. 4. Specify the behaviour of the stack process. Stack1 = S S = dD push(d).Sd, for any d D Sd = eD push(e).Sed + dD pop(d).S, for any d D and D* infinite
Specifying a Stack again • Consider a finite set of data elements D = {d1, d2, …, dn} for some n natural number. Define a recursive specification that describes a stack with unlimited capacity. Elements from D can be added or removed from the stack from the top of the stack. • Steps: • First, define the set of atomic actions. • The equational theory is extended with operator (general sequential composition) • 3. Can we do it with finitely many equations now? • Stack2 = T • T = dD push(d). ( ( ….) . pop(d).1)
Specifying a Stack again • Consider a finite set of data elements D = {d1, d2, …, dn} for some n natural number. Define a recursive specification that describes a stack with unlimited capacity. Elements from D can be added or removed from the stack from the top of the stack. • Steps: • First, define the set of atomic actions. • The equational theory is extended with operator • 3. Can we do it with finitely many equations now? • Stack2 = T • T = dD push(d). ( ( U ) . pop(d).1) • U = 1 + T U push(d) Stack pop(d) U pop(d) push(e) pop(e) (U pop(e)) (U pop(d))
Extending BPA(A) with sequential composition • BPA(A) • Signature: constants 0,1 • action prefix a._ (unary operator) • non-deterministic choice _+_ (bin. op.) • sequential composition __ (bin.op.) • (A1) x+ y = y+x • (A2) (x+y) + z = x+ (y + z) • (A3) x + x = x • (A4) x+ 0 = x Question: Can you find a set of axioms for the new operator? Process Algebra (2IF45)
Extending BPA(A) with sequential composition BPA(A) Signature: constants 0,1 action prefix a._ (unary operator) non-deterministic choice _+_ (bin. op.) sequential composition __ (bin.op.) • (A1) x+ y = y+x • (A2) (x+y) + z = x+ (y + z) • (A3) x + x = x • (A4) x+ 0 = x • (A5) (x+ y) z = x z+y z • (A6) (x y) z = x (y z) • (A7) 0 x = 0 • (A8) x 1 = x • (A9) 1 x = x • (A10) a.x y = a.(x y) Process Algebra (2IF45)
Term deduction system for BPA(A) with sequential composition • Set of action names (actions): A • Signature: constants 0,1 (note 0,1 A) action prefix a._ (unary operator) non-deterministic choice _+_ (binary operator) sequential composition __ (binary operator) • Behaviour expressed by action transitions _ _ for a in A and termination _ • Behavioural equivalence is bisimilarity a • Deduction rules a x x’ x + y x’ a y y’ x + y y’ a a.x x a a x (x + y) y (x + y) 1 ⑥ Process Algebra (2IF45)
Term deduction system for BPA(A) with sequential composition • Set of action names (actions): A • Signature: constants 0,1 (note 0,1 A) • action prefix a._ (unary operator) • non-deterministic choice _+_ (binary operator) • sequential composition __ (binary operator) • Behaviour expressed by action transitions _ _ for a in A and • termination _ • Behavioural equivalence is bisimilarity a • Deduction rules a x x’ x + y x’ a y y’ x + y y’ a a.x x a a • Deduction rules for sequential com. x (x + y) y (x + y) 1 a x x’ x y x’ a x y y’ x y y’ ⑥ a a Process Algebra (2IF45) x y (x y)
Extending BPA(A) further BPA(A) Signature: constants 0,1 action prefix a._ non-deterministic choice _+_ sequential composition _ _ || cut_cake water in_plate coffee in_cup What are possible scenarios? Process Algebra (2IF45)
Extending BPA(A) further and further || water cut_cake in_plate coffee sit_sofa in_cup watchTV sit_sofa watchTV What are possible scenarios now? Process Algebra (2IF45)
Term deduction system for BPA(A) extended to TCP(A) • Set of action names (actions): A • Signature: constants 0,1 (note 0,1 A) action prefix a._ non-deterministic choice _+_ sequential composition _ _ • Behaviour expressed by action transitions _ _ for a in A and termination _ • Behavioural equivalence is bisimilarity • Deduction rules for sequential com. a x x’ x y x’ a x y y’ x y y’ a a x y (x y) • Deduction rules a x x’ x + y x’ a y y’ x + y y’ a a.x x a a x (x + y) y (x + y) 1 ⑥ Process Algebra (2IF45)
Term deduction system for BPA(A) extended to TCP(A) • Set of action names (actions): A • Signature: constants 0,1 (note 0,1 A) action prefix a._ nondeterminism _+_ sequential compos. __ • Behaviour expressed by action transitions _ _ for a in A and termination _ • Behavioural equivalence is bisimilarity communication function (_,_) parallel composition _ || _ communication composition. _ | _ • 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)
Extending BPA(A) to TCP(A) • communication function (_,_) • parallel composition_ || _ • communication compos. _ | _ • left merge operator _ ╙_ • unary operator ∂H BPA(A) Signature: constants 0,1 action prefix a._ non-determ. _+_ sequential comp. __ • 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 • 1 | 1 = 1 • a.x | 1 = 0 • x | y = y | x • (x | y) | z = x | (y | z) • 1 | x + 1 = 1 • (x | y) ╙ z = x | (y ╙ z) • 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) Process Algebra (2IF45)
Example Specify the communication process: B 2 1 A 3 4 C Process Algebra (2IF45)
Example • Draw the transition system generated by the operational rules for the process X || Y given by the recursive specification • X = a.X • Y = b.Y • There is no communication, so = . • 2. Draw the transition system generated by the operational rules for the process X || Y given by the recursive specification • X = a.Y + b.Y; • Y = a.X + b.X. • There is no communication, so = . • 3. Also draw the transition system generated by the operational rules for the process Z = (a.1 || b.1) Z • 4. Are the transition systems found in the previous two items (2 and 3) bisimilar? If yes, show a bisimulation. If no, argue why not. Process Algebra (2IF45)