<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Compiling Protocols to Promela and Verifying their LTL Properties</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Benjamin Lion</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Amesterdam</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>The Netherland B.Lion@cwi.nl</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Samir Chouali</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>France schouali@femto-st.fr</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Component-based systems</institution>
          ,
          <addr-line>Reo circuits, verification, Promela/SPIN</addr-line>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>FEMTO-ST Institute/CNRS</institution>
          ,
          <addr-line>Besançon</addr-line>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Farhad Arbab CWI</institution>
          ,
          <addr-line>Amesterdam, The Netherland</addr-line>
        </aff>
        <aff id="aff3">
          <label>3</label>
          <institution>Univ. Bourgogne Franche-Comté</institution>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2018</year>
      </pub-date>
      <abstract>
        <p>Component-based systems can be modeled as black-box, standalone components, coordinated by an interaction protocol. In this paper we focus on developing reliable protocols, specified in a coordination language where their design, implementation, and property verification rely on the exact same model. In this context, to construct complex protocols compositionally, we use Reo, a powerful channel-based coordination language with well-defined semantics. We extend the current set of back-end languages supported by Reo's compiler with Promela, the specification language of the model checker SPIN. The automatic generation of Promela code from Reo specification enables system simulation and verification of LTL properties of Reo models using SPIN.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>INTRODUCTION</title>
      <p>Development of a complex distributed system relies, generally, on
assembling existing COTS (Commercial of-the-shelf) components
(or services), such that their interactions after the composition
manifest that of the required system. A major dificulty in developing
such systems involves the correctness of the interaction protocol
among their constituent heterogeneous components. As such,
correct behavior of individual component is insuficient to imply the
correctness of the composed system, because such system’s
behavior depends on the protocol that coordinates its components. Precise
specification and correctness of coordination protocols, thus, play
a crucial role in construction of complex distributed systems.</p>
      <p>
        Coordination languages, like Reo [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], ofer powerful "glue-code"
to specify interaction protocols. Reo ofers a non-traditional
interaction centric paradigm for design of concurrent system. It is a
coordination language, that supports exogenous composition of
components and services via explicit, composable, pure
interaction specifications. The Reo model of a concurrent system consists
of a set of components that interact with each other through a
set of externally specified protocol constructs, called, connectors,
that constrain synchronization and exchanges of data among those
components. Primitive and complex connectors are specified in a
graphical or textual syntax [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. Many semantic formalisms exist
for formal specification of the behavior of Reo connectors [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ].
      </p>
      <p>
        In this paper we propose to use Reo to guarantee a precise
speciifcation of complex protocols, and our main purpose is to propose
a formal approach for verifying their correctness. For that, we
propose to exploit the SPIN model checker [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] to verify safety and
liveness properties of the specified protocols.
      </p>
      <p>Our choice of SPIN is motivated by the fact that it is one of the
most employed model checkers, in both industrial and academic
communities, for detecting software defects in concurrent system
designs. SPIN has been applied to everything from the
verification of complex call processing software that is used in telephone
exchanges, to the validation of intricate control software for
interplanetary spacecraft. In SPIN, a formal specification is built using
Promela, which is an imperative language that resembles C in, .e.g,
variable and type declaration.</p>
      <p>To ensure the correctness of translation from Reo to Promela, we
present suficient conditions to compile a protocol into a Promela
program. We first introduce the notion of input/output designation,
to direct the data flow in the protocol. Then, we define an
environment as a set of processes that the protocol coordinates, and
write the functional response of the protocol from the environment
as a formula in guarded commands form. We finally present the
translation of the guarded commands to Promela, to verify their
LTL properties. We show the correctness of our translation by
considering the behavior of the protocol specified in Reo and Promela.
We demonstrate the relevance of our work in a case study involving
design and verification of a railway component-based system.</p>
      <p>
        Proofs of propositions and theorem are accessible at [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
2
      </p>
      <p>REO
Reo is a channel-based coordination language used for
compositional construction of coordinated systems. In this section, we
explain the terminology used in Reo, together with a graphical
syntax used to draw Reo circuit. We then present a logical syntax
for representation of exogenous constraints. We define a guarded
command form for logic formula, and use this structure to generate
executable and verifiable code.</p>
      <p>Terminology. The basic constructs in Reo consist of components,
ports, channels and nodes. A port is a unidirectional means of
synchronous exchange of data between two parties. Two operations
can be performed on a port: put and get. The unidirectionality of
a port means that each of the two parties on its two sides can use
the port exclusively either as input or as output. A party that uses
a port as output, can perform only put operations on that port, and
a party that uses a port as input can perform only get operations
on that port. A port fires whenever it has a get and a put operation
pending on its respective sides. Firing of a port transfers the data
item from the put operation to the get operation. A component is
defined with a set of ports at its boundary, called its interface. Each
port of an interface is either an input or an output port. When a
port is shared by two components, we say that those two
components are in composition. The port must be used as input in one
component, and as output in the other component. A component
can internally contain several components in composition, in which
case we say that the component is composite. A component is called
atomic if its behavior is defined in a specific formal semantic. A
binary component, meaning that one whose interface consists of
only two ports, is called a channel.</p>
      <p>
        As pictured in Fig. 1, we represent graphically some standard
Reo component. More details can be found in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. We define in the
next subsection a syntax to write the constraint relations among
the ports of a component. We later define a semantic of those
constraints as the set of data streams accepted by the constraint on
their respective ports of the component.
2.1
      </p>
    </sec>
    <sec id="sec-2">
      <title>Exogenous constraints as formula</title>
      <p>
        Logical constraints. We can express the externally observable
behavior of a component as a relation over the sequences of data
items that it exchanges with its environment through its ports. In
this view, an interaction protocols is a relation that constrains the
exchanges of data among the ports of various components. We can
use logic formulas to express these constraints. We usually
separate two types of constraints. A synchronization constraint relates
ifring of ports, and a data constraint relates the values exchanged
among ports. We follow the work of [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ], where they used a
special data item NO-FLOW (that we represent here as ∗) to encode
synchronization as data constraint.
      </p>
      <p>We use D to denote the set of data items that flow through
ports and are stored in memories. We use a special symbol ∗ &lt; D,
that represent no-data, to encode synchronization. We use D∗ to
denote the set D ∪ {∗}. We use P to denote the set of variables that
represent values exchanged through their homonym ports, M the
set of variables that represent the current values stored in their
homonym memory cells, and M ′ the set of variables that represent
the next values to be stored in their unprimed homonym memory
cells. We denote the set of variables as V , which consists of the
union of P , M and M ′. Variables take their values from the domain
D∗. Q and F respectively denote the set of n-ary predicate symbols
and n-ary function symbol.</p>
      <p>A term is either a variable v ∈ V (which can be a port or a
memory variable), an n-ary function f ∈ F , or a constant d ∈ C
(where C is the set of constant symbols).</p>
      <p>t1,t2
::=
d |
f (t1, ...,tn )
| v
The set of term expression is denoted by E</p>
      <p>A formula is built inductively by:
ϕ
::= t1 = t2 |</p>
      <p>B (t1, ...,tn )
|
ϕ1 ∧ ϕ2 |
¬ϕ
| ∃pϕ</p>
      <p>Where B ∈ Q is a predicate symbol. The set of formula
expressions is denoted by F . We use the shorthand notation t1 , t2 for
¬(t1 = t2), ⊥ for t1 , t1, and we get ϕ ∨ ψ = ¬(¬ϕ ∧ ¬ψ ) as well
as ∀tϕ = ¬(∃t ¬ϕ) and ϕ =⇒ ψ = ¬ϕ ∨ ψ . Quantifiers range
over port variables only. We call atomic a formula that is either an
equality, an inequality, or a predicate. We call Vϕ the set of free
variables occurring in ϕ.
of terms J·K(Γ,γ ) : C ∪ F ∪ V
inductively as:</p>
      <p>Solution of constraints. We use γ : F → Dn
∗ → D∗, the
interpretation function for function symbols, and Γ : V → D∗ to denote
the interpretation function for variable symbols. We identify a
constant c with its homonym value in D∗. We define the interpretation
→ D∗, over the functions Γ and γ ,
JdK(Γ,γ ) = d ∈ D∗
Jf (t1, ...,tn )K(Γ,γ ) = γ ( f ) (Jt1K(Γ,γ ) , ..., Jtn K(Γ,γ ) ) ∈ D∗
JvK(Γ,γ ) = Γ (v ) ∈ D∗</p>
      <p>Each n-ary predicate symbol B ∈ Q is assumed to have an
interpretation denoted by I (B), such that I (B) ⊆ Dn Given an
in∗
terpretation function γ for the function symbols, a solution to a
formula ϕ is an assignment Γ such that Γ satis f ies ϕ, written as
Γ |= ϕ, defined inductively on ϕ as:
Γ |= ⊤ always
Γ |= t1 = t2 if Jt1K(Γ,γ ) = Jt2K(Γ,γ )
Γ |= ϕ1 ∧ ϕ2 if Γ |= ϕ1 and Γ |= ϕ2
Γ |= ¬ϕ if Γ ̸|= ϕ
Γ |= ∃pϕ if there exists d ∈ D∗ such that Γ |= ϕ[d/p]
Γ |= B (t1, ...,tn ) if (Jt1K(Γ,γ ) , ..., Jtn K(Γ,γ ) ) ∈ I (B)</p>
      <p>We extend the domain definition of an n-ary function from
to Dn∗ by defining f (t1, ...,tn ) = ∗ ⇐⇒ t1 = ∗ ∨ ... ∨ tn = ∗.
2.2</p>
    </sec>
    <sec id="sec-3">
      <title>Permanent and ephemeral constraints</title>
      <p>Components and permanent constraints. A Reo component, as
introduced earlier, constrains the flow of data through its boundary
ports. We call the logical formula used to represent this relation
on the data flow through the ports of a component the
permanent constraint of the component. Fig.1 shows several examples of
permanent constraints of component.</p>
      <p>Given a port p ∈ P , the proposition of whether or not p fires is
encoded as an equality between p and elements of D∗. We say that
p fires if p , ∗. On the other hand, p does not fire if p = ∗. Taking
a,b ∈ P , we can now express that a and b fire synchronously, as
the formula a = b.</p>
      <p>Dn
sync(a, b)
fifo(a, b)
a
a
•
b
b</p>
      <p>a = b
(m′ = a ∧ a , ∗ ∧ b = ∗ ∧ m = b) ∨
(m′ = a ∧ a = ∗ ∧ b , ∗ ∧ m = b) ∨
(m′ = m ∧ a = ∗ ∧ b = ∗)</p>
      <p>The permanent constraint for a fifo channel has three clauses.
The first one corresponds to filling the bufer with the data item
observed at port a; the second one empties the bufer through port
b; and the last one corresponds to the case where no port fires, in
which case the value in the bufer must remain unchanged.</p>
      <p>As hinted previously, protocols can be built by composing
primitive. In the case of a composite component, the resulting
permanent constraint is defined as the conjunction of the permanent
constraints of the underlying components.</p>
      <p>The logic is agnostic regarding the direction of data flow and
merely represents the constraint on the data observed at each port.
We introduce in the next paragraph the designation of input and
output for variables, and the notion of ephemeral constraint.</p>
      <p>I/O designation and ephemeral constraints. Given a formula, ϕ,
and its set of variable Vϕ = P ∪ M ∪ M ′, we write the function
io : Vϕ → {0, 1} as a designation for input and output variables
such that:
1 v ∈ M

io : v 7→ 0 v ∈ M ′
io(v ) ∈ {0, 1} v ∈ P

We define V in as the set of variables v such that io(v ) = 1 and
ϕ
V out the set of variables such that io(v ) = 0. We also extend the
ϕ
notation to Pin and Pout , referring to the set of input and output
port variables as designated by the io function.</p>
      <p>Since a port is a shared entity between two components, we
introduce the relative notion of environment for a component as
the constraint imposed by the external world on its boundary ports.
v ∈ V , i.e.:</p>
      <p>[
Lϕ =
τ ∈T
a
b
∗
∗
{(σv1 , ...,σvN ) | σvi (t ) = τ (t ) (vi ) f or all vi ∈ V and t ∈ N}
A component knows about the constraint imposed by the
environment only by sensing the state of its boundary ports, and cannot
access the permanent constraint that describes the environment.
We model an environment ∆ by:
v ∈ Pϕout ∩ P∆
∗
∆ : P∆ → D∗, v 7→ ∆ (v ) ∈ D∗ v ∈ Pϕin</p>
      <p>
where Pin ∩ P∆ = Pin , and Pout ∩ P∆ ⊆ Pout . We introduce the
ϕ ϕ ϕ ϕ
notion of ephemeral constraints ϵ and µ as opposed to a permanent
constraint ϕ. In contrast to a permanent constraint, an ephemeral
constraint may change in time. An environment ∆ imposes an
external ephemeral constraint µ = Vv ∈P∆ (v = ∆ (v ) ∨ v = ∗) on
the free variables of the permanent constraint ϕ of a component.
The external ephemeral constraint µ represents the fact that, if
the environment assigns ∗ to a variable, then the component does
not have a choice but to assign ∗ to the same variable; however, if
the environment has a data item pending at port v (described by
the constraint ∆ (v ) , ∗), the component can still chose to assign
∗ to the variable and let the environment wait. An assignment Γ
such that Γ |= ϕ imposes an internal ephemeral constraint on the
next state of the component with ϵ = Vm ∈M (m = Γ (m′)). In other
words, the next assignment Γ′ must then satisfy the constraint
ϕ ∧ ϵ, where ϵ represents the internal state of the component, i.e.,
its memory values.</p>
      <p>Intuitively, we can understand external ephemeral constraints
as a current state of the ports on the boundary of a component
(whether or not the environment has some I/O requests pending
on a subset of ports), and the internal ephemeral constraint reflects
the current state of the memory in a component. In composition
with the permanent constraint, we get the current constraint of the
component in the context of its internal and external states.
2.3</p>
    </sec>
    <sec id="sec-4">
      <title>Behavior and language of protocols</title>
      <p>Operational semantic. Operationally, we consider formulas as
labels for states, and assignments Γ as labels for transitions between
states. Each state is labeled by an ephemeral constraint ϵ ∧ µ . We
assume an initial state ϵ0 ∧ µ 0, given ϵ0 = Vm ∈M m = cm where
cm ∈ D∗, and µ 0 = Vp ∈P p = ∗. In the initial state, the constraint µ 0
ensures that all port variables have the value ∗, and the constraint
ϵ0 gives an initial value for all memory variables. We say that two
states ϵ1 ∧ µ 1 and ϵ2 ∧ µ 2 under a permanent constraint ϕ are
related by an assignment Γ if and only if Γ |= ϕ ∧ ϵ1 ∧ µ 1 and
Γϕ
ϵ2 = Vm ∈M (m = Γ (m′)). In this case, we write ϵ1 ∧ µ 1 −−→ ϵ2 ∧ µ 2,
and drop the subscript ϕ when it is clear from the context.</p>
      <p>Note that there exists an assignment Γ that relates each state with
itself. Indeed, choosing the assignment Γ such that Γ (m) = Γ (m′)
for all m ∈ M and Γ (p) = ∗ for all p ∈ P is a solution for any
ephemeral constraint. Multiple distinct assignments may relate
the same two states, in which case the labeled transition system
contains multiple labeled edges between the same pair of states.</p>
      <p>We refer to an infinite path in the labeled transition system
ϵ1 ∧ µ 1 −−→ ϵ2 ∧ µ 2 −−→ ϵ3 ∧ µ 3 −−Γ→3 ... by the infinite sequence of its
Γ1 Γ2
labels Γ1, Γ2, .... By T , we designate the set of infinite label sequences
of the LTS. Given τ ∈ T , we write τ (i ) for the i-th assignment in
the sequence τ , and τ (i ) (v ) for the value of the variable v ∈ Vϕ in
the i-th assignment of the sequence τ .</p>
      <p>Language of protocols. Analogously, an infinite sequence Γ0, Γ1, ... ∈
T can also be transformed into a tuple of data streams. For each
variable v ∈ V , we define the data stream σv : N → D∗ such that
σv (i ) = Γi (v ) for all i ∈ N. We call σV the tuple (σv1 ,σv2 , ...,σvN )
where {v1, ...,vN } = V</p>
      <p>We define the language of a formula ϕ with initial memory values
defined by ϵ0 as the set of tuples of data streams for the variables</p>
      <p>
        Each component defines a constraint on the exchanges of data
items through its own boundary ports and two resulting time data
streams are shown in Fig. 2. This constraint is represented by a
formula such that the interpretation of the formula describes the
intended behavior of the component. We represent the behavior of
a component as a set of data streams, as also described in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. The
symbol ∗ used in the table represents the case where no data flow
is observed at its respective port.
      </p>
      <p>
        This overview sufices to understand the Reo compiler,
comprehend the behavior of independent components, and that of
composite components. In the next subsection, we explain the logical
form which the compiler uses to optimize the composition of
components. We define the notion of the guarded command form for a
formula, and relate it to code generation. The formal development
in the next subsection is supported by a tool [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] developed at CWI.
Currently, the tool consists of a compilation suite from Treo, a
textual language for Reo [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ], to executable code (Java) or verifiable
code (Promela). We explain the formal steps in the compilation
process in the next subsection.
      </p>
      <p>Guarded commands. Given a formula ϕ representing a constraint,
and an io designation, we define suficient conditions for ϕ to be
written in the guarded command form. We first introduce a
fragment of the logic of constraints, give some requirement on ϕ to be
expressible as a guarded command, and show some properties if ϕ
satisfied those requirements.</p>
      <p>We denote by vin and vout a variable v such that io(v ) = 1 and
io(v ) = 0, respectively. We denote a term by tin and tout such that:
tin ::=</p>
      <p>f (t1in , ...,tnin ) |
d |
The language of guards д is defined by the following grammar:
tout ::= vout
vin
l ::= B (t1in , ...,tnin ) | t1in = t2in | tout = ∗ | ¬l
д ::= l1 ∧ l2
The language of commands c is defined by the following grammar:
We say that a formula ϕ is in guarded command form if
c ::= tout = tin | c1 ∧ c2
ϕ =
^(дi =⇒ ci ) ∧ (_ дj )
i
j
where дi are formulas in the language of guards and ci are formulas
in the language of commands. Given ϕ in guarded command form,
we call an implication of the type д =⇒ c in ϕ, a guarded command
of ϕ. We call the number of guarded commands in such a formula,
the size of that formula. We denote the set of guards by G, and the
set of commands by C.</p>
      <p>We say that a quantifier free formula ϕ = ϕ1 ∨ ... ∨ ϕn in
disjunctive normal form and expressed in the language of constraints
is deterministic if ϕ can be written with the grammar of guarded
commands such that ϕ = д1 ∧ c1 ∨ ... ∨ дn ∧ cn , where ∧ has
precedence over ∨, дi are guards, ci are commands, and дi ∧ дj ≡ ⊥ for
all i, j where i , j.</p>
      <p>We assume that if a term tout is involved in an equality, then
the other term is either ∗, or an input term tin . In other words, if an
equality tout = t2out appears in the constraint ϕ, there must exist
1
an input term tin such that t1out = tin and t2out = tin . Moreover,</p>
      <p>Proposition 1. A deterministic formula ϕ = д1 ∧c1 ∨ ... ∨дn ∧cn
can be written as a guarded command where:</p>
      <p>ϕ = (д1 =⇒ c1) ∧ ... ∧ (дn =⇒ cn ) ∧ (_ дi )
.
as the formula:</p>
      <p>Given two guarded commands ϕ = Vi (дi =⇒ ci ) ∧ (Wj дj )
and ψ = Vi (дi′ =⇒ ci′) ∧ (Wj дj′), we write the composition ϕ ∧ ψ
ϕ ∧ ψ =
^(дi =⇒ ci ) ^(дi′ =⇒ ci′) ∧ (_ дi′ ∧ дj )
i
i</p>
      <p>i
i,j</p>
      <p>Proposition 2. Given two deterministic formulas ϕ and ψ , their
product ϕ ∧ ψ is also deterministic.</p>
      <p>As the construction in the proof of Proposition 2 shows, writing
the composition of two deterministic formulas as a deterministic
formula may increase the size of the resulting formula. Some
optimizations that can be applied to formulas before forming their
product, but we don’t detail them here for lack of</p>
      <p>Example. We now consider an example of guarded commands
for the fifo primitive. The fifo primitive has a permanent constraint
written in Fig. 1, with the io designation of io(a) = 1 and io(b ) = 0,
i.e., a is an input port and b is an output port. The formula of a fifo
is deterministic, and with the result of Proposition 1, we can write
its permanent constraint as a guarded command:
ϕf if o =((a , ∗ ∧ b = ∗ ∧ m = ∗) =⇒ (m′ = a ∧ m = b )) ∧
((a = ∗ ∧ b , ∗ ∧ m , ∗) =⇒ (m′ = a ∧ m = b )) ∧
((a = ∗ ∧ b = ∗) =⇒</p>
      <p>m′ = m) ∧
((a , ∗ ∧ b = ∗ ∧ m = ∗) ∨ (a = ∗ ∧ b , ∗ ∧ m , ∗)∨
The formula for a fifo channel has two diferent guards. The first
guard checks whether its source port a is active, in which case
the command fills the bufer with the data observed at port a; the
second guard checks whether the channel’s sink port b is active, in
which case its command empties the bufer through port b.</p>
      <p>Proposition 3. Given a deterministic formula ϕ in guarded
command form, and an ephemeral constraint ϵ ∧ µ , Γ is a solution of
ϕ ∧ ϵ ∧ µ if and only if there exists a unique guarded command
д =⇒ c of ϕ such that:</p>
      <p>Γ |= д ∧ ϵ ∧ µ and Γ |= c</p>
      <p>We now look into the implementation and verification of a
protocol described by a formula in guarded command form. As
Proposition 3 shows, given a state of an environment and an internal state
of our component, each solution is described by a unique guarded
command. Therefore, given an environment and an internal state,
a program implementing a protocol checks the set of guards that
are satisfied by the state of the environment and the internal state,
and nondeterministically satisfies one and only one corresponding
command. We develop in the next section the steps leading from a
protocol specification to a program written in Promela.
(a = ∗ ∧ b = ∗))</p>
    </sec>
    <sec id="sec-5">
      <title>3 FROM REO TO PROMELA</title>
      <p>In the previous section, we detailed the requirement and the
procedure to write a protocol as a formula in the guarded command
form. The implication of having such a form for a protocol makes it
possible and easier to translate it into a program. In this section, we
define a translation from a formula written as a guarded command
to a Promela program. We show the correctness of the translation,
by comparing the semantic of a Reo specification, and that of its
target program in Promela.</p>
      <p>Throughout this section, we assume a generic data type denoted
as Data for data flowing in the protocol, since data type is specific
in the application that employs the protocol.</p>
    </sec>
    <sec id="sec-6">
      <title>3.1 Ports and environment in Promela</title>
      <p>
        Ports. In Reo, as defined in the previous section, a port is a
location where two components synchronize and exchange data. In
Promela, we implement a Reo port as a pair of two Promela
channels, each with a bufer size of one. We show that our Promela
implementation of a port simulates Reo’s synchronized message
passing between components.
typedef port {
chan data = [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] of {Data};
chan synch = [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] of {int}; }
      </p>
      <sec id="sec-6-1">
        <title>Listing 1: definition of a Reo port in Promela</title>
        <p>As expressed in Listing 1, a port has a data channel and a
synchronization channel. The data channel is responsible of the data
lfow between input and output ends of a port. The Promela synch
channel ensures synchronous exchange between these two ends.</p>
        <p>As described in Listing 2, two actions can be performed on such
a constructed port: put and take.</p>
        <p>inline put(q,a) {
int x;
atomic{q.data!a;
q.synch?x} }
inline take(q,a) {</p>
        <p>atomic{q.synch!-1; q.data?a} }</p>
      </sec>
      <sec id="sec-6-2">
        <title>Listing 2: put and take functions</title>
        <p>The action put has two arguments: a port q and a datum a. The
function call put(q, a) atomically fills the data channel of q with the
datum a, and blocks on the synch channel, waiting to synchronize
with the component on the output side of q. The integer x is used
to empty the synch channel, but its value does not matter.</p>
        <p>The action take has a port q and a variable a as arguments.
The function call take(q, a) atomically notifies, by filling the synch
channel, that there is a component willing to take data, and blocks
on the data channel, until a datum can be taken into the variable a.
The integer value of −1 written into the synchronization channel
is arbitrary, as synch is used only for signaling.</p>
        <p>Environment. We call an external component that interacts with
the main protocol, an aдent . For each port q in the protocol’s
interface, we assume an aдent connected to that port. More precisely, if
q is used as an input port by the protocol, the aдent connected to q
must use q as an output port, and vice versa. We give in Listing 3 an
example of a definition of an agent with two ports as its arguments.
proctype agent(port p1; port p2){
/* p1: input, p2: output */
do</p>
        <p>:: /* action */
od }</p>
      </sec>
      <sec id="sec-6-3">
        <title>Listing 3: A generic structure for an agent</title>
        <p>Each agent is defined as a proctype in Promela, and runs
concurrently with the main protocol. We represent the generic behavior of
an agent as an infinite sequence of non deterministic actions (with
the do − od loop), but the definition of the precise behavior of an
agent is left for the user. Since agents and protocol share ports, it is
possible that an agent blocks until a datum is delivered at its port.</p>
        <p>We assume a set of agents given by the user. Our compiler
generates only the skeleton of an agent including the set of ports in its
interface, with the direction of each port (either input or output).
As an extension, we intend to make the input/output restriction
of ports direction more strict, using the Promela assertion xr and
xs to prevent misuse of port directionality. We later specify some
properties of the desired observable behavior.
3.2</p>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>Translation of a Reo specification</title>
      <p>We define formally the translation of a formula written in guarded
command form into a Promela specification.</p>
      <p>Logical terms. Given a set of term expressions E, we define a
mapping of E to a set of Promela specification P. We assume a
function I that maps every constant, function, and predicate symbol to
itthsaitnmtearppsreatatteiromn itno Paruomnieqluae. WnaemcealelxJp·KrEession in Promela, such
: E → P the function
that:</p>
      <p>Jf (t1, ...,tn )KE = I ( f ) (Jt1KE , ..., Jtn KE )
JcKE = I (c ) JmKE = m</p>
      <p>Jm′KE = m JpKE = p</p>
      <p>Memory variables m and m′ are mapped to the same name in
Promela, since they refer to the same memory location, subject to
diferent actions.</p>
      <p>
        Given a formula ϕ, its set of port variables P , and memory
variables M, the function : P ∪ M → P maps each port variable
p ∈ P and memory varJia·KbIle m ∈ M to a definition in Promela, such
that:
JpKI = port JpKE ; and JmKI = chan JmKE = [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] of {Data};
Promela expression such that:
      </p>
      <p>Each port variable is mapped to an instance of the port structure
in Promela. Every port name is unique, and given by JpKE . Each
memory variable is defined as a channel of data type Data and of
size 1. Every memory name is also unique, and given by m .</p>
      <p>Besides the mapping of terms to Promela, we introduceJPrKoEmela
vParaisabthlees ftuonacctcioensstfhoartmtauklaesvaarviaabrlieasb’levaelxuper.eWsseiounseanJd·KVretu:rEns→a</p>
      <p>JmKV = _JmKE JpKV = _JpKE Jm′KV = _JmKE
We use m p to refer to the current value in Promela of
the memJorKyVvaarnidableKmV or of the port variable p.</p>
      <p>J</p>
      <p>Guarded commands. Because we have assumed the source
formula to be deterministic, we define the target Promela program by
induction on the syntax of the formula in guarded command form.</p>
      <p>For a set of guards G, we define J·KG : G → P such that:
Jд1 ∧ д2KG = Jд1KG &amp;&amp;Jд2KG
J</p>
      <p>Jt1in KV ==Jt2in KV
Jt1in = t2in KG = empty(Jt1in KE )
true

full(Jt1in KE .data) if t1in , ∗ ∧ t2in = ∗
J¬(t1in = t2in )KG =  and t1in ∈ P
!(Jt1in = t2in KG ) otherwise
J¬(tout = ∗)KG = full( tout .synch)</p>
      <p>J KE
Note that guards of the shape p = ∗, where p ∈ Pin , are trivially
mapped to true in Promela, since such condition can always be
satisfied (a port could always have a silent behavior). However,
guards of the shape ¬(p = ∗) must distinguish the case where
p ∈ Pin , since the port p must have a pending input from the
environment.</p>
      <p>Before defining the translation from commands to Promela
program, we must ensure that the conjunction is properly ordered. We
consider the case where a memory variable m ∈ M is used as input
and m′ ∈ M ′ as output in the same command. In this case, we first
give precedence to the command involving m over the command
involving m′, since m refers to the current value of m, and m′ refers
to the new value of m.
sucFhorthaast:et of commands C, we define the function J·KC : C → P
Jc1 ∧ c2KC = Jc1KC ; Jc2KC ;
Jtout = tin KC = (ptuotu(tJtou!t tKiEn,Jtin</p>
      <p>J KE J KV</p>
      <p>KV
) if tout ∈ P
if tout ∈ M</p>
      <p>The Promela program for a command is directly followed by an
update of the state of the protocol. Since command execution
consumes certain values from some port locations, we notify each input
port involved in the command to release its value. Therefore, given
a command c, for each tin occurring in c, we append at the end of
itfhteinpr∈ogPraomr JJtciKnC th?eJtfionllowiinfgtisnta∈teMm e.nts: take(Jtin KE ,Jtin KV )</p>
      <p>Given a determK Einistic KfoVrmula ϕ in the guarded command form,
we inductively define the function J·KF : F → P such that:</p>
      <p>
        Jд =⇒ cKF =JдKG -&gt; atomic{JcKC }
The generic structure of a Promela program obtained from a
deterministic formula with n guarded commands is shown in Listing 4.
proctype Protocol(port p1;...){
/* p1: input, ... */
/* Memory declaration */
chan m = [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] of {int};
/* Initial state */
m!0;
/* Local variables */
int _m; int _p1 ;
...
      </p>
      <p>/* Guarded commands */
do
:: (guard_1) -&gt;</p>
      <p>atomic{command_1}
:: ...
:: (guard_n) -&gt;</p>
      <p>atomic{command_n}
od }</p>
      <sec id="sec-7-1">
        <title>Listing 4: a generic structure of a protocol</title>
        <p>
          Example. We show as example the protocol of a fifo channel. The
corresponding deterministic formula for a fifo is presented in the
example in Section 2.4. Listing 5 shows the generated code obtained
from compiling the deterministic formula representing a fifo.
proctype Fifo(port a; port b){
/* a: input, b: output */
chan m = [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] of {int};
int _m; int _a ; int _b ;
do
:: (empty(m) &amp;&amp; full(a.data)) -&gt;
        </p>
        <p>atomic{take(a,_a);m!_a;}
:: (full(m) &amp;&amp; full(b.synch)) -&gt;</p>
        <p>atomic{m?_m; put(b,_m);}
od }</p>
      </sec>
      <sec id="sec-7-2">
        <title>Listing 5: Promela code generated for a Reo fifo channel with a String bufer</title>
        <p>Note that the last guarded command is removed from the
generated code, since it would result in the trivial statement: true -&gt;
atomic{m?_m;m!_m}, which essentially, merely copies the value of
the memory m to itself.</p>
        <p>Initialization. The init process in Promela defines the only active
process in the initial state. Ports are initialized and shared between
processes that run concurrently, i.e., we apply the instantiation
function for all p ∈ P . We later reason on the set of processes
in the initJp·KrIocess only. All agents and protocol are run concurrently.</p>
        <p>
          Correctness. We use the semantic of Promela defined in [
          <xref ref-type="bibr" rid="ref21">21</xref>
          ] to
show the correctness of our translation. The operational semantics
of a Promela program P composed of processes Pi is defined as a
graph T = (Q, →,q0) where Q is a set of states and → is a binary
relation on states. A state q ∈ Q is a tuple q = (l0, ...,lm ,lv1, ...,lvm,дv )
where each li is a location in process Pi , lvi is the vector of local
variable values in process Pi , and дv is the vector of global variables
in P . The state s0 ∈ Q refers to the initial state.
        </p>
        <p>Proposition 4. For every gv vector of global variable values, there
exists an environment ∆ such that ∆ ≡ дv, and vice versa.</p>
        <p>We use д =⇒ c to designate the translation of the guarded
command Jд =⇒ cKtFo a Promela program. We denote the set of
guarded commands as Sдc .</p>
        <p>Theorem 5. Given a permanent constraint ϕ, where ϕ
J KF is its
translation, a state q = (l ,lv,дv ) and an environment ∆ such that
дv ≡ ∆ , for every guarded command дc ∈ Sдc and a state q′ such
дc
that q −−→ q′, there exists an assignment such that Γ |= д ∧ c, where
Jд =⇒ cKF = дc.</p>
        <p>Completeness can be derived by showing that every solution of
the guarded command corresponds to an implementation where
the set of agents simulate the environment of the solution. By
taking an implementation that unifies the agents, and using the
nondeterministic properties of Promela, we can simulate any solution of
the formula as a statement and a дv vector in Promela. Elaboration
of this part remains as future work.</p>
        <p>Adding our Promela code generator as a back-end for the Treo
compiler significantly extends the application range of the
current compiler. From the same Reo specification, the compiler can
generate either an executable code in Java, or a verifiable code in
Promela.</p>
      </sec>
    </sec>
    <sec id="sec-8">
      <title>4 CASE STUDY</title>
      <p>In this section, we consider specification of a railway protocol as a
Reo circuit, its compilation into Promela, and verification of some
of its properties using SPIN.
4.1</p>
    </sec>
    <sec id="sec-9">
      <title>Railway case study</title>
      <p>
        We consider the simplified trains protection in CBTC
(Communications Based Train Control) systems. The system is illustrated
in the Figure 3 and detailed in depth in previous work of one of
the author [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ]. To illustrate our approach, we propose a slight
adaptation of the original version of the system.
      </p>
      <p>Event 1: sending coverage requests to MCU
Event 2: T1 and T2 are covered
Event 3: requesting VMAZs from MCU
Event 4: VMAZs of T1 and T2 from MCU
Event 5: computing VLMA</p>
      <p>Wireless communication with T1
Velocity profile of T1</p>
      <p>T1
s1
TEL</p>
      <p>HEL
s2</p>
      <p>VLMA of T1
p1
s3</p>
      <p>BTS
Boundary between
VMAZ1 and VMAZ2
s4 TEL</p>
      <p>DEU</p>
      <p>MCU
Wireless communication with T2</p>
      <p>T2</p>
      <p>HEL</p>
      <p>s5 s6</p>
      <p>Trains path
s7</p>
      <p>Coverage area of MCU</p>
      <p>The studied system consists of a set of components located
inside and outside trains, that interact continuously to calculate and
exchange parameters necessary to guarantee safe circulation of
trains.</p>
      <p>In this paper, we focus on modeling and verifying the
interaction protocol of the main OBD component (On-Board Device) that
interacts continuously with the Movement Control Unit component
(MCU). This protocol implies constraints on the subcomponents
of OBD (CtrVelocity, EmgcyBrake) and those of MCU (Coverage,
ProdVmaz). Before modeling this protocol as a Reo circuit, in the
next section, we describe it informally by showing the chaining of
component actions that OBD and other components enable during
their interactions.</p>
      <p>The OBDs of T1 and T2 initiate the protection process by asking
if they are visible to the MCU component, by sending the message
covReq to Coverage subcomponent. There are several MCUs
covering the entire line, with overlapping coverage sections, useful for
information exchange between them. Locations are sent by wireless
communication to the nearest Base Transmission Station (BTS) and
saved in its Data Exchange Unit (DEU), which in turn transfers them
to MCU (event 1). The internal subcomponent Coverage of MCU
determines whether or not the zone between TEL and HEL (tail and
head external locations ) is completely included within its coverage
area, and responds to T1 and T2 by sending the messages covered or
uncovered (event 2). Next, each train asks from its covering MCUs
its Vital Movement Authority Zone (VMAZ), by sending the message
vmazReq. A VMAZ is an area (sequence of segments) in which the
train can safely circulate (event 3). MCU ensures that VMAZs of
successive trains never overlap to avoid collisions. VMAZs are
computed, by the MCU subcomponent ProdVmaz, through chaining of
segments according to route information. Chaining terminates at
the nearest obstacle on the train trajectory: the end of MCU
coverage area, an uncontrolled switch, or the beginning of a segment
containing TEL of the next train, etc. Finally, the train computes
the Vital Limit of Movement Authority (VLMA) by incorporating a
ifxed safety margin within the limit of its VMAZ (event 5).</p>
      <p>
        Depending on VLMA an OBD component will either enable its
subcomponent CtrVelocity, or EmgcyBrake. The subcomponent
CtrVelocity gradually reduce the train velocity down to zero (via its
internal action ctrV elocity) before HEL reaches VLMA. The
activation of the subcomponent EmgcyBrake results into an emergency
brake action (emдcyBrake action).
The railway example presented above is translated into a Reo circuit,
described graphically in Fig. 4. Six diferent type of components are
used to model the protocol. Two fifo channels are used to represent
the asynchronous communication while Coverage sends an update
and expects an answer, and when Coverage communicates with
ProdVmaz. Transformer channels ComputeVlma and Update are
used to apply functions on the data flowing at their ports. Therefore,
the transformer ComputeVlma returns the speed value, responding
to the message sent by ProdVmaz, and Update updates the data of
the message sent by Coverage. The xrouter component (circle with
a cross) models the routing replication of data to CtrVelocity or
EmgcyBrake. Once a data enters the xrouter component, the data
is sent either to CtrVelocity or to EmergcyBrake but not to both.
Merger, replicator, and sync components have the usual behavior
and are used to model synchronization properties. For more details
on Reo components behavior, please refer to [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>The protocol component (dashed line and grey font) represents
the permanent constraint of the system. The four components
CtrVelocity, EmgcyBrake, ProdVmaz, and Coverage, correspond to
the environment of the protocol. In the next section, we generate
the Promela code for this protocol, link the protocol with its agents,
and verify some synchronization properties.
4.3</p>
    </sec>
    <sec id="sec-10">
      <title>Code generation</title>
      <p>Initialization. To generate the Promela code corresponding to
Reo circuit described in Fig. 4, we exploit our compiler that accepts
as input Reo specification and generates as output Promela code by
applying the rules described in Section 4. We obtain the following
Promela proctypes described in Listing 6.
init {
port pcv; port pc1; port pc2;
...
atomic{
run prodVmaz(ppv2,ppv1);run emergencyBrake(peb);
run ctlVelocity(pcv); run coverture(pc2,pc3,pc1);
run Protocol(pcv,pc3,pc1,ppv1,ppv2,pc2,peb) } }</p>
      <sec id="sec-10-1">
        <title>Listing 6: Generated proctypes</title>
        <p>Ports are first initialized with a respective unique named. Then,
the Protocol proctype implements the Reo specification of the
interaction protocol, with its corresponding interface. In addition,
the proctypes ProdVmaz, EmgcyBrake, CtrlVelocity, Coverage,
and EmgcyBrake implement the boundary agent, considered as
an environment for the main protocol proctype. Each proctype
accepts as parameters, ports associated with the interface of its
respective component.</p>
        <p>Protocol. In Listing 7, we show a partial implementation of the
Protocol proctype corresponding to Reo specification described
in Figure 4. To illustrate the result obtained from the compiler, we
describe, for example, the actions coveReq, and covered, that are
implemented as two guarded commands. The first action models the
message sent by the OBD component to the agent Coverage. The
second one models the message received by the OBD component
from the agent Coverage. For example, as shown in Listing 7 in the
implementation of coveReq, the guard part of the action specifies
that the bufer m1 is full because there is a message to send, and the
port pc2 (instantiation of the parameter p6 in Protocol) associated
to the component Coverage is free. The command part of the action
specifies that the message will be sent in Pc2 and the bufer will be
available.
proctype Protocol(port p1; ... ; port p7){
...
do
::(full(m1) &amp;&amp; full(p6.sync)) -&gt; atomic{ m1?_m1; put(p6,_m1);}
/* covereq!*/
...
:: (full(p3.data) &amp;&amp; empty(m2)) -&gt; atomic{take(p3,_p3);m2!_p3;}
/*covered*/
od }</p>
      </sec>
      <sec id="sec-10-2">
        <title>Listing 7: Guarded commands for covereq and covered actions</title>
        <p>
          Simulation and verification. The Promela program generated by
our compiler allows to run random or guided simulation with SPIN
for analyzing the protocol. It allows also to verify safety properties,
such as the absence of deadlock states. The verification performed
on the Promela program, corresponding to the case study, shows
that the protocol behavior does not reach any deadlock state. Using
the approach described in [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ], we define, in the next subsection,
some new flag variables used to verify liveness properties. The
experiment detailed in the use case can be reproduced by downloading
the Reo compiler [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ].
4.4
        </p>
      </sec>
    </sec>
    <sec id="sec-11">
      <title>Verification of LTL properties</title>
      <p>Flags. LTL properties, in our case, describe properties of the
run in the generated code. As presented in previous section, the
state of a generated Promela program is entirely captured in the
global variables value, and a vector of local variables value for
each concurrent proctype. We decide, to abstract system’s state by
defining flags to describe the main state we interested in. As shown
in Listing 8
/*flags declaration */
bit hassend=0, hasreceive=0, msg_covReq=0,msg_vmazReq=0,
msg_covered=0, msg_uncovered=0, msg_vmaz=0,brake=0,ctrvelo=0;
...
do
::(full(m1) &amp;&amp; full(p6.sync)) -&gt; atomic{ m1?_m1; put(p6,_m1);
d_step{hassend=1; msg_covReq=1; hasreceive=0; msg_vmazReq=0;
msg_covered=0; msg_uncovered=0; msg_vmaz=0; brake=0;
ctrvelo=0;}} /* covereq!*/</p>
      <sec id="sec-11-1">
        <title>Listing 8: Flags of the generated code</title>
        <p>Mainly, each sending and receiving action from the protocol point
of view has a dedicated flag. This allows to keep track of the actions
performed by the components and the reactions of their
environment. These flags are updated together with each send/receive
event, using a d_step statement to ensure the values assignment
in one execution step. For example in Listing 8, we present the
Promela code of the guarded command covereq enriched with its
corresponding flags.</p>
        <p>LTL properties. To verify the correctness of the specified protocol,
we propose to verify the following LTL properties presented in
Listing 9.
ltl p1{[]((hassend==1 &amp;&amp; msg_covReq==1) -&gt; &lt;&gt; (hasreceive==1
&amp;&amp; (msg_uncovered==1 || msg_covered==1)))} /*satified */
ltl p2{[](msg_covered==1 -&gt; &lt;&gt; (hasreceive==1 &amp;&amp; msg_vmaz==1
&amp;&amp; brake==1))} /*not satisfied */</p>
      </sec>
      <sec id="sec-11-2">
        <title>Listing 9: Flags of the generated code</title>
        <p>The property p1 specifies that, always if the component OBD
sends the message covReq then it will receive a message covered or
uncovered. This property is satisfied. The property p2 specifies that
always if the OBD receives the message covered then it will receive
the message vmaz and the action emдcyBrake will be enabled. This
property is not satisfied, because there is the option of enabling the
action ctrV elocity instead of emдcyBrake.</p>
      </sec>
    </sec>
    <sec id="sec-12">
      <title>5 RELATED WORK</title>
      <p>In this paper, we propose compiling Reo circuits into Promela to
formally verify the LTL properties of protocols of interactions among
components. Formal verification of Reo specifications using a
number of tools has already appeared in the literature (see below).
Complementing this existing set of tools, in our work, we opted to use
the SPIN model checker, because (i) it is one of the most advanced
analysis and verification tools available, and (ii) its Promela
language resembles our guarded command formal specification of Reo
circuits. We are not aware of a comprehensive work on verification
of Reo circuits using SPIN.</p>
      <p>We proposed a formal framework for translation of Reo models
into Promela. We use a transition-systems-based operational
semantics of Promela to express the formal semantics of Reo, through
which we establish the correctness of our translation. Most of the
existing work uses constraint automata, instead, as operational
semantics.</p>
      <p>
        Similar to our concerns, the CHARMY framework [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ] also
addresses verifying LTL formulas expressing properties of
componentbased systems. CHARMY is a UML based specification, where state
diagrams are counterparts of our agents, and sequence diagrams
are that of our protocols. CHARMY defines a system as a set of
state diagrams, coordinated by a sequence diagram. The CHARMY
framework ofers the possibility to translate its specification into
a Promela program, and thereby allows the verification of
properties using SPIN. However, CHARMY allows composition of state
diagram specifications only, and not that of sequence diagrams. In
our case, agents and protocol difer only in their implementations.
In Reo, protocols are constructed compositionally, and their
composition preserves and propagates synchrony. CHARMY does not
seem to support such compositions.. Moreover, Reo can express
nesting of components, which is disallowed in CHARMY. Finally,
properties of protocols are specified using property sequence chart
(PSC) in CHARMY. In our approach, we require the specification of
LTL properties directly in Promela, and leave as future work the
integration of property specification at the design level.
      </p>
      <p>
        Vereofy [
        <xref ref-type="bibr" rid="ref5 ref6 ref7">5–7</xref>
        ] is a model checking tool developed at the
University of Dresden to analyze and verify Reo connectors.
Vereofy has two input languages: the Reo Scripting Language (RSL),
used to specify the coordination protocol, and a guarded command
language called Constraint Automata Reactive Module Language
(CARML), a textual version of constraint automata used to specify
the behavior of components. Vereofy allows the verification of
temporal properties expressed in LTL and CTL-like logics. In contrast
to Vereofy, in our work we use only one language, Promela, to
specify both component behavior and coordination protocols.
      </p>
      <p>
        The constraint automata semantics for Reo was also considered
in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] for defining and verifying bisimulation and language
equivalence between Reo connectors. In [
        <xref ref-type="bibr" rid="ref3 ref4">3, 4</xref>
        ], the authors considered time
constraints, and proposed a timed version of constraint automaton
to verify by model checking timed CTL properties. In [
        <xref ref-type="bibr" rid="ref15 ref16">15, 16</xref>
        ], the
authors use timed constraint automata and present a SAT-based
approach for bounded model checking of real-time component
connectors. Another verification approach based on SAT solvers was
proposed in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], exploiting Alloy. This work allows analysis of Reo
circuits and verification of their properties expressed as predicates
in the lightweight modeling language of Alloy, which is based on
ifrst-order relational logic. In [
        <xref ref-type="bibr" rid="ref17 ref18">17, 18</xref>
        ], Kokash et al. proposed a
framework for the verification of Reo circuits using the mCRL2
toolset (developed at the TU of Eindhoven). Their tool
automatically generates mCRL2 specifications from Reo graphical models.
The translation from Reo to mCRL2 uses the constraint automata
semantics of Reo.
      </p>
    </sec>
    <sec id="sec-13">
      <title>6 CONCLUSION AND FUTURE WORK</title>
      <p>In this paper, we presented suficient conditions to compile a
protocol specified in Reo into a program implemented in Promela. We
introduced the notions of ephemeral and permanent constraints;
the former consist of constraints that change through time,
reflecting the states of the environment or internal memories, whereas
the latter consist of structural constraints that must hold
invariably. We defined suficient conditions for expressing the permanent
constraint of a component in the guarded command form. We then
defined a translation of a formula in guarded command form to
a Promela program. We show the correctness of our translation,
which we have implemented as a back-end for the current Reo
compiler.</p>
      <p>We demonstrate the relevance of our work in a case study
involving design and verification of a railway component-based system.
We use our compiler to translate the Reo specification of a protocol
in this system into Promela, and use SPIN to verify LTL-specified
properties, such as safety and liveness. In future work, we would
like to support specification of LTL properties at design level as
an extension of constraint formula. This direction is justified by
the argument that in Reo, we can deduce the states of a protocol
entirely from the current state of its boundary ports and its internal
memory. A designer, thus, has enough information at the level of
Reo to specify not just a protocol, but also its required LTL
properties, in some suitable constraint language, which our extended
compilation can subsequently translate into Promela LTL statement
on protocol states, for verification.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <fpage>2018</fpage>
          .
          <article-title>Link to the proofs</article-title>
          . https://cloud.benjaminlion.fr/s/PtH6RtW056tuFJ4
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <fpage>2018</fpage>
          .
          <article-title>Reo github webpage</article-title>
          . https://github.com/ReoLanguage/Reo
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Farhad</given-names>
            <surname>Arbab</surname>
          </string-name>
          .
          <year>2004</year>
          .
          <article-title>Reo: A Channel-based Coordination Model for Component Composition</article-title>
          .
          <source>Mathematical. Structures in Comp. Sci. 14</source>
          ,
          <issue>3</issue>
          (
          <year>June 2004</year>
          ),
          <fpage>329</fpage>
          -
          <lpage>366</lpage>
          . https://doi.org/10.1017/S0960129504004153
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Farhad</given-names>
            <surname>Arbab</surname>
          </string-name>
          , Christel Baier, Frank de Boer, and
          <string-name>
            <given-names>Jan</given-names>
            <surname>Rutten</surname>
          </string-name>
          .
          <year>2007</year>
          .
          <article-title>Models and temporal logical specifications for timed component connectors</article-title>
          .
          <source>Software &amp; Systems Modeling 6</source>
          ,
          <issue>1</issue>
          (
          <issue>01</issue>
          <year>Mar 2007</year>
          ),
          <fpage>59</fpage>
          -
          <lpage>82</lpage>
          . https://doi.org/10.1007/s10270-006-0009-9
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Christel</given-names>
            <surname>Baier</surname>
          </string-name>
          , Tobias Blechmann, Joachim Klein, and
          <string-name>
            <given-names>Sascha</given-names>
            <surname>Klüppelholz</surname>
          </string-name>
          .
          <year>2009</year>
          .
          <article-title>Formal Verification for Components and Connectors</article-title>
          .
          <source>In Formal Methods for Components and Objects</source>
          , Frank S. de Boer,
          <string-name>
            <surname>Marcello M. Bonsangue</surname>
          </string-name>
          , and Eric Madelaine (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg,
          <fpage>82</fpage>
          -
          <lpage>101</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Christel</given-names>
            <surname>Baier</surname>
          </string-name>
          , Tobias Blechmann, Joachim Klein, and
          <string-name>
            <given-names>Sascha</given-names>
            <surname>Klüppelholz</surname>
          </string-name>
          .
          <year>2009</year>
          .
          <article-title>A Uniform Framework for Modeling and Verifying Components and Connectors</article-title>
          .
          <source>In Coordination Models and Languages</source>
          , John Field and Vasco T. Vasconcelos (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg,
          <fpage>247</fpage>
          -
          <lpage>267</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Christel</given-names>
            <surname>Baier</surname>
          </string-name>
          , Tobias Blechmann, Joachim Klein, Sascha Klüppelholz, and
          <string-name>
            <given-names>Wolfgang</given-names>
            <surname>Leister</surname>
          </string-name>
          .
          <year>2010</year>
          .
          <article-title>Design and Verification of Systems with Exogenous Coordination Using Vereofy</article-title>
          . In Leveraging Applications of Formal Methods, Verification, and
          <string-name>
            <surname>Validation</surname>
          </string-name>
          ,
          <source>Tiziana Margaria and Bernhard Stefen (Eds.)</source>
          . Springer Berlin Heidelberg, Berlin, Heidelberg,
          <fpage>97</fpage>
          -
          <lpage>111</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Christel</given-names>
            <surname>Baier</surname>
          </string-name>
          , Marjan Sirjani, Farhad Arbab, and
          <string-name>
            <given-names>Jan</given-names>
            <surname>Rutten</surname>
          </string-name>
          .
          <year>2006</year>
          .
          <article-title>Modeling component connectors in Reo by constraint automata</article-title>
          .
          <source>Science of Computer Programming</source>
          <volume>61</volume>
          ,
          <issue>2</issue>
          (
          <year>2006</year>
          ),
          <fpage>75</fpage>
          -
          <lpage>113</lpage>
          . https://doi.org/10.1016/j.scico.
          <year>2005</year>
          .
          <volume>10</volume>
          .008 Second International Workshop on Foundations of
          <source>Coordination Languages and Software Architectures (FOCLASA'03).</source>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>Oscar</given-names>
            <surname>Carrillo</surname>
          </string-name>
          , Samir Chouali, and
          <string-name>
            <given-names>Hassan</given-names>
            <surname>Mountassir</surname>
          </string-name>
          .
          <year>2013</year>
          .
          <article-title>Incremental Modeling of System Architecture Satisfying SysML Functional Requirements</article-title>
          .
          <source>In Formal Aspects of Component Software - 10th International Symposium, FACS</source>
          <year>2013</year>
          , Nanchang, China,
          <source>October 27-29</source>
          ,
          <year>2013</year>
          , Revised Selected Papers.
          <fpage>79</fpage>
          -
          <lpage>99</lpage>
          . https://doi.org/10.1007/978-3-
          <fpage>319</fpage>
          -07602-
          <issue>7</issue>
          _
          <fpage>7</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Dave</surname>
            <given-names>Clarke</given-names>
          </string-name>
          , Jose Proenca, Alexander Lazovik, and
          <string-name>
            <given-names>Farhad</given-names>
            <surname>Arbab</surname>
          </string-name>
          .
          <year>2011</year>
          .
          <article-title>Channelbased coordination via constraint satisfaction</article-title>
          .
          <source>Science of Computer Programming</source>
          <volume>76</volume>
          ,
          <issue>8</issue>
          (
          <year>2011</year>
          ),
          <fpage>681</fpage>
          -
          <lpage>710</lpage>
          . https://doi.org/10.1016/j.scico.
          <year>2010</year>
          .
          <volume>05</volume>
          .004 Special issue on the 7th
          <source>International Workshop on the Foundations of Coordination Languages and Software Architectures (FOCLASA'08).</source>
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>Kasper</given-names>
            <surname>Dokter</surname>
          </string-name>
          and
          <string-name>
            <given-names>Farhad</given-names>
            <surname>Arbab</surname>
          </string-name>
          .
          <year>2018</year>
          .
          <article-title>Rule-Based Form for Stream Constraints</article-title>
          .
          <source>In Coordination Models and Languages, Giovanna Di Marzo Serugendo and Michele Loreti (Eds.)</source>
          . Springer International Publishing, Cham,
          <fpage>142</fpage>
          -
          <lpage>161</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>Kasper</given-names>
            <surname>Dokter</surname>
          </string-name>
          and
          <string-name>
            <given-names>Farhad</given-names>
            <surname>Arbab</surname>
          </string-name>
          .
          <year>2018</year>
          .
          <article-title>Treo: Textual Syntax for Reo Connectors</article-title>
          .
          <volume>272</volume>
          (
          <issue>06</issue>
          <year>2018</year>
          ),
          <fpage>121</fpage>
          -
          <lpage>135</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>Gerard</given-names>
            <surname>Holzmann</surname>
          </string-name>
          .
          <year>2003</year>
          .
          <article-title>Spin Model Checker, the: Primer and Reference Manual (first ed</article-title>
          .).
          <string-name>
            <surname>Addison-Wesley Professional</surname>
          </string-name>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <surname>Sung-Shik</surname>
            <given-names>T. Q.</given-names>
          </string-name>
          <string-name>
            <surname>Jongmans</surname>
            and
            <given-names>Farhad</given-names>
          </string-name>
          <string-name>
            <surname>Arbab</surname>
          </string-name>
          .
          <year>2012</year>
          .
          <article-title>Overview of Thirty Semantic Formalisms for Reo</article-title>
          . Sci. Ann. Comp. Sci.
          <volume>22</volume>
          (
          <year>2012</year>
          ),
          <fpage>201</fpage>
          -
          <lpage>251</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>Stephanie</given-names>
            <surname>Kemper</surname>
          </string-name>
          .
          <year>2010</year>
          .
          <article-title>Compositional Construction of Real-Time Dataflow Networks</article-title>
          .
          <source>In Coordination Models and Languages, Dave Clarke and Gul Agha (Eds.)</source>
          . Springer Berlin Heidelberg, Berlin, Heidelberg,
          <fpage>92</fpage>
          -
          <lpage>106</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>S.</given-names>
            <surname>Kemper</surname>
          </string-name>
          .
          <year>2012</year>
          .
          <article-title>SAT-based verification for timed component connectors</article-title>
          .
          <source>Science of Computer Programming</source>
          <volume>77</volume>
          ,
          <issue>7</issue>
          (
          <year>2012</year>
          ),
          <fpage>779</fpage>
          -
          <lpage>798</lpage>
          . https://doi.org/10.1016/j.scico.
          <year>2011</year>
          .
          <volume>02</volume>
          .
          <issue>003</issue>
          (
          <issue>1</issue>
          ) FOCLASA'
          <volume>09</volume>
          (
          <issue>2</issue>
          ) FSEN'
          <fpage>09</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <surname>Natallia</surname>
            <given-names>Kokash</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Christian</given-names>
            <surname>Krause</surname>
          </string-name>
          , and Erik de Vink.
          <year>2012</year>
          .
          <article-title>Reo + mCRL2 : A framework for model-checking dataflow in service compositions</article-title>
          .
          <source>Formal Aspects of Computing 24</source>
          ,
          <issue>2</issue>
          (
          <issue>01</issue>
          <year>Mar 2012</year>
          ),
          <fpage>187</fpage>
          -
          <lpage>216</lpage>
          . https://doi.org/10.1007/ s00165-011-0191-6
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <surname>Natallia</surname>
            <given-names>Kokash</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Christian</given-names>
            <surname>Krause</surname>
          </string-name>
          , and
          <string-name>
            <surname>Erik P. de Vink</surname>
          </string-name>
          .
          <year>2010</year>
          .
          <article-title>Verification of Context-Dependent Channel-Based Service Models</article-title>
          .
          <source>In Formal Methods for Components and Objects</source>
          , Frank S. de Boer,
          <string-name>
            <surname>Marcello M. Bonsangue</surname>
          </string-name>
          , Stefan Hallerstede, and Michael Leuschel (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg,
          <fpage>21</fpage>
          -
          <lpage>40</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <surname>Sebti</surname>
            <given-names>Mouelhi</given-names>
          </string-name>
          , Khalid Agrou, Samir Chouali, and
          <string-name>
            <given-names>Hassan</given-names>
            <surname>Mountassir</surname>
          </string-name>
          .
          <year>2015</year>
          .
          <article-title>ObjectOriented Component-Based Design using Behavioral Contracts: Application to Railway Systems</article-title>
          .
          <source>In Proceedings of the 18th International ACM SIGSOFT Symposium on Component-Based Software Engineering, CBSE</source>
          <year>2015</year>
          , Montreal, QC, Canada, May 4-
          <issue>8</issue>
          ,
          <year>2015</year>
          .
          <fpage>49</fpage>
          -
          <lpage>58</lpage>
          . https://doi.org/10.1145/2737166.2737171
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>P.</given-names>
            <surname>Pelliccione</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Inverardi</surname>
          </string-name>
          , and
          <string-name>
            <given-names>H.</given-names>
            <surname>Muccini</surname>
          </string-name>
          .
          <year>2009</year>
          .
          <article-title>CHARMY: A Framework for Designing and Verifying Architectural Specifications</article-title>
          .
          <source>IEEE Transactions on Software Engineering</source>
          <volume>35</volume>
          , 3 (May
          <year>2009</year>
          ),
          <fpage>325</fpage>
          -
          <lpage>346</lpage>
          . https://doi.org/10.1109/TSE.
          <year>2008</year>
          .104
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>Stavros</given-names>
            <surname>Tripakis</surname>
          </string-name>
          and
          <string-name>
            <given-names>Costas</given-names>
            <surname>Courcoubetis</surname>
          </string-name>
          .
          <year>1996</year>
          .
          <article-title>Extending promela and spin for real time</article-title>
          .
          <source>In Tools and Algorithms for the Construction and Analysis of Systems, Tiziana Margaria and Bernhard Stefen (Eds.)</source>
          . Springer Berlin Heidelberg, Berlin, Heidelberg,
          <fpage>329</fpage>
          -
          <lpage>348</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>