68
Compositionality, Interaction, and Abstraction in Complex Computing Systems: Process Calculi and Behavioral Equivalences Marco Bernardo University of Urbino – Italy c July 2013

Compositionality, Interaction, and Abstraction in Complex

  • Upload
    others

  • View
    16

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Compositionality, Interaction, and Abstraction in Complex

Compositionality, Interaction, and Abstractionin Complex Computing Systems:

Process Calculi and Behavioral Equivalences

Marco Bernardo

University of Urbino – Italy

c© July 2013

Page 2: Compositionality, Interaction, and Abstraction in Complex

Organization of the Lectures

Part I: Concurrency and Communication 3

Part II: Process Calculi 19

Part III: Behavioral Equivalences 36

References 66

Page 3: Compositionality, Interaction, and Abstraction in Complex

Part I:Concurrency and Communication

Page 4: Compositionality, Interaction, and Abstraction in Complex

Evolution in Computing

• Sequential computing (1940): a single instruction at a time is executed.

• Imperative models: Turing machines and less expressive automata

(finite-state automata, push-down automata).

• Declarative models: Church λ-calculus, first-order logic.

• Programming languages (Fortran, Cobol, Algol, C, ..., Lisp, Prolog, ...).

• Concurrent and distributed computing (1980): several instructions can

be simultaneously executed.

• Shared-memory model vs. message-passing model.

• Primitives for programs synchronization (semaphores, monitors, ...).

• Concurrent programming languages (Ada, Occam, Java, ...).

Page 5: Compositionality, Interaction, and Abstraction in Complex

• Global computing (2000): computation over infrastructures available

globally and able to provide uniform services with variable guarantees,

with particular regard to exploiting their universal scale as well as

the programmability of their services.

• Development of large-scale general-purpose computer systems that have

dependably predictable behavior, for the needs of a distributed world.

• Support for resource sharing (grids), Internet commerce (web services),

ambient intelligence (e.g. via UMTS), ...

• Addressing issues that go beyond concurrent and distributed systems:

mobility, ubiquity, dynamicity, interactivity, ...

• “Computing is interaction!”

Page 6: Compositionality, Interaction, and Abstraction in Complex

Communicating Concurrent Systems

• Concurrency and communication are essential in complex computing

systems such as global computers.

• Any such system is composed of many interconnected parts that may

interact by exchanging information or simply synchronizing.

• Concurrency and communication are complementary notions.

• Diversity: each part acts concurrently with (independently of) other parts.

• Unity: achieved through communication among the various parts.

Page 7: Compositionality, Interaction, and Abstraction in Complex

• How can we model and analyze complex computing systems?

• Making no distinction of kind between systems and their parts enables

uniform reasoning at different abstraction levels: notion of process.

• A process may be decomposed into subprocesses for a certain purpose

or may be viewed as being atomic for other purposes.

• A process is a series of actions/events divided into:

– Internal actions, possibly due to subprocesses interaction.

– Interactions with the neighboring processes/external environment.

Page 8: Compositionality, Interaction, and Abstraction in Complex

• A computing system is characterized by its structure and its behavior.

• A process is an abstraction of the behavior of a computing system.

• The behavior of a complex computing system can be defined as its entire

capability of communication.

• Black-box view: the behavior of a system is exactly what is observable,

and to observe a system is exactly to communicate with it.

• The notion of process focusses on the behavioral aspects of a system

while neglecting its structural and physical attributes.

Page 9: Compositionality, Interaction, and Abstraction in Complex

• Consider a sequential system that:

– either performs action a followed by action b and then terminates;

– or performs action b followed by action a and then terminates.

• Consider another system that performs actions a and b in parallel:

– either action a terminates first and then action b terminates;

– or action b terminates first and then action a terminates.

• Interleaving view: for an external observer, a concurrent system behaves

like a sequential one obtained by interleaving the actions of its parts.

Page 10: Compositionality, Interaction, and Abstraction in Complex

Observational Semantics

• Computational systems featuring concurrency and communication are

often required to possess a high degree of reactivity to external stimuli

and are usually nonterminating.

• They are typically structured into a set of autonomous components

that can evolve independently of each other and from time to time can

exchange information or simply synchronize.

• Nondeterminism in the final result or in the computation can arise due

to the different speeds of the components, the interaction scheme among

the components, and the scheduling policies that are adopted.

Page 11: Compositionality, Interaction, and Abstraction in Complex

• The behavior of a sequential system can be defined as a mathematical

function that associates a finishing state with every possible start state.

• This input-output transformation approach for sequential systems is no

longer applicable in the case of communicating concurrent systems.

• Consider the following two fragments of sequential program:

(1) X := 1; (2) X := 0; X := X + 1;

• In the absence of interference, they have the same effect (X becomes 1).

• If the two fragments are executed concurrently, the final value of X is

not necessarily 1, but can be either 1 or 2 (cannot be deterministically predicted).

Page 12: Compositionality, Interaction, and Abstraction in Complex

• We cannot abstract from the intermediate states of the computation

when dealing with concurrent systems.

• Under the interleaving view of concurrency, the behavior of a concurrent

system can be defined as:

– A set of traces, with a trace being the sequence of actions performed

by the system during a computation (linear-time semantics).

– A computation tree or graph including all traces and selection points

in the behavior of the system (branching-time semantics).

• Need for behavioral relations to compare structurally different systems.

Page 13: Compositionality, Interaction, and Abstraction in Complex

Process Algebra

• Start in the late 1970’s / early 1980’s: Robin Milner, Tony Hoare, . . .

• Process: series of actions or events.

• Algebra: calculus of symbols combining according to certain laws.

• Calculus: system or method of calculation.

• Generalization of formal languages and automata theory focussing on

system behavior rather than language recognition and generation.

• “Is there a calculus for processes as basic as λ-calculus for functions?”

Page 14: Compositionality, Interaction, and Abstraction in Complex

• Conceived for understanding communicating concurrent systems and

their various aspects (nondeterminism, priority, probability, time, mobility, . . . ).

• Compositional modeling by means of behavioral operators expressing

concepts like the sequential composition, the alternative composition,

and the parallel composition of processes (represent the behavior of systems).

• Abstraction from certain details of system behavior by distinguishing

between visible and invisible actions (represent system activities).

• Behavioral comparison through equivalences (notion of same behavior) and

preorders (notion of behavior refinement).

Page 15: Compositionality, Interaction, and Abstraction in Complex

• Means for reasoning about the semantics of concurrent programming

(basic formalisms such as CCS, CSP, ACP, π-calculus, . . . ).

• Scientific impact witnessed by a rich literature and the development of

formal description techniques and automated software tools for system

modeling and analysis (ISO language LOTOS; tools CADP, CWB, FDR, µCRL, . . . ).

• Process calculi and behavioral equivalences yielding process algebra

used for teaching:

¯ Foundations of concurrent programming.

¯ Model-based design of concurrent, distributed, and mobile systems.

Page 16: Compositionality, Interaction, and Abstraction in Complex

• Process algebra is the linguistic counterpart of computational models

developed for communicating concurrent systems.

• Support for the (automata-based) interleaving view of concurrency:

¯ Trace model.

¯ Synchronization tree model.

• Support for the true concurrency view.

¯ Petri net model.

¯ Event structure model.

Page 17: Compositionality, Interaction, and Abstraction in Complex

• Process algebra constitutes a different approach to dynamical systems.

• Basic elements:

behaviors instead of numerically quantified characteristics.

• Combinators:

behavioral operators instead of the arithmetical operators +,−,×, /.

• Relations:

behavioral equivalences and preorders instead of the usual =,≤.

• Dynamics:

behavioral equations instead of differential equations.

Page 18: Compositionality, Interaction, and Abstraction in Complex

Running Example: Producer-Consumer System

• General description:

¯ Three components: producer, finite-capacity buffer, consumer.

¯ The producer deposits items into the buffer as long as the buffer

capacity is not exceeded.

¯ Stored items are then withdrawn by the consumer according to some

predefined discipline (like FIFO or LIFO).

• Specific scenario:

¯ The buffer has only two positions.

¯ Items are identical, hence the discipline is not important.

Page 19: Compositionality, Interaction, and Abstraction in Complex

Part II:Process Calculi

Page 20: Compositionality, Interaction, and Abstraction in Complex

Process Calculi Syntax

• Specification language for communicating concurrent systems.

• Support for compositionality (building complex models by combining simpler models).

• Capability of abstraction (neglecting certain details of a model).

• Based on actions and behavioral operators.

• Namev: set of visible action names.

• Name = Namev ∪ {τ}: set of all action names.

• Relab = {ϕ : Name → Name | ϕ−1(τ) = {τ}}: set of visibility-preserv.

relabeling functions.

• Var : set of process variables (Const: set of process constants).

Page 21: Compositionality, Interaction, and Abstraction in Complex

• Process term syntax for process language PL:

P ::= 0 inactive process

| a . P action prefix (a ∈ Name)

| P + P alternative composition

| P ‖S P parallel composition (S ⊆ Namev)

| P / H hiding (H ⊆ Namev)

| P \L restriction (L ⊆ Namev)

| P [ϕ] relabeling (ϕ ∈ Relab)

| X process variable (X ∈ Var)

| rec X : P recursion (X ∈ Var)

(recursion is alternatively expressed by means of equations of the form B∆= P ).

Page 22: Compositionality, Interaction, and Abstraction in Complex

• P1 + P2 behaves as P1 or P2 depending on which executes first.

• The choice among several enabled actions is solved nondeterministically.

• The choice is internal if the enabled actions are all invisible, otherwise

the choice can be influenced by the external environment.

• P1 ‖S P2 behaves as P1 in parallel with P2 under synchronization set S.

• Actions whose name does not belong to S are executed autonomously

by P1 and by P2.

• Synchronization is forced between any action enabled by P1 and any

action enabled by P2 that have the same name belonging to S, in which

case the resulting action has the same name as the two original actions

(S = ∅ implies P1 and P2 fully independent, S = Namev implies P1 and P2 fully synchronized).

Page 23: Compositionality, Interaction, and Abstraction in Complex

• 0 is a terminated process and hence cannot execute any action.

• a . P can perform a and then behaves as P (action-based sequential composition).

• P / H behaves as P but every action belonging to H is turned into τ

(abstraction mechanism; can be used for preventing a process from communicating).

• P \L behaves as P but every action belonging to L is forbidden

(same effect as P ‖L 0).

• P [ϕ] behaves as P but every action is renamed according to function ϕ

(redundance avoidance; encoding of the previous two operators if ϕ is non-visib.-pres./partial).

• Operator precedence: unary operators > + > ‖.• Operator associativity: + and ‖ are left associative.

Page 24: Compositionality, Interaction, and Abstraction in Complex

• rec X : P behaves as P with every free occurrence of process variable X

being replaced by rec X : P (same as B ∆= P with B being a process constant).

• A process variable is said to occur free in a process term if it is not in

the scope of a rec binder for that variable, otherwise it is said to be

bound in that process term.

• A process term is said to be closed if all of its occurrences of process

variables are bound, otherwise it is said to be open.

• A process term is said to be guarded iff all of its occurrences of process

variables are in the scope of action prefix operators.

• P: set of closed and guarded process terms (fully defined, finitely branching).

Page 25: Compositionality, Interaction, and Abstraction in Complex

• Running example (process syntax):

¯ Conventions: action names are verbs composed of lower-case letters,

process constant names are nouns starting with an upper-case letter.

¯ The only observable activities are deposits and withdrawals.

¯ Visible actions: deposit and withdraw .

¯ Structure-independent process algebraic description:

ProdCons0/2∆= deposit .ProdCons1/2

ProdCons1/2∆= deposit .ProdCons2/2 + withdraw .ProdCons0/2

ProdCons2/2∆= withdraw .ProdCons1/2

¯ Specification to which every correct implementation should conform.

Page 26: Compositionality, Interaction, and Abstraction in Complex

Process Calculi Semantics

• Mathematical model in the form of a state transition graph representing

all computations and branching points (synchronization tree if unwound).

• Keller transition systems (instead of Kripke structures) to elicit interaction.

• Every process term P ∈ P is mapped to a labeled transition system [[P ]]:

¯ Each state corresponds to a process term into which P can evolve.

¯ The initial state corresponds to P .

¯ Each transition from a source state to a target state is labeled with

the action that determines the corresponding state change.

• The transition relation −−−→P of [[P ]] is contained in the smallest subset

of P×Name × P that satisfies some Plotkin style operational semantic

rules defined by induction on the syntactical structure of process terms.

Page 27: Compositionality, Interaction, and Abstraction in Complex

• Derivation of one single transition at a time by applying the operational

semantic rules to the source state of the transition.

• Basic rule for action prefix, inductive rules for all the other operators.

• Different formats: dynamic operators (. +), static operators (‖ / \ [ ]).

• No rule for 0: [[0]] has a single state and no transitions.

• Operational semantic rule for action prefix:

a . Pa−−−→ P

• Operational semantic rule for recursion:

P{rec X : P ↪→ X} a−−−→ P ′

rec X : Pa−−−→ P ′

„B

∆= P Pa

−−−→ P ′

Ba

−−−→ P ′

«

Page 28: Compositionality, Interaction, and Abstraction in Complex

• Operational semantic rules for alternative composition:

P1

a−−−→ P ′1

P1 + P2

a−−−→ P ′1

P2

a−−−→ P ′2

P1 + P2

a−−−→ P ′2

• If several actions are initially enabled, the choice among them is solved

nondeterministically due to the absence of precise criteria or

quantitative information (if-then-else, priority, probability, time).

• The choice is internal if the initially enabled actions are all invisible.

• Otherwise the choice can be influenced by the external environment.

Page 29: Compositionality, Interaction, and Abstraction in Complex

• Operational semantic rules for parallel execution:

P1

a−−−→ P ′1 a /∈ S

P1 ‖S P2

a−−−→ P ′1 ‖S P2

P2

a−−−→ P ′2 a /∈ S

P1 ‖S P2

a−−−→ P1 ‖S P ′2

• Operational semantic rule for synchronization:

P1

a−−−→ P ′1 P2

a−−−→ P ′2 a ∈ S

P1 ‖S P2

a−−−→ P ′1 ‖S P ′2

• Parallel composition is thus given an interleaving semantics.

Page 30: Compositionality, Interaction, and Abstraction in Complex

• The following process terms represent structurally different systems:

a . b . 0 + b . a . 0

a . 0 ‖∅ b . 0

but they are indistinguishable by an external observer.

• Black-box semantics given by the same labeled transition system:

b

ab

a

• Truly concurrent semantics are possible (via Petri net or event structure models)

in which causally independent activities can also occur simultaneously.

Page 31: Compositionality, Interaction, and Abstraction in Complex

• Operational semantic rules for hiding, restriction, relabeling:

Pa−−−→ P ′ a ∈ H

P / Hτ−−−→ P ′ / H

Pa−−−→ P ′ a /∈ H

P / Ha−−−→ P ′ / H

Pa−−−→ P ′ a /∈ L

P \La−−−→ P ′ \L

Pa−−−→ P ′

P [ϕ]ϕ(a)

−−−→ P ′[ϕ]

• [[P ]] is finite state if no recursive definition in P contains static operators.

Page 32: Compositionality, Interaction, and Abstraction in Complex

• Running example (process semantics):

¯ Labeled transition system [[ProdCons0/2]] with explicit states:

deposit withdraw

deposit withdraw

ProdCons1/2

ProdCons2/2

ProdCons0/2

¯ Obtained by mechanically applying the operational semantic rules

for process constant, alternative composition, and action prefix.

Page 33: Compositionality, Interaction, and Abstraction in Complex

Computational Power of Process Calculi

• Process calculi with the considered operators (in particular, recursion)

have full computational power.

• A Turing machine can be simulated by two stacks together with a

finite-state control mechanism.

• In a process calculus, the interaction of the control mechanism with

the two stacks can be represented through parallel composition.

• The finite-state control mechanism can be represented by making use

of action prefix, alternative composition, and recursion:

Qi∆= ai,j1 . Qj1 + ai,j2 . Qj2 + . . . + ai,jni

. Qjni

Page 34: Compositionality, Interaction, and Abstraction in Complex

• A stack for a set V of values can be inductively specified as follows:

Stack(ε)∆=

Pv∈V

pushv .Stack(v) + signal empty .Stack(ε)

Stack(v :: σ)∆=

Pw∈V

pushw .Stack(w :: v :: σ) + popv .Stack(σ)

where ε is the empty sequence and σ belongs to V ∗.

• Infinitely many equations to be implemented because V ∗ is countable.

• Infinitely branching summations to be implemented if V is infinite.

• V must be finite in a Turing machine.

Page 35: Compositionality, Interaction, and Abstraction in Complex

• Finite implementation for a finite set V of values based on as many cells

as there are values, which are linked together as needed (|V |+ 2 equations):

Cellv∆=

Pw∈V

pushw . (CellwbCellv) + popv . Inactive

Inactive∆=

Pu∈V

new topu .Cellu + last cell .Empty

Empty∆=

Pw∈V

pushw . (CellwbEmpty) + signal empty .Empty

• Definition of the auxiliary linking operator:

PbQ ∆= P [dec/new top , e/last cell ] ‖{inc,dec,e}

Q[inc/push , dec/pop , e/signal empty ]

Page 36: Compositionality, Interaction, and Abstraction in Complex

Part III:Behavioral Equivalences

Page 37: Compositionality, Interaction, and Abstraction in Complex

Behavioral Equivalences for PA

• Establishing whether two process terms are equivalent amounts to

establishing whether the systems they represent behave the same.

• Preservation of compositionality and abstraction should be achieved.

• Useful for theoretical and applicative purposes:

¯ Comparing syntactically different process terms on the basis of the

behavior they exhibit.

¯ Relating process algebraic descriptions of the same system at

different abstraction levels (top-down modeling).

¯ Manipulating process algebraic descriptions in a way that preserves

certain properties (state space reduction before analysis).

Page 38: Compositionality, Interaction, and Abstraction in Complex

• Features of a good behavioral equivalence:

¯ Being a congruence with respect to all the behavioral operators,

so as to support compositional reasoning.

¯ Having a sound and complete axiomatization, which elucidates the

fundamental equational laws of the equivalence with respect to the

behavioral operators (rewriting rules for syntactical manipulation).

¯ Having a logical characterization, which shows the behavioral

properties preserved by the equivalence (diagnostic information).

¯ Being equipped with an efficient verification algorithm, which runs

in polynomial time in the worst case (finite-state systems – undecidable o.w.).

¯ Being able to abstract from invisible actions.

• Three fundamental approaches: trace, bisimulation, testing.

Page 39: Compositionality, Interaction, and Abstraction in Complex

• Trace approach (Hoare et al.): two processes are equivalent if they are

able to execute the same sequences of actions (≈Tr).

• Total abstraction from branching points leads to deadlock insensitivity:

rec X : a . X + a . 0 ≈Tr rec X : a . X but the first one can deadlock.

• Deadlock-sensitive (hence finer) variants of trace equivalence:

¯ Completed-trace equivalence: it compares process terms also with

respect to traces that lead to deadlock (≈Tr,c).

¯ Failure equivalence: it takes into account the sets of visible actions

that can be refused after executing a trace (≈F).

¯ Readiness equivalence: it takes into account the sets of visible

actions that are enabled after executing a trace (≈R).

¯ Failure-trace equivalence: it takes into account the sets of visible

actions that can be refused at each step of a trace (≈FTr).

¯ Ready-trace equivalence: it takes into account the sets of visible

actions that are enabled at each step of a trace (≈RTr).

Page 40: Compositionality, Interaction, and Abstraction in Complex

• Bisimulation approach (Milner, Park): two processes are equivalent if

they are able to mimic each other’s behavior stepwise (∼B).

• Faithful account of branching points leads to overdiscrimination:

a . b . c . 0 + a . b . d . 0 6∼B a . (b . c . 0 + b . d . 0) is hardly justifiable.

• Coarser variants of bisimulation equivalence:

¯ Simulation equivalence: it is the intersection of two preorders, each

of which considers the capability of stepwise behavior mimicking in

one single direction (∼S).

¯ Failure-simulation equivalence: same as simulation equivalence, with

in addition the fact that each of the two preorders checks for the

equality of the sets of actions that can be stepwise refused (∼FS).

¯ Ready-simulation equivalence: same as simulation equivalence, with

in addition the fact that each of the two preorders checks for the

equality of the sets of actions that are stepwise enabled (∼RS).

Page 41: Compositionality, Interaction, and Abstraction in Complex

• Testing approach (De Nicola & Hennessy): two processes are equivalent

if their reaction to tests is the same (≈Te).

• Tests formalized as processes extended with a success action/state.

• Interaction between process and test formalized as parallel composition.

• It holds that a . b . c . 0 + a . b . d . 0 ≈Te a . (b . c . 0 + b . d . 0).

• Intersection of may-testing equivalence (at least one computation leads to success)

and must-testing equivalence (all computations lead to success).

• May-testing equivalence coincides with trace equivalence.

• Testing equivalence coincides with failure equivalence for nondiverging,

finitely-branching processes.

• Checking whether every test may/must be passed.

Page 42: Compositionality, Interaction, and Abstraction in Complex

• Linear-time/branching-time spectrum for finitely-branching processes

with no τ -actions (Van Glabbeek):

~B

~S

~RS~FS

~~RTr

~~R ~~FTr

~~F~Te~

~~Tr,c

~~Tr

Page 43: Compositionality, Interaction, and Abstraction in Complex

Bisimulation Equivalence

• Whenever a process term can perform a certain action, then any process

term equivalent to the given one has to be able to perform that action,

and the derivative process terms must still be equivalent to each other.

• A binary relation B over P is a bisimulation iff, whenever (P1, P2) ∈ B,

then for all actions a ∈ Name:

¯ Whenever P1

a−−−→ P ′1, then P2

a−−−→ P ′2 with (P ′1, P′2) ∈ B.

¯ Whenever P2

a−−−→ P ′2, then P1

a−−−→ P ′1 with (P ′1, P′2) ∈ B.

• Bisimulation equivalence ∼B is the union of all the bisimulations.

• Coinductive definition.

Page 44: Compositionality, Interaction, and Abstraction in Complex

• In order for P1 ∼B P2, it is necessary that for all a ∈ Name there exist

P ′1, P′2 ∈ P such that:

P1

a−−−→ P ′1 ⇐⇒ P2

a−−−→ P ′2

• A binary relation B over P is a bisimulation up to ∼B iff, whenever

(P1, P2) ∈ B, then for all actions a ∈ Name:

¯ Whenever P1

a−−−→ P ′1, then P2

a−−−→ P ′2 with P ′1 ∼B Q1BQ2 ∼B P ′2.

¯ Whenever P2

a−−−→ P ′2, then P1

a−−−→ P ′1 with P ′1 ∼B Q1BQ2 ∼B P ′2.

• Focus on important pairs of process terms that form a bisimulation.

• In order for P1 ∼B P2, it is sufficient to find a bisimulation up to ∼B

that contains (P1, P2).

Page 45: Compositionality, Interaction, and Abstraction in Complex

• ∼B is a congruence with respect to all the dynamic and static operators

as well as recursion.

• Substituting equals for equals does not alter the overall meaning in any

process context.

• Let P1, P2 ∈ P. Whenever P1 ∼B P2, then:

a . P1 ∼B a . P2

P1 + P ∼B P2 + P P + P1 ∼B P + P2

P1 ‖S P ∼B P2 ‖S P P ‖S P1 ∼B P ‖S P2

P1 / H ∼B P2 / H

P1 \L ∼B P2 \L

P1[ϕ] ∼B P2[ϕ]

Page 46: Compositionality, Interaction, and Abstraction in Complex

• Recursion: extend ∼B to open process terms by replacing all variables

freely occurring outside rec binders with every closed process term.

• Let P1, P2 ∈ PL be guarded process terms containing free occurrences

of k ∈ N process variables X1, . . . , Xk ∈ Var at most.

• We define P1 ∼B P2 iff:

P1{Qi ↪→ Xi | 1 ≤ i ≤ k} ∼B P2{Qi ↪→ Xi | 1 ≤ i ≤ k}

for all Q1, . . . , Qk ∈ P.• Whenever P1 ∼B P2, then:

rec X : P1 ∼B rec X : P2

Page 47: Compositionality, Interaction, and Abstraction in Complex

• ∼B has a sound and complete axiomatization over the set Pnrec of

nonrecursive process terms of P.

• Basic laws (commutativity, associativity, and neutral element of +):

(AB,1) P1 + P2 = P2 + P1

(AB,2) (P1 + P2) + P3 = P1 + (P2 + P3)

(AB,3) P + 0 = P

• Characterizing laws (idempotency of +, not valid for synchronization tree isomorphism):

(AB,4) P + P = P

Page 48: Compositionality, Interaction, and Abstraction in Complex

• Expansion law (interleaving view of concurrency; I and J nonempty and finite):

(AB,5)Pi∈I

ai . Pi ‖S

Pj∈J

bj . Qj =P

k∈I,ak /∈S

ak .

Pk ‖S

Pj∈J

bj . Qj

!+

Ph∈J,bh /∈S

bh .

„Pi∈I

ai . Pi ‖S Qh

«+

Pk∈I,ak∈S

Ph∈J,bh=ak

ak . (Pk ‖S Qh)

(AB,6)Pi∈I

ai . Pi ‖S 0 =P

k∈I,ak /∈S

ak . Pk

(AB,7) 0 ‖S

Pj∈J

bj . Qj =P

h∈J,bh /∈S

bh . Qh

(AB,8) 0 ‖S 0 = 0

Page 49: Compositionality, Interaction, and Abstraction in Complex

• Distribution laws (for unary static operators):

(AB,9) 0 /H = 0

(AB,10) (a . P ) /H = τ . (P /H) if a ∈ H(AB,11) (a . P ) /H = a . (P /H) if a /∈ H(AB,12) (P1 + P2) /H = P1 /H + P2 /H

(AB,13) 0 \L = 0

(AB,14) (a . P ) \L = 0 if a ∈ L(AB,15) (a . P ) \L = a . (P \L) if a /∈ L(AB,16) (P1 + P2) \L = P1 \L+ P2 \L

(AB,17) 0[ϕ] = 0

(AB,18) (a . P )[ϕ] = ϕ(a) . (P [ϕ])

(AB,19) (P1 + P2)[ϕ] = P1[ϕ] + P2[ϕ]

Page 50: Compositionality, Interaction, and Abstraction in Complex

• DED(AB): deduction system based on all the previous axioms plus:

¯ Reflexivity: AB ` P = P .

¯ Symmetry: AB ` P1 = P2 =⇒ AB ` P2 = P1.

¯ Transitivity: AB ` P1 = P2 ∧ AB ` P2 = P3 =⇒ AB ` P1 = P3.

¯ Substitutivity: AB ` P1 = P2 =⇒ AB ` a . P1 = a . P2 ∧ . . .

• The deduction system DED(AB) is sound and complete for ∼B

over Pnrec; i.e., for all P1, P2 ∈ Pnrec:

AB ` P1 = P2 ⇐⇒ P1 ∼B P2

Page 51: Compositionality, Interaction, and Abstraction in Complex

• ∼B has a modal logic characterization based on Hennessy-Milner logic.

• Basic truth values and propositional connectives, plus modal operators

expressing how to behave after executing certain actions.

• Syntax of the modal language HML (a ∈ Name):

φ ::= true basic truth value

| ¬φ negation

| φ ∧ φ conjunction

| 〈a〉φ possibility

plus derived logical operators:

false ≡ ¬true basic truth value

φ1 ∨ φ2 ≡ ¬(¬φ1 ∧ ¬φ2) disjunction

[a]φ ≡ ¬〈a〉¬φ necessity

Page 52: Compositionality, Interaction, and Abstraction in Complex

• Interpretation of HML over P:

P |= true

P |= ¬φ if P 6|= φ

P |= φ1 ∧ φ2 if P |= φ1 and P |= φ2

P |= 〈a〉φ if there exists P ′ ∈ P such that Pa−−−→ P ′ and P ′ |= φ

plus derived logical operators:

P 6|= false

P |= φ1 ∨ φ2 if P |= φ1 or P |= φ2

P |= [a]φ if for all P ′ ∈ P, whenever Pa

−−−→ P ′, then P ′ |= φ

• For all P1, P2 ∈ P:P1 ∼B P2 ⇐⇒ (∀φ ∈ HML. P1 |= φ ⇐⇒ P2 |= φ)

Page 53: Compositionality, Interaction, and Abstraction in Complex

• ∼B has a temporal logic characterization based on CTL*.

• State formulae with atomic propositions and propositional connectives,

plus path formulae including temporal operators about the future.

• A path π is a sequence of states s0s1s2 . . . such that si reaches si+1.

• CTL* is interpreted over Kripke structures, hence we redefine ∼B

(propositions labeling states instead of actions labeling transitions).

• A binary relation B over Kripke structure (S,L, −−−→) is a bisimulation

iff, whenever (s1, s2) ∈ B, then L(s1) = L(s2) and:

¯ Whenever s1−−−→ s′1, then s2−−−→ s′2 with (s′1, s′2) ∈ B.

¯ Whenever s2−−−→ s′2, then s1−−−→ s′1 with (s′1, s′2) ∈ B.

• Bisimulation equivalence ∼B is the union of all the bisimulations.

Page 54: Compositionality, Interaction, and Abstraction in Complex

• Syntax of the temporal language CTL*:

φ ::= ap atomic proposition

| ¬φ state formula negation

| φ ∧ φ state formula conjunction

| Eψ existential path quantifier

ψ ::= φ state formula

| ¬ψ path formula negation

| ψ ∧ ψ path formula conjunction

| Xψ next operator

| ψUψ until operator

plus derived logical operators:

Aψ ≡ ¬E¬ψ universal path quantifier

Fψ ≡ trueUψ eventually operator

Gψ ≡ ¬F¬ψ globally operator

Page 55: Compositionality, Interaction, and Abstraction in Complex

• Interpretation of CTL* over Kripke structure (S,L, −−−→):

s |= ap if ap ∈ L(s)

s |= ¬φ if s 6|= φ

s |= φ1 ∧ φ2 if s |= φ1 and s |= φ2

s |= Eψ if there exists a path π starting from s such that π |= ψ

π |= φ if π[0] |= φ

π |= ¬ψ if π 6|= ψ

π |= ψ1 ∧ ψ2 if π |= ψ1 and π |= ψ2

π |= Xψ if π1 |= ψ

π |= ψ1 Uψ2 if πk |= ψ2 for some k ≥ 0 and πi |= ψ1 for all 0 ≤ i < k

• For all s1, s2 ∈ S:

s1 ∼B s2 ⇐⇒ (∀φ ∈ CTL∗. s1 |= φ ⇐⇒ s2 |= φ)

Page 56: Compositionality, Interaction, and Abstraction in Complex

• ∼B is decidable in polynomial time over the set Pfin of finite-state

process terms of P with Paige-Tarjan partition refinement algorithm.

• Based on the fact that ∼B can be characterized as the limit of a sequence

of successively finer equivalence relations (original definition of bisimilarity):

∼B =T

i∈N∼B,i

• ∼B,0 = P× P hence it induces the trivial partition {P}.• Whenever P1 ∼B,i P2, i ∈ N≥1, then for all actions a ∈ Name:

¯ Whenever P1

a−−−→ P ′1, then P2

a−−−→ P ′2 with P ′1∼B,i−1 P ′2.

¯ Whenever P2

a−−−→ P ′2, then P1

a−−−→ P ′1 with P ′1∼B,i−1 P ′2.

• ∼B,1 refines {P} by creating an equivalence class for each set of process

terms that satisfy the necessary condition for ∼B.

Page 57: Compositionality, Interaction, and Abstraction in Complex

• Steps of the algorithm for checking whether P1 ∼B P2:

1. Build an initial partition with a single class including all the states

of [[P1]] and all the states of [[P2]].

2. Initialize a list of splitters with the above class as its only element.

3. While the list of splitters is not empty, select a splitter and remove it

from the list after refining the current partition for all a∈NameP1,P2 :

a. Split each class of the current partition by comparing its states

when executing actions of name a that lead to the selected splitter.

b. For each class that has been split, insert its smallest subclass into

the list of splitters.

4. Return yes/no depending on whether the initial states of [[P1]] and

[[P2]] belong to the same class of the final partition or not.

• The time complexity is O(m · log n), where n is the number of states

and m is the number of transitions of [[P1]] and [[P2]] (also for minimization).

Page 58: Compositionality, Interaction, and Abstraction in Complex

• Running example (bisimulation equivalence):

¯ Concurrent implementation (with two independent one-position buffers):

PC conc,2∆= Prod ‖{deposit} (Buff ‖∅ Buff ) ‖{withdraw} Cons

Prod∆= deposit .Prod

Buff∆= deposit .withdraw .Buff

Cons∆= withdraw .Cons

¯ Bisimulation proving PC conc,2 ∼B ProdCons0/2:

||∅||{d} ||{w}

||∅||{d} ||{w} ||∅||{d} ||{w}

||∅||{d} ||{w}

deposit

deposit deposit withdraw

deposit withdraw

ProdCons1/2

ProdCons2/2

ProdCons0/2

deposit

deposit

withdraw withdraw

withdrawwithdraw

BB( )P C

BB( )P C BB( )P C

BB( )P C

Page 59: Compositionality, Interaction, and Abstraction in Complex

Weak Bisimulation Equivalence

• ∼B does not abstract from invisible actions: a . b . 0 6∼B a . τ . b . 0.

• Two process terms should be considered equivalent in the bisimulation

approach if they are able to mimic each other’s visible behavior stepwise.

• Extending the transition relation −−−→ to action sequences.

• Pa1...an====⇒ P ′ iff:

¯ either n = 0 and P ≡ P ′, meaning that P stays idle;

¯ or n ≥ 1 and there exist P0, P1, . . . , Pn ∈ P such that:

∗ P ≡ P0;

∗ Pi−1

ai−−−→ Pi for all 1 ≤ i ≤ n;

∗ Pn ≡ P ′.

Page 60: Compositionality, Interaction, and Abstraction in Complex

• A binary relation B over P is a weak bisimulation iff, whenever

(P1, P2) ∈ B, then:

¯ Whenever P1

τ−−−→ P ′1, then P2τ∗

====⇒ P ′2 with (P ′1, P′2) ∈ B.

¯ Whenever P2

τ−−−→ P ′2, then P1τ∗

====⇒ P ′1 with (P ′1, P′2) ∈ B.

and for all visible actions a ∈ Namev:

¯ Whenever P1

a−−−→ P ′1, then P2τ∗aτ∗

====⇒ P ′2 with (P ′1, P′2) ∈ B.

¯ Whenever P2

a−−−→ P ′2, then P1τ∗aτ∗

====⇒ P ′1 with (P ′1, P′2) ∈ B.

• Weak bisimulation equivalence ≈B is the union of all the weak

bisimulations.

• Coinductive definition.

Page 61: Compositionality, Interaction, and Abstraction in Complex

• ≈B is a congruence with respect to all the behavioral operators except

for alternative composition (not a problem in practice).

• Additional τ -laws highlighting abstraction capabilities:

τ . P = P

a . τ . P = a . P

P + τ . P = τ . P

a . (P1 + τ . P2) + a . P2 = a . (P1 + τ . P2)

• Weak modal operators replacing those of HML (a ∈ Namev):

P |= 〈〈τ〉〉φ if there exists P ′ ∈ P such that Pτ∗

====⇒ P ′ and P ′ |= φ

P |= 〈〈a〉〉φ if there exists P ′ ∈ P such that Pτ∗aτ∗

====⇒ P ′ and P ′ |= φ

• Temporal logic characterization based on CTL* without X.

Page 62: Compositionality, Interaction, and Abstraction in Complex

• P1 ≈B P2 can be decided in O(n2 ·m · log n) time with the verification

algorithm for ∼B preceded by the following preprocessing step:

0. Build the reflexive and transitive closure ofτ−−−→ in [[Pi]] for i = 1, 2:

a. Add a looping τ -transition to each state.

b. Add a τ -transition between the initial state and the final state of

any sequence of at least two τ -transitions, if the two states are

distinct and all the transitions in the sequence are distinct and

nonlooping.

c. Add an a-transition, a ∈ Namev, between the initial state and

the final state of any sequence of at least two transitions in which

one is labeled with a, if all the other transitions in the sequence

are labeled with τ , distinct, and nonlooping.

Page 63: Compositionality, Interaction, and Abstraction in Complex

• The fact that ≈B is not a congruence with respect to the alternative

composition operator stems from τ . P = P (abstraction from initial τ-actions).

• This τ -law cannot be freely used in all contexts when P is stable:

τ . a . 0 ≈B a . 0 but τ . a . 0 + b . 0 6≈B a . 0 + b . 0.

• Congruence w.r.t. the alternative composition operator can be restored

by enforcing a matching on initial τ -actions in the definition.

• P1 ∈ P is weakly bisimulation congruent to P2 ∈ P, written P1 ≈cB P2,

iff for all actions a ∈ Name (hence including τ):

¯ Whenever P1

a−−−→ P ′1, then P2τ∗aτ∗

====⇒ P ′2 with P ′1≈B P ′2.

¯ Whenever P2

a−−−→ P ′2, then P1τ∗aτ∗

====⇒ P ′1 with P ′1≈B P ′2.

• ≈cB is the largest congruence contained in ≈B.

Page 64: Compositionality, Interaction, and Abstraction in Complex

• ≈B does not fully retain the property possessed by ∼B of respecting the

branching structure of process terms.

• Given P1 ≈B P2, when P1

a−−−→ P ′1 then P2τ∗

====⇒Qa−−−→Q′

τ∗====⇒ P ′2

with P ′1 ≈B P ′2 . . .

• . . . but we do not know whether any relation exists between P1 and Q

and between P ′1 and Q′.

• The property can be restored by requiring that P1 be equivalent to Q

and that P ′1 be equivalent to Q′.

• The resulting equivalence is branching bisimulation equivalence (≈B,b).

• Characterized by a single τ -law: a . (τ . (P1 + P2) + P1) = a . (P1 + P2).

• ≈B,b coincides with ≈B on any pair of process terms with at most one

of them reaching unstable process terms.

Page 65: Compositionality, Interaction, and Abstraction in Complex

• Running example (weak bisimulation equivalence):

¯ Pipeline implementation (with two communicating one-position buffers):

PCpipe,2∆= Prod ‖{deposit} (LBuff ‖{pass} RBuff ) / {pass} ‖{withdraw} Cons

Prod∆= deposit .Prod

LBuff∆= deposit . pass .LBuff

RBuff∆= pass .withdraw .RBuff

Cons∆= withdraw .Cons

¯ Weak bisimulation proving PC pipe,2 ≈B ProdCons0/2:

||{d} ||{w}||{ }p

||{d} ||{w}||{ }p

||{d} ||{w}||{ }p ||{d} ||{w}||{ }p(P LB RB)/{p} Cτ

(P LB RB)/{p} C

(P LB RB)/{p} C

(P LB RB)/{p} C ProdCons1/2

ProdCons2/2

ProdCons0/2

deposit

deposit

withdraw

withdraw

withdraw deposit

withdrawdeposit

Page 66: Compositionality, Interaction, and Abstraction in Complex

References[1] S. Abramsky, “Observational Equivalence as a Testing Equivalence”, in Theoretical Computer Sci-

ence 53:225–241, 1987.

[2] A. Aldini, M. Bernardo, and F. Corrardini, “A Process Algebraic Approach to Software Architecture

Design”, Springer, 2010.

[3] J.C.M. Baeten and W.P. Weijland, “Process Algebra”, Cambridge University Press, 1990.

[4] H. Bekic, “Towards a Mathematical Theory of Processes”, Tech. Rep. TR 25.125, IBM Labora-tory Vienna (Austria), 1971 (published in “Programming Languages and Their Definition”, Springer,LNCS 177:168–206, 1984).

[5] J.A. Bergstra and J.W. Klop, “Process Algebra for Synchronous Communication”, in Information andControl 60:109–137, 1984.

[6] J.A. Bergstra, A. Ponse, and S.A. Smolka (eds.), “Handbook of Process Algebra”, Elsevier, 2001.

[7] B. Bloom, S. Istrail, and A.R. Meyer, “Bisimulation Can’t Be Traced”, in Journal of theACM 42:232–268, 1995.

[8] T. Bolognesi and E. Brinksma, “Introduction to the ISO Specification Language LOTOS”, in ComputerNetworks and ISDN Systems 14:25–59, 1987.

[9] S.D. Brookes, C.A.R. Hoare, and A.W. Roscoe, “A Theory of Communicating Sequential Processes”,in Journal of the ACM 31:560–599, 1984.

[10] M.C. Browne, E.M. Clarke, and O. Grumberg, “Characterizing Finite Kripke Structures in Propositional

Temporal Logic”, in Theoretical Computer Science 59:115–131, 1988.

[11] R. Cleaveland and M. Hennessy, “Testing Equivalence as a Bisimulation Equivalence”, in Formal As-pects of Computing 5:1–20, 1993.

Page 67: Compositionality, Interaction, and Abstraction in Complex

[12] R. Cleaveland, J. Parrow, and B. Steffen, “The Concurrency Workbench: A Semantics-Based Tool for the

Verification of Concurrent Systems”, in ACM Trans. on Programming Languages and Systems 15:36–72, 1993.

[13] R. Cleaveland and O. Sokolsky, “Equivalence and Preorder Checking for Finite-State Systems”,in [6]:391–424.

[14] R. De Nicola, “Extensional Equivalences for Transition Systems”, in Acta Informatica 24:211–237,1987.

[15] R. De Nicola and M. Hennessy, “Testing Equivalences for Processes”, in Theoretical Computer Sci-ence 34:83–133, 1984.

[16] H. Garavel, R. Mateescu, F. Lang, and W. Serwe, “CADP 2006: A Toolbox for the Construction

and Analysis of Distributed Processes”, in Proc. of the 19th Int. Conf. on Computer Aided Verification

(CAV 2007), Springer, LNCS 4590:158–163, Berlin (Germany), 2007.

[17] R.J. van Glabbeek, “The Linear Time – Branching Time Spectrum I”, in [6]:3–99.

[18] R.J. van Glabbeek and W.P. Weijland, “Branching Time and Abstraction in Bisimulation Semantics”,in Journal of the ACM 43:555–600, 1996.

[19] M. Hennessy, “Acceptance Trees”, in Journal of the ACM 32:896–928, 1985.

[20] M. Hennessy, “Algebraic Theory of Processes”, MIT Press, 1988.

[21] M. Hennessy and R. Milner, “Algebraic Laws for Nondeterminism and Concurrency”, in Journal of theACM 32:137–162, 1985.

[22] C.A.R. Hoare, “Communicating Sequential Processes”, Prentice Hall, 1985.

[23] P.C. Kanellakis and S.A. Smolka, “CCS Expressions, Finite State Processes, and Three Problems of

Equivalence”, in Information and Computation 86:43–68, 1990.

[24] R.M. Keller, “Formal Verification of Parallel Programs”, in Communications of the ACM 19:371–384,1976.

Page 68: Compositionality, Interaction, and Abstraction in Complex

[25] R. Milner, “A Calculus of Communicating Systems”, Springer, LNCS 92, 1980.

[26] R. Milner, “Communication and Concurrency”, Prentice Hall, 1989.

[27] R. Milner, “Communicating and Mobile Systems: The π-Calculus”, Cambridge University Press, 1999.

[28] R. Milner, J. Parrow, and D. Walker, “A Calculus of Mobile Processes”, in Information and Com-putation 100:1–77, 1992.

[29] E.-R. Olderog and C.A.R. Hoare, “Specification-Oriented Semantics for Communicating Processes”, inActa Informatica 23:9–66, 1986.

[30] R. Paige and R.E. Tarjan, “Three Partition Refinement Algorithms”, in SIAM Journal on Comput-ing 16:973–989, 1987.

[31] D. Park, “Concurrency and Automata on Infinite Sequences”, in Proc. of the 5th GI Conf. on Theoretical

Computer Science, Springer, LNCS 104:167–183, Karlsruhe (Germany), 1981.

[32] C.A. Petri, “Kommunikation mit Automaten”, Ph.D. Thesis, Technical University of Darmstadt(Germany), 1962.

[33] G.D. Plotkin, “A Structural Approach to Operational Semantics”, Tech. Rep. DAIMI-FN-19,Aarhus University (Denmark), 1981 (published in Journal of Logic and Algebraic Program-ming 60/61:17–139, 2004).

[34] D. Sangiorgi and D. Walker, “The π-Calculus: A Theory of Mobile Processes”, Cambridge UniversityPress, 2001.

[35] D.S. Scott, “Data Types as Lattices”, in SIAM Journal on Computing 5:522–587, 1976.

[36] G. Winskel, “Events in Computation”, Ph.D. Thesis, University of Edinburgh (UK), 1980.