A logical analysis of entanglement and separability in quantum higher-order functions
We present a logical separability analysis for a functional quantum computation language. This logic is inspired by previous works on logical analysis of aliasing for imperative functional programs. Both analyses share similarities notably because th…
Authors: F. Prost, C. Zerrari
A logical analysis of en tanglemen t and separabilit y in quan tum higher-order fun ctions F. Prost and C. Zerrari LIG 46, a v F ´ elix Viallet, F-38031 Grenoble, F rance Frederic.P rost@imag. fr Abstract. W e present a logical separabilit y analysis for a functional quantum computation language. This logic is inspired by previous works on logical analysis of aliasing for imp erative functional programs. Both analyses share si milarities notably because they are highly n on-com- p ositional. Quantum setting is harder to deal with since it introduces non d eterminism and thus considerably mo difies seman tics and v alid- it y of logical assertions. This logic is the first prop osal of entangle- ment/s eparabilit y analysis d ealing with a functional q uantum program- ming language with higher-order functions. 1 In t ro duction The aim of high level progr amming language is to provide a sufficiently high le vel of abstractio n in order b oth to av o id unneces sary burden coming from technical details and to provide useful ment al guidelines for the programmer. Quant um computation [4] is s till in its prime and qua n tum pr ograming lang uages remain in need for s uch abstr a ctions. F unctional quantum prog r aming languages hav e bee n prop ose d and offer ways to handle the no - cloning axiom via linea r λ -calc uli [9, 7]. In [1] is developed QML in which a purely q uantum control expr ession is int ro duced in orde r to repr esent quantum super po sition in prog ramming terms. Another cr ucial ing redient of quantum co mputation is the handling o f e ntan- glement o f quantum states during computation. Indeed without entanglemen t it is p ossible to efficiently simulate quantum computations on a class ic al com- puter [10]. A first step to deal with entanglemen t, and its dual: separability , ha s bee n done in [5] in which a type system is provided in order to approximate the ent anglement relation of a n array of quantum bits. Quantum bits entanglemen t analysis shares s ome simila rities with v ariables name aliasing ana lysis.Indeed, alia sing analyzes are complica ted since an action on a v ar iable o f a given name may hav e rep ercussio ns on another v ariable having a differe n t name. The same kind of problems o ccur betw een t wo ent angled quan- tum bits : if one quantum bit is measured then the other one can be affected. In bo th cases there is a compo sitionality issue: it is hard to state an ything ab out a progra m without any knowledge of its context. It seems therefore sensible to try to adapt known alia sing analys is techniques to the quantum setting. In this pap er we follow the idea developed in [2 ] and adapt it for entangle- men t/separa bilit y analys is in a functiona l quantum pr ogra ming la nguage with higher order functions. The work of [2] has to b e ada pted in a non determin- istic setting, which is inherent of quantum co mputation, making the seman tics and so undness of the log ic radically different. Moreover, o ur results ar e a strict improv ement ov er [5] in which only fir st or der functions are consider ed. 1.1 outline of the pap er W e first start by giving the definition of the dual problems of entanglement and separability , together with quick reminders on quantum computation, in se ction 2. Then, in sectio n 3, w e pres e n t a functional quantum computatio n language in section for which we define an entanglemen t logic in section 4. Finally , we conclude in s ection 5 . 2 Separabilit y and Entan glemen t A n qubits register is repres ent ed by a normalized vector in a Hilbert 2 n - dimension spa c e that is the tensorial pro duct o f n dimension 2 Hilber t spa ces o n C 2 . Each 2 dimension s ubspace repr esents a qubit. F or a given vector, written | ϕ i , qubits c a n b e either entangled o r s eparable. Definition 1 (En tanglement, Separability ). Consider | ϕ i a n qubits r e gis- ter. ϕ is sep ar able if it is p ossible to p artition the n qubits in t wo non empty sets A, B , t wo states | ϕ A i and | ϕ B i describing A and B qubits, such that | ϕ i = | ϕ A i ⊗ | ϕ B i , wher e | ϕ A i and | ϕ B i ,otherwise it is said entangle d. By extension, two qubits q , q ′ ar e sep ar able if and only if ther e exists a p ar- tition A, B , two states | ϕ A i and | ϕ B i describing A and B qubits, such t hat | ϕ i = | ϕ A i ⊗ | ϕ B i , with q ∈ A and q ′ ∈ B . Ot herwise q , q ′ ar e entangle d. Definition 2 (En tanglement relation). L et a n qubits r e gister b e r epr esent e d by | ϕ i . The entanglement r elation of | ϕ i , E ( | ϕ i ) , over qubits of the r e gister is define d as fol lows: ( x, y ) ∈ E ( | ϕ i ) if and only if x and y ar e entangle d. The en tanglement relation is an equiv alenc e relation. It is indeed o bviously symmetric and reflexive. It is transitive b ecause if ( x, y ) ∈ E ( | ϕ i ) and ( y, z ) ∈ E ( | ϕ i ). It is p ossible to find a par tition X , Z (with x ∈ X and z ∈ Z ) and | ϕ X i , | ϕ Z i s uch that | ϕ i = | ϕ X i ⊗ | ϕ Z i . y is either in X or Y then either ( x, y ) or ( y , z ) is not in E ( | ϕ i ), thu s the result by contradiction. 3 λ Q L a functional quantum computing language W e use a v a riant of Selinger and V aliron’s λ -calculus [7] as progr amming la n- guage. Ins tea d of considering arbitrar y unitar y transforma tions w e only consider three: q ua nt um phase T , Hadama rd tr ansformation H , and co nditional not Cnot . This restriction do est not make our langua ge less ge neral since it for ms a univer- sal q ua nt um g ates s et, s ee [4]. It makes entanglemen t a nalysis simpler . Indeed, only Cnot may create entanglement . W e als o in tro duce another simplifications: since the calculus may b e linear o nly fo r qua nt um bits we do not use all the lin- ear artillery (bang, linear implications e tc) but only chec k that abstractio ns over quantum bits are linear. More over we supp os e a fix e d num b er o f q uantum bits, therefore there ar e no new op er ators creating new qua nt um bits during co mpu- tation. Indeed a s shown in [6] name g eneration cr eates nontrivial pr o blems. Therefore, in the following we s uppo se the n um ber of quantum bit reg is ters fixed although non s pe c ifie d and refer to it as n . 3.1 Syn tax and ty p es Definition 3 (T erms and t yp es). λ Q L terms and t yp es ar e inductively defin e d by: M , N , P ::= x | q i | 1 | 0 | λx : M .N | ( M N ) | 1 | 0 | h M , N i | π i N | if M the n N else P | meas | Cnot | H | T σ , τ ::= B | B ◦ | σ → τ | σ ⊗ τ wher e x denotes names of element of a c ountable set of variables. q i , wher e i ∈ { 1 ..n } ar e c onst ant names that ar e u se d as r efer enc e for a c oncr ete quan- tum bit arr ay. 1 , 0 ar e standar d b o ole an c onst ant. π i N with i ∈ { 1 , 2 } is the pr oje ction op er ator. T erms of the t hir d line ar e quantum primitives r esp e ctively for me asur e, quantum bit initialization and the thr e e quantum gates Conditional not, H adamar d and phase. We only have two b ase t yp es B for bits and B ◦ for quantu m bits, arr ow and pr o duct typ es ar e standar d ones. Note that if quantum bits a re consta nts, there c a n b e quant um bits v ar iable in this λ Q L . Consider for instanc e the following piece of co de: ( λx : M . i f M th en q 1 else q 2 ). After reduction x may even tually beco me either q 1 or q 2 . W e write q without subscript to denote qua ntum bit v ar iables. Definition 4 (Con text and typing judgments). Contexts ar e inductivel y define d by: Γ ::= · | Γ , x : σ wher e σ is not B ◦ . We define lists of quantum bits variable by: Λ ::= · | Λ, q T yping judgments ar e of the form: Γ ; Λ ⊢ M : σ and s hal l b e r e ad as : under the typing c ontext Γ , list of quantu m bits variable Λ , the term M is wel l forme d of typ e σ . As usual we require that typing contexts a nd lists are unam biguous. It means that when we write Γ , x : σ (resp. Λ, q ) x (resp. q ) is implicitly supp osed not to app ear in Γ (re sp. Λ ). Simila r ly when w e write Γ 1 , Γ 2 (resp. Λ 1 , Λ 2 ) we intend that Γ 1 and Γ 2 (resp. Λ 1 and Λ 2 ) a re disjoint contexts. Typing rules a re the following : Γ ; Λ ⊢ q i : B ◦ [ AxQ ] Γ ; q ⊢ q : B ◦ [ V ar Q ] Γ, x : σ ; · ⊢ x : σ [ V ar ] Γ ; · ⊢ 1 : B [ AxT ] Γ ; · ⊢ 0 : B [ AxF ] Γ ; · ⊢ M : σ Γ, x : τ ; · ⊢ M : σ [ W k g ] Γ, x : σ ; Λ ⊢ M : τ Γ ; Λ ⊢ λx : σ .M : σ → τ [ → I ] Γ ; Λ ⊢ M : σ → τ Γ ; · ⊢ N : σ Γ ; Λ ⊢ ( M N ) : τ [ → E ] Γ ; Λ, q ⊢ M : τ Γ ; Λ ⊢ λq : B ◦ .M : B ◦ → τ [ → ◦ I ] Γ ; Λ 1 ⊢ M : σ → τ Γ ; Λ 2 ⊢ N : σ Γ ; Λ 1 , Λ 2 ⊢ ( M N ) : τ [ → ◦ E ] Γ ; Λ 1 ⊢ M : τ Γ ; Λ 2 ⊢ N : σ Γ ; Λ 1 , Λ 2 ⊢ h M , N i : τ ⊗ σ [ ⊗ I ] Γ ; Λ 1 ⊢ M : B Γ ; Λ 2 ⊢ N : τ Γ ; Λ 2 ⊢ P : τ Γ ; Λ 1 , Λ 2 ⊢ if M then N else P : τ [ I F I ] Γ ′ ; Λ ⊢ M : τ 1 ⊗ τ 2 Γ ; Λ ⊢ π i M : τ i [ ⊗ E ] ii ∈ { 1 , 2 } Γ ; Λ ⊢ M : B ◦ Γ ; Λ ⊢ H M : B ◦ [ H AD ] Γ ; Λ ⊢ M : B ◦ Γ ; Λ ⊢ T M : B ◦ [ P H A ] Γ ; Λ ⊢ M : B ◦ Γ ; Λ ⊢ meas M : B [ M E AS ] Γ ; Λ ⊢ M : B ◦ ⊗ B ◦ Γ ; Λ ⊢ Cnot M : B ◦ ⊗ B ◦ [ C N OT ] Where in rule [ ⊗ E ] Γ ′ = Γ, x : σ , y : τ if σ and τ are not B ◦ , Γ ′ = Γ , x : σ (resp. Γ, y : τ ) if τ (r esp. σ ) is B ◦ and σ (resp. τ ) is not B ◦ . Λ ′ 2 is build in a symmetrical wa y , thus Λ ′ 2 is Λ 2 augmented with v aria bles x or y if and only if their type is B ◦ . λ Q L is a standar d simply type d λ -calculus with tw o base types which is linear for terms of t ype B ◦ . Th us we ensure the no-cloning prop erty of quantum physics (e.g. [4]). 3.2 Op erational s eman tics Quantum particular ities have strong implications in the design of a quantum progra mming languag e. First, s ince quantum bits may b e entangled tog e ther it is not possible to textually represent individual quant um bits a s a normalized vector of C 2 . W e us e | 1 i and | 0 i as base. Therefore , a quantum progra m manip- ulating n quantum bits is r epresented as a quantum state of a Hilb ert space C 2 n and co nstants of t ype B ◦ are p ointers to this quantum state. Moreover, quantum op erators mo dify this state introducing imp era tive ac tio ns. As a co ns equence a n ev aluation order has to be set in order to k eep some kind o f co nfluence. Moreov er, λ Q L reductions are probabilistic. Indeed, quantum mechanics pr op erties induce an inher en t probabilistic b ehavior when measuring the state o f a qua nt um bit. Definition 5 ( λ Q L state). L et Γ ; Λ ⊢ M : σ . A λ Q L state is a c ouple [ | ϕ i , M ] .wher e | ϕ i is a normalize d ve ctor of C 2 n Hilb ert sp ac e and M a λ Q L term. An ex ample of λ Q L state o f s iz e n = 2 is the following: [ | ϕ i , ( λq : B ◦ . if ( meas q 1 ) th en 1 el se ( meas ( T q )) q 2 )] where | ϕ i = 1 √ 2 ( | 0 i + | 1 i ) ⊗ ( 2 3 | 0 i + √ 5 3 | 1 i ) q 1 is the quantum bit deno ted by 1 √ 2 ( | 0 i + | 1 i ) and q 2 the one r epresented by 2 3 | 0 i + √ 5 3 | 1 i . W e c onsider call by v alue reductio n rules. V alues a re defined as usual. Definition 6 (V alues). V alues of λ Q L ar e inductively define d by: U, V ::= x | 1 | 0 | q i | λx : σ .M | h V , V i | ( F x ) Wher e F is one of the fol lowing op er ators π i , Cnot , T , H , meas W e can now define probabilistic reduction rules. W e only ment ion proba bili- ties to b e accura te although we are not going to inv es tigate any related problems in this pap er (w e do no t consider co nfluence pro blems etc.). Definition 7 (Quan tum reductions). We define a pr ob abilistic r e duction b e- twe en λ Q L states as: [ | ϕ i , M ] → p [ | ϕ ′ i , M ′ ] That has to b e r e d [ | ϕ i , M ] r e duc es t o [ | ϕ ′ i , M ′ ] with pr ob ability p . R e duct ion rules ar e the fol lowing: [ | ϕ i , ( λx : σ .M V )] → 1 [ | ϕ i , M { x := V } ] [ β V ] [ | ϕ i , N ] → p [ | ϕ ′ i , N ′ ] [ | ϕ i , ( M N )] → p [ | ϕ ′ i , ( M N ′ )] [ β ] [ | ϕ i , N ] → p [ | ϕ ′ i , N ′ ] [ | ϕ i , ( M N )] → p [ | ϕ ′ i , ( M N ′ )] [ App ] [ | ϕ i , M ] → p [ | ϕ ′ i , M ′ ] [ | ϕ i , ( M V )] → p [ | ϕ ′ i , ( M ′ V )] [ Apc ] [ | ϕ i , if 1 then M else N ] → 1 [ | ϕ i , M ] [ I F /T ] [ | ϕ i , P ] → p [ | ϕ ′ i , P ′ ] [ | ϕ i , if P then M else N ] → p [ | ϕ i , if P ′ then M else N ] [ I F ] [ | ϕ i , if 0 then M else N ] → 1 [ | ϕ i , N ] [ I F /F ] i ∈ { 1 , 2 } [ | ϕ i , π i h V 1 , V 2 i ] → 1 [ | ϕ i , V i ] [ π ] i [ | ϕ i , M ] → p [ | ϕ ′ i , M ′ ] [ | ϕ i , h M , N i ] → p [ | ϕ ′ i , h M ′ , N i ] [ LF T ] [ | ϕ i , N ] → p [ | ϕ ′ i , N ′ ] [ | ϕ i , h V , N i ] → p [ | ϕ ′ i , h V , N ′ i ] [ RGT ] [ | ϕ i , ( T q i )] → 1 [ T i ( | ϕ i ) , q i ] [ P H S ] [ | ϕ i , ( H q i )] → 1 [ H i ( | ϕ i ) , q i ] [ H D R ] [ α | ϕ 0 i + β | ϕ 1 i , ( meas q i )] → | α | 2 [ | ϕ 0 i , 1 ] [ M E F ] [ α | ϕ 0 i + β | ϕ 1 i , ( meas q i )] → | β | 2 [ | ϕ 1 i , 0 ] [ M E T ] [ | ϕ i , ( Cnot h q i i q j )] → 1 [ Cnot i,j ( | ϕ i ) , h q i , q j i ] [ C N O ] In rules [ M E T ] and [ M E F ], let | ϕ i = α | ϕ 0 i + β | ϕ 1 i b e no rmalized with | ϕ 1 i = P i = 1 n α i | φ 1 i i ⊗ | 1 i ⊗ | ψ 1 i i | ϕ 0 i = P i = 1 n β i | φ 0 i i ⊗ | 0 i ⊗ | ψ 0 i i . where | 1 i and | 0 i is the ith quantum bit. W e say that the set of rules containing [ β ], [ β V ], [ App ], [ Apc ], [ Apv ], [ I F ], [ I F /F ], [ I F /T ], [ π ] i , [ L F T ], [ RGT ] is the purely functional part o f λ Q L , the other rules are the quantum part o f λ Q L . Based o n this reduction rules one can define r eachable states, by considering the reflexive-transitive closur e of → p . One ha s to co mpo se pr obabilities along a reduction pa th. Ther e fore [ | ϕ ′ i , M ′ ] is reachable fro m [ | ϕ ′ i , M ′ ], if there is a non zero pro bability path b etw een those states. Mor e prec is ions can b e found in [7 ]. Computations of a λ Q L term are done from an initial state where all reg is ters are set to | 0 i : | ϕ 0 i = | 0 i n − 1 z }| { ⊗ . . . ⊗ | 0 i Prop ositio n 1 (Sub ject Reduction). L et Γ , Λ ⊢ M : τ and M → p M ′ , t hen Γ, Λ ⊢ M ′ : τ Pr o of. F rom the typing p oint o f v iew λ Q L is nothing more than a simply typed λ -calculus with c o nstants for q ua nt um bits manipulatio ns . Note that T , H , Cnot act as ident it y functions (from the strict λ -ca lculus p o int of view). The measure- men t is simple to deal with since it o nly retur ns constant (hence typable in a ny contexts). 4 En t anglemen t logic for λ Q L W e pres ent a static analysis for the study of the entanglemen t r elation during a quantum computation. The idea that we fo llow in this pap er is to adapt the work [2] to the quantum setting. The lo gic is in the style of Hoare [3 ] and lea ds to the following no tation: { C } M : Γ ; Λ, u { C ′ } where C is a precondition, C ′ is a p ost-co ndition, M is the sub ject and u is its anchor (the name us e d in C ′ to denote M v alue). Informally , this judgment can be red: if C is s a tisfied, then after the ev aluation of M , whose v a lue is denoted by u in C ′ , C ′ is satisfied. Γ ; Λ is the typing context of M and ∆ is the anchor t yping context : it is used in order to type anchors within asser tio ns. Indeed, anchors denote ter ms and hav e to b e typed. Since we ar e in terested in s e parability ana ly sis, assertions state whe ther tw o quantum bits a re entangled or not. Moreover, since separa bilit y is uncomputable (it trivia lly reduces to the halt problem since o n can add Cnot ( q i , q j ) as a last line o f a pro gram in such a wa y that q i and q j are e n tangled iff the computation stops), assertions are safe approximations: if an asser tion state that tw o quantum bits are se parable then they rea lly ar e, wher eas if tw o quantum bits are stated ent angled by an assertio n, it is p oss ible that in re a lity they a re not. 4.1 Assertions Definition 8 . T erms and assertions ar e define d by the fol lowing gr ammar: e, e ′ ::= u | q i | h e, e ′ i | π i ( e ) C, C ′ ::= u ↔ v | k e | e = e ′ ¬ C | C ∨ C ′ | C ∧ C ′ | C = ⇒ C ′ | ∀ u.C | ∃ u.C { C } e 1 • e 2 = e 3 { C ′ } Wher e u, v ar e names fr om a c ou n table set of anchor names. The idea b ehind assertio ns is the following: every subterm of a prog ram is ident ified in assertions b y a n anchor, whic h is simply a unique name. The anchor is the lo gical count erpart o f the progr am. Note that the na me of quantum bits are considered a s g round ter ms. Assertion u ↔ v mea ns that the quan tum bit iden tified b y u is po ssibly ent angled with v . Notice that ¬ u ↔ v means that it is sure that u and v are separable. k u means tha t it is for sure that the quantum bit is in a base state (it can be see n as α | b i where b is either 1 or 0 ). Th us ¬k u means that u may no t be in a base sta te (her e the approximation works the other aro und). Asser tion { C } e 1 • e 2 = e 3 { C ′ } is used to ha ndle higher order functions. It is the ev aluation formula. e 3 binds its fr e e o ccurrences in C ′ . following [2], C, C ′ are called internal pre/p ost co nditions. The idea is that inv o ca tion of a function denoted by e 1 with argument e 2 under the co ndition that the initial asser tion C is satisfied by the current quantum state ev alua tes in a new quantum state in which C ′ is satisfied. C ′ describ es the new entanglemen t and purity rela tio ns. The other a ssertions ha ve their standa rd fir st order logic meaning. Notice that in ∀ and ∃ binder are o nly meant to be used on quantum bits. T ha t is ∀ u .C means that u is e ither of the for m q i or of the form x , with x of t ype B ◦ but cannot b e o f the for m h e, e ′ i . In the following we T (resp. F ) for the following tautolog y (r esp. ant ilogy) u = u (res p ¬ ( u = u )). Definition 9 (Assertion t yping). – A lo gic al term t is wel l typ e d of typ e τ , written Γ ; Λ ; ∆ ⊢ t : τ if it c an b e derive d fr om the fol lowing ru les: ( u : τ ) ∈ Γ ; Λ ; ∆ Γ ; Λ ; ∆ ⊢ u : τ [ T AsAx ] Γ ; Λ ; ∆ ⊢ q i : B ◦ [ T AsQ ] Γ ; Λ ; ∆ ⊢ e : τ Γ ; Λ ; ∆ ⊢ e ′ : τ ′ Γ ; Λ ; ∆ ⊢ h e , e ′ i : τ ⊗ τ ′ [ T As ⊗ ] Γ ; Λ ; ∆ ⊢ u : τ 1 ⊗ τ 2 Γ ; Λ ; ∆ ⊢ π i ( u ) : τ i [ T Asπ i ] with i ∈ { 1 , 2 } . – An assertion C is wel l typ e d under c ontext Γ ; Λ ; ∆ written Γ ; Λ ; ∆ ⊢ C if it c an b e derive d fr om the fol lowing ru les: Γ ; Λ ; ∆ ⊢ e : B ◦ Γ ; Λ ; ∆ ⊢ e ′ : B ◦ Γ ; Λ ; ∆ ⊢ e ↔ e ′ [ T As ↔ ] Γ ; Λ ; ∆ ⊢ e : B ◦ Γ ; Λ ; ∆ ⊢ k e [ T As k ] Γ ; Λ ; ∆ ⊢ e : τ Γ ; Λ ; ∆ ⊢ e ′ : τ Γ ; Λ ; ∆ ⊢ e = e ′ [ T As =] Γ ; Λ ; ∆ ⊢ C Γ ; Λ ; ∆ ⊢ ¬ C [ T As ¬ ] Γ ; Λ ; ∆ ⊢ C Γ ; Λ ; ∆ ⊢ C ′ Γ ; Λ ; ∆ ⊢ C ∧ C ′ [ T As ∧ ] Γ ; Λ ; ∆ ⊢ C Γ ; Λ ; ∆ ⊢ C ′ Γ ; Λ ; ∆ ⊢ C ∨ C ′ [ T As ∨ ] Γ ; Λ ; ∆ ⊢ C Γ ; Λ ; ∆ ⊢ C ′ Γ ; Λ ; ∆ ⊢ C = ⇒ C ′ [ T As = ⇒ ] Γ ; Λ ; ∆, u : B ◦ ⊢ C Γ ; Λ ; ∆ ⊢ ∀ u .C [ T As ∀ ] Γ ; Λ ; ∆, u : B ◦ ⊢ C Γ ; Λ ; ∆ ⊢ ∃ u .C [ T As ∃ ] Γ ; Λ, Λ ′ ; ∆ ⊢ C Γ ; Λ, Λ ′ ; ∆, e 3 : τ ⊢ C ′ Γ ; Λ ′ ; ∆ ⊢ e 2 : σ Γ ; Λ ; ∆ ⊢ e 1 : σ → τ Γ ; Λ, Λ ′ ; ∆ ⊢ { C } e 1 • e 2 = e 3 { C ′ } [ T AsE V ] Assertion t yping rules may b e classified in tw o catego ries. The firs t one is the set of rules insuring cor rect use o f names with resp ect to the t y pe of the term denoted by them. It is done by r ules [ T As ↔ ] [ T As k ] [ T As = ] [ T As ∀ ] [ T As ∃ ] and [ T AsE V ]. The se cond set of rules is used to structurally chec k formulas: [ T As ¬ ] [ T As ∧ ] [ T As ∨ ], and [ T As = ⇒ ]. 4.2 Seman tics W e now forma liz e the int uitive semantics of a ssertions. F or this, we abstract the set of quantum bits to an abstract quantum sta te. The approximation (we are conserv ative in saying that tw o q uantum bits are entangled and in stating the non-purity of a quantum bits) is done at this level. It means that for a given quantum state there are several abstra c t quantum state a cceptable. F or ins ta nce stating that all quantum bits ar e en tangled, and not one of them is in a bas e state, which is tautologic al, holds as an a cceptable abstr act quantum state fo r an y actual quantum state. The satisfaction of an assertion is done relatively to the abstract op erationa l semantics. W e develop an a bstract op erational semantics in order to abstractly exec ute λ Q L progra ms. Abstract quan tum state and abstract op erational s eman ti cs Let the fixed set of n quantum bits b e named S in the following of this s ection. Let also suppo se tha t the q ua nt um state of S is describ ed by | ϕ i a nor malized vector of C 2 . Definition 1 0 (Abstract quan tum state). An abstr act quantum state of S (AQS for short) is a tu ple A = ( R , P ) wher e P ⊆ S and R is a p artial e quivalenc e r elation on ( S \ P ) × ( S \ P ) . Relation R is a PE R since it describ es an approximation of the ent anglement relation and there is not muc h sens in talking a bo ut the entanglemen t of a quantum bit with itself. Indeed b ecause of the no-clo ning pr op erty it is not po ssible to have progra ms p : B ◦ × B ◦ → τ requiring tw o no n ent angled quantum bits and to t y pe ( p h q i , q i i ). The equiv alence class of a quantum bit q with relation to an abstra ct quantum state A = ( R , P ) is written q A . Definition 1 1 (A QS and quan tum s tate adequacy). L et S b e describ e d by | ϕ i and A = ( R , P ) an AQS of S . A is ade quate wi th r e gar ds to | ϕ i , written A | = | ϕ i , iff for every x, y ∈ S such t hat ( x, y ) 6∈ R then x, y ar e sep ar able w.r.t. | ϕ i and for every x ∈ P then the me asur ement of x is deterministic. Suppo se that S = { q 1 , q 2 , q 3 } and | ϕ i = 1 / p (2)( | 0 i + | 1 i ⊗ 1 / p (2)( | 0 i + | 1 i ⊗ | 1 i then: – A = ( { ( q 1 , q 2 ) , ( q 2 , q 1 ) } , { q 3 } ) – A ′ = ( { ( q 1 , q 2 ) , ( q 2 , q 1 ) , ( q 2 , q 3 ) , ( q 3 , q 2 ) , ( q 3 , q 1 ) , ( q 1 , q 3 ) } , ∅ ) are such that A | = | ϕ i and A ′ | = | ϕ i . On the other hand: – B = ( { ( q 1 , q 2 ) , ( q 2 , q 1 ) } , { q 2 , q 3 } ) – B ′ = ( ∅ , { q 3 } ) are not a dequate a bstract quantum s tates with r elation to | ϕ i . W e now give a new op e r ational semantics of λ Q L terms based on abstract quantum states transforma tion. Definition 1 2 (Abstract op erational sem an tics). We define an abstr act op er ational semantics of a term M such that Γ ; Λ ⊢ M : τ b etwe en AQS as : [ A, M ] → Γ,Λ A [ A ′ , M ′ ] We often write → A inste ad of → Γ,Λ A when typing c ontext s play no r ole or c an b e inferr e d fr om the c ontext. R e duct ion ru les ar e the same ones as those of definition 7 for the functional p art of the c alculus wher e the quantum state is r eplac e d with an abstr act state. We have the fol lowing ru les for the quantum actions: [( R , P ) , ( T q i )] → A [( R , P ) , q i ] [ P H S A ] [( R , P ) , ( H q i )] → A [( R , P \ { q i } ) , q i ] [ H D R A ] [( R , P ) , ( meas q i )] → A [( R \ q i , P ∪ { q i } ) , 1 0 ] [ M E T A ] [( R , P ) , ( Cnot h q i , q j i )] → A [( R , P ) , h q i , q j i ] [ C N O 1 A ] if q i ∈ P [( R , P ) , ( Cnot h q i , q j i )] → A [( R · q i ↔ q j , P \ { q i , q j } ) , h q i , q j i ] [ C N O 0 A ] if q i 6∈ P Wher e 1 0 is non deterministic al ly 1 or 0 , R \ q i is the e quivalenc e r elation such that if ( x, y ) ∈ rel e ntang l e and x 6 = q i or exclusive y 6 = q i then ( x, y ) ∈ R \ q i otherwise ( x, y ) 6∈ R \ q i , and wher e R · q i ↔ q j is t he e quivalenc e r elation R in which the e quivalenc e classes of q i , q j have b e en mer ge d t o gether. Note that this a bstract semantics is not deter ministic since it no n determin- istically gives 1 or 0 as result of a measure. Its cor rectness ca n h urt the intuition since the measurement of a quan tum bit in a base s tate, sa y | 1 i , ca n never pro duce | 0 i . Note also that since our system is normalizing the n umber o f a ll po ssible a bstract executions is finite. Hence, co mputable. Definition 1 3 (Abstract program se man ti cs). Consider an AQS A , the semantics of pr o gr am Γ ; Λ ⊢ M : τ u nder A , written J M K Γ ; Λ A , is the set of A ′ such that [ A, M ] → ∗ A [ A ′ , V ] wher e V is a value. Notice that the a bstract semantics of a pro gram is a co llecting semantics. It may explor e branches that are never g oing to b e used in actual computation. Indeed in the op era tional semantics measurement gives a non deter ministic an- swer. Nev ertheless, cor rectness is ensured by the if judgment rules (se e rule [ I F J ] in definition 20). Prop ositio n 2. L et A | = | ϕ i , Γ ; Λ ⊢ M : τ . S upp ose that [ | ϕ i , M ] → ∗ γ [ | ϕ ′ i , V ] then ther e exists A ′ | = | ϕ ′ i su ch t hat [ A, M ] → ∗ A [ A ′ , V ] . Pr o of. The pro of is done by induction o n the num b er of s teps of the r eduction betw een [ | ϕ i , M ] a nd [ | ϕ ′ i , V . The prop os ition is clearly true if there is 0 step since M = V , ϕ = ϕ ′ and A ′ = A pr ov es the r esult. Now cons ider the last rule used. If this rule is one o f the purely functional part of the calculus (see def. 7 ) the pro p o sition follow dir ectly fro m the induction hypothesis since the AQS is not changed. W e thus have the fo llowing p ossibilities for the la st rule: – It is [ P H S A ]: If the qbit q on which pha s e is a pplied is a ba se state it can be written α | l i with l being either 1 o r 0 . T hus T q = exp iπ/ 4 α , thus still a base s tate. Hence P remains unchanged. – It is [ H D R A ]: if ( R , P ) | = ϕ , then ( R , P \ { q i } ) | = ( H i | ϕ i ) b ecause of definition 11 since in ( H i | ϕ i ), any q j is in a non ba se state only if it is in a non base state in | ϕ i . – It is [ M E T A ]: After the mea sure the qubit v a nis hes. Mo r eov er co ncrete mea- sure proba bilis tically pr o duces 1 o r 0 . Regar ding the c o ncrete result one ca n choose the appropriate v alue a s result of the abstract meas ure, moreover the measured qubit is in a bas e state (hence the P ∪ { q i } ). – It is [ N E W A ]: then by definition | ϕ ′ i = | 1 i ⊗ | ϕ i , hence quantum in a base state in ϕ remain in a base state in ϕ ′ , moreov er the new qubit is in a bas e state. – It is [ C N O 0 A ]: If the t wo q ubits q i = α | l i , q j = β | l ′ i a re in a ba se state then • If l = 1 then Cnot ( α | 1 i ⊗ β | l ′ i ) = α | 1 i ⊗ β |¬ l ′ i • If l = 0 then Cnot ( α | 0 i ⊗ β | l ′ i ) = α | 0 i ⊗ β | l ′ i in bo th cases we obtain tw o sepa rable qubits. If o nly q i = α ′ | l i is in a base state a nd q j = α | 0 i + β | 1 i is no t. • If l = 1 then Cnot ( α | 1 i ⊗ α | 0 i + β | 1 i ) = α ′ | 1 i ⊗ β | 1 i + α | 0 i • If l = 0 then Cnot ( α ′ | 1 i ⊗ α | 1 i + β | 0 i ) = α ′ | 1 i ⊗ α | 1 i + β | 0 i ) here a ls o we obtain tw o sepa rable qubits. Moreover in all cases q i remains in a ba s e state. – It is [ C N O 1 A ]: The prop er t y follows from induction hypothes is and from the fact that R and P are s afe appr oximations. Seman tics of en tangl e men t assertions W e now give the semantics of a well t yp ed assertio n with rela tion to a co nc r ete quantum state. It is done via an ab- stract qua n tum state w hich is adequa te with r egards to the co ncrete quantum state. The idea is a s follows: if | ϕ i | = A , and if Γ ; Λ ; ∆ ⊢ C then we define the satisfaction relation M Γ ; Λ ; ∆ | = C , whic h s tates that under a prop er mo del de- pending on the typing context, then C is sa tisfied. Bas ic ally it amounts to check t wo prop erties : whether or not tw o quantum bits are in the same entanglement equiv alence class and whether or no t a pa r ticular quantum bit is in ba se s ta te. Definition 1 4 (Abstract observ ational equiv alence). Supp ose that Γ ; Λ ⊢ M , M ′ : τ . M and M ′ ar e observational ly e quivalent, written M ≡ Γ,Λ A M ′ , if and only if for al l c ontext C [ . ] such that · ; · ⊢ C [ M ] , C [ M ′ ] : B and for al l AQS A we have J C [ M ] K Γ,Λ A = J C [ M ′ ] K Γ,Λ A The e quivalenc e class of M is denote d by f M Γ,Λ A , by extens ion we say that t he typ e of this e qu ivalenc e class is τ . Definition 1 5 (Abstract v alues). In assertion typing c ontext Γ ; Λ ; ∆ , an ab- str act value v Γ ; Λ ; ∆ A,tau of typ e τ , wher e τ 6 = σ ⊗ σ ′ , with r elation to c ont ext Γ ; Λ ; ∆ and AQS A = ( R , P ) is: – An e quivalenc e class of typ e τ f or ≡ Γ,Λ A , if τ 6 = B ◦ . – a p air ( C, b ) forme d by an e quivalenc e class C of R and a b o ole an b (the ide a b eing that if b is true then the denote d qubit is in P ). If τ = σ ′ ⊗ σ ′′ , then v Γ ; Λ ; ∆ A,τ is a p air ( v ′ , v ′′ ) forme d by abstr act values of r esp e ctive typ es σ ′ , σ ′′ . The set of abstr act values u n der an AQS A , typing c ont ext Γ ; Λ ; ∆ and for a t yp e τ is written Ξ Γ ; Λ ; ∆ A,τ . Abstract v alues are used to define the interpretation of free v ariables. Since in a Given an as sertion typing context Γ ; Λ ; ∆ more than one t yp e may o cc ur we need to consider collections of abstract v alues of the different types that o ccur in Γ ; Λ ; ∆ : w e wr ite Ξ Γ ; Λ ; ∆ the disjo int union of all Ξ Γ ; Λ ; ∆ τ for every τ in Γ ; Λ ; ∆ . Definition 1 6 (Mo de ls). A Γ ; Λ ; ∆ mo del is a tu ple M Γ ; Λ ; ∆ = h A, I i , wher e A is an AQS, I is a map fr om variables define d in Γ ; Λ ; ∆ to Ξ Γ ; Λ ; ∆ . In order to deal with ev aluation a nd quantified formulas we need to de fine a notion o f mo del extension. Definition 1 7 (Mo de l extensions). L et M Γ ; Λ ; ∆ = h A, I i b e a mo del, then the mo del M ′ written M · x : v = h A, I ′ i , wher e v ∈ Ξ Γ ; Λ ; ∆ A,τ is define d as fol lows: – the typing c ontext of M ′ is Γ ; Λ ; ∆, x : τ . – If the typ e of x is τ = σ ⊗ σ ′ , then v is a c ouple m ade of abstr act values V ′ , v ′′ of r esp e ctive typ e σ , σ ′ . – If the t yp e of x is B ◦ : if v = ( C, 1 ) then A ′ = ( R ∪ C, P ′ ∪ { x } ) , otherwise if v = ( C, 0 ) then A ′ = ( R ∪ C , P ′ ) . – If the t yp e of x is σ 6 = B ◦ , t hen: I ′ ( y ) = I ( y ) for al l x 6 = y and I ′ ( x ) = v W e now define term interpretation. It is standard a nd amo un ts to an inter- pretation of names into abstract v alues of the r ight type . Definition 1 8 (T erm in terpretation). L et M Γ,Λ = h A, I , τ i b e a mo del, the interpr etation of a term u is define d by: – [ | u | ] M = I ( u ) if t he t yp e of u is n ot B ◦ . – [ | q i | ] M = ( q i A , b A i ) , wher e b A i is t rue iff q i P with A = hR , P i . – [ |h e, e ′ i| ] M = h [ |M| ] A , [ | e ′ | ] M i Definition 1 9 (Satisfaction). The satisfaction of an assertion C in the mo del M = h A, I i , is written M | = C , is inductively define d by the fol lowing rules: – M | = u ↔ v if ( π 1 ([ | u | ] M ) , π 1 ([ | v | ] model )) ∈ R A . – M | = k u if π 2 ([ | u | ] M ) is tru e. – M | = e 1 = e 2 if [ | e 2 | ] A = [ | e 1 | ] A . – M | = ¬ C if | = do es not satisfy C . – M | = C ∨ C ′ if M | = C or M | = C ′ . – M | = C ∧ C ′ if M | = C and M | = C ′ . – M | = C = ⇒ C ′ if M | = C implies M | = C ′ . – M | = ∀ u .C if for al l mo del M ′ = M · u.v , one has M ′ | = C . – M | = ∃ u .C if ther e is an abstr act value v such that if M ′ = M · u.v , one has M ′ | = C . – M | = { C } e 1 • e 2 = e 3 { C ′ } if for al l mo dels M ′ Γ ; Λ ; ∆ = h A ′ , I ′ i such that M ′ Γ ; Λ ; ∆ ′ | = C , with the fol lowing c onditions: Γ ; Λ ; ∆ ⊢ e 1 : σ → τ , and Γ ; Λ ; ∆ ⊢ e 2 : σ s u ch t hat for al l terms t 1 ∈ [ | e 1 | ] M ′ , t 2 ∈ [ | e 2 | ] M ′ one has • [ A, ( t 1 t 2 )] → ∗ A [ A ′ , V ] • we have two su b-c ases: 1. τ is B ◦ and V = q i and M ′ = M · e 3 : ( q i A ′ , q i ∈ P A ′ ) 2. τ is not B ◦ and M ′ · e 3 : e V Γ ; Λ ; ∆,τ A | = C ′ 4.3 Judgmen ts and pro of rule s W e now give r ules to derive judgments of the form { C } M : Γ ; Λ ; ∆ ; τ u { C ′ } . Those judgment s bind u in C ′ , thus u cannot o ccur free ly in C . There are t wo kinds of rules: the first one follow the structure of M , the second one are purely lo gical rules. Definition 2 0 (Language rules). L et Γ ; Λ ⊢ M : τ , we define the judgment { C } M : Γ ; Λ ; ∆ ; τ u { C ′ } inductively as fol lows: { C ∧ k u } N : Γ ; Λ ; ∆ ; B ◦ ⊗ B ◦ h u, v i{ C ′ } { C ∧ k u } ( Cnot N ) : Γ ; Λ ; ∆ ; B ◦ ⊗ B ◦ h u, v i{ C ′ } [ C N OT 1 J ] { C } N : Γ ; Λ ; ∆ ; B ◦ ⊗ B ◦ h u, v i{ C ′ } { C } ( Cno t N ) : Γ ; Λ ; ∆ ; B ◦ ⊗ B ◦ h u, v i{ C ′ ∧ u ↔ v } [ C N OT 2 J ] { C } N : Γ ; Λ ; ∆ ; B ◦ v { C ′ } { C } ( H N ) : Γ ; Λ ; ∆ ; B ◦ v { C ′ [ ¬k v ] } [ H AD J ] { C } N : Γ ; Λ ; ∆ ; B ◦ u { C ′ } { C } ( T N ) : Γ ; Λ ; ∆, B ◦ u { C ′ } [ P H AS E J ] { C [ u/ x ] } x : Γ ; Λ ; ∆,u : τ ; τ u { C } [ V AR J ] c ∈ { 1 , 0 } { C } c : Γ ; Λ ; ∆,u : B ; B u { C } [ C O N S T J ] { C } M : Γ ; Λ ; ∆ Γ ; Λ ; ∆ ; B ◦ { u } C ′ { C } mea s M : Γ ; Λ ; ∆,v : B ; B v { C ′ [ − u ] ∧ k u } [ M E AS J ] { C } M : Γ ; Λ ; ∆ ; B b { C 0 } { C 0 [ 1 /b ] } N : Γ ; Λ ; ∆ ; τ x { C ′ } { C 0 [ 0 /b ] } P : Γ ; Λ ; ∆ ; τ x { C ′ } { C } if M th en N else P : Γ ; Λ ; ∆,u : τ ; τ u { C ′ } [ I F J ] { C } M : Γ ; Λ ; ∆ ; σ → τ m { C 0 } { C 0 } N : Γ ; Λ ; ∆ ; σ n { C 1 ∧ { C 1 } m • n = u { C ′ }} { C } ( M N ) : Γ ; Λ ; ∆,u : τ ; τ u { C ′ } [ AP P J ] { C − x ∧ C 0 } M : Γ ; Λ ; ∆ ; τ m { C ′ } { C } λx : M . : Γ [ − x ] ; Λ [ − x ]; ∆,u : σ → τ ; σ → τ u {∀ x. { C 0 } u • x = m { C ′ }} [ AB S J ] { C } M : Γ ; Λ ; ∆ ; τ m { C 0 } { C 0 } N : Γ ; Λ ; ∆ ; σ n { C ′ [ m/u, n/v ] } { C }h M , N i : Γ ; Λ ; ∆,u : τ ,v : σ ; τ h u, v i{ C ′ ] } [ × J ] { C } M : Γ ; Λ ; ∆ ; τ 1 ⊗ τ 2 m { C ′ [ π i ( m ) /u ] } i ∈ { 1 , 2 } { C } π i M : Γ ; Λ ; ∆u : τ i ; τ i u { C ′ } [ π J ] i Wher e in rule [ H AD J ] , if ther e exists C ′′ such that C ′′ ∧k u ≡ C ′ the assertion C ′ [ ¬k v ] is C ′′ ∧ ¬k u otherwise it is C ′ ¬k u . In [ M E AS J ] , the assertion C ′ [ − u ] is C ′ wher e al l assertions c ontaining u have b e en delete d. In [ AB S J ] , C − x me ans that x do es not o c cur fr e ely in C . In [ V AR J ] , C [ u/x ] is the assertion C wher e al l fr e e o c curr enc es of x have b e en r eplac e d by u . Judgment of the purely functional fra gment ar e standard see [2]. W e ha ve just modified the wa y to handle co uples in order to ease manipulations, but we could hav e us ed pro jections instead of intro ducing tw o different names. Re- garding the q uantum frag men t, rule [ C N OT 1 J ] has no influence s o ver quan- tum en tanglement since the first argument of the Cnot is in a base state; rule [ C N OT 2 J ] introduce s an entanglemen t b etw een the tw o ar guments of the Cnot op erator. Notice tha t it is no t use ful to introduce all entanglement pairs intro- duced. Indeed, since the entanglemen t relation is an equiv alence re la tion one can safely a dd to judgment (see logical rules that follow in def. 21) statement s for tr a nsitivity , reflexivity and sy mmetr y of entanglement rela tion, for instance ∀ x, y , z .x ↔ y ∧ y ↔ z = ⇒ x ↔ z fo r transitivity . Indeed any abstract quantum state, by definitio n, v alidates those sta temen ts which will b e implicitly supp osed in the fo llowing. As we saw in the pr o of o f pr op osition 2, the pha s e gate do es no t change the fact that a quantum bit is in a ba s e sta te, wherea s the Hadama r d gate may make him not in a base s tate, hence explaining the co nclusions of rules [ H AD J ] [ P H AS E J ]. W e now give pur ely logica l rules . One may see them as an adapted version of standard fir st order logic sequent calculus. Definition 2 1 (Logical rules). { C 0 } V : u { C ′ 0 } C ⊢ C ′ 0 C 0 ⊢ C ′ { C } V : u { C ′ } [ LO G J ] { C } V : u { C ′ } { C ∧ C 0 } V : u { C ′ ∧ C 0 } [ promote ] { C ∧ C 0 } V : u { C ′ } { C } V : u { C 0 = ⇒ C ′ } [ = ⇒ E Lim ] { C } M : u { C 0 = ⇒ C ′ } { C ∧ C 0 } V : u { C ′ } [ ∧ E li m ] { C 1 } M : u { C } { C 2 } M : u { C } { C 1 ∨ C 2 } M : u { C } [ ∨ L ] { C } M : u { C 1 } { C } M : u { C 2 } { C } M : u { C 1 ∧ C 2 } [ ∧ R ] { C } M : u { C ′− x } {∃ x.C } M : u { C ′ } [ ∃ L ] { C − x } M : u { C ′ } { C } M : u {∀ x.C ′ } [ ∀ R ] wher e C ⊢ C ′ is the standar d firs t or der lo gic pr o of derivation (se e e.g. [8]). W e now g ive the soundnes s re s ult rela ting Theorem 1 (Soundness ). Supp ose that { C } M : Γ ; Λ ; ∆ ; τ u { C ′ } is pr ovable. Then for al l mo del M = h A, I i , abstr act quantum state A ′ , a bstr act value v such that 1. M | = C 2. [ A, M ] → ∗ A [ A ′ , V ] 3. v ∈ Ξ Γ ; Λ ; ∆ A ′ ,τ then M · u : v | = C ′ . Pr o of. The pro of is done by induction o n judgmen t rules . The last judgment rule used can b e either a lo gical or a la nguage one. If it is a lo g ical one, so undnes s follows from the soundness of first order logic. Obser ve that we have a v alue in the promotion rule [ pr omote ] thus no reductions ar e p ossible and the so undness is v acuously v alid. If he last judgment rules used is a languag e rule, we only consider the quan- tum fragment (indeed for the functional fragment, the pro o f follows directly from [2]), thus w e hav e the fo llowing cases: – [ C N OT 1 J ], th us { C } M : Γ ; Λ ; ∆ ; τ u { C ′ } is in facts { C 1 ∧k u ′ } ( Cnot N ) : Γ ; Λ ; ∆ ; B ◦ ⊗ B ◦ h u ′ , v ′ i{ C ′ } . By induction hypothesis w e kno w that if M | = C 1 ∧ k u ′ , if [ A, N ] → ∗ A [ A ′ , V ], and v ∈ Ξ Γ ; Λ ; ∆ A ′ ,τ , then M · h u ′ , v ′ i : v M C ′ . W e know that V is a couple of qbits (since judgmen t is w ell typed), say h q i , q j i . Now [ A ′ , ( Cnot h q i , q j i )] → A [ A, h q i , q j i ] tha nk s to r ule [ C N O 1 A ] and due to the fact that M | = k u ′ . – [ C N OT 2 J ], thus { C } M : Γ ; Λ ; ∆ ; τ u { C ′ } is in facts { C } ( Cno t N ) : Γ ; Λ ; ∆ ; B ◦ ⊗ B ◦ h u ′ , v ′ i{ C ′ ∧ u ′ ↔ v ′ } w e reason similarly a s in previous case with the differ- ence that the last abstract o pe r ational r ule used is [ C N O 0 A ]. – [ H AD J ], thus { C } M : Γ ; Λ ; ∆ ; τ u { C ′ } is in facts { C } ( H N ) : Γ ; Λ ; ∆ ; B ◦ u { C ′ [ ¬k u ] } . By induction hypo thesis we know that if M | = C , if [ A, N ] → ∗ A [ A ′ , V ], and v ∈ Ξ Γ ; Λ ; ∆ A ′ ,τ , then M · h u i : v M C ′ . Now b ecause judgmen t is w ell t yp ed τ is B ◦ , and V is q i . Thus [ A, ( H q i )] → A [( R , P \ { q i } ) , q i ], a nd clearly M · h u i : v | = ¬k u , the re s t is done by induction hypo thesis. – [ P H AS E J ], thus { C } M : Γ ; Λ ; ∆ ; τ u { C ′ } is direct by induction hypothesis and considering abstract reduction rule [ P H S A ]. – J D GM E AS , thus { C } M : Γ ; Λ ; ∆ ; τ u { C ′ } is in fac ts { C } ( meas N ) : Γ ; Λ ; ∆ ; B ◦ u { C ′ [ − u ] ∧ k u ] } . By induction hypo thesis we know tha t if M | = C , if [ A, N ] → ∗ A [ A ′ , V ], and v ∈ Ξ Γ ; Λ ; ∆ A ′ ,τ , then M · u : v M C ′ . Now b ecause judgment is w ell typed τ is B ◦ , and V is q i . Thus [ A, ( meas q i )] → A [( R , P ∪ { q i } \ { q i } ) , 1 0 ], and clearly M · u : v | = k u , the rest is done b y induction hypothesis. Example 1. The idea of this example is to show how the entanglemen t lo gic may be used to analyze non lo cal and non c omp o sitional b ehavior. Supp ose 4 qubits, x, y , z , t such that x, t ar e entangled and y , z a r e entangled a nd { x, t } s eparable from { y , z } . Now if w e p erform a control not o n x, y , then as a side effect z , t are ent angled to o, even if quantum bits x, y are discarded by meas urement. Thus we w ant to prov e the fo llowing statement: { T } P : u {∀ x, y , z , t. { x ↔ y ∧ z ↔ t } u • y , z = v { x ↔ t }} where P is the following pro g ram λy , z : let h u, v i = ( Cno t h y , z i ) i n h ( meas u ) , ( meas v ) i . Then using rule [ AP P J ] we ca n derive the following judgmen t on actual quantum bits: { C } ( P h q 2 , q 3 i ) : h u, v i{ q 1 ↔ q 4 } where C denotes the following as s ertion : q 1 ↔ q 2 ∧ q 3 ↔ q 4 . This judgment is remark able in the fact that it asserts o n entanglemen t prop erties of q 1 , q 4 while those tw o qua nt um bits do not o ccur in the piece of co de analyz e d. 5 Conclusion In this pa p er we hav e prop osed a logic for the static ana lysis of entanglemen t for a functional quantum pr ogra ming lang uage. W e hav e prov ed that this logic is sa fe and sound: if tw o quantum bits are pr ov ably separ a ble then they a re not ent angled while if they are pr ov ably en tangled they c ould actually be separ able. The functional language considered includes higher -order functions . It is, to our knowledge the first prop os al to do so and str ictly improv es over [5 ] on this resp ect. W e have shown that no n lo cal b ehavior can b e handled by this logic. Completeness of our logic remains an open issue worth of future investiga- tions. W e also hop e that this setting will allow reasoning exa mples on q uantum algorithms, a nd that it will provide a useful help for quantum algorithms res e arch in providing a high- level, compo sitional reaso ning too l. References 1. T. Altenkirch and J. Grattage. A functional quantum p rogramming language. In 20th IEEE Symp osium on L o gic i n Computer Scienc e (LICS 2005) , pages 249–258. IEEE Computer So ciet y , 2005. 2. M. Berger, K. H onda, and N. Y oshida. A logical analysis of aliasing in imp erative higher-order functions. In O. Danvy and B. C. Pierce, editors, Pr o c e e di ngs of the 10th ACM SIGPLAN I nternational Confer enc e on F unctional Pr o gr amm ing, I CFP 2005 , p ages 280–293, 2005. 3. T. Hoare. An axiomatic basis of computer programming. CACM , 12(10):576– 580, 1969. 4. M. Nielsen and I. Chuang. Quantum Computa tion and Quantum Information . Cam b ridge Universit y Press, 2000. 5. S. Pe rdrix. Qu antum patterns and typ es for entangle ment and separability . El e c- tr onic Notes The or etic al Computer Scienc e , 170:125–13 8, 2007. 6. F. Prost. T aming non-comp ositionalit y using new binders. In Pr o c e e di ngs of Unc on- ventional Computation 2007 (UC’07) , vo lume 4618 of L e ctur e Notes in Computer Scienc e . Springer, 2007. 7. P . Selinger and B. V aliron. A lambda calculus for quantum computation with classical control. I n P . Urzyczy n, editor, T yp e d L amb da Cal culi and Applic ations, 7th International Confer enc e, (TLCA 2005), LNCS 3461 , pages 354–368 , N ara, Japan, 2005. Springer. 8. R. M. Smullyan. Fi rst-Or der L o gic . Springer, 1968. 9. A. v an T onder. A lambd a calculus for quantum compu tation. SIAM Journal on Computing , 33(5):110 9–1135, 2004. 10. G. Vidal. Efficien t classical simulation of sligh tly entangled quantum computations. Physic al R eview L etters , 91(14), 2003.
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment