Process Algebra (2IF45) Extending Process Algebra: Parallel composition More examples

Post on 18-Mar-2016

50 views 0 download

description

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 - PowerPoint PPT Presentation

Transcript of Process Algebra (2IF45) Extending Process Algebra: Parallel composition More examples

Process Algebra (2IF45)

Extending Process Algebra:Parallel composition More examples

Dr. Suzana Andova

2

TCP language TCP(A, ) A is a pre-defied set of atomic actions is a pre-defined communication functionSignature: (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

3 Process Algebra (2IF45)

components’ specifications

System specification manipulation (recap)

the whole system specification

the state space

reductionon specification

reductionon specification

reductionon LTSs

composition by axiom

SOS rules

• simpler• smaller• in a particular form (basic)• …

4

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,1B0, m+1 = r1(0). B1,m+1 + r1(1). B0,m+2 + s2(1). B0,mBn+1,0 = r1(0). Bn+2,0 + r1(1). Bn+1,1 + s2(0). Bm,0Bn+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 2

5

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,1B0, m+1 = r1(0). B1,m+1 + r1(1). B0,m+2 + s2(1). B0,mBn+1,0 = r1(0). Bn+2,0 + r1(1). Bn+1,1 + s2(0). Bn,0Bn+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?

1 2

6

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?

7

Example: Specifying a Bag

Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1))

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!

B0,0 = r1(0). B1,0 + r1(1). B0,1B0, m+1 = r1(0). B1,m+1 + r1(1). B0,m+2 + s2(1). B0,mBn+1,0 = r1(0). Bn+2,0 + r1(1). Bn+1,1 + s2(0). Bn,0Bn+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

8

Example: Specifying a Bag

Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1))

1. Define new equations Dn,m using BagDn,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?

B0,0 = r1(0). B1,0 + r1(1). B0,1B0, m+1 = r1(0). B1,m+1 + r1(1). B0,m+2 + s2(1). B0,mBn+1,0 = r1(0). Bn+2,0 + r1(1). Bn+1,1 + s2(0). Bn,0Bn+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)

m (m0)

9

Example: Specifying a Bag

Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1))

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 I. D0,0 = B0,0 II. D0,m+1 = B, 0, m+1 (only this case on the next slides)III. Dn+1, 0 = Bn+1,0IV. Dn+1,m+1 = Bn+1,m+1

Observe thatD0,0 = Bag

?

10

Example: Specifying a Bag

Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1))

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

Observe thatD0,0 = Bag

11

Example: Specifying a Bag

Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1))

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)

Observe thatD0,0 = Bag

s2(1) m+11 ||_ Bag =

s2(1).s2(1) m1 ||_ Bag =

s2(1). (s2(1) m1|| Bag)

12

Example: Specifying a Bag

Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1))

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)

Observe thatD0,0 = Bag

s2(1).1 || s2(1) m+11 =s2(1) m+11

13

Example: Specifying a Bag - Conclusion

Bag = r1(0). (Bag || s2(0)) + r1(1). (Bag || s2(1))

Dn,m = Bag || s2(0) n1 || s2(1) m+11

From RDP and RSP it follows that I. D0,0 = B0,0II. D0,m+1 = B0,m+1III. Dn+1,0= Bn+1,0IV. Dn+1,m+1 = Bn+1,m+1

Final conclusion: B0,0 = Bag

Observe thatD0,0 = Bag

14

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

Process Algebra (2IF45)

1 2BufTwo

15

Example: Buffer

Assume a set of data elements D = {0,1}III. Implementing a Two place buffer with Two One place buffers

Process Algebra (2IF45)

21 3

BufOne13 = r1(0).s3(0).BufOne13 + r1(1).s3(1).BufOne13BufOne32 = r3(0).s2(0).BufOne32 + r3(1).s2(1).BufOne32communication: (r3(x), s3(x)) = c3(x), for x D blocking: H = {r3(x), s3(x) | x D}

BufTwoInOne = ∂H( BufOne13 || BufOne32 )

16

Example: BufTwoInOne Recursive Specification

III. Implementing a Two place buffer with Two One place buffersBufOne13 = r1(0).s3(0).BufOne13 + r1(1).s3(1).BufOne13BufOne32 = 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

18 Process Algebra (2IF45)

components’ specifications

System specification manipulation (recap)

the whole system specification

the state space

reductionon specification

reductionon specification

reductionon LTSs

composition by axiom

SOS rules

• simpler• smaller• in a particular form (basic)• …

19

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 functionSignature: (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

20 Process Algebra (2IF45)

Towards equivalence relation(s)

in1euro

!coffee !coffee

in50c

in50c

!coffee !coffee

hiding reducing

!tea !coffee

40c 50c

!tea !coffee

hiding reducing

?

?

Think about different ways to reduce these processes?

Which reduced process preserves “the same moment of choice” as in the original process with s?

21 Process Algebra (2IF45)

reducing insert

40c

hiding ? coffee

insert

coffee

reducing insert

card

hiding ?

coffee

coin

insert

coffee

Towards equivalence relation(s)

22

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:

a

P Q

P+

+

a

P Q+

reduces to

23

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:

a

P Q

P+

+

a

P Q+

reduces to