process algebra (2if45) extending process algebra: parallel composition more examples

23
Process Algebra (2IF45) Extending Process Algebra: Parallel composition More examples Dr. Suzana Andova

Upload: kapila

Post on 18-Mar-2016

50 views

Category:

Documents


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

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

Process Algebra (2IF45)

Extending Process Algebra:Parallel composition More examples

Dr. Suzana Andova

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

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

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

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)• …

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

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

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

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

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

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?

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

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

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

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)

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

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

?

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

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

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

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)

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

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

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

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

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

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

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

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 )

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

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!

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

Process Algebra (2IF45)

Extending Process Algebra:Abstraction

Dr. Suzana Andova

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

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)• …

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

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

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

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?

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

21 Process Algebra (2IF45)

reducing insert

40c

hiding ? coffee

insert

coffee

reducing insert

card

hiding ?

coffee

coin

insert

coffee

Towards equivalence relation(s)

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

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

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

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