---
author:
- 
bibliography:
- 'labels.bib'
---

Designers of mathematical models for computational systems need to find appropriate trade-offs between two seemingly contradictory requirements. Automatic verification (and thus usability) typically requires a high level of abstraction whereas prediction accuracy requires a high level of details. &gt;From this perspective, the use of symbolic models for security analysis is particularly delicate since it seems that the inherent high level of abstraction at which such models operate is not able to capture all aspects that are relevant to security. This paper is concerned with one particular such aspect, namely the use of randomization in the construction of cryptosystems [@goldwasser84probabilistic].

A central feature of the computational, complexity-based models is the ability to capture and reason explicitly about the use of randomness. Moreover, randomness is essential to achieve any meaningful notion of security for encryption. In contrast, symbolic models rarely represent randomness directly. For example, a typical representation for the encryption of message $m$ under the public key of entity $B$ is the term ${\{m\}_{\ek(B)}}$. Notice that the symbolic representation does not capture the dependency on the randomness used to generate this ciphertext. While this abstraction may be sufficiently accurate in certain settings [@MW04], in some other settings it is not sufficient.

Consider the following flow in some toy protocol: $$\begin{array}{rcl}
 A& \rightarrow B:& \{m\}_{\ek(B)},\{\{m\}_{\ek(B)}\}_{\ek(B)}\end{array}$$ To implement this flow, each occurrence of ${\{m\}_{\ek(B)}}$ is mapped to a ciphertext. Notice however that the pictorial description does not specify if the two occurrences of ${\{m\}_{\ek(B)}}$ are equal (created with identical coins) or different (created with different coins). In rich enough protocol specification languages disambiguating constructs as above can be easily done. For instance, in a language that has explicit assignments, the two different interpretation for the first message of the protocol can be obtained as $$x:={\{m\}_{\ek(B)}};
\mathsf{send}(x,{\{x\}_{\ek(B)}})\;\;\;\;\mathrm{and}\;\;\;\;
\mathsf{send}({\{m\}_{\ek(B)}},{\{{\{m\}_{\ek(B)}}\}_{\ek(B)}})\;\;$$ Here, each distinct occurrence of ${\{m\}_{\ek(B)}}$ is interpreted with different randomness. Other approaches adopt a more direct solution and represent the randomness used for encryption explicitly [@herzog; @abadi01formal; @lowe04analysing; @CortierW-ESOP05]. If we write ${\{m\}_{\ek(B)}}^l$ for the encryption of $m$ under the public key of $B$ with random coins $l$, the two different interpretations of the flow are: $$\mathsf{send}({\{m\}_{\ek(B)}}^{l_1},
{\{{\{m\}_{\ek(B)}}^{l_1}\}_{\ek(B)}}^{l_2})\;\;\;\;
\mathrm{and}\;\;\;\;
\mathsf{send}({\{m\}_{\ek(B)}}^{l_1},
{\{{\{m\}_{\ek(B)}}^{l_2}\}_{\ek(B)}}^{l_3})$$ A model that employs labels to capture the randomness used in ciphertexts (and signatures) has recently been used to establish soundness of symbolic analysis with respect to computational models [@CortierW-ESOP05]. Their results are based on an emulation lemma: for protocol executions, every computational trace can be mapped to a valid symbolic trace. The mapping is then used to translate security properties that hold in the symbolic model to computational analogues. The next step towards making the soundness result relevant to practice is to carry out the security proofs using some (semi-)automated tools for the symbolic model.

However, to the best of our knowledge, none of the popular tools (ProVerif [@blanchet01], CASPER [@casper], Athenta [@athena], AVISPA [@sysdesc-CAV05]), offers capabilities for automatically reasoning in models that use labels. There are at least two solutions to this problem. One possibility is to enhance the symbolic models that underlie existing tools. Unfortunately such a modification would probably require significant effort that involves adapting existing decision procedures, proving their correctness, and verifying and modifying thousands of lines of code.

In this paper we put forth and clarify an alternative solution, used implicitly in [@CortierW-ESOP05]. The idea is to keep existing tools unchanged, use their underlying (unlabeled) model to prove security properties, and then show that the results are in fact meaningful for the model with labels. The main result of this paper is to prove that for a large class of security properties the approach that we propose is indeed feasible.

We are currently implementing an AVISPA module for computationally sound automatic proofs based on the results of this paper.

#### Results.

We consider the protocol specification language and the execution model developed in [@CortierW-ESOP05]. The language is for protocols that use random nonces, public key encryption and digital signatures, and uses labels to model the randomness used by these primitives. To each protocol $\Pi$ with labels, we naturally associate a protocol ${\overline{\Pi}}$ obtained by erasing all labels, and extend the transformation to execution traces. To each trace $tr$ of $\Pi$ we associate a trace ${\overline{tr}}$ obtained by erasing labels and we extend this mapping to sets of traces. The first contribution of this paper is a proof that the transformation is sound. More precisely we prove that if $tr$ is a valid trace of $\Pi$ (obtained by Dolev-Yao operations) then ${\overline{tr}}$ is a valid trace of ${\overline{\Pi}}$. Importantly, this result relies on the fact that the specification language that we consider does not allow equality tests between ciphertexts. We believe that a similar result holds for most (if not all) protocol specification languages that satisfy the above condition. The language for specifying protocols (with and without labels) as well as the relation between their associated execution models are in Section \[section-protocol\].

In Section \[section-alogic\] we give two logics, ${\mathcal{L}_1}^l$ and ${\mathcal{L}_1}$, that we use to express security properties for protocols with and without labels, respectively. Informally, the formulas of ${\mathcal{L}_1}$ are obtained by removing the labels from formulas of ${\mathcal{L}_1}^l$. Both logics are quite expressive. For example, it can be used to express standard formulations for secrecy and authenticity properties.

Next we focus our attention on translating security properties between the two models. First, notice that the mapping between the model with and that without labels is not faithful since it looses information regarding inequality of ciphertexts. To formalize this intuition we give a protocol $\Pi$ and a formula $\phi$ such that ${\overline{\Pi}}$ satisfies ${\overline{\phi}}$ (the formula that corresponds to $\phi$ in the model without labels), but for which $\Pi$ does not satisfy $\phi$. Anticipating, our example indicates that the source of problems is that $\phi$ may contain equality tests between ciphertexts, and such tests may not be translated faithfully. The counterexample is in Section \[section-main\].

The main result of the paper is a soundness theorem. We show that for a large class of security properties it is possible to carry out the proof in the model without labels and infer security properties in the model with labels. More precisely, we identify ${\mathcal{L}_2}^l$ and ${\mathcal{L}_2}$, fragments of ${\mathcal{L}_1}^l$ and ${\mathcal{L}_1}$ respectively, such that the following theorem holds.

Consider an arbitrary protocol $\Pi$ and formula $\phi$ in ${\mathcal{L}_2}^l$. Let ${\overline{\phi}}$ be a formula in ${\mathcal{L}_2}$ obtained by erasing the labels that occur in $\phi$. Then, it holds that: $${\overline{\Pi}}\models{\overline{\phi}} \implies \Pi\models\phi$$ The logics ${\mathcal{L}_2}^l$ and ${\mathcal{L}_2}$ are still expressive enough to contain the secrecy and authentication formulas. The theorem and its proof are in in Section \[section-main\].

 {#section-protocol}

In this section we provide the syntax of protocols with labels. The presentation is adapted from [@CortierW-ESOP05]. The specification language is similar to the one of Casrul [@RT01]; it allows parties to exchange messages built from identities and randomly generated nonces using public key encryption and digital signatures. Protocols that do not use labels are obtained straightforwardly.

Syntax {#section-syntax}
------

Consider an algebraic signature $\Sigma$ with the following sorts. A sort $\id$ for agent identities, sorts $\skey$, $\vkey$, $\ekey$, $\dkey$ containing keys for signing, verifying, encryption, and decryption respectively. The algebraic signature also contains sorts $\nonce$, $\labels$, $\ciphertext$, $\signature$ and $\p$ for nonces, labels, ciphertexts, signatures and pair, respectively. The sort $\labels$ is used in encryption and signatures to distinguish between different encryption/signature of the same plaintext. The sort $\term$ is a supersort containing all other sorts, except $\skey$ and $\dkey$. There are nine operations: the four operations $\ek,\dk,\sk,\vk$ are defined on the sort $\id$ and return the encryption key, decryption key, signing key, and verification key associated to the input identity. The two operations $\mathsf{ag}$ and $\mathsf{adv}$ are defined on natural numbers and return labels. As explained in the introduction, the labels are used to differentiate between different encryptions (and signatures) of the same plaintext, created by the honest agents or the adversary. We distinguish between labels for agents and for the adversary since they do not use the same randomness. The other operations that we consider are pairing, public key encryption, and signing.

We also consider sets of sorted variables $\X=\X.n\cup \X.a\cup
\X.c\cup \X.s$ and $\X^l=\X\cup \X.l$. Here, $\X.n, \X.a,\X.c, \X.s, \X.l$ are sets of variables of sort nonce, agent, ciphertext, signature and labels, respectively. The sets of variables $\X.a$ and $\X.n$ are as follows. If $k\in{{\mathbb N}}$ is some fixed constant representing the number of protocol participants, w.l.o.g. we fix the set of agent variables to be $\X.a={\{A_1,A_2,\ldots,A_k\}}$, and partition the set of nonce variables, by the party that generates them. Formally: $\X.n=\cup_{A\in \X.a}\X_n(A)^{}$ and $\X_n(A) = \{X^j_A   
\mid j\in{{\mathbb N}}\}.$ This partition avoids to specify later, for each role, which variables stand for generated nonces and which variables stand for expected nonces.

Labeled messages that are sent by participants are specified using terms in ${T}^l$ $$\begin{array}{lll}
{{\cal L}}&::= & X.l \mid {\mathsf{ag}(i)} \mid {\mathsf{adv}(j)}\\ 
{T}^l &::=& \X\mid a \mid \ek(a) \mid \dk(a) \mid \sk(a) \mid \vk(a)
 \mid n(a,j,s) \mid
 {\langle {T}^l\;  , {T}^l\rangle}  \mid {\{{T}^l\}_{\ek(a)}}^{{{\cal L}}} 
 \mid {[{T}^l]_{\sk(a)}}^{{{\cal L}}}
\end{array}$$ where $i,j\in{{\mathbb N}}$, $a\in \id$, $j,s\in{{\mathbb N}}$, $a\in \id$.

Unlabeled messages are specified similarly as terms in the algebra ${T}$ defined by $$\begin{array}{lll}    
{T}&::=& \X\mid a \mid \ek(a) \mid \dk(a) \mid \sk(a) \mid \vk(a)
  \mid n(a,j,s)  \mid  
 {\langle {T}\;  , {T}\rangle} 
 \mid {\{{T}\}_{\ek(a)}}
 \mid {[{T}]_{\sk(a)}}
\end{array}$$ where $a\in \id$, $j,s\in{{\mathbb N}}$, $a\in \id$.

A mapping ${\overline{\cdot}}:{T}^l\rightarrow {T}$ from labeled to unlabeled terms is defined by removing the labels: ${\overline{{\{k\}_{m}}^{l}}} = 
{\{{\overline{k}}\}_{{\overline{m}}}}$, ${\overline{{[k]_{m}}^{l}}} =
{[{\overline{k}}]_{{\overline{m}}}}$, ${\overline{f(t_1,\ldots,t_n)}} =
f({\overline{t_1}},\ldots,{\overline{t_n}})$ otherwise. The mapping function is extended to sets of terms as expected.

The individual behavior of each protocol participant is defined by a *role* that describes a sequence of message receptions/transmissions. A $k$-party protocol is given by $k$ such roles.

The set ${\mathsf{Roles}}^l$ of roles for labeled protocol participants is defined by ${\mathsf{Roles}}^l=(({\{\init\}}\cup{T}^l)\times({T}^l\cup{\{\stop\}}))^*$. A $k$-party labeled protocol is a mapping $\Pi:[k]\to{\mathsf{Roles}}^l$, where $[k]$ denotes the set $\{1,2,\ldots,k\}$.

Unlabeled roles and protocols are defined very similarly. The mapping function is extended from labeled protocols to unlabeled protocols as expected.

We assume that a protocol specification is such that $\Pi(j)=((l_1^j,r^j_1),(l_2^j,r^j_2),\ldots )$, the $j$’th role in the definition of the protocol being executed by player $A_j$. Each sequence $((l_1,r_1),(l_2,r_2),\ldots )\in{\mathsf{Roles}}^l$ specifies the messages to be sent/received by the party executing the role: at step $i$, the party expects to receive a message conforming to $l_i$ and returns message $r_i$. We wish to emphasize that terms $l_i^j,r_i^j$ are not actual messages, but specify how the message that is received and the message that is output should look like.

\[ex\_syntax\] The Needham-Schroeder-Lowe protocol [@lowe96breaking] is specified as follows: there are two roles $\Pi(1)$ and $\Pi(2)$ corresponding to the sender’s and receiver’s role. $$\begin{aligned}
A\rightarrow B: &  & {\{N_a,A\}_{\ek(B)}}\\    
B\rightarrow A: &  & {\{N_a,N_b,B\}_{\ek(A)}}\\    
A\rightarrow B: &  & {\{N_b\}_{\ek(B)}}    \end{aligned}$$ $$\begin{aligned}
\Pi(1) & = & (\init,{\{X^1_{A_1},A_1\}_{\ek(A_2)}}^{{\mathsf{ag}(1)}}),\;\;\;\;
    ({\{X^1_{A_1},X^1_{A_2},A_2\}_{\ek(A_1)}}^L,
     {\{X^1_{A_2}\}_{\ek(A_2)}}^{{\mathsf{ag}(1)}})\\ 
\Pi(2)& = & ({\{X^1_{A_1},A_1\}_{\ek(A_2)}}^{L_1},
{\{X^1_{A_1},X^1_{A_2},A_2\}_{\ek(A_1)}}^{{\mathsf{ag}(1)}}),\;\;\;\;
 ({\{X^1_{A_2}\}_{\ek(A_2)}}^{L_2},\stop)\end{aligned}$$

Clearly, not all protocols written using the syntax above are meaningful. In particular, some protocols might be not executable. This is actually not relevant for our result (our theorem also holds for non executable protocols).

Execution Model {#section-formal}
---------------

We define the execution model only for labeled protocols. The definition of the execution model for unlabeled protocols is then straightforward.

If $A$ is a variable or constant of sort agent, we define its knowledge by $\kn(A) = \{\dk(A),\sk(A)\}\cup \X_n(A)$, *i.e.* an agent knows its secret decryption and signing key as well as the nonces it generates during the execution. The formal execution model is a state transition system. A *global state* of the system is given by $(\SId,f,H)$ where $H$ is a set of terms of ${T}^l$ representing the messages sent on the network and $f$ maintains the local states of all session ids $\SId$. We represent session ids as tuples of the form $(n,j,(a_1,a_2,\ldots,a_k))\in({{\mathbb N}}\times{{\mathbb N}}\times {\id}^k)$, where $n\in{{\mathbb N}}$ identifies the session, $a_1,a_2,\ldots,a_k$ are the identities of the parties that are involved in the session and $j$ is the index of the role that is executed in this session. Mathematically, $f$ is a function $f:\SId\to ([\X{\to}{T}^l]\times {{\mathbb N}}\times {{\mathbb N}}),$ where $f(\mathsf{sid})=(\sigma,i,p)$ is the local state of session $\mathsf{sid}$. The function $\sigma$ is a partial instantiation of the variables occurring in role $\Pi(i)$ and $p\in {{\mathbb N}}$ is the control point of the program. Three transitions are allowed.

-   $(\SId,f,H){\xrightarrow{{\mathbf{corrupt}}(a_1,\ldots,a_l)}} (\SId,f,\cup_{1\leq j\leq l}\kn(a_j)\cup H)$. The adversary corrupts parties by outputting a set of identities. He receives in return the secret keys corresponding to the identities. It happens only once at the beginning of the execution.

-   The adversary can initiate new sessions: $(\SId,f,H){\xrightarrow{{\mathbf{new}}(i,a_1,\ldots,a_k)}} (\SId',f',H')$ where $H'$, $f'$ and $\SId'$ are defined as follows. Let $s = |\SId| +1$, be the session identifier of the new session, where $|\SId|$ denotes the cardinality of $\SId$. $H'$ is defined by $H'= H$ and $\SId'= \SId\cup\{(s,i,(a_1,\ldots,a_k))\}$. The function $f'$ is defined as follows.

    -   $f'({\mathsf{sid}}) = f({\mathsf{sid}})$ for every ${\mathsf{sid}}\in\SId$.

    -   $f'(s,i,(a_1,\ldots,a_k)) = (\sigma, i, 1)$ where $\sigma$ is a partial function $\sigma:\X{\to}{T}^l$ and: $$\left\{\begin{array}{lll}    
        \sigma(A_j) & = a_j & \quad 1\leq j\leq k \\    
        \sigma(X^j_{A_i}) & = n(a_i,j,s) & \quad j\in{{\mathbb N}}\end{array}\right.$$

    We recall that the principal executing the role $\Pi(i)$ is represented by $A_i$ thus, in that role, every variable of the form $X^j_{A_i}$ represents a nonce generated by $A_i$.

-   The adversary can send messages: $(\SId,f,H){\xrightarrow{{\mathbf{send}}({\mathsf{sid}},m)}} (\SId,f',H')$ where ${\mathsf{sid}}\in\SId$, $m\in{T}^l$, $H'$, and $f'$ are defined as follows. We define $f'({\mathsf{sid}}') = f({\mathsf{sid}}')$ for every ${\mathsf{sid}}'\neq{\mathsf{sid}}$. We denote $\Pi(j)=((l^j_1,r^j_1),\ldots,(l^j_{k_j},r^j_{k_j}))$. $f({\mathsf{sid}}) = (\sigma, j, p)$ for some $\sigma, j, p$. There are two cases.

    -   Either there exists a least general unifier $\theta$ of $m$ and $l^j_p\sigma$. Then $f'({\mathsf{sid}}) = (\sigma\cup\theta,j,p+1)$ and $H'=H\cup\{r^j_p\sigma\theta\}$.

    -   Or we define $f'({\mathsf{sid}}) = f({\mathsf{sid}})$ and $H'= H$ (the state remains unchanged).

If we denote by $\sSId = {{\mathbb N}}\times{{\mathbb N}}\times {\id}^k$ the set of all sessions ids, the set of *symbolic execution traces* is ${\mathsf{SymbTr}}^l \!=\! (\sSId\!\times\! (\sSId\!\to\! ([\X\!{\to}\!
  {T}^l]\!\times \!{{\mathbb N}}\!\times\! {{\mathbb N}}))\!\times\! 2^{{T}^l})^*$. The set of corresponding unlabeled symbolic execution traces is denoted by ${\mathsf{SymbTr}}$. The mapping function ${\overline{\cdot}}$ is extended as follows: if $tr = (\SId_0,f_0,H_0),\ldots,(\SId_n,f_n,H_n)$ is a trace of ${\mathsf{SymbTr}}^l$, ${\overline{tr}} =
({\overline{\SId_0}},{\overline{f_0}},{\overline{H_0}}),\ldots,({\overline{\SId_n}},{\overline{f_n}},{\overline{H_n}})\in{\mathsf{SymbTr}}$ where ${\overline{\SId_i}}$ simply equal $\SId_i$ and ${\overline{f_i}}:\sSId\!\to\! ([\X\!{\to}\!
  {T}]\!\times \!{{\mathbb N}}\!\times\! {{\mathbb N}}))$ with ${\overline{f_i}}({\mathsf{sid}}) = ({\overline{\sigma}},i,p)$ if $f_i({\mathsf{sid}}) = (\sigma,i,p)$ and ${\overline{\sigma}}(X) = {\overline{\sigma(X)}}$.

[c]{}

$$\begin{array}{p{2in}p{2in}p{2in}}
\begin{prooftree}    
\justifies    
S{\vdash^l}m    
\using    
m\in S    
\end{prooftree}    
\quad
&    
\begin{prooftree}    
\justifies    
S{\vdash^l}b,\ek(b),\vk(b)    
\using    
b\in \X.a   
\end{prooftree}  &
\mbox{Initial knowledge} \\ \\ \\

\begin{prooftree}    
S{\vdash^l}m_1 \quad S{\vdash^l}m_2    
\justifies    
S{\vdash^l}{\langle m_1\;  , m_2\rangle}    
\end{prooftree}    
\quad    
&    
\begin{prooftree}    
S{\vdash^l}{\langle m_1\;  , m_2\rangle}    
\justifies    
S{\vdash^l}m_i    
\using    
i\in \{1,2\}     
\end{prooftree}  &
\mbox{Pairing and unpairing} \\ \\ \\

\begin{prooftree}    
S{\vdash^l}\ek(b) \quad S{\vdash^l}m    
\justifies    
S{\vdash^l}{\{m\}_{\ek(b)}}^{{\mathsf{adv}(i)}}
\using i\in{{\mathbb N}}\end{prooftree}    
\quad    
&    
\begin{prooftree}    
S{\vdash^l}{\{m\}_{\ek(b)}}^{l} \quad S{\vdash^l}\dk(b)    
\justifies    
S{\vdash^l}m    
\end{prooftree} &
\mbox{Encryption and decryption} \\ \\ \\

\begin{prooftree}    
S{\vdash^l}\sk(b) \quad S{\vdash^l}m    
\justifies    
S{\vdash^l}{[m]_{\sk(b)}}^{{\mathsf{adv}(i)}} 
   \using i\in{{\mathbb N}}\end{prooftree}    
& 
\begin{prooftree}    
S{\vdash^l}{[m]_{\sk(b)}}^{l}  
\justifies    
S{\vdash^l}m    
  \end{prooftree} &
\mbox{Signature}
\end{array}$$

\
\
\

------------------------------------------------------------------------

\[figure-deducta\]

The adversary intercepts messages between honest participants and computes new messages using the deduction relation ${\vdash^l}$ defined in Figure \[figure-deducta\]. Intuitively, $S{\vdash^l}m$ means that the adversary is able to compute the message $m$ from the set of messages $S$. All deduction rules are rather standard with the exception of the last one: The last rule states that the adversary can recover the corresponding message out of a given signature. This rule reflects capabilities that do not contradict the standard computational security definition of digital signatures, may potentially be available to computational adversaries and are important for the soundness result of [@CortierW-ESOP05].

Next, we sketch the execution model for unlabeled protocols. As above, the execution is based on a deduction relation ${\vdash}$ that captures adversarial capabilities. The deduction rules that define ${\vdash}$ are obtained from those of ${\vdash}^l$ (Figure \[figure-deducta\]) as follows. The sets of rules *Initial knowledge* and *Pairing and unpairing* in are kept unchanged (replacing ${\vdash^l}$ by ${\vdash}$, of course). For encryption and signatures we suppress the labels ${\mathsf{adv}(i)}$ and $l$ in the encryption function $\{\_\}^\__\_$ and the signature function ${[\_]_{\_}}^\_$ for rules *Encryption and decryption* and rules *Signature*. That is, the rules for encryption are: $$\begin{prooftree}    
\quad 
S{\vdash}\ek(b) \quad S{\vdash}m    
\justifies    
S{\vdash}{\{m\}_{\ek(b)}}
\end{prooftree}    
\quad 
\quad
\begin{prooftree}    
S{\vdash}{\{m\}_{\ek(b)}} \quad S{\vdash}\dk(b)    
\justifies    
S{\vdash}m    
\end{prooftree}    
\quad$$ and those for signatures are: $$\begin{prooftree}    
S{\vdash}\sk(b) \quad S{\vdash}m    
\justifies    
S{\vdash}{[m]_{\sk(b)}}
\end{prooftree}    
\quad 
\quad
\begin{prooftree}    
S{\vdash}{[m]_{\sk(b)}}
\justifies    
S{\vdash}m    
  \end{prooftree}
   \quad$$

We use the deduction relations to characterize the set of valid execution traces. We say that the trace $(\SId_1,f_1,H_1), \ldots, (\SId_n,f_n,H_n)$ is *valid* if the messages sent by the adversary can be computed by Dolev-Yao operations. More precisely, we require that in a valid trace whenever $(\SId_i,f_i,H_i){\xrightarrow{{\mathbf{send}}(s,m)}} (\SId_{i+1},f_{i+1},H_{i+1})$, we have $H_i{\vdash^l}m$. Given a protocol $\Pi$, the set of valid symbolic execution traces is denoted by $\Exec(\Pi)$. The set $\Exec({\overline{\Pi}})$ of execution traces in the model without labels is defined similarly. We thus require that every sent message $m'$ satisfies ${\overline{H_i}} {\vdash}m'$.

Playing with the Needham-Schroeder-Lowe protocol described in Example \[ex\_syntax\], an adversary can corrupt an agent $a_3$, start a new session for the second role with players $a_1,a_2$ and send the message ${\{n(a_3,1,1),a_1\}_{\ek(a_2)}}^{{\mathsf{adv}(1)}}$ to the player of the second role. The corresponding valid trace execution is: $$\begin{gathered}
\!\!\!\!\!
(\emptyset,f_1,\emptyset){\xrightarrow{{\mathbf{corrupt}}(a_3)}}\left(\emptyset,f_1,\kn(a_3)\right)   
{\xrightarrow{{\mathbf{new}}(2,a_1,a_2)}}\\ \left(\{{\mathsf{sid}}_1\},f_2,\kn(a_3)\right)
{\xrightarrow{{\mathbf{send}}({\mathsf{sid}}_1,{\{n_3,a_1\}_{\ek(a_2)}}^{{\mathsf{adv}(1)}})}} \\
\left(\{{\mathsf{sid}}_1\},f_3,\kn(a_3)\cup
\{{\{n_3,n_2,a_2\}_{\ek(a_1)}}^{{\mathsf{ag}(1)}}\}\right),   \end{gathered}$$ where ${\mathsf{sid}}_1 = (1,2,(a_1,a_2))$, $n_2 = n(a_2,1,1)$, $n_3 = n(a_3,1,1)$, and $f_2,f_3$ are defined as follows: $f_2({\mathsf{sid}}_1) = (\sigma_1,2,1)$, $f_3({\mathsf{sid}}_1) = (\sigma_2,2,2)$ where $\sigma_1(A_1) = a_1$, $\sigma_1(A_2) = a_2$, $\sigma_1(X^1_{A_2}) = n_2$, and $\sigma_2$ extends $\sigma_1$ by $\sigma_2(X^1_{A_1}) = n_3$ and $\sigma_2(L_1) = {\mathsf{adv}(1)}$.

Relating the labeled and unlabeled execution models {#sec:relating}
---------------------------------------------------

First notice that by induction on the deduction rules, it can be easily shown that whenever a message is deducible, then the corresponding unlabeled message is also deducible. Formally, we have the following lemma.

\[lem1\] $S {\vdash^l}m \Rightarrow {\overline{S}} {\vdash}{\overline{m}}$

Note that our main result holds for any deduction rules provided this lemma holds. In particular, the rule $$\begin{prooftree}    
S{\vdash^l}{[m]_{\sk(b)}}^{l}  
\justifies    
S{\vdash^l}m    
  \end{prooftree}$$ and the corresponding unlabeled rule might be removed.

Based on the above property we show that whenever a trace corresponds to an execution of a protocol, the corresponding unlabeled trace corresponds also to an execution of the corresponding unlabeled protocol.

\[lem4\] $
tr \in \Exec(\Pi) \Rightarrow {\overline{tr}} \in \Exec({\overline{\Pi}}).
$

The key argument is that only pattern matching is performed in protocols and when a term with labels matches some pattern, the unlabeled term matches the corresponding unlabeled pattern. The proof is done by induction on the length of the trace.

-   Let $tr = {\mbox{$(SId_{0}, f_{0}, H_{0})$}}$, where $\SId_0$ and $H_0$ are empty sets. We have ${\overline{H_0}} = H_0$. $f_0$ is defined nowhere, and so is ${\overline{f_0}}$. Clearly, ${\overline{tr}} = (\SId_0, {\overline{f_0}}, {\overline{H_0}})$ is in $\Exec({\overline{\Pi}})$.

-   Let $tr \in \Exec(\Pi)$, $tr = e_0, ..., e_n = {\mbox{$(SId_{0}, f_{0}, H_{0})$}}, ..., {\mbox{$(SId_{n}, f_{n}, H_{n})$}}$, such that ${\overline{tr}} \in \Exec({\overline{\Pi}})$. We have to show that if $tr' = tr, {\mbox{$(SId_{n+1}, f_{n+1}, H_{n+1})$}} \in \Exec(\Pi)$, then we have ${\overline{tr'}} \in \Exec({\overline{\Pi}})$. There are three possible operations.

    1.  $corrupt(a_1, ..., a_k)$. It means that $tr = {\mbox{$(SId_{0}, f_{0}, H_{0})$}}, {\mbox{$(SId_{1}, f_{1}, H_{1})$}}$. In this case, we have $\SId_1 = \SId_0 = \emptyset$, $f_1 = f_0$ and $H_1 = H_0 \cup \bigcup_{1 \leq i \leq k} \kn(a_i)$. We can conclude that ${\overline{tr}} = (\SId_0, {\overline{f_0}}, {\overline{H_0}}),(\SId_1, {\overline{f_1}}, {\overline{H_1}})$ is in $\Exec({\overline{\Pi}})$, because there are no labels in $H_1$ and $f_1$ is still not defined.

    2.  $new(i, a_1, ..., a_k)$. No labels are involved in this operation. The extension made to $f_n$ is the same as is made to ${\overline{f_n}}$. Neither $H_n$ nor ${\overline{H_n}}$ are modified. ${\overline{tr'}} = {\overline{tr}}, (\SId_{n+1}, {\overline{f_{n+1}}}, {\overline{H_{n+1}}})$ is a valid trace.

    3.  $send(s, m)$. First, we have to be sure that if $m$ can be deduced from $H_n$, then ${\overline{m}}$ can be deduced from ${\overline{H_n}}$. This is Lemma \[lem1\].

        Note that $\SId_n = \SId_{n+1}$ thus ${\overline{\SId_n}} = {\overline{\SId_{n+1}}}$. Let $f_n(s)=(\sigma, i, p)$ and $\Pi(i) = (..., (l_p, r_p), ...)$. We have two cases.

        -   Either there is a substitution $\theta$ with $m = l_p\sigma\theta$. Then $f_{n+1}(s) = (\sigma \cup \theta, i, p+1)$. Thus ${\overline{f_n}}(s) = ({\overline{\sigma}}, i, p)$ and ${\overline{f_{n+1}}}(s) = ({\overline{\sigma}} \cup {\overline{\theta}}, i, p+1)$. By induction hypothesis, ${\overline{tr}}$ is a valid trace. From $m = l_p\sigma\theta$ follows ${\overline{m}} = {\overline{l_p}} {\overline{\sigma}}{\overline{\theta}}$. We conclude that ${\overline{tr}}, (\SId_{n+1}, {\overline{f_{n+1}}}, {\overline{H_{n+1}}}) =
            {\overline{tr'}}$ is a valid trace, thus a member of $\Exec({\overline{\Pi}})$.

        -   Or no substitution $\theta$ with $m = l_p\sigma\theta$ exists. Then $tr' = e_0, ..., e_n, e_{n+1}$ with $e_n = e_{n+1}$. We must show that it is always possible to construct a message $m' \in {T}$, such that there exists no substitution $\theta'$ with $m' = {\overline{l_p}} {\overline{\sigma}} \theta'$. Then, from the validity of $tr'$ and ${\overline{tr}}$ we can deduce the validity of ${\overline{tr'}}$, because ${\overline{e_n}} = {\overline{e_{n+1}}}$.

            Either there exists no substitution $\theta'$ such that ${\overline{m}} = {\overline{l_p}}
            {\overline{\sigma}} \theta'$. In that case, we choose $m' = {\overline{m}}$.

            Or let $\theta'$ be a substitution such that ${\overline{m}} = {\overline{l_p}}
            {\overline{\sigma}} \theta'$. Then the matching for $m$ fails because of labels. This can be shown by contradiction. Assume $m$ contain no label, *i. e.* $m$ does not contain subterms of the form $\{t\}^l_{\ek(a_i)}$ or $[t]^l_{\sk(a_i)}$, $t \in {T}$. In that case, we have ${\overline{m}} = m$ by definition. &gt;From ${\overline{m}} = {\overline{l_p}}
            {\overline{\sigma}} \theta'$, we deduce that $m = l_p\sigma\theta'$, contradiction.

            We deduce that ${\overline{m}}$ contains some subterm of the form $\{t\}_{\ek(a_i)}$ or $[t]_{\sk(a_i)}$. The fact ${\overline{m}} =
            {\overline{l_p}} {\overline{\sigma}} \theta'$ implies that ${\overline{l_p}}$ has to contain one of the following subterms: $\{t'\}_{\ek(A_i)}$, $[t']_{\sk(A_i)}$ with $t' \in T$ or, a variable of sort ciphertext or signature.

            Then, we choose $m' = a$ for some agent identity $a\in\X.a$. The term $a$ is deducible from ${\overline{H_n}}$. Now, the matching of $m'$ with ${\overline{l_p}}$ always fails, either because of the encryption or signature occurring in ${\overline{l_p}}$ or because of type mismatch for a variable of type ciphertext or signature in ${\overline{l_p}}$.

 {#section-alogic}

In this section we define a logic for specifying security properties. We then show that the logic is quite expressive and, in particular, it can be used to specify rather standard secrecy and authenticity properties.

Preliminary definitions {#section-Preliminary}
-----------------------

To a trace $tr = e_1, ..., e_n = {\mbox{$(SId_{1}, f_{1}, H_{1})$}}, ..., {\mbox{$(SId_{n}, f_{n}, H_{n})$}}
\in {\mathsf{SymbTr}}$ we associate its set of indices ${\mathcal{I}}(tr) = \{i {\;|\;}e_i
\mbox{ appears in the trace } tr \}$. We also define the set of local states ${\mbox{$\mathcal{LS}$}}_{i,p}(tr)$ for role $i$ at step $p$ that appear in trace $tr$ by $
{\mbox{$\mathcal{LS}$}}_{i, p}(tr) = \{(\sigma, i, p) {\;|\;}\exists s \in \SId_k, k \in {\mathcal{I}}(tr),
\mbox{ such that } f_k(s) = (\sigma, i, p) \}.
$

We assume an infinite set ${\mathit{Sub}}$ of meta-variables for substitutions. We extend the term algebra to allow substitution application. More formally, let ${T_{\mathit{Sub}}}^l$ be the algebra defined by: $$\begin{array}{lll}
{{\cal L}}&::= & \varsigma(x_l) \mid {\mathsf{ag}(i)} \mid {\mathsf{adv}(j)} \\ 
{T_{\mathit{Sub}}}^l &::=&  \varsigma(x)  \mid a \mid \ek(a) \mid \dk(a) \mid \sk(a)
\mid \vk(a) \mid
 {\langle {T_{\mathit{Sub}}}^l\;  , {T_{\mathit{Sub}}}^l\rangle}  \mid {\{{T_{\mathit{Sub}}}^l\}_{\ek(a)}}^{{{\cal L}}} 
 \mid {[{T_{\mathit{Sub}}}^l]_{\sk(a)}}^{{{\cal L}}} 
\end{array}$$ where $x_l\in\X.l$, $\varsigma\in{\mathit{Sub}}$, $i,j\in{{\mathbb N}}$, $x\in\X$, $a\in
\id$. The unlabeled algebra ${T_{\mathit{Sub}}}$ is defined similarly. The mapping function between the two algebras is defined by: ${\overline{\varsigma(x)}}= 
\varsigma(x)$, ${\overline{{\{k\}_{m}}^{l}}} =
{\{{\overline{k}}\}_{{\overline{m}}}}$, ${\overline{{[k]_{m}}^{l}}} =
{[{\overline{k}}]_{{\overline{m}}}}$, ${\overline{f(t_1,\ldots,t_n)}} =
f({\overline{t_1}},\ldots,{\overline{t_n}})$ otherwise.

Security Logic {#section-security}
--------------

In this section we describe a logic for security properties. Besides standard propositional connectors, the logic has a predicate to specify honest agents, equality tests between terms, and existential and universal quantifiers over the local states of agents.

The formulas of the logic ${\mathcal{L}_1}^l$ are defined as follows: $$\begin{array}{lll}
F(tr) & ::= & NC(tr, t_1) {\;|\;}(t_1 = t_2) {\;|\;}\neg F(tr) {\;|\;}F(tr) \wedge F(tr) {\;|\;}F(tr) \vee F(tr) {\;|\;}\\
& & {\mbox{$\forall\mathcal{LS}_{i, p}(tr).\varsigma\;$}}F(tr) {\;|\;}{\mbox{$\exists\mathcal{LS}_{i, p}(tr).\varsigma\;$}}F(tr)
\end{array}$$ where $tr$ is a parameter of the formula, $i,p\in {{\mathbb N}}$, $\varsigma\in{\mathit{Sub}}$, $t_1$ and $t_2$ are terms of ${T_{\mathit{Sub}}}^l$. Note that formulas are parametrized by a trace $tr$. As usual, we may use $\phi_1\rightarrow\phi_2$ as a shortcut for $\neg\phi_1\vee\phi_2$.

We similarly define the corresponding unlabeled logic ${\mathcal{L}_1}$: the tests $(t_1 =
t_2)$ are between unlabeled terms $t_1,t_2$ over ${T}_\mathit{sub}$. The mapping function ${\overline{\cdot}}$ is extended as expected. In particular ${\overline{NC(tr, t)}} = NC({\overline{tr}}, {\overline{t}})$, ${\overline{(t_1 =
  t_2)}} = ({\overline{t_1}} = {\overline{t_2}})$, ${\overline{{\mbox{$\forall\mathcal{LS}_{i, p}(tr).\varsigma\;$}}F(tr)}} = {\mbox{$\forall\mathcal{LS}_{i, p}({\overline{tr}}).\varsigma\;$}}{\overline{F(tr)}}$ and ${\overline{{\mbox{$\exists\mathcal{LS}_{i, p}(tr).\varsigma\;$}}F(tr)}} = 
{\mbox{$\exists\mathcal{LS}_{i, p}({\overline{tr}}).\varsigma\;$}}{\overline{F(tr)}}$.

Here, the predicate $NC(tr, t)$ of arity 2 is used to specify non corrupted agents. The quantifications ${\mbox{$\forall\mathcal{LS}_{i, p}(tr).\varsigma\;$}}$ and ${\mbox{$\exists\mathcal{LS}_{i, p}(tr).\varsigma\;$}}$ are over the local states in the trace that correspond to agent $i$ at control point $p$. The semantics of our logic is defined for *closed* formula as shown in Figure \[interpretation\].

$$\begin{aligned}
{\mbox{$[\![ NC(tr, t) ]\!]$}} & = & 
\left\{
    \begin{array}{l l}
  1 &   \mbox{if } t\in\id  \mbox{ and $t$ does not appear
  in a corrupt action, \textit{i.e.} }
\\ & tr=e_1, e_2, ..., e_n \mbox{ and }\\ & \forall a_1,\ldots,a_k
  \mbox{, s.t.  } e_1{\xrightarrow{{\mathbf{corrupt}}(a_1,\ldots,a_k)}}e_2, t\neq a_i
 \\
  0 &  \mbox{otherwise} 
    \end{array} \right.
\\
{\mbox{$[\![ (t_1 = t_2) ]\!]$}} & = & \left\{
    \begin{array}{l l}
  1 &   \mbox{if } t_1=t_2  \mbox{ (syntactic equality)}\\
  0 &  \mbox{otherwise} 
    \end{array} \right.
\\
{\mbox{$[\![ \neg F(tr) ]\!]$}} & = & \neg {\mbox{$[\![ F(tr) ]\!]$}}\\
{\mbox{$[\![ F_1(tr)\wedge F_2(tr) ]\!]$}} & = & {\mbox{$[\![ F_1(tr) ]\!]$}}\wedge {\mbox{$[\![ F_2(tr) ]\!]$}}\\
{\mbox{$[\![ F_1(tr)\vee F_2(tr) ]\!]$}} & = & {\mbox{$[\![ F_1(tr) ]\!]$}}\vee {\mbox{$[\![ F_2(tr) ]\!]$}}\\
{\mbox{$[\![ {\mbox{$\forall\mathcal{LS}_{i, p}(tr).\varsigma\;$}}F(tr) ]\!]$}} & = & \left\{  
   \begin{array}{l l}
  1 &   \mbox{if } \forall (\theta, i, p) \in {\mbox{$\mathcal{LS}$}}_{i, p}(tr), \mbox{ we have }
  {\mbox{$[\![ F(tr)[\theta/\varsigma] ]\!]$}} = 1,  \\
  0 &  \mbox{otherwise}. 
   \end{array} \right.
\\
{\mbox{$[\![ {\mbox{$\exists\mathcal{LS}_{i, p}(tr).\varsigma\;$}}F(tr) ]\!]$}} & = & \left\{  
   \begin{array}{l l}
  1 &   \mbox{if } \exists (\theta, i, p) \in {\mbox{$\mathcal{LS}$}}_{i, p}(tr), \mbox{ s.t. }
  {\mbox{$[\![ F(tr)[\theta/\varsigma] ]\!]$}} = 1,  \\
  0 &  \mbox{otherwise}. 
   \end{array} 
\right.\end{aligned}$$

------------------------------------------------------------------------

\[interpretation\]

Next we define when a protocol $\Pi$ satisfies a formula $\phi\in{\mathcal{L}_1}^l$. The definition for the unlabeled execution model is obtained straightforwardly. Informally, a protocol $\Pi$ satisfies $\phi$ if $\phi(tr)$ is true for all traces $tr$ of $\Pi$. Formally:

Let $\phi$ be a formula and $\Pi$ be a protocol. We say that $\Pi$ satisfies security property $\phi$, and write $\Pi \models \phi$ if for any trace $tr\in\Exec(\Pi)$, ${\mbox{$[\![ \phi(tr) ]\!]$}}=1$.

Abusing notation, we occasionally write $\phi$ for the set $\{tr\mid
{\mbox{$[\![ \phi(tr) ]\!]$}}=1\}$. Then, $\Pi\models\phi$ precisely when $\Exec(\Pi)\subseteq\phi$.

Examples of security properties {#section-Examples}
-------------------------------

In this section we exemplify the use of the logic by specifying secrecy and authenticity properties.

### A secrecy property

Let $\Pi(1)$ and $\Pi(2)$ be the sender’s and receiver’s role of a two-party protocol. To specify our secrecy property we use a standard encoding. Namely, we add a third role to the protocol, $\Pi(3) = (X^1_{A_3},
stop)$, which can be seen as some sort of witness.

Informally, the definition of the secrecy property $\phi_s$ states that, for two non corrupted agents $A_1$ and $A_2$, where $A_1$ plays role $\Pi(1)$ and $A_2$ plays role $\Pi(2)$, a third agent playing role $\Pi(3)$ cannot gain any knowledge on nonce $X^1_{A_1}$ sent by role $\Pi(1)$. $$\phi_s(tr) ={\mbox{$\forall\mathcal{LS}_{1,1}(tr).\varsigma\;$}} {\mbox{$\forall\mathcal{LS}_{3,2}(tr).\varsigma'\;$}}
[ NC(tr, \varsigma(A_1))  \wedge NC(tr, \varsigma(A_2))
  \rightarrow
\neg (\varsigma'(X^1_{A_3}) = \varsigma(X^1_{A_2}))
]$$

### An authentication property

Consider a two role protocol, such that role 1 finishes its execution after $n$ steps and role 2 finishes its execution after $p$ steps. For this kind of protocols we give a variant of the week agreement property [@lowe97hierarchy]. Informally, this property states that whenever an instantiation of role 2 finishes, there exists an instantiation of role 1 that has finished and they agree on some value for some variable and they have indeed talked to each other. In our example we choose this variable to be $X^1_{A_1}$. Note that we capture that some agent has finished its execution by quantifying appropriately over the local states of that agent. More precisely, we quantify only over the states where it indeed has finished its execution. $$\begin{gathered}
\phi_a(tr) =
 {\mbox{$\forall\mathcal{LS}_{2,p}(tr).\varsigma\;$}} {\mbox{$\exists\mathcal{LS}_{1,n}(tr).\varsigma'\;$}}\\
[NC(tr, \varsigma(A_1))\wedge NC(tr, \varsigma'(A_2)) 
\rightarrow
 (\varsigma(X^1_{A_1}) = \varsigma'(X^1_{A_1})) \wedge 
(\varsigma(A_2) = \varsigma'(A_2)) \wedge (\varsigma(A_1) = \varsigma'(A_1))]\end{gathered}$$

Notice that although in its current version our logic is not powerful enough to specify stronger versions of agreement (like injective or bijective agreement), it could be appropriately extended to deal with this more complex forms of authentication.

 {#section-main}

Recall that our goal is to prove that ${\overline{\Pi}}\models
{\overline{\phi}}\Rightarrow \Pi\models \phi$. However, as explained in the introduction this property does not hold in general. The following example sheds some light on the reasons that cause the desired implication to fail.

\[ex:counter\] Consider the first step of some protocol where $A$ sends a message to $B$ where some part is intended for some third agent. $$\begin{array}{rcl}
A& \rightarrow B:& \{N_a, \{N_a\}_{\ek(C)}, \{N_a\}_{\ek(C)}\}_{\ek(B)}
\end{array}$$

The specification of the programs of $A$ and $B$ that corresponds to this first step is as follows (in the definition below $C^1_{A_2}$ and $C^2_{A_2}$ are variables of sort ciphertext).

$$\begin{array}{lll}
\Pi(1) & = &  (\init, {\{\langle X^1_{A_1},\langle 
{\{X^1_{A_1}\}_{\ek(A_3)}}^{{\mathsf{ag}(1)}},
{\{X^1_{A_1}\}_{\ek(A_3)}}^{{\mathsf{ag}(2)}}\rangle\rangle\}_{\ek(A_2)}}^{{\mathsf{ag}(3)}})\\[2ex]
\Pi(2) & = & 
({\{\langle X^1_{A_1},\langle C^1_{A_2}, C^2_{A_2}\rangle\rangle\}_{\ek(A_2)}}^{L},
\stop)
\end{array}$$ We assume that $A$ generates twice the message $\{N_a\}_{\ek(C)}$. Notice that we stop the execution of $B$ after it receives the first message since this is sufficient for our purpose, but its execution might be continued to form a more realistic example.

Consider the security property $\phi_1$ that states that if $A$ and $B$ agree on the nonce $X^1_{A_1}$ then $B$ should have received twice the same ciphertext. $$\begin{gathered}
\phi_1(tr) = {\mbox{$\forall\mathcal{LS}_{1,2}(tr).\varsigma\;$}} {\mbox{$\forall\mathcal{LS}_{2,2}(tr).\varsigma'\;$}}\\
NC(tr, \varsigma(A_1)) \wedge NC(tr, \varsigma(A_2)) \wedge
(\varsigma(X^1_{A_1}) = \varsigma'(X^1_{A_1})) \rightarrow
(\varsigma'(C^1_{A_2}) = \varsigma'(C^2_{A_2}))\end{gathered}$$ This property clearly does not hold for any normal execution of the labeled protocol since $A$ always sends ciphertexts with distinct labels. Thus $\Pi\not\models \phi_1$.

On the other hand, one can show that we have ${\overline{\Pi}}\models {\overline{\phi_1}}$ in the unlabeled execution model. Intuitively, this holds because if $A$ and $B$ are honest agents and agree on $X^1_{A_1}$, then the message received by $B$ has been emitted by $A$ and thus should contain identical ciphertexts (after having removed their labels).

Logic ${\mathcal{L}_2}^l$ {#section-logic}
-------------------------

The counterexample above relies on the fact that two ciphertexts that are equal in the model without labels may have been derived from distinct ciphertexts in the model with labels. Hence, it may be the case that although ${\overline{t_1}}\neq
{\overline{t_2}}\Rightarrow t_1\neq t_2$, the contrapositive implication ${\overline{t_1}}={\overline{t_2}}\Rightarrow t_1= t_2$ does not hold, which in turn entails that formulas that contain equality tests between ciphertexts may be true in the model without labels, but false in the model with labels. In this section we identify a fragment of ${\mathcal{L}_1}^l$, which we call ${\mathcal{L}_2}^l$ where such tests are prohibited. Formally, we avoid equality tests between arbitrary terms by forbidding arbitrary negation over formulas and allowing equality tests only between *simple* terms.

A term $t$ is said *simple* if $t\in \X.a\cup\X.n$ or $t=a$ for some $a\in \id$ or $t= n(a, j, s)$ for some $a\in \id$, $j,s\in{{\mathbb N}}$.

An important observation is that for any simple term $t$ it holds that ${\overline{t}}=t$.

The formulas of the logic ${\mathcal{L}_2}^l$ are defined as follows: $$\begin{array}{lll}
F(tr) & ::= & NC(tr, t_1) {\;|\;}\neg NC(tr, t_1) \mid F(tr) \wedge F(tr)
{\;|\;}F(tr) \vee F(tr) \mid (t_1 \neq t_2) {\;|\;}(u_1 = u_2) \mid\\
 & & {\mbox{$\forall\mathcal{LS}_{i,p}(tr).\varsigma\;$}}F(tr) {\;|\;}{\mbox{$\exists\mathcal{LS}_{i,p}(tr).\varsigma\;$}}F(tr),  \\
\end{array}$$ where $tr\in {\mathsf{SymbTr}}$ is a parameter, $i,p \in {{\mathbb N}}$, $t_1,t_2\in{T_{\mathit{Sub}}}^l$ and $u_1,u_2$ are simple terms.

Since simple terms also belong to ${T_{\mathit{Sub}}}^l$, both equality and inequality tests are allowed between simple terms.

The corresponding unlabeled logic ${\mathcal{L}_2}$ is defined as expected. Note that ${\mathcal{L}_2}^l\subset {\mathcal{L}_1}^l$ and ${\mathcal{L}_2}\subset {\mathcal{L}_1}$.

Theorem {#section-theorem}
-------

Informally, our main theorem says that to verify if a protocol satisfies some security formula $\phi$ in logic ${\mathcal{L}_2}^l$, it is sufficient to verify that the unlabeled version of the protocol satisfies ${\overline{\phi}}$.

Let $\Pi$ be a protocol and $\phi\in{\mathcal{L}_2}^l$, then ${\overline{\Pi}}\models{\overline{\phi}} \Rightarrow \Pi\models\phi$.

Assume ${\overline{\Pi}}\models{\overline{\phi}}$. We have to show that for any trace $tr\in\Exec(\Pi)$, ${\mbox{$[\![ \phi(tr) ]\!]$}}=1$. &gt;From lemma \[lem4\] it follows that ${\overline{tr}} \in \Exec({\overline{\Pi}})$, thus ${\mbox{$[\![ {\overline{\phi}}({\overline{tr}}) ]\!]$}}=1$, since ${\overline{\Pi}}\models{\overline{\phi}}$. Thus, it is sufficient to show that ${\mbox{$[\![ {\overline{\phi}}({\overline{tr}}) ]\!]$}} \Rightarrow {\mbox{$[\![ \phi(tr) ]\!]$}}$. The following lemma offers the desired property.

\[lem3\] Let $\phi(tr)\in{\mathcal{L}_2}^l$ for some $tr\in{\mathsf{SymbTr}}$, ${\mbox{$[\![ {\overline{\phi}}({\overline{tr}}) ]\!]$}}$ implies ${\mbox{$[\![ \phi(tr) ]\!]$}}$.

The proof of the lemma is by induction on the structure of $\phi(tr)$.

-   $\phi(tr) = NC(tr, t)$ or $\phi(tr) = \neg NC(tr, t)$. ${\mbox{$[\![ NC(tr, t) ]\!]$}}=1$, if and only if $t\in \id$ and $t$ does not occur in a ${\mathbf{corrupt}}$ event for the trace $tr$. This is equivalent to ${\overline{t}}\in \id$ and ${\overline{t}}$ does not occur in a ${\mathbf{corrupt}}$ event for the trace ${\overline{tr}}$. Thus ${\mbox{$[\![ NC(tr, t) ]\!]$}}=1$ if and only if ${\mbox{$[\![ {\overline{NC(tr, t)}} ]\!]$}} =
    {\mbox{$[\![ NC({\overline{tr}}, {\overline{t}}) ]\!]$}}=1$.

-   $\phi(tr) = (t_1\neq t_2)$. We have that ${\overline{\phi}}({\overline{tr}}) = ({\overline{t_1}} \neq
      {\overline{t_2}})$ holds. Assume by contradiction that $\phi(tr)$ does not hold, *i.e* $t_1=t_2$. This implies ${\overline{t_1}} = {\overline{t_2}}$, contradiction.

-   $\phi(tr) = (u_1 = u_2)$ with $u_1,u_2$ simple terms. We have that ${\overline{\phi}}({\overline{tr}}) = ({\overline{u_1}} = {\overline{u_2}})$ holds. Since $u_1$ and $u_2$ are simple terms, we have ${\overline{u_i}} = u_i$, thus $u_1 = u_2$. We conclude that $\phi(tr)$ holds.

-   The cases $\phi(tr) = \phi_1(tr) \vee \phi_2(tr)$ or $\phi(tr) = \phi_1(tr) \wedge
      \phi_2(tr)$ are straightforward.

-   $\phi(tr) = {\mbox{$\forall\mathcal{LS}_{i}(tr).\varsigma\;$}} F(tr)$. If ${\overline{\phi}}({\overline{tr}})$ holds, this means that for all $(\theta, i, p)) \in {\mbox{$\mathcal{LS}$}}_{i, p}({\overline{tr}})$, ${\mbox{$[\![ {\overline{F}}({\overline{tr}})[\theta/\varsigma] ]\!]$}} = 1$.

    Let $(\theta', i, p) \in {\mbox{$\mathcal{LS}$}}_{i, p}(tr)$. We consider ${\mbox{$[\![ F(tr)[\theta'/\varsigma] ]\!]$}}$. Since $tr \in \Exec(\Pi)$ implies ${\overline{tr}} \in \Exec({\overline{\Pi}})$ (Lemma \[lem4\]), we have $({\overline{\theta'}}, i, p) \in {\mbox{$\mathcal{LS}$}}_{i, p}({\overline{tr}})$. By induction hypothesis, ${\mbox{$[\![ {\overline{F}}({\overline{tr}})[{\overline{\theta'}}/\varsigma] ]\!]$}} = 1$ implies that ${\mbox{$[\![ F(tr)[\theta'/\varsigma] ]\!]$}} = 1$. It follows that $$\forall (\theta', i, p) \in {\mbox{$\mathcal{LS}$}}_{i, p}(tr)\; {\mbox{$[\![ F(tr)[\theta'/\varsigma] ]\!]$}} = 1.$$ Thus, $\phi(tr)$ holds.

-   $\phi(tr) = {\mbox{$\exists\mathcal{LS}_{i}(tr).\varsigma\;$}} F(tr)$. If ${\overline{\phi}}({\overline{tr}})$ holds, this means that there exists $(\theta, i, p)) \in {\mbox{$\mathcal{LS}$}}_{i, p}({\overline{tr}})$, such that ${\mbox{$[\![ {\overline{F}}({\overline{tr}})[\theta/\varsigma] ]\!]$}} = 1$.

    By definition of the mapping function, there exists $(\theta', i, p)
    \in {\mbox{$\mathcal{LS}$}}_{i, p}(tr)$ such that ${\overline{\theta'}}=\theta$. By induction hypothesis, ${\mbox{$[\![ F(tr)[\theta'/\varsigma] ]\!]$}} = 1$. Thus there exists $\theta'$, such that ${\mbox{$[\![ F(tr)[\theta'/\varsigma] ]\!]$}} = 1$. Thus, $\phi(tr)$ holds.

 {#section-discussion}

We conclude with a brief discussion of two interesting aspects of our result. First, as mentioned in the introduction, the only property needed for our main theorem to hold is that the underlying deduction system satisfies the condition in Lemma \[lem1\], that is $S {\vdash^l}m
\Rightarrow {\overline{S}} {\vdash}{\overline{m}}$. In fact, an interesting result would be to prove a more abstract and modular version of our theorem.

Secondly, a natural question is whether the converse of our main theorem holds. We prove that this is not the case. More precisely, we show that there exists a protocol $\Pi$ and a property $\phi$ such that $\Pi\models \phi$ but ${\overline{\Pi}}\not\models
{\overline{\phi}}$. Let $\Pi$ be the protocol defined in Example \[ex:counter\]. Consider a security property $\phi_2$ that states on the contrary that whenever $A$ and $B$ agree on the nonce $X^1_{A_1}$ then $B$ should have received two distinct ciphertexts. Formally: $$\begin{gathered}
\phi_2(tr) = {\mbox{$\forall\mathcal{LS}_{1,2}(tr).\varsigma\;$}} {\mbox{$\forall\mathcal{LS}_{2,2}(tr).\varsigma'\;$}}\\
 NC(tr, \varsigma(A_1)) \wedge NC(tr, \varsigma(A_2)) \wedge
(\varsigma(X^1_{A_1}) = \varsigma'(X^1_{A_1})) 
\rightarrow
(\varsigma'(C^1_{A_2}) \neq \varsigma'(C^2_{A_2}))\end{gathered}$$ where $C^1_{A_2}$ and $C^2_{A_2}$ are variables of sort ciphertext.

This property clearly does not hold for any honest execution of the unlabeled protocol since $A$ always sends twice the same ciphertext, and thus ${\overline{\Pi}}\not\models{\overline{\phi_2}}$. On the other hand however, one can show that this property holds for labeled protocols since, if $A$ and $B$ are honest agents and agree on $X^1_{A_1}$, it means that the message received by $B$ has been emitted by $A$ and thus contains two distinct ciphertexts. Thus, $\Pi\models \phi_2$. We conclude that, in general, $\Pi\models \phi$ does not imply ${\overline{\Pi}}\models{\overline{\phi}}$.
