• No results found

Semantics and Verification of Software

N/A
N/A
Protected

Academic year: 2021

Share "Semantics and Verification of Software"

Copied!
23
0
0

Loading.... (view fulltext now)

Full text

(1)

Semantics and Verification of Software

Lecture 21: Nondeterminism and Parallelism IV (Equivalence of CCS Processes & Wrap-Up)

Thomas Noll

Lehrstuhl f¨ur Informatik 2 (Software Modeling and Verification)

[email protected]

http://www-i2.informatik.rwth-aachen.de/i2/svsw11/

Winter Semester 2011/12

(2)

Outline

1

Repetition: Calculus of Communicating Systems

2

Equivalence of CCS Processes

3

Strong Bisimulation

4

Further Topics in Formal Semantics

5

Upcoming Courses

(3)

Syntax of CCS I

Definition (Syntax of CCS)

Let N be a set of (action) names.

N := {a | a ∈ N} denotes the set of co-names.

Act := N ∪ N ∪ {τ } is the set of actions where τ denotes the silent (or: unobservable) action.

Let Pid be a set of process identifiers.

The set Prc of process expressions is defined by the following syntax:

P ::= nil (inaction)

| α.P (prefixing)

| P

1

+ P

2

(choice)

| P

1

k P

2

(parallel composition)

| new a P (restriction)

| A(a

1

, . . . , a

n

) (process call)

where α ∈ Act, a, a

i

∈ N, and A ∈ Pid .

(4)

Semantics of CCS I

Definition (Semantics of CCS)

A process definition (A

i

(a

i 1

, . . . , a

ini

) = P

i

| 1 ≤ i ≤ k) determines the labeled transition system (LTS) (Prc, Act, −→) whose transitions can be inferred from the following rules (P, P

0

, Q, Q

0

∈ Prc, α ∈ Act, λ ∈ N ∪ N, a, b ∈ N , A ∈ Pid):

(Act)

α.P −→ P

α

(Com)

P −→ P

λ 0

Q −→ Q

λ 0

P k Q −→ P

τ 0

k Q

0

(Sum1)

P −→ P

α 0

P + Q −→ P

α 0 (Sum2)

Q −→ Q

α 0

P + Q −→ Q

α 0

(Par1)

P −→ P

α 0

P k Q −→ P

α 0

k Q

(Par2)

Q −→ Q

α 0

P k Q −→ P k Q

α 0

(New)

P −→ P

α 0

(α / ∈ {a, a}) new a P −→ new a P

α 0

(Call)

P[~a 7→ ~ b] −→ P

α 0

A(~ b) −→ P

α 0

if A(~a) = P

(Here P[~a 7→ ~ b] denotes the replacement of every a

i

by b

i

in P .)

(5)

Semantics of CCS II

Example (on the board)

1

One-place buffer:

B(in, out) = in.out.B(in, out)

2

Sequential two-place buffer:

B

0

(in, out) = in.B

1

(in, out)

B

1

(in, out) = out.B

0

(in, out) + in.B

2

(in, out) B

2

(in, out) = out.B

1

(in, out)

3

Parallel two-place buffer:

B

k

(in, out) = new com (B(in, com) k B(com, out))

B(in, out) = in.out.B(in, out)

(6)

Semantics of CCS III

Example (continued)

Complete LTS of parallel two-place buffer (=: LTS (B

k

(in, out))):

B

k

(in, out)

new com (com.B(in, com) k B(com, out))

new com (com.B(in, com) k out.B(com, out)) new com (B(in, com) k

out.B(com, out))

new com (B(in, com) k B(com, out)) empty

1 entry

full

in in

τ

out

out in

(7)

Outline

1

Repetition: Calculus of Communicating Systems

2

Equivalence of CCS Processes

3

Strong Bisimulation

4

Further Topics in Formal Semantics

5

Upcoming Courses

(8)

Equivalence of CCS Processes

Generally: two syntactic objects are equivalent if they have the same

“meaning”

Here: two processes are equivalent if they have the same “behavior”

(i.e., communication potential)

Communication potential described by LTS First idea: define (for P, Q ∈ Prc)

P, Q are called LTS equivalent if LTS (P) = LTS (Q) But: yields too many distinctions

Example 21.1

X (a) = a.X (a) Y (a) = a.a.Y (a)

LTS: •

a 6= •

a ↓↑ a

although both processes can (only) execute infinitely many a-actions, and

should therefore be considered equivalent

(9)

Trace Equivalence I

Second idea: reduce process to its action sequences Definition 21.2 (Trace language)

For every P ∈ Prc, let

Tr (P) := {w ∈ Act

| ex. P

0

∈ Prc such that P −→ P

w 0

} be the trace language of P

(where −→ :=

w

−→ ◦ . . . ◦

a1

−→

a1

for w = a

1

. . . a

n

).

P, Q ∈ Prc are called trace equivalent if Tr (P) = Tr (Q).

Example 21.3 (One-place buffer) B(in, out) = in.out.B(in, out)

⇒ Tr (B(in, out)) = (in · out)

· (in + ε)

(10)

Trace Equivalence II

Remarks:

The trace language of P ∈ Prc is accepted by the LTS of P , interpreted as an automaton with initial state P and where every state is final.

Trace equivalence is obviously an equivalence relation (i.e., reflexive, symmetric, and transitive).

Trace equivalence identifies processes with identical LTSs: the trace language of a process consists of the (finite) paths in the LTS. Thus:

LTS (P) = LTS (Q) ⇒ Tr (P) = Tr (Q)

(11)

Trace Equivalence III

Are we satisfied with trace equivalence? No!

Example 21.4

P : •

a .& a

• •

b ↓ •

and Q : •

↓ a •

↓ b •

are trace equivalent (Tr (P) = Tr (Q) = {ε, a, ab}) But P and Q are distinguishable:

both can execute ab but P can deny b after a

while Q always has to offer b after a (e.g., consider a model of vending machine with a = “insert coin”, b = “return coffee”)

⇒ take into account such deadlock properties

(12)

Outline

1

Repetition: Calculus of Communicating Systems

2

Equivalence of CCS Processes

3

Strong Bisimulation

4

Further Topics in Formal Semantics

5

Upcoming Courses

(13)

Definition of Strong Bisimulation I

Observation: equivalence should be sensitive to deadlocks

⇒ needs to take branching structure of processes into account This is guaranteed by a definition according to the following scheme:

Bisimulation scheme

P, Q ∈ Prc are equivalent iff, for every α ∈ Act, every α-successor of P is equivalent to some α-successor of Q, and vice versa.

Strong version ignores special function of silent action τ (alternative: weak bisimulation; not considered here) Unidirectional version: simulation

(not considered here)

(14)

Definition of Strong Bisimulation II

Definition 21.5 (Strong bisimulation)

A relation ρ ⊆ Prc × Prc is called a strong bisimulation if PρQ implies, for every α ∈ Act,

1

P −→ P

α 0

⇒ ex. Q

0

∈ Prc such that Q −→ Q

α 0

and P

0

ρQ

0

2

Q −→ Q

α 0

⇒ ex. P

0

∈ Prc such that P −→ P

α 0

and P

0

ρQ

0

P, Q ∈ Prc are called strongly bisimilar (notation: P ∼ Q) if there exists a strong bisimulation ρ such that PρQ.

Theorem 21.6

∼ is an equivalence relation.

Proof.

omitted

(15)

Examples

Example 21.7 (on the board)

1

Bisimilar but not LTS equivalent (cf. Example 21.1):

P

a

∼ Q

1

a ↓↑ a

Q

2

2

Trace equivalent (cf. Example 21.4) but not bisimilar:

P

↓ a P

1

↓ b P

2

6∼ Q

a .& a Q

1

Q

3

b ↓

Q

2

(16)

Bisimulation vs. LTS/Trace Equivalence

Theorem 21.8 For every P, Q ∈ Prc,

LTS (P) = LTS (Q) ⇒

6⇐ P ∼ Q ⇒

6⇐ Tr (P) = Tr (Q)

Proof.

LTS (P) = LTS (Q) ⇒ P ∼ Q: clear as Definition 21.5 (of ∼) is directly based on LTS (p) and LTS (Q)

P ∼ Q 6⇒ LTS (p) = LTS (Q): see Example 21.7(1) P ∼ Q ⇒ Tr (P) = Tr (Q): by contradiction

(show: ∃w ∈ Tr (P) \ Tr (Q) ⇒ P 6∼ Q by induction on |w |)

Tr (P) = Tr (Q) 6⇒ P ∼ Q: see Example 21.7(2)

(17)

More Examples I

Example 21.9 Binary semaphore

(controls exclusive access to two instances of a resource) Sequential definition:

Sem

0

(get, put) = get.Sem

1

(get, put)

Sem

1

(get, put) = get.Sem

2

(get, put) + put.Sem

0

(get, put) Sem

2

(get, put) = put.Sem

1

(get, put)

Parallel definition:

S (get, put) = S

0

(get, put) k S

0

(get, put) S

0

(get, put) = get.S

1

(get, put)

S

1

(get, put) = put.S

0

(get, put)

Proposition: Sem

0

(get, put) ∼ S (get, put)

(18)

More Examples II

Example 21.10 Two-place buffer Sequential definition:

B

0

(in, out) = in.B

1

(in, out)

B

1

(in, out) = out.B

0

(in, out) + in.B

2

(in, out) B

2

(in, out) = out.B

1

(in, out)

Parallel definition:

B

k

(in, out) = new com (B(in, com) k B(com, out)) B(in, out) = in.out.B(in, out)

Proposition: B

0

(in, out) 6∼ B

k

(in, out)

(19)

Outline

1

Repetition: Calculus of Communicating Systems

2

Equivalence of CCS Processes

3

Strong Bisimulation

4

Further Topics in Formal Semantics

5

Upcoming Courses

(20)

Semantics of Functional Languages I

Program = list of function definitions

Simplest setting: first-order function definitions of the form f (x

1

, . . . , x

n

) = t

function name f

formal parameters x

1

, . . . , x

n

term t over (base and defined) function calls and x

1

, . . . , x

n

Operational semantics (only function calls)

call-by-value case:

t

1

→ z

1

. . . t

n

→ z

n

t[x

1

7→ z

1

, . . . , x

n

7→ z

n

] → z f (t

1

, . . . , t

n

) → z

call-by-name case:

t[x

1

7→ t

1

, . . . , x

n

7→ t

n

] → z

f (t

1

, . . . , t

n

) → z

(21)

Semantics of Functional Languages II

Denotational semantics

program = equation system (for functions) induces call-by-value and call-by-name functional monotonic and continuous w.r.t. graph inclusion semantics := least fixpoint (Tarski/Knaster Theorem) coincides with operational semantics

Extensions: higher-order types, data types, ...

see [Winskel 1996, Sct. 9] and Functional Programming course [Giesl]

(22)

Outline

1

Repetition: Calculus of Communicating Systems

2

Equivalence of CCS Processes

3

Strong Bisimulation

4

Further Topics in Formal Semantics

5

Upcoming Courses

(23)

Courses Summer 2012

Course Advanced Model Checking [Katoen]

Course Compiler Construction [Noll] (“Hiwi” jobs available!)

References

Related documents

Likewise, if adrenergic blocking agents as adrenolytic drugs are given to rats so, locomotor activity of rats will decrease.In the present study,results

The purpose of our study was to update the safety and efficacy results of radioimmunotherapy in relapsed or resistant indolent or transformed non-Hodgkin lymphoma.. Methods: More than

Our study successfully implemented a referral program for maternal contraceptive services within pediatric care by having pediatric residents assess postpartum women ’ s needs

It was decided that with the presence of such significant red flag signs that she should undergo advanced imaging, in this case an MRI, that revealed an underlying malignancy, which

treatment with Wilhelmi growth hormone... Ratio of cortisol production rate to urinary 17-OHCS excretion in older infants and children with various pathological conditions including

19% serve a county. Fourteen per cent of the centers provide service for adjoining states in addition to the states in which they are located; usually these adjoining states have

In conclusion, some of the reproductive parameters such as sex distribution, gonad development, spawning period and batch fecundity of the poor cod population in the

Atherosclerosis, a chronic disorder and the main pathogenesis of various cardiovascular diseases, is initiated by the formation of the macrophage foam cell at the subendothelial