年轻人!怎么,对这古老的祖国你不打算出点力?

A Quantum Interpretation of Bunched Logic & Quantum Separation Logic

Li Zhou, Gilles Barthe, Justin Hsu, Mingsheng Ying, Nengkun Yu

# 关于理解

  1. 关于C\mathbf{C}-modification, 实际上对应了经典逻辑中的 substitution,目的就是对于一个 postcondition ϕ\phi,希望找到一个 substitution ϕ[C]\phi[\mathbf{C}] 满足: {ϕ[C]}C{ϕ}\models\{\phi[\mathbf{C}]\}\mathbf{C}\{\phi\}

# 技术细节

# Notations

  • Let V\mathbf{V} be the set of all quantum variables.

  • A quantum register is a list of distinct variables qˉ=q1,...,qn\bar{q}=q_1,...,q_n. Each quantum variable qq has a type Hq\mathcal{H}_q, which is the state Hilbert space of quantum system denoted by qq.

  • For a set of quantum variables S={q1,...,qn}VS=\{q_1,...,q_n\}\subseteq\mathbf{V} (or a quantum register qˉ=q1,...,qn\bar{q}=q_1,...,q_n):

    1. HS=i=1nHqi\mathcal{H}_S=\bigotimes_{i=1}^n \mathcal{H}_{q_i}: the Hilbert space of SS.

    2. dim(S)\dim(S): the dimension of HS\mathcal{H}_S.

    3. D(S)\mathcal{D}(S): the set of all (mixed) quantum states of SS.

    4. For any ρD(S)\rho\in\mathcal{D}(S), its domain is defined as dom(ρ)S\text{dom}(\rho)\triangleq S. We write D=SVD(S)\mathcal{D}=\bigcup_{S\subseteq\mathbf{V}}\mathcal{D}(S) for the set of all states.

    5. P(S)\mathcal{P}(S): the set of projections on HS\mathcal{H}_S. In particular, for any PP(S)P\in\mathcal{P}(S), its domain is defined as free(P)S\text{free}(P)\triangleq S.

      Since there is a one-to-one correspondence between projections and closed subspaces, we sometimes call closed subspaces of HS\mathcal{H}_S projections. We write P=SVP(S)\mathcal{P}=\bigcup_{S\subseteq\mathbf{V}}\mathcal{P}(S) for the set of all projections.

    6. ρStrdom(ρ)\S(ρ)\rho|_S\triangleq \text{tr}_{\text{dom}(\rho)\backslash S}(\rho): the restriction of state ρ\rho on SS, defined as a reduced density operator over Sdom(ρ)S\cap \text{dom}(\rho).

# Quantum Interpretation of Bunched Logic

Definition(BI logic):

  • BI formula is generated with the following syntax:

    ϕ,ψ::=pAPϕψϕψϕψϕψϕψ\newcommand\sepimp{\mathrel{-\mkern-6mu*}} \phi,\psi::=p\in\mathcal{AP}\mid\top\mid\bot\mid\phi\wedge\psi\mid\phi\wedge\psi\mid\phi\rightarrow\psi\mid\phi *\psi\mid\phi\sepimp\psi\\

    where pp ranges over a set AP\mathcal{AP} of atomic propositions.

  • BI frame is a tuple X=(X,,,e)\mathcal{X}=(X,\circ,\preceq,e) where XX is a set equipped with a preorder \preceq, and :X×XX\circ:X\times X\rightarrow X is a partial binary operation with an unit element ee, satisfying:

    1. (Unit Existence) xX,x=xe=ex\forall x\in X,x=x\circ e=e\circ x.
    2. (Commutativity) xy=yxx\circ y=y\circ x.
    3. (Associativity) x(yz)=(xy)zx\circ (y\circ z)=(x\circ y)\circ z.
    4. (Compatible with \preceq) If xxx\preceq x' and yyy\preceq y and xy,xyx\circ y,x'\circ y' are defined, then xyxyx\circ y\preceq x'\circ y'.

    The “==” means that either both sides are defined, or both undefined.

  • A valuation is a mapping V:AP(X)\mathcal{V}:\mathcal{AP}\rightarrow\wp(X) where \wp represents the power set. The map is monotonic if xV(p)x\in\mathcal{V}(p) and yxy\succeq x implies yV(p)y\in\mathcal{V}(p).

  • A BI frame X\mathcal{X} together with a monotonic valuation V\mathcal{V} gives a BI model M=(X,,,e,V)\mathcal{M}=(X,\circ,\prec,e,\mathcal{V}).

  • Given a BI formula ϕ\phi and a BI model M\mathcal{M}, for each xXx\in X, the satisfaction relation xϕx\models \phi is defined by induction on ϕ\phi:

    1. xMpx\models_{\mathcal{M}} p iff xV(p)x\in\mathcal{V}(p).
    2. xMx\models_{\mathcal{M}}\top: always.
    3. xMx\models_{\mathcal{M}}\bot: never.
    4. xMϕ1ϕ2x\models_{\mathcal{M}}\phi_1\wedge\phi_2 iff xMϕ1x\models_{\mathcal{M}}\phi_1 and xMϕ2x\models_{\mathcal{M}}\phi_2.
    5. xMϕ1ϕ2x\models_{\mathcal{M}}\phi_1\vee\phi_2 iff xMϕ1x\models_{\mathcal{M}}\phi_1 or xMϕ2x\models_{\mathcal{M}}\phi_2.
    6. xMϕ1ϕ2x\models_{\mathcal{M}}\phi_1\rightarrow\phi_2 iff xx\forall x'\succeq x, xMϕ1x'\models_{\mathcal{M}}\phi_1 implies xMϕ2x'\models_{\mathcal{M}}\phi_2.
    7. xMϕ1ϕ2x\models_{\mathcal{M}}\phi_1*\phi_2 iff y,z\exists y,z s.t. yzy\circ z is defined and xyzx\succeq y\circ z and yMϕ1y\models_{\mathcal{M}}\phi_1 and zMϕ2z\models_{\mathcal{M}}\phi_2.
    8. x\models_{\mathcal{M}}\phi_1\sepimp\phi_2 iff y\forall y s.t. xyx\circ y is defined, yMϕ1y\models_{\mathcal{M}}\phi_1 implies xyMϕ2x\circ y\models_{\mathcal{M}}\phi_2.

Then we are going to introduce the quantum instance for BI logic:

# BI frame of quantum states

For a BI frame X=(X,,,e)\mathcal{X}=(X,\circ,\preceq,e), we instantiate it in quantum case:

  • XDX\triangleq\mathcal{D} is the set of all states.

  • For :D×DD\circ:\mathcal{D}\times\mathcal{D}\rightarrow\mathcal{D}:

    ρ1ρ2{ρ1ρ2if dom(ρ1)dom(ρ2)=undefinedotherwise\rho_1\circ\rho_2\triangleq\begin{cases}\rho_1\otimes\rho_2 & \text{if dom}(\rho_1)\cap\text{dom}(\rho_2)=\emptyset\\ \text{undefined}&\text{otherwise}\end{cases}

  • For preorder \preceq defined on D\mathcal{D}:

    ρ1ρ2 iff dom(ρ1)dom(ρ2) and ρ1=ρ2dom(ρ1)\rho_1\preceq\rho_2 \text{ iff } \text{dom}(\rho_1)\subseteq\text{dom}(\rho_2)\text{ and }\rho_1=\rho_2|_{\text{dom}(\rho_1)}

  • For the unit ee, it’s understood as the state over the empty register.

# Atomic propositions about quantum states

  • Propositions denoting free variables:

    For each variable set SVS\subseteq\mathbf{V}, we introduce a set of atomic propositions D[S]\mathbf{D}[S] with domain defined by free(D[S])S\text{free}(\mathbf{D}[S])\triangleq S. We interpret it as the state with domain at least SS:

    [D[S]]{ρD:Sdom(ρ)}[|\mathbf{D}[S]|]\triangleq\{\rho\in\mathcal{D}:S\subseteq\text{dom}(\rho)\}

  • Propositions for qualitative analysis:

    For qualitative analysis of quantum programs, we often use projection operators as atomic propositions. For a projection PPP\in\mathcal{P} as an atomic proposition, its semantics is defined as:

    [P]{ρD:free(P)dom(ρ) and supp(ρfree(P))P}[|P|]\triangleq\{\rho\in\mathcal{D}:\text{free}(P)\subseteq\text{dom}(\rho)\text{ and supp}(\rho|_{\text{free}(P)})\subseteq P\}

    where the support of a state ρD\rho\in\mathcal{D} is the (topological) closure of the subspaces spanned by its eigenvectors with nonzero eigenvalues, or equivalently:

    supp(ρ)={ϕHdom(ρ):ϕρϕ=0}\text{supp}(\rho)=\{|\phi\rangle\in\mathcal{H}_{\text{dom}(\rho)}:\langle\phi|\rho|\phi\rangle=0\}^{\bot}

    Let’s carefully explain the definition of [P][|P|]. In the case that ρ\rho has the same domain of PP, it is natural to define ρ[P]\rho\in[|P|] if its support space supp(ρ)\text{supp}(\rho) lies in PP.

    In the case where dom(ρ)\text{dom}(\rho) and free(P)\text{free}(P) are not the same, in order to make [P][|P|] upward-closed (i.e. monotonic): ρ[P]\rho\in[|P|] and ρρ\rho\preceq\rho' imply ρ[P]\rho'\in[|P|], it is appropriate to require that ρ[P]\rho\in[|P|] iff dom(ρ)free(P)\text{dom}(\rho)\supseteq \text{free}(P) and the restricted state of ρ\rho on free(P)\text{free}(P) is in [P][|P|].

  • Atomic propositions expressing uniformity in quantum security

    For each variable set SVS\subseteq\mathbf{V}, we introduce an atomic proposition U[S]\mathbf{U}[S]. Its domain is free(U[S])S\text{free}(\textbf{U}[S])\triangleq S. The semantics is defined as:

    [U(S)]{ρD:Sdom(ρ) and ρS=ISdim(S)}[|\textbf{U}(S)|]\triangleq \left \{\rho\in\mathcal{D}:S\subseteq \text{dom}(\rho)\text{ and }\rho|_S=\frac{I_S}{\dim(S)}\right \}

    The intuition is: for a state ρ[U(S)]\rho\in[|\textbf{U}(S)|] such that Sdom(ρ)S\subseteq\text{dom}(\rho), its restriction on SS should be the completely mixed state, ISdim(S)\frac{I_S}{\dim(S)}, which means “uniformly distributed” over all orthonormal bases of the system denoted by SS.

  • Axiom schema for atomic formulas

    1. D[S]IS\models \mathbf{D}[S]\leftrightarrow I_S, where ISI_S is the identity operator over HS\mathcal{H}_S, i.e. [D(S)]=[IS][|\mathbf{D}(S)|]=[|I_S|].
    2. For all P,QPP,Q\in\mathcal{P} with disjoint domains, PQPQ\models P\wedge Q\leftrightarrow P\otimes Q.
    3. If S1S2S_1\subseteq S_2, then U[S2]U[S1]\models \mathbf{U}[S_2]\rightarrow\mathbf{U}[S_1].
    4. If S1S2=S_1\cap S_2=\emptyset, then (U[S1]U[S2])U[S1S2]\models (\mathbf{U}[S_1]*\mathbf{U}[S_2])\leftrightarrow \mathbf{U}[S_1\cup S_2].

# Restriction property

The formulas generated by following grammar are denoted by RES:

ϕ,ψ::=pAPϕψϕψϕψ\phi,\psi::=p\in\mathcal{AP}\mid\top\mid\bot\mid\phi\wedge\psi\mid\phi\vee\psi\mid\phi*\psi

Any formular ϕRes\phi\in\text{Res} is restrictive, that is, for any ρϕ,ρfree(ϕ)ϕ\rho\models\phi,\rho|_{\text{free}(\phi)}\models\phi.

# Modification of BI Formulas

Let C\mathbf{C} be a unitary transformation qˉ:=U[qˉ]\bar{q}:=U[\bar{q}] or an initialization q:=0q:=|0\rangle,

For any pAPp\in\mathcal{AP}, we write p[C]p[\mathbf{C}] for the modification:

  1. For atomic proposition D[S]\mathbf{D}[S], D[S][C]D[S]\mathbf{D}[S][\mathbf{C}]\triangleq\mathbf{D}[S].

  2. For a projection PP,

    P[qˉ:=U[qˉ]]{PU[qˉ]qˉfree(P)Pqˉfree(P)=undefinedotherwiseP[qˉ:=0]{D[q]Pqqfree(P)PotherwiseP[\bar{q}:=U[\bar{q}]]\triangleq\begin{cases} P_{U[\bar{q}]}&\bar{q}\subseteq\text{free}(P)\\ P&\bar{q}\cap\text{free}(P)=\emptyset\\ \text{undefined}&\text{otherwise} \end{cases}\\ P[\bar{q}:=|0\rangle]\triangleq\begin{cases} \textbf{D}[q]\wedge \lceil P\rceil_q &q\in\text{free}(P)\\ P&\text{otherwise} \end{cases}\\

    where

    PU[qˉ]=(UqˉIfree(P)\qˉ)P(UqˉIfree(P)\qˉ)P_{U[\bar{q}]}=(U^{\bar{q}\dagger}\otimes I_{\text{free}(P)\backslash \bar{q}})P(U^{\bar{q}}\otimes I_{\text{free}(P)\backslash \bar{q}})

    and Pq={\lceil P\rceil_q=\bigsqcup\{ closed subspaces T:0q0TP}P(free(P)\q)T:|0\rangle_q\langle 0|\otimes T\subseteq P\}\in\mathcal{P}(\text{free}(P)\backslash q).

    Here \sqcup is the disjunction of projections in quantum logic, that is, for projections P,QP,Q with the same domain, PQ=span(PQ)P\sqcup Q=\overline{\text{span}(P\cup Q)} with “\overline{\cdot}” standing for (topological closure).

  3. For uniformity atomic proposition,

    U[S][qˉ:=U[qˉ]]={U[S]qˉS or qˉS=undefinedotherwiseU[S][qˉ:=0]={U[S]qSundefinedotherwise\mathbf{U}[S][\bar{q}:=U[\bar{q}]]=\begin{cases} \mathbf{U}[S]&\bar{q}\subseteq S\text{ or }\bar{q}\cap S=\emptyset\\ \text{undefined} &\text{otherwise} \end{cases}\\ \mathbf{U}[S][\bar{q}:=|0\rangle]=\begin{cases} \mathbf{U}[S]&q\notin S\\ \text{undefined} &\text{otherwise} \end{cases}\\

we write ϕ[C]\phi[\mathbf{C}]\downarrow when ϕ[C]\phi[\mathbf{C}] is defined.

  • if ϕ=,\phi=\top,\bot, ϕ[C]ϕ\phi[\mathbf{C}]\triangleq \phi;

  • if ϕ=pAP\phi=p\in\mathcal{AP}, ϕ[C]\phi[\mathbf{C}] is defined as above;

  • if ϕ=ϕ1ϕ2\phi=\phi_1\wedge\phi_2 and ϕ1[C]\phi_1[\mathbf{C}]\downarrow and ϕ2[C]\phi_2[\mathbf{C}]\downarrow, then ϕ[C]=ϕ1[C]ϕ2[C]\phi[\mathbf{C}]=\phi_1[\mathbf{C}]\wedge\phi_2[\mathbf{C}];

  • if ϕ=ϕ1ϕ2\phi=\phi_1\vee\phi_2 and ϕ1[C]\phi_1[\mathbf{C}]\downarrow and ϕ2[C]\phi_2[\mathbf{C}]\downarrow, then ϕ[C]=ϕ1[C]ϕ2[C]\phi[\mathbf{C}]=\phi_1[\mathbf{C}]\vee\phi_2[\mathbf{C}];

  • if ϕ=ϕ1ϕ2\phi=\phi_1*\phi_2 and ϕ1[C],ϕ2[C]\phi_1[\mathbf{C}]\downarrow,\phi_2[\mathbf{C}]\downarrow and (qˉfree(ϕ1)\bar{q}\subseteq \text{free}(\phi_1) or qˉfree(ϕ1)=\bar{q}\wedge\text{free}(\phi_1)=\emptyset) and (qˉfree(ϕ2)\bar{q}\subseteq \text{free}(\phi_2) or qˉfree(ϕ2)=\bar{q}\wedge\text{free}(\phi_2)=\emptyset), then

    • if C=qˉ:=U[qˉ]\mathbf{C}=\bar{q}:=U[\bar{q}], then ϕ[C]=ϕ1[C]ϕ2[C]\phi[\mathbf{C}]=\phi_1[\mathbf{C}]*\phi_2[\mathbf{C}];
    • if C=q:=0\mathbf{C}=q:=|0\rangle, then
      • if qfree(ϕ1)free(ϕ2)q\notin\text{free}(\phi_1)\cup\text{free}(\phi_2), ϕ[C]=ϕ1[C]ϕ2[C]\phi[\mathbf{C}]=\phi_1[\mathbf{C}]*\phi_2[\mathbf{C}];
      • if only one of qfree(ϕ1)q\in\text{free}(\phi_1) or qfree(ϕ2)q\in\text{free}(\phi_2)is satisfied, then ϕ[C]=(ϕ1[C]ϕ2[C])(D[free(ϕ1)\q]D[free(ϕ2)\q])\phi[\mathbf{C}]=(\phi_1[\mathbf{C}]\wedge\phi_2[\mathbf{C}])\wedge (\mathbf{D}[\text{free}(\phi_1)\backslash q]*\mathbf{D}[\text{free}(\phi_2)\backslash q]).
  • otherwise, ϕ[C]\phi[\mathbf{C}] is undefined.

Proposition:

  • free(ϕ)=free(ϕ[C])\text{free}(\phi)=\text{free}(\phi[\mathbf{C}]).
  • for all ρD(free(ϕ)var(C))\rho\in\mathcal{D}(\text{free}(\phi)\cup\text{var}(\mathbf{C})), if ρϕ[C]\rho\models \phi[\mathbf{C}], then [C](ρ)ϕ[|\mathbf{C}|](\rho)\models \phi.

# Quantum Separation Logic

Let V\mathbf{V} be a set of quantum variables with free(ϕ),free(ψ),var(C)V\text{free}(\phi),\text{free}(\psi),\text{var}(\mathbf{C})\subseteq\mathbf{V}. Then V{ϕ}C{ψ}\mathbf{V}\models\{\phi\}\mathbf{C}\{\psi\} is true in the sense of partial correctness if we have:

ρD(V),ρϕ[C]V(ρ)ψ\forall \rho\in\mathcal{D}(\mathbf{V}),\rho\models\phi\Rightarrow[|\mathbf{C}|]_{\mathbf{V}}(\rho)\models\psi

Inference rules:

{ϕ}skip{ψ}ϕ[q:=0]{ϕ[q:=0}q:=0{ϕ}{ϕ}C1{ψ}{ψ}C2{μ}{ϕ}C1;C2{μ}m,{ϕMm}Cm{ϕ}ψCM{ϕD(qˉ)}if (m.M[qˉ]=mCm) fi{ψ}{ϕM1}C{ϕD(qˉ)}ϕCM{ϕD(qˉ)}while M[qˉ]=1 do C od{ϕM0}\begin{aligned} &\frac{}{\{\phi\}\text{skip}\{\psi\}}\\ &\frac{\phi[q:=|0\rangle]\downarrow}{\{\phi[q:=|0\rangle\}q:=|0\rangle\{\phi\}}\\ &\frac{\{\phi\}\mathbf{C}_1\{\psi\}\quad\{\psi\}\mathbf{C}_2\{\mu\}}{\{\phi\}\mathbf{C}_1;\mathbf{C}_2\{\mu\}}\\ & \frac{\forall m,\{\phi*M_m\}\mathbf{C}_m\{\phi\}\quad \psi\in\text{CM}}{\{\phi*\mathbf{D}(\bar{q})\}\text{if }(\square m.M[\bar{q}]=m\rightarrow\mathbf{C}_m)\text{ fi}\{\psi\}}\\ &\frac{\{\phi*M_1\}\mathbf{C}\{\phi*\mathbf{D}(\bar{q})\}\quad \phi\in\text{CM}}{\{\phi*\mathbf{D}(\bar{q})\}\text{while }M[\bar{q}]=1\text{ do }\mathbf{C}\text{ od}\{\phi\wedge M_0\}} \end{aligned}

where “CM” stands for closed under mixtures. i.e., if dom(ρ)=dom(ρ)\text{dom}(\rho)=\text{dom}(\rho') and ρϕ,ρϕ\rho\models\phi,\rho'\models\phi, we have λ[0,1],λρ+(1λ)ρϕ\forall \lambda\in[0,1],\lambda\rho+(1-\lambda)\rho'\models \phi.

Proposition: The formulas generated by following grammar are CM:

ϕ,ψ::=pAPϕψU[S]ϕ\phi,\psi::=p\in\mathcal{AP}\mid\top\mid\bot\mid\phi\wedge\psi\mid\mathbf{U}[S]*\phi

Structural rules:

D[free(ϕ)free(ϕ)](ϕϕ){ϕ}C{ψ}D[free(ψ)free(ψ)](ψψ){ϕ}C{ψ}{ϕ1}C{ψ1}{ϕ2}C{ψ2}{ϕ1ϕ2}C{ψ1ψ2}{ϕ1}C{ψ1}{ϕ2}C{ψ2}{ϕ1ϕ2}C{ψ1ψ2}{ϕ}C{ψ}free(μ)var(C)={ϕμ}C{ψμ}{ϕ}C{ψ}free(μ)var(C)=free(ψ)var(C)free(ϕ) or ψSP{ϕμ}C{ψμ}\begin{aligned} &\frac{\mathbf{D}[\text{free}(\phi)\cup\text{free}(\phi')]\rightarrow(\phi\rightarrow\phi')\quad \{\phi'\}\mathbf{C}\{\psi'\}\quad\mathbf{D}[\text{free}(\psi)\cup\text{free}(\psi')]\rightarrow(\psi\rightarrow\psi')}{\{\phi\}\mathbf{C}\{\psi\}}\\ &\frac{\{\phi_1\}\mathbf{C}\{\psi_1\}\quad\{\phi_2\}\mathbf{C}\{\psi_2\}}{\{\phi_1\wedge\phi_2\}\mathbf{C}\{\psi_1\wedge\psi_2\}}\\ &\frac{\{\phi_1\}\mathbf{C}\{\psi_1\}\quad\{\phi_2\}\mathbf{C}\{\psi_2\}}{\{\phi_1\vee\phi_2\}\mathbf{C}\{\psi_1\vee\psi_2\}}\\ &\frac{\{\phi\}\mathbf{C}\{\psi\}\quad\text{free}(\mu)\cap\text{var}(\mathbf{C})=\emptyset}{\{\phi\wedge\mu\}\mathbf{C}\{\psi\wedge \mu\}}\\ &\frac{\{\phi\}\mathbf{C}\{\psi\}\quad\text{free}(\mu)\cap\text{var}(\mathbf{C})=\emptyset\quad\text{free}(\psi)\cup\text{var}(\mathbf{C})\subseteq\text{free}(\phi)\text{ or }\psi\in\text{SP}}{\{\phi*\mu\}\mathbf{C}\{\psi*\mu\}} \end{aligned}

​ A formula ψ\psi is called supported, written ψSP\psi\in\text{SP}, if [ψ][|\psi|] is nonempty then it has a least element, or equivalently, there exists a SVS\subseteq\mathbf{V} such that

  • at most one ρD(S)\rho\in\mathcal{D}(S) satisfies ψ\psi.
  • if σψ\sigma\models\psi, σρ\sigma\succeq \rho.

​ 其中,条件中的ρD[free(ϕ)free(ϕ)](ϕϕ)\rho\models\mathbf{D}[\text{free}(\phi)\cup\text{free}(\phi')]\rightarrow(\phi\rightarrow\phi') 前面那个 D,其实就是限定了要求那些满足free(ϕ)free(ϕ)dom(ρ)\text{free}(\phi)\cup\text{free}(\phi')\subseteq\text{dom}(\rho)ρ\rho 可以ρϕϕ\rho\models \phi\rightarrow\phi'

Edited on Views times