Compositional Analysis of Protocol Equivalence in the Applied π -Calculus Using Quasi-open Bisimilarity

. This paper shows that quasi-open bisimilarity is the coarsest bisim-ilarity congruence for the applied π -calculus. Furthermore, we show that this equivalence is suited to security and privacy problems expressed as an equivalence problem in the following senses: (1) being a bisimilarity is a safe choice since it does not miss attacks based on rich strategies; (2) being a congruence it enables a compositional approach to proving certain equivalence problems such as unlinkability; and (3) being the coarsest such bisimilarity congruence it can establish proofs of some privacy properties where ﬁner equivalences fail to do so.


Introduction
The applied π-calculus [2,5] is a generalisation and extension of the π-calculus [37] useful for verifying security and privacy properties of cryptographic protocols. Some security and privacy properties may be expressed as an equivalence problem, for instance by comparing the actual protocol to an idealised specification that trivially satisfies the desired property [8,23,24,28,33]. This paper employs good-practice principles for designing process equivalences for cryptographic calculi. We define two equivalences: one based on testing and another based on labelled transitions. The two equivalences are proven to coincide; thereby establishing that observables represented by the labels on transitions capture all relevant information about all testing contexts. This paradigm is suited to cryptographic calculi, where the testing environment contains attackers that can be inserted into a network without direct access to key material and other secrets, yet may violate security and privacy requirements of a protocol. By using an equivalence based on labelled transitions for cryptographic calculi we learn that we do not need to know all details of such malicious agents, and that to characterise such attackers it is sufficient to look only at the input and output actions of honest agents S. Yurkov is supported by the Luxembourg National Research Fund through grant PRIDE15/10621687/SPsquared. modelled in the specification of the protocol. Considering only the inputs and outputs of honest agents makes the formulation of process equivalence problems in terms of labelled transitions easier to check, compared to checking all malicious agents in full.
Amongst the most powerful testing equivalences proposed over the years is open barbed bisimilarity [41], and its equivalent mild simplification saturated bisimilarity [13], which were inspired by dynamic bisimilarity [38]. These testing equivalences consider all contexts at every execution step, hence, by definition, we obtain a congruence -an equivalence relation preserved in all contexts. Considering all contexts at every execution step reflects that new knowledge about the environment may be discovered during execution. Such testing equivalences have been used to inform the design of labelled transition systems and their corresponding notions of labelled equivalence for a range of process calculi including the π-calculus, which led to the emergence of quasi-open bisimilarity [29,41] -the notion of labelled bisimilarity that coincides with open barbed bisimilarity for the π-calculus.
In this work, we make use of the testing regime offered by open barbed bisimilarity to design a labelled transition system and notion of quasi-open bisimilarity for the applied π-calculus. We argue here that employing a bisimilarity that coincides with the testing regime offered by open barbed bisimilarity, is a win-win choice for the applied π-calculus: not only is such an equivalence well-designed according to good-practice process-design principles; but also it is useful for verifying security and privacy properties. We should always be inclined to select an equivalence that is a congruence over one that is not a congruence without a compelling reason not to; and, in the setting of the applied π-calculus, having a congruence relation opens up new proof techniques, such as the ability to reason about equivalence problems compositionally.
It is possible to design other congruence relations for the applied π-calculus, such as the more famous open bisimilarity [28,40]. What we found to be fascinating about quasi-open bisimilarity is that, although, in order to be both a congruence relation and a bisimilarity relation, it is necessary that we obtain a finer equivalence compared to the more common early bisimilarity [5] that is not a congruence, the notion of equivalence is not too fine for security and privacy problems. Moving from early bisimilarity to quasi-open bisimilarity for security and privacy problems that can be formulated as equivalence problems, such as unlinkability, strong secrecy (non-interference), voter privacy, anonymity, does not appear to invalidate established properties. While it is impossible to check and anticipate all possible security and privacy problems that can be formulated as an equivalence problem in the applied π-calculus, there is the following compelling reason why we are confident in making this claim. Despite being finer than early bisimilarity, quasi-open bisimilarity still treats classically the important content of security and privacy problems, which is the treatment of private information such as nonces and keys. In contrast, this is not the case for the finer open bisimilarity, since we, in this paper, will demonstrate a representative example of a scenario in which open bisimilarity discovers a spurious attack, whereas quasi-open bisimilarity discovers the expected proof. Indeed, we are yet to encounter a disadvantage of using open barbed bisimilarity rather than observational equivalence for privacy problems.

Motivating Quasi-open Bisimilarity for the Applied π-Calculus
In the paper, we target properties expressed as a process equivalence. Whether a system satisfies such properties depends not only on the system but also on the choice of equivalence relation, and this choice in fact contributes to the attacker model [28]. In this motivating section, we present the advantages of employing the coarsest bisimilarity congruence and present motivating examples to justify our proposal.

A Finer Equivalence Discovers Spurious Attacks
Below we provide an example of a property expressed as an equivalence and show that a finer relation can fail to reflect a real attack on the system. Our running example is a cut-down variant of a classic private server example [3,22]. We express the privacy property as an equivalence between the "real" and the "ideal" behaviours.
Consider a server Server A that responds with an encrypted message only when it receives a particular public key. Otherwise, it responds with a nonce, indistinguishable from a ciphertext. We assume an attacker knows public key pk(k) but does not know private key k or nonce r.
Server A can be modelled formally in the applied π-calculus as follows.
Server A : νk.s pk(k) .! νa.c a .a(x).νr. if x = pk(k) then a aenc( m, r , pk(k)) else a r In Server A, the prefix νk.s pk(k) stands for announcing a public key. The prefix !νa.c a .a(x).νr represents the start of an unbounded number of sessions on a fresh channel a where, in each session, an input is received and a nonce r is freshly generated. In each session, one of the following decisions is made, based on the input received. If an input is a public key output previously, Server A responds with a message-nonce pair encrypted with the public key a aenc( m, r , pk(k)) . Otherwise, Server A sends a dummy random message r indistinguishable from a random cyphertext.
Note that in this minimal formulation of the problem, we refrain from modelling the clients (possibly knowing key k). Of course, the fact that clients transmit their public keys in plaintext may introduce further privacy concerns, which we do not model in this minimal illustration.
We approach the problem of proving that the privacy of the owner of secret key k is preserved by providing a reference specification. The reference specification models how the private server should ideally behave from the perspective of an attacker. The specification, defined as Server B below, differs from Server A in that it transmits a nonce regardless of the message received.
Server B : νk.s pk(k) .!νa.c a .a(x).νr.a r Server A and Server B are indistinguishable to an external observer -the attacker. An attacker cannot learn that Server A responds in a special way to input pk(k). The idea is that an attacker without private key k cannot learn that Server A serves some data m to the owner of k. Thus the privacy of the intended recipient of the data is preserved.
We can verify this privacy property by showing Server A and Server B are bisimilar. The point is that there is a warning: we must take care about which bisimilarity we employ. If we employ the famous open bisimilarity (which also is a congruence), the processes are not equivalent.
Using a suitable labelled transition system [28], Server A can reach the following state, at which point open bisimilarity still allows x (a free variable representing an input) to be instantiated with the message bound to u (i.e., pk(k)), representing a previously output message.
νk, a1, r1. pk(k),a 1 /u,v | if x = pk(k) then a1 aenc( m, r1 , pk(k)) else a1 r1 if x = pk(k) then a aenc( m, r , pk(k)) else a r Thus, we have not yet committed to x = pk(k) or x = pk(k), and hence we cannot proceed until we provide more information about x. Therefore the guard in the if-thenelse statement above cannot yet be resolved; but Server B cannot reach an equivalent state, since it can only reach a state which is immediately ready to perform an action regardless of whether x = pk(k) or x = pk(k). Note we do not assume x = pk(k) ∨ x = pk(k) holds, which would be an instance of the law of excluded middle; hence we are in an intuitionistic setting [6,7]. The presented distinguishing strategy, does not correspond to a real attack on the privacy of Server A; hence open bisimilarity is not sufficiently coarse to verify this privacy property. Fortunately, we will see in this paper that quasi-open bisimilarity addresses the above limitation of open bisimilarity. Quasi-open bisimilarity is also intuitionistic [29]. It handles open terms (with free variables) intuitionistically; but handles private messages that an attacker cannot interfere with more subtly. Private information, such as pk(k) (bound to u in the above state), can only be received eagerly by an input action; the effect being that messages such as pk(k) in the above example are treated classically. Thereby, after receiving the input either x = pk(k) or x = pk(k) holds; from which we establish that Server A and Server B are indeed quasi-open bisimilar.
The example above, elaborated on in the body of the paper, is selected as a minimal explanation for why quasi-open bisimilarity defines an appropriate attacker model.
A Still More Sophisticated Argument. Those that are not yet satisfied with the above illustration, may question whether the limitation of open bisimilarity is due to a particular lifting of open bisimilarity to the applied π-calculus. This is not the case. There are several possible definitions of open bisimilarity for the applied π-calculus that are, firstly, conservative with respect to the original definition of open bisimilarity for the πcalculus [40] and, secondly, also a congruence relation. However, none of them would be able to prove the privacy property illustrated above. The problem lies with mismatch (the else branches in the above example), which is exactly the problem isolated and explored in related work [29].
We illustrate the argument, by drawing attention to two possible ways of conservatively extending open bisimilarity to the applied π-calculus (which features mismatch or else branches). One approach is to extend the histories in the past (see Sect. 5 [29]); while another is to add explicit inequality constraints [28]. Each of these approaches provide different expressive power, as illustrated by the following pair of processes.
Server C νk.νl.s pk(k) .s pk(l) .P (k) v.s. Server D νk.νl.s pk(k) .s pk(l) .P (l) where P (t) νa.c a .a(x).νr.if x = pk(t) then a aenc( m, r , pk(t)) else a r When we specify that Server C and Server D should be equivalent, we specify that two servers that respond to different keys (the first or second output) should be indistinguishable. This differs from our previous private server example, where, recall, the specification is stipulated in terms of another private server, Server B, that has no information to leak. Surprisingly, the above processes are equivalent under the notion of open bisimilarity obtained by extending histories [29], yet are not equivalent under the notion of open bisimilarity with inequality constraints [28]. Furthermore, processes Server A and Server B from the previous sections are not equivalent under either of the notions of open bisimilarity described, and hence neither extension of open bisimilarity is sufficiently coarse to verify that privacy property.
The fundamental insight is that open bisimilarity is heavily tied to the way it symbolically represents constraints, which gives rise to equivalences that differ for technical reasons which have little to do with the semantics of protocols. Quasi-open bisimilarity however is canonical, as we prove in this work via a completeness result that is independent of any internal constraint system. Finally, quasi-open bisimilarity supports proofs of privacy properties that we expect to hold, as illustrated by the equivalence of Server A and Server B (Sect. 4.2), making it a robust choice that enables compositional reasoning without introducing spurious attacks.

Too Coarse an Equivalence Misses Real Attacks
Above we have seen an example when a finer property leads to a spurious attack. The situation is mirrored, however, if we attempt to formulate a property using too coarse equivalence: real attacks may be missed. Recent work [26,28], comprehensively explains an attack on ePassports that allows unauthorised observers to track movements of the holder. This attack was overlooked by trace equivalence, which is strictly coarser than bisimilarity. Thus, taking into consideration both ends of the spectrum, we find that quasi-open bisimilarity is neither too coarse, since it is a bisimilarity, nor too fine, since it does not introduce spurious attacks.

A Congruence Enables Compositional Reasoning
To illustrate the importance of the presented equivalence being a congruence we briefly introduce a discussion on unlinkability, that is the incapability of determining relationships between two observed protocol sessions. The state-of-the-art approach to unlinkability developed in [28] is as follows. If the process System, reflecting the actual behaviour of the protocol, is equivalent to the process Spec, which specifies the ideal behaviour (from the attacker's perspective), we say that such a protocol is unlinkable.
Consider an abstract authentication protocol with two roles: C and T . The agent playing role C holds credentials signed by the secret key s of the certification authority CA and wants to be able to assume the same identity multiple times without the risk of being reidentified. The goal of the agent playing T is to verify these credentials using the public key pk(s) of the CA and authenticate C. The real-world behaviour of the system can be modelled as follows.
Initially, the CA's secret key s is created. The first parallel component above defines agents with identity a that can participate in an arbitrary number of sessions of the protocol. Each session begins with advertising a fresh session channel ch c on the public channel c C , modelling a new connection to a new session. The leftmost replication models that any number of agents can exist in the system, while the subsequent replication is what allow an agent to appear with the same identity across multiple sessions. The second parallel component above makes the public key pk(s) of the CA available to the environment via the output on the public channel out. After that, the role T is specified which tries to authenticate a genuine agent in role C making use of pk(s). Such sessions in role T also begin by advertising a fresh session channel on public channel c T . The processes C(s, ch t ) and T (pk(s) , ch t ) can be instantiated to model various protocols.
On the other hand, the ideal system is obtained from System by removing the second replication, which means that the agent with the identity a can participate in one protocol run only.
The fact that quasi-open bisimilarity is a congruence allows us to verify an equivalence property for a smaller system and extend the proof to a larger system. Consider a smaller system comprising only agents playing the role C.
The corresponding, smaller version of the idealised specification where there is one session per identity is as follows.
Small Spec νs. out pk(s) .!νa.νch c .c C ch c .C(s, ch c , a) We are ready now to prove that if we prove properties using the smaller specification with one role then they hold in the more traditional specification with two roles.
Proof. Consider the following context, where out is a fresh variable.
Firstly, C{Small System}{ out / out } ∼ τ.System and C{Small Spec}{ out / out } ∼ τ.Spec hold. Furthermore, by the assumption, Small System ∼ Small Spec and the fact that since quasi-open bisimilarity is a congruence (Theorem 2), the following holds. The key difficulty is, of course, to prove that Small System ∼ Small Spec, but studying a smaller system significantly reduces the amount of work. This approach to verifying unlinkability for a subsystem was taken in [30], where authors study key agreement for contactless payments and employ only honest cards in their model of unlinkability.

The Coarsest Bisimilarity Congruence
This section concerns the coarsest (strong) bisimilarity congruence -open barbed bisimilarity. Open barbed bisimilarity is a natural choice of bisimilarity, being, by definition, the greatest bisimilarity congruence. Since open barbed bisimilarity has an objective language-independent definition, there are no design decisions -there is only one reasonable definition as explored in this section.

An Example Message Term Language and Equational Theory
In the applied π-calculus messages can be defined with respect to any message language subject to any equational theory (= E ). The example equational theory we provide in Fig. 1 is for the purpose of providing meaningful examples. Further theories can also be devised not limited to: sub-term convergent theories [1]; blind signatures and homomorphic encryption [20]; and locally stable theories with inverses [9].
The example theory provided in Fig. 1 covers asymmetric encryption. A message encrypted with public key pk(k) can only be decrypted using private key k. The theory includes a collision-resistant hash function, with no equations. This theory assumes we have the power to detect whether a message is a pair, but cannot distinguish a failed decryption from a random number.

Active Substitutions and Labelled Transitions
We define a syntax for the applied π-calculus. The syntax is similar to the π-calculus, except messages and channels can be any term rather than just variables. There is no separate syntactic class of terms for names -names are variables bound by new name binders. In addition to processes, extended processes are defined, which allow active substitutions, denoted σ, to float alongside processes and in the scope of new name binders, defined in Fig. 2.
Extended processes in normal form νx.(σ | P ) are subject to the restriction that the variables in dom(σ) are fresh for x, fv(P ) and fv(yσ), for all variables y (i.e., σ is idempotent, and substitutions are fully applied to P ). We follow the convention that operational rules are defined directly on extended processes in normal form up to αconversion. This avoids numerous complications caused by the structural congruence in the original definition of bisimilarity for the applied π-calculus. The set of free variables and α-conversion are as standard, where νx.P and M (x).P bind x in P . As uncovered in related work [29], the trick for handling mismatch such that we obtain a congruence is to treat mismatch intuitionistically. Intuitionistic negation enjoys the property that it is preserved under substitutions; a property that fails for classical negation in general. E.g., there are substitutions under which [x = h(y)]a(z) can perform an input transition and others where it cannot, hence neither x = h(y) nor x = h(y) holds in the intuitionistic setting until more information is provided about the environment. In order to define intuitionistic negation, we require the notion of a fresh substitution.

Definition 2 (fresh). Consider a set of variables z.
We say z is fresh for set of variables y, whenever z ∩ y = ∅. Given a term, say P , we say z is fresh for P , whenever z is fresh for the free variables of P . Given a substitution σ, we say z is fresh for σ whenever z is fresh for dom(σ), and, for all y ∈ z, we have z is fresh for yσ. Freshness  extends point-wise to lists of entities and is denoted u, v, . . . # M, N, σ, . . ..
We say entailment z |= M = N holds whenever there is no σ such that z # σ and Mσ = E Nσ.
Consider the following examples that hold or fail to hold for different reasons. Entailment ∅ |= x = h(x) holds, since there exists no unifier, witnessed by a simple occurs check. In contrast, ∅ |= x = h(y) does not hold, since there exists substitution h(y) / x unifying messages x and h(y), so it is still possible the messages could be equal; thus, there is insufficient information to decide whether the messages are equal or not. By extending the environment such that y is a private name, entailment y |= x = h(y) holds, since y is not fresh for the most general unifier h(y) / x -an observer who can influence x, cannot make x equal to h(y) without access to y.
To define open barbed bisimilarity, we require the labelled transition system for the applied π-calculus in Fig. 2. It is an early labelled transition system due to the way inputs are treated, and open early, since it does not assume that free variables are ground names, unless stated so explicitly in the name environment to the left of the transition relation. There are three types of label: τ representing internal progress due to communication; bound output M (x) representing that something bound to x is sent on channel M ; and free input M N representing that we receive N on channel M .

The MISMATCH and RES Rules.
The MISMATCH rule is defined in terms of entailment in Definition 2. The RES rule can also influence mismatches by introducing fresh names. For example, the following derivation shows an input is enabled.
Notice, the bound variable y is added to the set of names, enabling y |= x = h(y).
Active Substitutions and Labels. For a non-trivial example where the active substitution affects the label, observe that the following transition is derivable.
The conditions on the RES rule ensure bound name m cannot appear in the terms on the label. Fortunately, the INP rule allows m to be expressed in terms of extruded variable w. Since we have m = E fst( m, n ) and the equational theory can be applied in rule INP, the above input action is enabled, where message fst(w) indirectly refers to channel m.
The OUT Rule. The OUT rule for the applied π-calculus does not record the message sent on the label; instead, the message is recorded in an active substitution. The domain of the active substitution is chosen to be a fresh variable appearing as the bound variable in the output action on the label. In the following example a message is sent using the OUT rule, then the RES rule is applied such that the private name n in the active substitution remains bound after the transition.
k : a(w).adec(w, k) a a aenc(n,pk(k)) adec(aenc(n, pk(k)) , k) a Hence, by CLOSE-L and the above input and output transitions, the following interaction is enabled; and RES is used to bind the key k.

νk.νn.(n(x) | n a )
Note this labelled approach to interaction follows closely how interaction traditionally works in the π-calculus. Thus this formulation of labelled transitions facilitates the lifting of results from the π-calculus to the applied π-calculus. An advantage of our labelled transition system is strong, weak, and other variants of bisimilarity can be studied. In contrast, the original system proposed for the applied π-calculus [2] used a hybrid labelled/reduction system that can only be used to formalise weak equivalences. Furthermore, avoiding a structural congruence avoids having to consider all transitions up to an associative-commutative theory (which can make proofs cumbersome). Also, the use of REP-ACT and REP-CLOSE for defining replication, respects image-finiteness (up to α-conversion) [39].
Note, trying to obtain strong bisimilarity by naïvely restricting the original definition of labelled bisimilarity [2] such that every τ -transition is matched by exactly one τ -transition results in an ill-formulated notion of strong bisimilarity. Doing so, would allow processes, such as Server A and Server B from Sect. 2, to be wrongly distinguished by counting the number of τ -transitions induced by branching statements. The rule SUM-L and its counterpart SUM-R avoid this problem.

A Testing Regime Defining a Bisimilarity Congruence
A barb represents the ability to observe an input or output action on a channel. Barbs are typically used to define barbed equivalence, or observational equivalence [36]. However, barbed equivalence is a congruence but not a bisimilarity; while observational equivalence is a bisimilarity but not a congruence. For this reason, we prefer open barbed bisimilarity [41], which is, by definition, both a bisimilarity and a congruence. We adopt the convention of writing A π B whenever ∅ : A π B. We say process P has barb M , written P ↓ M , whenever, for some A, P

M (z)
A, or P M N A.

Definition 3 (open barbed bisimilarity). An open barbed bisimulation R is a symmetric relation over processes such that whenever P R Q holds the following hold:
-For all contexts C{ · }, C{P } R C{Q}. The power of open barbed bisimilarity comes from closing by all contexts at every step, not only at the beginning of an execution. Closing by all contexts at every step ensures the robustness of open barbed bisimilarity even if the environment is extended at runtime; i.e., we stay within a congruence relation at every step of the bisimulation game.
Recall that a congruence is an equivalence relation preserved in all contexts. Symmetry and context closure of open barbed bisimilarity are immediate from the definition.

Reflexivity is trivial since the identity relation is an open barbed bisimulation. Transitivity is only slightly more involved, proven by checking that the composition of two open barbed bisimulation relations is an open barbed bisimulation.
Open barbed bisimilarity is concise -the definition requires only the open labelled transition system in Fig. 2 and the three clauses in Definition 3. Furthermore, it is the coarsest bisimilarity congruence, in the objective sense that it is defined to be a congruence and defined independently of the content of the messages sent and received. Notice, due to the independence of the information on the labels, open barbed bisimilarity applies to any language; indeed open barbed bisimilarity is a generalisation of dynamic observational equivalence [38], that, historically, was used to objectively identify the greatest bisimulation congruence for CCS. Related work also uses the term saturated bisimilarity for such a reference bisimilarity congruence [13,14], which shows that a single barb, say ok suffices.
For the above reasons, open barbed bisimilarity is an ideal reference definition. However, it is unwieldy due to closure of the definition under all contexts. This leads us to the notion of quasi-open bisimilarity, defined in the next section.

Quasi-open Bisimilarity for the Applied π-Calculus
As highlighted in the previous section, open barbed bisimilarity has a concise and objective definition but is difficult to check, due to the quantification over all contexts. An open variant of labelled bisimilarity, called quasi-open bisimilarity, avoids quantifying over all contexts; and furthermore, coincides with open barbed bisimilarity. In this section, we define quasi-open bisimilarity for the applied π-calculus, generalising established results for the π-calculus [29,41].

Introducing Quasi-open Bisimilarity for the Applied π-Calculus
To extend quasi-open bisimilarity to the applied π-calculus the notion of static equivalence is required. Static equivalence is defined over the static information in an extended process -the active substitutions and name restrictions. In the above definition, messages M and N represent two different "recipes" for producing messages. Two extended processes are distinguished by static equivalence only when the two recipes produce equivalent messages under one substitution, but distinct messages under the other substitution. The concept of static equivalence is no different from original work on the applied π-calculus [5].
Static Equivalence Example. For example, the following extended processes are not statically equivalent.
In order to define quasi-open bisimilarity, we require the notion of an open relation between extended processes. An open relation is preserved under substitutions (respecting bound names, including the domain of active substitution) and extensions of the active substitutions and names in environment. In the following, θ D is the restriction of a substitution to a set D.

Definition 5 (open). A relation over extended processes
R is open whenever we have that if νx.(θ 1 | P ) R νy.(θ 2 | Q) and there exist idempotent substitutions σ, ρ and variables z such that: x, y # σ, ρ and z # dom(ρ) , x, y and dom(θ i ) # σ, ρ, z for i ∈ {1, 2}, we have the following: Given the definition of an open relation, static equivalence, and the labelled transition system, we can provide the following concise definition of quasi-open bisimilarity for the applied π-calculus. The keyword in the definition above is "open" in the sense of Definition 5. Without ensuring that properties are preserved under reachability, the above definition would simply be a strong version of the classical labelled bisimilarity for the applied πcalculus [5]. We illustrate the impact of insisting on an open relation and allowing messages as channels in the following examples. Remark 1. The definition of quasi-open bisimilarity above is arguably simpler than in the setting of the π-calculus [41]. In contrast to the original definition, since private names are recorded in extended processes, all types of action are handled by one clause. The π-calculus definition maintains an additional index of extruded private names.

Definition 6 (quasi-open bisimilarity). An open symmetric relation between extended processes R is a quasi-open bisimulation whenever, if
Mobility Example. This work builds on a recent evolution of the applied π-calculus [5], which allows processes such as νz.x z, y .z(w) and νz.x z, y to be evaluated. These processes should not be equivalent, since they are polyadic π-calculus processes [35] (the π-calculus with tuples), and the applied π-calculus should be conservative with respect to the polyadic π-calculus, which was not the case for older definitions of bisimilarity for the applied π-calculus [2]. The trick to allow processes such as the above to be evaluated is simple: allow channels to be messages. This way, a message, such as fst(u), can be used to indirectly refer to channels. To see why we can distinguish these processes, firstly, consider the following two transitions with matching actions.
νz.x z, y .z(w) νz. z,y / v | 0 is enabled for the process on the left. The process on the right above νz. z,y / v | 0 is deadlocked, so cannot match this transition. Notice the use of message fst(v) on the input label to refer to the private channel output at the first step.

Example Showing Impact of an Open Relation on Static Equivalence. By insisting that a quasi-open bisimulation is an open relation (Definition 5)
, static equivalence must also be preserved by all fresh substitutions. This has an impact on examples such as the following.
Processes νx.a aenc(x, z) and νx.a aenc( x, y , z) are labelled bisimilar but not quasi-open bisimilar. To see why, observe both processes can perform a a(v)-transition to the respective extended processes νx. aenc(x,z) / v | 0 and νx. aenc( x,y ,z) / v | 0 . These extended process are statically equivalent (recall z cannot be used to decrypt these cyphertexts in asymmetric cryptography). However, since a quasi-open bisimulation must be preserved under fresh substitutions and v # pk(w) / z , we check static equivalence for νx. aenc(x,z) / v | 0 pk(w) / z and νx. aenc( x,y ,z) / v | 0 pk(w) / z . After applying the substitution, the extended processes are no longer statically equivalent, witnessed by distinguishing recipes snd(adec(v, w)) and y. Thus the processes are not quasi-open bisimilar.
Note that the fact that the attack succeeds above suggests the attacker has the power to influence the message bound to z, in order to stage an attack. In the above example the message chosen is a public key pk(w) for which the attacker knows the secret key w. For another such example, νk.a aenc(x, pk(k)) .a aenc(y, pk(k)) and νk.a aenc(x, pk(k)) .a aenc(z, pk(k)) are labelled bisimilar (which assumes x, y, z are distinct names), but not quasi-open bisimilar (which instead assumes x, y, z are variables). To see why, observe the above processes can reach the extended processes νk. aenc(x,pk(k)),aenc(y,pk(k)) / v,w | 0 and νk. aenc(x,pk(k)),aenc(z,pk(k)) / v,w | 0 , at which point the attacker has the power to set x = y, thereby reaching a scenario explained after Definition 4, where the attacker can observe the same message is output twice for the process on the left but not for the process on the right. This feature of quasi-open bisimilarity is related to the security property of strong secrecy [11], where the open nature of secrets represents that the attacker may interfere with messages at runtime.

Running Example of a Privacy Property
We now have the mechanisms to verify the minimal privacy example from Sect. 2. For greater clarity, firstly consider the case of a single session, i.e., with replication removed. The equivalence of running examples Server A and Server B for the single session case (without replication) can be established by taking the least symmetric open relation satisfying the constraints in Fig. 3. The critical observation is that message n in Fig. 3 ranges over all permitted inputs. Since n = u is permitted, we have the following pair in relation S. νk, a, r. pk(k),a /u,v | a r S νk.a, r. pk(k),a /u,v | if pk(k) = pk(k) then a aenc( m, r , pk(k)) else a r In the above, observe the branch sending an encrypted message is enabled. In contrast to the above, if n is any message term not equivalent to u then we have k, a, r |= n pk(k),a / u,v = pk(k) since if n were a message term such that k, a, r # n such that n pk(k),a / u,v = pk(k), then n must be equivalent to u. Thus in all other cases the else branch is enabled. Notice νk, a, r. pk(k),a,aenc( m,r ,pk(k)) / u,v,w |0 and νk, a, r. pk(k),a,r / u,v,w |0 are statically equivalent, reachable when n = E u. To see why, observe that an attacker neither has the key k to decrypt aenc( m, r , pk(k)), nor can an attacker reconstruct the message m, r , without knowing r.
For the unbounded case, consider the least symmetric open relation T satisfying the constraints in Fig. 4  A subtlety is that T is not the least quasi-open bisimulation witnessing Server A ∼ Server B, since we over approximated by allowing inputs to possibly use outputs from the future. This over approximation is correct, since we can always have additional redundant terms in a bisimulation set, as long as they are also closed under the relevant conditions. Indeed, this illustrates a practical benefit of bisimilarity -we can find abstractions that reduce the amount of verification work.

Quasi-open Bisimilarity is Sound and Complete
As illustrated in the previous sub-section, a core guarantee offered by quasi-open bisimilarity is that it is a congruence relation. We prove quasi-open bisimilarity is preserved by all contexts, notably under input prefixes; and, furthermore, coincides exactly with open barbed bisimilarity, which is the coarsest (strong) bisimilarity congruence. Completeness, expressed in Theorem 3, supports our claim that quasi-open bisimilarity in Definition 6 is a correct and canonical (strong) bisimilarity congruence for the applied π-calculus. This theorem is the fundamental property of quasi-open bisimilarity that does not hold for open bisimilarity.

Theorem 3 (completeness). Quasi-open bisimilarity coincides with open barbed bisimilarity.
It is interesting to compare the proof of Theorem 3 to the corresponding proof for the π-calculus [41]. In the corresponding proof for the π-calculus checks are built into bound output transitions to ensure extruded private names are fresh. In the proof of Theorem 3 no such checks are required for output transitions; such checks are subsumed by checking static equivalence.
Strong v.s. Weak Bisimilarity. Observe Theorem 3 is for a strong formulation of quasiopen bisimilarity. The weak/strong dimension [44] (as with other dimensions such as interleaving v.s. true concurrency [45], for instance) is a perpendicular issue to the focus of this paper. Quasi-open variants of various equivalences and preorders can also be defined, so this scientific discussion on attacker models should not be limited to strong bisimilarity. Sometimes weak equivalences can be avoided. For example, for privacy properties, such as unlinkability of ePassports, the traditional formulation in terms of a weak bisimilarity problem [8] has been shown to be reducible to an equivalent strong bisimilarity problem that is easier to check, since we have image finiteness [28], i.e., for any label π each process has finitely many π-labelled transitions.

Comparison to Related Work on Observational Equivalence
Most notions of bisimilarity previously introduced for cryptographic calculi (e.g., hedged bisimilarity, labelled bisimilarity, early bisimilarity) coincide with observational equivalence [2, 4, 5, 10, 15-17, 31, 32, 34]. Observational equivalence is a restriction of open barbed bisimilarity (Definition 3), considering only contexts of the form { · } | P that add a new process in parallel at every step of the bisimulation game. This makes the equivalence strictly coarser than open barbed bisimilarity, however observational equivalence is not a congruence relation. Intermediate results on symbolic bisimulations [18,25] also closely approximate observational equivalence.
The gap between observational equivalences and open barbed bisimilarity is thoroughly explored in the context of the π-calculus [7,29,40,41]. Open barbed bisimilarity is finer than observational equivalence since, π.P + π.Q is observationally equivalent to π.P + π.Q + π.if x = y then P else Q, but these processes are not open barbed bisimilar in general. Yet these processes are equivalent if we take barbed equivalence [36], which is the largest congruence contained within observational equivalence, lying strictly between open barbed bisimilarity and observational equivalence. In Sect. 4.1, we did mention there are examples of noninterference properties that can be formulated using a congruence. However, it remains an open question whether there exists a realistic privacy property, as opposed to the toy equation immediately above, that cannot be verified using open barbed bisimilarity but can be analysed using barbed equivalence.
If one does insist that a property is defined in terms of observational equivalence, we may still use quasi-open bisimilarity as an under-approximation. If an attack is discovered, we can check whether an attack is also valid classically (possibly making use of modal logic intuitionistic FM described in the extended technical report [29]). If the attack is also classically valid it is also a counterexample for observational equivalence. This methodology was used to resolve the problem of whether there is an attack on the BAC protocol for ePassports [26,28], as originally stated in terms of observational equivalence [8].

Conclusion
This paper justifies the bisimilarity congruence quasi-open bisimilarity as a method for reasoning about protocols expressed using the applied π-calculus. The equivalence we converge on, quasi-open bisimilarity, can be seen as an enhancement of existing methods, balancing between the strengths of labelled bisimilarity [4, 10, 15-17, 31, 32, 34] and open bisimilarity.
The bisimilarity congruence, open bisimilarity, has previously been introduced for the spi-calculus [19,42,43]. However, the spi-calculus could not verify privacy properties demanding mismatch, and is less abstract, being hard-wired with a fixed message theory; which were problems addressed in recent work that lifts open bisimilarity to the more general setting of the applied π-calculus [28]. By moving to the coarser equivalence quasi-open bisimilarity we are able to verify more privacy properties, such as the typical privacy-preserving protocol in Sect. 2, involving if-then-else with a guard depending on private information. Some equivalences, such as differential equivalence [12,21], which compares two structurally identical processes that differ only in the terms they exchange, are incomplete and hence may report attacks that trivially do not exist. Hence when differential equivalence reports an attack, it may not exist for trivial reasons -a problem minimised by the fact that quasi-open bisimilarity adheres to a completeness criterion for observational congruences (Theorem 3).
Equivalences coarser than quasi-open bisimilarity are either not congruences or are not bisimilarities, meaning that some corresponding proof techniques cannot be applied.
The gap between quasi-open bisimilarity and classical labelled bisimilarity is small-we insist on an open relation (Definition 2). However, the gap is significant, since we obtain a complete congruence. In an extended version of this paper in a technical report [27], we go further by demonstrating that we are able to logically characterise quasi-open bisimilarity, using an intuitionistic modal logic useful for describing attacks.