# Automated reasoning for equivalences in the applied pi calculus with barriers , [^2] ## Abstract Observational equivalence allows us to study important security properties such as anonymity. Unfortunately, the difficulty of proving observational equivalence hinders analysis. Blanchet, Abadi & Fournet simplify its proof by introducing a sufficient condition for observational equivalence, called diff-equivalence, which is a reachability condition that can be proved automatically by ProVerif. However, diff-equivalence is a very strong condition, which often does not hold even if observational equivalence does. In particular, when proving equivalence between processes that contain several parallel components, e.g., $P \mid Q$ and $P' \mid Q'$, diff-equivalence requires that $P$ is equivalent to $P'$ and $Q$ is equivalent to $Q'$. To relax this constraint, Delaune, Ryan & Smyth introduced the idea of swapping data between parallel processes $P'$ and $Q'$ at synchronisation points, without proving its soundness. We extend their work by formalising the semantics of synchronisation, formalising the definition of swapping, and proving its soundness. We also relax some restrictions they had on the processes to which swapping can be applied. Moreover, we have implemented our results in ProVerif. Hence, we extend the class of equivalences that can be proved automatically. We showcase our results by analysing privacy in election schemes by Fujioka, Okamoto & Ohta, Lee *et al.*, and Juels, Catalano & Jakobsson, and in the vehicular ad-hoc network by Freudiger *et al*.
and
# Introduction Cryptographic protocols are required to satisfy a plethora of security requirements. These requirements include classical properties such as secrecy and authentication, and emerging properties including anonymity (Pfitzmann and Köhntopp 2001; Delaune, Kremer, and Ryan 2009; Dahl, Delaune, and Steel 2010), ideal functionality (Martı́n Abadi and Gordon 1997; Martı́n Abadi and Fournet 2001; Delaune, Kremer, and Pereira 2009), and stronger notions of secrecy (Martín Abadi 2000; Blanchet 2004; Cortier, Rusinowitch, and Zǎlinescu 2007). These security requirements can generally be classified as *indistinguishability* or *reachability* properties. Reachability properties express requirements of a protocol’s reachable states. For example, secrecy can be expressed as the inability of deriving a particular value from any possible protocol execution. By comparison, indistinguishability properties express requirements of a protocol’s observable behaviour. Intuitively, two protocols are said to be indistinguishable if an observer has no way of telling them apart. Indistinguishability enables the formulation of more complex properties. For example, anonymity can be expressed as the inability to distinguish between an instance of the protocol in which actions are performed by a user, from another instance in which actions are performed by another user. Indistinguishability can be formalised as observational equivalence, denoted $\approx$. As a motivating example, consider an election scheme, in which a voter $A$ voting $v$ is formalised by a process $V(A, v)$. Ballot secrecy can be formalised by the equivalence $$V(A, v) \mid V(B, v') \approx V(A, v') \mid V(B, v) \label{eq:motiv}$$ which means that no adversary can distinguish when two voters swap their votes (Delaune, Kremer, and Ryan 2009). (We use the applied pi calculus syntax and terminology (Martı́n Abadi and Fournet 2001), which we introduce in Section 2.) ## Approaches to proving equivalences Observational equivalence is the tool introduced for reasoning about security requirements of cryptographic protocols in the spi calculus (Martı́n Abadi and Gordon 1997) and in the applied pi calculus (Martı́n Abadi and Fournet 2001). It was originally proved manually, using the notion of labelled bisimilarity (Martı́n Abadi and Gordon 1998; Borgström and Nestmann 2005; Martı́n Abadi and Fournet 2001) to avoid universal quantification over adversaries. Manual proofs of equivalence are long and difficult, so automating these proofs is desirable. Automation often relies on symbolic semantics (Borgström, Briais, and Nestmann 2004; Delaune, Kremer, and Ryan 2010) to avoid the infinite branching due to messages sent by the adversary by treating these messages as variables. For a bounded number of sessions, several decision procedures have been proposed for processes without else branches, first for a fixed set of primitives (Hüttel 2003; Durante, Sisto, and Valenzano 2003), then for a wide variety of primitives with the restriction that processes are determinate, that is, their execution is entirely determined by the adversary inputs (Cortier and Delaune 2009). These decision procedures are too complex for useful implementations. Practical algorithms have since been proposed and implemented: SPEC (Tiu and Dawson 2010) for fixed primitives and without else branches, APTE (Cheval, Comon-Lundh, and Delaune 2011) for fixed primitives with else branches and non-determinism, and AKISS (Chadha, Ciobâca, and Kremer 2012; Ciobâca 2011) for a wide variety of primitives and determinate processes. For an unbounded number of sessions, proving equivalence is an undecidable problem (Hüttel 2003; Martín Abadi and Cortier 2006), so automated proof techniques are incomplete. ProVerif automatically proves an equivalence notion, named diff-equivalence, between processes $P$ and $Q$ that share the same structure and differ only in the choice of terms (Blanchet, Abadi, and Fournet 2008). Diff-equivalence requires that the two processes always reduce in the same way, in the presence of any adversary. In particular, the two processes must have the same branching behaviour. Hence, diff-equivalence is much stronger than observational equivalence. Maude-NPA (Santiago et al. 2014) and Tamarin (Basin, Dreier, and Casse 2015) also use that notion, and Baudet (Baudet 2007) showed that diff-equivalence is decidable for a bounded number of sessions and used this technique for proving resistance against off-line guessing attacks (Baudet 2005). To deal with limitations of diff-equivalence, other sufficient conditions have been designed for particular classes of equivalences, e.g., anonymity and unlinkability (Hirschi, Baelde, and Delaune 2016) and ballot secrecy (Cremers and Hirschi 2017). These conditions can be checked automatically using tools such as ProVerif. The definition of ballot secrecy in (Cremers and Hirschi 2017) is based on trace equivalence and its relationship with ([eq:motiv]) is unknown. Decision procedures also exist for restricted classes of protocols: for an unbounded number of sessions, trace equivalence has a decision procedure for symmetric-key, type-compliant, acyclic protocols (Chrétien, Cortier, and Delaune 2015a), which is too complex for useful implementation, and for ping-pong protocols (Chrétien, Cortier, and Delaune 2015b), which is implemented in a tool. ## Diff-equivalence and its limitations In this paper, we focus on proofs of observational equivalence in the applied pi calculus. The main approach to automate proofs of observational equivalence with an unbounded number of sessions is to use diff-equivalence. (In our motivating example [eq:motiv], a bounded number of sessions is sufficient, but an unbounded number becomes useful in more complex examples, as in Section 4.2.) Diff-equivalence seems well-suited to our motivating example, since the processes $V(A, v) \mid V(B, v')$ and $V(A, v') \mid V(B, v)$ differ only by their terms. Such a pair of processes can be represented as a *biprocess* which has the same structure as each of the processes and captures the differences in terms using the construct $\mathsf{diff}[M,M']$, denoting the occurrence of a term $M$ in the first process and a term $M'$ in the second. For example, the pair of processes in our motivating example can be represented as the biprocess $P =V(A, \mathsf{diff}[v,v']) \mid V(B, \mathsf{diff}[v',v])$. The two processes represented by a biprocess $P$ are recovered by $\mathsf{fst}(P)$ and $\mathsf{snd}(P)$. Hence, $\mathsf{fst}(P) = V(A, v) \mid V(B, v')$ and $\mathsf{snd}(P) = V(A, v') \mid V(B, v)$. Diff-equivalence implies observational equivalence. Hence, the equivalence [eq:motiv] can be inferred from the diff-equivalence of the biprocess $P$. However, diff-equivalence is so strong that it does not hold for biprocesses modelling even trivial schemes, as the following example demonstrates.
**Example 1**. *Consider an election scheme that instructs voters to publish their vote on an anonymous channel. The voter’s role can be formalised as $V(A, v) = \overline{c}\langle v\rangle$. Thus, ballot secrecy can be analysed using the biprocess $P =\overline{c}\langle\mathsf{diff}[v,v']\rangle\mid\overline{c}\langle\mathsf{diff}[v',v]\rangle$. It is trivial to see that $\mathsf{fst}(P) = \overline{c}\langle v\rangle\mid\overline{c}\langle v'\rangle$ is indistinguishable from $\mathsf{snd}(P) = \overline{c}\langle v'\rangle\mid\overline{c}\langle v\rangle$, because any output by $\mathsf{fst}(P)$ can be matched by an output from $\mathsf{snd}(P)$, and vice-versa. However, the biprocess $P$ does not satisfy diff-equivalence. Intuitively, this is because diff-equivalence requires that the subprocesses of the parallel composition, namely, $\overline{c}\langle\mathsf{diff}[v,v']\rangle$ and $\overline{c}\langle\mathsf{diff}[v',v]\rangle$, each satisfy diff-equivalence, which is false, because $\overline{c}\langle v\rangle$ is not equivalent to $\overline{c}\langle v'\rangle$ (nor is $\overline{c}\langle v'\rangle$ equivalent to $\overline{c}\langle v\rangle$).*
Overcoming the difficulty encountered in Example 1 is straightforward: using the general property that $P \mid Q \approx Q \mid P$, we can instead prove $%\begin{equation*} V(A, v) \mid V(B, v') \approx V(B, v) \mid V(A, v') %\label{eq:motiv2} %\end{equation*}$, which, in the case of Example 1, is proved by noticing that the two sides of the equivalence are equal, i.e., by noticing that the biprocess $\hat P =\overline{c}\langle\mathsf{diff}[v,v]\rangle\mid\overline{c}\langle\mathsf{diff}[v',v']\rangle$ trivially satisfies diff-equivalence, since $\mathsf{fst}(\hat P)=\mathsf{snd}(\hat P)$. However, this technique cannot be applied to more complex examples, as we show below. Some security properties (e.g., privacy in elections (Delaune, Kremer, and Ryan 2009; Backes, Hriţcu, and Maffei 2008), vehicular ad-hoc networks (Dahl, Delaune, and Steel 2010, 2011), and anonymity networks (Reiter and Rubin 1998; Pfitzmann and Köhntopp 2001; Chothia 2006)) can only be realised if processes synchronise their actions in a specific manner.
**Example 2**. *Building upon Example 1, suppose each voter sends their identity, then their vote, both on an anonymous channel, i.e., $V(A, v) = \overline{c}\langle A\rangle.\overline{c}\langle v\rangle$. This example does not satisfy ballot secrecy, because $V(A, v) \mid V(B, v')$ can output $A$, $v$, $B$, $v'$ on channel $c$ in that order, while $V(A, v') \mid V(B, v)$ cannot.*
To modify this example so that it satisfies ballot secrecy, we use the notion of barrier synchronisation, which ensures that a process will block, when a barrier is encountered, until all other processes executing in parallel reach this barrier (Brooks 1986; Hensgen, Finkel, and Manber 1988; Arenstorf and Jordan 1989; Lubachevsky 1990).
**Example 3**. *Let us modify the previous example so that voters publish their identity, synchronise with other voters, and publish their vote on an anonymous channel. The voter’s role can be formalised as process $V(A, v) = \overline{c}\langle A\rangle.1\textnormal{::}\,\overline{c}\langle v\rangle$, where $1\textnormal{::}\,$ is a barrier synchronisation. Ballot secrecy can then be analysed using biprocess $P_{\sf ex}=\overline{c}\langle A\rangle.1\textnormal{::}\,\overline{c}\langle\mathsf{diff}[v,v']\rangle\mid\overline{c}\langle B\rangle.1\textnormal{::}\,\overline{c}\langle\mathsf{diff}[v',v]\rangle$. Synchronisation ensures the output of $A$ and $B$, prior to $v$ and $v'$, in both $\mathsf{fst}(P_{\sf ex})$ and $\mathsf{snd}(P_{\sf ex})$, so that ballot secrecy holds, but diff-equivalence does not hold.*
The technique used to overcome the difficulty in Example 1 cannot be applied here, because swapping the two voting processes leads to the biprocess $P_{\sf ex}' =\overline{c}\langle\mathsf{diff}[A,B]\rangle.1\textnormal{::}\,\overline{c}\langle v\rangle\mid\overline{c}\langle\mathsf{diff}[B,A]\rangle.1\textnormal{::}\,\overline{c}\langle v'\rangle$, which does not satisfy diff-equivalence. Intuitively, we need to swap at the barrier, not at the beginning (cf. $P_{\sf ex}'$). In essence, by swapping data between the two voting processes at the barrier, it suffices to prove that the biprocess $P_{\sf ex}'' =\overline{c}\langle A\rangle.1\textnormal{::}\,\overline{c}\langle\mathsf{diff}[v,v]\rangle\mid\overline{c}\langle B\rangle.1\textnormal{::}\,\overline{c}\langle\mathsf{diff}[v',v']\rangle$ satisfies diff-equivalence, which trivially holds since $\mathsf{fst}(P_{\sf ex}'')=\mathsf{snd}(P_{\sf ex}'')$. As illustrated in , diff-equivalence is a sufficient condition for observational equivalence, but it is not necessary, and this precludes the analysis of interesting security properties. In this paper, we will partly overcome this limitation: we weaken the diff-equivalence requirement by allowing swapping of data between processes at barriers. ## Contributions First, we extend the process calculus by Blanchet, Abadi & Fournet (Blanchet, Abadi, and Fournet 2008) to capture barriers (Section 2). Secondly, we formally define a compiler that encodes barriers and swapping using private channel communication (Section 3). As a by-product, if we compile without swapping, we also obtain an encoding of barriers into the calculus without barriers, via private channel communication. Thirdly, we provide a detailed soundness proof for this compiler. Fourthly, we have implemented our compiler in ProVerif. Hence, we extend the class of equivalences that can be proved automatically. Finally, we analyse privacy in election schemes and in a vehicular ad-hoc network to showcase our results (Section 4). This manuscript mainly differs from its conference version (Blanchet and Smyth 2016) by the inclusion of proofs and additional examples and explanations. ## Comparison with Smyth *et al.* The idea of swapping data at barriers was informally introduced by Delaune, Ryan & Smyth (Delaune, Ryan, and Smyth 2008; Smyth 2007). Our contributions improve upon their work by providing a strong theoretical foundation to their idea. In particular, they do not provide a soundness proof, we do; they prohibit replication and place restrictions on control flow and parallel composition, we relax these conditions; and they did not implement their results, we implement ours. (Smyth presented a preliminary version of our compiler in his thesis (Smyth 2011, chap. 5), and Klus, Smyth & Ryan implemented that preliminary compiler (Klus, Smyth, and Ryan 2010). The preliminary compiler differs from the one presented here; moreover, it was not proved sound. In contrast, we prove that the compiler we have implemented in ProVerif is sound.) # Process calculus We recall Blanchet, Abadi & Fournet’s dialect (Blanchet, Abadi, and Fournet 2008) of the applied pi calculus (Martı́n Abadi and Fournet 2001; Ryan and Smyth 2011). This dialect is particularly useful due to the automated support provided by ProVerif (Blanchet, Smyth, and Cheval 2016; Blanchet 2016). The semantics of the applied pi calculus (Martı́n Abadi and Fournet 2001) and the dialect of (Blanchet, Abadi, and Fournet 2008) were defined using structural equivalence. Those semantics have been simplified by semantics with configurations and without structural equivalence, first for trace properties (Martı́n Abadi and Blanchet 2005), then for equivalences (Baudet 2007; Blanchet 2008; Arapinis et al. 2014). In this paper, we use the latter semantics. In addition, we extend the calculus to capture barrier synchronisation, by giving the syntax and formal semantics of barriers. ## Syntax and semantics The calculus assumes an infinite set of *names*, an infinite set of *variables*, and a finite set of *function symbols* (*constructors* and *destructors*), each with an associated arity. We write $f$ for a constructor, $g$ for a destructor, and $h$ for a constructor or destructor; constructors are used to build terms, whereas destructors are used to manipulate terms in expressions. Thus, *terms* range over names, variables, and applications of constructors to terms, and *expressions* allow applications of function symbols to expressions (Figure 1). We use metavariables $u$ and $w$ to range over both names and variables. *Substitutions* $\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}$ replace $x$ with $M$. Arbitrarily large substitutions can be written as $\{\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_1$}},\ldots,\textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_n$}}\}$ and the letters $\sigma$ and $\tau$ range over substitutions. We write $M\sigma$ for the result of applying $\sigma$ to the variables of $M$. Similarly, *renamings* $\{\textnormal{\raisebox{2pt}{\footnotesize $u$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $w$}}\}$ replace $w$ with $u$, where $u$ and $w$ are both names or both variables. The semantics of a destructor $g$ of arity $l$ are given by a finite set $\mathsf{def}(g)$ of rewrite rules $g(M'_1, \ldots, M'_l) \rightarrow M'$, where $M'_1,\ldots, M'_l, M'$ are terms that contain only constructors and variables, the variables of $M'$ must be bound in $M'_1, \ldots, M'_l$, and variables are subject to renaming. The evaluation of expression $g(M_1, \ldots, M_l)$ succeeds if there exists a rewrite rule $g(M'_1, \ldots, M'_l) \rightarrow M'$ in $\mathsf{def}(g)$ and a substitution $\sigma$ such that $M_i = M'_i\sigma$ for all $i \in \{ {1}, \ldots, {l}\}$, and in this case $g(M_1, \ldots, M_l)$ evaluates to $M'\sigma$. In order to avoid distinguishing constructors and destructors in the semantics of expressions, we let $\mathsf{def}(f)$ be $\{f(x_1,\dots,x_l)\rightarrow f(x_1,\dots,x_l)\}$, where $f$ is a constructor of arity $l$. In particular, we use $n$-ary constructors $\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1,\dots,\allowbreak M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$ for tuples, and unary destructors $\pi_{i,n}$ for projections, with the rewrite rule $\pi_{i,n}(\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{x_1,\dots,\allowbreak x_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}) \rightarrow x_i$ for all $i \in \{1, \dots, n\}$. ProVerif supports both rewrite rules and equations (Blanchet, Abadi, and Fournet 2008); we omit equations in this paper for simplicity. Our proofs can be extended to equations, and our implementation supports them[^3]. The grammar for *processes* is presented in Figure 1. The process $\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q$ tries to evaluate $D$; if this succeeds, then $x$ is bound to the result and $P$ is executed, otherwise, $Q$ is executed. We define the conditional $\textnormal{if } M=N \textnormal{ then } P \textnormal{ else }Q$ as $\textnormal{let } x=\mathsf{eq}(M,N) \textnormal{ in } P \textnormal{ else }Q$, where $x$ is a fresh variable, $\mathsf{eq}$ is a binary destructor, and $\mathrm{def}(\mathsf{eq}) = \{\mathsf{eq}(y,y) \rightarrow y\}$; we always include $\mathsf{eq}$ in our set of function symbols. The else branches may be omitted when $Q$ is the null process. The rest of the syntax is standard (see (Blanchet 2008, 2004; Blanchet, Abadi, and Fournet 2008)), except for barriers, which we explain next.

̄ ̄ ̄

M, N : :=terms
a, b, c, …, k, …, m, n, …, sname
x, y, zvariable
f(M1, …, Ml)constructor application
D : :=expressions
Mterm
h(D1, …, Dl)function evaluation
P, Q, R : :=processes
0null process
P ∣ Qparallel composition
!Preplication
ν a.Pname restriction
M(x).Pmessage input
$\overline{M}\langle N\rangle.P$message output
$\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q$expression evaluation
$t\textnormal{::}\,{P}$barrier

Syntax for terms and processes
Our syntax allows processes to contain barriers $t\textnormal{::}\,P$, where $t\in\mathbb{N}$. Intuitively, $t\textnormal{::}\,P$ blocks $P$ until all processes running in parallel are ready to synchronise at barrier $t$. In addition, barriers are ordered, so $t\textnormal{::}\,P$ is also blocked if there are any barriers $t'$ such that $t'3.5.1. The *scope* of names and variables is delimited by binders $\nu\,n$, $M(x)$, and $\textnormal{let } x=D \textnormal{ in}$. The set of free names $\mathsf{fn}(P)$ contains every name $n$ in $P$ which is not under the scope of the binder $\nu\,n$. The set of free variables $\mathsf{fv}(P)$ contains every variable $x$ in $P$ which is not under the scope of a message input $M(x)$ or an expression evaluation $\textnormal{let } x=D \textnormal{ in}$. Using similar notation, the set of names in a term $M$ is denoted $\mathsf{fn}(M)$ and the set of variables in a term $M$ is denoted $\mathsf{fv}(M)$. We naturally extend these functions to multisets ${\mathcal P}$ of processes by $\mathsf{fn}({\mathcal P}) = \bigcup_{P\in{\mathcal P}} \mathsf{fn}(P)$ and $\mathsf{fv}({\mathcal P}) = \bigcup_{P\in{\mathcal P}} \mathsf{fv}(P)$. A term $M$ is ground if $\mathsf{fv}(M) = \emptyset$, a substitution $\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}$ is ground if $M$ is ground, and a process $P$ is closed if $\mathsf{fv}(P) = \emptyset$. Processes are considered equal modulo renaming of bound names and variables. As usual, substitutions avoid name and variable capture, by first renaming bound names and variables to fresh names and variables, respectively.

M ⇓ M(M is a term, so it does not contain destructors)
h(D1, …, Dl) ⇓ Nσ if
there exist h(N1, …, Nl) → N ∈ def(h) and σ such that
for all i ∈ {1, …, l} we have Di ⇓ Mi and Mi = Niσ $$\begin{aligned} &B,E,{\mathcal P}\cup \{0\}\;\rightarrow\;B,E,{\mathcal P}\tag*{{\ensuremath{\mbox{\sc (Red Nil)}}}}\\[3mm] &B,E,{\mathcal P}\cup \{P \mid Q\}\;\rightarrow\;B,E,{\mathcal P}\cup \{P,Q\} \tag*{{\ensuremath{\mbox{\sc (Red Par)}}}}\\[3mm] &B,E,{\mathcal P}\cup \{!P\}\;\rightarrow\;B,E,{\mathcal P}\cup \{P,!P\} \tag*{{\ensuremath{\mbox{\sc (Red Repl)}}}}\\[3mm] \begin{split} &B,E,{\mathcal P}\cup \{\nu\,n.P\}\;\rightarrow\;B,E \cup \{n'\},{\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\}\\ &\textrm{for some name }n'\textrm{ such that }n'\not\in E \cup \mathsf{fn}({\mathcal P}\cup \{\nu\,n.P\}) \end{split}\tag*{{\ensuremath{\mbox{\sc (Red Res)}}}}\\[3mm] &B,E,{\mathcal P}\cup \{\overline{N}\langle M\rangle.P, N(x).Q\}\;\rightarrow\; B,E,{\mathcal P}\cup \{P,Q\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\} \tag*{{\ensuremath{\mbox{\sc (Red I/O)}}}}\\[3mm] \begin{split} &B,E,{\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\}\;\rightarrow\; B,E,{\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}\\ &\textrm{if }D\Downarrow M \end{split}\tag*{{\ensuremath{\mbox{\sc (Red Destr 1)}}}}\\[3mm] \begin{split} &B,E,{\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\}\;\rightarrow\;B,E,{\mathcal P}\cup \{Q\}\\ &\textrm{if there is no $M$ such that }D\Downarrow M \end{split}\tag*{{\ensuremath{\mbox{\sc (Red Destr 2)}}}}\\[3mm] \begin{split} &B,E,{\mathcal P}\cup \{t\textnormal{::}\,P_1,\dots,t\textnormal{::}\,P_n\} \;\rightarrow\; B\backslash\{t^n\},E,{\mathcal P}\cup \{P_1,\dots,P_n\}\\ &\textrm{if $n\geq 1$ and for all $t'$ such that $t' \leq t$, we have $t'\not\in B\backslash\{t^n\}$,}\\ &\textrm{where $t^n$ denotes $n$ copies of $t$.} \end{split}\tag*{{\ensuremath{\mbox{\sc (Red Bar)}}}} \end{aligned}$$

Operational semantics
The operational semantics is defined by reduction ($\rightarrow$) on *configurations*. A configuration $\mathcal{C}$ is a triple $B,E,{\mathcal P}$, where $B$ is a finite multiset of integers, $E$ is a finite set of names, and ${\mathcal P}$ is a finite multiset of closed processes. The multiset $B$ contains the barriers that control the synchronisation of processes in ${\mathcal P}$. The set $E$ is initially empty and is extended to include any names introduced during reduction, namely, those names introduced by ${\ensuremath{\mbox{\sc (Red Res)}}}$. When $E = \{\tilde a\}$ and ${\mathcal P}= \{P_1, \dots, P_n\}$, the configuration $B,E,{\mathcal P}$ intuitively stands for $\nu\,\tilde a.(P_1 \mid \dots \mid P_n)$. We consider configurations as equal modulo any renaming of the names in $E, {\mathcal P}$ that leaves $\mathsf{fn}({\mathcal P})\setminus E$ unchanged. The initial configuration for a closed process $P$ is $\mathcal{C}_{\textnormal{init}}(P) = \mathsf{barriers}(P), \emptyset, \{P\}$. Figure 2 defines reduction rules for each construct of the language. The rule ${\ensuremath{\mbox{\sc (Red Repl)}}}$ creates a new copy of the replicated process $P$. The rule ${\ensuremath{\mbox{\sc (Red Res)}}}$ reduces $\nu\,n$ by creating a fresh name $n'$, adding it to $E$, and substituting it for $n$. The rule ${\ensuremath{\mbox{\sc (Red I/O)}}}$ performs communication: the term $M$ sent by $\overline{N}\langle M\rangle.P$ is received by $N(x).Q$, and substituted for $x$. The rules ${\ensuremath{\mbox{\sc (Red Destr 1)}}}$ and ${\ensuremath{\mbox{\sc (Red Destr 2)}}}$ treat expression evaluations. They first evaluate $D$, using the relation $D \Downarrow M$, which means that the expression $D$ evaluates to the term $M$, and is also defined in Figure 2. When this evaluation succeeds, ${\ensuremath{\mbox{\sc (Red Destr 1)}}}$ substitutes the result $M$ for $x$ and runs $P$. When it fails, ${\ensuremath{\mbox{\sc (Red Destr 2)}}}$ runs $Q$. Finally, the new rule ${\ensuremath{\mbox{\sc (Red Bar)}}}$ performs barrier synchronisation: it synchronises on the lowest barrier $t$ in $B$. If $t$ occurs $n$ times in $B$, it requires $n$ processes $t\textnormal{::}\,P_1,\dots,t\textnormal{::}\,P_n$ to be ready to synchronise, and in this case, it removes barrier $t$ both from $B$ and from these processes, which can then further reduce. A configuration $B,E,{\mathcal P}$ is *valid* when $\mathsf{barriers}({\mathcal P}) \subseteq B$. It is easy to check that the initial configuration is valid and that validity is preserved by reduction. We shall only manipulate valid configurations.
**Example 4**. *Let us consider the parallel composition of processes $P=\overline{c}\langle k\rangle.1\textnormal{::}\,c(x)$, $Q=\nu\,n.1\textnormal{::}\,\overline{c}\langle n\rangle$, and $R=c(x)$, which yields the initial configuration $\{1^2\},\;\emptyset,\;\{P\mid Q \mid R\}$, since the process $P\mid Q \mid R$ contains two barriers 1. We have $$\begin{aligned} \{1^2\},\;\emptyset,\;\{P\mid Q \mid R\} &\xrightarrow{}\{1^2\},\emptyset,\{P,\;Q \mid R\} \tag*{by {\ensuremath{\mbox{\sc (Red Par)}}}} \\ &\xrightarrow{}\{1^2\},\emptyset,\{P,\;Q,\;R\} \tag*{by {\ensuremath{\mbox{\sc (Red Par)}}}} \\ &\xrightarrow{}\{1^2\},\emptyset,\{1\textnormal{::}\,c(x),\;Q,\; 0\} \tag*{by {\ensuremath{\mbox{\sc (Red I/O)}}}} \\ &\xrightarrow{}\{1^2\},\emptyset,\{1\textnormal{::}\,c(x),\;Q\} \tag*{by {\ensuremath{\mbox{\sc (Red Nil)}}}} \\ &\xrightarrow{}\{1^2\},\{n'\},\{1\textnormal{::}\,c(x),\;1\textnormal{::}\,\overline{c}\langle n'\rangle\} \tag*{by {\ensuremath{\mbox{\sc (Red Res)}}}} \\ &\xrightarrow{}\emptyset,\{n'\},\{c(x),\;\overline{c}\langle n'\rangle\} \tag*{by {\ensuremath{\mbox{\sc (Red Bar)}}}} \\ &\xrightarrow{}\emptyset,\{n'\},\{0,\; 0\} \tag*{by {\ensuremath{\mbox{\sc (Red I/O)}}}} \\ &\xrightarrow{}\emptyset,\{n'\},\{0\} \tag*{by {\ensuremath{\mbox{\sc (Red Nil)}}}} \\ &\xrightarrow{}\emptyset,\{n'\},\emptyset \tag*{by {\ensuremath{\mbox{\sc (Red Nil)}}}} \end{aligned}$$ First, the parallel compositions are expanded (by ${\ensuremath{\mbox{\sc (Red Par)}}}$), then process $P$ sends $k$ to process $R$, on channel $c$ (first reduction ${\ensuremath{\mbox{\sc (Red I/O)}}}$), and a fresh name $n'$ is created by reducing $\nu\,n$ (by ${\ensuremath{\mbox{\sc (Red Res)}}}$). These steps must happen before barrier synchronisation, by ${\ensuremath{\mbox{\sc (Red Bar)}}}$. After that synchronisation, the communication between $c(x)$ and $\overline{c}\langle n'\rangle$ can happen (second reduction ${\ensuremath{\mbox{\sc (Red I/O)}}}$).* *The semantics permits synchronisation on barrier $t$, immediately followed by synchronisation on barrier $t+1$. For instance, $\{1^2,2\},\emptyset,\{1\textnormal{::}\,c(x) \mid 1\textnormal{::}\,\overline{c}\langle n\rangle \mid 2\textnormal{::}\,\overline{c}\langle m\rangle\}$ reduces to $\emptyset,\emptyset,\{c(x),\;\overline{c}\langle n\rangle,\;\overline{c}\langle m\rangle\}$ (by $\mbox{\sc (Red Par)}$ twice and $\mbox{\sc (Red Bar)}$ twice). Hence, communication between $c(x)$ and $\overline{c}\langle n\rangle$, or $c(x)$ and $\overline{c}\langle m\rangle$ is possible. To prevent the latter communication, process $1\textnormal{::}\,c(x).2\textnormal{::}\,0 \mid 1\textnormal{::}\,\overline{c}\langle n\rangle.2\textnormal{::}\,0 \mid 2\textnormal{::}\,\overline{c}\langle m\rangle$ can be considered.*
## Observational equivalence Intuitively, configurations $\mathcal{C}$ and $\mathcal{C}'$ are observationally equivalent if they can output on the same channels in the presence of any adversary. Formally, we adapt the definition of observational equivalence by Arapinis *et al.* (Arapinis et al. 2014) to consider barriers rather than mutable state. We define a *context* $C[\_]$ to be a process with a hole. We obtain $C[P]$ as the result of filling $C[\_]$’s hole with process $P$. We define *adversarial contexts* as contexts $\nu\,\tilde n.(\_ \mid Q)$ with $\mathsf{fv}(Q) = \emptyset$ and $\mathsf{barriers}(Q) = \emptyset$. When $\mathcal{C}= B, E, {\mathcal P}$ and $C[\_]= \nu\,\tilde n.(\_ \mid Q)$ is an adversarial context, we define $C[\mathcal{C}] = B,E \cup \{\tilde n\},{\mathcal P}\cup\{Q\}$, after renaming the names in $E,{\mathcal P}$ so that $E \cap \mathsf{fn}(Q) = \emptyset$. A configuration $\mathcal{C}= B,E,{\mathcal P}$ can output on a channel $N$, denoted, $\mathcal{C}\downarrow_N$, if there exists $\overline{N}\langle M\rangle.P\in{\mathcal P}$ with $\mathsf{fn}(N) \cap E = \emptyset$, for some term $M$ and process $P$.
**Definition 1** (Observational equivalence). *Observational equivalence between configurations $\approx$ is the largest symmetric relation $\mathrel{\mathcal{R}}$ between valid configurations such that $\mathcal{C}\mathrel{\mathcal{R}}\mathcal{C}'$ implies:* 1. *for all $N$, if $\mathcal{C}\downarrow_N$, then $\mathcal{C}'\xrightarrow{}^* \mathcal{C}''$ and $\mathcal{C}'' \downarrow_N$ for some $\mathcal{C}''$;* 2. *if $\mathcal{C}\rightarrow \mathcal{C}_1$, then $\mathcal{C}' \rightarrow^* \mathcal{C}_1'$ and $\mathcal{C}_1 \mathrel{\mathcal{R}}\mathcal{C}_1'$ for some $\mathcal{C}_1'$.* 3. *$C[\mathcal{C}] \mathrel{\mathcal{R}}C[\mathcal{C}']$ for all adversarial contexts $C[\_]$.* *Closed processes $P$ and $P'$ are *observationally equivalent*, denoted $P \approx P'$, if $\mathcal{C}_{\textnormal{init}}(P) \approx\mathcal{C}_{\textnormal{init}}(P')$.*
The definition first formulates observational equivalence on semantic configurations. Item 1 guarantees that, if a configuration $\mathcal{C}$ outputs on a public channel, then so does $\mathcal{C}'$. Item 2 guarantees that this property is preserved by reduction, and Item 3 guarantees that it is preserved in the presence of any adversary. Finally, observational equivalence is formulated on closed processes. ## Biprocesses The calculus defines syntax to model pairs of processes that have the same structure and differ only by the terms that they contain. We call such a pair of processes a *biprocess*. The grammar for biprocesses is an extension of Figure 1, with additional cases so that $\mathsf{diff}[M,M']$ is a term and $\mathsf{diff}[D,D']$ is an expression. (We occasionally refer to processes and biprocesses as processes when it is clear from the context.) Given a biprocess $P$, we define processes $\mathsf{fst}(P)$ and $\mathsf{snd}(P)$ as follows: $\mathsf{fst}(P)$ is obtained by replacing all occurrences of $\mathsf{diff}[M,M']$ with $M$ and $\mathsf{snd}(P)$ is obtained by replacing $\mathsf{diff}[M,M']$ with $M'$. We define $\mathsf{fst}(D)$, $\mathsf{fst}(M)$, $\mathsf{snd}(D)$, and $\mathsf{snd}(M)$ similarly, and naturally extend these functions to multisets of biprocesses by $\mathsf{fst}({\mathcal P}) = \{\mathsf{fst}(P) \mid P\in{\mathcal P}\}$ and $\mathsf{snd}({\mathcal P}) = \{\mathsf{snd}(P) \mid P\in{\mathcal P}\}$, and to configurations by $\mathsf{fst}(B,E,{\mathcal P}) = B,E,\mathsf{fst}({\mathcal P})$ and $\mathsf{snd}(B,E,{\mathcal P}) = B,E,\mathsf{snd}({\mathcal P})$. The standard definitions of $\mathsf{barriers}$, free names, and free variables apply to biprocesses as well. Adversarial contexts do not contain $\mathsf{diff}$. Observational equivalence can be formalised as a property of biprocesses:

$$\begin{aligned} \begin{split} &B,E,{\mathcal P}\cup \{\overline{N}\langle M\rangle.P, N'(x).Q\}\;\rightarrow\; B,E,{\mathcal P}\cup \{P,Q\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}\\ &\textrm{if }\mathsf{fst}(N)=\mathsf{fst}(N')\textrm{ and }\mathsf{snd}(N)=\mathsf{snd}(N') \end{split}\tag*{{\ensuremath{\mbox{\sc (Red I/O)}}}}\\[3mm] \begin{split} &B,E,{\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\}\;\rightarrow\; B,E,{\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $\mathsf{diff}[M,M']$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}\\ &\textrm{if }\mathsf{fst}(D)\Downarrow M\textrm{ and }\mathsf{snd}(D)\Downarrow M' \end{split}\tag*{{\ensuremath{\mbox{\sc (Red Destr 1)}}}}\\[3mm] \begin{split} &B,E,{\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\}\;\rightarrow\;B,E,{\mathcal P}\cup \{Q\}\\ &\textrm{if there is no $M$ such that }\mathsf{fst}(D)\Downarrow M\\ &\textrm{and no $M'$ such that }\mathsf{snd}(D)\Downarrow M' \end{split}\tag*{{\ensuremath{\mbox{\sc (Red Destr 2)}}}} \end{aligned}$$

Generalised semantics for biprocesses
**Definition 2**. *A closed biprocess $P$ satisfies *observational equivalence* if $\mathsf{fst}(P)\approx\mathsf{snd}(P)$.*
The semantics for biprocesses includes the rules in Figure 2, except for $\mbox{\sc (Red I/O)}$, $\mbox{\sc (Red Destr 1)}$, and $\mbox{\sc (Red Destr 2)}$ which are revised in Figure 3. It follows from this semantics that, if $\mathcal{C}\xrightarrow{}\mathcal{C}'$, then $\mathsf{fst}(\mathcal{C}) \xrightarrow{}\mathsf{fst}(\mathcal{C}')$ and $\mathsf{snd}(\mathcal{C}) \xrightarrow{}\mathsf{snd}(\mathcal{C}')$. In other words, a biprocess reduces when the two underlying processes reduce in the same way. However, reductions in $\mathsf{fst}(\mathcal{C})$ or $\mathsf{snd}(\mathcal{C})$ do not necessarily imply reductions in $\mathcal{C}$, that is, there exist configurations $\mathcal{C}$ such that $\mathsf{fst}(\mathcal{C}) \xrightarrow{}\mathsf{fst}(\mathcal{C}')$, but there is no such reduction $\mathcal{C}\xrightarrow{}\mathcal{C}'$, and symmetrically for $\mathsf{snd}(\mathcal{C})$. For example, given the configuration $\mathcal{C}= \emptyset,\emptyset,\{\overline{\mathsf{diff}[a,c]}\langle n\rangle.0,a(x).0\}$, we have $\mathsf{fst}(\mathcal{C}) \xrightarrow{}\emptyset,\emptyset,\{0,0\}$, but there is no reduction $\mathcal{C}\xrightarrow{}\emptyset,\emptyset,\{0,0\}$. Formally, this behaviour can be captured using the *divergence* relation ($\uparrow$) for configurations (Figure 4) (Baudet 2007). Divergence can occur because either: i) one process can perform a communication and the other cannot, by rule ${\ensuremath{\mbox{\sc (Div I/O)}}}$; or ii) the evaluation of an expression succeeds in one process and fails in the other, by rule ${\ensuremath{\mbox{\sc (Div Destr)}}}$. Using the notion of *diff-equivalence* (Definition 3), Theorem 1 shows that a biprocess $P$ satisfies observational equivalence when reductions in $C[\mathcal{C}_{\textnormal{init}}(\mathsf{fst}(P))]$ or $C[\mathcal{C}_{\textnormal{init}}(\mathsf{snd}(P))]$ imply reductions in $C[\mathcal{C}_{\textnormal{init}}(P)]$ for all adversarial contexts $C[\_]$, that is, configurations obtained from $C[\mathcal{C}_{\textnormal{init}}(P)]$ never diverge.

$$\begin{aligned} \begin{split} &B,E,{\mathcal P}\cup \{\overline{N}\langle M\rangle.P, N'(x).Q\}\;\uparrow\\ &\textrm{if }(\mathsf{fst}(N)=\mathsf{fst}(N'))\not\Leftrightarrow(\mathsf{snd}(N)=\mathsf{snd}(N')) \end{split}\tag*{{\ensuremath{\mbox{\sc (Div I/O)}}}}\\[3mm] \begin{split} &B,E,{\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\}\;\uparrow\\ &\textrm{if }(\exists M . \mathsf{fst}(D) \Downarrow M)\not\Leftrightarrow(\exists M' . \mathsf{snd}(D)\Downarrow M') \end{split}\tag*{{\ensuremath{\mbox{\sc (Div Destr)}}}} \end{aligned}$$

Semantics for divergence
**Definition 3** (Diff-equivalence). *A closed biprocess $P$ satisfies *diff-equivalence* if for all adversarial contexts $C[\_]$, there is no configuration $\mathcal{C}$ such that $C[\mathcal{C}_{\textnormal{init}}(P)] \xrightarrow{}^*\mathcal{C}$ and $\mathcal{C}\uparrow$.*
**Theorem 1**. *Let $P$ be a closed biprocess without barriers. If $P$ satisfies diff-equivalence, then $P$ satisfies observational equivalence.*
Theorem 1 can be proved by easily adapting the result of Blanchet (Blanchet 2016, Theorem 3.5). This result itself adapts the result of Blanchet, Abadi & Fournet (Blanchet, Abadi, and Fournet 2008, Theorem 1), initially presented with a semantics based on structural equivalence and reduction, to a semantics based on reduction on configurations.
**Example 5**. *Let us revisit Example 1. Formally, the biprocess $P =\overline{c}\langle\mathsf{diff}[v,v']\rangle\mid\overline{c}\langle\mathsf{diff}[v',v]\rangle$ does not satisfy diff-equivalence, because the context $C[\_]=\_ \mid c(x).\textnormal{if } x=v \textnormal{ then }{\overline{c}\langle n\rangle}$ causes divergence: $$\begin{aligned} C[\mathcal{C}_{\textnormal{init}}(P)] &= \emptyset, \emptyset, \{\overline{c}\langle\mathsf{diff}[v,v']\rangle\mid\overline{c}\langle\mathsf{diff}[v',v]\rangle, c(x).\textnormal{if } x=v \textnormal{ then }{\overline{c}\langle n\rangle}\}\\ \xrightarrow{}^* \mathcal{C}&= \emptyset, \emptyset, \{ 0, \overline{c}\langle\mathsf{diff}[v',v]\rangle, \textnormal{if } \mathsf{diff}[v,v']=v \textnormal{ then }{\overline{c}\langle n\rangle}\} \end{aligned}$$ by $\mbox{\sc (Red Par)}$ and $\mbox{\sc (Red I/O)}$, and $\mathcal{C}\uparrow$ by $\mbox{\sc (Div Destr)}$. (Recall that the conditional is encoded as a destructor application.)* *We can revisit Example 3 similarly. The biprocess $P_{\sf ex}=\overline{c}\langle A\rangle.1\textnormal{::}\,\overline{c}\langle\mathsf{diff}[v,v']\rangle\mid\overline{c}\langle B\rangle.1\textnormal{::}\,\overline{c}\langle\mathsf{diff}[v',v]\rangle$ does not satisfy diff-equivalence, because the context $C[\_]=\_ \mid c(x).c(y).c(z). \textnormal{if } z=v \textnormal{ then }{\overline{c}\langle n\rangle}$ causes divergence: $$\begin{aligned} C[\mathcal{C}_{\textnormal{init}}(P)] = {}&\{1^2\}, \emptyset, \{P_{\sf ex}, c(x).c(y).c(z).\textnormal{if } z=v \textnormal{ then }{\overline{c}\langle n\rangle}\}\\ \xrightarrow{}^* {}&\{1^2\}, \emptyset, \{ 1\textnormal{::}\,\overline{c}\langle\mathsf{diff}[v,v']\rangle, 1\textnormal{::}\,\overline{c}\langle\mathsf{diff}[v',v]\rangle, c(z).\textnormal{if } z=v \textnormal{ then }{\overline{c}\langle n\rangle}\} \tag*{by {{\ensuremath{\mbox{\sc (Red Par)}}}} and {{\ensuremath{\mbox{\sc (Red I/O)}}}} twice}\\ \xrightarrow{}{}& \emptyset, \emptyset, \{ \overline{c}\langle\mathsf{diff}[v,v']\rangle, \overline{c}\langle\mathsf{diff}[v',v]\rangle, c(z).\textnormal{if } z=v \textnormal{ then }{\overline{c}\langle n\rangle}\} \tag*{by {{\ensuremath{\mbox{\sc (Red Bar)}}}}}\\ \xrightarrow{}\mathcal{C}= {}& \emptyset, \emptyset, \{ 0, \overline{c}\langle\mathsf{diff}[v',v]\rangle, \textnormal{if } \mathsf{diff}[v,v']=v \textnormal{ then }{\overline{c}\langle n\rangle}\} \tag*{by {{\ensuremath{\mbox{\sc (Red I/O)}}}}} \end{aligned}$$ and $\mathcal{C}\uparrow$ as above.*
We do not allow adversarial contexts to contain barriers. In general, allowing them would enable an adversary to distinguish more processes. For instance, the processes $P =\overline{c}\langle n\rangle.\overline{c}\langle m\rangle$ and $Q =\overline{c}\langle n\rangle.1\textnormal{::}\, \overline{c}\langle m\rangle$ are observationally equivalent with our definition, because the barrier 1 can be executed immediately after outputting $n$. However, the context $C[\_]=\_ \mid c(x).c(y).1\textnormal{::}\, \overline{d}\langle a\rangle$ would distinguish them: $C[\mathcal{C}_{\textnormal{init}}(P)] = \{1\}, \emptyset, \{\overline{c}\langle n\rangle.\overline{c}\langle m\rangle, c(x).c(y).1\textnormal{::}\, \overline{d}\langle a\rangle \} \xrightarrow{}^* \emptyset, \emptyset, \{\overline{d}\langle a\rangle\} \downarrow_{d}$, while there is no $\mathcal{C}$ such that $C[\mathcal{C}_{\textnormal{init}}(Q)] = \{1^2\}, \emptyset, \{\overline{c}\langle n\rangle.1\textnormal{::}\, \overline{c}\langle m\rangle, c(x).c(y).1\textnormal{::}\, \overline{d}\langle a\rangle \} \xrightarrow{}^* \mathcal{C}\downarrow_{d}$ because the input $c(y)$ cannot be reduced. In contrast, for trace properties, including diff-equivalence, which is a trace property on biprocesses, allowing barriers in adversarial contexts does not give more power to the adversary, because barriers only constrain the possible traces. # Automated reasoning To prove equivalence, we define a compiler from a biprocess (containing barriers) to a set of biprocesses without barriers. The biprocesses in that set permit various swapping strategies. We show that if one of these biprocesses satisfies diff-equivalence, then the original biprocess satisfies observational equivalence. The compiler works in two steps: 1. Function $\mathsf{annotate}$ annotates barriers with the data to be swapped and channels for sending and receiving such data. 2. Function $\mathsf{elim\text{-}and\text{-}swap}$ translates the biprocess with annotated barriers into biprocesses without barriers, which encode barriers using communication (inputs and outputs). We exploit this communication to allow swapping, by sending data back to a different barrier. We introduce annotated barriers (Section 3.1) and define these two steps (Sections 3.2 and 3.3) below. By combining these two steps we obtain our compiler (Section 3.4), which we have implemented in ProVerif (), as of version 1.94. The proof of soundness shows that these two steps preserve the observational behaviour of the biprocesses, so that if a compiled biprocess satisfies observational equivalence, then so does the initial biprocess. ## Process calculus with annotated barriers We introduce an *annotated barrier* construct $t[a,\allowbreak c,\allowbreak \varsigma]\textnormal{::}\,P$, which is not present in the syntax introduced in Section 2, but is used by our compiler. In this construct, $a$ and $c$ are distinct channel names: channel $a$ will be used for sending swappable data, and channel $c$ for receiving swapped data.[^4] Moreover, the *ordered substitution* $\varsigma = (\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_1$}}, \ldots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_n$}})$ collects swappable data $M_1, \dots, M_n$ and associates these terms with variables $x_1, \dots, x_n$; the process $P$ uses these variables instead of the terms $M_1, \dots, M_n$. The ordered substitution $\varsigma$ is similar to a substitution, except that the elements $\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_1$}}, \ldots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_n$}}$ are ordered. (We indicate ordering using parentheses instead of braces.) The ordering is used to designate each variable in the domain unambiguously. We define $\mathsf{dom}(\varsigma) = \{x_1, \ldots, x_n\}$ and $\mathsf{range}(\varsigma) = \{ M_1, \ldots, M_n \}$. As usual, we require that $\mathsf{fv}(\mathsf{range}(\varsigma)) \cap \mathsf{dom}(\varsigma) = \emptyset$. The annotated barrier $t[a,c,\varsigma]\textnormal{::}\,P$ binds the variables in the domain of $\varsigma$ in $P$, so we extend the functions $\mathsf{fn}$ and $\mathsf{fv}$ to annotated barriers as follows: $$\begin{aligned} & \mathsf{fn}(t[a,c,\varsigma]\textnormal{::}\,P) = \{a, c \} \cup \mathsf{fn}(\mathsf{range}(\varsigma)) \cup \mathsf{fn}(P)\\ & \mathsf{fv}(t[a,c,\varsigma]\textnormal{::}\,P) = \mathsf{fv}(\mathsf{range}(\varsigma)) \cup (\mathsf{fv}(P)\setminus \mathsf{dom}(\varsigma)) \end{aligned}$$ We define the *ordered domain* of $\varsigma$, $\mathsf{ordom}(\varsigma) = (x_1, \dots, x_n)$, as the tuple containing the variables in the domain of $\varsigma$, in the same order as in the definition of $\varsigma$. We also introduce a *domain-barrier* construct $t[a,c,\tilde{x}]\textnormal{::}\,P$, which is similar to an annotated barrier except that the ordered substitution $\varsigma$ is replaced with a tuple of variables $\tilde{x} = (x_1, \dots, x_n)$ corresponding to the ordered domain of $\varsigma$. Domain-barriers occur in $\mathsf{barriers}(P)$, but not in processes. We extend function $\mathsf{barriers}$ to annotated barriers as follows: $$\begin{aligned} \mathsf{barriers}(t[a,c,\varsigma]\textnormal{::}\,P) = \{ t[a,c,\mathsf{ordom}(\varsigma)]\textnormal{::}\,P \} \cup \mathsf{barriers}(P) \end{aligned}$$ Hence, function $\mathsf{barriers}$ maps processes to multisets of domain-barriers and integers, and domain-barriers include the process that follows the barrier itself. In addition, we extend $\mathsf{fst}$ and $\mathsf{snd}$ for configurations as follows: $\mathsf{fst}(t[a,c,\tilde{x}]\textnormal{::}\,P) = t[a,c,\tilde{x}]\textnormal{::}\,\mathsf{fst}(P)$ and $\mathsf{fst}(B, E, {\mathcal P}) = \mathsf{fst}(B), E, \mathsf{fst}({\mathcal P})$, and similarly for $\mathsf{snd}$. We introduce the function $\mathsf{channels}(B) = \{a \mid t[a,\allowbreak c, \allowbreak \tilde{x}]\textnormal{::}\,P\in B\} \cup \{c \mid t[a,c,\tilde{x}]\textnormal{::}\,P\in B\}$ to recover the multiset of names used by the domain-barriers in $B$. We implicitly cast $\mathsf{channels}(B)$ into a set when we take the intersection with a set, test the inclusion with a set, or use it as a set of names $E$ inside a configuration $B, E, {\mathcal P}$. We also define the function $\mathsf{fn\text{-}nobc}$, which returns the free names excluding the channels of barriers, by $\mathsf{fn\text{-}nobc}(t[a,c,\varsigma]\textnormal{::}\,P) = \mathsf{fn}(\mathsf{range}(\varsigma)) \cup \mathsf{fn\text{-}nobc}(P)$ and, for all other processes, $\mathsf{fn\text{-}nobc}(P)$ is defined inductively like $\mathsf{fn}(P)$. (The acronym “nobc” stands for “no barrier channels”.) The initial configuration for a closed process $P$ with annotated barriers is $\mathcal{C}_{\textnormal{init}}(P) = \mathsf{barriers}(P), \mathsf{channels}(\mathsf{barriers}(P)), \{P\}$. We consider configurations $B, E, {\mathcal P}$ with annotated barriers as equal modulo any renaming of the names in $B, E, {\mathcal P}$ that leaves $\mathsf{fn}({\mathcal P})\setminus E$ unchanged. We introduce the following validity condition to ensure that channels of annotated barriers are not mixed with other names: they are fresh names when they are introduced by barrier annotation (Section 3.2); they should remain pairwise distinct and distinct from other names. Their scope is global, but they are private, that is, the adversary does not have access to them.
**Definition 4** (Validity). *A process $P$ is *valid* if it is closed, $\mathsf{channels}(\mathsf{barriers}(P)) \cap \mathsf{fn\text{-}nobc}(P) = \emptyset$, the elements of $\mathsf{channels}(\mathsf{barriers}(P))$ are pairwise distinct, and for all annotated barriers in $P$ such that $P = C[t[a,c,\varsigma]\textnormal{::}\,Q]$, we have $\mathsf{fv}(Q) \subseteq \mathsf{dom}(\varsigma)$ and $C[\_]$ does not bind $a$, $c$, nor the names in $\mathsf{fn}(Q)$ above the hole.* *A configuration $B,E,{\mathcal P}$ is *valid* if $\mathsf{barriers}({\mathcal P}) \subseteq B$, $\mathsf{channels}(B) \subseteq E$, all processes in ${\mathcal P}$ are valid, the elements of $\mathsf{channels}(B)$ are pairwise distinct, and $\mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}) = \emptyset$.*
Validity guarantees that channels used in annotated barriers are pairwise distinct (the elements of $\mathsf{channels}(\mathsf{barriers}(P))$ are pairwise distinct; the elements of $\mathsf{channels}(B)$ are pairwise distinct), distinct from other names ($\mathsf{channels}(\mathsf{barriers}(P)) \cap \mathsf{fn\text{-}nobc}(P) = \emptyset$; $\mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}) = \emptyset$), and free in the processes (for all annotated barriers in $P$ such that $P = C[t[a,c,\varsigma]\textnormal{::}\,Q]$, $C[\_]$ does not bind $a$ nor $c$ above the hole). These channels must be in $E$ ($\mathsf{channels}(B) \subseteq E$), which corresponds to the intuition that they are global but private. Furthermore, for each annotated barrier $t[a,c,\varsigma]\textnormal{::}\,Q$, we require that $\mathsf{fv}(Q) \subseteq \mathsf{dom}(\varsigma)$ and the names in $\mathsf{fn}(Q)$ are not bound above the barrier, that is, they are global. This requirement ensures that the local state of the process $t[a,c,\varsigma]\textnormal{::}\,Q$ is contained in the ordered substitution $\varsigma$. The process $Q$ refers to this state using variables in $\mathsf{dom}(\varsigma)$. We consider only valid configurations; Lemma 2 below justifies this point. The operational semantics for processes with both standard and annotated barriers extends the semantics for processes with only standard barriers, with the following rule: $$\begin{gathered} B,E,{\mathcal P}\cup \{t\textnormal{::}\,P_1,\dots,t\textnormal{::}\,P_m, t[a_{m+1},c_{m+1},\varsigma_{m+1}]\textnormal{::}\,P_{m+1},\dots, t[a_n,c_n,\varsigma_n]\textnormal{::}\,P_n\} \\ \rightarrow\;B',E,{\mathcal P}\cup \{P_1,\dots,P_m,P_{m+1}\varsigma_{m+1},\dots,P_n\varsigma_n\} \tag*{{\ensuremath{\mbox{\sc (Red Bar')}}}} \end{gathered}$$ where $0 \leq m \leq n$, $1 \leq n$, $B = \{ t^m, \allowbreak t[a_{m+1},\allowbreak c_{m+1},\allowbreak \mathsf{ordom}(\varsigma_{m+1})]\textnormal{::}\,P_{m+1},\allowbreak \dots,\allowbreak t[a_n,\allowbreak c_n,\allowbreak \mathsf{ordom}(\varsigma_n)]\textnormal{::}\,P_n \}\allowbreak \cup\allowbreak B'$, and for all $t'$ such that $t' \leq t$, $t'$ does not appear in $B'$, i.e., $t'\notin B'$ and $t'[\_]\textnormal{::}\,\_ \notin B'$. When all barriers are standard, this rule reduces to ${\ensuremath{\mbox{\sc (Red Bar)}}}$. The next lemma allows us to show that all considered configurations are valid.
**Lemma 2**. *If $P$ is a valid process, then $\mathcal{C}_{\textnormal{init}}(P)$ is valid. Validity is preserved by reduction, by application of an adversarial context, and by application of $\mathsf{fst}$ and $\mathsf{snd}$.*
The proof of Lemma 2 is detailed in Appendix 6. We refer to processes in which all barriers are annotated as *annotated processes*, and processes in which all barriers are standard as *standard processes*. ## Barrier annotation Next, we define the first step of our compiler, which annotates barriers with additional information.
**Definition 5**. *We define function $\mathsf{annotate}$, from standard processes to annotated processes, as follows: $\mathsf{annotate}$ transforms $C[t\textnormal{::}\,Q]$ into $C[t[a,c,\varsigma]\textnormal{::}\,Q']$, where $C[\_]$ is any context without replication above the hole, $a$ and $c$ are distinct fresh names, and $(Q', \varsigma) = \mathsf{split}({Q})$, where the function $\mathsf{split}$ is defined below. The transformations are performed until all barriers are annotated, in a top-down order, so that in the transformation above, all barriers above $t\textnormal{::}\,Q$ are already annotated and barriers inside $Q$ are standard.* *The function $\mathsf{split}$ is defined by $\mathsf{split}({Q}) = (Q', \varsigma)$ where $Q'$ is a process and $\varsigma = (\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_1$}},\dots,\textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_n$}})$ is an ordered substitution such that terms $M_1, \ldots, M_n$ are the largest subterms of $Q$ that do not contain names or variables bound in $Q$, variables $x_1, \ldots, x_n$ are fresh, and process $Q'$ is obtained from $Q$ by replacing each $M_i$ with $x_i$, so that $Q = Q'\varsigma$. Moreover, the variables $x_1, \dots, x_n$ occur in this order in $Q'$ when read from left to right.*
Intuitively, the function $\mathsf{split}$ separates a process $Q$ into its “skeleton” $Q'$ (a process with variables as placeholders for data) and associated data in the ordered substitution $\varsigma$. Such data can be swapped with another process that has the same skeleton. The ordering of $x_1, \dots, x_n$ chosen in the definition of $\mathsf{split}$ guarantees that the ordering of variables in the domain of $\varsigma$ is consistent among the various subprocesses. This ordering of variables and the fact that $M_1, \ldots, M_n$ are the largest possible subterms allows the checks in the definition of our compiler (see definition of function $\mathsf{swapper}$ in Section 3.3) to succeed more often, and hence increases opportunities for swapping.
**Example 6**. * We have $$\begin{aligned} \mathsf{split}({\overline{c}\langle\mathsf{diff}[v,v']\rangle}) &= (\overline{x}\langle y\rangle, (\textnormal{\raisebox{2pt}{\footnotesize $c$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}},\textnormal{\raisebox{2pt}{\footnotesize $\mathsf{diff}[v,v']$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $y$}}))\\ \mathsf{split}({\overline{c}\langle\mathsf{diff}[v',v]\rangle}) &= (\overline{x'}\langle y'\rangle,(\textnormal{\raisebox{2pt}{\footnotesize $c$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x'$}},\allowbreak\textnormal{\raisebox{2pt}{\footnotesize $\mathsf{diff}[v',v]$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $y'$}})) \end{aligned}$$ The process $\overline{c}\langle\mathsf{diff}[v,v']\rangle$ is separated into its skeleton $Q' = \overline{x}\langle y\rangle$ and the ordered substitution $\varsigma = (\textnormal{\raisebox{2pt}{\footnotesize $c$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}},\allowbreak \textnormal{\raisebox{2pt}{\footnotesize $\mathsf{diff}[v,v']$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $y$}})$, which defines the values of the variables $x$ and $y$ such that $\overline{c}\langle\mathsf{diff}[v,v']\rangle = Q'\varsigma$. The process $\overline{c}\langle\mathsf{diff}[v',v]\rangle$ is separated similarly. Using these results, $\mathsf{annotate}(P_{\sf ex})$ is defined as $$\begin{aligned} &\overline{c}\langle A\rangle.1[a,b,(\textnormal{\raisebox{2pt}{\footnotesize $c$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}},\textnormal{\raisebox{2pt}{\footnotesize $\mathsf{diff}[v,v']$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $y$}})]\textnormal{::}\,\overline{x}\langle y\rangle \mathrel\mid \overline{c}\langle B\rangle.1[a',b',(\textnormal{\raisebox{2pt}{\footnotesize $c$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x'$}},\allowbreak\textnormal{\raisebox{2pt}{\footnotesize $\mathsf{diff}[v',v]$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $y'$}})]\textnormal{::}\,\overline{x'}\langle y'\rangle \end{aligned}$$ where $a,a',b,b'$ are fresh names. That is, $\mathsf{annotate}(P_{\sf ex})$ is derived by annotating the two barriers in $P_{\sf ex}$. (Process $P_{\sf ex}$ is given in Example 3.)*

$$\begin{aligned} \text{R1. }&\mathsf{split}({U}, {M}) = (x, (\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}})) \text{ where $x$ is a fresh variable, if $(\mathsf{fv}(M) \cup \mathsf{fn}(M)) \cap U = \emptyset$}\\ \text{R2. }&\mathsf{split}({U}, {u}) = (u, \emptyset)\text{ if $u \in U$}\\ \text{R3. }&\mathsf{split}({U}, {C[Q_1, \dots, Q_n]}) = (C[Q'_1,\dots,Q'_n], \varsigma)\text{ where}\\ &\quad \text{for all }i \leq n, \mathsf{split}({U \cup U_i}, {Q_i}) = (Q'_i, \varsigma_i)\\ &\quad \text{$C[\_,\dots,\_]$ binds the names and variables in $U_i$ above the $i$-th hole}\\ &\quad \text{$\varsigma = \varsigma_1 + \dots + \varsigma_n$, where }\\ &\qquad (\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_1$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_n$}}) + (\textnormal{\raisebox{2pt}{\footnotesize $M_{n+1}$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_{n+1}$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_m$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_m$}}) = (\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_1$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_m$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_m$}})\\ &\quad \text{$Q_i$ may be a term, an expression, or a process}\\ &\quad \text{$C[\_,\dots,\_]$ is one of the following contexts:}\\ &\quad \begin{array}{r l r l} 1.& 0 & 6. &\overline{{[\_]}}\langle[\_]\rangle.[\_]\\ 2.&[\_] \mid [\_] & 7. &\textnormal{let } x=[\_] \textnormal{ in } [\_] \textnormal{ else }[\_]\\ 3.&![\_] & 8. &t\textnormal{::}\,{[\_]}\\ 4.&\nu\,a.[\_] & 9. &h([\_],\dots,[\_]) \text{ ($h$ is a constructor or a destructor)}\\ 5.&{[\_]}(x).[\_]\qquad{} & 10.&\mathsf{diff}[[\_],[\_]] \end{array}\\ &\quad \text{for $i \leq n$, $U_i$ is computed as follows depending on the context $C[\_,\dots,\_]$:}\\ &\quad \begin{array}{@{}l@{}} \text{-- for context~4, $U_1 = \{ a\}$, since context~4 binds $a$ above its hole;}\\ \text{-- for contexts~5 and~7, $U_2 = \{x\}$ since these contexts bind $x$ above their second hole; }\\ \text{-- in all other cases, $U_i = \emptyset$.}\\ \end{array}\\ &\text{Rule R3 is applied with context~9 or~10 only when rule R1 does not apply.} \end{aligned}$$

Helper function for barrier annotation
The function $\mathsf{split}$ can also be formally defined as $\mathsf{split}({Q}) = \mathsf{split}({\emptyset}, {Q})$ with the definition of $\mathsf{split}({U}, {Q})$ by structural induction on $Q$ given in Figure 5. In that definition, we use contexts with multiple holes. All inductive cases for terms, expressions, and processes have the same form, so we exceptionally use the same notation $Q$ for a term, an expression, and a process. Assuming we initially call $\mathsf{split}({\emptyset}, {Q_0})$, in each recursive call $\mathsf{split}({U}, {Q})$, the set $U$ contains all bound names and variables at the subprocess $Q$ in $Q_0$. Each call to $\mathsf{split}({U}, {Q})$ returns $(Q', \varsigma)$ where $Q'$ is obtained from $Q$ by replacing the largest subterms $M_i$ of $Q$ that do not contain names or variables in $U$ or previously bound in $Q$ with fresh variables $x_i$, and recording the replacement in the ordered substitution $\varsigma = (\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_1$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x_n$}})$. When $Q$ is a term $M$, $\mathsf{split}({U}, {Q}) = \mathsf{split}({U}, {M})$ behaves as follows - If $M$ does not contain names or variables in $U$, then $M$ is replaced with a fresh variable $x$, and the replacement is recorded in $\varsigma = (\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}})$, hence $\mathsf{split}({U}, {M}) = (x, (\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}))$ (rule R1 of Figure 5). - If $M$ is a variable in $U$, then it is left unchanged, hence $\mathsf{split}({U}, {u}) = (u, \emptyset)$ (rule R2). - If $M$ is a constructor application $M = f(M_1, \dots, M_n)$ that contains names or variables in $U$, then we cannot replace $M$ itself with a variable, but we perform the replacement on the largest possible subterms of $M$ by induction: $\mathsf{split}({U}, {M})= (f(M'_1, \dots, M'_n), \varsigma_1 + \dots + \varsigma_n)$ where for all $i \leq n$, $\mathsf{split}({U}, {M_i}) = (M'_i, \varsigma_i)$ (rule R3 with context 9). If $M$ is a constructor application $M = f(M_1, \dots, M_n)$ that does not contains names or variables in $U$, then we always apply rule R1 as mentioned in the first item and never apply rule R3. (As written in Figure 5, rule R3 is applied with context 9 only when rule R1 does not apply.) The case in which $M = \mathsf{diff}[M_1,M_2]$ is similar, using context 10. For an expression or process $Q$, we proceed by induction using the third rule of Figure 5, and after several recursive calls, we apply $\mathsf{split}$ to each term contained in $Q$. For soundness of the transformation (Proposition 5), it is sufficient that:
**Lemma 3**. *If $(Q', \varsigma) = \mathsf{split}({Q})$, then $Q = Q'\varsigma$, $\mathsf{fv}(Q') = \mathsf{dom}(\varsigma)$, and $\mathsf{fn}(Q') = \emptyset$.*
This lemma is an immediate corollary of the following result:
**Lemma 4**. *Let $Q$ be a term, an expression, or a process. If $(Q',\varsigma) = \mathsf{split}({U}, {Q})$, then $Q'\varsigma = Q$, $(\mathsf{fv}(\mathsf{range}(\varsigma)) \cup \mathsf{fn}(\mathsf{range}(\varsigma))) \cap U = \emptyset$, $\mathsf{dom}(\varsigma) \subseteq \mathsf{fv}(Q')\subseteq \mathsf{dom}(\varsigma) \cup U$, $\mathsf{fn}(Q') \subseteq U$, and $\mathsf{dom}(\varsigma)$ consists of fresh variables.*
Lemma 4 is proved in Appendix 7 by induction of $Q$, following the definition of $\mathsf{split}$ in Figure 5. Intuitively, when reducing the annotated barrier by ${\ensuremath{\mbox{\sc (Red Bar')}}}$, we reduce $t[a,c,\varsigma]\textnormal{::}\,Q'$ to $Q'\varsigma$, which is equal to $Q$ by Lemma 3, so we recover the process $Q$ we had before annotation. The conditions that $\mathsf{fv}(Q') = \mathsf{dom}(\varsigma)$ and $\mathsf{fn}(Q') = \emptyset$ show that no names and variables are free in $Q'$ and bound above the barrier, thus substitution $\varsigma$ contains the whole state of the process $Q = Q'\varsigma$. The following proposition shows that annotation does not alter the semantics of processes:
**Proposition 5**. *If $P_0$ is a closed standard biprocess and $P'_0 = \mathsf{annotate}(P_0)$, then $P'_0$ is valid, $\mathsf{fst}(P'_0) \approx \mathsf{fst}(P_0)$, and $\mathsf{snd}(P'_0) \approx \mathsf{snd}(P_0)$.*
*Proof sketch.* The main step of the proof consists in showing that, when $C[t\textnormal{::}\,P\varsigma]$ and $C[t[a,c,\varsigma]\textnormal{::}\,P]$ are valid processes, we have $%\begin{equation} C[t\textnormal{::}\,P\varsigma] \approx C[t[a,c,\varsigma]\textnormal{::}\,P] %\label{eq:equiv-prop:standard-to-annotated-all} %\end{equation}$. This proof is performed by defining a relation $\mathrel{\mathcal{R}}$ that satisfies the conditions of Definition 1. By Lemma 3, from the annotated biprocess $P'_0$, we can rebuild the initial process $P_0$ by replacing each occurrence of an annotated barrier $t[a,c,\varsigma]\textnormal{::}\,Q$ with $t\textnormal{::}\, Q\varsigma$, so the same replacement also transforms $\mathsf{fst}(P'_0)$ into $\mathsf{fst}(P_0)$ and $\mathsf{snd}(P'_0)$ into $\mathsf{snd}(P_0)$. By $C[t\textnormal{::}\,P\varsigma] \approx C[t[a,c,\varsigma]\textnormal{::}\,P]$, this replacement preserves the observational behaviour of the processes. This proof is detailed in Appendix 8. ◻
## Barrier elimination and swapping Next, we define the second step of our compiler, which translates an annotated biprocess into biprocesses without barriers. Each annotated barrier $t[a_i,c_i,\varsigma_i]$ ($1 \leq i \leq n$) is eliminated by replacing it with an output on channel $a_i$ of swappable data, followed by an input on channel $c_i$ that receives swapped data. A swapping process is added in parallel, which receives the swappable data on channels $a_1, \dots, a_n$ for all barriers $t$, before sending swapped data on channels $c_1, \dots, c_n$. Therefore, all inputs on channels $a_1, \dots, a_n$ must be received before the outputs on channels $c_1, \dots, c_n$ are sent and the processes that follow the barriers can proceed, thus the synchronisation between the barriers is guaranteed. Moreover, the swapping process may permute data, sending on channel $c_i$ data that comes from channel $a_j$ with $j \neq i$, thus implementing swapping. This swapping is allowed only when the processes that follow the barriers are identical (up to renaming of some channel names and variables), so that swapping preserves the observational behaviour of the processes. We detail this construction below. ### Barrier elimination First, we eliminate barriers.
**Definition 6**. *The function $\mathsf{bar\text{-}elim}$ removes annotated barriers, by transforming each annotated barrier $t[a,\allowbreak c,\allowbreak (\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}},\allowbreak \dots,\allowbreak \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}})]\textnormal{::}\,Q$ into $\overline{a}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1,\dots,M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle.\allowbreak c(z).\allowbreak \textnormal{let } z_1=\pi_{1,n}(z) \textnormal{ in } \allowbreak \cdots\ \textnormal{let } z_n=\pi_{n,n}(z) \textnormal{ in } Q$, where $z$ is a fresh variable.*
The definition of function $\mathsf{bar\text{-}elim}$ ensures that, if the message $\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1,\dots,M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$ on the private channel $a$ is simply forwarded to the private channel $c$, then the process derived by application of $\mathsf{bar\text{-}elim}$ binds $z_i$ to $M_i$ for each $i\in\{1,\dots,n\}$, like the annotated barrier, so the original process and the process derived by application $\mathsf{bar\text{-}elim}$ are observationally equivalent. Intuitively, the private channel communication provides an opportunity to swap data. The function $\mathsf{bar\text{-}elim}$ is defined more formally in Figure 6, by induction on the syntax.

$$\begin{array}{@{}l@{\;}c@{\;}l@{}} \mathsf{bar\text{-}elim}(0) &=& 0\\ \mathsf{bar\text{-}elim}(Q \mid R) &=& \mathsf{bar\text{-}elim}(Q) \mid \mathsf{bar\text{-}elim}(R)\\ \mathsf{bar\text{-}elim}(!Q) &=&!\mathsf{bar\text{-}elim}(Q) \\ \mathsf{bar\text{-}elim}(\nu\,n.Q) &=& \nu\,n.\mathsf{bar\text{-}elim}(Q)\\ \mathsf{bar\text{-}elim}(M(x).Q) &=& M(x).\mathsf{bar\text{-}elim}(Q)\\ \mathsf{bar\text{-}elim}(\overline{M}\langle N\rangle.Q) &=& \overline{M}\langle N\rangle.\mathsf{bar\text{-}elim}(Q)\\ \mathsf{bar\text{-}elim}(\textnormal{let } x=D \textnormal{ in } Q \textnormal{ else }R) &=& \textnormal{let } x=D \textnormal{ in } \mathsf{bar\text{-}elim}(Q) \textnormal{ else }\mathsf{bar\text{-}elim}(R)\\ \mathsf{bar\text{-}elim}(t[a,c,(\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}})]\textnormal{::}\,Q)&=& \overline{a}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1,\dots,M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle.c(z).\textnormal{let } z_1=\pi_{1,n}(z) \textnormal{ in } \cdots\\ && \textnormal{let } z_n=\pi_{n,n}(z) \textnormal{ in } \mathsf{bar\text{-}elim}(Q)\\ && \qquad \textrm{where $z$ is a fresh variable} \end{array}$$

Definition of bar-elim
**Example 7**. *Using the results of Example [ex:annotate], eliminating barriers from $\mathsf{annotate}(P_{\sf ex})$ yields $\mathsf{bar\text{-}elim}(\allowbreak\mathsf{annotate}(\allowbreak P_{\sf ex})) = P_{\sf comp}\mid P_{\sf comp}'$, where $$\begin{aligned} P_{\sf comp}={} &\overline{c}\langle A\rangle.\overline{a}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,\mathsf{diff}[v,v']}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle.b(z). \textnormal{let } x=\pi_{1,2}(z) \textnormal{ in } \textnormal{let } y=\pi_{2,2}(z) \textnormal{ in } \overline{x}\langle y\rangle\\ P_{\sf comp}' ={} &\overline{c}\langle B\rangle.\overline{a'}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,\mathsf{diff}[v',v]}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle.b'(z'). \textnormal{let } x'=\pi_{1,2}(z') \textnormal{ in } \textnormal{let } y'=\pi_{2,2}(z') \textnormal{ in }\overline{x'}\langle y'\rangle \end{aligned}$$ for some fresh variables $z$ and $z'$.*
### Swapping Next, we define swapping strategies.
**Definition 7**. *The function $\mathsf{swapper}$ is defined over multisets $B$ as follows: if $B=\emptyset$, then $\mathsf{swapper}(B) = \{ 0 \}$; otherwise, $$\begin{aligned} & \mathsf{swapper}(B) =\\ &\ \big\{\ a_1(x_1)\mathrel. \cdots \mathrel. a_n(x_n). \overline{c_1}\langle\mathsf{diff}[x_1,x_{f(1)}]\rangle\mathrel. \cdots \mathrel. \overline{c_n}\langle\mathsf{diff}[x_n,x_{f(n)}]\rangle.R \mathrel\big|\\ &\phantom{\ \big\{\ } B = \{t[a_1,c_1,\tilde{z}_1]\textnormal{::}\, Q_1,\dots,t[a_n,c_n,\tilde{z}_n]\textnormal{::}\, Q_n\} \cup B'\text{ where $t'>t$ for all $t'[a,c,\tilde{z}]\textnormal{::}\,Q\in B'$;}\\ &\phantom{\ \big\{\ }\text{function $f$ is a permutation on $\{1,\dots,n\}$ such that $Q_l/\tilde{z}_l =_{\mathsf{ch}}Q_{f(l)}/\tilde{z}_{f(l)}$ for all $1 \leq l \leq n$;} \\ &\phantom{\ \big\{\ }\text{$R \in \mathsf{swapper}(B')$; and $x_1, \dots, x_n$ are fresh variables}\big\} \end{aligned}$$ where $=_{\mathsf{ch}}$ is defined as follows:* - *$Q =_{\mathsf{ch}}Q'$ means that $Q$ equals $Q'$ modulo renaming of channels of annotated barriers and* - *$Q/\tilde{z} =_{\mathsf{ch}}Q'/\tilde{z}'$ means that $\tilde{z} = (z_1, \dots, z_k)$ and $\tilde{z}' = (z'_1, \dots, z'_k)$ for some integer $k$, and $Q\{\textnormal{\raisebox{2pt}{\footnotesize $y_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}},\dots,\textnormal{\raisebox{2pt}{\footnotesize $y_k$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_k$}}\} =_{\mathsf{ch}}Q'\{\textnormal{\raisebox{2pt}{\footnotesize $y_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z'_1$}},\dots,\textnormal{\raisebox{2pt}{\footnotesize $y_k$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z'_k$}}\}$ for some fresh variables $y_1, \dots, y_k$.*
The function $\mathsf{swapper}$ builds a set of processes from a multiset of domain-barriers $B$ as follows. We identify integer $t\in\mathbb N$ and domain-barriers $t[a_1,c_1,\tilde{z}_1]\textnormal{::}\,Q_1,\allowbreak\dots,\allowbreak t[a_n,c_n,\tilde{z}_n]\textnormal{::}\,Q_n$ in $B$ such that no other barriers with $t'\leq t$ appear in $B$, so that these barriers are reduced before other barriers in $B$. Among these barriers, we consider barriers $t[a_i,c_i,\tilde{z}_i]\textnormal{::}\,Q_i$ and $t[a_j,c_j,\tilde{z}_j]\textnormal{::}\,Q_j$ such that $Q_i/\tilde{z}_i =_{\mathsf{ch}}Q_j/\tilde{z}_j$, that is, the processes $Q_i$ and $Q_j$ are equal modulo renaming of channels of annotated barriers, after renaming the variables in $\tilde{z}_i$ and $\tilde{z}_j$ to the same variables, and we allow swapping data between such barriers using the permutation $f$. We then construct a set of processes which enable swapping, by receiving data to be swapped on channels $a_1$, …, $a_n$, and sending it back on channels $c_1$, …, $c_n$, in the same order in the first component of $\mathsf{diff}$ and permuted by $f$ in the second component of $\mathsf{diff}$. The function $\mathsf{swapper}$ does not specify an ordering on the pairs of channels $(a_1,c_1),\allowbreak\dots,\allowbreak(a_n,c_n)$, since any ordering is correct.
**Example 8**. *We have $\mathsf{barriers}(\mathsf{annotate}(P_{\sf ex})) = \{ 1[a,b,(x,y)]\textnormal{::}\,\overline{x}\langle y\rangle, 1[a',b',(x',y')]\textnormal{::}\,\overline{x'}\langle y'\rangle \}$. Moreover, we trivially have $\overline{x}\langle y\rangle/(x,y) =_{\mathsf{ch}}\overline{x}\langle y\rangle/(x,y)$ and $\overline{x'}\langle y'\rangle/(x',y') =_{\mathsf{ch}}\overline{x'}\langle y'\rangle/(x',y')$, because $Q/\tilde z =_{\mathsf{ch}}Q/\tilde z$ for all $Q$ and $\tilde z$. We also have $\overline{x}\langle y\rangle/(x,y) =_{\mathsf{ch}}\overline{x'}\langle y'\rangle/(x',y')$, because $$\overline{x}\langle y\rangle\{\textnormal{\raisebox{2pt}{\footnotesize $x''$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}},\textnormal{\raisebox{2pt}{\footnotesize $y''$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $y$}}\} = \overline{x''}\langle y''\rangle = \overline{x'}\langle y'\rangle\{\textnormal{\raisebox{2pt}{\footnotesize $x''$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x'$}},\textnormal{\raisebox{2pt}{\footnotesize $y''$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $y'$}}\}$$ It follows that $\mathsf{swapper}(\mathsf{barriers}(\mathsf{annotate}(P_{\sf ex}))) = \{ P_{\sf same}, \allowbreak P_{\sf swap}\}$, where $$\begin{aligned} &P_{\sf same}=a(z). a'(z').\overline{b}\langle\mathsf{diff}[z,z]\rangle. \overline{b'}\langle\mathsf{diff}[z',z']\rangle\\ &P_{\sf swap}=a(z). a'(z').\overline{b}\langle\mathsf{diff}[z,z']\rangle. \overline{b'}\langle\mathsf{diff}[z',z]\rangle \end{aligned}$$ for some fresh variables $z$ and $z'$. (Note that $\mathsf{diff}[z,z]$ could be simplified into $z$. Similarly, $\mathsf{diff}[z',z']$ could be simplified into $z'$.) This set considers the two possible swapping strategies: the strategy that does not swap any data and the strategy that swaps data between the two processes at the barrier.*
### Combining barrier elimination and swapping Finally, we derive a set of processes by parallel composition of the process output by $\mathsf{bar\text{-}elim}$ and the processes output by $\mathsf{swapper}$, under the scope of name restrictions on the fresh channels introduced by $\mathsf{annotate}$. $$\mathsf{elim\text{-}and\text{-}swap}(P) = \left\{\begin{array}{@{}l@{}} \nu\,\tilde{a}.(\mathsf{bar\text{-}elim}(P) \mid R) \text{ where } B = \mathsf{barriers}(P), \\ \{\tilde{a}\} = \mathsf{channels}(B), \textrm{ and } R \in \mathsf{swapper}(B) \end{array}\right\}$$ Intuitively, function $\mathsf{elim\text{-}and\text{-}swap}$ encodes barrier synchronisation and swapping using private channel communication, thereby preserving the observational behaviour of processes.
**Example 9**. *Using the results of Examples 7 & 8, applying $\mathsf{elim\text{-}and\text{-}swap}$ to the process $\mathsf{annotate}(P_{\sf ex})$ generates two processes $$\begin{aligned} P_1 =\nu\,a,a',b,b'.(P_{\sf comp}\mid P_{\sf comp}' \mid P_{\sf same})\\ P_2 =\nu\,a,a',b,b'.(P_{\sf comp}\mid P_{\sf comp}' \mid P_{\sf swap}) \end{aligned}$$ In the process $P_1$, no data is swapped, so it behaves exactly like $P_{\sf ex}$: $\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,\mathsf{diff}[v,v']}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$ is sent on $a$, sent back on $b$ by $P_{\sf same}$ as $\mathsf{diff}[\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,\mathsf{diff}[v,v']}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$},\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,\mathsf{diff}[v,v']}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}]$ which simplifies into $\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,\mathsf{diff}[v,v']}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$, and after evaluating the projections, $P_{\sf comp}$ reduces into $\overline{c}\langle\mathsf{diff}[v,v']\rangle$, which is the output present in the process $P_{\sf ex}$. Similarly, $P_{\sf comp}'$ reduces into $\overline{c}\langle\mathsf{diff}[v',v]\rangle$, present in $P_{\sf ex}$.* *By contrast, in process $P_2$, data is swapped: $\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,\mathsf{diff}[v,v']}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$ is sent on $a$ and $\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,\mathsf{diff}[v',v]}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$ is sent on $a'$, and $P_{\sf swap}$ sends back $\mathsf{diff}[\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,\mathsf{diff}[v,v']}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$},\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,\mathsf{diff}[v',v]}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}]$ on $b$. The first component of this term is $\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,v}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$ (obtained by taking the first component of each $\mathsf{diff}$), and similarly its second component is also $\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,v}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$, so this term simplifies into $\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{c,v}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$. After evaluating the projections, $P_{\sf comp}$ reduces into $\overline{c}\langle v\rangle$. Similarly, $P_{\sf comp}'$ reduces into $\overline{c}\langle v'\rangle$. Hence $P_2$ behaves like $\overline{c}\langle A\rangle.1\textnormal{::}\,\overline{c}\langle v\rangle\mid\overline{c}\langle B\rangle.1\textnormal{::}\,\overline{c}\langle v'\rangle$. In particular, $P_2$ outputs $A$ and $B$ before barrier synchronisation and $v$ and $v'$ after synchronisation just like $P_{\sf ex}$. But $P_2$ satisfies diff-equivalence while $P_{\sf ex}$ does not.*
The next proposition formalises the preservation of observable behaviour.
**Proposition 6**. *Let $P$ be a valid, annotated biprocess. If $P' \in \mathsf{elim\text{-}and\text{-}swap}(P)$, then $\mathsf{fst}(P) \approx \mathsf{fst}(P')$ and $\mathsf{snd}(P) \approx \mathsf{snd}(P')$.*
The core argument for the proof of Proposition 6 is the following:
**Proposition 7**. *Suppose $P_0$ is a valid, annotated biprocess. Let $\mathcal{C}_0 = B,E,\{P_0\}$ and $\mathcal{C}'_0 = \emptyset, E,\{\mathsf{bar\text{-}elim}(P_0), R\}$, where $B = \mathsf{barriers}(P_0)$, $E = \mathsf{channels}(B)$, and $R\in\mathsf{swapper}(B)$. We have $\mathsf{fst}(\mathcal{C}_0) \approx\mathsf{fst}(\mathcal{C}'_0)$ and $\mathsf{snd}(\mathcal{C}_0) \approx\mathsf{snd}(\mathcal{C}'_0)$.*
In this proposition, the configuration $\mathcal{C}_0$ is the initial configuration of the process $P_0$ and the configuration $\mathcal{C}'_0$ is obtained by reducing the restrictions and the parallel composition at the root of a compiled process in $\mathsf{elim\text{-}and\text{-}swap}(P_0)$. The proposition shows that the first components of these two configurations are observationally equivalent, and so are the second components. The proposition is proved by defining a relation $\mathrel{\mathcal{R}}$ that satisfies the conditions of Definition 1. The proof is fairly long and delicate. It relies on Lemmas 8 and 9, and is detailed in Appendix 11. Lemma 8 proves that $\mathsf{bar\text{-}elim}$ preserves renaming of names and substitution of terms for variables. (Our operational semantics uses renaming of names and substitution of terms for variables. Implicitly, this includes renaming of variables.)
**Lemma 8**. * Given an annotated process $P$ and a substitution or renaming $\sigma$, we have $\mathsf{bar\text{-}elim}(P)\sigma = \mathsf{bar\text{-}elim}(P\sigma)$.*
This lemma is proved by induction on process $P$, in Appendix 9. The second lemma builds upon Lemma 8 to show that function $\mathsf{bar\text{-}elim}$ preserves reduction, in cases in which barriers are not reduced.
**Lemma 9**. *Suppose $B$ is a finite set of annotated barriers, $E$ is a finite set of names and ${\mathcal P},{\mathcal Q},{\mathcal Q}'$ are finite multisets of processes such that $\mathsf{barriers}({\mathcal Q}') = \emptyset$. Further suppose that $\mathcal{C}= B, E, {\mathcal Q}\cup {\mathcal P}$ is a valid configuration. Let $\mathcal{C}' = \emptyset, E,{\mathcal Q}' \cup\mathsf{bar\text{-}elim}({\mathcal P})$. We have the following properties:* 1. * If $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ by reducing one or more processes in ${\mathcal P}$ such that $\mathcal{C}_1 = B, E_1, {\mathcal Q}\cup {\mathcal P}_1$ for some set of names $E_1$ and multiset of processes ${\mathcal P}_1$, then $\mathcal{C}' \xrightarrow{}\mathcal{C}'_1$, where $\mathcal{C}'_1 = \emptyset, E_1,{\mathcal Q}' \cup\mathsf{bar\text{-}elim}({\mathcal P}_1)$.* 2. * If $\mathcal{C}' \xrightarrow{}\mathcal{C}'_1$ by reducing one or more processes in $\mathsf{bar\text{-}elim}({\mathcal P})$ such that $\mathcal{C}'_1 = \emptyset, E_1,{\mathcal Q}' \cup {\mathcal P}'_1$ for some set of names $E_1$ and multiset of processes ${\mathcal P}'_1$, then there exists a multiset of processes ${\mathcal P}_1$ such that ${\mathcal P}'_1 = \mathsf{bar\text{-}elim}({\mathcal P}_1)$ and $\mathcal{C}\xrightarrow{}\mathcal{C}_1$, where $\mathcal{C}_1 = B, E_1, {\mathcal Q}\cup {\mathcal P}_1$.*
This lemma is proved by cases on the considered reduction, in Appendix 10. We use two additional propositions in order to prove Proposition 6.
**Proposition 10**. *Let $B, E, \{\nu\,n.P\}\cup{\mathcal P}$ be a valid configuration, and $n'$ be a name, where $n'\not\in E \cup \mathsf{fn}(\{\nu\,n.P\}\cup{\mathcal P})$. We have $B, E, \{\nu\,n.P\}\cup{\mathcal P}\approx B, E\cup\{n'\}, \{P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\}\cup{\mathcal P}$.*
**Proposition 11**. *Let $B, E, \{P \mid Q\} \cup {\mathcal P}$ be a valid configuration. We have $B, E, \{P \mid Q\} \cup {\mathcal P}\approx B, E, \{P, Q\} \cup {\mathcal P}$.*
These propositions follow immediately from the semantics and definition of observational equivalence. They are proved in Appendix 12, by defining a relation $\mathrel{\mathcal{R}}$ that satisfies the conditions of Definition 1. The proof of Proposition 6 follows from these results.
*Proof of Proposition 6.* Let $B_0 = \mathsf{barriers}(P)$, and $\{\tilde{a}\} = \mathsf{channels}(B_0)$. By definition of $\mathsf{compiler}$, there exists a biprocess $R \in \mathsf{swapper}(B_0)$ such that $P' = \nu\,\tilde{a}.(\mathsf{bar\text{-}elim}(P) \mid R)$. It follows that $\mathsf{barriers}(P') = \emptyset$, so we have $$\begin{aligned} \mathcal{C}_{\textnormal{init}}(\mathsf{fst}(P')) &= \emptyset, \emptyset, \{\mathsf{fst}(P')\} \\ &\approx\emptyset,\{\tilde a\},\{\mathsf{fst}(\mathsf{bar\text{-}elim}(P) \mid R)\} \tag*{by Proposition~\ref{prop:1}}\\ &\approx\emptyset,\{\tilde a\},\{\mathsf{fst}(\mathsf{bar\text{-}elim}(P)), \mathsf{fst}(R)\} \tag*{by Proposition~\ref{prop:3}}\\ &\approx\mathsf{fst}(B_0),\{\tilde a\},\{\mathsf{fst}(P)\} = \mathcal{C}_{\textnormal{init}}(\mathsf{fst}(P)) \tag*{by Proposition~\ref{prop:soundnessSwapping}} \end{aligned}$$ so $\mathsf{fst}(P') \approx \mathsf{fst}(P)$. The proof of $\mathsf{snd}(P) \approx \mathsf{snd}(P')$ is similar. ◻
## Our compiler We combine the annotation (Section 3.2) and barrier removal (Section 3.3) steps to define our compiler as $$\mathsf{compiler}(P) = \mathsf{elim\text{-}and\text{-}swap}(\mathsf{annotate}(P))$$ We have implemented the compiler in ProVerif, available from: . By combining Propositions 5 and 6, we immediately obtain:
**Corollary 12**. *Let $P$ be a closed standard biprocess. If $P' \in \mathsf{compiler}(P)$, then $\mathsf{fst}(P) \approx \mathsf{fst}(P')$ and $\mathsf{snd}(P) \approx \mathsf{snd}(P')$.*
This corollary shows that compilation preserves the observational behaviour of processes. The following theorem is an immediate consequence of this corollary:
**Theorem 13**. *Let $P$ be a closed biprocess. If a biprocess in $\mathsf{compiler}(P)$ satisfies observational equivalence, then $P$ satisfies observational equivalence.*
*Proof.* Suppose that there exists a biprocess $P'\in\mathsf{compiler}(P)$ such that $P'$ satisfies observational equivalence, that is, $\mathsf{fst}(P')\approx\mathsf{snd}(P')$. By Corollary 12, $\mathsf{fst}(P) \approx \mathsf{fst}(P')$ and $\mathsf{snd}(P) \approx \mathsf{snd}(P')$, so by transitivity of $\approx$, we have $\mathsf{fst}(P) \approx \mathsf{snd}(P)$, so $P$ satisfies observational equivalence. ◻
This theorem allows us to prove observational equivalence using swapping: we prove that a biprocess in $\mathsf{compiler}(P)$ satisfies observational equivalence using ProVerif (by Theorem 1), and conclude that $P$ satisfies observational equivalence as well. For instance, ProVerif can show that the process $P_2 \in \mathsf{compiler}(P_{\sf ex})$ of Example 9 satisfies observational equivalence, thus $P_{\sf ex}$ satisfies observational equivalence too. The idea of swapping data at synchronisation points also applies to other tools that prove diff-equivalence (e.g., Maude-NPA (Santiago et al. 2014) and Tamarin (Basin, Dreier, and Casse 2015)). However, a compiler such as ours is not necessarily needed to implement this idea in these tools. For instance, in Tamarin, the swapping can be done directly on the multiset representing the state at the synchronisation point (Dreier et al. 2017). The idea of swapping could also be applied to other methods of proving equivalence. However, it may be less useful in these cases, since it might not permit the proof of more equivalences in such cases. ## Extensions ### Replicated barriers While our calculus does not allow barriers under replication, we can still prove equivalence with barriers under bounded replication, for any bound. We define bounded replication by $!^n P =P \mid \dots \mid P$ with $n$ copies of the process $P$. We have the following results:
**Proposition 14**. *Let $C[!Q]$ be a closed standard biprocess, such that the context $C[\_]$ does not contain any barrier above the hole. If a biprocess in $\mathsf{compiler}(C[!Q])$ satisfies diff-equivalence, then for all $n$, a biprocess in $\mathsf{compiler}(C[!^n Q])$ satisfies diff-equivalence.*
Proposition 14 shows that, if our approach proves equivalence with unbounded replication, then it also proves equivalence with bounded replication. This proposition and the next one are proved in Appendix 13.
**Proposition 15**. *Let $C[Q]$ be a closed standard biprocess, such that the context $C[\_]$ does not contain any replication above the hole. If a biprocess in $\mathsf{compiler}(C[Q])$ satisfies diff-equivalence, then a biprocess in $\mathsf{compiler}(C[t\textnormal{::}\,Q])$ satisfies diff-equivalence.*
Proposition 15 shows that, if our approach proves equivalence after removing a barrier, then it also proves equivalence with the barrier. By combining these two results, we obtain:
**Corollary 16**. *Let $Q_{\textnormal{nobar}}$ be obtained from $Q$ by removing all barriers. Let $C[\_]$ be a context that does not contain any replication or barrier above the hole. If a biprocess in $\mathsf{compiler}(C[!Q_{\textnormal{nobar}}])$ satisfies diff-equivalence, then for all $n$, process $C[!^n Q]$ satisfies observational equivalence.*
*Proof.* If a biprocess in $\mathsf{compiler}(C[! Q_{\textnormal{nobar}}])$ satisfies diff-equivalence, then by Proposition 14, a biprocess in $\mathsf{compiler}(C[!^n Q_{\textnormal{nobar}}])$ satisfies diff-equivalence. By applying Proposition 15 several times, a biprocess in $\mathsf{compiler}(C[!^n Q])$ satisfies diff-equivalence. Hence, by Theorem 1, a biprocess in $\mathsf{compiler}(C[!^n Q])$ satisfies observational equivalence, and by Theorem 13, $C[!^n Q]$ satisfies observational equivalence. ◻
Corollary 16 shows that we can apply our compiler to prove observational equivalence for biprocesses with bounded replication, for any value of the bound. In the context of election schemes, this result allows us to prove privacy for an unbounded number of voters. For instance, in the protocol by Lee *et al.* (Section 4.2), we consider a process $C[!^{n+2} Q]$ with $n+2$ voters each using a process $Q$, in which two voters $A$ and $B$ swap their votes. We isolate the processes for the voters $A$ and $B$, writing the process $C[Q_A \mid Q_B \mid {!}^n Q]$. We keep the barriers in $Q_A$ and $Q_B$ (they are typically useful), but remove them in the other processes $!^n Q$ in order to apply Corollary 16: we show that a biprocess in $\mathsf{compiler}(C[Q_A \mid Q_B \mid {!}Q_{\textnormal{nobar}}])$ satisfies diff-equivalence, and conclude that for all $n$, process $C[Q_A \mid Q_B \mid {!}^n Q]$ satisfies observational equivalence. ### Trace properties ProVerif also supports the proof of trace properties (reachability and correspondence properties of the form “if some event has been executed, then some other events must have been executed”, which serve for formalising authentication) (Blanchet 2009). Our implementation extends this support to processes with barriers, by compiling them to processes without barriers, and applying ProVerif to the compiled processes. In this case, swapping does not help, so our compiler does not swap. We do not detail the proof of trace properties with barriers further, since it is easier and less important than observational equivalence. ### Swapping without explicit synchronisation Our compiler enables swapping at synchronisation points. Swapping can also be performed immediately under parallel compositions. For instance, in a biprocess $C[P_1 \mid\dots\mid P_n]$, data could be swapped between processes $P_1,\dots,P_n$ that have the same skeleton, even without explicit synchronisation. We do not perform this swapping in our compiler for several reasons. First, this case is easy to deal with manually: by rewriting $P_1 \mid\dots\mid P_n$ as $Q_1 \mid\dots\mid Q_n$, where $\mathsf{fst}(Q_1 \mid\dots\mid Q_n) = \mathsf{fst}(P_1 \mid\dots\mid P_n)$ and $\mathsf{snd}(Q_1 \mid\dots\mid Q_n)$ is obtained by permuting the parallel processes in $\mathsf{snd}(P_1 \mid\dots\mid P_n)$. Secondly, such a rewriting is performed by another extension of ProVerif (Cheval and Blanchet 2013, sec. 5), to merge processes into biprocesses in order to prove observational equivalence. Finally, this case would lead to useless swapping opportunities, which would slow down the exploration of all swapping possibilities. If swapping is desired in this case, it can be obtained in our approach by adding a synchronisation at the beginning of $P_1,\dots,P_n$. ### Future work Our results could be extended to systems in which several groups of participants synchronise locally inside each group, but do not synchronise with other groups. For instance, we could consider a voting system in which voters synchronise at a regional level. In the same direction, we could consider a vehicular network in which vehicles synchronise at the crossroad level (see also Section 4.3). In this case, we would need several swapping processes similar to those generated by $\mathsf{swapper}$, one for each group. We could also extend our approach to swap data between processes that have the same skeleton only until the next synchronisation. In this case, the swapping must be reversed at the next synchronisation, to recover the initial data. For instance, that would allow us to prove that the biprocess $1\textnormal{::}\, \overline{c}\langle\mathsf{diff}[m,n]\rangle.2\textnormal{::}\,0\mid 1\textnormal{::}\,\overline{c}\langle\mathsf{diff}[n,m]\rangle.2\textnormal{::}\,\overline{c}\langle n\rangle$ satisfies observational equivalence. (The synchronisation at barrier 1 could be removed as explained in Section 3.5.3.) It would also be useful to study heuristics in order to find a successful swapping strategy without trying all of them. Finally, it would be interesting to study the impact of our compiler on the termination and on the precision of ProVerif, especially with the usage of private channels to encode synchronisation and swapping. # Privacy in elections Elections enable voters to choose representatives. Choices should be made freely, and this has led to the emergence of ballot secrecy as a *de facto* standard privacy requirement of elections. Stronger formulations of privacy, such as receipt-freeness, are also possible. - Ballot secrecy: a voter’s vote is not revealed to anyone. - Receipt-freeness: a voter cannot prove how she voted. We demonstrate the suitability of our approach for analysing privacy requirements of election schemes by Fujioka, Okamoto & Ohta (commonly referred to as FOO), by Lee *et al.*, along with some of its variants, and by Juels, Catalano & Jakobsson (commonly referred to as JCJ). Our ProVerif scripts are included in ProVerif’s documentation package (). The runtime of these scripts (including compilation of barriers and proof of diff-equivalence by ProVerif) ranges from 0.24 seconds for FOO to 372 seconds to prove coercion-resistance in JCJ, on an Intel Xeon 3.6 GHz under Linux. ## Case study: FOO ### Cryptographic primitives FOO uses commitments and blind signatures. We model commitment with a binary constructor $\mathsf{commit}$, and the corresponding destructor $\mathsf{open}$ for opening the commitment, with the following rewrite rule: $$\begin{array}{@{}r@{}c@{}l@{}} \mathsf{open}(x_{\mathsf{k}},\mathsf{commit}(x_{\mathsf{k}},x_{\mathsf{plain }})) &{}\rightarrow{}& x_{\mathsf{plain }} \end{array}$$ Using constructors $\mathsf{sign}$, $\mathsf{blind}$, and $\mathsf{pk}$, we model blind signatures as follows: $\mathsf{sign}(x_{\mathsf{sk }}, x_{\mathsf{msg }})$ is the signature of message $x_{\mathsf{msg }}$ under secret key $x_{\mathsf{sk }}$, $\mathsf{blind}(x_{\mathsf{k}}, x_{\mathsf{msg }})$ is the blinding of message $x_{\mathsf{msg }}$ with coins $x_{\mathsf{k}}$, and $\mathsf{pk}(x_{\mathsf{sk }})$ is the public key corresponding to the secret key $x_{\mathsf{sk }}$. We also use three destructors: $\mathsf{checksign}$ to verify signatures, $\mathsf{getmsg}$ to model that an adversary may recover the message from the signature, even without the public key, and $\mathsf{unblind}$ for unblinding, defined by the following rewrite rules: $$\begin{array}{@{}r@{}c@{}l@{}} \mathsf{checksign}(\mathsf{pk}(x_{\mathsf{sk }}),\mathsf{sign}(x_{\mathsf{sk }},x_{\mathsf{msg }})) &{}\rightarrow{}& x_{\mathsf{msg }}\\ \mathsf{getmsg}(\mathsf{sign}(x_{\mathsf{sk }},x_{\mathsf{msg }})) &\rightarrow& x_{\mathsf{msg }}\\ \mathsf{unblind}(x_{\mathsf{k}},\mathsf{sign}(x_{\mathsf{sk }},\mathsf{blind}(x_{\mathsf{k}},x_{\mathsf{msg }}))) &\rightarrow& \mathsf{sign}(x_{\mathsf{sk }},x_{\mathsf{msg }}) \\ \mathsf{unblind}(x_{\mathsf{k}},\mathsf{blind}(x_{\mathsf{k}},x_{\mathsf{plain }})) &\rightarrow& x_{\mathsf{plain }} \end{array}$$ With blind signatures, a signer may sign a blinded message without learning the plaintext message, and the signature on the plaintext message can be recovered by unblinding, as shown by the third rewrite rule. ### Protocol description The protocol uses two authorities, a *registrar* and a *tallier*, and it is divided into four phases, *setup*, *preparation*, *commitment*, and *tallying*. The setup phase proceeds as follows. 1. The registrar creates a signing key pair $sk_R$ and $\mathsf{pk}(sk_R)$, and publishes the public part $\mathsf{pk}(sk_R)$. In addition, each voter is assumed to have a signing key pair $sk_V$ and $\mathsf{pk}(sk_V)$, where the public part $\mathsf{pk}(sk_V)$ has been published. The preparation phase then proceeds as follows. 2. The voter chooses coins $k$ and $k'$, computes the commitment to her vote $M = \mathsf{commit}(k,v)$ and the signed blinded commitment $\mathsf{sign}(sk_V,\mathsf{blind}(k',M))$, and sends the signature, paired with her public key, to the registrar. 3. The registrar checks that the signature belongs to an eligible voter and returns the blinded commitment signed by the registrar $\mathsf{sign}(sk_R,\mathsf{blind}(k',M))$. 4. The voter verifies the registrar’s signature and unblinds the message to recover $\hat M = \mathsf{sign}(sk_R,M)$, that is, her commitment signed by the registrar. After a deadline, the protocol enters the commitment phase. 5. The voter posts her ballot $\hat M$ to the bulletin board. Similarly, the tallying phase begins after a deadline. 6. The tallier checks validity of all signatures on the bulletin board and prepends an identifier $\ell$ to each valid entry. 7. The voter checks the bulletin board for her entry, the pair $\ell, \hat M$, and appends the commitment factor $k$. 8. Finally, using $k$, the tallier opens all of the ballots and announces the election outcome. The distinction between phases is essential to uphold the protocol’s security properties. In particular, voters must synchronise before the commitment phase to ensure ballot secrecy (observe that without synchronisation, traffic analysis may allow the voter’s signature to be linked with the commitment to her vote – this is trivially possible when a voter completes the commitment phase before any other voter starts the preparation phase, for instance – which can then be linked to her vote) and before the tallying phase to avoid publishing partial results, that is, to ensure *fairness* (see Cortier & Smyth (Cortier and Smyth 2013) for further discussion on fairness). ### Model To analyse ballot secrecy, it suffices to model the participants that must be honest (i.e., must follow the protocol description) for ballot secrecy to be satisfied. All the remaining participants are controlled by the adversary. The FOO protocol assures ballot secrecy in the presence of dishonest authorities if the voter is honest. Hence, it suffices to model the voter’s part of FOO as a process.
**Definition 8**. *The process $P_{\sf foo}(x_{\mathsf{sk }}, x_{\mathsf{vote} })$ modelling a voter in FOO, with signing key $x_{\mathsf{sk }}$ and vote $x_{\mathsf{vote} }$, is defined as follows $$\begin{array}{@{}l@{}l@{}l} P_{\sf foo}(x_{\mathsf{sk }}, x_{\mathsf{vote} }) ={}& \nu\,k.\nu\,k'.&\textrm{\% Step 2}\\ & \textnormal{let } M=\mathsf{commit}(k,x_{\mathsf{vote} }) \textnormal{ in } \\ & \textnormal{let } {M'}=\mathsf{blind}(k',M) \textnormal{ in } \\ & \overline{c}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{\mathsf{pk}(x_{\mathsf{sk }}),\mathsf{sign}(x_{\mathsf{sk }},{M'})}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle. \\ % & c(y). &\textrm{\% Step 4}\\ & \textnormal{let } y'=\mathsf{checksign}(\mathsf{pk}(sk_R),y) \textnormal{ in } \\ & \textnormal{if } y'=M' \textnormal{ then } \\ & \textnormal{let } \hat M=\mathsf{unblind}(k',y) \textnormal{ in } \\ & 1\textnormal{::}\, \overline{c}\langle\hat M\rangle . &\textrm{\% Step 5}\\ % & 2\textnormal{::}\, c(z) . &\textrm{\% Step 7}\\ & \textnormal{let } z_2=\pi_{2,2}(z) \textnormal{ in } \\ & \textnormal{if } z_2=\hat M \textnormal{ then } \\ & \overline{c}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{z,k}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle \\ \end{array}$$*
The process $P_{\sf foo}(sk_1, v_1) \mid\dots\mid P_{\sf foo}(sk_n, v_n)$ models an election with $n$ voters casting votes $v_1,\dots,v_n$ and encodes the separation of phases using barriers. ### Analysis: ballot secrecy Based upon (Kremer and Ryan 2005; Delaune, Kremer, and Ryan 2009) and as outlined in Section 1, we formalise ballot secrecy for two voters $A$ and $B$ with the assertion that an adversary cannot distinguish between a situation in which voter $A$ votes for candidate $v$ and voter $B$ votes for candidate $v'$, from another one in which $A$ votes $v'$ and $B$ votes $v$. We use the biprocess $P_{\sf foo}(sk_A, \mathsf{diff}[v,v'])$ to model $A$ and the biprocess $P_{\sf foo}(sk_B, \mathsf{diff}[v',v])$ to model $B$, and formally express ballot secrecy as an equivalence which can be checked using Theorem 13. Voters’ keys are modelled as free names, since ballot secrecy can be achieved without confidentiality of these keys. (Voters’ keys *must* be secret for other properties.)
**Definition 9** (Ballot secrecy). *FOO preserves *ballot secrecy* if the biprocess $Q_{\sf foo} =P_{\sf foo}(sk_A, \mathsf{diff}[v,v']) \mid P_{\sf foo}(sk_B, \mathsf{diff}[v',v])$ satisfies observational equivalence.*
To provide further insight into how our compiler works, let us consider how to informally prove this equivalence: that $\mathsf{fst}(Q_{\sf foo})$ is indistinguishable from $\mathsf{snd}(Q_{\sf foo})$. Before the first barrier, $A$ outputs $$\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{\mathsf{pk}(sk_A),\;\mathsf{sign}(sk_A,\mathsf{blind}(k'_a,\mathsf{commit}(k_a,v)))}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$$ in $\mathsf{fst}(Q_{\sf foo})$ and $$\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{\mathsf{pk}(sk_A),\;\mathsf{sign}(sk_A,\mathsf{blind}(k'_a,\mathsf{commit}(k_a,v')))}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$$ in $\mathsf{snd}(Q_{\sf foo})$, where the name $k'_a$ remains secret. By the equational theory for blinding, $N$ can only be recovered from $\mathsf{blind}(M,N)$ if $M$ is known, so these two messages are indistinguishable. The situation is similar for $B$. Therefore, before the first barrier, $A$ moves in $\mathsf{fst}(Q_{\sf foo})$ are mimicked by $A$ moves in $\mathsf{snd}(Q_{\sf foo})$ and $B$ moves in $\mathsf{fst}(Q_{\sf foo})$ are mimicked by $B$ moves in $\mathsf{snd}(Q_{\sf foo})$. Let us define $\mathsf{sc}({k},{v}) =\mathsf{sign}(sk_R,\mathsf{commit}(k,v))$. After the first barrier, $A$ outputs $$\begin{aligned} &\mathsf{sc}({k_a},{v}) \textrm{ and } \mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{\ell_1,\;\mathsf{sc}({k_a},{v})}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$},\;k_a}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$} \text{ in $\mathsf{fst}(Q_{\sf foo})$}\\ &\mathsf{sc}({k_a},{v'}) \textrm{ and } \mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{\ell_1,\;\mathsf{sc}({k_a},{v'})}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$},\;k_a}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$} \text{ in $\mathsf{snd}(Q_{\sf foo})$} \end{aligned}$$ where $\ell_1$ is chosen by the adversary. It follows that $A$ reveals her vote $v$ in $\mathsf{fst}(Q_{\sf foo})$ and her vote $v'$ in $\mathsf{snd}(Q_{\sf foo})$, so these messages are distinguishable. However, $B$ outputs $$\begin{aligned} &\mathsf{sc}({k_b},{v'}) \textrm{ and } \mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{\ell_2,\;\mathsf{sc}({k_b},{v'})}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\;k_b}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$} \text{ in $\mathsf{fst}(Q_{\sf foo})$}\\ &\mathsf{sc}({k_b},{v}) \textrm{ and } \mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{\ell_2,\;\mathsf{sc}({k_b},{v})}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\;k_b}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$} \text{ in $\mathsf{snd}(Q_{\sf foo})$} \end{aligned}$$ where $\ell_2$ is similarly chosen by the adversary. Hence, $B$’s messages in $\mathsf{snd}(Q_{\sf foo})$ are indistinguishable from $A$’s messages in $\mathsf{fst}(Q_{\sf foo})$. Therefore, after the first barrier, $A$ moves in $\mathsf{fst}(Q_{\sf foo})$ are mimicked by $B$ moves in $\mathsf{snd}(Q_{\sf foo})$ and symmetrically, $B$ moves in $\mathsf{fst}(Q_{\sf foo})$ are mimicked by $A$ moves in $\mathsf{snd}(Q_{\sf foo})$, that is, the roles are swapped at the first barrier. Our compiler encodes the swapping, hence we can show that FOO satisfies ballot secrecy using Theorem 13. Moreover, ProVerif proves this result automatically. This proof is done for two honest voters, but it generalises immediately to any number of possibly dishonest voters, since other voters can be part of the adversary. Showing that FOO satisfies ballot secrecy is not new: Delaune, Kremer & Ryan (Kremer and Ryan 2005; Delaune, Kremer, and Ryan 2009) present a manual proof of ballot secrecy, Chothia *et al.* (Chothia et al. 2007) provide an automated analysis in the presence of a passive adversary, and Delaune, Ryan & Smyth (Delaune, Ryan, and Smyth 2008), Klus, Smyth & Ryan (Klus, Smyth, and Ryan 2010), and Chadha, Ciobâcă & Kremer (Chadha, Ciobâca, and Kremer 2012; Ciobâca 2011) provide automated analysis in the presence of an active adversary. More recently, Dreier *et al.* (Dreier et al. 2017) provided a mechanised analysis in the tool Tamarin in the presence of an active adversary. Nevertheless, our analysis is useful to demonstrate our approach. FOO does not satisfy receipt-freeness, because each voter knows the coins used to construct their ballot and these coins can be used as a witness to demonstrate how they voted. In an effort to achieve receipt-freeness, the protocol by Lee *et al.* (Lee et al. 2004) uses a hardware device to introduce coins into the ballot that the voter does not know. ## Case study: Lee *et al.* ### Protocol description The protocol uses a registrar and some talliers, and it is divided into three phases, *setup*, *voting*, and *tallying*. For simplicity, we assume there is a single tallier. The setup phase proceeds as follows. 1. The tallier generates a key pair and publishes the public key. 2. Each voter is assumed to have a signing key pair and an offline tamper-resistant hardware device. The registrar is assumed to know the public keys of voters and devices. The registrar publishes those public keys. The voting phase proceeds as follows. 3. The voter encrypts her vote and inputs the resulting ciphertext into her tamper-resistant hardware device. 4. The hardware device re-encrypts the voter’s ciphertext, signs the re-encryption, computes a Designated Verifier Proof that the re-encryption was performed correctly, and outputs these values to the voter. 5. If the signature and proof are valid, then the voter outputs the re-encryption and signature, along with her signature of these elements. The hardware device re-encrypts the voter’s encrypted choice to ensure that the voter’s coins cannot be used as a witness demonstrating how the voter voted. Moreover, the device is offline, thus communication between the voter and the device is assumed to be untappable, hence, the only meaningful relation between the ciphertexts input and output by the hardware device is due to the Designated Verifier Proof, which can only be verified by the voter. Finally, the tallying phase proceeds as follows. 6. Valid ballots (that is, ciphertexts associated with valid signatures) are input to a mixnet and the mixnet’s output is published. (We model the mixnet as a collection of parallel processes that each input a ballot, verify the signatures, synchronise with the other processes, and finally output the ciphertext on an anonymous channel.) 7. The tallier decrypts each ciphertext and announces the election outcome. ### Analysis: ballot secrecy In this protocol, the authorities and hardware devices must be honest for ballot secrecy to be satisfied, so we need to explicitly model them. Therefore, building upon ([eq:motiv]), we formalise ballot secrecy by the equivalence $$C[V(A, v) \mid V(B, v')] \approx C[V(A, v') \mid V(B, v)]\label{eq:ballotsecrecysystem}$$ where the process $V(A, v)$ models a voter with identity $A$ (including its private key, its device public key, and its private channel to the device) voting $v$, and the context $C$ models all other participants: authorities and hardware devices. (Other voters are included in $C$ for privacy results concerning more than two voters.) With two voters, we prove ballot secrecy by swapping data at the synchronisation in the mixnet. With an unbounded number of honest voters, we prove ballot secrecy using Corollary 16 to model an unbounded number of voters by a replicated process. As far as we know, this is the first proof of this result. In order to prove this result, we separate the processes (voter, device, mixnet and tallier) corresponding to voters $A$ and $B$, from those corresponding to the other voters, as outlined at the end of Section 3.5.1. We keep the synchronisations in the mixnet for $A$ and $B$ and swap data there, and we remove synchronisations in the processes for other voters in order to apply Corollary 16. With the addition of a dishonest voter, the proof of ballot secrecy fails. This failure does not come from a limitation of our approach, but from a ballot copying attack, already mentioned in the original paper (Lee et al. 2004, sec. 6) and formalised in (Dreier, Lafourcade, and Lakhnech 2011): the dishonest voter can copy $A$’s vote, as follows. The adversary observes $A$’s encrypted vote on the bulletin board (since it is accompanied by the voter’s signature), inputs the ciphertext to the adversary’s tamper-resistant hardware device, uses the output to derive a related ballot, and derives $A$’s vote from the election outcome, which contains two copies of $A$’s vote. ### Analysis: receipt-freeness Following (Delaune, Kremer, and Ryan 2009), receipt-freeness can be formalised as follows: there exists a process $V'$ such that $$\begin{aligned} V'^{\backslash \mathit{chc}} &\approx V(A, v)\label{eq:recfree1}\\ C[V(A, v')^{\mathit{chc}} \mid V(B, v)] &\approx C[V' \mid V(B, v')]\label{eq:recfree2} \end{aligned}$$ where the context $C[\_]$ appears in [eq:ballotsecrecysystem], $\mathit{chc}$ is a public channel, $V'^{\backslash \mathit{chc}} = \nu\,\mathit{chc}.(V \mid {!}\mathit{chc}(x))$, which is intuitively equivalent to removing all outputs on channel $\mathit{chc}$ from $V'$, and $V(A, v')^{\mathit{chc}}$ is obtained by modifying $V(A, v')$ as follows: we output on channel $\mathit{chc}$ the private key of $A$, its device public key, all restricted names created by $V$, and messages received by $V$. Intuitively, the voter $A$ tries to prove to the adversary how she voted, by giving the adversary all its secrets, as modelled by $V(A, v')^{\mathit{chc}}$. The process $V'$ simulates a voter $A$ that votes $v$, as shown by [eq:recfree1], but outputs messages on channel $\mathit{chc}$ that aim to make the adversary think that it voted $v'$. The equivalence [eq:recfree2] shows that the adversary cannot distinguish voter $A$ voting $v'$ and trying to prove it to the adversary and voter $B$ voting $v$, from $V'$ and voter $B$ voting $v'$, so $V'$ successfully votes $v$ and deceives the adversary in thinking that it voted $v'$. In the case of the Lee *et al*. protocol, $V'$ is derived from $V(A, v)^{\mathit{chc}}$ by outputting on $\mathit{chc}$ a fake Designated Verifier Proof that simulates a proof of re-encryption of a vote for $v'$, instead of the Designated Verifier Proof that it receives from the device. Intuitively, the adversary cannot distinguish a fake proof from a real one, because only the voter can verify the proof. The equivalence [eq:recfree1] holds by construction of $V'$, because after removing outputs on $\mathit{chc}$, $V'$ is exactly the same as $V(A, v)$. We prove [eq:recfree2] using our approach, for an unbounded number of honest voters. Hence, this protocol satisfies receipt-freeness for an unbounded number of honest voters. As far as we know, this is the first proof of this result. Obviously, receipt-freeness does not hold with dishonest voters, because it implies ballot secrecy. ### Variant by Dreier, Lafourcade & Lakhnech Dreier, Lafourcade & Lakhnech (Dreier, Lafourcade, and Lakhnech 2011) introduced a variant of this protocol in which, in step 3, the voter additionally signs the ciphertext containing her vote, and in step 4, the hardware device verifies this signature. We have also analysed this variant using our approach. It is sufficiently similar to the original protocol that we obtain the same results for both. ### Variant by Delaune, Kremer, & Ryan #### Protocol description Delaune, Kremer, & Ryan (Delaune, Kremer, and Ryan 2009) introduced a variant of this protocol in which the hardware devices are replaced with a single administrator, and the voting phase becomes: 3. The voter encrypts her vote, signs the ciphertext, and sends the ciphertext and signature to the administrator on a private channel. 4. The administrator verifies the signature, re-encrypts the voter’s ciphertext, signs the re-encryption, computes a Designated Verifier Proof of re-encryption, and outputs these values to the voter. 5. If the signature and proof are valid, then the voter outputs her ballot, consisting of the signed re-encryption (via an anonymous channel). The mixnet is replaced with the anonymous channel, and the tallying phase becomes: 6. The collector checks that the ballots are pairwise distinct, checks the administrator’s signature on each of the ballots, and, if valid, decrypts the ballots and announces the election outcome. #### Analysis: ballot secrecy We have shown that this variant preserves ballot secrecy, with two honest voters, using our approach. In this proof, all keys are public and the collector is not trusted, so it is included in the adversary. Since the keys are public, any number of dishonest voters can also be included in the adversary, so the proof with two honest voters suffices to imply ballot secrecy for any number of possibly dishonest voters. Hence, this variant avoids the ballot copying attack and satisfies a stronger ballot secrecy property than the original protocol. Thus, we automate the proof made manually in (Delaune, Kremer, and Ryan 2009). For this variant, the swapping occurs at the beginning of the voting process, so we can actually prove the equivalence by proving diff-equivalence after applying the general property that $C[P \mid Q] \approx C[Q \mid P]$, as explained in Section 3.5.3. Furthermore, an extension of ProVerif (Cheval and Blanchet 2013, sec. 5) takes advantage of this property to merge processes into biprocesses in order to prove observational equivalence. The approach outlined in that paper also succeeds in proving ballot secrecy for this variant. It takes 12 minutes 46 seconds, while our implementation with swapping takes 31 seconds. It spends most of the time computing the merged biprocesses; this is the reason why it is slower. #### Analysis: receipt-freeness We prove receipt-freeness for two honest voters. The administrator and voter keys do need to be secret, and all authorities need to be explicitly modelled. The process $V'$ is built similarly to the one for the original protocol by Lee *et al*. Equivalence [eq:recfree1] again holds by construction of $V'$. To prove [eq:recfree2], much like in (Delaune, Kremer, and Ryan 2009), we model the collector as parallel processes that each input one ballot, check the signature, decrypt, synchronise together, and output the decrypted vote: $$c(b);\textnormal{let } ev=\mathsf{checksign}(pk_A,b) \textnormal{ in }\textnormal{let } v=\mathsf{dec}(sk_C,ev) \textnormal{ in }2\textnormal{::}\,\overline{c}\langle v\rangle$$ There are as many such processes as there are voters, two in our case. However, such a collector does not check that the ballots are pairwise distinct: each of the two parallel processes has access to a single ballot, so each process individually cannot check that the two ballots are distinct. Therefore, this check is difficult to implement in the original process fed to our compiler in a way that would allow our approach to conclude. Instead, we implemented this necessary check by manually modifying the code generated by our compiler, by adding a check that the ballots are distinct in the process that swaps data. An excerpt of the obtained code follows: $$\begin{aligned} &(c(b);\textnormal{let } ev=\mathsf{checksign}(pk_A,b) \textnormal{ in }\\ &\textnormal{let } v=\mathsf{dec}(sk_C,ev) \textnormal{ in }\overline{a_1}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{b, v}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle;c_1(v');\overline{c}\langle v'\rangle)\\ \mid &\\ &(c(b);\textnormal{let } ev=\mathsf{checksign}(pk_A,b) \textnormal{ in }\\ &\textnormal{let } v=\mathsf{dec}(sk_C,ev) \textnormal{ in }\overline{a_2}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{b, v}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle;c_2(v');\overline{c}\langle v'\rangle)\\ \mid &\\ &(a_1(\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{b_1, v_1}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$});a_2(\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{b_2, v_2}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$});\\ (*)\quad &\textnormal{if } b_1=b_2 \textnormal{ then } 0 \textnormal{ else }\\ &\overline{c_1}\langle\mathsf{diff}[v_1,v_2]\rangle;\overline{c_2}\langle\mathsf{diff}[v_2,v_1]\rangle) \end{aligned}$$ This code shows the two collectors and the process that swaps data. We use $a(\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{b, v}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$})$ as an abbreviation for $a(x);\textnormal{let } b=\pi_{1,2}(x) \textnormal{ in } \textnormal{let } v=\pi_{2,2}(x) \textnormal{ in}$. The ballots are sent on channels $a_1$ and $a_2$ in addition to the decrypted votes, and we check that the two ballots are distinct at line $(*)$. With this code, ProVerif proves the diff-equivalence, so we have shown receipt-freeness for two honest voters. This proof is difficult to generalise to more voters in ProVerif, because in this case the collector should swap two ballots among the ones it has received (the two ballots coming from the voters that swap their votes), but it has no means to detect which ones. ## Other examples The idea of swapping for proving equivalences has been applied by Dahl, Delaune & Steel (Dahl, Delaune, and Steel 2010) to prove privacy in a vehicular ad-hoc network (Freudiger et al. 2007). They manually encode swapping based upon the informal idea of (Delaune, Ryan, and Smyth 2008). We have repeated their analysis using our approach. Thus, we automate the encoding of swapping in (Dahl, Delaune, and Steel 2010), and obtain stronger confidence in the results thanks to our soundness proof. Backes, Hriţcu & Maffei (Backes, Hriţcu, and Maffei 2008) also manually encode the idea of swapping, together with other encoding tricks, to prove a privacy notion stronger than receipt-freeness, namely *coercion resistance*, of the protocol by Juels, Catalano & Jakobsson (Juels, Catalano, and Jakobsson 2010). We removed their manual encoding of swapping and repeated their analysis using our approach. In this case, swapping is done immediately under a parallel composition, so it is particularly easy to encode manually, as explained in Section 3.5.3. (Both our analysis and the one by Backes, Hriţcu & Maffei abstract away the malleability of encryption, because ProVerif does not support it.) Although the swapping idea also applies to the election scheme Helios (Adida et al. 2009), we cannot automatically verify it with ProVerif, because ProVerif does not support the equational theory of homomorphic encryption. # Conclusion We extend the applied pi calculus to include barrier synchronisation and define a compiler to the calculus without barriers. Our compiler enables swapping data between processes at barriers, which simplifies proofs of observational equivalence. We have proven the soundness of our compiler and have implemented it in ProVerif, thereby extending the class of equivalences that can be automatically verified. The applicability of the results is demonstrated by analysing ballot secrecy, receipt-freeness, and coercion resistance in election schemes, as well as privacy in a vehicular ad-hoc network. The idea of swapping data at barriers was introduced in (Delaune, Ryan, and Smyth 2008), without proving its soundness, and similar ideas have been used by several researchers (Backes, Hriţcu, and Maffei 2008; Dahl, Delaune, and Steel 2010), so we believe that it is important to provide a strong theoretical foundation to this technique. # Acknowledgements We are particularly grateful to Tom Chothia, Véronique Cortier, Andy Gordon, Mark Ryan, and the anonymous CSF and JCS reviewers, for their careful reading of preliminary drafts which led to this paper; their comments provided useful guidance. Birmingham’s *Formal Verification and Security Group* provided excellent discussion and we are particularly grateful to: Myrto Arapinis, Sergiu Bursuc, Dan Ghica, and Eike Ritter, as well as, Mark and Tom, whom we have already mentioned. Part of the work was conducted while the authors were at École Normale Supérieure, Paris, France and while Smyth was at Inria, Paris, France and the University of Birmingham, Birmingham, UK.
# Proofs for Section 3 This appendix proves the results announced in Section 3. Appendix 6 proves Lemma 2 (validity); Appendix 7 proves Lemma 4 (soundness of $\mathsf{split}$); and Appendix 8 proves Proposition 5 (soundness of $\mathsf{annotate}$). Appendices 9 to 12 are devoted to the proof of results needed for Theorem 13. We show that barrier elimination commutes with renaming and substitution (proof of Lemma 8 in Appendix 9) and that it preserves reduction (proof of Lemma 9 in Appendix 10). Using these interim results, we prove Proposition 7 (Appendix 11). Appendix 12 proves Propositions 10 and 11. Finally, Appendix 13 proves our results on replicated barriers (Section 3.5.1). # Proof of Lemma 2 (validity)
**Lemma 17**. *If $C[Q]$ is valid, $\sigma$ is a ground substitution, $C[\_]$ binds the variables in $\mathsf{dom}(\sigma)$ and no other variable above the hole, and $\mathsf{fn}(\mathsf{range}(\sigma)) \cap \mathsf{channels}(\mathsf{barriers}(Q)) = \emptyset$, then $\mathsf{barriers}(Q\sigma) = \mathsf{barriers}(Q)$ and $Q \sigma$ is valid.*
*Proof.* The process $Q\sigma$ is closed because $\mathsf{fv}(Q\sigma) \subseteq \mathsf{fv}(Q) \setminus \mathsf{dom}(\sigma) \cup \mathsf{fv}(\mathsf{range}(\sigma)) \subseteq \mathsf{fv}(C[Q]) \cup \mathsf{fv}(\mathsf{range}(\sigma)) = \emptyset$ since $C[Q]$ is closed and $\sigma$ is ground. Consider an annotated barrier in $Q$, such that $Q = C'[t[a,c,\varsigma]\textnormal{::}\,Q']$. We rename the bound variables so that the variables in $\mathsf{dom}(\sigma)$ are not bound by $C'[\_]$ and the bound names so that the names in the range of $\sigma$ are not bound by $C'[\_]$. Since $C[Q]$ is valid, we have $\mathsf{fv}(Q') \subseteq \mathsf{dom}(\varsigma)$, so $(t[a,c,\varsigma]\textnormal{::}\,Q')\sigma = t[a,c,\varsigma\sigma]\textnormal{::}\,Q'$, so $$\begin{aligned} \mathsf{barriers}((t[a,c,\varsigma]\textnormal{::}\,Q')\sigma) & =\mathsf{barriers}(t[a,c,\varsigma\sigma]\textnormal{::}\,Q')\\ & =\{t[a,c,\mathsf{ordom}(\varsigma\sigma)]\textnormal{::}\,Q'\} \cup \mathsf{barriers}(Q')\\ & =\{t[a,c,\mathsf{ordom}(\varsigma)]\textnormal{::}\,Q'\} \cup \mathsf{barriers}(Q')\\ & =\mathsf{barriers}(t[a,c,\varsigma]\textnormal{::}\,Q') \end{aligned}$$ Therefore, $\mathsf{barriers}(Q\sigma) = \mathsf{barriers}(Q)$. Hence, $\mathsf{channels}(\mathsf{barriers}(Q\sigma)) = \mathsf{channels}(\mathsf{barriers}(Q)) \subseteq \mathsf{channels}(\mathsf{barriers}(C[Q]))$ has pairwise distinct elements, and $$\begin{aligned} &\mathsf{channels}(\mathsf{barriers}(Q\sigma)) \cap \mathsf{fn\text{-}nobc}(Q\sigma)\\ &\quad \subseteq \mathsf{channels}(\mathsf{barriers}(Q)) \cap (\mathsf{fn\text{-}nobc}(Q) \cup \mathsf{fn}(\mathsf{range}(\sigma)))\\ &\quad \subseteq \mathsf{channels}(\mathsf{barriers}(C[Q])) \cap \mathsf{fn\text{-}nobc}(Q) = \emptyset\,. \end{aligned}$$ Consider an annotated barrier in $Q\sigma$, such that $Q\sigma = C'[t[a,c,\varsigma]\textnormal{::}\,Q']$. Then $Q = C''[t[a,c,\varsigma']\textnormal{::}\,Q'']$, $C'[\_]= C''[\_]\sigma$, $\varsigma = \varsigma'\sigma$, and $Q' = Q''\sigma$, after renaming the bound variables so that the variables in $\mathsf{dom}(\sigma)$ are not bound by $C''[\_]$ nor by $\varsigma'$ and the bound names so that the names in the range of $\sigma$ are not bound by $C''[\_]$. Since $C[Q]$ is valid, $\mathsf{fv}(Q'') \subseteq \mathsf{dom}(\varsigma')$, so $Q' = Q''\sigma = Q''$. We have $\mathsf{fv}(Q') = \mathsf{fv}(Q'') \subseteq \mathsf{dom}(\varsigma') = \mathsf{dom}(\varsigma)$, $C'[\_]$ does not bind $a$, $c$, and the names in $\mathsf{fn}(Q') = \mathsf{fn}(Q'')$ since $C[C''[\_]]$ does not bind $a$, $c$, and the names in $\mathsf{fn}(Q'')$ and $C'[\_]$ binds the same names as $C''[\_]$. ◻
*Proof of Lemma 2.* We prove each of the properties (denoted in italics) below: *If $P$ is a valid process, then $\mathcal{C}_{\textnormal{init}}(P)$ is valid.* Suppose that $P$ is valid. As defined in Section 3.1, we have $\mathcal{C}_{\textnormal{init}}(P) = B, E, {\mathcal P}$, where $B = \mathsf{barriers}(P)$, $E = \mathsf{channels}(B)$, and ${\mathcal P}= \{ P\}$, so a fortiori $\mathsf{barriers}({\mathcal P}) \subseteq B$, $\mathsf{channels}(B) \subseteq E$, all processes in ${\mathcal P}$ are valid, the elements of $\mathsf{channels}(B) = \mathsf{channels}(\mathsf{barriers}(P))$ are pairwise distinct, and $\mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}) = \mathsf{channels}(\mathsf{barriers}(P)) \cap \mathsf{fn\text{-}nobc}(P) = \emptyset$. Therefore, $\mathcal{C}_{\textnormal{init}}(P)$ is valid. *Validity is preserved by reduction.* We proceed by cases on the reduction rule. - Cases $\mbox{\sc (Red Nil)}$ and $\mbox{\sc (Red Par)}$ are easy. - Case $\mbox{\sc (Red Repl)}$: Since barriers never occur under replication, the transformed process $!P$ contains no barrier. Preservation of validity follows easily. - Case $\mbox{\sc (Red Res)}$: Suppose that $B,E,{\mathcal P}\cup \{\nu\,n.P\}\;\rightarrow\;B,E \cup \{n'\},{\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\}$ by $\mbox{\sc (Red Res)}$, for some name $n'$ such that $n'\not\in E \cup \mathsf{fn}({\mathcal P}\cup \{\nu\,n.P\})$, and $B,E,{\mathcal P}\cup \{\nu\,n.P\}$ is a valid configuration. Suppose that an annotated barrier $t[a,c,\varsigma]\textnormal{::}\,Q$ occurs in $P$, so that $P = C[t[a,c,\varsigma]\textnormal{::}\,Q]$. Since $\nu\,n.P$ is valid, $\nu\,n.C[\_]$ does not bind the names $a$, $c$, and $\mathsf{fn}(Q)$ above the hole, hence $n\notin\{a,c\}\cup\mathsf{fn}(Q)$, so $$(t[a,c,\varsigma]\textnormal{::}\,Q)\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\} = t[a,c,\varsigma\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}]\textnormal{::}\,Q\,,$$ so $$\begin{aligned} \mathsf{barriers}((t[a,c,\varsigma]\textnormal{::}\,Q)\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}) & =\mathsf{barriers}(t[a,c,\varsigma\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}]\textnormal{::}\,Q)\\ & =\{t[a,c,\mathsf{ordom}(\varsigma\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\})]\textnormal{::}\,Q\} \cup \mathsf{barriers}(Q)\\ & =\{t[a,c,\mathsf{ordom}(\varsigma)]\textnormal{::}\,Q\} \cup \mathsf{barriers}(Q)\\ & =\mathsf{barriers}(t[a,c,\varsigma]\textnormal{::}\,Q) \end{aligned}$$ Therefore, $\mathsf{barriers}(P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}) = \mathsf{barriers}(P) = \mathsf{barriers}(\nu\,n.P)$. Hence, we have $\mathsf{barriers}({\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\}) = \mathsf{barriers}({\mathcal P}\cup \{\nu\,n.P\}) \subseteq B$ and $\mathsf{channels}(B) \subseteq E \subseteq E \cup \{ n'\}$. The processes in ${\mathcal P}$ are valid. Let us show that the process $P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}$ is valid. The process $P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}$ is closed because $\nu\,n.P$ is closed. The elements of $\mathsf{channels}(\mathsf{barriers}(P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\})) = \mathsf{channels}(\mathsf{barriers}(\nu\,n.P))$ are pairwise distinct. We have $$\begin{aligned} &\mathsf{channels}(\mathsf{barriers}(P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\})) \cap \mathsf{fn\text{-}nobc}(P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\})\\ &\quad \subseteq \mathsf{channels}(\mathsf{barriers}(\nu\,n.P)) \cap (\mathsf{fn\text{-}nobc}(\nu\,n.P) \cup \{ n'\}) = \emptyset \end{aligned}$$ because $n' \notin \mathsf{channels}(\mathsf{barriers}(\nu\,n.P))$ since $$\mathsf{channels}(\mathsf{barriers}(\nu\,n.P)) \subseteq \mathsf{channels}(B) \subseteq E$$ and $n' \notin E$. Consider an annotated barrier in $P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}$, such that $P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\} = C[t[a,c,\varsigma]\textnormal{::}\,Q]$. Since $n' \notin \mathsf{fn}(\nu\,n.P) = \mathsf{fn}(P) \setminus\{n\}$, $\nu\,n.P = \nu\,n.(P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\{\textnormal{\raisebox{2pt}{\footnotesize $n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n'$}}\}) =\nu\,n.(C[t[a,c,\varsigma]\textnormal{::}\,Q]\{\textnormal{\raisebox{2pt}{\footnotesize $n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n'$}}\})$. We rename the bound names in $C[\_]$ so that they are different from $n$ and $n'$, and let $C'[\_]= C[\_]\{\textnormal{\raisebox{2pt}{\footnotesize $n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n'$}}\}$. Then $\nu\,n.P = \nu\,n.C'[t[a\{\textnormal{\raisebox{2pt}{\footnotesize $n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n'$}}\},\allowbreak c\{\textnormal{\raisebox{2pt}{\footnotesize $n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n'$}}\},\allowbreak \varsigma\{\textnormal{\raisebox{2pt}{\footnotesize $n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n'$}}\}]\textnormal{::}\,\allowbreak Q\{\textnormal{\raisebox{2pt}{\footnotesize $n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n'$}}\}]$. Since $\nu\,n.P$ is valid, we have $\mathsf{fv}(Q) = \mathsf{fv}(Q\{\textnormal{\raisebox{2pt}{\footnotesize $n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n'$}}\}) \subseteq \mathsf{dom}(\varsigma\{\textnormal{\raisebox{2pt}{\footnotesize $n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n'$}}\}) = \mathsf{dom}(\varsigma)$ and $C[\_]$ does not bind $a$, $c$, and the names in $\mathsf{fn}(Q)$ above the hole since $\nu\,n.C'[\_]$ does not bind $a\{\textnormal{\raisebox{2pt}{\footnotesize $n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n'$}}\}$, $c\{\textnormal{\raisebox{2pt}{\footnotesize $n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n'$}}\}$, and the names of $\mathsf{fn}(Q\{\textnormal{\raisebox{2pt}{\footnotesize $n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n'$}}\})$ above the hole. The elements of $\mathsf{channels}(B)$ are pairwise distinct by hypothesis, and $$\begin{aligned} &\mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\})\\ &\quad \subseteq \mathsf{channels}(B) \cap (\mathsf{fn\text{-}nobc}({\mathcal P}\cup \{ \nu\,n.P \}) \cup \{ n'\}) = \emptyset \end{aligned}$$ because $n' \notin \mathsf{channels}(B)$ since $\mathsf{channels}(B) \subseteq E$ and $n' \notin E$. - Case $\mbox{\sc (Red I/O)}$: Suppose that $B,E,{\mathcal P}\cup \{\overline{N}\langle M\rangle.P, N(x).Q\}\;\rightarrow\;B,E,{\mathcal P}\cup \{P,Q\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}$ by $\mbox{\sc (Red I/O)}$ and $B,E,{\mathcal P}\cup \{\overline{N}\langle M\rangle.P, N(x).Q\}$ is a valid configuration. The term $M$ is ground since $\overline{N}\langle M\rangle.P$ is closed. Moreover, $\mathsf{channels}(\mathsf{barriers}(Q)) \cap \mathsf{fn}(M) = \emptyset$ since $\mathsf{channels}(\mathsf{barriers}({\mathcal P}\cup \{\overline{N}\langle M\rangle.P, N(x).Q\})) \cap \mathsf{fn\text{-}nobc}({\mathcal P}\cup \{\overline{N}\langle M\rangle.P, N(x).Q\}) = \emptyset$. Hence, by Lemma 17, we have $\mathsf{barriers}({\mathcal P}\cup \{P,Q\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}) = \mathsf{barriers}({\mathcal P}\cup \{P,Q\}) = \mathsf{barriers}({\mathcal P}\cup \{\overline{N}\langle M\rangle.P, N(x).Q\}) \subseteq B$. We have $\mathsf{channels}(B) \subseteq E$. The processes in ${\mathcal P}$ are valid. The validity of $P$ follows easily from the validity of $\overline{N}\langle M\rangle.P$. The process $Q\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}$ is valid by Lemma 17. The elements of $\mathsf{channels}(B)$ are pairwise distinct by hypothesis, and $\mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}\cup \{P,Q\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}) \subseteq \mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}\cup \{\overline{N}\langle M\rangle.P, N(x).Q\}) = \emptyset$. Therefore, $B,E,{\mathcal P}\cup \{P,Q\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}$ is valid. - Case $\mbox{\sc (Red Destr 1)}$: Suppose that $B,E,{\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\}\;\rightarrow\;B,E,{\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}$ by $\mbox{\sc (Red Destr 1)}$, where $D\Downarrow M$, and $B,E,{\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\}$ is a valid configuration. The term $M$ is ground since $D$ is ground, and $\mathsf{channels}(\mathsf{barriers}(P)) \cap \mathsf{fn}(M) = \emptyset$ since $\mathsf{channels}(\mathsf{barriers}(P)) \cap \mathsf{fn}(D) = \emptyset$, since $\mathsf{channels}(\mathsf{barriers}(\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q)) \mathrel\cap\allowbreak \mathsf{fn\text{-}nobc}(\allowbreak\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q) = \emptyset$ by validity of $\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q$. Hence, by Lemma 17, we have $$\begin{aligned} \mathsf{barriers}({\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}) & = \mathsf{barriers}({\mathcal P}\cup \{P\}) \\ & \subseteq \mathsf{barriers}({\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\})\\ & \subseteq B\,. \end{aligned}$$ We have $\mathsf{channels}(B) \subseteq E$. The processes in ${\mathcal P}$ are valid. The process $P\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}$ is valid by Lemma 17. The elements of $\mathsf{channels}(B)$ are pairwise distinct by hypothesis, and $\mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}) \subseteq \mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\}) = \emptyset$. Therefore, $B,E,{\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}$ is valid. - Case $\mbox{\sc (Red Destr 2)}$: Suppose that $B,E,{\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\}\;\rightarrow\;B,E,{\mathcal P}\cup \{Q\}$ by $\mbox{\sc (Red Destr 2)}$ and $B,E,{\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\}$ is a valid configuration. We have $\mathsf{barriers}({\mathcal P}\cup \{Q\}) \subseteq \mathsf{barriers}({\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\}) \subseteq B$ and $\mathsf{channels}(B) \subseteq E$. The processes in ${\mathcal P}$ are valid. The validity of $Q$ follows easily from the validity of $\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q$. The elements of $\mathsf{channels}(B)$ are pairwise distinct, and $\mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}\cup \{ Q\}) \subseteq \mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}\cup \{\textnormal{let } x=D \textnormal{ in } P \textnormal{ else }Q\}) = \emptyset$. Therefore, $B,E,{\mathcal P}\cup \{Q\}$ is valid. - Case $\mbox{\sc (Red Bar')}$: Let ${\mathcal P}_1 = {\mathcal P}\cup \{t\textnormal{::}\,P_1,\allowbreak \dots,\allowbreak t\textnormal{::}\,P_m, \allowbreak t[a_{m+1},c_{m+1},\varsigma_{m+1}]\textnormal{::}\,P_{m+1}, \allowbreak \dots, \allowbreak t[a_n,\allowbreak c_n, \allowbreak \varsigma_n]\textnormal{::}P_n\}$ ${\mathcal P}_2 = {\mathcal P}\cup \{P_1,\allowbreak \dots,\allowbreak P_m,\allowbreak P_{m+1}\varsigma_{m+1},\allowbreak \dots,\allowbreak P_n\varsigma_n\}$, and suppose that $B,E,{\mathcal P}_1 \rightarrow\;B',E,{\mathcal P}_2$ by $\mbox{\sc (Red Bar')}$, where $B = \{ t^m, t[a_{m+1},c_{m+1},\mathsf{ordom}(\varsigma_{m+1})]\textnormal{::}\,P_{m+1}, \allowbreak \dots, \allowbreak t[a_n,c_n,\mathsf{ordom}(\varsigma_n)]\textnormal{::}\,P_n \} \cup B'$; for all $t'$ such that $t' \leq t$, we have $t'\notin B'$ and $t'[\_]\textnormal{::}\,\_ \notin B'$; and $B,E,{\mathcal P}_1$ is a valid configuration. The substitution $\varsigma_i$ is ground since $t[a_i,c_i,\varsigma_i]\textnormal{::}\,P_i$ is closed and $\mathsf{channels}(\mathsf{barriers}(P_i)) \cap \mathsf{fn}(\mathsf{range}(\varsigma_i)) = \emptyset$ since $\mathsf{channels}(\mathsf{barriers}(t[a_i,c_i,\varsigma_i]\textnormal{::}\,P_i)) \cap \mathsf{fn\text{-}nobc}(t[a_i,c_i,\varsigma_i]\textnormal{::}\,P_i) = \emptyset$ since $t[a_i,c_i,\varsigma_i]\textnormal{::}\,P_i$ is valid. We have $$\begin{aligned} &\mathsf{barriers}({\mathcal P}_2)\\ &\quad = \mathsf{barriers}({\mathcal P}\cup \{P_1, \dots, P_m, P_{m+1}\varsigma_{m+1}, \dots,P_n\varsigma_n\})\\ &\quad = \mathsf{barriers}({\mathcal P}\cup \{P_1, \dots, P_n\})\tag*{by Lemma~\ref{lem:valid-subst}}\\ &\quad = \mathsf{barriers}({\mathcal P}_1) \setminus \{ t^m, t[a_{m+1},c_{m+1},\mathsf{ordom}(\varsigma_{m+1})]\textnormal{::}\,P_{m+1}, \dots, t[a_n,c_n,\mathsf{ordom}(\varsigma_n)]\textnormal{::}\,P_n \}\\ &\quad \subseteq B\setminus \{ t^m, t[a_{m+1},c_{m+1},\mathsf{ordom}(\varsigma_{m+1})]\textnormal{::}\,P_{m+1}, \dots, \allowbreak t[a_n,c_n,\mathsf{ordom}(\varsigma_n)]\textnormal{::}\,P_n \}\\ &\quad = B' \end{aligned}$$ and $\mathsf{channels}(B') \subseteq \mathsf{channels}(B) \subseteq E$. The processes in ${\mathcal P}$ are valid. The validity of $P_i$ for $i \leq m$ follows easily from the validity of $t\textnormal{::}\,P_i$. The process $P_i \varsigma_i$ for $i > m$ is valid by Lemma 17. The elements of $\mathsf{channels}(B') \subseteq \mathsf{channels}(B)$ are pairwise distinct, and $\mathsf{channels}(B') \cap \mathsf{fn\text{-}nobc}({\mathcal P}_2) \subseteq \mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}_1) = \emptyset$. *Validity is preserved by application of an adversarial context.* Let $\mathcal{C}= B, E, {\mathcal P}$ be a valid configuration and $C[\_]$ be an adversarial context. We have $C[\_]= \nu\,\tilde n.(\_ \mid Q)$ with $\mathsf{fv}(Q) = \emptyset$ and $\mathsf{barriers}(Q) = \emptyset$. We suppose that the names in $E$ have been renamed so that $\mathsf{fn}(Q) \cap E = \emptyset$. Then we have $C[\mathcal{C}] = B,E \cup \{\tilde n\},{\mathcal P}\cup\{Q\}$. Let us show that $C[\mathcal{C}]$ is valid. We have $$\begin{aligned} &\mathsf{barriers}({\mathcal P}\cup\{Q\}) = \mathsf{barriers}({\mathcal P}) \subseteq B\\ &\mathsf{channels}(B) \subseteq E \subseteq E \cup \{\tilde n\} \end{aligned}$$ All processes in ${\mathcal P}$ are valid and $Q$ is valid since it is closed and contains no barriers. The elements of $\mathsf{channels}(B)$ are pairwise distinct by hypothesis, and $\mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}\cup \{Q\}) = \emptyset$ because $\mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}) = \emptyset$ and $\mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}(Q) \subseteq E \cap \mathsf{fn}(Q) = \emptyset$. Therefore, $C[\mathcal{C}]$ is valid. *Validity is preserved by application of $\mathsf{fst}$ and $\mathsf{snd}$.* We consider the case of $\mathsf{fst}$. The case of $\mathsf{snd}$ is symmetric. We first show that, if biprocess $P$ is valid, then $\mathsf{fst}(P)$ is valid. Suppose that $P$ is valid. Since $P$ is closed and $\mathsf{fv}(\mathsf{fst}(P)) \subseteq \mathsf{fv}(P)$, the process $\mathsf{fst}(P)$ is also closed. The elements of $\mathsf{channels}(\mathsf{barriers}(\mathsf{fst}(P))) = \mathsf{channels}(\mathsf{barriers}(P))$ are pairwise distinct. We have $\mathsf{channels}(\mathsf{barriers}(\mathsf{fst}(P))) \cap \mathsf{fn\text{-}nobc}(\mathsf{fst}(P)) \subseteq \mathsf{channels}(\mathsf{barriers}(P)) \cap \mathsf{fn\text{-}nobc}(P) = \emptyset$. Consider an annotated barrier in $\mathsf{fst}(P)$, such that $\mathsf{fst}(P) = C[t[a,c,\varsigma]\textnormal{::}\,Q]$. Then $P = C'[t[a,c,\varsigma']\textnormal{::}\,Q']$ such that $C[\_]= \mathsf{fst}(C'[\_])$, $\varsigma = \mathsf{fst}(\varsigma')$, and $Q = \mathsf{fst}(Q')$. We have $\mathsf{fv}(Q) \subseteq \mathsf{fv}(Q') \subseteq \mathsf{dom}(\varsigma') = \mathsf{dom}(\varsigma)$, $C'[\_]$ does not bind $a$, $c$, nor the names in $\mathsf{fn}(Q')$ above the hole, so $C[\_]$ does not bind $a$, $c$, nor the names in $\mathsf{fn}(Q) \subseteq \mathsf{fn}(Q')$ above the hole, because $C[\_]$ binds the same names as $C'[\_]$. So $\mathsf{fst}(P)$ is valid. Next, we show that, if a configuration $B, E, {\mathcal P}$ is valid, then $\mathsf{fst}(B, E, {\mathcal P}) = \mathsf{fst}(B), E, \mathsf{fst}({\mathcal P})$ is valid. Suppose that $B, E, {\mathcal P}$ is valid. We have $$\begin{aligned} &\mathsf{barriers}(\mathsf{fst}({\mathcal P})) = \mathsf{fst}(\mathsf{barriers}({\mathcal P})) \subseteq \mathsf{fst}(B)\,,\\ &\mathsf{channels}(\mathsf{fst}(B)) = \mathsf{channels}(B) \subseteq E\,, \end{aligned}$$ all processes in $\mathsf{fst}({\mathcal P})$ are valid since all processes in ${\mathcal P}$ are valid, the elements of $\mathsf{channels}(\mathsf{fst}(B)) = \mathsf{channels}(B)$ are pairwise distinct, and $$\mathsf{channels}(\mathsf{fst}(B)) \cap \mathsf{fn\text{-}nobc}(\mathsf{fst}({\mathcal P})) \subseteq \mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}) = \emptyset\,.$$ So $\mathsf{fst}(B, E, {\mathcal P})$ is valid. ◻
# Proof of Lemma 4 (soundness of $\mathsf{split}$)
*Proof of Lemma 4.* The proof proceeds by induction on $Q$. - Case $Q = M$ with $(\mathsf{fv}(M) \cup \mathsf{fn}(M)) \cap U = \emptyset$. We have $\mathsf{split}({U}, {M}) = (x, (\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}))$ where $x$ is a fresh variable, so $Q' = x$ and $\varsigma = (\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}})$. Hence $Q'\varsigma = M = Q$, $(\mathsf{fv}(\mathsf{range}(\varsigma)) \cup \mathsf{fn}(\mathsf{range}(\varsigma))) \cap U = (\mathsf{fv}(M) \cup \mathsf{fn}(M)) \cap U = \emptyset$, $\mathsf{fv}(Q') = \mathsf{dom}(\varsigma) = \{x\}$, $\mathsf{fn}(Q') = \emptyset$, and $\mathsf{dom}(\varsigma)$ consists of fresh variables. - Case $Q = u$ with $u \in U$. We have $\mathsf{split}({U}, {u}) = (u, \emptyset)$, so $Q' = u$ and $\varsigma = \emptyset$. Hence $Q'\varsigma = u = Q$, $\mathsf{fv}(\mathsf{range}(\varsigma)) \cup \mathsf{fn}(\mathsf{range}(\varsigma)) = \emptyset$, $\mathsf{dom}(\varsigma) = \emptyset$, $\mathsf{fv}(Q') \subseteq U$, and $\mathsf{fn}(Q') \subseteq U$. - Case $Q = C[Q_1, \dots, Q_n]$. The considered contexts $C[\_]$ do not have any free names or variables. We have $\mathsf{split}({U}, {C[Q_1, \dots, Q_n]}) = (C[Q'_1,\dots,Q'_n], \varsigma)$ where for all $i \leq n$, $\mathsf{split}({U \cup U_i}, {Q_i}) = (Q'_i, \varsigma_i)$, $C[\_,\dots,\_]$ binds the names and variables in $U_i$ above the $i$-th hole, and $\varsigma = \varsigma_1 + \dots + \varsigma_n$, so $Q' = C[Q'_1,\dots,Q'_n]$. Hence $Q' \varsigma = C[Q'_1\varsigma_1,\dots,Q'_n\varsigma_n]$ because $Q'_i \varsigma = Q'_i \varsigma_i$, since $\mathsf{fv}(Q'_i) \subseteq \mathsf{dom}(\varsigma_i) \cup U$ and, for all $j \neq i$, $\mathsf{dom}(\varsigma_j)$ consists of fresh variables, so it does not intersect $\mathsf{dom}(\varsigma_i) \cup U$, and $C[\_,\dots,\_]$ does not capture names nor variables because $(\mathsf{fv}(\mathsf{range}(\varsigma_i)) \cup \mathsf{fn}(\mathsf{range}(\varsigma_i))) \cap U_i = \emptyset$ and $\mathsf{dom}(\varsigma_i) \cap U_i = \emptyset$. Moreover, $(\mathsf{fv}(\mathsf{range}(\varsigma)) \cup \mathsf{fn}(\mathsf{range}(\varsigma))) \cap U \subseteq \bigcup_{i \leq n} (\mathsf{fv}(\mathsf{range}(\varsigma_i)) \cup \mathsf{fn}(\mathsf{range}(\varsigma_i))) \cap (U \cup U_i) = \emptyset$. For all $i \leq n$, $\mathsf{dom}(\varsigma_i) \subseteq \mathsf{fv}(Q'_i)\subseteq \mathsf{dom}(\varsigma_i) \cup U \cup U_i$, so $\mathsf{dom}(\varsigma_i) \subseteq \mathsf{fv}(Q'_i) \setminus U_i \subseteq \mathsf{dom}(\varsigma_i) \cup U$ since $\mathsf{dom}(\varsigma_i) \cap U_i = \emptyset$, so by taking the union over $i \leq n$, $\mathsf{dom}(\varsigma) \subseteq \mathsf{fv}(Q') \subseteq \mathsf{dom}(\varsigma) \cup U$. For all $i \leq n$, $\mathsf{fn}(Q'_i) \subseteq U \cup U_i$, so $\mathsf{fn}(Q'_i) \setminus U_i \subseteq U$, so by taking the union over $i \leq n$, $\mathsf{fn}(Q') \subseteq U$. Finally, for all $i \leq n$, $\mathsf{dom}(\varsigma_i)$ consists of fresh variables, so $\mathsf{dom}(\varsigma)$ consists of fresh variables.  ◻
# Proof of Proposition 5 (soundness of $\mathsf{annotate}$)
**Proposition 18**. *Let $B, E, {\mathcal P}$ be a valid configuration, and $n$ be a name, where $n \notin \mathsf{fn}({\mathcal P})$. We have $B, E, {\mathcal P}\approx B, E \cup \{n\}, {\mathcal P}$.*
*Proof.* If $n\in E$, the result is obvious. Let us prove it when $n \notin E \cup \mathsf{fn}({\mathcal P})$. When $B, E, {\mathcal P}$ is valid, $B, E \cup \{n\}, {\mathcal P}$ is a fortiori valid. We define the relation $\mathrel{\mathcal{R}}$ by $$(B, E, {\mathcal P}) \mathrel{\mathcal{R}}(B, E \cup \{n\}, {\mathcal P})$$ for any $B$, $E$, ${\mathcal P}$, $n$ such that $n \notin E \cup \mathsf{fn}({\mathcal P})$, and $B, E, {\mathcal P}$ and $B, E \cup \{n\}, {\mathcal P}$ are valid configurations. We have that $\mathrel{\mathcal{R}}\cup \mathrel{\mathcal{R}}^{-1}$ is symmetric and satisfies the three conditions of Definition 1. For condition 2, we assume $\mathcal{C}= (B, E, {\mathcal P})\mathrel{\mathcal{R}}\mathcal{C}' = (B, E \cup \{n\}, {\mathcal P})$ and $\mathcal{C}\rightarrow \mathcal{C}_1$. In case $\mathcal{C}\rightarrow \mathcal{C}_1$ is derived by ${\ensuremath{\mbox{\sc (Red Res)}}}$, we have ${\mathcal P}= {\mathcal P}' \cup \{\nu\,n_0.P\}$ and $\mathcal{C}= (B, E, {\mathcal P}' \cup \{\nu\,n_0.P\})$ reduces into $\mathcal{C}_1 = (B,E \cup \{n_1\},{\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $n_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n_0$}}\}\})$ with $n_1\notin E \cup \mathsf{fn}({\mathcal P})$. Moreover, $\mathcal{C}' = (B, E \cup \{n\}, {\mathcal P}' \cup \{\nu\,n_0.P\})$ reduces into $\mathcal{C}'_1 = (B,E \cup \{n'_1, n\},{\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $n'_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n_0$}}\}\})$ with $n'_1\notin E \cup \{n\} \cup \mathsf{fn}({\mathcal P})$. By the convention that configurations $(B, E, {\mathcal P})$ are considered equal modulo any renaming of the names in $E, {\mathcal P}$ that leaves $\mathsf{fn}({\mathcal P})\setminus E$ unchanged, we have $\mathcal{C}'_1 = (B,E \cup \{n_1, n'\},{\mathcal P}\cup \{P\{\textnormal{\raisebox{2pt}{\footnotesize $n_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n_0$}}\}\})$ for some $n' \notin E \cup \{n_1\} \cup \mathsf{fn}({\mathcal P})$, so $\mathcal{C}_1 \mathrel{\mathcal{R}}\mathcal{C}'_1$. The other cases are left to the reader. Hence ${\mathrel{\mathcal{R}}\cup \mathrel{\mathcal{R}}^{-1}} \subseteq {\approx}$. This property implies the desired equivalence. ◻
**Proposition 19**. *For any context $C[\_]$ without replication above the hole, any process $P$, barrier $t$, names $a, c$, ordered substitution $\varsigma$ such that $C[t\textnormal{::}\,P\varsigma]$ and $C[t[a,c,\varsigma]\textnormal{::}\,P]$ are valid processes, we have $$C[t\textnormal{::}\,P\varsigma] \approx C[t[a,c,\varsigma]\textnormal{::}\,P]$$*
*Proof.* We define the relations $\mathrel{\mathcal{R}}_0$ and $\mathrel{\mathcal{R}}_1$ by $$\begin{aligned} (B, E, {\mathcal P}) &\mathrel{\mathcal{R}}_0 (B', E, {\mathcal P})\\ (B, E, \{C[t\textnormal{::}\,P\varsigma]\} \cup {\mathcal P}) &\mathrel{\mathcal{R}}_1 (B', E, \{C[t[a,c,\varsigma]\textnormal{::}\,P]\} \cup {\mathcal P}) \end{aligned}$$ where $(B, E, {\mathcal P})$, $(B', E, {\mathcal P})$, $(B, E, \{C[t\textnormal{::}\,P\varsigma]\} \cup {\mathcal P})$, and $(B', E, \{C[t[a,c,\varsigma]\textnormal{::}\,P]\} \cup {\mathcal P})$ are valid configurations and for all $t'$, $B_{|t'} = B'_{|t'}$, where $B_{|t'}$ denotes the total number of barriers of the form $t'$ or $t'[a',c',\tilde{x}]\textnormal{::}\,P'$ in $B$. We show that ${\mathrel{\mathcal{R}}} = {\mathrel{\mathcal{R}}_0 \cup \mathrel{\mathcal{R}}_1 \cup \mathrel{\mathcal{R}}_1^{-1}}$ is symmetric and satisfies the three conditions of Definition 1. Conditions 1 and 3 are obvious. To prove Condition 2, we notice that, when $(B, E, {\mathcal P}) \mathrel{\mathcal{R}}(B', E, {\mathcal P}')$, ${\ensuremath{\mbox{\sc (Red Bar')}}}$ is enabled for barrier $t'$ in $(B, E, {\mathcal P})$ if and only if it is enabled in $(B', E, {\mathcal P}')$. Indeed, ${\ensuremath{\mbox{\sc (Red Bar')}}}$ is enabled for barrier $t'$ in $(B, E, {\mathcal P})$ when $B_{|t''} = 0$ for all $t'' < t'$ and ${\mathcal P}$ contains $B_{|t'}$ processes of form $t'\textnormal{::}\,P$ or $t'[a,c,\varsigma]\textnormal{::}\,P$. (Validity ensures that $\mathsf{barriers}({\mathcal P})\subseteq B$, so for barrier $t'$, $B$ and ${\mathcal P}$ contain the same number of standard, resp. annotated, barriers and the content of annotated barriers also matches.) From this property, we prove Condition 2: - Case 1: $(B, E, {\mathcal P}) \mathrel{\mathcal{R}}_0 (B', E, {\mathcal P})$ and $(B, E, {\mathcal P}) \xrightarrow{}\mathcal{C}_1$. If this reduction is by ${\ensuremath{\mbox{\sc (Red Bar')}}}$ for barrier $t'$, then $\mathcal{C}_1 = (B_1, E, {\mathcal P}_1)$ where $B_1$ is obtained from $B$ by removing all (standard or annotated) barriers $t'$. Let $B'_1$ be obtained from $B'$ by removing all (standard or annotated) barriers $t'$. Then we have $(B', E, {\mathcal P}) \xrightarrow{}(B'_1, E, {\mathcal P}_1)$ and $(B_1, E, {\mathcal P}_1) \mathrel{\mathcal{R}}_0 (B'_1, E, {\mathcal P}_1)$. Otherwise, $\mathcal{C}_1 = (B, E_1, {\mathcal P}_1)$, $(B', E, {\mathcal P}) \xrightarrow{}(B', \allowbreak E_1, \allowbreak {\mathcal P}_1)$ by the same reduction and $(B, \allowbreak E_1, \allowbreak {\mathcal P}_1) \mathrel{\mathcal{R}}_0 (B', \allowbreak E_1, \allowbreak {\mathcal P}_1)$. - Case 2: $(B, E, \{C[t\textnormal{::}\,P\varsigma]\} \cup {\mathcal P}) \mathrel{\mathcal{R}}_1 (B', \allowbreak E, \allowbreak \{C[t[a,c,\varsigma]\textnormal{::}\,P]\} \cup {\mathcal P})$ and $(B, \allowbreak E, \allowbreak \{C[t\textnormal{::}\,P\varsigma]\} \cup {\mathcal P}) \xrightarrow{}\mathcal{C}_1$. If this reduction reduces only processes in ${\mathcal P}$, then the same reduction applies on the other side, much like in Case 1, and the reduced processes are in $\mathrel{\mathcal{R}}_1$. If this reduction reduces $C[t\textnormal{::}\,P\varsigma]$ and is not ${\ensuremath{\mbox{\sc (Red Bar')}}}$ for barrier $t$, then the same reduction also applies on the other side. If the reduction eliminates $t\textnormal{::}\,P\varsigma$ (so the reduction reduces $C[t\textnormal{::}\,P\varsigma]$ by ${\ensuremath{\mbox{\sc (Red Destr 1)}}}$ or ${\ensuremath{\mbox{\sc (Red Destr 2)}}}$), then the reduced processes are in $\mathrel{\mathcal{R}}_0$. Otherwise, the reduced processes are still in $\mathrel{\mathcal{R}}_1$, and any substitutions are applied to $\varsigma$. (By validity, $\mathsf{fv}(P) \subseteq \mathsf{dom}(\varsigma)$, so substitutions leave $P$ unchanged.) If this reduction is ${\ensuremath{\mbox{\sc (Red Bar')}}}$ for barrier $t$, then context $C[\_]$ is empty. (When $n$ barriers $t$ reduce, ${\mathcal P}_0 = \{C[t\textnormal{::}\,P\varsigma]\} \cup {\mathcal P}$ contains $n$ barriers $t$ at the top-level and $B$ contains $n$ barriers $t$. Since $\mathsf{barriers}({\mathcal P}_0)\subseteq B$ by validity, all barriers $t$ in ${\mathcal P}_0$ are at the top-level and are reduced.) The reduction transforms $t\textnormal{::}\,P\varsigma$ into $P\varsigma$. The same reduction also applies on the other side, and transforms $t[a,c,\varsigma]\textnormal{::}\,P$ into $P\varsigma$, so the reduced processes are in $\mathrel{\mathcal{R}}_0$. - Case 3: $(B', E, \{C[t[a,c,\varsigma]\textnormal{::}\,P]\} \cup {\mathcal P}) \mathrel{\mathcal{R}}_1^{-1} (B, E, \{C[t\textnormal{::}\,P\varsigma]\} \cup {\mathcal P})$ and $(B, \allowbreak E, \allowbreak \{C[t[a,c,\varsigma]\textnormal{::}\,P]\} \cup {\mathcal P}) \xrightarrow{}\mathcal{C}_1$. This case can be treated similarly to Case 2. Hence ${\mathrel{\mathcal{R}}_0 \cup \mathrel{\mathcal{R}}_1 \cup \mathrel{\mathcal{R}}_1^{-1}} \subseteq {\approx}$. Let $$\begin{aligned} &B = \mathsf{barriers}(C[t\textnormal{::}\,P\varsigma])\,,\\ &B' = \mathsf{barriers}(C[t[a,c,\varsigma]\textnormal{::}\,P])\,,\\ &E = \mathsf{channels}(B)\,\text{, and}\\ &E' = \mathsf{channels}(B') = E \cup \{a,c\}\,. \end{aligned}$$ We have $$\begin{aligned} &\mathcal{C}_{\textnormal{init}}(C[t\textnormal{::}\,P\varsigma]) = B, E, \{C[t\textnormal{::}\,P\varsigma]\}\text{ and}\\ &\mathcal{C}_{\textnormal{init}}(C[t[a,c,\varsigma]\textnormal{::}\,P]) = B', E', \{C[t[a,c,\varsigma]\textnormal{::}\,P]\}\,. \end{aligned}$$ By Lemma 2, these configurations are valid. Furthermore, since $B, E, \{C[t\textnormal{::}\,P\varsigma]\}$ is valid, $B, \allowbreak E',\allowbreak \{C[t\textnormal{::}\,P\varsigma]\}$ is a fortiori valid, and since $C[t[a,c,\varsigma]\textnormal{::}\,P]$ is valid, $$\mathsf{channels}(\mathsf{barriers}(C[t[a,c,\varsigma]\textnormal{::}\,P])) \cap \mathsf{fn\text{-}nobc}(C[t[a,c,\varsigma]\textnormal{::}\,P]) = \emptyset\,,$$ so $\{a,c\} \cap \mathsf{fn\text{-}nobc}(C[t\textnormal{::}\,P\varsigma]) = \emptyset$ and the elements of multiset $\mathsf{channels}(\mathsf{barriers}(C[t[a,c,\varsigma]\textnormal{::}\,P]))$ are pairwise distinct, so $\{a,c\} \cap \mathsf{channels}(\mathsf{barriers}(C[t\textnormal{::}\,P\varsigma])) = \emptyset$, so $\{a,c \} \cap \mathsf{fn}(C[t\textnormal{::}\,P\varsigma]) = \emptyset$. By Proposition 18, $$B, E, \{C[t\textnormal{::}\,P\varsigma]\} \approx B, E', \{C[t\textnormal{::}\,P\varsigma]\}\,.$$ By the result shown above, $$B, E', \{C[t\textnormal{::}\,P\varsigma]\} \approx B', E', \{C[t[a,c,\varsigma]\textnormal{::}\,P]\}\,,$$ so by transitivity of $\approx$, $$\mathcal{C}_{\textnormal{init}}(C[t\textnormal{::}\,P\varsigma]) \approx\mathcal{C}_{\textnormal{init}}(C[t[a,c,\varsigma]\textnormal{::}\,P])\,,$$ which proves the desired result. ◻
*Proof of Proposition 5.* Let us first show that $P'_0 = \mathsf{annotate}(P_0)$ is valid. The proof is done by induction on the number of transformation steps made from $P_0$. First, the process after 0 transformation steps, $P_0$ itself, is valid. Indeed, since $P_0$ is a closed standard biprocess, it contains no annotated barrier, hence it is valid. Moreover, if the process after $n$ transformation steps is valid, then so is the process after $n+1$ transformation steps, because the transformation performed by $\mathsf{annotate}$ preserves validity: if $C[t\textnormal{::}\,Q]$ is valid, then $C[t[a,c,\varsigma]\textnormal{::}\,Q']$ is also valid, as we show next. We can then conclude that $P'_0 = \mathsf{annotate}(P_0)$ is valid as well. Let us show that, if $C[t\textnormal{::}\,Q]$ is valid, then $C[t[a,c,\varsigma]\textnormal{::}\,Q']$ is also valid. We have $\mathsf{fv}(t[a,c,\varsigma]\textnormal{::}\,Q') = \mathsf{fv}(\mathsf{range}(\varsigma)) \cup (\mathsf{fv}(Q') \setminus \mathsf{dom}(\varsigma)) = \mathsf{fv}(Q'\varsigma) = \mathsf{fv}(Q)$ since $\mathsf{fv}(Q') = \mathsf{dom}(\varsigma)$ by Lemma 3. Therefore, if $C[t\textnormal{::}\,Q]$ is closed, then $C[t[a,c,\varsigma]\textnormal{::}\,Q']$ is also closed. Since barriers are transformed in a top-down order, the barriers in $Q$ and $Q'$ are standard, so we have $$\mathsf{channels}(\mathsf{barriers}(C[t[a,c,\varsigma]\textnormal{::}\,Q'])) = \{ a, c\} \cup \mathsf{channels}(\mathsf{barriers}(C[t\textnormal{::}\,Q]))\,.$$ Since $a$ and $c$ are distinct fresh names, the elements of $\mathsf{channels}(\mathsf{barriers}(C[t[a,c,\varsigma]\textnormal{::}\,Q']))$ are pairwise distinct, and $$\begin{split} &\mathsf{channels}(\mathsf{barriers}(C[t[a,c,\varsigma]\textnormal{::}\,Q'])) \cap \mathsf{fn\text{-}nobc}(C[t[a,c,\varsigma]\textnormal{::}\,Q']) \\ &\quad \subseteq (\{a, c\} \cup \mathsf{channels}(\mathsf{barriers}(C[t\textnormal{::}\,Q]))) \cap \mathsf{fn\text{-}nobc}(C[t\textnormal{::}\,Q]) = \emptyset\,. \end{split}$$ - For the transformed barrier, $a$ and $c$ are fresh names, so $C[\_]$ does not bind $a$ nor $c$ above the hole. Moreover, by Lemma 3, $\mathsf{fv}(Q') \subseteq \mathsf{dom}(\varsigma)$ and $C[\_]$ does not bind the names in $\mathsf{fn}(Q')$ above the hole, since $\mathsf{fn}(Q') = \emptyset$. - For the annotated barriers that already occur in $C[t\textnormal{::}\,Q]$, we have $C[t\textnormal{::}\,Q] = C'[t'[a',c',\varsigma']\textnormal{::}\,Q'']$. Since barriers are transformed in a top-down order, the barriers in $Q$ are standard, so the annotated barriers in question occur in $C[\_]$, and two cases may happen: - The transformed barrier is under $t'[a',c',\varsigma']$, inside $Q''$: $$\begin{aligned} C[t\textnormal{::}\,Q] &= C'[t'[a',c',\varsigma']\textnormal{::}\,C''[t\textnormal{::}\,Q]]\\ C[t[a,c,\varsigma]\textnormal{::}\,Q'] &= C'[t'[a',c',\varsigma']\textnormal{::}\,C''[t[a,c,\varsigma]\textnormal{::}\,Q']] \end{aligned}$$ for some context $C''[\_]$. Since $C'[t'[a',\allowbreak c',\allowbreak \varsigma']\textnormal{::}\,\allowbreak C''[t\textnormal{::}\,Q]]$ is valid, we have $\mathsf{fv}(C''[t\textnormal{::}\,Q]) \subseteq \mathsf{dom}(\varsigma')$ and $C'[\_]$ does not bind $a'$, $c'$, nor the names in $\mathsf{fn}(C''[t\textnormal{::}\,Q])$ above the hole. Furthermore, $\mathsf{fv}(t[a,c,\varsigma]\textnormal{::}\,Q') = \mathsf{fv}(Q) = \mathsf{fv}(t\textnormal{::}\,Q)$, so $\mathsf{fv}(C''[t[a,c,\varsigma]\textnormal{::}\,Q']) \subseteq \mathsf{dom}(\varsigma')$. Moreover, $$\begin{aligned} \mathsf{fn}(t[a,c,\varsigma]\textnormal{::}\,Q') &= \{a,c\} \cup \mathsf{fn}(Q'\varsigma)\\ &= \{a,c\} \cup \mathsf{fn}(Q) \\ &= \{a,c\} \cup \mathsf{fn}(t\textnormal{::}\,Q)\,, \end{aligned}$$ so $\mathsf{fn}(C''[t[a,c,\varsigma]\textnormal{::}\,Q']) = \{a,c\} \cup \mathsf{fn}(C''[t\textnormal{::}\,Q])$. Since $a$ and $c$ are fresh, they are not bound by $C'[\_]$, so $C'[\_]$ does not bind the names in $\mathsf{fn}(C''[t[a,c,\varsigma]\textnormal{::}\,Q'])$ above the hole. - The transformed barrier and the barrier $t'[a',c',\varsigma']$ are not under one another: $$\begin{aligned} C[t\textnormal{::}\,Q] &= C''[t'[a',c',\varsigma']\textnormal{::}\,Q'', t\textnormal{::}\,Q]\\ C[t[a,c,\varsigma]\textnormal{::}\,Q'] &= C''[t'[a',c',\varsigma']\textnormal{::}\,Q'', t[a,c,\varsigma]\textnormal{::}\,Q'] \end{aligned}$$ for some context $C''[\_,\_]$ with two holes. Since $C''[t'[a',c',\varsigma']\textnormal{::}\,Q'', t\textnormal{::}\,Q]$ is valid, we have $\mathsf{fv}(Q'') \subseteq \mathsf{dom}(\varsigma')$ and $C''[\_,\_]$ does not bind $a'$, $c'$, nor the names in $\mathsf{fn}(Q'')$ above its first hole. In all cases, $C[t[a,c,\varsigma]\textnormal{::}\,Q']$ is valid. From an annotated biprocess $P'_0 = \mathsf{annotate}(P_0)$, we can rebuild $P_0$ by replacing each occurrence of an annotated barrier $t[a,c,\varsigma]\textnormal{::}\,Q$ with $t\textnormal{::}\, Q\varsigma$, by Lemma 3. Therefore, we can also rebuild $\mathsf{fst}(P_0)$ from $\mathsf{fst}(P'_0)$ by replacing each occurrence of an annotated barrier $t[a,c,\varsigma]\textnormal{::}\,Q$ (in $\mathsf{fst}(P'_0)$) with $t\textnormal{::}\, Q\varsigma$. Furthermore, since validity is preserved by application of $\mathsf{fst}$ (Lemma 2), the considered processes are valid. Hence by applying several times Proposition 19 and by transitivity of $\approx$, we obtain that $\mathsf{fst}(P'_0) \approx \mathsf{fst}(P_0)$. We obtain $\mathsf{snd}(P'_0) \approx \mathsf{snd}(P_0)$ symmetrically. ◻
# Proof of Lemma 8 (barrier elimination commutes with renaming and substitution)

$$\begin{array}{r@{}l} \mathsf{bar\text{-}elim}(Q \mid R)\sigma & {}= (\mathsf{bar\text{-}elim}(Q) \mid \mathsf{bar\text{-}elim}(R)) \sigma \\ & {}= \mathsf{bar\text{-}elim}(Q)\sigma \mid \mathsf{bar\text{-}elim}(R) \sigma \\ & {}= \mathsf{bar\text{-}elim}(Q\sigma) \mid \mathsf{bar\text{-}elim}(R \sigma) \\ & {}= \mathsf{bar\text{-}elim}(Q\sigma \mid R \sigma) \\ & {}= \mathsf{bar\text{-}elim}((Q \mid R) \sigma) \\[0.55em] % \mathsf{bar\text{-}elim}(!Q)\sigma & {}= {(!\mathsf{bar\text{-}elim}(Q))\sigma} \\ & {}= {!(\mathsf{bar\text{-}elim}(Q)\sigma)} \\ & {}= {!\mathsf{bar\text{-}elim}(Q\sigma)} \\ & {}= \mathsf{bar\text{-}elim}(!(Q\sigma)) \\ & {}= \mathsf{bar\text{-}elim}((!Q)\sigma) \\[0.55em] % %%%%% % \mathsf{bar\text{-}elim}(\nu\,n.Q)\sigma & {}= (\nu\,n.\mathsf{bar\text{-}elim}(Q))\sigma \\%&&\textrm{by definition of $\compilerISymb$} \\ & {}= \nu\,n'.(\mathsf{bar\text{-}elim}(Q)\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\sigma)\\%&&\textrm{by application of $\sigma$} \\ & {}= \nu\,n'.(\mathsf{bar\text{-}elim}(Q\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\})\sigma)\\%&&\textrm{by Lemma~\ref{lem:substIbb}} \\ & {}= \nu\,n'.\mathsf{bar\text{-}elim}(Q\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\sigma)\\%&&\textrm{by induction hypothsis} \\ & {}= \mathsf{bar\text{-}elim}(\nu\,n'.(Q\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\sigma))\\%&&\textrm{by definition of $\compilerISymb$} \\ & {}= \mathsf{bar\text{-}elim}((\nu\,n.Q)\sigma)\\[0.55em]%&&\textrm{by application of $\sigma$} % %%%%% % \mathsf{bar\text{-}elim}(M(x).Q)\sigma & {}= (M(x).\mathsf{bar\text{-}elim}(Q))\sigma \\% &&\textrm{by definition of $\compilerISymb$}\\ & {}= M\sigma(x').(\mathsf{bar\text{-}elim}(Q)\{\textnormal{\raisebox{2pt}{\footnotesize $x'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\sigma) \\% &&\textrm{by application of $\sigma$} \\ & {}= M\sigma(x').\mathsf{bar\text{-}elim}(Q\{\textnormal{\raisebox{2pt}{\footnotesize $x'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\sigma) \\% &&\textrm{by induction hypothsis}\\ & {}= \mathsf{bar\text{-}elim}(M\sigma(x').(Q\{\textnormal{\raisebox{2pt}{\footnotesize $x'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\sigma)) \\% &&\textrm{by definition of $\compilerISymb$}\\ & {}= \mathsf{bar\text{-}elim}((M(x).Q)\sigma) \\[0.55em]%&&\textrm{by application of $\sigma$} \\ % %%%%% % \mathsf{bar\text{-}elim}(\overline{M}\langle N\rangle.Q)\sigma & {}= (\overline{M}\langle N\rangle.\mathsf{bar\text{-}elim}(Q))\sigma \\ & {}= \overline{M}\langle N\rangle\sigma.\mathsf{bar\text{-}elim}(Q)\sigma \\ & {}= \overline{M}\langle N\rangle\sigma.\mathsf{bar\text{-}elim}(Q\sigma) \\ & {}= \mathsf{bar\text{-}elim}(\overline{M}\langle N\rangle\sigma.Q\sigma) \\ & {}= \mathsf{bar\text{-}elim}((\overline{M}\langle N\rangle.Q)\sigma) \\[0.55em] % \mathsf{bar\text{-}elim}(\textnormal{let } x=D \textnormal{ in } Q \textnormal{ else }R)\sigma & {}= (\textnormal{let } x=D \textnormal{ in } \mathsf{bar\text{-}elim}(Q) \textnormal{ else }\mathsf{bar\text{-}elim}(R))\sigma \\ % &&\textrm{by definition of $\compilerISymb$}\\ & {} = \textnormal{let } x'=D\sigma \textnormal{ in } \mathsf{bar\text{-}elim}(Q)\{\textnormal{\raisebox{2pt}{\footnotesize $x'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\sigma \textnormal{ else }\mathsf{bar\text{-}elim}(R)\sigma \\ % &&\textrm{by application of $\sigma$} \\ & {}= \textnormal{let } x'=D\sigma \textnormal{ in } \mathsf{bar\text{-}elim}(Q\{\textnormal{\raisebox{2pt}{\footnotesize $x'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\sigma) \textnormal{ else }\mathsf{bar\text{-}elim}(R\sigma) \\ % &&\textrm{by induction hypothesis}\\ & {}= \mathsf{bar\text{-}elim}(\textnormal{let } x'=D\sigma \textnormal{ in } Q\{\textnormal{\raisebox{2pt}{\footnotesize $x'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\sigma \textnormal{ else }R\sigma) \\ % &&\textrm{by definition of $\compilerISymb$}\\ & {}= \mathsf{bar\text{-}elim}((\textnormal{let } x=D \textnormal{ in } Q \textnormal{ else }R)\sigma) % &&\textrm{by application of $\sigma$} \end{array}$$ $$\begin{array}{@{}l@{}} \mathsf{bar\text{-}elim}(t[a,c,(\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}} )]\textnormal{::}\,Q)\sigma\\ \quad= (\overline{a}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1,\dots,M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle.c(z).\textnormal{let } z_1=\pi_{1,n}(z) \textnormal{ in } \dots \textnormal{let } z_n=\pi_{n,n}(z) \textnormal{ in }\mathsf{bar\text{-}elim}(Q))\sigma \\ \quad= \overline{a}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1\sigma,\dots,M_n\sigma}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle.c(z).\textnormal{let } z'_1=\pi_{1,n}(z) \textnormal{ in } \dots \textnormal{let } z'_n=\pi_{n,n}(z) \textnormal{ in }\\ \quad\qquad\mathsf{bar\text{-}elim}(Q)\{\textnormal{\raisebox{2pt}{\footnotesize $z'_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}},\dots,\textnormal{\raisebox{2pt}{\footnotesize $z'_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}}\}\sigma \\ \quad= \overline{a}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1\sigma,\dots,M_n\sigma}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle.c(z).\textnormal{let } z'_1=\pi_{1,n}(z) \textnormal{ in } \dots \textnormal{let } z'_n=\pi_{n,n}(z) \textnormal{ in }\\ \quad\qquad\mathsf{bar\text{-}elim}(Q\{\textnormal{\raisebox{2pt}{\footnotesize $z'_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}},\dots,\textnormal{\raisebox{2pt}{\footnotesize $z'_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}}\}\sigma) \\ \quad= \mathsf{bar\text{-}elim}(t[a,c,(\textnormal{\raisebox{2pt}{\footnotesize $M_1\sigma$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z'_1$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n\sigma$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z'_n$}} )]\textnormal{::}\, Q\{\textnormal{\raisebox{2pt}{\footnotesize $z'_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}},\dots,\textnormal{\raisebox{2pt}{\footnotesize $z'_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}}\}\sigma) \\ \quad= \mathsf{bar\text{-}elim}((t[a,c,(\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}} )]\textnormal{::}\,Q)\sigma) \end{array}$$

Derivations for the inductive case of Lemma [lem:substIIb]
*Proof of Lemma [lem:substIIb].* Let us proceed by structural induction on $P$. In the base case, we derive $\mathsf{bar\text{-}elim}(0)\sigma = 0\sigma = 0 = \mathsf{bar\text{-}elim}(0) = \mathsf{bar\text{-}elim}(0\sigma)$ by definition of $\mathsf{bar\text{-}elim}$ and application of $\sigma$. The inductive cases (Figure 7) additionally apply the induction hypothesis. In Figure 7, we assume name $n'$ is fresh in the name restriction case; variable $x'$ is fresh in the input and expression evaluation cases; variables $z, z'_1, \dots, z'_n$ are fresh in the barrier case. We rename bound names and variables to fresh names and variables respectively, to avoid any name or variable capture. ◻
# Proof of Lemma 9 (barrier elimination preserves reduction)
*Proof of Lemma 9.* Suppose configurations $\mathcal{C}$, $\mathcal{C}'$, $\mathcal{C}_1$ and $\mathcal{C}'_1$ are given above. We proceed by case analysis of our reduction rules. First, we consider Property [prop1]. ${\ensuremath{\mbox{\sc (Red Nil)}}}$ In this case, ${\mathcal P}= {\mathcal P}_1 \cup \{0\}$ and $E = E_1$. It follows that $\mathsf{bar\text{-}elim}({\mathcal P}) = \mathsf{bar\text{-}elim}({\mathcal P}_1) \cup \{0\}$, hence, $\mathcal{C}'\xrightarrow{}\mathcal{C}_1'$. ${\ensuremath{\mbox{\sc (Red Repl)}}}$ In this case, $E = E_1$ and there exist a multiset of processes ${\mathcal P}_0$ and a process $R$ such that ${\mathcal P}= {\mathcal P}_0 \cup \{!R\}$ and ${\mathcal P}_1 = {\mathcal P}_0 \cup \{R,!R\}$. It follows that $\mathsf{bar\text{-}elim}({\mathcal P}) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\mathsf{bar\text{-}elim}(!R)\}$ and $\mathsf{bar\text{-}elim}({\mathcal P}_1) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\mathsf{bar\text{-}elim}(R),\mathsf{bar\text{-}elim}(!R)\}$. Moreover, since $\mathsf{bar\text{-}elim}(!R) = {!\mathsf{bar\text{-}elim}(R)}$, we have $\mathcal{C}' \xrightarrow{}\mathcal{C}_1'$. ${\ensuremath{\mbox{\sc (Red Par)}}}$ In this case, $E = E_1$ and there exist a multiset of processes ${\mathcal P}_0$ and processes $R$ and $R'$ such that ${\mathcal P}= {\mathcal P}_0 \cup \{R \mid R'\}$ and ${\mathcal P}_1 = {\mathcal P}_0 \cup \{R,R'\}$. It follows that $\mathsf{bar\text{-}elim}({\mathcal P}) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\mathsf{bar\text{-}elim}(R) \mid \mathsf{bar\text{-}elim}(R')\}$ and $\mathsf{bar\text{-}elim}({\mathcal P}_1) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\mathsf{bar\text{-}elim}(R), \mathsf{bar\text{-}elim}(R')\}$, hence, $\mathcal{C}' \xrightarrow{}\mathcal{C}_1'$. ${\ensuremath{\mbox{\sc (Red Res)}}}$ In this case, there exist a multiset of processes ${\mathcal P}_0$, a process $R$ and names $n$ and $n'$ such that ${\mathcal P}= {\mathcal P}_0 \cup \{\nu\,n.R\}$, $E_1 = E \cup \{n'\}$ and ${\mathcal P}_1 = {\mathcal P}_0 \cup \{R\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\}$, where $n'\not\in E \cup \mathsf{fn}({\mathcal P})$. It follows that $\mathsf{bar\text{-}elim}({\mathcal P}) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\nu\,n.\mathsf{bar\text{-}elim}(R)\}$ and $\mathsf{bar\text{-}elim}({\mathcal P}_1) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\mathsf{bar\text{-}elim}(R\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\})\}$. We have $\mathsf{bar\text{-}elim}(R\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}) = \mathsf{bar\text{-}elim}(R)\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}$ by , hence, $\mathcal{C}'\rightarrow\mathcal{C}'_1$. ${\ensuremath{\mbox{\sc (Red I/O)}}}$ In this case, $E = E_1$ and there exist a multiset of processes ${\mathcal P}_0$, processes $R$ and $R'$, terms $M$ and $N$, and a variable $x$ such that ${\mathcal P}= {\mathcal P}_0 \cup \{\overline{N}\langle M\rangle.R, \allowbreak N(x).R'\}$ and ${\mathcal P}_1 = {\mathcal P}_0 \cup \{R,R'\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}$. It follows that $\mathsf{bar\text{-}elim}({\mathcal P}) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\overline{N}\langle M\rangle.\mathsf{bar\text{-}elim}(R), \allowbreak N(x).\mathsf{bar\text{-}elim}(R')\}$ and $\mathsf{bar\text{-}elim}({\mathcal P}_1) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\mathsf{bar\text{-}elim}(R), \allowbreak \mathsf{bar\text{-}elim}(R'\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\})\}$. Moreover, we have $\mathsf{bar\text{-}elim}(\allowbreak{}R'\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}) = \mathsf{bar\text{-}elim}(R')\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}$ by , hence, $\mathcal{C}'\rightarrow\mathcal{C}'_1$. ${\ensuremath{\mbox{\sc (Red Destr 1)}}}$ In this case, $E = E_1$ and there exist a multiset of processes ${\mathcal P}_0$, processes $R$ and $R'$, an expression $D$, a term $M$, and a variable $x$ such that ${\mathcal P}= {\mathcal P}_0 \cup \{\textnormal{let } x=D \textnormal{ in } R \textnormal{ else }R'\}$ and ${\mathcal P}_1 = {\mathcal P}_0 \cup \{R\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}$, where $D\Downarrow M$. It follows that $\mathsf{bar\text{-}elim}({\mathcal P}) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\textnormal{let } x=D \textnormal{ in } \mathsf{bar\text{-}elim}(R) \textnormal{ else }\mathsf{bar\text{-}elim}(R')\}$ and $\mathsf{bar\text{-}elim}({\mathcal P}_1) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\mathsf{bar\text{-}elim}(R\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\})\}$. Moreover, we have $\mathsf{bar\text{-}elim}(R\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}) = \mathsf{bar\text{-}elim}(R)\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}$ by , hence, $\mathcal{C}'\rightarrow\mathcal{C}'_1$. ${\ensuremath{\mbox{\sc (Red Destr 2)}}}$ In this case, $E = E_1$ and there exist a multiset of processes ${\mathcal P}_0$, processes $R$ and $R'$, an expression $D$, and a variable $x$ such that ${\mathcal P}= {\mathcal P}_0 \cup \{\textnormal{let } x=D \textnormal{ in } R \textnormal{ else }R'\}$ and ${\mathcal P}_1 = {\mathcal P}_0 \cup \{R'\}$, where there is no $M$ such that $D\Downarrow M$. It follows that $\mathsf{bar\text{-}elim}({\mathcal P}) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\textnormal{let } x=D \textnormal{ in } \mathsf{bar\text{-}elim}(R) \textnormal{ else }\mathsf{bar\text{-}elim}(R')\}$ and $\mathsf{bar\text{-}elim}({\mathcal P}_1) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\mathsf{bar\text{-}elim}(R')\}$, hence, $\mathcal{C}' \xrightarrow{}\mathcal{C}_1'$. ${\ensuremath{\mbox{\sc (Red Bar')}}}$ By inspection of our reduction rules, the reduction $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ cannot apply ${\ensuremath{\mbox{\sc (Red Bar')}}}$, since $B$ remains constant in the configurations $\mathcal{C}$ and $\mathcal{C}_1$. Secondly, we consider Property [prop2]. ${\ensuremath{\mbox{\sc (Red Nil)}}}$ In this case, $E = E_1$, $0\in\mathsf{bar\text{-}elim}({\mathcal P})$, and ${\mathcal P}'_1 = \mathsf{bar\text{-}elim}({\mathcal P}) \backslash\{0\}$. By definition of $\mathsf{bar\text{-}elim}$ (Figure 6), it follows immediately that $0\in{\mathcal P}$ and hence $\mathcal{C}\xrightarrow{}\mathcal{C}_1$, where $\mathcal{C}_1 = B,E_1,{\mathcal Q}\cup {\mathcal P}_1$ and ${\mathcal P}_1 = {\mathcal P}\backslash\{0\}$. Moreover, since $\mathsf{bar\text{-}elim}(0) = 0$, we have ${\mathcal P}'_1 = \mathsf{bar\text{-}elim}({\mathcal P}_1)$. ${\ensuremath{\mbox{\sc (Red Repl)}}}$ In this case, $E = E_1$ and there exist a multiset of processes ${\mathcal P}'_0$ and a process $R$ such that $\mathsf{bar\text{-}elim}({\mathcal P}) = {\mathcal P}'_0 \cup \{!R\}$ and ${\mathcal P}'_1 = {\mathcal P}'_0 \cup \{R,{!R}\}$. So there are ${\mathcal P}_0$ and $R_0$ such that ${\mathcal P}= {\mathcal P}_0 \cup \{R_0\}$ with ${\mathcal P}'_0 = \mathsf{bar\text{-}elim}({\mathcal P}_0)$ and $!R = \mathsf{bar\text{-}elim}(R_0)$. By definition of $\mathsf{bar\text{-}elim}$ (Figure 6), there exists a process $\hat R$ such that $\mathsf{bar\text{-}elim}(\hat R) = R$ and $R_0 = !\hat R$, so ${\mathcal P}= {\mathcal P}_0 \cup \{!\hat R\}$. Let ${\mathcal P}_1 = {\mathcal P}_0 \cup \{\hat R, {! \hat R}\}$. It follows immediately that $\mathcal{C}\xrightarrow{}\mathcal{C}_1$, where $\mathcal{C}_1 = B,E_1,{\mathcal Q}\cup {\mathcal P}_1$ and ${\mathcal P}'_1 = \mathsf{bar\text{-}elim}({\mathcal P}_1)$. ${\ensuremath{\mbox{\sc (Red Par)}}}$ In this case, $E = E_1$ and there exist a multiset of processes ${\mathcal P}'_0$ and processes $R$ and $R'$ such that $\mathsf{bar\text{-}elim}({\mathcal P}) = {\mathcal P}'_0 \cup \{R \mid R'\}$ and ${\mathcal P}'_1 = {\mathcal P}'_0 \cup \{R,R'\}$. So there are ${\mathcal P}_0$ and $R_0$ such that ${\mathcal P}= {\mathcal P}_0 \cup \{R_0\}$ with ${\mathcal P}'_0 = \mathsf{bar\text{-}elim}({\mathcal P}_0)$ and $R \mid R' = \mathsf{bar\text{-}elim}(R_0)$. By definition of $\mathsf{bar\text{-}elim}$ (Figure 6), there exist processes $\hat R$ and $\hat R'$ such that $\mathsf{bar\text{-}elim}(\hat R) = R$, $\mathsf{bar\text{-}elim}(\hat R') = R'$, and $R_0 = \hat R \mid \hat R'$, so ${\mathcal P}= {\mathcal P}_0 \cup \{\hat R \mid \hat R'\}$. Let ${\mathcal P}_1 = {\mathcal P}_0 \cup \{\hat R,\hat R'\}$. It follows immediately that ${\mathcal P}'_1 = \mathsf{bar\text{-}elim}({\mathcal P}_1)$ and $\mathcal{C}\xrightarrow{}\mathcal{C}_1$, where $\mathcal{C}_1 = B,E_1,{\mathcal Q}\cup {\mathcal P}_1$. ${\ensuremath{\mbox{\sc (Red Res)}}}$ In this case, there exist a multiset of processes ${\mathcal P}'_0$, a process $R$ and names $n$ and $n'$ such that $E_1 = E \cup \{n'\}$, $\mathsf{bar\text{-}elim}({\mathcal P}) = {\mathcal P}'_0 \cup \{\nu\,n.R\}$, and ${\mathcal P}'_1 = {\mathcal P}'_0 \cup \{R\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\}$, where $n'\not\in E \cup \mathsf{fn}({\mathcal P}'_0 \cup \{\nu\,n.R\})$. So there are ${\mathcal P}_0$ and $R_0$ such that ${\mathcal P}= {\mathcal P}_0 \cup \{R_0\}$ with ${\mathcal P}'_0 = \mathsf{bar\text{-}elim}({\mathcal P}_0)$ and $\nu\,n.R = \mathsf{bar\text{-}elim}(R_0)$. By definition of $\mathsf{bar\text{-}elim}$ (Figure 6), there exists a process $\hat R$ such that $R = \mathsf{bar\text{-}elim}(\hat R)$ and $R_0 = \nu\,n.\hat R$, so ${\mathcal P}= {{\mathcal P}_0} \cup \{\nu\,n.\hat R\}$. Let ${\mathcal P}_1 = {\mathcal P}_0 \cup \{\hat R\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\}$. It follows that $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ and $\mathsf{bar\text{-}elim}({\mathcal P}_1) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\mathsf{bar\text{-}elim}(\hat R\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\})\}$. Moreover, we have ${\mathcal P}'_1 = \mathsf{bar\text{-}elim}({\mathcal P}_1)$ by . ${\ensuremath{\mbox{\sc (Red I/O)}}}$ In this case, $E = E_1$ and there exist a multiset of processes ${\mathcal P}'_0$, processes $R$ and $R'$, terms $M$ and $N$, and a variable $x$ such that $\mathsf{bar\text{-}elim}({\mathcal P}) = {\mathcal P}'_0 \cup \{\overline{N}\langle M\rangle.R, \allowbreak N(x).R'\}$ and ${\mathcal P}'_1 = {\mathcal P}'_0 \cup \{R,R'\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}$. So there are ${\mathcal P}_0$, $R_0$, and $R'_0$ such that ${\mathcal P}= {\mathcal P}_0 \cup \{R_0, R'_0\}$ with ${\mathcal P}'_0 = \mathsf{bar\text{-}elim}({\mathcal P}_0)$, $\overline{N}\langle M\rangle.R = \mathsf{bar\text{-}elim}(R_0)$, and $N(x).R' = \mathsf{bar\text{-}elim}(R'_0)$. By definition of $\mathsf{bar\text{-}elim}$ (Figure 6), $N(x).R' = \mathsf{bar\text{-}elim}(R'_0)$ implies $N(x).\hat R' = R'_0$ for some process $\hat R'$ such that $\mathsf{bar\text{-}elim}(\hat R') = R'$. Moreover, $\overline{N}\langle M\rangle.R = \mathsf{bar\text{-}elim}(R_0)$ implies: 1) there exists a process $\hat R$ such that $R_0 = \overline{N}\langle M\rangle.\hat R$, where $\mathsf{bar\text{-}elim}(\hat R) = R$; or 2) $N$ is a name and there exist a barrier $t$, name $c$, ordered substitution $\varsigma$, process $R''$, variable $z$, and integer $n$, such that $R_0 = t[N,c,\varsigma]\textnormal{::}\,R''$, and $R = c(z).\textnormal{let } z_1=\pi_{1,n}(z) \textnormal{ in } \cdots\ \textnormal{let } z_n=\pi_{n,n}(z) \textnormal{ in }\mathsf{bar\text{-}elim}(R'')$. In the first case, ${\mathcal P}= {\mathcal P}_0 \cup \{\overline{N}\langle M\rangle.\hat R, N(x).\hat R'\}$. Let ${\mathcal P}_1 = {\mathcal P}_0 \cup \{\hat R, \hat R'\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}$. It follows that $\mathcal{C}\xrightarrow{}\mathcal{C}_1$, where $\mathcal{C}_1 = B,E_1,{\mathcal Q}\cup {\mathcal P}_1$. Moreover, we have $\mathsf{bar\text{-}elim}(\hat R'\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}) = \mathsf{bar\text{-}elim}(\hat R')\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}$ by , hence, ${\mathcal P}'_1 = \mathsf{bar\text{-}elim}({\mathcal P}_1)$. We show that the second case cannot arise. Since $N$ is a name, we have $N \in \mathsf{fn\text{-}nobc}(N(x).\hat R') = \mathsf{fn\text{-}nobc}(R'_0) \subseteq \mathsf{fn\text{-}nobc}({\mathcal Q}\cup {\mathcal P})$. Furthermore, $N \in \mathsf{channels}(\mathsf{barriers}(t[N,c,\varsigma]\textnormal{::}\,R'')) = \mathsf{channels}(\mathsf{barriers}(R_0)) \subseteq \mathsf{channels}(\mathsf{barriers}({\mathcal Q}\cup {\mathcal P}))$ and since $\mathcal{C}$ is a valid configuration, we have $\mathsf{channels}(\mathsf{barriers}({\mathcal Q}\cup {\mathcal P})) \cap \mathsf{fn\text{-}nobc}({\mathcal Q}\cup {\mathcal P}) = \emptyset$, thereby deriving a contradiction. ${\ensuremath{\mbox{\sc (Red Destr 1)}}}$ In this case, $E = E_1$ and there exist a multiset of processes ${\mathcal P}'_0$, processes $R$ and $R'$, an expression $D$, a term $M$, and a variable $x$ such that $\mathsf{bar\text{-}elim}({\mathcal P}) = {\mathcal P}'_0 \cup \{\textnormal{let } x=D \textnormal{ in } R \textnormal{ else }R'\}$ and ${\mathcal P}'_1 = {\mathcal P}'_0 \cup \{R\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}$, where $D\Downarrow M$. So there are ${\mathcal P}_0$ and $R_0$ such that ${\mathcal P}= {\mathcal P}_0 \cup \{R_0\}$ with ${\mathcal P}'_0 = \mathsf{bar\text{-}elim}({\mathcal P}_0)$ and $\textnormal{let } x=D \textnormal{ in } R \textnormal{ else }R' = \mathsf{bar\text{-}elim}(R_0)$. By definition of $\mathsf{bar\text{-}elim}$ (Figure 6), there exist processes $\hat R$ and $\hat R'$ such that $\mathsf{bar\text{-}elim}(\hat R) = R$, $\mathsf{bar\text{-}elim}(\hat R') = R'$, and $R_0 = \textnormal{let } x=D \textnormal{ in } \hat R \textnormal{ else }\hat R'$, so ${\mathcal P}= {\mathcal P}_0 \cup \{\textnormal{let } x=D \textnormal{ in } \hat R \textnormal{ else }\hat R'\}$. Let ${\mathcal P}_1 = {\mathcal P}_0 \cup \{\hat R\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}\}$. It follows that $\mathcal{C}\xrightarrow{}\mathcal{C}_1$, where $\mathcal{C}_1 = B,E_1,{\mathcal Q}\cup {\mathcal P}_1$. Moreover, we have $\mathsf{bar\text{-}elim}({\mathcal P}_1) = \mathsf{bar\text{-}elim}({\mathcal P}_0) \cup \{\mathsf{bar\text{-}elim}(\hat R\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\})\}$. Furthermore, we have $\mathsf{bar\text{-}elim}(\hat R\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}) = \mathsf{bar\text{-}elim}(\hat R)\{\textnormal{\raisebox{2pt}{\footnotesize $M$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $x$}}\}$ by , hence, ${\mathcal P}'_1 = \mathsf{bar\text{-}elim}({\mathcal P}_1)$. ${\ensuremath{\mbox{\sc (Red Destr 2)}}}$ In this case, $E = E_1$ and there exist a multiset of processes ${\mathcal P}'_0$, processes $R$ and $R'$, an expression $D$, and a variable $x$ such that $\mathsf{bar\text{-}elim}({\mathcal P}) = {\mathcal P}'_0 \cup \{\textnormal{let } x=D \textnormal{ in } R \textnormal{ else }R'\}$ and ${\mathcal P}'_1 = {\mathcal P}'_0 \cup \{R'\}$, where there is no $M$ such that $D\Downarrow M$. So there are ${\mathcal P}_0$ and $R_0$ such that ${\mathcal P}= {\mathcal P}_0 \cup \{R_0\}$ with ${\mathcal P}'_0 = \mathsf{bar\text{-}elim}({\mathcal P}_0)$ and $\textnormal{let } x=D \textnormal{ in } R \textnormal{ else }R' = \mathsf{bar\text{-}elim}(R_0)$. By definition of $\mathsf{bar\text{-}elim}$ (Figure 6), there exist processes $\hat R$ and $\hat R'$ such that $\mathsf{bar\text{-}elim}(\hat R) = R$, $\mathsf{bar\text{-}elim}(\hat R') = R'$, and $R_0 = \textnormal{let } x=D \textnormal{ in } \hat R \textnormal{ else }\hat R'$, so ${\mathcal P}= {\mathcal P}_0 \cup \{\textnormal{let } x=D \textnormal{ in } \hat R \textnormal{ else }\hat R'\}$. Let ${\mathcal P}_1 = {\mathcal P}_0 \cup \{\hat R'\}$. It follows immediately that ${\mathcal P}'_1 = \mathsf{bar\text{-}elim}({\mathcal P}_1)$ and $\mathcal{C}\xrightarrow{}\mathcal{C}_1$, where $\mathcal{C}_1 = B,E_1,{\mathcal Q}\cup {\mathcal P}_1$. ${\ensuremath{\mbox{\sc (Red Bar')}}}$ By definition of $\mathsf{bar\text{-}elim}$, configuration $\mathcal{C}'$ does not contain barriers and therefore we do not consider applications of the rule ${\ensuremath{\mbox{\sc (Red Bar')}}}$.  ◻
# Proof of Proposition 7 (main proposition) We introduce some rudimentary results (), before proving the main technical result (Proposition 7). An *annotated configuration* is a configuration in which all processes are annotated.
**Lemma 20**. *Suppose $\mathcal{C}= B,E,{\mathcal P}$ is a valid annotated configuration such that $\mathsf{bar\text{-}elim}(P) = \overline{N}\langle M\rangle.Q$ for some processes $P \in {\mathcal P}$ and $Q$, and terms $M$ and $N$, where $\mathsf{fn}(N)\cap E = \emptyset$. We have $\mathcal{C}\downarrow_N$.*
*Proof.* By definition of $\mathsf{bar\text{-}elim}$, either: 1) $P = \overline{N}\langle M\rangle.R\in {\mathcal P}$ for some process $R$ such that $\mathsf{bar\text{-}elim}(R) = Q$; or 2) $P = t[N,c,\varsigma]\textnormal{::}\,R\in {\mathcal P}$ for some barrier $t$, channel name $c$, ordered substitution $\varsigma$, and process $R$. In the first case, it follows immediately that $\mathcal{C}\downarrow_N$. We show that the second case cannot arise. By definition of a valid configuration (Definition 4), $\mathsf{channels}(\mathsf{barriers}({\mathcal P})) \subseteq E$, so $N \in E$, which contradicts the assumption $\mathsf{fn}(N)\cap E = \emptyset$. ◻
We define $$\begin{aligned} &\textrm{add-lets}(Q) = \Bigl\{ \textnormal{let } z_j=\pi_{j,n}(\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1, \dots, M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}) \textnormal{ in } \cdots \textnormal{let } z_n=\pi_{n,n}(\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1, \dots, M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}) \textnormal{ in }Q' \\ &\quad \mathrel{\Big|} \begin{array}{l} 1 \leq j \leq n, Q = Q'\{\textnormal{\raisebox{2pt}{\footnotesize $M_j$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_j$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}}\}, M_1, \ldots, M_n \text{ ground terms}, \\ z_j, \dots, z_n \text{ pairwise distinct variables} \end{array} \Bigr\} \cup \{ Q \} \end{aligned}$$
**Lemma 21**. *Let $Q' \in \textrm{add-lets}(Q)$ and $B, E, {\mathcal P}\cup \{Q'\}$ be a valid configuration. We have $B, E, {\mathcal P}\cup \{Q'\} \xrightarrow{}^* B, E, {\mathcal P}\cup \{ Q\}$. Furthermore, if $Q' \neq Q$ and $B, E, {\mathcal P}\cup \{Q'\} \xrightarrow{}B, E, {\mathcal P}\cup \{Q''\}$ by reducing $Q'$, then $Q'' \in \textrm{add-lets}(Q)$.*
*Proof.* If $Q' = Q$, then we have obviously $B, E, {\mathcal P}\cup \{Q'\} \xrightarrow{}^* B, E, {\mathcal P}\cup \{ Q\}$, with no reduction. Otherwise, $$Q' = \textnormal{let } z_j=\pi_{j,n}(\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1, \dots, M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}) \textnormal{ in } \cdots \textnormal{let } z_n=\pi_{n,n}(\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1, \dots, M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}) \textnormal{ in }Q_1$$ where $Q = Q_1\{\textnormal{\raisebox{2pt}{\footnotesize $M_j$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_j$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}}\}$, $M_1, \ldots, M_n$ are ground terms, $z_j, \dots, z_n$ are pairwise distinct variables, and $1 \leq j \leq n$. Then $B, E, {\mathcal P}\cup \{Q'\} \xrightarrow{}^* B, E, {\mathcal P}\cup \{ Q\}$ by $n-j+1$ applications of ${\ensuremath{\mbox{\sc (Red Destr 1)}}}$. If $B, E, {\mathcal P}\cup \{Q'\} \xrightarrow{}B, E, {\mathcal P}\cup \{Q''\}$ by reducing $Q'$, then this reduction is obtained by one application of ${\ensuremath{\mbox{\sc (Red Destr 1)}}}$, so $$Q'' = \textnormal{let } z_{j+1}=\pi_{j+1,n}(\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1, \dots, M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}) \textnormal{ in } \cdots \textnormal{let } z_n=\pi_{n,n}(\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1, \dots, M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}) \textnormal{ in }Q_2$$ where $Q_2 = Q_1\{\textnormal{\raisebox{2pt}{\footnotesize $M_j$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_j$}}\}$, so $$\begin{aligned} Q & = Q_1\{\textnormal{\raisebox{2pt}{\footnotesize $M_j$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_j$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}}\}\\ & = Q_2\{\textnormal{\raisebox{2pt}{\footnotesize $M_{j+1}$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{j+1}$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}}\}\,. \end{aligned}$$ If $j
**Lemma 22**. *If $B, E, {\mathcal P}\cup \{ t[a,c,\varsigma]\textnormal{::}\,Q \}$ is a valid annotated configuration, then $c \notin \mathsf{fn}({\mathcal P}\cup \{ Q\varsigma \})$.*
*Proof.* By validity, the elements of multiset $\mathsf{channels}(B)$ are pairwise distinct. Since $\mathsf{channels}(B)$ contains $$\begin{aligned} \mathsf{channels}(\mathsf{barriers}( {\mathcal P}\cup \{ t[a,c,\varsigma]\textnormal{::}\,Q \})) & = \{a,c\} \cup \mathsf{channels}(\mathsf{barriers}({\mathcal P}\cup \{ Q \}))\\ & = \{a,c\} \cup \mathsf{channels}(\mathsf{barriers}({\mathcal P}\cup \{ Q\varsigma \}))\,, \end{aligned}$$ we have $c \notin \mathsf{channels}(\mathsf{barriers}({\mathcal P}\cup \{ Q\varsigma \}))$. Moreover $\mathsf{channels}(B) \cap \mathsf{fn\text{-}nobc}({\mathcal P}\cup\{ t[a,c,\varsigma]\textnormal{::}\,Q \}) = \emptyset$ so $c \notin \mathsf{fn\text{-}nobc}({\mathcal P}\cup\{ t[a,c,\varsigma]\textnormal{::}\,Q \}) \supseteq \mathsf{fn\text{-}nobc}({\mathcal P}\cup \{ Q \})\cup \mathsf{fn}(\mathsf{range}(\varsigma)) \supseteq \mathsf{fn\text{-}nobc}({\mathcal P}\cup \{ Q\varsigma \})$. Therefore, $c\notin \mathsf{fn}({\mathcal P}\cup \{ Q\varsigma \})$. ◻
These results allow us to prove Proposition 7.
*Proof of Proposition 7.* Suppose the configurations $\mathcal{C}_0$ and $\mathcal{C}'_0$ are given in Proposition 7. We will construct a symmetric relation $\mathrel{\mathcal{R}}$ such that $\mathsf{fst}(\mathcal{C}_0)\mathrel{\mathcal{R}}\mathsf{fst}(\mathcal{C}'_0)$, $\mathsf{snd}(\mathcal{C}_0)\mathrel{\mathcal{R}}\mathsf{snd}(\mathcal{C}'_0)$, and $\mathrel{\mathcal{R}}$ satisfies the three conditions of Definition 1. #### Relation $\mathrel{\mathcal{R}}$ We first define some functions $$\begin{aligned} &\mathsf{bar\text{-}elim}_{\textrm{in}}(\overline{c}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1, \dots, M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle,Q) = {}\\* &\quad \big\{ c(z).\textnormal{let } z_1=\pi_{1,n}(z) \textnormal{ in } \cdots \textnormal{let } z_n=\pi_{n,n}(z) \textnormal{ in }\mathsf{bar\text{-}elim}(Q')\\* &\qquad \mathrel{\big|} Q = Q'\{\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}}\}, z, z_1, \dots, z_n \text{ pairwise distinct variables} \big\}\\ &\mathsf{bar\text{-}elim}'_{\textrm{in}}(t[a,c,\varsigma]\textnormal{::}\,Q) = {}\\* &\quad \big\{ c(z).\textnormal{let } z_1=\pi_{1,n}(z) \textnormal{ in } \cdots \textnormal{let } z_n=\pi_{n,n}(z) \textnormal{ in }\mathsf{bar\text{-}elim}(Q) \\* &\qquad \mathrel{\big|} \varsigma = (\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}} \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}}), z \text{ variable different from }z_1, \dots, z_n \big\}\\ &\mathsf{swapper}_1(\emptyset) = \{ 0 \}\\ &\mathsf{swapper}_1(B) = {}\\* &\quad\begin{array}{@{}l@{}} \big\{a_1(x_1)\mathrel. \cdots \mathrel. a_n(x_n).\overline{c_1}\langle x_{f(1)}\rangle\mathrel. \cdots \mathrel. \overline{c_n}\langle x_{f(n)}\rangle.R\\ \big| \mathrel{} \textrm{$B = \{t[a_1,c_1,\tilde{z}_1]\textnormal{::}\, Q_1,\dots,t[a_n,c_n,\tilde{z}_n]\textnormal{::}\, Q_n\} \cup B'$,}\\ \quad\textrm{where $t'>t$ for all $t'[a,c,\tilde{z}]\textnormal{::}\,Q\in B'$;}\\ \quad\textrm{function $f$ is a permutation of $\{1,\dots,n\}$ such}\\ \quad\textrm{that $Q_l/\tilde{z}_l =_{\mathsf{ch}}Q_{f(l)}/\tilde{z}_{f(l)}$ for all $1 \leq l \leq n$;}\\ \quad\textrm{$R \in \mathsf{swapper}_1(B')$; and $x_1, \dots, x_n$ are pairwise distinct variables}\big\}\\ \textrm{if $B \neq \emptyset$} \end{array} \end{aligned}$$ The sets of processes $\mathsf{bar\text{-}elim}_{\textrm{in}}(\overline{c}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1, \dots, M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle,Q)$ and $\mathsf{bar\text{-}elim}'_{\textrm{in}}(t[a,c,\varsigma]\textnormal{::}\,Q)$ represent partially reduced compiled barriers: the output on channel $a$ has been executed but not the input on channel $c$. For $\mathsf{bar\text{-}elim}'_{\textrm{in}}(t[a,c,\varsigma]\textnormal{::}\,Q)$, this set is computed from the process $t[a,c,\varsigma]\textnormal{::}\,Q$ before reduction of the barrier. For $\mathsf{bar\text{-}elim}_{\textrm{in}}(\overline{c}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1, \dots, M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle,Q)$, this set is computed from the process $Q$ after reduction of the barrier. In this case, we need the additional argument $\overline{c}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1, \dots, M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle$ representing the message sent on channel $c$ to know how to compile the barrier. The function $\mathsf{swapper}_1(B)$ is similar to $\mathsf{swapper}(B)$ but produces only one component of the $\mathsf{diff}$. Let us consider the smallest relations $\mathrel{\mathcal{R}}_1$, $\mathrel{\mathcal{R}}_2$ and $\mathrel{\mathcal{R}}_3$ between configurations such that the conditions below are satisfied. 1. Suppose that $B, E, {\mathcal P}\cup {\mathcal Q}$ is a valid annotated configuration, ${\mathcal P}= \{P_1, \allowbreak \dots, \allowbreak P_m\}$, ${\mathcal Q}= \{t[a_1,c_1,\varsigma_1]\textnormal{::}\,Q_1,\allowbreak \dots,\allowbreak t[a_k,c_k,\varsigma_k]\textnormal{::}\,Q_k\}$, $\varsigma_l = (\textnormal{\raisebox{2pt}{\footnotesize $M_{l,1}$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{l,1}$}},\allowbreak \dots,\allowbreak \textnormal{\raisebox{2pt}{\footnotesize $M_{l,|\varsigma_l|}$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{l,|\varsigma_l|}$}})$ for all $l \leq k$, $B = \{t[a_1,c_1,\tilde{z}_1]\textnormal{::}\,Q_1,\allowbreak \dots,\allowbreak t[a_n,c_n,\tilde{z}_n]\textnormal{::}\,Q_n\} \cup B'$, $t' > t$ for all $t'[a',c',\tilde{z}']\textnormal{::}\,Q' \in B'$, $k \leq n$, and $\tilde{z}_{l} = (z_{l,1}, \dots, z_{l,|\tilde{z}_{l}|})$ for all $l \leq n$. Finally, suppose $f$ is a permutation of $\{1,\dots,n\}$ such that, for all $1\leq l \leq n$, we have $Q_l/\tilde{z}_l =_{\mathsf{ch}}Q_{f(l)}/\tilde{z}_{f(l)}$. Let ${\mathcal P}' = \{P'_1, \dots, P'_m\}$ and ${\mathcal Q}' = \{Q'_1, \dots, Q'_k\}$, where $P'_i \in \textrm{add-lets}(\mathsf{bar\text{-}elim}(P_i))$ for all $i \leq m$ and $Q'_i \in \mathsf{bar\text{-}elim}'_{\textrm{in}}(t[a_i,c_i,\varsigma_i]\textnormal{::}\,Q_i)$ for all $i \leq k$. We have $$\Big( B,E,{\mathcal P}\cup {\mathcal Q}\Big) \mathrel{\mathcal{R}}_1 \Big(\emptyset, E,{\mathcal P}' \cup {\mathcal Q}' \cup \{R\} \Big)$$ where $$\begin{split} R &{} \in \Bigl\{ a_{k+1}(x_{k+1})\mathrel.\cdots\mathrel.a_n(x_n)\mathrel. \overline{c_{1}}\langle {N_{f(1)}}\rangle\mathrel.\cdots\mathrel.\overline{c_n}\langle{N_{f(n)}}\rangle\mathrel.R' \\ &\Big|\begin{array}{l@{}} \textrm{$N_{l} = \mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_{l,1},\dots,M_{l,|\varsigma_{l}|}}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$ for all $l\leq k$; $N_{l} = x_l$ for all $l > k$;}\\ \textrm{$R' \in \mathsf{swapper}_1(B')$; and variables $x_{k+1},\allowbreak\dots,\allowbreak{}x_n$ are pairwise distinct} \end{array}\Bigr\} \end{split}$$ 2. Configuration $\mathcal{C}= B,E,{\mathcal P}\cup {\mathcal Q}$ is waiting to synchronise at barrier $t$ and configuration $\mathcal{C}' = \emptyset, E,{\mathcal P}' \cup {\mathcal Q}' \cup \{R\}$ represents an encoding of such a synchronisation with swapping. Multiset ${\mathcal Q}$ contains $k$ processes that are ready to synchronise at barrier $t$, while $n$ processes are needed for the synchronisation to take place. The multiset ${\mathcal P}$ may contain other processes that will synchronise at barrier $t$. In the configuration $\mathcal{C}'$, the communications that implement the barrier $t$ are partly done: the $k$ processes in ${\mathcal Q}'$, corresponding to the $k$ processes in ${\mathcal Q}$, have output messages on private channels and are awaiting input on private channels, i.e., the processes are ready to synchronise at $t$. Process $R$ has received $k$ private channel inputs and is awaiting for a further $n-k$ private inputs; once all inputs have been received, process $R$ will respond to all processes waiting to synchronise. 3. Suppose $B, E, {\mathcal P}\cup {\mathcal Q}$ is a valid annotated configuration, such that ${\mathcal P}= \{P_1, \dots, P_m\}$ and ${\mathcal Q}= \{Q_1, \dots, Q_k\}$. Let ${\mathcal P}' = \{P'_1, \ldots, P'_m\}$ and ${\mathcal Q}' = \{Q'_1, \dots, Q'_k\}$, where $P'_i \in \textrm{add-lets}(\mathsf{bar\text{-}elim}(P_i))$ for all $i \leq m$, and $Q'_i \in \mathsf{bar\text{-}elim}_{\textrm{in}}(\overline{c_i}\langle M_i\rangle,Q_i)$ for all $i \leq k$, for some pairwise distinct names $c_1, \dots, c_k$ in $E \setminus \mathsf{fn}({\mathcal P}\cup {\mathcal Q})$, and some ground tuples $M_1, \dots, M_k$. We have $$\Big( B,E,{\mathcal P}\cup {\mathcal Q}\Big) \mathrel{\mathcal{R}}_2 \Big(\emptyset, E,{\mathcal P}' \cup {\mathcal Q}' \cup \{ R\}\Big)$$ where $R \in \{\overline{c_1}\langle M_1\rangle\mathrel.\cdots\mathrel.\overline{c_k}\langle M_k\rangle\mathrel.R' \mid R' \in \mathsf{swapper}_1(B) \}$. 4. Configuration $\mathcal{C}= B,E,{\mathcal P}\cup {\mathcal Q}$ has just synchronised and configuration $\mathcal{C}' = \emptyset, E, {\mathcal P}' \cup {\mathcal Q}' \cup \{R\}$ represents an encoding of such a synchronisation with swapping. When $k > 0$, the communications that implement the last barrier upon which synchronisation happened are not fully done yet: $k$ outputs remain in $R$, and correspondingly ${\mathcal Q}'$ contains $k$ processes ready to receive these outputs. The condition $Q'_i \in \mathsf{bar\text{-}elim}_{\textrm{in}}(\overline{c_i}\langle M_i\rangle,Q_i)$ constrains $M_i$ to be a tuple of terms that occur in $Q_i$, so that $Q'_i$ reduces to $\mathsf{bar\text{-}elim}(Q_i)$ after receiving $M_i$ on channel $c_i$. 5. Suppose ${\mathcal P}= \{P_1, \ldots, P_m\}$ is a multiset of processes such that $\mathsf{barriers}({\mathcal P}) = \emptyset$, and $E$ is a set of names. Let ${\mathcal P}' = \{P'_1, \dots, P'_m\}$ be a multiset of processes, where $P'_i \in \textrm{add-lets}(P_i)$ for all $i \leq m$. We have: $$\Big(\emptyset, E, {\mathcal P}\Big) \mathrel{\mathcal{R}}_3 \Big(\emptyset, E, {\mathcal P}'\Big)$$ Let ${\mathrel{\mathcal{R}}} = {\mathrel{\mathcal{R}}_1 \cup \mathrel{\mathcal{R}}_2 \cup \mathrel{\mathcal{R}}_3 \cup \mathrel{\mathcal{R}}_1^{-1} \cup \mathrel{\mathcal{R}}_2^{-1} \cup \mathrel{\mathcal{R}}_3^{-1}}$. #### Relation $\mathrel{\mathcal{R}}$ relates $\mathsf{fst}(\mathcal{C}_0)$ with $\mathsf{fst}(\mathcal{C}'_0)$ and $\mathsf{snd}(\mathcal{C}_0)$ with $\mathsf{snd}(\mathcal{C}'_0)$ Recall that $\mathcal{C}_0 = B_0,E,\{P_0\}$ and $\mathcal{C}'_0 = \emptyset, E,\{\mathsf{bar\text{-}elim}(P_0), R_0\}$, where $B_0 = \mathsf{barriers}(P_0)$, $E = \mathsf{channels}(B_0)$, and $R_0\in\mathsf{swapper}(B_0)$. By Lemma 2, $\mathcal{C}_0 = \mathcal{C}_{\textnormal{init}}(P_0)$ is valid, so $\mathsf{fst}(\mathcal{C}_0)$ and $\mathsf{snd}(\mathcal{C}_0)$ are valid. We notice that, if $R_0 \in \mathsf{swapper}(B_0)$, then $\mathsf{fst}(R_0) \in \mathsf{swapper}_1(\mathsf{fst}(B_0))$, using the identity function for $f$, and $\mathsf{snd}(R_0) \in \mathsf{swapper}_1(\mathsf{snd}(B_0))$, using the same function $f$ as in the computation of $R_0 \in \mathsf{swapper}(B_0)$. Hence we have $\mathsf{fst}(\mathcal{C}_0)\mathrel{\mathcal{R}}_2\mathsf{fst}(\mathcal{C}'_0)$ with $B = \mathsf{fst}(B_0)$, $k = 0$, ${\mathcal P}= \{\mathsf{fst}(P_0)\}$, ${\mathcal P}' = \mathsf{bar\text{-}elim}({\mathcal P})$, ${\mathcal Q}' = {\mathcal Q}= \emptyset$, $R = \mathsf{fst}(R_0)$, and $\mathsf{snd}(\mathcal{C}_0) \mathrel{\mathcal{R}}_2 \mathsf{snd}(\mathcal{C}'_0)$ similarly using $\mathsf{snd}$ instead of $\mathsf{fst}$. #### Relation $\mathrel{\mathcal{R}}$ satisfies the conditions of Definition 1 The relation $\mathrel{\mathcal{R}}$ is symmetric and it remains to show that $\mathrel{\mathcal{R}}$ satisfies the three conditions of Definition 1. Let us first introduce the following results about our relation.
**Fact 1**. *Given configurations $\mathcal{C}= B,E,{\mathcal P}\cup {\mathcal Q}$ and $\mathcal{C}'$ such that $\mathcal{C}\mathrel{\mathcal{R}}_2 \mathcal{C}'$, we have $\mathcal{C}' \xrightarrow{}^* \emptyset, E, \mathsf{bar\text{-}elim}({\mathcal P}\cup{\mathcal Q}) \cup \{ R' \}$, where $R' \in \mathsf{swapper}_1(B)$.*
*Proof of Fact 1.* We use the notations of the definition of $\mathrel{\mathcal{R}}_2$. We transform $\mathcal{C}'$ by applying $\mbox{\sc (Red I/O)}$ $k$ times between $R$ and $Q'_i$ for $i$ from 1 to $k$. Then $R$ reduces into $R' \in \mathsf{swapper}_1(B)$ and $Q'_i$ reduces into an element of $\textrm{add-lets}(\mathsf{bar\text{-}elim}(Q_i))$. By Lemma 21, we reduce $P'_i$ into $\mathsf{bar\text{-}elim}(P_i)$ and further reduce $Q'_i$ into $\mathsf{bar\text{-}elim}(Q_i)$, so Fact 1 holds. ◻
**Fact 2**. *Given configurations $\mathcal{C}$, $\mathcal{C}'$, and $\mathcal{C}_1$ such that $\mathcal{C}\mathrel{\mathcal{R}}_1 \mathcal{C}'$ with $k = n$ and $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ by $\mbox{\sc (Red Bar')}$, we have $\mathcal{C}_1 \mathrel{\mathcal{R}}_2 \mathcal{C}'$.*
Fact 2 handles the swapping of data at barriers, so it is a key step of the proof.
*Proof of Fact 2.* We use the notations of the definition of $\mathrel{\mathcal{R}}_1$. Since ${\mathcal Q}$ contains $n$ barriers, we have $\mathcal{C}\xrightarrow{}\mathcal{C}_1 = B', E, {\mathcal P}\cup \{ Q_1\varsigma_1, \dots, Q_n\varsigma_n \}$ by $\mbox{\sc (Red Bar')}$. We have $\mathcal{C}' = \emptyset, E,{\mathcal P}' \cup {\mathcal Q}' \cup \{R\}$ and since $k = n$, we have $R = \overline{c_{1}}\langle {N_{f(1)}}\rangle\mathrel.\cdots\mathrel.\overline{c_n}\langle{N_{f(n)}}\rangle\mathrel.R'$ with $N_{l} = \mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_{l,1},\dots,M_{l,|\varsigma_{l}|}}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$ for all $l \leq n$ and $R' \in \mathsf{swapper}_1(B')$. Moreover, ${\mathcal Q}' = \{Q'_1, \dots, Q'_n\}$ with $Q'_i \in \mathsf{bar\text{-}elim}'_{\textrm{in}}(t[a_i,c_i,\varsigma_i]\textnormal{::}\,Q_i)$ for all $i \leq n$. Since for all $1\leq l \leq n$, $Q_l/\tilde{z}_l =_{\mathsf{ch}}Q_{f(l)}/\tilde{z}_{f(l)}$, we have $$Q_{l} \{\textnormal{\raisebox{2pt}{\footnotesize $y_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{l,1}$}},\dots,\textnormal{\raisebox{2pt}{\footnotesize $y_{|\tilde{z}_{l}|}$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{l,|\tilde{z}_{l}|}$}}\} =_{\mathsf{ch}} Q_{f(l)} \{\textnormal{\raisebox{2pt}{\footnotesize $y_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{f(l),1}$}},\dots,\textnormal{\raisebox{2pt}{\footnotesize $y_{|\tilde{z}_{l}|}$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{f(l),|\tilde{z}_{l}|}$}}\}\,,$$ where $y_1,\dots,y_{|\tilde{z}_l|}$ are fresh variables, so we have $$Q_{l} \{\textnormal{\raisebox{2pt}{\footnotesize $y_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{l,1}$}},\dots,\textnormal{\raisebox{2pt}{\footnotesize $y_{|\tilde{z}_{l}|}$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{l,|\tilde{z}_{l}|}$}}\} = Q_{f(l)} \{\textnormal{\raisebox{2pt}{\footnotesize $y_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{f(l),1}$}},\dots,\textnormal{\raisebox{2pt}{\footnotesize $y_{|\tilde{z}_{l}|}$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{f(l),|\tilde{z}_{l}|}$}}\}\rho_l\,,$$ for some renaming $\rho_l$ of channels of annotated barriers. (Recall that processes are considered equal modulo renaming of bound names and variables.) The renaming $\rho_l$ maps names in $\mathsf{channels}(\mathsf{barriers}(Q_{f(l)}))$ to names in $\mathsf{channels}(\mathsf{barriers}(Q_l))$. Since the names in $\mathsf{channels}(\mathsf{barriers}({\mathcal P}\cup {\mathcal Q}))$ are pairwise distinct, for $l \neq l'$, $\mathsf{channels}(\mathsf{barriers}(Q_l)) \cap \mathsf{channels}(\mathsf{barriers}(Q_{l'})) = \emptyset$, so we can merge all functions $\rho_l$ for $1 \leq l \leq n$ into a single function $\rho$. Since furthermore $f$ is a permutation, $\rho$ is a permutation of $\mathsf{channels}(B')$ and leaves other names unchanged. Since the names in $\mathsf{channels}(\mathsf{barriers}({\mathcal P}\cup {\mathcal Q}))$ are pairwise distinct, $\rho$ leaves unchanged the names in $\mathsf{channels}(\mathsf{barriers}({\mathcal P}))$ and $a_1$, $c_1$, …, $a_n$, $c_n$. Hence, we obtain $$\mathsf{bar\text{-}elim}(Q_{i}) \{\textnormal{\raisebox{2pt}{\footnotesize $y_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{i,1}$}},\dots,\textnormal{\raisebox{2pt}{\footnotesize $y_{|\tilde{z}_{i}|}$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{i,|\tilde{z}_{i}|}$}}\} = \mathsf{bar\text{-}elim}(Q_{f(i)})\{\textnormal{\raisebox{2pt}{\footnotesize $y_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{f(i),1}$}},\dots,\textnormal{\raisebox{2pt}{\footnotesize $y_{|\tilde{z}_{l}|}$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{f(i),|\tilde{z}_{l}|}$}}\}\rho$$ for all $i \leq n$ by Lemma 8, so $$\mathsf{bar\text{-}elim}'_{\textrm{in}}(t[a_i,c_i,\varsigma_i]\textnormal{::}\,Q_i) = \mathsf{bar\text{-}elim}'_{\textrm{in}}(t[a_i,c_i,\varsigma_{f(i)}]\textnormal{::}\,Q_{f(i)})\rho$$ for all $i \leq n$. (Recall that processes are considered equal modulo renaming of bound variables.) So $Q'_i \in \mathsf{bar\text{-}elim}'_{\textrm{in}}(t[a_i,c_i,\varsigma_{f(i)}]\textnormal{::}\,Q_{f(i)})\rho$. Therefore, $Q'_i \in \mathsf{bar\text{-}elim}_{\textrm{in}}(\overline{c_i}\langle N_{f(i)}\rangle,\allowbreak Q_{f(i)}\varsigma_{f(i)})\rho$, so $Q'_i \rho^{-1} \in \mathsf{bar\text{-}elim}_{\textrm{in}}(\overline{c_i}\langle N_{f(i)}\rangle,Q_{f(i)}\varsigma_{f(i)})$. We define ${\mathcal Q}_1 = \{ Q_{1}\varsigma_1,\allowbreak\dots,\allowbreak Q_n\varsigma_n \} = \{ Q_{f(1)} \varsigma_{f(1)}, \dots, Q_{f(n)} \varsigma_{f(n)} \}$ since $f$ is a permutation of $\{1,\dots,n\}$, ${\mathcal Q}'_1 = \{ Q'_1\rho^{-1}, \dots, Q'_n \rho^{-1}\} = {\mathcal Q}'\rho^{-1}$, and $R_1 = R\rho^{-1} = \overline{c_{1}}\langle {N_{f(1)}}\rangle\mathrel.\cdots\mathrel.\overline{c_n}\langle{N_{f(n)}}\rangle\mathrel.R'_1$, where $R'_1 = R'\rho^{-1} \in \mathsf{swapper}_1(B'\rho^{-1})$ since $R' \in \mathsf{swapper}_1(B')$. Moreover, $B'\rho^{-1} = B'$ since $\rho^{-1}$ maps a barrier of $Q_l$ to a barrier of $Q_{f(l)}$ for all $l \leq n$ and leaves other barriers unchanged. Therefore, $R'_1 \in \mathsf{swapper}_1(B')$. Moreover, since $\mathcal{C}$ is valid, the elements of $\mathsf{channels}(B)$ are pairwise distinct so $c_1, \dots, c_n$ are pairwise distinct names. By Lemma 22, for all $i \leq n$, $c_i \notin \mathsf{fn}(\{Q_i\varsigma_i\} \cup {\mathcal P}\cup {\mathcal Q}\setminus \{t[a_i,c_i,\varsigma_i]\textnormal{::}\,Q_i\}) \supseteq \mathsf{fn}({\mathcal P}\cup {\mathcal Q}_1)$. Furthermore, $c_1, \dots, c_n$ are in $\mathsf{channels}(B)$, so they are in $E$ since $\mathcal{C}$ is valid, hence they are in $E \setminus \mathsf{fn}({\mathcal P}\cup {\mathcal Q}_1)$. We have $\mathcal{C}' = (\emptyset, E, {\mathcal P}' \cup {\mathcal Q}' \cup \{R\}) = (\emptyset, E\rho^{-1}, {\mathcal P}' \rho^{-1}\cup {\mathcal Q}'\rho^{-1} \cup \{R\rho^{-1}\})$ since configurations are considered equal modulo renaming, so $\mathcal{C}' = (\emptyset, E, {\mathcal P}' \cup {\mathcal Q}'_1 \cup \{R_1\})$. It follows that $\mathcal{C}_1 = (B', E, {\mathcal P}\cup {\mathcal Q}_1) \mathrel{\mathcal{R}}_2 \mathcal{C}' = (\emptyset, E, {\mathcal P}' \cup {\mathcal Q}'_1 \cup \{R_1\})$ using $N_{f(i)}$ for $M_i$ for all $i \leq n$. ◻
We proceed with the proof of Proposition 7 by showing that $\mathrel{\mathcal{R}}$ satisfies the three conditions of Definition 1. #### Condition 1 We show that, if $\mathcal{C}\mathrel{\mathcal{R}}' \mathcal{C}'$ and $\mathcal{C}\downarrow_N$, then $\mathcal{C}'\xrightarrow{}^*\downarrow_N$, where $\mathrel{\mathcal{R}}' \in \{{\mathrel{\mathcal{R}}_1}, {\mathrel{\mathcal{R}}_2}, {\mathrel{\mathcal{R}}_3}, \mathrel{\mathcal{R}}_1^{-1}, \mathrel{\mathcal{R}}_2^{-1}, \mathrel{\mathcal{R}}_3^{-1}\}$, by distinguishing the following cases: ${\mathrel{\mathcal{R}}'}={\mathrel{\mathcal{R}}_1}$. In this case, $\mathcal{C}= B,E,{\mathcal P}\cup {\mathcal Q}$ and $\mathcal{C}' = \emptyset, E,{\mathcal P}'\cup {\mathcal Q}' \cup\{R\}$. By inspection of ${\mathcal P}\cup {\mathcal Q}$, we have $P_i = \overline{N}\langle M\rangle.Q \in {\mathcal P}$ for some index $i$, process $Q$, and term $M$, with $\mathsf{fn}(N) \cap E = \emptyset$. It follows that $\mathsf{bar\text{-}elim}(P_i) = \overline{N}\langle M\rangle.\mathsf{bar\text{-}elim}(Q)$ and by Lemma 21, $P'_i \in \textrm{add-lets}(\mathsf{bar\text{-}elim}(P_i))$ reduces into $\mathsf{bar\text{-}elim}(P_i)$ inside $\mathcal{C}'$, hence $\mathcal{C}'\xrightarrow{}^*\downarrow_N$. ${\mathrel{\mathcal{R}}'}={\mathrel{\mathcal{R}}_2}$. In this case, $\mathcal{C}= B,E,{\mathcal P}\cup {\mathcal Q}$, where $\overline{N}\langle M\rangle.Q\in{\mathcal P}\cup {\mathcal Q}$ for some process $Q$ and term $M$, with $\mathsf{fn}(N) \cap E = \emptyset$. It follows that $\overline{N}\langle M\rangle.\mathsf{bar\text{-}elim}(Q) \in \mathsf{bar\text{-}elim}({\mathcal P}\cup{\mathcal Q})$. By Fact 1, we have $\mathcal{C}' \xrightarrow{}^* \mathcal{C}'_1 = \emptyset, E,\mathsf{bar\text{-}elim}({\mathcal P}\cup{\mathcal Q}) \cup \{ R' \}$, where $R' \in \mathsf{swapper}_1(B)$ and, moreover, $\mathcal{C}'_1\downarrow_N$, hence, $\mathcal{C}'\xrightarrow{}^*\downarrow_N$. ${\mathrel{\mathcal{R}}'}={\mathrel{\mathcal{R}}_3}$. In this case, $\mathcal{C}= \emptyset, E, {\mathcal P}$ and $\mathcal{C}' = \emptyset, E, {\mathcal P}'$, where $P_i = \overline{N}\langle M\rangle.Q\in{\mathcal P}$ for some index $i$, process $Q$ and term $M$, with $\mathsf{fn}(N) \cap E = \emptyset$. We have $P'_i \in \textrm{add-lets}(P_i)$, so by Lemma 21, $P'_i$ reduces into $P_i$ inside $\mathcal{C}'$. It follows immediately that $\mathcal{C}'\xrightarrow{}^*\downarrow_N$. ${\mathrel{\mathcal{R}}'}={\mathrel{\mathcal{R}}_1^{-1}}$. In this case, $\mathcal{C}= \emptyset,E,{\mathcal P}' \cup {\mathcal Q}' \cup\{R\}$ and $\mathcal{C}' = B, E,{\mathcal P}\cup {\mathcal Q}$. We have $\overline{N}\langle M\rangle.Q \in {\mathcal P}'\cup {\mathcal Q}' \cup \{R\}$ for some process $Q$ and term $M$, with $\mathsf{fn}(N) \cap E = \emptyset$. The process $R$ cannot be the output $\overline{N}\langle M\rangle.Q$ because if $k \neq n$, then $R$ starts with an input and if $k = n$, then $R$ starts with an output on channel $c_1 \in E$ since $\mathsf{channels}(B) \subseteq E$. Therefore, by inspection of ${\mathcal P}' \cup {\mathcal Q}' \cup\{R\}$, we have $P'_i = \overline{N}\langle M\rangle.Q = \mathsf{bar\text{-}elim}(P_i) \in {\mathcal P}'$ for some index $i$, and $\mathcal{C}'\downarrow_N$ by . ${\mathrel{\mathcal{R}}'}={\mathrel{\mathcal{R}}_2^{-1}}$. In this case $\mathcal{C}= \emptyset,E,{\mathcal P}' \cup {\mathcal Q}' \cup \{R\}$ and $\mathcal{C}' = B, E,{\mathcal P}\cup{\mathcal Q}$. We have $\overline{N}\langle M\rangle.Q \in {\mathcal P}'\cup {\mathcal Q}' \cup \{R\}$ for some process $Q$ and term $M$, with $\mathsf{fn}(N) \cap E = \emptyset$. If $k > 0$, then $R$ starts with an output on $c_1\in E\setminus\mathsf{fn}({\mathcal P}\cup {\mathcal Q})$. It follows immediately that $N\neq c_1$, since $\mathsf{fn}(N) \cap E = \emptyset$. If $k = 0$, then $R$ is either 0 or starts with an input, so in all cases, $R$ does not start with the output $\overline{N}\langle M\rangle.Q$. Therefore, by inspection of ${\mathcal P}' \cup {\mathcal Q}' \cup\{R\}$, we have $P'_i = \overline{N}\langle M\rangle.Q = \mathsf{bar\text{-}elim}(P_i) \in {\mathcal P}'$ for some index $i$, and $\mathcal{C}'\downarrow_N$ by . ${\mathrel{\mathcal{R}}'}={\mathrel{\mathcal{R}}_3^{-1}}$. In this case, $\mathcal{C}= \emptyset, E, {\mathcal P}'$ and $\mathcal{C}' = \emptyset, E, {\mathcal P}$. By inspection of ${\mathcal P}'$, it follows that $P'_i = \overline{N}\langle M\rangle.Q = P_i \in{\mathcal P}$ for some index $i$, process $Q$, and term $M$, with $\mathsf{fn}(N) \cap E = \emptyset$, and, hence, $\mathcal{C}'\downarrow_N$. #### Condition 2 We show that, if $\mathcal{C}\mathrel{\mathcal{R}}' \mathcal{C}'$ and $\mathcal{C}\xrightarrow{}\mathcal{C}_1$, then $\mathcal{C}'\xrightarrow{}^*\mathcal{C}'_1$ and $\mathcal{C}_1 \mathrel{\mathcal{R}}\mathcal{C}'_1$ for some $\mathcal{C}'_1$, where $\mathrel{\mathcal{R}}' \in \{{\mathrel{\mathcal{R}}_1}, {\mathrel{\mathcal{R}}_2}, {\mathrel{\mathcal{R}}_3}, \mathrel{\mathcal{R}}_1^{-1}, \mathrel{\mathcal{R}}_2^{-1}, \mathrel{\mathcal{R}}_3^{-1}\}$, by distinguishing the following cases: ${\mathrel{\mathcal{R}}'}={\mathrel{\mathcal{R}}_1}$. We have $\mathcal{C}= B,E,{\mathcal P}\cup {\mathcal Q}$ and $\mathcal{C}' = \emptyset, E, {\mathcal P}'\cup {\mathcal Q}' \cup\{ R\}$, with the conditions given in the definition of $\mathrel{\mathcal{R}}_1$. Let us distinguish two cases: - Case I: $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ by ${\ensuremath{\mbox{\sc (Red Bar')}}}$. In this case, $\mathcal{C}= B, E, {\mathcal P}\cup {\mathcal Q}$, ${\mathcal Q}= \{t[a_1,c_1, \varsigma_1]\textnormal{::}\,Q_1,\allowbreak\dots,\allowbreak t[a_k,c_k,\varsigma_k]\textnormal{::}\,Q_k\}$, ${\mathcal P}= {\mathcal P}_1 \cup \{ t[a_{k+1},c_{k+1}, \varsigma_{k+1}]\textnormal{::}\,Q_{k+1},\allowbreak\dots,\allowbreak t[a_n,c_n,\varsigma_n]\textnormal{::}\,Q_n\}$, and $\mathcal{C}_1 =B',E,{\mathcal P}_1 \cup \{Q_{1}\varsigma_1,\dots,Q_n\varsigma_n\}$, where $B' = B \setminus \{t[a_1,c_1,\tilde{z}_1]\textnormal{::}\, Q_1,\dots,t[a_n,c_n,\tilde{z}_n]\textnormal{::}\, Q_n\}$ and $\tilde{z}_i = \mathsf{ordom}(\varsigma_i)$ for all $i \leq n$. For a suitable numbering of processes, we have $P_i = t[a_{k+i},c_{k+i}, \varsigma_{k+i}]\textnormal{::}\,Q_{k+i}$ for $i = 1, \dots, n-k$ and ${\mathcal P}_1 = \{P_{n-k+1}, \dots, P_m\}$. Since $\mathcal{C}\mathrel{\mathcal{R}}_1 \mathcal{C}'$, we have $\mathcal{C}' = \emptyset, E, {\mathcal P}' \cup {\mathcal Q}' \cup \{R\}$ where ${\mathcal P}' = \{P'_1, \dots, P'_m\}$ with $P'_i \in \textrm{add-lets}(\mathsf{bar\text{-}elim}(P_i))$ for all $i \leq m$ and ${\mathcal Q}' = \{Q'_1, \dots, Q'_k\}$ with $Q'_i \in \mathsf{bar\text{-}elim}'_{\textrm{in}}(t[a_i,c_i,\varsigma_i]\textnormal{::}\,Q_i)$ for all $i \leq k$. By Lemma 21, we can reduce the lets so that $\mathcal{C}' \xrightarrow{}^* \mathcal{C}'_2 = \emptyset, E, {\mathcal P}'_2 \cup {\mathcal Q}' \cup \{R\}$ where ${\mathcal P}'_2 = \{P''_1, \dots, P''_m\}$ with $P''_i = \mathsf{bar\text{-}elim}(P_i)$ for all $i \leq m$. Furthermore, we can reduce each $P''_i \in \mathsf{bar\text{-}elim}(t[a_{k+i},c_{k+i}, \varsigma_{k+i}]\textnormal{::}\,Q_{k+i})$ for $i = 1, \dots, n-k$ with $R$ by $\mbox{\sc (Red I/O)}$, so that $\mathcal{C}'_2 \xrightarrow{}^{n-k} \mathcal{C}'_1 = \emptyset, E, {\mathcal P}'_1 \cup {\mathcal Q}'_1 \cup \{R_1\}$, where ${\mathcal P}'_1 = \{ P''_{n-k+1}, \ldots, P''_m\}$ with $P''_i = \mathsf{bar\text{-}elim}(P_i)$ for $i = n-k+1, \dots, m$, ${\mathcal Q}'_1 = \{Q'_1, \dots, Q'_n\}$ with $Q'_i \in \mathsf{bar\text{-}elim}'_{\textrm{in}}(t[a_i,c_i,\varsigma_i]\textnormal{::}\,Q_i)$ for all $i \leq n$, and $R_1 = \overline{c_{1}}\langle {N_{f(1)}}\rangle.\cdots.\overline{c_n}\langle{N_{f(n)}}\rangle.R'$ where $N_{l} = \mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_{l,1},\dots,M_{l,|\varsigma_{l}|}}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$ for all $l \leq n$ and $R' \in \mathsf{swapper}_1(B')$. After these reductions, we obtain $\mathcal{C}\mathrel{\mathcal{R}}_1 \mathcal{C}'_1$ with $k = n$. By Fact 2, we have $\mathcal{C}_1 \mathrel{\mathcal{R}}_2 \mathcal{C}'_1$. Therefore, $\mathcal{C}_1 \mathrel{\mathcal{R}}\mathcal{C}'_1$ and $\mathcal{C}' \xrightarrow{}^* \mathcal{C}'_1$. - Case II: $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ without application of ${\ensuremath{\mbox{\sc (Red Bar)}}}$. By inspection of our reduction rules, the reduction $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ is obtained by reducing processes in ${\mathcal P}$ and $\mathcal{C}_1 = B,E_1,{\mathcal P}_1 \cup {\mathcal Q}$ for some multiset of processes ${\mathcal P}_1$ and set of names $E_1$. By Lemma 21, we can reduce the lets in ${\mathcal P}'$ so that $\mathcal{C}' \rightarrow^* \mathcal{C}'_2 = B, E_1, \mathsf{bar\text{-}elim}({\mathcal P}) \cup {\mathcal Q}' \cup \{R\}$. By Lemma 9[prop1], $\mathcal{C}'_2\xrightarrow{}\mathcal{C}'_1$, where $\mathcal{C}'_1 = \emptyset,E_1, \mathsf{bar\text{-}elim}({\mathcal P}_1)\cup {\mathcal Q}' \cup \{ R \}$. Hence, $\mathcal{C}_1\mathrel{\mathcal{R}}_1\mathcal{C}'_1$ (with $k$, $n$, $f$ unchanged), therefore, $\mathcal{C}_1 \mathrel{\mathcal{R}}\mathcal{C}_1'$ and $\mathcal{C}' \xrightarrow{}^* \mathcal{C}'_1$. ${\mathrel{\mathcal{R}}'} = {\mathrel{\mathcal{R}}_2}$. We have $\mathcal{C}= B,E,{\mathcal P}\cup {\mathcal Q}$ and $\mathcal{C}' = \emptyset, E, {\mathcal P}' \cup {\mathcal Q}' \cup \{ R\}$, with the conditions given in the definition of $\mathrel{\mathcal{R}}_2$. By Fact 1, we have $\mathcal{C}' \xrightarrow{}^* \mathcal{C}'_2 = \emptyset, E,\mathsf{bar\text{-}elim}({\mathcal P}\cup{\mathcal Q})\cup\{ R'\}$, where $R' \in \mathsf{swapper}_1(B)$. - Case I: $B = \emptyset$. Since $\mathcal{C}$ is a valid configuration, we have $\mathsf{barriers}({\mathcal P}\cup{\mathcal Q}) \subseteq B$, so ${\mathcal P}$ and ${\mathcal Q}$ contain no barrier, therefore, ${\mathcal P}\cup {\mathcal Q}= \mathsf{bar\text{-}elim}({\mathcal P}\cup{\mathcal Q})$ by definition of $\mathsf{bar\text{-}elim}$ (Figure 6). By definition of $\mathsf{swapper}_1$, we have $R' = \{0\}$. Hence, $\mathcal{C}' \xrightarrow{}^* \mathcal{C}'_2 = \emptyset, E,{\mathcal P}\cup{\mathcal Q}\cup\{ 0\} \xrightarrow{}\mathcal{C}= \emptyset, E,{\mathcal P}\cup{\mathcal Q}$. Since $\mathcal{C}\xrightarrow{}\mathcal{C}_1$, we have $\mathcal{C}' \xrightarrow{}^* \mathcal{C}_1$. Moreover, we have $\mathcal{C}_1 \mathrel{\mathcal{R}}_3 \mathcal{C}_1$, so $\mathcal{C}_1 \mathrel{\mathcal{R}}\mathcal{C}_1$, and we conclude with $\mathcal{C}'_1 = \mathcal{C}_1$. - Case II: $B \neq \emptyset$. We have $\mathcal{C}\mathrel{\mathcal{R}}_1 \mathcal{C}'_2$ with $k = 0$ by expanding the definition of $\mathsf{swapper}_1(B)$, and we conclude by the case ${\mathrel{\mathcal{R}}'} = {\mathrel{\mathcal{R}}_1}$ above. ${\mathrel{\mathcal{R}}'} = {\mathrel{\mathcal{R}}_3}$. We have $\mathcal{C}= \emptyset,E,{\mathcal P}$ and $\mathcal{C}' = \emptyset, E,{\mathcal P}'$ with $\mathsf{barriers}({\mathcal P}) = \emptyset$ and $P'_i \in \textrm{add-lets}(P_i)$ for all $i \leq m$. By Lemma 21, we can reduce the lets in ${\mathcal P}'$ so that $\mathcal{C}' \xrightarrow{}^* \mathcal{C}= \emptyset, E,{\mathcal P}$. Since $\mathcal{C}\xrightarrow{}\mathcal{C}_1$, we have $\mathcal{C}' \xrightarrow{}^* \mathcal{C}_1$. Moreover, we have $\mathcal{C}_1 \mathrel{\mathcal{R}}_3 \mathcal{C}_1$, so $\mathcal{C}_1 \mathrel{\mathcal{R}}\mathcal{C}_1$, and we conclude with $\mathcal{C}'_1 = \mathcal{C}_1$. ${\mathrel{\mathcal{R}}'} = {\mathrel{\mathcal{R}}_1^{-1}}$. We have $\mathcal{C}= \emptyset, E,{\mathcal P}' \cup {\mathcal Q}' \cup \{R\}$ and $\mathcal{C}' = B,E,{\mathcal P}\cup {\mathcal Q}$, with the conditions given in the definition of $\mathrel{\mathcal{R}}_1$. - Case I: $k = n$. Since ${\mathcal Q}$ contains $n$ barriers, we have $\mathcal{C}' \xrightarrow{}\mathcal{C}'_2 = B', E, {\mathcal P}\cup \{ Q_1\varsigma_1, \dots, Q_n\varsigma_n \}$ by $\mbox{\sc (Red Bar')}$. By Fact 2, we have $\mathcal{C}'_2 \mathrel{\mathcal{R}}_2 \mathcal{C}$, so we conclude by the case ${\mathrel{\mathcal{R}}'} = {\mathrel{\mathcal{R}}_2^{-1}}$ (below). - Case II: $k < n$. - Case II.1: $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ by reducing at least $R$. Since $R$ starts with an input on $a_{k+1}$, it can only reduce by $\mbox{\sc (Red I/O)}$ with an output on $a_{k+1}$. The processes in ${\mathcal Q}'$ start with an input, so they cannot reduce with $R$. Hence $R$ reduces with a process $P'_i \in \textrm{add-lets}(\mathsf{bar\text{-}elim}(P_i))$ in ${\mathcal P}'$. If $P'_i$ starts with a let, it cannot reduce by $\mbox{\sc (Red I/O)}$, so we have $P'_i = \mathsf{bar\text{-}elim}(P_i)$. Since $a_{k+1} \in \mathsf{channels}(B)$ and $\mathcal{C}'$ is valid, $a_{k+1} \notin \mathsf{fn\text{-}nobc}({\mathcal P}\cup {\mathcal Q})$, so $a_{k+1}$ occurs free in ${\mathcal P}\cup {\mathcal Q}$ only as channel of a barrier in ${\mathcal P}\cup {\mathcal Q}$. Since $P'_i = \mathsf{bar\text{-}elim}(P_i)$ starts with an output on $a_{k+1}$ and $\mathsf{barriers}(P_i) \subseteq B$, we have $P_i = t[a_{k+1},c_{k+1},\varsigma_{k+1}]\textnormal{::}\,Q_{k+1}$ for some $\varsigma_{k+1} = (\textnormal{\raisebox{2pt}{\footnotesize $M_{k+1,1}$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{k+1,1}$}}, \allowbreak \dots, \allowbreak \textnormal{\raisebox{2pt}{\footnotesize $M_{k+1,|\varsigma_{k+1}|}$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_{k+1,|\varsigma_{k+1}|}$}})$. Let $N'_{k+1} = \mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_{k+1,1},\dots,M_{k+1,|\varsigma_{k+1}|}}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$ and for all $l \neq k+1$, $N'_l = N_l$. We have $$\begin{aligned} P'_i = {}&\overline{a_{k+1}}\langle N'_{k+1}\rangle.c_{k+1}(z). \textnormal{let } z_{k+1,1}=\pi_{1,|\varsigma_{k+1}|}(z) \textnormal{ in }\ \cdots\\ &\textnormal{let } z_{k+1,|\varsigma_{k+1}|}=\pi_{|\varsigma_{k+1}|,|\varsigma_{k+1}|}(z) \textnormal{ in } \mathsf{bar\text{-}elim}(Q_{k+1})\,. \end{aligned}$$ Let $$\begin{aligned} Q'_{k+1} &= c_{k+1}(z).\textnormal{let } z_{k+1,1}=\pi_{1,|\varsigma_{k+1}|}(z) \textnormal{ in }\cdots\\ &\phantom{{} = {}}\textnormal{let } z_{k+1,|\varsigma_{k+1}|}=\pi_{|\varsigma_{k+1}|,|\varsigma_{k+1}|}(z) \textnormal{ in } \mathsf{bar\text{-}elim}(Q_{k+1})\\ & \in \mathsf{bar\text{-}elim}'_{\textrm{in}}(t[a_{k+1},c_{k+1},\varsigma_{k+1}]\textnormal{::}\,Q_{k+1})\,. \end{aligned}$$ After reduction by $\mbox{\sc (Red I/O)}$, $P'_i$ becomes $Q'_{k+1}$ and $R$ becomes $R_1 = a_{k+2}(x_{k+2})\mathrel.\cdots\mathrel.a_n(x_n)\mathrel.\overline{c_{1}}\langle {N'_{f(1)}}\rangle\mathrel.\cdots\mathrel.\overline{c_n}\langle{N'_{f(n)}}\rangle\mathrel.R'$. Let ${\mathcal P}_1 = {\mathcal P}\setminus \{P_i\}$, ${\mathcal Q}_1 = {\mathcal Q}' \cup \{P_i\} = {\mathcal Q}' \cup \{ t[a_{k+1},c_{k+1},\varsigma_{k+1}]\textnormal{::}\,Q_{k+1} \}$, ${\mathcal P}'_1 = {\mathcal P}' \setminus \{ P'_i\}$, and ${\mathcal Q}'_1 = {\mathcal Q}' \cup \{Q'_{k+1}\}$. Then we have $\mathcal{C}= (\emptyset, E,{\mathcal P}' \cup {\mathcal Q}' \cup \{R\}) \xrightarrow{}\mathcal{C}_1 = (\emptyset, E, {\mathcal P}'_1 \cup {\mathcal Q}'_1 \cup \{R_1\})$ and $\mathcal{C}' = (B, E, {\mathcal P}_1 \cup {\mathcal Q}_1) \mathrel{\mathcal{R}}_1 \mathcal{C}_1 = (\emptyset, E, {\mathcal P}'_1 \cup {\mathcal Q}'_1 \cup \{R_1\})$ (with $m$ decreased by one, $k$ increased by one, and $f$ unchanged), so we conclude with $\mathcal{C}'_1 = \mathcal{C}'$. - Case II.2: $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ by reducing at least a process in ${\mathcal Q}'$. Since we reduce $Q'_i \in {\mathcal Q}'$, which starts with an input on $c_i$, this process can only reduce by $\mbox{\sc (Red I/O)}$, with an output on $c_i$. If it reduced with $P'_j \in {\mathcal P}'$, since $P'_j \in \textrm{add-lets}(\mathsf{bar\text{-}elim}(P_j))$, we would actually have $P'_j = \mathsf{bar\text{-}elim}(P_j)$. Since $\mathcal{C}$ is valid, by Lemma 22, $c_i \notin \mathsf{fn}({\mathcal P})$, so $c_i \notin \mathsf{fn}(P'_j) = \mathsf{fn}(\mathsf{bar\text{-}elim}(P_j)) = \mathsf{fn}(P_j)$, hence $Q'_i$ cannot reduce with a process $P'_j \in {\mathcal P}'$. It also cannot reduce with $R$ or with another process in ${\mathcal Q}'$ since they start with an input. Therefore, this case cannot happen. - Case II.3: $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ by reducing only processes in ${\mathcal P}'$. - Case II.3.1: a reduced process is $P'_i \neq \mathsf{bar\text{-}elim}(P_i)$. We have $P'_i \in \textrm{add-lets}(\allowbreak\mathsf{bar\text{-}elim}(\allowbreak{}P_i))$. By Lemma 21, $\mathcal{C}_1 = \emptyset, E,({\mathcal P}' \setminus \{P'_i\}) \cup \{P''_i\} \cup {\mathcal Q}' \cup \{R\}$ with $P''_i \in \textrm{add-lets}(\mathsf{bar\text{-}elim}(P_i))$, so we still have $\mathcal{C}' \mathrel{\mathcal{R}}_1 \mathcal{C}_1$, so we conclude with $\mathcal{C}'_1 = \mathcal{C}'$. - Case II.3.2: the reduced process(es) are $P'_i = \mathsf{bar\text{-}elim}(P_i)$ and possibly $P'_j = \mathsf{bar\text{-}elim}(P_j)$. Let ${\mathcal P}_{\textnormal{red}}' = \{P'_i\}$ or ${\mathcal P}_{\textnormal{red}}' = \{P'_i, P'_j\}$ be the multiset of reduced processes, such that ${\mathcal P}_{\textnormal{red}}' = \mathsf{bar\text{-}elim}({\mathcal P}_{\textnormal{red}})$, ${\mathcal P}' = {\mathcal P}_{\textnormal{stay}}' \cup {\mathcal P}_{\textnormal{red}}'$, ${\mathcal P}= {\mathcal P}_{\textnormal{stay}}\cup {\mathcal P}_{\textnormal{red}}$. We have $\mathcal{C}= (\emptyset, E, {\mathcal P}_{\textnormal{stay}}' \cup \mathsf{bar\text{-}elim}({\mathcal P}_{\textnormal{red}}) \cup {\mathcal Q}' \cup \{R\}) \xrightarrow{}\mathcal{C}_1 = (\emptyset, E_1, {\mathcal P}_{\textnormal{stay}}' \cup {\mathcal P}_{\textnormal{red1}}' \cup {\mathcal Q}' \cup \{R\})$ by reducing one or more processes in $\mathsf{bar\text{-}elim}({\mathcal P}_{\textnormal{red}})$, so by Lemma 9[prop2], there exists ${\mathcal P}_{\textnormal{red1}}$ such that ${\mathcal P}_{\textnormal{red1}}' = \mathsf{bar\text{-}elim}({\mathcal P}_{\textnormal{red1}})$ and $\mathcal{C}' = (B, E, {\mathcal P}_{\textnormal{stay}}\cup {\mathcal P}_{\textnormal{red}}\cup {\mathcal Q}) \xrightarrow{}\mathcal{C}'_1 = (B, E, {\mathcal P}_{\textnormal{stay}}\cup {\mathcal P}_{\textnormal{red1}}\cup {\mathcal Q})$. Letting ${\mathcal P}_1 = {\mathcal P}_{\textnormal{stay}}\cup {\mathcal P}_{\textnormal{red1}}$ and ${\mathcal P}'_1 = {\mathcal P}_{\textnormal{stay}}' \cup {\mathcal P}_{\textnormal{red1}}'$, we obtain that $\mathcal{C}'_1 = (B, E, {\mathcal P}_1 \cup {\mathcal Q})\mathrel{\mathcal{R}}_1 \mathcal{C}_1 = (\emptyset, E_1, {\mathcal P}'_1 \cup {\mathcal Q}' \cup \{R\})$ (with $f$, $k$, $n$ unchanged), so $\mathcal{C}_1 \mathrel{\mathcal{R}}\mathcal{C}'_1$. ${\mathrel{\mathcal{R}}'} = {\mathrel{\mathcal{R}}_2^{-1}}$. We have $\mathcal{C}=\emptyset, E, {\mathcal P}' \cup {\mathcal Q}' \cup \{ R\}$ and $\mathcal{C}' = B,E,{\mathcal P}\cup {\mathcal Q}$, with the conditions given in the definition of $\mathrel{\mathcal{R}}_2$. We distinguish several cases. - Case I: $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ by reducing at least $R$. - Case I.1: $k = 0$. In this case, ${\mathcal Q}= {\mathcal Q}' = \emptyset$. - Case I.1.1: $B = \emptyset$. Then $R = 0$, so $\mathcal{C}\xrightarrow{}\mathcal{C}_1 =\emptyset, E, {\mathcal P}'$, $\mathcal{C}' = \emptyset,E,{\mathcal P}$, and furthermore since $B = \emptyset$, we have $\mathsf{barriers}({\mathcal P}) = \emptyset$, so $P'_i \in \textrm{add-lets}(\mathsf{bar\text{-}elim}(P_i)) = \textrm{add-lets}(P_i)$, so $\mathcal{C}' \mathrel{\mathcal{R}}_3 \mathcal{C}_1$, so $\mathcal{C}_1 \mathrel{\mathcal{R}}\mathcal{C}'$. We conclude with $\mathcal{C}'_1 = \mathcal{C}'$. - Case I.1.2: $B \neq \emptyset$. Then we have $\mathcal{C}' \mathrel{\mathcal{R}}_1 \mathcal{C}$ by expanding the definition of $\mathsf{swapper}_1(B)$, we conclude by using the case ${\mathrel{\mathcal{R}}'} = {\mathrel{\mathcal{R}}_1^{-1}}$, Case II.1 ($k < n$, $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ by reducing $R$, above). - Case I.2: $k > 0$. The process $R$ starts with an output on $c_1$, hence it can only reduce by $\mbox{\sc (Red I/O)}$ with an input on $c_1$. If $R$ reduced with $P'_i \in {\mathcal P}'$, since $P'_i \in \textrm{add-lets}(\mathsf{bar\text{-}elim}(P_i))$, we would actually have $P'_i = \mathsf{bar\text{-}elim}(P_i)$. By definition of $\mathrel{\mathcal{R}}_2$, $c_1 \notin \mathsf{fn}(P_i)$, so $c_1 \notin \mathsf{fn}(P'_i) = \mathsf{fn}(\mathsf{bar\text{-}elim}(P_i)) = \mathsf{fn}(P_i)$, hence $R$ cannot reduce with $P'_i \in {\mathcal P}'$. It cannot reduce with $Q'_i$ for $i > 1$ because $c_1, \dots, c_k$ are pairwise distinct. Therefore, $R$ reduces with $Q'_1$ by $\mbox{\sc (Red I/O)}$. After reduction, $R$ is transformed into $$R_1 = \overline{c_2}\langle M_2\rangle\mathrel.\cdots\mathrel.\overline{c_k}\langle M_k\rangle\mathrel.R'$$ with $R' \in \mathsf{swapper}_1(B)$, and since $Q'_1 \in \mathsf{bar\text{-}elim}_{\textrm{in}}(\overline{c_1}\langle M_1\rangle,Q_1)$, $$Q'_1 = c_1(z).\textnormal{let } z_1=\pi_{1,n}(z) \textnormal{ in } \cdots \textnormal{let } z_n=\pi_{n,n}(z) \textnormal{ in }\mathsf{bar\text{-}elim}(Q')$$ with $M_1 = \mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{N_1,\dots, N_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}$, $Q_1 = Q'\{\textnormal{\raisebox{2pt}{\footnotesize $N_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $N_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}}\}$, and $z, \allowbreak z_1, \allowbreak \dots, \allowbreak z_n$ pairwise distinct variables is transformed into $$\begin{aligned} P'_{m+1} &= \textnormal{let } z_1=\pi_{1,n}(M_1) \textnormal{ in } \cdots \textnormal{let } z_n=\pi_{n,n}(M_1) \textnormal{ in }\mathsf{bar\text{-}elim}(Q')\\ &\in \textrm{add-lets}(\mathsf{bar\text{-}elim}(Q_1)) \end{aligned}$$ because $\mathsf{bar\text{-}elim}(Q_1) = \mathsf{bar\text{-}elim}(Q')\{\textnormal{\raisebox{2pt}{\footnotesize $N_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $N_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}}\}$ by Lemma [lem:substIIb]. We let ${\mathcal P}_1 = {\mathcal P}\cup \{Q_1\}$, ${\mathcal Q}_1 = {\mathcal Q}\setminus \{Q_1\}$, ${\mathcal P}'_1 = {\mathcal P}' \cup \{P'_{m+1}\}$, and ${\mathcal Q}'_1 = {\mathcal Q}' \setminus \{Q'_1\}$. Then we have $\mathcal{C}= (\emptyset, E, {\mathcal P}' \cup {\mathcal Q}' \cup \{ R\}) \xrightarrow{} \mathcal{C}_1 = (\emptyset, E, {\mathcal P}'_1 \cup {\mathcal Q}'_1 \cup \{ R_1\})$ and $\mathcal{C}' = (B,E,{\mathcal P}\cup {\mathcal Q}) = (B,E,{\mathcal P}_1 \cup {\mathcal Q}_1) \mathrel{\mathcal{R}}_2 \mathcal{C}_1 = (\emptyset, E, {\mathcal P}'_1 \cup {\mathcal Q}'_1 \cup \{ R_1\})$ (with $k$ decreased by one and $m$ increased by one), so we conclude with $\mathcal{C}'_1 = \mathcal{C}'$. - Case II: $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ by reducing at least a process in ${\mathcal Q}'$ and not reducing $R$. Since we reduce $Q'_i \in {\mathcal Q}'$, which starts with an input on $c_i$, this process can reduce only by $\mbox{\sc (Red I/O)}$, with an output on $c_i$. If it reduced with $P'_j \in {\mathcal P}'$, since $P'_j \in \textrm{add-lets}(\mathsf{bar\text{-}elim}(P_j))$, we would actually have $P'_j = \mathsf{bar\text{-}elim}(P_j)$. By definition of $\mathrel{\mathcal{R}}_2$, $c_i \notin \mathsf{fn}(P_j)$, so $c_i \notin \mathsf{fn}(P'_j) = \mathsf{fn}(\mathsf{bar\text{-}elim}(P_j)) = \mathsf{fn}(P_j)$, hence $Q'_i$ cannot reduce with a process $P'_j \in {\mathcal P}'$. Moreover, $Q'_i$ cannot reduce with another process in ${\mathcal Q}'$ because all these processes start with inputs. Therefore, this case is impossible. - Case III: $\mathcal{C}\xrightarrow{}\mathcal{C}_1$ by reducing only processes in ${\mathcal P}'$. This case is similar to the case ${\mathrel{\mathcal{R}}'} = {\mathrel{\mathcal{R}}_1^{-1}}$, Case II.3. ${\mathrel{\mathcal{R}}'} = {\mathrel{\mathcal{R}}_3^{-1}}$. We have $\mathcal{C}= \emptyset, E, {\mathcal P}'$ and $\mathcal{C}' = \emptyset, E, {\mathcal P}$ with $\mathsf{barriers}({\mathcal P}) = \emptyset$, ${\mathcal P}= \{P_1, \ldots, P_m\}$, ${\mathcal P}' = \{P'_1, \dots, P'_m\}$, and for all $i \leq m$, $P'_i \in \textrm{add-lets}(P_i)$. - Case I: a reduced process is $P'_i \neq P_i$. We have $P'_i \in \textrm{add-lets}(P_i)$. By Lemma 21, $\mathcal{C}_1 = \emptyset, E,({\mathcal P}' \setminus \{P'_i\}) \cup \{P''_i\}$ with $P''_i \in \textrm{add-lets}(P_i)$, so we still have $\mathcal{C}' \mathrel{\mathcal{R}}_3 \mathcal{C}_1$, so we conclude with $\mathcal{C}'_1 = \mathcal{C}'$. - Case II: the reduced process(es) are $P'_i = P_i$ and possibly $P'_j = P_j$. Let ${\mathcal P}_{\textnormal{red}}= \{P_i\}$ or ${\mathcal P}_{\textnormal{red}}= \{P_i, P_j\}$ be the multiset of reduced processes, ${\mathcal P}' = {\mathcal P}_{\textnormal{stay}}' \cup {\mathcal P}_{\textnormal{red}}$, and ${\mathcal P}= {\mathcal P}_{\textnormal{stay}}\cup {\mathcal P}_{\textnormal{red}}$. We have $\mathcal{C}= (\emptyset, E, {\mathcal P}_{\textnormal{stay}}' \cup {\mathcal P}_{\textnormal{red}}) \xrightarrow{}\mathcal{C}_1 = (\emptyset, E_1, {\mathcal P}_{\textnormal{stay}}' \cup {\mathcal P}_{\textnormal{red1}})$ by reducing one or more processes in ${\mathcal P}_{\textnormal{red}}$. Since the reduction rules are independent of the non-reduced processes, we also have $\mathcal{C}' = (\emptyset, E, {\mathcal P}_{\textnormal{stay}}\cup {\mathcal P}_{\textnormal{red}}) \xrightarrow{}\mathcal{C}'_1 = (\emptyset, E_1, {\mathcal P}_{\textnormal{stay}}\cup {\mathcal P}_{\textnormal{red1}})$ and furthermore $\mathcal{C}'_1 \mathrel{\mathcal{R}}_3 \mathcal{C}_1$, so $\mathcal{C}_1 \mathrel{\mathcal{R}}\mathcal{C}'_1$. #### Condition 3 We show that, if $\mathcal{C}\mathrel{\mathcal{R}}_i \mathcal{C}'$ and $C[\_]$ is an adversarial context, then $C[\mathcal{C}] \mathrel{\mathcal{R}}_i C[\mathcal{C}']$, for $i \in \{1, 2, 3\}$. Let $C[\_]= \nu\,\tilde n.(\_ \mid Q)$ with $\mathsf{fv}(Q) = \emptyset$ and $\mathsf{barriers}(Q) = \emptyset$. We rename $E$ in $\mathcal{C}$ and $\mathcal{C}'$ so that $E \cap \mathsf{fn}(Q) = \emptyset$. $i = 1$. We have $\mathcal{C}= B, E, {\mathcal P}\cup {\mathcal Q}$ and $\mathcal{C}' = \emptyset, E, {\mathcal P}' \cup {\mathcal Q}' \cup \{R\}$. Let ${\mathcal P}_1 = {\mathcal P}\cup \{Q\}$, ${\mathcal P}'_1 = {\mathcal P}' \cup \{Q\}$, and $E_1 = E \cup \{\tilde n\}$. Since $Q$ contains no barrier, we have $\mathsf{bar\text{-}elim}(Q) = Q$, so $Q \in \textrm{add-lets}(\mathsf{bar\text{-}elim}(Q))$, hence $C[\mathcal{C}] = (B, E_1, {\mathcal P}_1 \cup {\mathcal Q}) \mathrel{\mathcal{R}}_1 C[\mathcal{C}'] = (\emptyset, E_1, {\mathcal P}'_1 \cup {\mathcal Q}' \cup \{R\})$ (with $m$ increased by one and $k$, $n$, $f$ unchanged). $i = 2$. We have $\mathcal{C}= B, E, {\mathcal P}\cup {\mathcal Q}$ and $\mathcal{C}' = \emptyset, E, {\mathcal P}' \cup {\mathcal Q}' \cup \{R\}$. Let ${\mathcal P}_1 = {\mathcal P}\cup \{Q\}$, ${\mathcal P}'_1 = {\mathcal P}' \cup \{Q\}$, and $E_1 = E \cup \{\tilde n\}$. Since $Q$ contains no barrier, we have $\mathsf{bar\text{-}elim}(Q) = Q$, so $Q \in \textrm{add-lets}(\mathsf{bar\text{-}elim}(Q))$, hence $C[\mathcal{C}] = (B, E_1, {\mathcal P}_1 \cup {\mathcal Q}) \mathrel{\mathcal{R}}_2 C[\mathcal{C}'] = (\emptyset, E_1, {\mathcal P}'_1 \cup {\mathcal Q}' \cup \{R\})$ (with $m$ increased by one and $k$ unchanged.) $i = 3$. We have $\mathcal{C}= B, E, {\mathcal P}$ and $\mathcal{C}' = \emptyset, E, {\mathcal P}'$. Let ${\mathcal P}_1 = {\mathcal P}\cup \{Q\}$, ${\mathcal P}'_1 = {\mathcal P}' \cup \{Q\}$, and $E_1 = E \cup \{\tilde n\}$. We have $Q \in \textrm{add-lets}(Q)$, so $C[\mathcal{C}] = (B, E_1, {\mathcal P}_1) \mathrel{\mathcal{R}}_3 C[\mathcal{C}'] = (\emptyset, E_1, {\mathcal P}'_1)$ (with $m$ increased by one). #### Conclusion Since $\mathrel{\mathcal{R}}$ is symmetric and satisfies the three conditions of Definition 1, we have ${\mathrel{\mathcal{R}}} \subseteq {\approx}$. Since $\mathsf{fst}(\mathcal{C}_0)\mathrel{\mathcal{R}}\mathsf{fst}(\mathcal{C}'_0)$ and $\mathsf{snd}(\mathcal{C}_0)\mathrel{\mathcal{R}}\mathsf{snd}(\mathcal{C}'_0)$, we conclude that $\mathsf{fst}(\mathcal{C}_0)\approx\mathsf{fst}(\mathcal{C}'_0)$ and $\mathsf{snd}(\mathcal{C}_0)\approx\mathsf{snd}(\mathcal{C}'_0)$. ◻
# Proofs of Propositions 10 and 11
*Proof of Proposition 10.* We have $B, E, \{\nu\,n.P\}\cup{\mathcal P}\;\rightarrow\; B, E\cup\{n'\}, \{P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\}\cup{\mathcal P}$ by $\mbox{\sc (Red Res)}$, so by Lemma 2, $B, E\cup\{n'\}, \{P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\}\cup{\mathcal P}$ is also a valid configuration. We define the relations $\mathrel{\mathcal{R}}_0$ and $\mathrel{\mathcal{R}}_1$ by $$\begin{aligned} \mathcal{C}&\mathrel{\mathcal{R}}_0 \mathcal{C}\\ (B, E, \{\nu\,n.P\}\cup{\mathcal P}) &\mathrel{\mathcal{R}}_1 (B, E\cup\{n'\}, \{P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\}\cup{\mathcal P}) \end{aligned}$$ for any $\mathcal{C}$, $B$, $E$, $n$, $n'$, $P$, ${\mathcal P}$ such that $n'\not\in E \cup \mathsf{fn}(\{\nu\,n.P\}\cup{\mathcal P})$ and $\mathcal{C}$, $(B, E, \{\nu\,n.P\}\cup{\mathcal P})$, and $(B, E\cup\{n'\}, \{P\{\textnormal{\raisebox{2pt}{\footnotesize $n'$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $n$}}\}\}\cup{\mathcal P})$ are valid configurations. We have that $\mathrel{\mathcal{R}}_0 \cup \mathrel{\mathcal{R}}_1 \cup \mathrel{\mathcal{R}}_1^{-1}$ is symmetric and satisfies the three conditions of Definition 1. Hence ${\mathrel{\mathcal{R}}_0 \cup \mathrel{\mathcal{R}}_1 \cup \mathrel{\mathcal{R}}_1^{-1}} \subseteq {\approx}$. This property implies the desired equivalence. ◻
*Proof of Proposition 11.* We have $B, E, \{P \mid Q\} \cup {\mathcal P}\;\rightarrow\; B, E, \{P, Q\} \cup {\mathcal P}$ by $\mbox{\sc (Red Par)}$, so by Lemma 2, $B, E, \{P, Q\} \cup {\mathcal P}$ is also a valid configuration. We define the relations $\mathrel{\mathcal{R}}_0$ and $\mathrel{\mathcal{R}}_1$ by $$\begin{aligned} \mathcal{C}&\mathrel{\mathcal{R}}_0 \mathcal{C}\\ (B, E, \{P \mid Q\} \cup {\mathcal P}) &\mathrel{\mathcal{R}}_1 (B, E, \{P, Q\} \cup {\mathcal P}) \end{aligned}$$ for any $\mathcal{C}$, $B$, $E$, $P$, $Q$, ${\mathcal P}$ such that $\mathcal{C}$, $(B, E, \{P \mid Q\} \cup {\mathcal P})$, and $(B, E, \{P, Q\} \cup {\mathcal P})$ are valid configurations. We have that $\mathrel{\mathcal{R}}_0 \cup \mathrel{\mathcal{R}}_1 \cup \mathrel{\mathcal{R}}_1^{-1}$ is symmetric and satisfies the three conditions of Definition 1. Hence ${\mathrel{\mathcal{R}}_0 \cup \mathrel{\mathcal{R}}_1 \cup \mathrel{\mathcal{R}}_1^{-1}} \subseteq {\approx}$. This property implies the desired equivalence. ◻
# Proofs for Section 3.5.1 (replicated barriers)
*Proof sketch of Proposition 14.* Since barriers are forbidden under replication, the process $Q$ does not contain any barrier. We have $\mathsf{annotate}(C[!Q]) = C_1[!Q]$ and $\mathsf{annotate}(C[!^n Q]) = C_1[!^n Q]$, for some $C_1[\_]$ obtained by annotating the barriers in $C[\_]$. By induction on $C_1[\_]$, we have $\mathsf{bar\text{-}elim}(C_1[!Q]) = C_2[!Q]$ and $\mathsf{bar\text{-}elim}(C_1[!^n Q]) = C_2[!^n Q]$ for some $C_2[\_]$. Let $B = \mathsf{barriers}(C_1[!Q]) = \mathsf{barriers}(C_1[!^n Q])$ and $\{\tilde a\} = \mathsf{channels}(B)$. So $\mathsf{compiler}(C[!Q]) = \mathsf{elim\text{-}and\text{-}swap}(C_1[!Q]) = \{ C_3[!Q] \mid C_3[\_]= \nu\,\tilde a.(C_2[\_]\mid R), R \in \mathsf{swapper}(B) \}$ and $\mathsf{compiler}(C[!^n Q]) = \mathsf{elim\text{-}and\text{-}swap}(C_1[!^n Q]) = \{ C_3[!^n Q] \mid C_3[\_]= \nu\,\tilde a.(C_2[\_]\mid R), R \in \mathsf{swapper}(B) \}$. Let $C_4[\_]= \nu\,\tilde n.(\_ \mid Q')$ be an adversarial context. We have $C_4[\mathcal{C}_{\textnormal{init}}(C_3[!^n Q])] = \emptyset, \{\tilde n\}, \{C_3[!^n Q], Q'\}$ and similarly $C_4[\mathcal{C}_{\textnormal{init}}(C_3[!Q])] = \emptyset, \{\tilde n\}, \{C_3[!Q], Q'\}$. Moreover, for any context $C_3[\_]$, all traces of $\emptyset, \{\tilde n\}, \{C_3[!^n Q], Q'\}$ are matched by traces of $\emptyset, \{\tilde n\}, \{C_3[!Q], Q'\}$, by expanding the replication $!Q$ $n$ times when it appears at the root of a process in a semantic configuration. Therefore, if $\emptyset, \{\tilde n\}, \{C_3[!^n Q], Q'\} \rightarrow^* \uparrow$, then $\emptyset, \{\tilde n\}, \{C_3[! Q], Q'\} \rightarrow^* \uparrow$. Hence, if $C_3[!Q]$ satisfies diff-equivalence, then $C_3[!^n Q]$ satisfies diff-equivalence. So we conclude that, if some process in $\mathsf{compiler}(C[!Q])$ satisfies diff-equivalence, then some process in $\mathsf{compiler}(C[!^n Q])$ satisfies diff-equivalence. ◻
*Proof sketch of Proposition 15.* Let $P = C[Q]$ and $P' = C[t\textnormal{::}\,Q]$. Since annotation proceeds from top to bottom, we annotate the barriers in $C[\_]$ first, transforming $P = C[Q]$ into $C_1[Q_1]$ and $P' = C[t\textnormal{::}\,Q]$ into $C_1[t\textnormal{::}\,Q_1]$. Then we annotate $t\textnormal{::}\,Q_1$, transforming $P'$ into $C_1[t[a,c,\varsigma]\textnormal{::}\,Q'_1]$ where $Q_1 = Q_1'\varsigma$. Then we annotate the barriers in $Q_1$, respectively $Q'_1$. If $\mathsf{split}({U}, {Q}) = (Q', \varsigma')$ and $(\mathsf{fv}(\mathsf{range}(\varsigma)) \cup \mathsf{fn}(\mathsf{range}(\varsigma)) \cup \mathsf{dom}(\varsigma)) \cap U = \emptyset$, then $\mathsf{split}({U}, {Q\varsigma}) = (Q', \varsigma'\varsigma)$, by induction on $Q$. Let $Q'_1 = C'[t'\textnormal{::}\,Q_2]$. Then $Q_1 = C'\varsigma[t'\textnormal{::}\,Q_2\varsigma]$, after renaming the bound names and variables of $C'[\_]$ so that they do not occur in $\varsigma$, and we have $\mathsf{split}({\emptyset}, {Q_2}) = (Q_3, \varsigma')$, so $\mathsf{split}({\emptyset}, {Q_2\varsigma}) = (Q_3, \varsigma'\varsigma)$. Therefore, by annotating $t'\textnormal{::}\,Q_2$, $Q'_1$ becomes $Q_4' = C'[t'[a',c',\varsigma']\textnormal{::}\,Q_3]$ and $Q_1$ becomes $C'\varsigma[t'[a',c',\varsigma'\varsigma]\textnormal{::}\,Q_3] = Q_4'\varsigma$ since $\mathsf{fv}(Q_3) \subseteq \mathsf{dom}(\varsigma')$. Hence, the property that $P'$ is transformed into $C_1[t[a,c,\varsigma]\textnormal{::}\,Q_1']$ and $P$ is transformed into $C_1[Q'_1\varsigma]$ for some $C_1[\_]$, $\varsigma$, $Q_1'$, and fresh names $a$, $c$ is preserved by annotation of $Q'_1$, respectively $Q_1'\varsigma$. Therefore, $$\begin{aligned} &P'_1 =\mathsf{annotate}(P') = C_1[t[a,c,\varsigma]\textnormal{::}\,Q_1']\\ &P_1 =\mathsf{annotate}(P) = C_1[Q'_1\varsigma] \end{aligned}$$ for some $C_1[\_]$, $\varsigma$, $Q_1'$, and fresh names $a$, $c$ that do not occur in $C_1[\_]$, $\varsigma$, and $Q_1'$. Let us define $$\begin{aligned} \mathsf{add\text{-}in\text{-}let}({Q},{a,c,\varsigma}) &= c(z).\textnormal{let } z_1=\pi_{1,n}(z) \textnormal{ in }\cdots \textnormal{let } z_n=\pi_{n,n}(z) \textnormal{ in }Q\\ \mathsf{add\text{-}out\text{-}in\text{-}let}({Q},{a,c,\varsigma}) &= \overline{a}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1, \dots, M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle.\mathsf{add\text{-}in\text{-}let}({Q},{a,c,\varsigma}) \end{aligned}$$ where $\varsigma = (\textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}})$ and $z$ is a fresh variable. We have $$\begin{aligned} \mathsf{bar\text{-}elim}(C_1[t[a,c,\varsigma]\textnormal{::}\,Q_1']) &= C_2[\mathsf{add\text{-}out\text{-}in\text{-}let}({\mathsf{bar\text{-}elim}(Q_1')},{a,c,\varsigma})]\\ \mathsf{bar\text{-}elim}(C_1[Q_1'\varsigma]) &= C_2[\mathsf{bar\text{-}elim}(Q_1'\varsigma)] \end{aligned}$$ for some $C_2[\_]$ such that $a$ and $c$ do not occur in $C_2[\_]$, by induction on $C_1[\_]$. Furthermore, $C_1[\_]$ and $C_2[\_]$ do not contain replications above the hole, since barriers never occur under replication. So $$\begin{aligned} &\mathsf{bar\text{-}elim}(P_1') = C_2[\mathsf{add\text{-}out\text{-}in\text{-}let}({\mathsf{bar\text{-}elim}(Q_1')},{a,c,\varsigma})]\\ &\mathsf{bar\text{-}elim}(P_1) = C_2[\mathsf{bar\text{-}elim}(Q_1'\varsigma)] = C_2[\mathsf{bar\text{-}elim}(Q_1')\varsigma] \end{aligned}$$ by Lemma 8. Moreover, $$\mathsf{barriers}(P_1') = \{ t[a,c,\mathsf{ordom}(\varsigma)]\textnormal{::}\,Q'_1 \} \cup \mathsf{barriers}(P_1)\,.$$ So, considering permutations $f$ that leave $j$ unchanged when the $j$-th barrier is $t[a,c,\allowbreak \mathsf{ordom}(\varsigma)]\textnormal{::}\,Q'_1$, we have that $$\begin{aligned} \mathsf{swapper}(\mathsf{barriers}(P_1')) &\supseteq \{ C_{3,i}[a(x).C_{4,i}[\overline{c}\langle x\rangle.Q_{2,i}]] \mid i = 1, \dots, n \}\\ \mathsf{swapper}(\mathsf{barriers}(P_1)) &= \{ C_{3,i}[C_{4,i}[Q_{2,i}]] \mid i = 1, \dots, n \} \end{aligned}$$ for some families of contexts $C_{3,i}[\_]$ and $C_{4,i}[\_]$ and processes $Q_{2,i}$, such that $C_{3,i}[\_]$ and $C_{4,i}[\_]$ do not bind $x$ and do not contain replications, $x$ is not free in $C_{4,i}$ and $Q_{2,i}$, and $a$ and $c$ do not occur in $C_{3,i}[\_]$, $C_{4,i}[\_]$, and $Q_{2,i}$. We make a small abuse here: we write $\overline{c}\langle x\rangle.Q_{2,i}$ instead of $\overline{c}\langle\mathsf{diff}[x,x]\rangle.Q_{2,i}$. It is clear that the replacement of $\mathsf{diff}[x,x]$ with $x$ does not change the behaviour of the process. Let $\{\tilde a\} = \mathsf{channels}(\mathsf{barriers}(P_1))$. We have $\mathsf{channels}(\mathsf{barriers}(P'_1)) = \{\tilde a, a, c\}$. We finally obtain that $$\begin{aligned} &\mathsf{compiler}(P') = \mathsf{elim\text{-}and\text{-}swap}(P'_1) \supseteq \{P'_{2,i} \mid i = 1, \dots, n \}\\ &\mathsf{compiler}(P) = \mathsf{elim\text{-}and\text{-}swap}(P_1) = \{P_{2,i} \mid i = 1, \dots, n \} \end{aligned}$$ where $$\begin{aligned} &P'_{2,i} =\nu\,\tilde a, a, c.(C_2[\mathsf{add\text{-}out\text{-}in\text{-}let}({Q_2'},{a,c,\varsigma})] \mid C_{3,i}[a(x).C_{4,i}[\overline{c}\langle x\rangle.Q_{2,i}]])\\ &P_{2,i} =\nu\,\tilde a.(C_2[Q_2'\varsigma] \mid C_{3,i}[C_{4,i}[Q_{2,i}]]) \end{aligned}$$ for some $C_2[\_]$, $Q_2'$, $C_{3,i}[\_]$, $C_{4,i}[\_]$, $Q_{2,i}$, $\varsigma$, $\tilde a$, $a$, $c$, $x$, such that $C_2[\_]$ does not contain replications above the hole, $C_{3,i}[\_]$ and $C_{4,i}[\_]$ do not bind $x$ and do not contain replications, $x$ is not free in $C_{4,i}$ and $Q_{2,i}$, and $a$ and $c$ do not occur in $C_2[\_]$, $Q_2'$, $C_{3,i}[\_]$, $C_{4,i}[\_]$, $Q_{2,i}$, $\varsigma$, and $\tilde a$. Let $C_5[\_] = \nu\,n.(\_ \mid Q')$ be an adversarial context. We have $C_5[\mathcal{C}_{\textnormal{init}}(P'_{2,i})] = \emptyset, \{\tilde n\}, \{P'_{2,i}, Q'\}$ and similarly $C_5[\mathcal{C}_{\textnormal{init}}(P_{2,i})] = \emptyset, \{\tilde n\}, \{P_{2,i}, Q'\}$. We show that all traces of $\emptyset, \{\tilde n\}, \{P'_{2,i}, Q'\}$ are matched by traces of $\emptyset, \{\tilde n\}, \{P_{2,i}, Q'\}$. Formally, if $\emptyset, \{\tilde n\}, \{P'_{2,i}, Q'\} \rightarrow^* \mathcal{C}$, then one of the following cases occurs: 1. $\mathcal{C}= \emptyset, E', \{ \nu\,\tilde b'.(C_2[\mathsf{add\text{-}out\text{-}in\text{-}let}({Q_2'},{a,c,\varsigma})] \mid C_{3,i}[a(x).C_{4,i}[\overline{c}\langle x\rangle.Q_{2,i}]]) \} \cup {\mathcal P}$ $\emptyset, \{\tilde n\}, \{P_{2,i}, Q'\}\rightarrow^* \emptyset, E, \{\nu\,\tilde b.(C_2[Q_2'\varsigma] \mid C_{3,i}[C_{4,i}[Q_{2,i}]])\} \cup {\mathcal P}$ for some $E$, $E'$, $\tilde b$, $\tilde b'$, and ${\mathcal P}$ such that $\{a,c\} \cap (E \cup \{\tilde b\}) = \emptyset$, $E' \cup \{\tilde b'\} = E \cup \{\tilde b, a, c\}$, and $a$ and $c$ do not occur in ${\mathcal P}$. 2. $\mathcal{C}= \emptyset, E \cup \{a, c\}, \{ C_2[\mathsf{add\text{-}out\text{-}in\text{-}let}({Q_2'},{a,c,\varsigma})], C_3[a(x).C_4[\overline{c}\langle x\rangle.Q_2]]) \} \cup {\mathcal P}$ $\emptyset, \{\tilde n\}, \{P_{2,i}, Q'\}\rightarrow^* \emptyset, E, \{ C_2[Q_2'\varsigma], C_3[C_4[Q_2]] \} \cup {\mathcal P}$ for some $E$, $C_2[\_]$, $Q_2'$, $C_3[\_]$, $C_4[\_]$, $Q_2$, $\varsigma$, ${\mathcal P}$ such that $C_2[\_]$ does not contain replications above the hole, $C_3[\_]$ and $C_4[\_]$ do not bind $x$ and do not contain replications, $x$ is not free in $C_4[\_]$ and $Q_2$, and $a$ and $c$ do not occur in $C_2[\_]$, $Q_2'$, $C_3[\_]$, $C_4[\_]$, $Q_2$, ${\mathcal P}$, $\varsigma$, and $E$. ($C_2[\_]$, $\varsigma$, and $Q_2$ may be different from the initial ones.) 3. $\mathcal{C}= \emptyset, E \cup \{a, c\}, \{ \mathsf{add\text{-}in\text{-}let}({Q_2'},{a,c,\varsigma}), C_4[\overline{c}\langle\mbox{$(\mkern-2.8mu\rule[-.47ex]{.08ex}{2.10ex}\mkern 3mu$}{M_1, \dots, M_n}\mbox{$\mkern 3mu\rule[-.47ex]{.08ex}{2.1ex}\mkern-2.5mu)$}\rangle.Q_2] \} \cup {\mathcal P}$ $\emptyset, \{\tilde n\}, \{P_{2,i}, Q'\}\rightarrow^* \emptyset, E, \{ Q_2'\varsigma, C_4[Q_2] \} \cup {\mathcal P}$ for some $E$, $Q_2'$, $C_4[\_]$, $Q_2$, $\varsigma$, $M_1$, …, $M_n$, ${\mathcal P}$ such that $\varsigma = ( \textnormal{\raisebox{2pt}{\footnotesize $M_1$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_1$}}, \dots, \textnormal{\raisebox{2pt}{\footnotesize $M_n$}}/\textnormal{\raisebox{-1.5pt}{\footnotesize $z_n$}} )$, $C_4[\_]$ does not contain replications, and $a$ and $c$ do not occur in $Q_2'$, $C_4[\_]$, $Q_2$, ${\mathcal P}$, $\varsigma$, and $E$. ($\varsigma$ and $Q_2$ may be different from the initial ones.) 4. $\mathcal{C}= \emptyset, E \cup \{a, c\}, \{ Q_4 \} \cup {\mathcal P}$ and $\emptyset, \{\tilde n\}, \{P_{2,i}, Q'\}\rightarrow^* \emptyset, E, \{Q_3\} \cup {\mathcal P}$ for some $E$, $Q_3$, $Q_4$, and ${\mathcal P}$ such that $Q_4 \in \textrm{add-lets}(Q_3)$. This property is proved by induction on the length of the trace $\emptyset, \{\tilde n\}, \{P'_{2,i}, Q'\} \rightarrow^* \mathcal{C}$. By inspecting all cases, we conclude that, if $\emptyset, \allowbreak \{\tilde n\}, \allowbreak \{P'_{2,i}, Q'\} \rightarrow^* \uparrow$, then $\emptyset, \{\tilde n\}, \{P_{2,i}, Q'\} \rightarrow^* \uparrow$. Hence, if $P_{2,i}$ satisfies diff-equivalence, then $P'_{2,i}$ also satisfies diff-equivalence. So, if some process in $\mathsf{compiler}(P)$ satisfies diff-equivalence, then some process in $\mathsf{compiler}(P')$ satisfies diff-equivalence. ◻
# References
n.d.
Abadi, Martín. 2000. “Security Protocols and their Properties.” In *Foundations of Secure Computation*, 39–60. NATO Science Series. IOS Press.
Abadi, Martín, and Véronique Cortier. 2006. “Deciding Knowledge in Security Protocols Under Equational Theories.” *Theoretical Computer Science* 367 (1–2): 2–32.
Abadi, Martı́n, and Bruno Blanchet. 2005. “Computer-Assisted Verification of a Protocol for Certified Email.” *Science of Computer Programming* 58 (1–2): 3–27.
Abadi, Martı́n, and Cédric Fournet. 2001. “Mobile Values, New Names, and Secure Communication.” In *POPL’01: 28th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages*, 104–15. ACM Press.
Abadi, Martı́n, and Andrew D. Gordon. 1997. “A Calculus for Cryptographic Protocols: The Spi Calculus.” In *CCS’97: 4th ACM Conference on Computer and Communications Security*, 36–47. ACM Press.
———. 1998. “A Bisimulation Method for Cryptographic Protocols.” *Nordic Journal of Computing* 5 (4): 267–303.
Adida, Ben, Olivier de Marneffe, Olivier Pereira, and Jean-Jacques Quisquater. 2009. “Electing a University President Using Open-Audit Voting: Analysis of Real-World Use of Helios.” In *EVT/WOTE’09: Electronic Voting Technology Workshop/Workshop on Trustworthy Elections*. USENIX Association.
Arapinis, Myrto, Jia Liu, Eike Ritter, and Mark Ryan. 2014. “Stateful Applied Pi Calculus.” In *POST’14: 3rd Conference on Principles of Security and Trust*, 8414:22–41. LNCS. Springer.
Arenstorf, Norbert S., and Harry F. Jordan. 1989. “Comparing barrier algorithms.” *International Journal of Parallel Computing* 12 (2): 157–70.
Backes, Michael, Cătălin Hriţcu, and Matteo Maffei. 2008. “Automated Verification of Remote Electronic Voting Protocols in the Applied Pi-calculus.” In *CSF’08: 21st IEEE Computer Security Foundations Symposium*, 195–209. IEEE Computer Society.
Basin, David, Jannik Dreier, and Ralf Casse. 2015. “Automated Symbolic Proofs of Observational Equivalence.” In *CCS’15: 22nd ACM Conference on Computer and Communications Security*, 1144–55. ACM.
Baudet, Mathieu. 2005. “Deciding Security of Protocols Against Off-Line Guessing Attacks.” In *CCS’05: 12th ACM Conference on Computer and Communications Security*, 16–25. ACM Press.
———. 2007. “Sécurité Des Protocoles Cryptographiques : Aspects Logiques Et Calculatoires.” PhD thesis, Laboratoire Spécification et Vérification, ENS Cachan, France.
Blanchet, Bruno. 2004. “Automatic Proof of Strong Secrecy for Security Protocols.” In *S&p’04: 25th IEEE Symposium on Security and Privacy*, 86–100. IEEE Computer Society.
———. 2008. “Vérification Automatique de Protocoles Cryptographiques: Modèle Formel Et Modèle Calculatoire.” M\\emoire d'habilitation \\a diriger des recherches, Université Paris-Dauphine.
———. 2009. “Automatic Verification of Correspondences for Security Protocols.” *Journal of Computer Security* 17 (4): 363–434.
———. 2016. “Modeling and Verifying Security Protocols with the Applied Pi Calculus and ProVerif.” *Foundations and Trends in Privacy and Security* 1 (1–2): 1–135.
Blanchet, Bruno, Martı́n Abadi, and Cédric Fournet. 2008. “Automated verification of selected equivalences for security protocols.” *Journal of Logic and Algebraic Programming* 75 (1): 3–51.
Blanchet, Bruno, and Ben Smyth. 2016. “Automated Reasoning for Equivalences in the Applied Pi Calculus with Barriers.” In *CSF’16: 29th Computer Security Foundations Symposium*, 310–24. IEEE Computer Society.
Blanchet, Bruno, Ben Smyth, and Vincent Cheval. 2016. “ProVerif 1.96: Automatic Cryptographic Protocol Verifier, User Manual and Tutorial.” .
Borgström, Johannes, Sébastien Briais, and Uwe Nestmann. 2004. “Symbolic Bisimulation in the Spi Calculus.” In *CONCUR’04: 15th International Conference on Concurrency Theory*, 3170:161–76. LNCS. Springer.
Borgström, Johannes, and Uwe Nestmann. 2005. “On bisimulations for the spi calculus.” *Mathematical Structures in Computer Science* 15 (3): 487–552.
Brooks, Eugene D., III. 1986. “The Butterfly Barrier.” *International Journal of Parallel Programming* 15 (4): 295–307.
Chadha, Rohit, Stefan Ciobâca, and Steve Kremer. 2012. “Automated Verification of Equivalence Properties of Cryptographic Protocols.” In *ESOP’12: 21st European Symposium on Programming*, 7211:108–27. LNCS. Springer.
Cheval, Vincent, and Bruno Blanchet. 2013. “Proving More Observational Equivalences with ProVerif.” In *POST’13: 2nd Conference on Principles of Security and Trust*, 7796:226–46. LNCS. Springer.
Cheval, Vincent, Hubert Comon-Lundh, and Stéphanie Delaune. 2011. “Trace Equivalence Decision: Negative Tests and Non-Determinism.” In *CCS’11: Proceedings of the 18th ACM Conference on Computer and Communications Security*, 321–30. ACM Press.
Chothia, Tom. 2006. “Analysing the MUTE Anonymous File-Sharing System Using the Pi-Calculus.” In *FORTE’06: 26th International Conference on Formal Techniques for Networked and Distributed Systems*, 4229:115–30. LNCS. Springer.
Chothia, Tom, Simona Orzan, Jun Pang, and Muhammad Torabi Dashti. 2007. “A Framework for Automatically Checking Anonymity with $\mu$CRL.” In *TGC’06: 2nd Symposium on Trustworthy Global Computing*, 4661:301–18. LNCS. Springer.
Chrétien, Rémy, Véronique Cortier, and Stéphanie Delaune. 2015a. “Decidability of Trace Equivalence for Protocols with Nonces.” In *CSF’15: Proceedings of the 28th IEEE Computer Security Foundations Symposium*, 170–84. IEEE Computer Society.
———. 2015b. “From Security Protocols to Pushdown Automata.” *ACM Transactions on Computational Logic* 17 (1:3).
Ciobâca, Stefan. 2011. “Verification and Composition of Security Protocols with Applications to Electronic Voting.” PhD thesis, Laboratoire Spécification et Vérification, ENS Cachan & CNRS & INRIA.
Cortier, Véronique, and Stéphanie Delaune. 2009. “A method for proving observational equivalence.” In *CSF’09: 22nd IEEE Computer Security Foundations Symposium*, 266–76. IEEE Computer Society.
Cortier, Véronique, Michaël Rusinowitch, and Eugen Zǎlinescu. 2007. “Relating Two Standard Notions of Secrecy.” *Logical Methods in Computer Science* 3 (3).
Cortier, Véronique, and Ben Smyth. 2013. “Attacking and fixing Helios: An analysis of ballot secrecy.” *Journal of Computer Security* 21 (1): 89–148.
Cremers, Cas, and Lucca Hirschi. 2017. “Improving Automated Symbolic Analysis for E-voting Protocols: A Method Based on Sufficient Conditions for Ballot Secrecy.” arXiv, Report 1709.00194.
Dahl, Morten, Stéphanie Delaune, and Graham Steel. 2010. “Formal Analysis of Privacy for Vehicular Mix-Zones.” In *ESORICS’10: 15th European Symposium on Research in Computer Security*, 6345:55–70. LNCS. Springer.
———. 2011. “Formal Analysis of Privacy for Anonymous Location Based Services.” In *TOSCA’11: Proceedings of the Workshop on Theory of Security and Applications*, 6993:98–112. LNCS. Springer.
Delaune, Stéphanie, Steve Kremer, and Olivier Pereira. 2009. “Simulation based security in the applied pi calculus.” In *FSTTCS: IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science*, 4:169–80. Leibniz International Proceedings in Informatics. Leibniz-Zentrum für Informatik.
Delaune, Stéphanie, Steve Kremer, and Mark D. Ryan. 2009. “Verifying privacy-type properties of electronic voting protocols.” *Journal of Computer Security* 17 (4): 435–87.
———. 2010. “Symbolic Bisimulation for the Applied Pi Calculus.” *Journal of Computer Security* 18 (2): 317–77.
Delaune, Stéphanie, Mark D. Ryan, and Ben Smyth. 2008. “Automatic Verification of Privacy Properties in the Applied Pi-Calculus.” In *IFIPTM’08: 2nd Joint iTrust and PST Conferences on Privacy, Trust Management and Security*, 263:263–78. International Federation for Information Processing. Springer.
Dreier, Jannik, Charles Duménil, Steve Kremer, and Ralf Sasse. 2017. “Beyond Subterm-Convergent Equational Theories in Automated Verification of Stateful Protocols.” In *6th International Conference on Principles of Security and Trust (POST)*, edited by Matteo Maffei and Mark Ryan, 10204:117–40. LNCS. Uppsala, Sweden: Springer.
Dreier, Jannik, Pascal Lafourcade, and Yassine Lakhnech. 2011. “Vote-Independence: A Powerful Privacy Notion for Voting Protocols.” In *FPS’11: 4th Workshop on Foundations & Practice of Security*, 6888:164–80. LNCS. Springer.
Durante, Luca, Riccardo Sisto, and Adriano Valenzano. 2003. “Automatic Testing Equivalence Verification of Spi Calculus Specifications.” *ACM Transactions on Software Engineering and Methodology* 12 (2): 222–84.
Freudiger, Julien, Maxim Raya, Márk Félegyházi, Panos Papadimitratos, and Jean-Pierre Hubaux. 2007. “Mix-Zones for Location Privacy in Vehicular Networks.” In *WiN-ITS’07: 1st International Workshop on Wireless Networking for Intelligent Transportation Systems*.
Hensgen, Debra, Raphael Finkel, and Udi Manber. 1988. “Two Algorithms for Barrier Synchronization.” *International Journal of Parallel Programming* 17 (1): 1–17.
Hirschi, Lucca, David Baelde, and Stéphanie Delaune. 2016. “A Method for Verifying Privacy-Type Properties: The Unbounded Case.” In *Proceedings of the 37th IEEE Symposium on Security and Privacy (S&P’16)*, 564–81. IEEE Computer Society.
Hüttel, Hans. 2003. “Deciding Framed Bisimilarity.” *Electronic Notes in Theoretical Computer Science* 68 (6): 1–20.
Juels, Ari, Dario Catalano, and Markus Jakobsson. 2010. “Coercion-Resistant Electronic Elections.” In *Towards Trustworthy Elections: New Directions in Electronic Voting*, 6000:37–63. LNCS. Springer.
Klus, Petr, Ben Smyth, and Mark D. Ryan. 2010. “ProSwapper: Improved equivalence verifier for ProVerif.” .
Kremer, Steve, and Mark D. Ryan. 2005. “Analysis of an Electronic Voting Protocol in the Applied Pi Calculus.” In *ESOP’05: 14th European Symposium on Programming*, 3444:186–200. LNCS. Springer.
Lee, Byoungcheon, Colin Boyd, Ed Dawson, Kwangjo Kim, Jeongmo Yang, and Seungjae Yoo. 2004. “Providing Receipt-Freeness in Mixnet-Based Voting Protocols.” In *ICISC’03: 6th International Conference on Information Security and Cryptology*, 2971:245–58. LNCS. Springer.
Lubachevsky, Boris D. 1990. “Synchronization Barrier and Related Tools for Shared Memory Parallel Programming.” *International Journal of Parallel Programming* 19 (3): 225–50.
Pfitzmann, Andreas, and Marit Köhntopp. 2001. “Anonymity, Unobservability, and Pseudonymity – A Proposal for Terminology.” In *International Workshop on Design Issues in Anonymity and Unobservability*, 2009:1–9. LNCS. Springer.
Reiter, Michael K., and Aviel D. Rubin. 1998. “Crowds: Anonymity for Web Transactions.” *ACM Transactions on Information and System Security* 1 (1): 66–92.
Ryan, Mark D., and Ben Smyth. 2011. “Applied pi calculus.” In *Formal Models and Techniques for Analyzing Security Protocols*. IOS Press.
Santiago, Sonia, Santiago Escobar, Catherine Meadows, and José Meseguer. 2014. “A Formal Definition of Protocol Indistinguishability and Its Verification Using Maude-NPA.” In *STM’14: Security and Trust Management*, 8743:162–77. LNCS. Springer.
Smyth, Ben. 2007. “Automatic Verification of Privacy Properties in the Applied Pi Calculus.” In *Formal Protocol Verification Applied: Abstracts Collection*. Dagstuhl Seminar Proceedings 07421.
———. 2011. “Formal verification of cryptographic protocols with automated reasoning.” PhD thesis, School of Computer Science, University of Birmingham.
Tiu, Alwen, and Jeremy Dawson. 2010. “Automating Open Bisimulation Checking for the Spi Calculus.” In *CSF’10: 23rd IEEE Computer Security Foundations Symposium*, 307–21. IEEE Computer Society.
[^1]: Corresponding author. [^2]: Corresponding author. [^3]: Only a few rules of the operational semantics need to be adapted to equations, as in (Blanchet 2016, sec. 2.5.1); the definition of our compiler and many parts of the proofs remain unchanged. A tricky point is that, with equations, the evaluation of expressions may introduce names that do not appear in the initial expression, and these names may collide with other names. There are several ways to solve this technical issue, either by considering a representative in which these names are renamed to avoid such collisions or by restricting ourselves to the equational theories that ProVerif supports, in which the equations can be oriented to avoid such introduction of names. Adapting the proofs to equations is otherwise straightforward. [^4]: The use of distinct channels helps avoid an incompleteness issue of ProVerif. In essence, ProVerif overapproximates a private channel as a set of messages: an input on a private channel $a$ may receive any message sent on $a$ at any point, in any order. By using distinct channels for barriers, we make sure that there is a single output and a single input for each private channel, so we reduce the effect of this overapproximation to a minimum.