Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and - - PowerPoint PPT Presentation

concurrency theory
SMART_READER_LITE
LIVE PREVIEW

Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and - - PowerPoint PPT Presentation

Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS Joost-Pieter Katoen and Thomas Noll Software Modeling and Verification Group RWTH Aachen University


slide-1
SLIDE 1

Concurrency Theory

Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS Joost-Pieter Katoen and Thomas Noll Software Modeling and Verification Group RWTH Aachen University

https://moves.rwth-aachen.de/teaching/ws-19-20/ct/

slide-2
SLIDE 2

Modelling Mutual Exclusion Algorithms Outline of Lecture 7 Modelling Mutual Exclusion Algorithms Evaluating the CCS Model Model Checking Mutual Exclusion Alternative Verification Approaches Syntax of Value-Passing CCS Semantics of Value-Passing CCS Translation of Value-Passing into Pure CCS

2 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-3
SLIDE 3

Modelling Mutual Exclusion Algorithms Peterson’s Mutual Exclusion Algorithm

  • Goal: ensuring exclusive access to non-shared resources
  • Here: two competing processes P1, P2 and shared variables

– b1, b2 (Boolean, initially false) – bi indicates that Pi wants to enter critical section – k (in {1, 2}, arbitrary initial value) – index of prioritised process

  • Pi uses local variable j := 2 − i (index of other process)

3 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-4
SLIDE 4

Modelling Mutual Exclusion Algorithms Peterson’s Mutual Exclusion Algorithm

  • Goal: ensuring exclusive access to non-shared resources
  • Here: two competing processes P1, P2 and shared variables

– b1, b2 (Boolean, initially false) – bi indicates that Pi wants to enter critical section – k (in {1, 2}, arbitrary initial value) – index of prioritised process

  • Pi uses local variable j := 2 − i (index of other process)

Algorithm 7.1 (Peterson’s algorithm for Pi) while true do “non-critical section”; bi := true; k := j; while bj ∧ k = j do skip end; “critical section”; bi := false; end

3 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-5
SLIDE 5

Modelling Mutual Exclusion Algorithms Representing Shared Variables in CCS

  • Not directly expressible in CCS (communication by message passing)
  • Idea: consider variables as processes that communicate with environment by processing

read/write requests

4 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-6
SLIDE 6

Modelling Mutual Exclusion Algorithms Representing Shared Variables in CCS

  • Not directly expressible in CCS (communication by message passing)
  • Idea: consider variables as processes that communicate with environment by processing

read/write requests

Example 7.2 (Shared variables in Peterson’s algorithm)

  • Encoding of b1 with two (process) states B1t (value tt) and B1f (ff)
  • Read access along ports b1rt (in state B1t) and b1rf (in state B1f)
  • Write access along ports b1wt and b1wf (in both states)

4 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-7
SLIDE 7

Modelling Mutual Exclusion Algorithms Representing Shared Variables in CCS

  • Not directly expressible in CCS (communication by message passing)
  • Idea: consider variables as processes that communicate with environment by processing

read/write requests

Example 7.2 (Shared variables in Peterson’s algorithm)

  • Encoding of b1 with two (process) states B1t (value tt) and B1f (ff)
  • Read access along ports b1rt (in state B1t) and b1rf (in state B1f)
  • Write access along ports b1wt and b1wf (in both states)
  • Possible behaviours: B1f = b1rf.B1f + b1wf.B1f + b1wt.B1t

B1t = b1rt.B1t + b1wf.B1f + b1wt.B1t

4 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-8
SLIDE 8

Modelling Mutual Exclusion Algorithms Representing Shared Variables in CCS

  • Not directly expressible in CCS (communication by message passing)
  • Idea: consider variables as processes that communicate with environment by processing

read/write requests

Example 7.2 (Shared variables in Peterson’s algorithm)

  • Encoding of b1 with two (process) states B1t (value tt) and B1f (ff)
  • Read access along ports b1rt (in state B1t) and b1rf (in state B1f)
  • Write access along ports b1wt and b1wf (in both states)
  • Possible behaviours: B1f = b1rf.B1f + b1wf.B1f + b1wt.B1t

B1t = b1rt.B1t + b1wf.B1f + b1wt.B1t

  • Similarly for b2 and k: B2f = b2rf.B2f + b2wf.B2f + b2wt.B2t

B2t = b2rt.B2t + b2wf.B2f + b2wt.B2t K1 = kr1.K1 + kw1.K1 + kw2.K2 K2 = kr2.K2 + kw1.K1 + kw2.K2

4 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-9
SLIDE 9

Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: Pi cannot fail or terminate within critical section Peterson’s algorithm while true do “non-critical section”; bi := true; k := j; while bj ∧ k = j do skip end; “critical section”; bi := false; end

5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-10
SLIDE 10

Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: Pi cannot fail or terminate within critical section Peterson’s algorithm while true do “non-critical section”; bi := true; k := j; while bj ∧ k = j do skip end; “critical section”; bi := false; end CCS representation P1 = b1wt.kw2.P11 P11 = b2rf.P12 + b2rt.(kr1.P12 + kr2.P11) P12 = enter1.exit1.b1wf.P1 P2 = b2wt.kw1.P21 P21 = b1rf.P22 + b1rt.(kr1.P21 + kr2.P22) P22 = enter2.exit2.b2wf.P2 Peterson = (P1 P2 B1f B2f K1) \ L for L = {b1rf, b1rt, b1wf, b1wt, b2rf, b2rt, b2wf, b2wt, kr1, kr2, kw1, kw2}

5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-11
SLIDE 11

Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: Pi cannot fail or terminate within critical section Peterson’s algorithm while true do “non-critical section”; bi := true; k := j; while bj ∧ k = j do skip end; “critical section”; bi := false; end CCS representation P1 = b1wt.kw2.P11 P11 = b2rf.P12 + b2rt.(kr1.P12 + kr2.P11) P12 = enter1.exit1.b1wf.P1 P2 = b2wt.kw1.P21 P21 = b1rf.P22 + b1rt.(kr1.P21 + kr2.P22) P22 = enter2.exit2.b2wf.P2 Peterson = (P1 P2 B1f B2f K1) \ L for L = {b1rf, b1rt, b1wf, b1wt, b2rf, b2rt, b2wf, b2wt, kr1, kr2, kw1, kw2}

5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-12
SLIDE 12

Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: Pi cannot fail or terminate within critical section Peterson’s algorithm while true do “non-critical section”; bi := true; k := j; while bj ∧ k = j do skip end; “critical section”; bi := false; end CCS representation P1 = b1wt.kw2.P11 P11 = b2rf.P12 + b2rt.(kr1.P12 + kr2.P11) P12 = enter1.exit1.b1wf.P1 P2 = b2wt.kw1.P21 P21 = b1rf.P22 + b1rt.(kr1.P21 + kr2.P22) P22 = enter2.exit2.b2wf.P2 Peterson = (P1 P2 B1f B2f K1) \ L for L = {b1rf, b1rt, b1wf, b1wt, b2rf, b2rt, b2wf, b2wt, kr1, kr2, kw1, kw2}

5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-13
SLIDE 13

Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: Pi cannot fail or terminate within critical section Peterson’s algorithm while true do “non-critical section”; bi := true; k := j; while bj ∧ k = j do skip end; “critical section”; bi := false; end CCS representation P1 = b1wt.kw2.P11 P11 = b2rf.P12 + b2rt.(kr1.P12 + kr2.P11) P12 = enter1.exit1.b1wf.P1 P2 = b2wt.kw1.P21 P21 = b1rf.P22 + b1rt.(kr1.P21 + kr2.P22) P22 = enter2.exit2.b2wf.P2 Peterson = (P1 P2 B1f B2f K1) \ L for L = {b1rf, b1rt, b1wf, b1wt, b2rf, b2rt, b2wf, b2wt, kr1, kr2, kw1, kw2}

5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-14
SLIDE 14

Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: Pi cannot fail or terminate within critical section Peterson’s algorithm while true do “non-critical section”; bi := true; k := j; while bj ∧ k = j do skip end; “critical section”; bi := false; end CCS representation P1 = b1wt.kw2.P11 P11 = b2rf.P12 + b2rt.(kr1.P12 + kr2.P11) P12 = enter1.exit1.b1wf.P1 P2 = b2wt.kw1.P21 P21 = b1rf.P22 + b1rt.(kr1.P21 + kr2.P22) P22 = enter2.exit2.b2wf.P2 Peterson = (P1 P2 B1f B2f K1) \ L for L = {b1rf, b1rt, b1wf, b1wt, b2rf, b2rt, b2wf, b2wt, kr1, kr2, kw1, kw2}

5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-15
SLIDE 15

Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: Pi cannot fail or terminate within critical section Peterson’s algorithm while true do “non-critical section”; bi := true; k := j; while bj ∧ k = j do skip end; “critical section”; bi := false; end CCS representation P1 = b1wt.kw2.P11 P11 = b2rf.P12 + b2rt.(kr1.P12 + kr2.P11) P12 = enter1.exit1.b1wf.P1 P2 = b2wt.kw1.P21 P21 = b1rf.P22 + b1rt.(kr1.P21 + kr2.P22) P22 = enter2.exit2.b2wf.P2 Peterson = (P1 P2 B1f B2f K1) \ L for L = {b1rf, b1rt, b1wf, b1wt, b2rf, b2rt, b2wf, b2wt, kr1, kr2, kw1, kw2}

5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-16
SLIDE 16

Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: Pi cannot fail or terminate within critical section Peterson’s algorithm while true do “non-critical section”; bi := true; k := j; while bj ∧ k = j do skip end; “critical section”; bi := false; end CCS representation P1 = b1wt.kw2.P11 P11 = b2rf.P12 + b2rt.(kr1.P12 + kr2.P11) P12 = enter1.exit1.b1wf.P1 P2 = b2wt.kw1.P21 P21 = b1rf.P22 + b1rt.(kr1.P21 + kr2.P22) P22 = enter2.exit2.b2wf.P2 Peterson = (P1 P2 B1f B2f K1) \ L for L = {b1rf, b1rt, b1wf, b1wt, b2rf, b2rt, b2wf, b2wt, kr1, kr2, kw1, kw2}

5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-17
SLIDE 17

Evaluating the CCS Model Outline of Lecture 7 Modelling Mutual Exclusion Algorithms Evaluating the CCS Model Model Checking Mutual Exclusion Alternative Verification Approaches Syntax of Value-Passing CCS Semantics of Value-Passing CCS Translation of Value-Passing into Pure CCS

6 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-18
SLIDE 18

Evaluating the CCS Model Obtaining the LTS I Alternatives:

  • By hand (really painful)
  • By tools:

– CAAL (Concurrency Workbench, Aalborg Edition): http://caal.cs.aau.dk

smart editor visualisation of generated LTS equivalence checking w.r.t. several bisimulation, simulation and trace equivalences generation of distinguishing formulae for nonequivalent processes model checking of recursive HML formulae (bi)simulation and model checking games. CCS specification of Peterson’s algorithm available as example yields LTS with 50 states (see following slides)

– [e]TAPAs (Tool for the Analysis of Process Algebras): http://etapas.sourceforge.net/

Eclipse plug-in stand-alone version not supported any more

– CWB (Edinburgh Concurrency Workbench): http://homepages.inf.ed.ac.uk/perdita/cwb/

somewhat outdated

7 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-19
SLIDE 19

Evaluating the CCS Model Obtaining the LTS II

8 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-20
SLIDE 20

Evaluating the CCS Model Obtaining the LTS III

9 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-21
SLIDE 21

Model Checking Mutual Exclusion Outline of Lecture 7 Modelling Mutual Exclusion Algorithms Evaluating the CCS Model Model Checking Mutual Exclusion Alternative Verification Approaches Syntax of Value-Passing CCS Semantics of Value-Passing CCS Translation of Value-Passing into Pure CCS

10 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-22
SLIDE 22

Model Checking Mutual Exclusion The Mutual Exclusion Property

  • Done: formal description of Peterson’s algorithm
  • To do: analysing its behaviour (manually or with tool support)
  • Question: what does “ensuring mutual exclusion” formally mean?

11 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-23
SLIDE 23

Model Checking Mutual Exclusion The Mutual Exclusion Property

  • Done: formal description of Peterson’s algorithm
  • To do: analysing its behaviour (manually or with tool support)
  • Question: what does “ensuring mutual exclusion” formally mean?

Mutual exclusion At no point in the execution of the algorithm, processes P1 and P2 will both be in their critical section at the same time. Equivalently: It is always the case that either P1 or P2 or both are not in their critical section.

11 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-24
SLIDE 24

Model Checking Mutual Exclusion Specifying Mutual Exclusion in HML Mutual exclusion It is always the case that either P1 or P2 or both are not in their critical section.

12 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-25
SLIDE 25

Model Checking Mutual Exclusion Specifying Mutual Exclusion in HML Mutual exclusion It is always the case that either P1 or P2 or both are not in their critical section. Observations:

  • Mutual exclusion is an invariance property (“always”)
  • Pi is in its critical section iff action exit i is enabled

12 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-26
SLIDE 26

Model Checking Mutual Exclusion Specifying Mutual Exclusion in HML Mutual exclusion It is always the case that either P1 or P2 or both are not in their critical section. Observations:

  • Mutual exclusion is an invariance property (“always”)
  • Pi is in its critical section iff action exit i is enabled

Mutual exclusion in HML MutEx := Inv(F) Inv(F)

max

= F ∧ [Act]Inv(F)

(cf. Theorem 6.1) F := [exit1]ff ∨ [exit2]ff

12 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-27
SLIDE 27

Model Checking Mutual Exclusion Model Checking Mutual Exclusion

  • Using CAAL Tool
  • Supports property specifications by recursive HML formulae:

MutEx max= ([[exit1]]ff or [[exit2]]ff) and [-]MutEx;

13 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-28
SLIDE 28

Alternative Verification Approaches Outline of Lecture 7 Modelling Mutual Exclusion Algorithms Evaluating the CCS Model Model Checking Mutual Exclusion Alternative Verification Approaches Syntax of Value-Passing CCS Semantics of Value-Passing CCS Translation of Value-Passing into Pure CCS

14 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-29
SLIDE 29

Alternative Verification Approaches Verification by Bisimulation Checking

  • Alternative to logic-based approaches
  • Idea: establish equivalence between (concrete) “implementation” and (abstract)

“specification”

15 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-30
SLIDE 30

Alternative Verification Approaches Verification by Bisimulation Checking

  • Alternative to logic-based approaches
  • Idea: establish equivalence between (concrete) “implementation” and (abstract)

“specification”

Example 7.3 (Two-place buffers (cf. Example 2.5))

  • 1. Sequential specification:

B0 = in.B1 B1 = out.B0 + in.B2 B2 = out.B1

  • 2. Parallel implementation:

B = (B[f] B[g]) \ com B = in.out.B where f := [out → com] and g := [in → com]

Later: (1) and (2) are “weakly bisimilar” (i.e., bisimilar up to τ-transitions)

15 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-31
SLIDE 31

Alternative Verification Approaches Specifying Mutual Exclusion in CCS

  • Goal: express desired behaviour of mutual exclusion algorithm as an “abstract” CCS

process

16 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-32
SLIDE 32

Alternative Verification Approaches Specifying Mutual Exclusion in CCS

  • Goal: express desired behaviour of mutual exclusion algorithm as an “abstract” CCS

process

  • Intuitively:
  • 1. initially, either P1 or P2 can enter its critical section
  • 2. once this happened, the other process cannot enter the critical section before the first has exited it

16 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-33
SLIDE 33

Alternative Verification Approaches Specifying Mutual Exclusion in CCS

  • Goal: express desired behaviour of mutual exclusion algorithm as an “abstract” CCS

process

  • Intuitively:
  • 1. initially, either P1 or P2 can enter its critical section
  • 2. once this happened, the other process cannot enter the critical section before the first has exited it

Mutual exclusion in CCS MutExSpec = enter1.exit1.MutExSpec + enter2.exit2.MutExSpec

16 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-34
SLIDE 34

Alternative Verification Approaches Specifying Mutual Exclusion in CCS

  • Goal: express desired behaviour of mutual exclusion algorithm as an “abstract” CCS

process

  • Intuitively:
  • 1. initially, either P1 or P2 can enter its critical section
  • 2. once this happened, the other process cannot enter the critical section before the first has exited it

Mutual exclusion in CCS MutExSpec = enter1.exit1.MutExSpec + enter2.exit2.MutExSpec Again: Peterson and MutExSpec are “weakly bisimilar”

16 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-35
SLIDE 35

Syntax of Value-Passing CCS Outline of Lecture 7 Modelling Mutual Exclusion Algorithms Evaluating the CCS Model Model Checking Mutual Exclusion Alternative Verification Approaches Syntax of Value-Passing CCS Semantics of Value-Passing CCS Translation of Value-Passing into Pure CCS

17 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-36
SLIDE 36

Syntax of Value-Passing CCS Value-Passing CCS

  • So far: pure CCS

– communication = mere synchronisation – no (explicit) exchange of data

  • But: processes usually do pass around data

18 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-37
SLIDE 37

Syntax of Value-Passing CCS Value-Passing CCS

  • So far: pure CCS

– communication = mere synchronisation – no (explicit) exchange of data

  • But: processes usually do pass around data

⇒ Value-passing CCS

  • Introduced in Robin Milner: Communication and Concurrency, Prentice-Hall, 1989
  • Assumption (for simplicity): only integers as data type

18 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-38
SLIDE 38

Syntax of Value-Passing CCS Value-Passing CCS

  • So far: pure CCS

– communication = mere synchronisation – no (explicit) exchange of data

  • But: processes usually do pass around data

⇒ Value-passing CCS

  • Introduced in Robin Milner: Communication and Concurrency, Prentice-Hall, 1989
  • Assumption (for simplicity): only integers as data type

Example 7.4 (One-place buffer with data (cf. Example 2.5)) One-place buffer that outputs successor of stored value: B = in(x).B′(x) B′(x) = out(x + 1).B

18 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-39
SLIDE 39

Syntax of Value-Passing CCS Syntax of Value-Passing CCS I Definition 7.5 (Syntax of value-passing CCS)

  • Let A, A, Pid (ranked) as in Definition 2.1.

19 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-40
SLIDE 40

Syntax of Value-Passing CCS Syntax of Value-Passing CCS I Definition 7.5 (Syntax of value-passing CCS)

  • Let A, A, Pid (ranked) as in Definition 2.1.
  • Let e and b be integer and Boolean expressions, resp., built from integer variables x, y, . . .

19 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-41
SLIDE 41

Syntax of Value-Passing CCS Syntax of Value-Passing CCS I Definition 7.5 (Syntax of value-passing CCS)

  • Let A, A, Pid (ranked) as in Definition 2.1.
  • Let e and b be integer and Boolean expressions, resp., built from integer variables x, y, . . .
  • The set Prc+ of value-passing process expressions is defined by:

P ::= nil (inaction)

| a(x).P

(input prefixing)

| a(e).P

(output prefixing)

| τ.P

(τ prefixing)

| P1 + P2

(choice)

| P1 P2

(parallel composition)

| P \ L

(restriction)

| P[f]

(relabelling)

| if b then P

(conditional)

| C(e1, . . . , en)

(process call) where a ∈ A, L ⊆ A, C ∈ Pid (of rank n ∈ N), and f : A → A.

19 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-42
SLIDE 42

Syntax of Value-Passing CCS Syntax of Value-Passing CCS II Definition 7.5 (Syntax of value-passing CCS; continued) A value-passing process definition is an equation system of the form

(Ci(x1, . . . , xni) = Pi | 1 ≤ i ≤ k)

where

  • k ≥ 1,
  • Ci ∈ Pid of rank ni (pairwise distinct),
  • Pi ∈ Prc+ (with process identifiers from {C1, . . . , Ck}), and
  • all occurrences of an integer variable y in each Pi are bound, i.e., y ∈ {x1, . . . , xni} or y is in

the scope of an input prefix of the form a(y) (to ensure well-definedness of values).

20 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-43
SLIDE 43

Syntax of Value-Passing CCS Syntax of Value-Passing CCS II Definition 7.5 (Syntax of value-passing CCS; continued) A value-passing process definition is an equation system of the form

(Ci(x1, . . . , xni) = Pi | 1 ≤ i ≤ k)

where

  • k ≥ 1,
  • Ci ∈ Pid of rank ni (pairwise distinct),
  • Pi ∈ Prc+ (with process identifiers from {C1, . . . , Ck}), and
  • all occurrences of an integer variable y in each Pi are bound, i.e., y ∈ {x1, . . . , xni} or y is in

the scope of an input prefix of the form a(y) (to ensure well-definedness of values).

Example 7.6

  • 1. C(x) = a(x + 1).b(y).C(y) is allowed

20 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-44
SLIDE 44

Syntax of Value-Passing CCS Syntax of Value-Passing CCS II Definition 7.5 (Syntax of value-passing CCS; continued) A value-passing process definition is an equation system of the form

(Ci(x1, . . . , xni) = Pi | 1 ≤ i ≤ k)

where

  • k ≥ 1,
  • Ci ∈ Pid of rank ni (pairwise distinct),
  • Pi ∈ Prc+ (with process identifiers from {C1, . . . , Ck}), and
  • all occurrences of an integer variable y in each Pi are bound, i.e., y ∈ {x1, . . . , xni} or y is in

the scope of an input prefix of the form a(y) (to ensure well-definedness of values).

Example 7.6

  • 1. C(x) = a(x + 1).b(y).C(y) is allowed
  • 2. C(x) = a(x + 1).a(y + 2).nil is disallowed as y is not bound

20 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-45
SLIDE 45

Semantics of Value-Passing CCS Outline of Lecture 7 Modelling Mutual Exclusion Algorithms Evaluating the CCS Model Model Checking Mutual Exclusion Alternative Verification Approaches Syntax of Value-Passing CCS Semantics of Value-Passing CCS Translation of Value-Passing into Pure CCS

21 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-46
SLIDE 46

Semantics of Value-Passing CCS Semantics of Value-Passing CCS I Definition 7.7 (Semantics of value-passing CCS) A value-passing process definition (Ci(x1, . . . , xni) = Pi | 1 ≤ i ≤ k) determines the LTS (Prc+, Act, −

→) with Act := (A ∪ A) × Z ∪ {τ} whose transitions can be

inferred from the following rules (P, P′, Q, Q′ ∈ Prc+, a ∈ A, xi integer variables, ei/b integer/Boolean expressions, z ∈ Z, α ∈ Act, λ ∈ (A ∪ A) × Z):

(In)

a(x).P

a(z)

− → P[z/x]

(Out) (z value of e)

a(e).P

a(z)

− → P

(Tau)

τ.P

τ

− → P

(Sum1)

P

α

− → P′

P + Q

α

− → P′

(Sum2)

Q

α

− → Q′

P + Q

α

− → Q′

(Par1)

P

α

− → P′

P Q

α

− → P′ Q

(Par2)

Q

α

− → Q′

P Q

α

− → P Q′

(Com) P

λ

− → P′ Q

λ

− → Q′

P Q

τ

− → P′ Q′

22 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-47
SLIDE 47

Semantics of Value-Passing CCS Semantics of Value-Passing CCS II Definition 7.7 (Semantics of value-passing CCS; continued)

(Rel)

P

α

− → P′

P[f]

f(α)

− → P′[f]

(Res)

P

α

− → P′ (α / ∈ (L ∪ L) × Z)

P \ L

α

− → P′ \ L

(If)

P

α

− → P′ (b true)

if b then P

α

− → P′

(Call)

P[z1/x1, . . . , zn/xn]

α

− → P′ (C(x1, . . . , xn) = P, zi value of ei)

C(e1, . . . , en)

α

− → P′

23 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-48
SLIDE 48

Semantics of Value-Passing CCS Semantics of Value-Passing CCS II Definition 7.7 (Semantics of value-passing CCS; continued)

(Rel)

P

α

− → P′

P[f]

f(α)

− → P′[f]

(Res)

P

α

− → P′ (α / ∈ (L ∪ L) × Z)

P \ L

α

− → P′ \ L

(If)

P

α

− → P′ (b true)

if b then P

α

− → P′

(Call)

P[z1/x1, . . . , zn/xn]

α

− → P′ (C(x1, . . . , xn) = P, zi value of ei)

C(e1, . . . , en)

α

− → P′

Remarks:

  • P[z1/x1, . . . , zn/xn] denotes the substitution of each free (i.e., unbound) occurrence of xi by

zi (1 ≤ i ≤ n)

  • Operations on actions ignore values:

a(z) := a(z) a(z) := a(z) f(a(z)) := f(a)(z) f(a(z)) := f(a)(z) (and f(τ) := τ)

23 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-49
SLIDE 49

Semantics of Value-Passing CCS Semantics of Value-Passing CCS III Further remarks:

  • The binding restriction ensures that all integer and Boolean expressions have a defined

value

24 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-50
SLIDE 50

Semantics of Value-Passing CCS Semantics of Value-Passing CCS III Further remarks:

  • The binding restriction ensures that all integer and Boolean expressions have a defined

value

  • The two-armed conditional if b then P else Q can be defined by

(if b then P) + (if ¬b then Q)

24 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-51
SLIDE 51

Semantics of Value-Passing CCS Semantics of Value-Passing CCS III Further remarks:

  • The binding restriction ensures that all integer and Boolean expressions have a defined

value

  • The two-armed conditional if b then P else Q can be defined by

(if b then P) + (if ¬b then Q)

Example 7.8 One-place buffer that outputs non-negative predecessor of stored value: B = in(x).B′(x) B′(x) = (if x = 0 then out(0).B) + (if x > 0 then out(x − 1).B) (processing of value “1”: on the board)

24 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-52
SLIDE 52

Translation of Value-Passing into Pure CCS Outline of Lecture 7 Modelling Mutual Exclusion Algorithms Evaluating the CCS Model Model Checking Mutual Exclusion Alternative Verification Approaches Syntax of Value-Passing CCS Semantics of Value-Passing CCS Translation of Value-Passing into Pure CCS

25 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-53
SLIDE 53

Translation of Value-Passing into Pure CCS Translation of Value-Passing into Pure CCS I

  • To show: value-passing process definitions can be represented in pure CCS
  • Idea: each parametrised construct (a(x), a(e), C(e1, . . . , en)) corresponds to an indexed

family of constructs in pure CCS, one for each possible (combination of) integer value(s)

  • Requires extension of pure CCS by infinite choices (“ . . .”), restrictions, and process

definitions

26 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-54
SLIDE 54

Translation of Value-Passing into Pure CCS Translation of Value-Passing into Pure CCS II Definition 7.9 (Translation of value-passing into pure CCS) For each P ∈ Prc+ without free variables, its translated form P ∈ Prc is given by

  • nil := nil
  • τ.P := τ.

P

  • a(x).P :=

z∈Z az.

P[z/x]

  • a(e).P := az.

P

(z value of e)

  • P1 + P2 :=

P1 + P2

  • P1 P2 :=

P1 P2

  • P \ L :=

P \ {az | a ∈ L, z ∈ Z}

  • P[f] :=

P[ f]

(

f(az) := f(a)z)

  • if b then P :=
  • P

if b true nil

  • therwise
  • C(e1, . . . , en) := Cz1,...,zn

(zi value of ei)

27 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-55
SLIDE 55

Translation of Value-Passing into Pure CCS Translation of Value-Passing into Pure CCS II Definition 7.9 (Translation of value-passing into pure CCS) For each P ∈ Prc+ without free variables, its translated form P ∈ Prc is given by

  • nil := nil
  • τ.P := τ.

P

  • a(x).P :=

z∈Z az.

P[z/x]

  • a(e).P := az.

P

(z value of e)

  • P1 + P2 :=

P1 + P2

  • P1 P2 :=

P1 P2

  • P \ L :=

P \ {az | a ∈ L, z ∈ Z}

  • P[f] :=

P[ f]

(

f(az) := f(a)z)

  • if b then P :=
  • P

if b true nil

  • therwise
  • C(e1, . . . , en) := Cz1,...,zn

(zi value of ei)

Moreover, each defining equation C(x1, . . . , xn) = P of a process identifier is translated into the indexed collection of process definitions

  • Cz1,...,zn =
  • P[z1/x1, . . . , zn/xn] | z1, . . . , zn ∈ Z
  • 27 of 28

Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-56
SLIDE 56

Translation of Value-Passing into Pure CCS Translation of Value-Passing into Pure CCS III Example 7.10 (cf. Example 7.8) B = in(x).B′(x) B′(x) = (if x = 0 then out(0).B) + (if x > 0 then out(x − 1).B) (on the board)

28 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-57
SLIDE 57

Translation of Value-Passing into Pure CCS Translation of Value-Passing into Pure CCS III Example 7.10 (cf. Example 7.8) B = in(x).B′(x) B′(x) = (if x = 0 then out(0).B) + (if x > 0 then out(x − 1).B) (on the board) Theorem 7.11 (Correctness of translation) For all P, P′ ∈ Prc+ and α ∈ Act, P

α

− → P′ ⇐ ⇒

P

  • α

− →

P′ where a(z) := az, a(z) := az, and

τ := τ.

28 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

slide-58
SLIDE 58

Translation of Value-Passing into Pure CCS Translation of Value-Passing into Pure CCS III Example 7.10 (cf. Example 7.8) B = in(x).B′(x) B′(x) = (if x = 0 then out(0).B) + (if x > 0 then out(x − 1).B) (on the board) Theorem 7.11 (Correctness of translation) For all P, P′ ∈ Prc+ and α ∈ Act, P

α

− → P′ ⇐ ⇒

P

  • α

− →

P′ where a(z) := az, a(z) := az, and

τ := τ.

Proof. by induction on the structure of P (omitted)

28 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS