<!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>Deciding Hedged Bisimilarity</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Alessio Mansutti</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Marino Miculan</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>DMIF, University of Udine</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>LSV, CNRS, ENS Paris-Saclay, Université Paris-Saclay</institution>
          ,
          <country country="FR">France</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The spi-calculus is a formal model which allows to reduce the verification of security properties of cryptographic protocols to the verification of observational equivalences between spi processes. In this paper we prove that hedged bisimilarity, which is equivalent to barbed equivalence, is decidable on finite spi-calculus processes. The algorithm we provide works with any term equivalence satisfying a simple set of conditions, thus encompassing many different encryption schemata.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>finite spi-calculus processes; to this end, we will introduce the notion of
canonical processes as canonical representatives of congruence classes. Finite canonical
processes can be analyzed to determine the (finite) space of terms and names
which have to be considered at each step of the bisimulation game. Based on
this result, we provide the algorithm for the verification of hedged bisimulation.
2</p>
    </sec>
    <sec id="sec-2">
      <title>The spi-calculus</title>
      <p>The spi-calculus extends the -calculus terms with primitives for encryption and
decryption. Formally, let N be a countable set of names (typically of channels)
ranged over by a; b; c; : : : , and V a countable set of variable symbols, ranged over
by x; y; z; : : : . The set of spi-calculus terms is given by the grammar
A ::= a j x</p>
      <p>t ::= A j (t1; t2) j 1(t) j 2(t) j ft1gt2 j Dt2 (t1)
::= true j : j 1 ^ 2 j [t1 = t2] j isname(t) j ispair(t) j isenc(t)
Intuitively, ft1gt2 denotes the term t1 encrypted using key t2, and (t1; t2) is the
pair composed by t1 and t2. The decryption Dt2 (t1) opens t1 using the key t2, and
1(t), 2(t) are the two projections. We call the encryption and pairing operators
constructors, and the projection and decryption operators destructors.</p>
      <p>
        We denote by fv(t), n(t) the sets of (free) variables and names in term t,
respectively. As usual, a term t is ground if fv(t) = ;. A ground term is moreover
said to be a message whenever no destructor appears in it. We denote with T
and G respectively the sets of all terms and ground terms. M denotes the set of
all messages, ranged over by M; N; : : : . Lastly, ranges over boolean expression,
where [t1 = t2] is the equality test between terms and isname(t), ispair(t) and
isenc(t) check whether a term t is a name, a pair of an encryption respectively.
These last three operators, not present in the original definition [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], reflect the
fact that often a process (e.g., an attacker) can easily infer if a term is a name,
a pair or an encrypted value, by observing its structure or by knowing how data
are encoded (in accordance to Kerckhoffs’s principle).
      </p>
      <p>
        Moreover, we extend further the calculus by abstracting from the syntactical
equality normally used for [t1 = t2], see [
        <xref ref-type="bibr" rid="ref1 ref3 ref5">1,3,5</xref>
        ]. To do so we introduce a typing
system for ground terms. Types are defined by the grammar:
::= N j B j 1
2 j C( )
where N; B are the base types of names and boolean values respectively, 1 2 is
the pair type and C( ) is the type of encrypted terms of type . Figure 1 shows
the rules for the typing judgment t : over ground terms. For well-typed terms
t, we denote with keys(t) the set of names that are used as keys. Formally,
keys(t) = fkey(t2) j there is t1 s.t. Dt2 (t1) or ft1gt2 are a subterm of tg
where key(a) = a, key( i(t1; t2)) = key(ti) and key(Dt3 (ft1gt2 )) = key(t1).
      </p>
      <p>Ground terms are taken up-to some computable structural congruence =.
We can think of two terms in the same equivalence class of = as being
computationally equivalent, i.e. executing the encryption/decryption algorithms on them
leads to the same value. With this novelty we aim to account for different types
true : B
t : 1
i(t) : i</p>
      <p>: B
: : B
2 i = 1; 2
1 : B 2 : B</p>
      <p>1 ^ 2 : B
t1 : t2 : N
ft1gt2 : C( )
[t1 = t2] : B
t1 : C( ) t2 : N</p>
      <p>Dt2 (t1) :
isname(t) : B
ispair(t) : B</p>
      <p>isenc(t) : B
of encryption schemata, which can be expressed by considering different = as
long as, for any t : 1 and t0 : 2 such that t = t0, it respects the three properties:
1. Type equivalence t and t0 have the same type, i.e. 1 = 2;
2. Key equivalence the same names are used as keys and, by changing any of
them with a fresh name we obtain two equivalent terms. Formally,
keys(t) = keys(t0) ^ 8a 2 keys(t)8b 2 N n (n((t; t0))) : tfb=ag = t0fb=ag
where tfb=ag is the substitution replacing all occurrences of a in t with b.
3. Deterministic decryption erasing all encryptions and decryption and
applying the same projections leads to the same term, i.e. after applying the
rewriting rules i((t1; t2)) ! ti, Dt2 (t1) ! t1 and ft1gt2 ! t1 in all subterms
of t and t0 we obtain two syntactically equivalent terms.</p>
      <p>
        It is easy to check that the equivalence used in [
        <xref ref-type="bibr" rid="ref1 ref3 ref5">1,3,5</xref>
        ] respects all these conditions.
Other encryption algorithms (and other abstract data types) can be considered
by adapting the congruence relation, as long as it respects the properties above.
For example commutative ciphers (like Elgamal encryption) can be considered
by adding the axiom 8M 2 G 8a; b 2 N : ffM gagb = ffM gbga.
Definition 1 (Processes). The spi-calculus processes are defined as follows:
P ::= 0 j A(x):P j Ahti:P j P1jP2 j P1 + P2 j ( m)P j!P j :P j let x = t in P
where t and are respectively a term and a boolean formula, x is a variable, m
is a list of names and A can be both a name or a variable.
      </p>
      <p>
        We extend fv on processes, so that fv(P ) is the set of free variables occurring in
P , and denote with fn(P ) the set of free names of P (i.e. names not occurring in
the scope of a ( m) operator). The syntax above is the usual one from -calculus
[
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], with these differences:
– input/output operations exchange terms, not only names;
– :P is the guard operator, that behaves as P if the boolean formula holds;
– let x = t in P is the let operator that computes the value of t, binds the
variable x to it and then executes P .
      </p>
      <p>Processes of the spi-calculus are taken up-to the usual structural congruence
familiar from the -calculus theory and shown in Figure 2.</p>
      <p>QjP
(P jQ)jR</p>
      <p>P (QjR)
P +Q</p>
      <p>Q+P
(P +Q)+R</p>
      <p>P +(Q+R)
( m)(P jQ)
( m)P jQ if m 62 fn(Q)
( m)( n)P
( n)( m)P</p>
      <p>P and Q are -equivalent</p>
      <p>P Q</p>
      <p>P
P + R</p>
      <p>Q
Q + R</p>
      <p>P
( m)P</p>
      <p>Q
( m)Q</p>
      <p>P
Q</p>
      <p>Q
P</p>
      <p>P</p>
      <p>P</p>
      <p>P jR
Q Q
P R</p>
      <p>Q
QjR
R</p>
      <p>To define the operational semantics of the spi-calculus we need to evaluate
ground terms and boolean expressions. The evaluation is defined over well-typed
terms, where each type denotes a set of values. The interpretation of base types
is defined as I(N) = N and I(B) = ftrue; falseg, whereas for pairs and
encryptions it is defined as:</p>
      <p>I( 1</p>
      <p>I(C( )) = ffM ga j M 2 I(C( )); a 2 N g==</p>
      <p>
        2) = f(M1; M2) j M1 2 I( 1); M2 2 I( 2)g==
Definition 2 (Evaluation). The evaluation for well-typed ground terms and
boolean expressions is a partial function [[ ]] defined recursively as follows:
[[a]] = a 2 N
[[true]] = true
[[ 1 ^ 2]] = [[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]] ^ [[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]]
[[(t1; t2)]] = ([[t1]]; [[t2]])
[[ 1(t)]] = v1 if [[t]] = (v1; v2)
[[ 2(t)]] = v2 if [[t]] = (v1; v2)
[[: ]] = :[[ ]] [[ft1gt2 ]] = f[[t1]]g[ t2]
[[Dt2 (t1)]] = t 2 if [[t2]] = a 2 N and [[t1]] = ftga 2 I(C( ))
[[[t1 = t2]]] = true if [[t1]] = [[t2]]; false otherwise
[[isname(t1)]] = true if [[t1]] 2 N ; false otherwise
[[ispair(t1)]] = true if [[t1]] 2 I( 1
      </p>
      <p>
        2) for some 1 and 2; false otherwise
[[isenc(t1)]] = true if [[t1]] 2 I(C( )) for some ; false otherwise
Following [
        <xref ref-type="bibr" rid="ref1 ref5">1,5</xref>
        ] we define a late input operational semantics for spi-calculus
processes. We first define the reduction relation, which describes how processes
unfold and execute internal computations.
      </p>
      <p>well-typed [[ ]] = true
:P &gt; P</p>
      <p>t well-typed [[t]] = v
let x = t in P &gt; P fv=xg</p>
      <p>P &gt; P 0
P P 0
Then, the late operational semantics of the spi-calculus is represented by a
labelled transition relation P ! Q, where 2 fa; a j a 2 N g [ f g is the name
of a channel (for both input and output) or the silent transition (also called
-transition), and Q ranges over processes, concretions and abstractions (see
below). The rules of this operational semantics are in Figure 3.
(input)</p>
      <p>a 2 N
a(x)P a! (x)P
(output)
t well-typed [[t]] = M
ahtiP
a! ( )hM iP
(interaction)
(restriction)</p>
      <p>P
P</p>
      <p>P jQ</p>
      <p>! D
( m)P
(sum)</p>
      <p>P
P + Q
! P 0
! P 0
n! (x)P 0 Q</p>
      <p>n! ( m)hM iQ0
! ( m)(P 0fM=xgjQ0)</p>
      <p>fmg \ fn(P 0) = ;
62 m [ m
! ( m)D
(equivalence)</p>
      <p>(parallel)
P</p>
      <p>Q Q</p>
      <p>P
P jQ
! P 0
! P 0jQ
! Q0 Q0</p>
      <p>P 0
P
! P 0</p>
      <p>Concretions are “message-continuation” pairs resulting from an output: a
process executing an output transition yields the concretion ( )hM iQ (where ( )
is a restriction on a empty set of names) which can be seen as a process ready
to send a message and to continue as Q. On the other hand, an abstraction
(x)P is a “process with a hole”, resulting from an input transition; it can be
seen as process waiting to receive a message M and continue as P fM=xg. An
abstraction (x)P and a concretion ( m)hM iQ, where m is a list of names, can
synchronize resulting in a process where the message M is received by (x)P .
In order to define this interaction, we need to extend restriction and parallel
composition operators to abstractions and concretions, as follows:
( a)( m)hM iP ,
( m)(x)P , (x)( m)P
(( a; m)hM iP
( m)hM i( a)P
if n 2 fn(M )
otherwise
Rj(x)P , (x)(RjP )</p>
      <p>where x 62 fv(R)
Rj( m)hM iP , ( m)hM i(RjP )
where fmg \ fn(R) = ;</p>
      <p>As usual, we denote with P =) Q the transitive closure of the -transition
whereas P =) Q denotes P =) ! Q.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Hedged bisimilarity</title>
      <p>
        We now define the hedged bisimilarity, firstly introduced in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. A hedge is a finite
subset of M M (where M is the set of all messages); we denote by H the
set of all hedges. A hedge h expresses a relation between messages used by two
processes P and Q, so that if (M; N ) 2 h then M has the same effects on P
that N has on Q. For this reason not all hedges are well-formed (e.g. a hedge
that associates a name with a pair) and a notion of consistency is needed to
understand which hedges are really relevant for the bisimulation.
Definition 3 (Consistent Hedge). A hedge h is consistent if and only if it is
pair-free (i.e. all messages in h are not pairs) and for (M; N ) 2 h we have that:
– M 2 N () N 2 N ;
– for all (M 0; N 0) 2 h, if M = M 0 or N = N 0 then M = M 0 and N = N 0;
– if M = fM 0gk e N = fN 0gj then k 62 1(h) and j 62 2(h).
      </p>
      <p>Here (and afterward), we abuse the projection operators i to be used on any
tuple, also outside of the calculus. The first condition requires a consistent hedge
to match names with names. The second one requires that elements are taken
up to equivalence on terms =. The last one requires that all encrypted messages
cannot be decrypted using keys in h: encrypted messages in a consistent hedge
cannot be reducible. Alongside hedges, we define synthesis, analysis, irreducible.
The synthesis of a hedge h is the set of message pairs that can be built from h.
Definition 4 (Synthesis). The synthesis S(h) of a hedge h is the least set s.t.:
– h S(h);
– if (M; N ) 2 S(h), (k; j) 2 S(h) and k; j 2 N then (fM gk; fN gj) 2 S(h);
– if (M1; N1) 2 S(h) and (M2; N2) 2 S(h) then ((M1; M2); (N1; N2)) 2 S(h).
We write h ` M $ N for (M; N ) 2 S(h), and in this case we say that M and
N are homologous w.r.t. h.</p>
      <p>The analysis of a hedge is the set of all message pairs obtained by “opening" the
messages of h via decryption or projection. The irreducible are those elements
in the analysis of a hedge that cannot be reduced further. Formally:
Definition 5 (Analysis). The analysis A(h) of a hedge h is the least set s.t.:
– h A(h);
– if (fM gk; fN gj) 2 A(h) and (k; j) 2 A(h) then (M; N ) 2 A(h);
– if ((M1; N1); (M2; N2)) 2 A(h) then (M1; M2) 2 A(h) and (N1; N2) 2 A(h).
Moreover, we define the irreducible I(h) of a hedge h as</p>
      <p>I(h) , A(h) n (f(C; D) 2 A(h) j C = fM gk; D = fN gj; (k; j) 2 A(h)g
[ f((M1; N1); (M2; N2)) 2 A(h)g)
It should be noted that all elements that can be reduced in the analysis can be
derived from the irreducible via synthesis, i.e. S(I(h)) = S(A(h)). Lastly, since
every hedge is a finite set, its analysis and irreducible are also finite.</p>
      <p>A hedged relation R is a subset of H P P, where P is the set of all
processes. We write h ` P RQ when (h; P; Q) 2 R. Moreover, we say that R is
consistent if, for all h 2 H, h ` P RQ implies that the hedge h is consistent.
Definition 6 (Hedged simulation). A consistent hedged relation R is a hedged
simulation if, whenever h ` P RQ we have that:
– if P ! P 0 then there exists Q0 such that Q =) Q0 and h ` P 0RQ0;
– if P a! ( m)hM iP 0 and m \ (fn(P ) [ n( 1(h))) = ; then there exist b 2 N
and a concretion ( n)hN iQ0 such that h ` a $ b, n\(fn(Q)[n( 2(h))) = ;,
Q =)b ( n)hN iQ0 and I(h [ f(M; N )g) ` P 0RQ0;</p>
      <p>
        a! (x)P 0 then there exist b 2 N and an abstraction (y)Q0 such that
h ` a $ b, Q =)b (y)Q0 and for all B N finite such that B \ (fn(P ) [
fn(Q) [ n(h)) = ; and h [ idB is consistent, for all pairs (M; N ) of ground
terms, if h [ idB ` M $ N then h [ idB ` P 0fM=xgRQ0fN=yg.
The first condition requires that for each -transition from P there is a path of
-transitions from Q such that the two target processes are in the simulation R.
The second condition requires that for each output transition of P , labelled with
a, there is an output transition from Q labelled with b (and possibly preceded by
some silent transitions); moreover, a and b are homologous in h and the processes
after the two output operations are paired in R w.r.t. a consistent hedge that
extends h by pairing the two messages M and N . The last condition requires
that for each input transition of P with label a, there is an input transition from
Q labelled with b (and possibly preceded by some silent transitions); moreover,
a and b are homologous in h and for all finite set B of fresh names w.r.t. P ,
Q and h, the abstractions (x)P 0 and (x)Q0 are paired in the simulation R for
each input messages (M; N ) homologous by h [ idB. Hedges simulation leads
to the definition of hedged bisimulation and bisimilarity. Remarkably, hedged
bisimilarity coincides with barbed equivalence [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>Definition 7 (Hedged bisimulation/bisimilarity). A hedged simulation R
is a hedged bisimulation if R 1 = f(h 1; Q; P ) j h ` P RQg is also a hedged
simulation (where h 1 = f(N; M )j(M; N ) 2 hg). The hedged bisimilarity, written
, is the greatest hedged bisimulation, i.e. the union of all hedged bisimulations.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Decidability of hedged bisimulation for finite processes</title>
      <p>
        Clearly, bisimilarity is undecidable for general processes (see [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]). Hence, we focus
on finite ones, i.e. without the “ !” operator. Even on finite processes decidability
of hedged bisimilarity is not obvious, since the third condition in Definition 6
requires to check the equivalence of two abstractions for an infinite number of
messages w.r.t. any finite set of fresh names. In this section we show that this
problem can be avoided as there is only a finite number of names and messages
that need to be considered in deciding if two processes are hedged bisimilar.
      </p>
      <p>
        The idea behind our result, and similar to that in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] for framed bisimilarity,
is the following: if (x)P is finite, then it can inspect a message (using let and
guard operators) up to a certain depth k. If a message M with more than k
nested constructors is received by (x)P , then it can only be partially analysed
by P . Hence, all messages M 0 equivalent to M up to depth k will not cause
any difference in the execution of (x)P , apart from output messages. Indeed,
P fM=xg and P fM 0=xg can output different messages (i.e. different parts of
M and M 0 respectively), but the two outputs are derived from M and M 0 by
applying the same operations, and only messages obtained through decryption
are interesting, since they can update the hedge h yielding a richer theory.
      </p>
      <p>Before formalizing this idea, we introduce a canonical form of processes and
show that any process can be translated into an equivalent one in canonical form.
Definition 8 (Canonical form). A process P is in canonical form if in P
– any [t1 = t2] is such that t1 and t2 are variables or messages;
– constructors do not occur inside terms t of let x = t in Q operators;
– destructors do not occur inside any term t of output operators ahtiQ;
– for any occurrence of isname(t), ispair(t) and isenc(t) in P , t is a variable.
Proposition 1. For all P there is a canonical process Q such that P
Q.</p>
      <p>The proof is based on defining a rewriting system on processes which preserves
congruence and terminates on canonical processes. Thanks to this result, we can
restrict ourselves to processes in canonical form without loss of generality.</p>
      <p>For terms and boolean expressions, we define their maximal constructor
depth. Intuitively, this depth is related to the maximum size of messages that
can satisfy a boolean expression when replacing a free variable appearing in it.
Definition 9 (Maximal constructor depth). The maximal constructor depth
mcd(t) of a term t is defined inductively by the clauses
mcd(n) = 0
mcd(x) = 0
mcd((t1; t2)) = max(mcd(t1); mcd(t2)) + 1
mcd(ft1gt2 ) = mcd(t1) + 1
and then extended to boolean formulas as follows:
mcd(true) = 0</p>
      <p>mcd(: ) = mcd( )
mcd([x = y]) = 0
mcd(ispair(x)) = 1
mcd( 1 ^ 2) = max(mcd( 1); mcd( 2))
mcd([x = M ]) = mcd(M )
mcd(isname(x)) = 1</p>
      <p>mcd(ispair(x)) = 1
Definition 10 (k-homologous). Given h 2 H and M; N 2 M, we define
h `k M $ N</p>
      <p>4
() h ` M $ N and k = max(mcd(M ); mcd(N ))
Whenever h `k M $ N we say that M and N are k-homologous in h.
The notion of k-homologous terms allows us to deduce an upper bound on the
number of names that are required to prove that h ` M $ N .</p>
      <p>Lemma 1. Let h 2 H and M; N 2 M be such that max(mcd(M ); mcd(N )) = k.
If there is a finite set of names B N such that B \ n(h) = ;, h [ idB is
consistent and h [ idB `k M $ N , then there exists B0 N such that jB0j 2k
and satisfying the same three properties.</p>
      <p>Proof. Suppose jBj 2k and that h ` M $ N does not hold, otherwise the
lemma is trivially satisfied. We have that M and N are in the synthesis S(h[idB)
and, at worst, all names in M and N are in B. As k = max(mcd(M ); mcd(N ))
and both encrypt and pairing are binary constructors, M and N can be
represented as binary trees with height k and with therefore at most 2k leafs. Hence
B can be reduced to a set B0 such that jB0j 2k and h [ idB0 `k M $ N . As
B0 B, it also holds that h [ idB0 is consistent and B0 \ n(h) = ;. tu
Lemma 1 leads to the notion of d-hedged bisimilarity : a hedged bisimilarity
where size of messages and number of fresh names are bounded. We define first
the corresponding simulation; differences with Definition 6 are put in boxes.
Definition 11 (d-hedged simulation). For any integer d 0, a consistent
hedged relation R is a d-hedged simulation if whenever h ` P RQ we have that:
– if P ! P 0 then there exists Q0 such that Q =) Q0 and h ` P 0RQ0;
– if P a! ( m)hM iP 0 and m \ (fn(P ) [ n( 1(h))) = ; then there exist b 2 N
and a concretion ( n)hN iQ0 such that h ` a $ b, n\(fn(Q)[n( 2(h))) = ;,
b</p>
      <p>Q =) a( n)hN iQ0 and I(h [ f(M; N )g) ` P 0RQ0;
– if P ! (x)P 0 then there exist b 2 N and an abstraction (y)Q0 such that
h ` a $ b, Q =)b (y)Q0 and for all B N , where jBj 2d , B \ (fn(P ) [
fn(Q) [ n(h)) = ; and h [ idB is consistent, for all pairs (M; N ) of ground
terms, if 9k d h [ idB `k M $ N then h [ idB ` P 0fM=xgRQ0fN=yg.
Definition 12 (d-hedged bisimulation/bisimilarity). A d-hedged
bisimulation is a d-hedged simulation R such that R 1 = f(h 1; Q; P ) j h ` P RQg is
also a d-hedged simulation (where h 1 = f(N; M )j(M; N ) 2 hg). The d-hedged
bisimilarity, written d, is the greatest d-hedged bisimulation, i.e. the union of
all d-hedged bisimulations.</p>
      <p>Since a d-hedged bisimulation is a hedged bisimulation up to a certain bound on
the size of messages and fresh names, its definition leads to the following result.
Lemma 2. (1) Any hedged bisimulation is a d-hedged bisimulation for all d 0.
(2) When d &gt; 0, a d-hedged bisimulation is also a (d 1)-hedged bisimulation.</p>
      <p>We now aim to show that for any processes P; Q, there exists d 0 such
that 9h 2 H h ` P d Q ) 9h 2 H h ` P Q. This statement is not valid for
arbitrary infinite processes since these can analyse messages of arbitrary depth.
Therefore, we now consider only the fragment of spi-calculus without replication.</p>
      <p>Notice that let and guard operators are the only constructs that can check
the structure of messages. For instance, c(y)(let x = 1(Db(y)) in [x = t]:P )
first decompose the message received on the channel c by applying Db(y) and 1,
and then test the result against a term t. Therefore, messages with constructor
depth greater than jtj + 2 (where 2 refers to the number of destructors in the let
expression) will automatically fail the test. For let expressions, this observation
leads to the following definition of analysis depth.</p>
      <p>Definition 13 (Analysis depth). Let P be a finite (canonical) process. The
analysis depth of P , denoted by ad(P ), is defined inductively by the clauses
ad(0) = 0
ad(( m)P ) = ad(P )
ad(M hti:P ) = ad(P )
ad(M (x):P ) = ad(P )
ad(P jQ) = ad(P ) + ad(Q)
ad( :P ) = ad(P )
ad(P + Q) = max(ad(P ); ad(Q))
ad(let x = t in P ) = ad(P ) + mdd(t)
where the maximal destructor depth mdd of a term is defined as follows:
mdd(ft1gt2 ) = max(mdd(t1); mdd(t2))
mdd((t1; t2)) = max(mdd(t1); mdd(t2))
mdd( i(t)) = mdd(t) + 1</p>
      <p>mdd(Dt2 (t1)) = max(mdd(t1); mdd(t2)) + 1:
Analysis depth, together with the maximal constructor depth previously defined,
are used to derive the upper-bound on the size of messages that are needed to
test in order to correctly decide if two processes are hedged bisimilar. We extend
the notion of maximal constructor depth to hedges and processes, where the
latter is well-defined as our processes are finite. For any hedge h and process P ,
mcd(h) = minfk j for all (M; N ) 2 h : h `k M $ N g
mcd(P ) = maxfmcd( ) j P ( [ =))Q and
occurs in Qg
Definition 14 (Critical depth). Let P and Q be two finite processes and let
h be a hedge. The critical depth CD(h; P; Q) is defined by</p>
      <p>CD(h; P; Q) , mcd(h) + max(ad(P ) + mcd(P ); ad(Q) + mcd(Q))
As we will formally see below, when checking if a d-hedged simulation exists,
given a hedge h we can correlate two input P a! (x)P 0 and Q !b (x)Q0, simply
by testing the equivalence between P 0 and Q0 w.r.t. messages with maximal
constructor depth less or equal than CD(h; P; Q). Moreover, Lemma 1 limits the
number of fresh names we must consider to 2CD(h;P;Q). Messages that exceed
these bounds can indeed be pruned without affecting the behaviour of processes.
Definition 15 (d-pruning). Let M; N 2 M and h be a consistent hedge such
that h ` M $ N . For d 0, the d-pruning of M , N w.r.t. h, denoted by
prd(h; M; N ), is defined as (h; M; N ) if (M; N ) 2 h, and otherwise as:
pr0(h; M; N ) = (h [ idfag; a; a) where a 2 N is fresh
prd+1(h; fU gJ ; fV gK ) = (h0; fM 0gJ ; fN 0gK )
prd+1(h; (L1; R1); (L2; R2)) = (h00; (L01; R10); (L02; R20))
where (J; K) 2 h and prd(h; U; V ) = (h0; M 0; N 0)
where prd(h; L1; L2) = (h0; L01; L02)
and prd(h0; R1; R2) = (h00; R10; R20):
Intuitively, the d-pruning of a message pair (M; N ) generates a message pair
(M 0; N 0) where subterms appearing at levels greater than d are replaced by
fresh names w.r.t. h, M and N . Then, the d-pruning is unique up to fresh
names. Critical depth and d-pruning are readily extended to single processes
and messages as CD(h; P ) , CD(h; P; P ) and prd(h; M ) , prd(h; M; M ). As
stated in the next two lemmata, pruning terms that exceeds CD(h; P ) do not
modify the behaviour of the process P .
Lemma 3. Let (x)P be an abstraction of a finite process, h be a hedge and
d CD(h; P ). For every message M the pruning N = 2(prd(h; M )) does not
affect the reduction relation. That is,
– ( :P )fM=xg &gt; P fM=xg if and only if ( :P )fN=xg &gt; P fN=xg;
– (let y = t in P )fM=xg &gt; P fM=xgf[[tfM=yg]]g if and only if</p>
      <p>(let y = t in P )fN=xg &gt; P fN=xgf[[tfN=yg]]g
Lemma 4. Let (x)P be an abstraction of a finite process, h be a hedge and
d CD(h; P ). For every message M the pruning N = 2(prd(h; M )) is so that
– P fM=xg n! (y)P 0fM=xg if and only if P fN=xg n! (y)P 0fN=xg;
– QfM=xg n! (( m)htiQ0)fM=xg iff QfN=xg n! (( m)htiQ0)fN=xg.
This lemma also implies that -transitions are preserved, because -transitions
are introduced only by the interaction rule (Figure 3); as shown in the diagram
below, the conclusions of this rule are preserved because the premises are.</p>
      <sec id="sec-4-1">
        <title>Lemma 4</title>
        <p>P fM=xg n! ((y)P 0)fM=xg QfM=xg n! (( m)htiQ0)fM=xg
(P jQ)fM=xg ! (( m)(P 0ft=ygjQ0))fM=xg</p>
      </sec>
      <sec id="sec-4-2">
        <title>Lemma 4</title>
        <p>P fN=xg n! ((y)P 0)fN=xg QfN=xg n! (( m)htiQ0)fN=xg</p>
        <p>(P jQ)fN=xg ! (( m)(P 0ft=ygjQ0))fN=xg
We can then reduce hedged bisimulation to d-hedged bisimulation.
Theorem 1. Let P and Q be two finite processes, and h 2 H a consistent hedge.
There is an integer d such that h ` P d Q, if and only if h ` P Q.</p>
        <p>h0 ` P 0fM 0=xg
Proof. (() A hedged bisimulation is a d-bisimulation for all d.
()) By Lemmata 3, 4 and the fact that the following is a hedged bisimulation:
&lt;&gt;8(h; P; Q) PP; =Q Pfi n0fitMe =axngd; Q9h=02QH0fN9P=y0;gQ;(0h20; MP 09;MN ;0)N=2prMd(hs;.tM.; N );=&gt;9
&gt;: &gt;;
d Q0fN 0=yg; for d = CD(h; P; Q)
tu
As every quantification is bounded, d-hedged bisimilarity is decidable on finite
processes. Then, so is hedged bisimilarity.</p>
        <p>Corollary 1. Let P and Q be two finite processes and h 2 H a consistent hedge.
It is decidable whether h ` P Q.</p>
        <p>An algorithm to decide hedged bisimilarity is shown in Figure 4. For P; Q two
finite (canonical) processes and h a hedge (which represents the initial knowledge
of the attacker, e.g. public channels, known keys, nonces, etc.), HB(h; P; Q) =
true if and only if there is a d such that (h; P; Q) are d-hedged bisimilar. Hence,
by Theorem 1 we have h ` P Q if and only if HB(h; P; Q) = true.
2 H(h; P; Q) =
3 for each P</p>
        <p>! P 0 s e l e c t Q =) Q0 such that HB(h; P 0; Q0)
4 for each P a! ( m)htiP 0 s e l e c t Q =)b ( n)ht0iQ0 such that</p>
        <p>(a; b) 2 I(h) , h0 := I(h [ f([ t] ; [ t0] )g) consistent and HB(h0; P 0; Q0)
5
7
8
9
6 for each P a! (x)P 0
l e t d = CD(h; P; Q) and s e l e c t (Q =)b (x)Q0 and B
N ) such that
(a; b) 2 I(h) , jBj = 2d , B \ (fn(P ) [ fn(Q) [ n(h) [ fa; bg) = ; , h0 := h [ idB consistent
and for each (M; N) s . t . (9k</p>
        <p>d : h0 `k M $ N) : HB(h0; P 0fM=xg; Q0fN=xg)</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Conclusions and further work</title>
      <p>In this paper we have proved that hedged bisimilarity (and hence barbed
equivalence) is decidable on finite processes of the spi-calculus. As we generalised the
spi-calculus to abstract from the syntactical equality between terms, our
algorithm can be readily applied to different encryption/decryption schemata just
by changing the congruence rules, as long as some mild conditions are satisfied.</p>
      <p>
        Thanks to this extension, we believe that the approach followed in this paper
can be applied to decide hedged bisimilarity between processes of more
expressive calculi, in particular the applied -calculus (which is used in tools such as
ProVerif [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]) and calculi with quantitative aspects [
        <xref ref-type="bibr" rid="ref4 ref6">6,4</xref>
        ]. Also considering larger
fragments of the spi-calculus beyond finite processes, e.g. depth- and
restrictionbounded processes, seems particularly promising.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>M.</given-names>
            <surname>Abadi</surname>
          </string-name>
          and
          <string-name>
            <given-names>A. D.</given-names>
            <surname>Gordon</surname>
          </string-name>
          .
          <article-title>A calculus for cryptographic protocols: The spi calculus</article-title>
          .
          <source>Inf. Comput.</source>
          ,
          <volume>148</volume>
          (
          <issue>1</issue>
          ):
          <fpage>1</fpage>
          -
          <lpage>70</lpage>
          ,
          <year>1999</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>B.</given-names>
            <surname>Blanchet</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Abadi</surname>
          </string-name>
          , and
          <string-name>
            <given-names>C.</given-names>
            <surname>Fournet</surname>
          </string-name>
          .
          <article-title>Automated verification of selected equivalences for security protocols</article-title>
          .
          <source>In Proc. 20th LICS</source>
          , pages
          <fpage>331</fpage>
          -
          <lpage>340</lpage>
          . IEEE,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>J.</given-names>
            <surname>Borgström</surname>
          </string-name>
          and
          <string-name>
            <given-names>U.</given-names>
            <surname>Nestmann</surname>
          </string-name>
          .
          <article-title>On bisimulations for the spi calculus</article-title>
          .
          <source>Mathematical Structures in Computer Science</source>
          ,
          <volume>15</volume>
          (
          <issue>3</issue>
          ):
          <fpage>487</fpage>
          -
          <lpage>552</lpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>T.</given-names>
            <surname>Brengos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Miculan</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Peressotti</surname>
          </string-name>
          .
          <article-title>Behavioural equivalences for coalgebras with unobservable moves</article-title>
          .
          <source>J. Logica. Algebraic Methods Program.</source>
          ,
          <volume>84</volume>
          :
          <fpage>826</fpage>
          -
          <lpage>852</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>H.</given-names>
            <surname>Hüttel</surname>
          </string-name>
          .
          <article-title>Deciding framed bisimilarity</article-title>
          .
          <source>In Proceedings of Infinity'02</source>
          , volume
          <volume>68</volume>
          of Electronic Notes in Theoretical Computer Science, pages
          <fpage>1</fpage>
          -
          <lpage>18</lpage>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>M.</given-names>
            <surname>Miculan</surname>
          </string-name>
          and
          <string-name>
            <given-names>M.</given-names>
            <surname>Peressotti</surname>
          </string-name>
          .
          <article-title>GSOS for non-deterministic processes with quantitative aspects</article-title>
          .
          <source>In Proc. QAPL</source>
          , volume
          <volume>154</volume>
          <source>of ENTCS</source>
          , pages
          <fpage>17</fpage>
          -
          <lpage>33</lpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>R.</given-names>
            <surname>Milner</surname>
          </string-name>
          and
          <string-name>
            <given-names>D.</given-names>
            <surname>Sangiorgi</surname>
          </string-name>
          .
          <article-title>Barbed bisimulation</article-title>
          .
          <source>In ICALP</source>
          , volume
          <volume>623</volume>
          of Lecture Notes in Computer Science, pages
          <fpage>685</fpage>
          -
          <lpage>695</lpage>
          . Springer,
          <year>1992</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>D.</given-names>
            <surname>Sangiorgi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Walker</surname>
          </string-name>
          .
          <article-title>The -calculus: a Theory of Mobile Processes</article-title>
          . CUP,
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>