Process Library Implementation Notes
Author: Wieger Wesselink
Processes
Process expressions in mCRL2 are expressions built according to the following syntax:
Expression |
C++ equivalent |
ATerm grammar |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
where the types of the symbols are as follows:
strings (action names) |
|
a process identifier |
|
a sequence of data expressions |
|
a sequence of data variables |
|
a set of strings (action names) |
|
a sequence of rename expressions |
|
a sequence of communication expressions |
|
a sequence of multi actions |
|
a data expression of type real |
|
process expressions |
|
a data expression of type bool |
A rename expression is of the form , with
and
action names. A multi action is of the form
, with
actions. A communication expression is of the form
, with
and
action names.
Restrictions
A multi action is a multi set of actions. The left hand sides of the communication
expressions in must be unique. Also the left hand sides of the rename expressions
in
must be unique.
Linear process expressions
Linear process expressions are a subset of process expressions satisfying the following grammar:
<linear process expression> ::= choice(<linear process expression>, <linear process expression>)
| <summand>
<summand> ::= sum(<variables>, <alternative>)
| <conditional action prefix>
| <conditional deadlock>
<conditional action prefix> ::= if_then(<condition>, <action prefix>)
| <action prefix>
<action prefix> ::= seq(<timed multiaction>, <process reference>)
| <timed multiaction>
<timed multiaction> ::= at_time(<multiaction>, <time stamp>)
| <multiaction>
<multiaction> ::= tau()
| <action>
| sync(<multiaction>, <multiaction>)
<conditional deadlock> ::= if_then(<condition>, <timed deadlock>)
| <timed deadlock>
<timed deadlock> ::= delta()
| at_time(delta(), <time stamp>)
<process reference> ::= process(<process identifier>, <data expressions>)
| process_assignment(<process identifier>, <data assignments>)
Guarded process expressions
We define the predicate for process expressions as follows:
N.B. This specification assumes that process names are unique. In mCRL2 process names can be
overloaded, therefore in the implementation contains process identifiers (i.e. both
the process name and the sorts of the arguments) instead of process names.
Alphabet reduction
Alphabet reduction is a preprocessing step for linearization. It is a transformation on process
expressions that preserves branching bisimulation. The transformation distributes renaming
operators (allow, hide, rename, block, and comm) over the other process
operators, with the goal of reducing the number of multi-actions that arise during intermediate
steps of the linearization procedure.
Notations
In this text action names are represented using and multi action names
using
. So in general we have
. In alphabet reduction data parameters play a minor
role, therefore we choose a notation in which data parameters are omitted. We use the
abbreviation
to denote an action, and
to denote a multi
action, where
are data expressions. Note that a multi action is a
multiset (or bag) of actions and a multi action name is a multiset of names. We write
as shorthand for
and
for
. Sets of multi action names are represented using
. A communication
maps multi action names to action
names, and is denoted as
.
A renaming
is a substitution on action names, and is denoted as
. A block set
is a
set of action names. A hide set
is a set of action names.
Definitions
We define multi actions using the following grammar:
where is an action, and where
is used to distinguish
alternatives.
We define pCRL terms using the following grammar:
and parallel mCRL terms using the following grammar:
Remark 1
Note that there is an unfortunate overload of the -operator in both multi actions and
process expressions. This has consequences for the implementation, since there is no clean
distinction between parallel and non-parallel operators.
Remark 2
The mCRL2 language also has a construct
, but this is just a shorthand
notation. Therefore we will ignore it in this text.
Alphabet operations
Let ,
and
be sets of multi action names. Then we define
Note that can take the value
in the definition of
, which implies
.
The set
has an exponential size, so whenever possible it should not be
computed explicitly.
Let be a communication set, then we define
where and
are defined using
pseudo code as follows:
Note that .
Let be a rename set, then we define
Let be a hide set, then we define
Let be a block set, then we define
We define a mapping that extracts the individual action names of a set of multi
action names:
The mapping
We define the mapping as follows. The value
is an
over-approximation of the alphabet of process expression
.
Example 1
If , then
. Note that the action
does not occur in the transition system of this process expression.
Example 2
In the computation of
the above mentioned optimization is really needed.
Computation of the alphabet
When computing for some multi action name set
, it may be
beneficial to apply an optimization. This is done to keep intermediate expressions small. We
introduce
, and define it as follows:
More efficient computation of the alphabet
The computation of can be done more efficiently. We define the
function
as follows:
Using this function we can change the computation of at three places:
Note that the value can be computed on the fly during the
computation of
.
Bounded alphabet
In practice one often wants to compute . This can
be computed more efficiently as follows:
The mappings
,
and
We define mappings ,
and
such that
is bisimulation equivalent to
,
is bisimulation equivalent to
, and
is bisimulation equivalent to
. The goal
of these mappings is to push allow and block expressions deeply inside process expressions.
It is important to know that an allow set
in the expression
implicitly contains the empty multi action
. Let
be a sequence of process
equations.
We assume that is a unique name for every
, multi action name set
and sequence of data
expressions
.
Optimizations
During the computation of the following optimizations are applied in
the right hand side of each equation:
For non-pCRL expressions the alphabet is computed on the fly during the
computation of
.
Example 1
Let . Then
, with
.
Example 2
Let . Then
, with
.
We assume that is a unique name for every
, block set
and sequence of data expressions
.
where
Example 3
The presence of instead of just
in the
right hand side of the rename operator is explained by the example
. We see that
,
which is clearly the wrong answer.
Allow sets
There are two rules in the definition of where the allow set
can/should not be computed explicitly. The computation of
involves computation of
. We want to avoid the computation of
, since it can become very large. The computation of
involves computation of
. The set
is
infinite.
In the implementation we use allow sets of the form , where
is a set of multi action names and
is a set of action names. The
is optional and
may be empty. Such an allow set is stored
as two sets
and
, together with an attribute that tells if
is applicable. We need to show that allow sets are closed under the
operations in
.
where we used the following properties:
Note that in case of the communication we only have an inclusion relation instead of equality.
This is done to stay within the format . As a consequence the
implementation uses an over-approximation of
and
. Furthermore note that the property
does not hold. A counter example is
and
. In that case we have
and
. Another property that was initially
assumed, but that does not hold, is
.
Optimization for
In some cases the operator produces expressions that are too large.
This section proposes an optimization for the case
that can help to prevent this problem for certain practical cases.
with
and
and
Note that in this case the allow set has the general shape
(?), with the subset operator
optional, and with
possibly empty. To implement this
optimization, it needs to be investigated if such a set
is closed under the
operations
,
,
,
,
,
,
and
.