ebook img

Quantum Computing over Finite Fields PDF

0.16 MB·
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Quantum Computing over Finite Fields

Quantum Computing over Finite Fields: Reversible Relational Programming with Exclusive Disjunctions Roshan P. James Gerardo Ortiz Amr Sabry School of Informatics and Computing Department of Physics School of Informatics and Computing Indiana University Indiana University Indiana University 1 Email: [email protected] Email: [email protected] Email: [email protected] 1 0 2 n a Abstract—In recent work, Benjamin Schumacher and clauses can be satisfied. Executing the query q(X). returns J Michael D. Westmoreland investigate a version of quantum three answers: 9 mechanics which they call modal quantum theory but which we 1 prefer to call discrete quantum theory. This theory is obtained by instantiating the mathematical framework of Hilbert spaces X = false ; X = true ; ] with a finite field instead of the field of complex numbers. This X = false. h instantiation collapses much the structure of actual quantum p Now consider the same example expressed in the Discrete mechanics but retains several of its distinguishing character- t- istics including the notions of superposition, interference, and Quantum Theory over the field of booleans (DQT2) recently n entanglement. Furthermore, discrete quantum theory excludes developed by Schumacher and Westmoreland [1]: a local hiddenvariablemodels, hasano-cloningtheorem, andcan u express natural counterparts of quantum information protocols r|0i = |0i+|1i q such as superdense coding and teleportation. r|1i = |0i [ Our first result is to distill a model of discrete quantum 1 computing from this quantum theory. The model is expressed q = r|0i+r|1i v using a monadic metalanguage built on top of a universal 4 reversible language for finite computations, and hence is di- The relation r which could relate false to either false 6 rectly implementable in a language like Haskell. In addition to or true is expressed as a quantum gate r that maps |0i to 7 superpositions and invertible linear maps, the model includes a superposition of |0i and |1i. The rule q corresponds to 3 conventional programming constructs including pairs, sums, . higher-order functions, and recursion. Our second result is a vector q produced by taking the superposition of the two 1 to relate this programming model to relational programming, possible alternatives. 0 e.g., a pure version of Prolog over finite relations. Surprisingly IncontrasttothePrologprogram,measuringthevectorq in 1 discrete quantum computing is identical to conventional logic thestandardbasis{|0i,|1i}isguaranteedtoalwaysreturn|1i: 1 programming except for a small twist that is responsible for the answer |0i could never be produced! To understand why, : all the “quantum-ness.” The twist occurs when merging sets v we calculate the result of q as follows: of answers computed by several alternatives: the answers are i X combined using an exclusive version of logical disjunction. In q =r|0i+r|1i=(|0i+|1i)+|0i=|1i other words, the two branches of a choice junction exhibit an r a interferenceeffect: ananswerisproducedfromthejunctionifit In the last step the two intermediate answers |0i interfere occurs in one or the other branch but not both. destructively with each other and are canceled. The details are explained in Section IV. I. THERESULT,INFORMALLY This simple example captures the essence of our result Consider this Prolog program: whichcan be informallystated as follows.The modelofcom- putation inherent in DQT2, DQC2, is a relational program- mingmodelinwhichanyvaluethatappearsanevennumberof r(false,false). r(false,true). timesindisjunctionsdisappears.SectionVIII-Cshowsamore r(true,false). significant example that implements the superdense coding q(X) :− r(false,X). quantum protocol in both DQC2 and Prolog. Removing all q(X) :− r(true,X). answers that appear an even number of times in the Prolog The program starts with three facts about a relation r and execution is indeed consistent with the quantum protocol. thendefinesaruleqsuchthatq(X)istrueifeitherofthetwo II. THERESULT,FORMALLY The pioneering research programmes of Abramsky and Partially funded by IU’s Office of the Vice Provost for Research through itsFaculty ResearchSupportProgram. Coecke et al. [2], [3] and of Selinger [4], [5] have established that quantum computing (QC) can be modeled using dag- larger finite fields to reach full QC in the limit. More impor- ger compact closed categories. The traditional mathematical tantly, what is the computational power of these intermediate model of QC — the category FDHilb of finite dimensional models, DQCn, as n grows larger? Hilbert spaces and linear maps — is a prime example of To tackle these questions,we do notwork directly with the such categories, and so is the category Rel∪ of sets and Hilbert space formalism, however. Indeed, the mathematical relations.Ourresult,formallystated,isthatthecomputational formulation of QC based on Hilbert spaces obscures many structuresinherentinDQC2 canbemodeledinanon-standard traditional computational structures that are inherent in the categoryRel⊎ ofsetsandrelationswhichisisomorphictothe physical theory. Early on, Mu and Bird [7] showed that the categoryFDVec2 of finite dimensionalvectorspaces over the simple model of QC based on vectors and linear operators is field of booleans and linear maps. This category is dagger a monad which is the standard way to model computational compact closed and hence possesses all the computational effects [8]. In a subsequentdevelopment,the third author and structures necessary for QC. Our category differs from the collaborators [9], [10], [11], [12], [13] have established that standardcategoryofsetsandrelationsinoneaspect:itusesthe the more general quantum model based on density matrices exclusive union of sets everywhere the standard union would and superoperators is an instance of the mathematical con- be used. Diagrammatically we have: cept of arrows [14] which is a generalization of monads. Interestingly dagger closed compact categories identified by QC FDHilb Abramskyet. al. also serve as modelsof linear logic [15] and variouscomputationaleffects[16],[17],[18].Hence,basedon these connections, our technical contributions are expressed using traditional computational structures and constructions: DQC2 Rel⊎/FDVec2 monads, arrows, and category theory. Prolog Rel∪ IV. DISCRETEQUANTUM THEORY III. SIGNIFICANCE AND BACKGROUND Intheirrecentwork,SchumacherandWestmoreland[1]ar- HilbertSpacesandModelsofQuantumComputing: The guethatmuchofthestructureoftraditionalQMismaintained traditional mathematical formulation of Quantum Mechanics inthepresenceoffinitefields.Inparticular,theyestablishthat (QM)isfoundedonHilbertspaces.Althoughthereareseveral thequantumtheorybasedonthefinitefieldofbooleansretains other more abstract mathematical formulations of QM, the the following characteristics of QM: Hilbert space formalism remains the most accepted and the • the notions of superposition, interference, entanglement, most widely used such formalism [6]. A Hilbert space is and mixed states of quantum systems; defined to be a real or complex inner product space that is • the time evolution of quantum systems using invertible a complete metric space with respect to the distance function linear operators; inducedbytheinnerproduct.Arealorcomplexinnerproduct • the complementarity of incompatible observables; space is a vector space over the field of real or complex • the exclusion of local hidden variable theories and the numbers on which there is an inner product. In traditional impossibility of cloning quantum states; and QM, the underlying field is the field of complex numbers • thepresenceofnaturalcounterpartsofquantuminforma- which serves as the space from which probability amplitudes tion protocols such as superdense coding and teleporta- for quantum events are drawn. tion. For the purposes of QC, the mathematical formalism of Fields: A field is an algebraic structure with notions of QMistypicallyrestrictedtofinitedimensionalHilbertspaces. addition and multiplication that satisfy the usual axioms. The This restriction removesone of the infinities in the formalism rationals,reals,complexnumbers,andquaternionsformfields but retainsanother — the underlyinginfinite field of complex thatareinfinite.Therearealsofinitefieldsthatsatisfythesame numbers. The resulting model is clearly still a mathematical set of axioms. Finite fields are necessarily “cyclic.” idealizationasitallowsinfinitesimallyfinedistinctionsamong quantum states that might differ by vanishingly small proba- We fix a field B consisting of two scalars {F,T}. The bility amplitudes. In contrast, any particular realization of a elements F and T are associated with the probabilities of quantum algorithm can only assume finite and discrete levels quantum events, with F interpreted as definitely no and T ofrepresentationofsuchprobabilityamplitudes.Althoughitis interpreted as possibly yes.1 The field B comes with an customary for (classical or quantum) models of computations additionoperation∨(whichinthiscase mustbeexclusive-or) toincludeinfinitestructuresofvariouskinds,itisimportantto and a multiplication operation ∧ (which in this case must be understand how the idealized models emerge as the limits of conjunction). In particular we have: finite approximations. A fundamental question that therefore motivates our research is whether it is possible to replace the 1Everything works if we switch the interpretation with F interpreted as infinite field of complex numbers by successively larger and possiblynoandTasdefinitely yes[19]. Theexamplealsoshowsthatthecyclicstructureofthefield extends to the vector space. F ∨ F = F F ∧ F = F InnerProducts: AHilbertspacecomesequippedwithan F ∨ T = T F ∧ T = F T ∨ F = T T ∧ F = F inner product hv1 | v2i which is an operation that associates each pair of vectors with a complex number scalar value that T ∨ T = F T ∧ T = T quantifiesthe“closeness”ofthetwovectors.Theinnerproduct The definitions are intuitively consistent with the interpre- inducesa norm hv | vi that can be thoughtof as the length tation of scalars as probabilities for quantum events except of vector v. In apfinite field, we can still define an operation that it appears strange to have T∨T be defined as F, i.e., to hv1 | v2i which, following our interpretation of the scalars, have a twice-possible event become impossible. This results would need to return F if the vectors are definitely not the from the cyclic property intrinsic to finite fields requiring sameandTifthevectorsarepossiblythesame.Thisoperation the existence of an inverse to ∨. This inverse must be T however does not yield an inner product, as the definition of itself which means that T essentially plays both the roles of inner products requires that the field has characteristic 0, i.e., “possiblewith phase1” and“possiblewith phase-1” andthat that the repeated addition of T to itself never reaches F. As the two occurrences cancel each other in a superposition. the above paragraph shows this is not the case for B (nor for Vector Spaces: In the vector space over the field B, anyfinitefieldforthatmatter)asthesumofpositiveelements if vectors are represented as functions κ that map basis must eventually “wrap around.” In other words, if we choose elements v to scalars field values, then vector addition and to instantiate the mathematical framework of Hilbert spaces scalar multiplicationare definedby lifting the field operations with a finite field, we mustthereforedropthe requirementfor to vectors as follows: innerproductsandcontentourselveswithaplainvectorspace. κ1+κ2 = κ′ s.t. κ′(v)=κ1(v) ∨ κ2(v) Furthermore, in the absence of a notion of length, one must b∗κ = κ′ s.t. κ′(v)=b ∧ κ(v) exclude zero vectors. InvertibleLinearMaps: InactualQC,thedynamicevolu- Scalar multiplication is uninteresting as it either leaves the tion of quantumstates is describedby unitarytransformations vectorunchangedorreturnsthezerovector(denoted•)which which preserve inner products. As discrete quantum theory mapseverythingtothescalarzero.Vectoradditionhoweveris lacksinnerproducts,the dynamicevolutionof quantumstates the key to introducingsuperpositionsand interferenceeffects. is described by any invertible linear transformation, i.e., by Considerthesimplecaseofa1-qubitsystemwithbases|0i any linear transformation that is guaranteed never to produce and |1i. The Hilbert space framework allows us to construct the zero vector. an infinite number of states for the qubit all of the form As an example, there are 16 linear (not necessarily in- α|0i+β|1i with α and β elements of the underlying field vertible) functions in the space of 1-qubit functions. Out of of complex numbers and with the side condition that the these, six are permutations on the three 1-qubit vectors; the state is not the zero vector and that it has length 1, i.e., remaining all map one of the vectors to • which makes that |α|2 + |β|2 = 1. Moving to a finite field immediately them non-invertible. Hence the space is quite impoverished limits the set of possible states as the coefficients α and β compared to the full set of 1-qubit linear transformations in are now drawn from a finite set. In other words, in the the Hilbert space. In particular, even some of the elementary field B, there are exactly three valid states for the qubit: unitary transformations such as the Hadamard transformation F|0i + T|1i(whichisequivalentto|1i),T|0i + F|1i(which are notexpressiblein thatspace. Indeedthe Hadamardmatrix is equivalent to |0i), and T|0i + T|1i (which we write as forthefieldofbooleansmapsthevector|+itothezerovector |+i). The fourth possibility is the zero vector which is not and hence is not an acceptable 1-qubit transformation. an allowed quantum state (discussed below). In a larger field Entanglement and Superdense Coding: Despite the re- with three scalars, there would be eightpossible states for the striction to finite fields and the drastic reduction in the state qubit which intuitively suggests that one must “pay” for the space of qubits and their transformations, the theory built on amountofdesiredsuperpositions:thelargerthefinitefield,the the field of booleans has a definite quantum character. We more states are present with the full Bloch sphere seemingly present the superdense coding example from the paper of appearing at the “limit” n→∞. SchumacherandWestmoreland[1]inSectionVIII-Candrefer Interestingly, we can easily check that the three possible the reader to their paper for more details. vectors for a 1-qubit state are linearly dependent with any pair of vectors expressing the third as a superposition: V. OUTLINEOF TECHNICAL DEVELOPMENT Our aims are to (i) develop a typed programminglanguage |0i + |1i = |+i thatpinsdowntheuniquefeaturesofdiscretequantumcompu- |0i + |+i = |1i tation and, (ii) to relate this language to that of conventional |1i + |+i = |0i relational programming. Building on the work of Abramsky Inotherwords,otherthanthestandardbasisconsistingof|0i andCoecke[2], [3] andofSelinger[4], [5],bothtaskscan be and |1i, there are just two other possible bases for this vector achieved by distilling a logic and type system from a special space, {|1i,|+i} and {|+i,|0i}. categoryof setsandrelationsandbydesigningan appropriate syntax.Thatcategory(andhencethe language)canbe related second system and the operation ( · ) is the composition of to the conventional category of sets and relations to establish the two labels. For example: a connectionwith conventionalrelational programmingand it • the composition of Q2 and Q4 (written Q2⊗Q4) is of canbeconnectedtodiscretequantumcomputationbyshowing dimension 8 and is spanned by: that it is dagger compactclosed. We proceed in the following {|0·00i,|0·01i,|0·10i,|0·11i,|1·00i,|1·01i,|1·10i,|1·11i} two stages. Classical Computation: Many programming models of • the compositionof Q4 and Q2 (written Q4⊗Q2) is also QC start with the λ-calculus as the underlying classical of dimension 8 and is spanned by: language and add quantum features on top of it [20], [21], {|00·0i,|00·1i,|01·0i,|01·1i,|10·0i,|10·1i,|11·0i,|11·1i} [22], [23]. This strategy is natural given that the λ-calculus is the canonical classical computational model. However this ClearlythecompositionsQ2⊗Q4 andQ4⊗Q2areisomorphic strategycomplicatesthedevelopmentofquantumlanguagesas and the distinction between them is typically blurred. itforcesthelanguagestodealinfairlycomplicatedwayswith B. Syntax and Type System theimplicitduplicationanderasureofinformationintheclas- Instead of using bits as the labels for the bases, we use sical sublanguage. A simpler strategy that loses no generality structuredfinitetypesbuiltusingtheemptytype,theunittype, istobuildthequantumfeaturesontopofareversibleclassical the sum type, and the product type. Furthermore instead of language: this keeps the language simple while still enabling silently identifying systems like Q2 ⊗Q4 and Q4⊗Q2, we the λ-calculus constructs to encoded using two explicit op- includeanexplicitsetofoperatorsbetweenthesefinitetypesto erators for erasure and duplication if desired [24]. Following witnesstheisomorphisms.Specifically,we havethefollowing this strategy we review the reversible language Π that was language of classical observable types b and values v: recentlydevelopedbythefirst andthirdauthoranduse itasa foundation for the quantum language in the remainder of the b ::= 0 | 1 | b+b | b×b | bool paper. The language provides the symmetrical monoidal part v ::= () | left v | right v | (v,v) | T | F of the required categorical structure. Monads and Arrows for Quantum Computation: We The types are finite as they will be used to define the definealanguageRΠbyaddingalayerontopoftheclassical dimensions of our vector spaces. The type 0 is the empty reversiblelanguageΠthatprovidessetsandrelations.Theset type containing no inhabitants. The type 1 has exactly one constructioncanbeexpressedasastrongmonad[25]overthe inhabitantcalled().Thetypeb1+b2isthedisjointunionofb1 language of classical observable values. However in order to and b2 whose elements are appropriately tagged values from expresstherequiredcompactclosurestructureinthelanguage, eithertype.Thetypeb1∗b2 isthetypeoforderedpairswhose the Kleisli maps of this monad are abstracted in a first-order elementsarecomingfromb1andb2respectively.Althoughthe datatypeusinganarrow[14].ThelanguageRΠisexpressive typeofbooleansisexpressibleas1+1weadditasaprimitive enoughtoimplementthesuperdensecodingprotocolandother type because it corresponds to the type of scalar field values quantum protocols. It differs from a conventional relational whichplayanimportantroleinthelanguage.Thetypesystem programming language in the semantics of the “union” oper- is summarized below: ation. ⊢v :b1 ⊢v :b2 ⊢():1 ⊢left v :b1+b2 ⊢right v :b1+b2 VI. CLASSICAL COMPUTATION ⊢v1 :b1 ⊢v2 :b2 WeintroducethelanguageΠforclassicalobservablevalues. ⊢(v1,v2):b1×b2 ⊢T:bool ⊢F:bool The language is defined over finite types: the only “computa- tions” in it are the isomorphisms between these types. In the Thefollowingisomorphismsaresoundandcompleteforthe contextofHilbertspaces,thislanguageformalizesthenotation given finite types [26]: used for the bases. In the categorical context, this language b ↔ b provides the underlying symmetric monoidal structure. 0+b ↔ b A. Bases for Vector Spaces b1+b2 ↔ b2+b1 In the traditional presentation of quantum computing, a b1+(b2+b3) ↔ (b1+b2)+b3 Hilbertspaceofdimensiondisspannedbyasetofdmutually orthogonal vectors. For example: 1×b ↔ b • a quantum system Q2 composed of just 1 qubit is of b1×b2 ↔ b2×b1 dimension 2 and is spanned by {|0i,|1i}; b1×(b2×b3) ↔ (b1×b2)×b3 • a quantumsystem Q4 composedof2 qubitsisof dimen- sion 4 and is spanned by {|00i,|01i,|10i,|11i}. 0×b ↔ 0 The Hilbert space for the composition of two systems is (b1+b2)×b3 ↔ (b1×b3)+(b2×b3) spanned by basis vectors of the form |m · ni where m is a basis vector of the first system and n is a basis vector of the bool ↔ 1+1 The forward c v1 7→v2 transitions are given below: b1 ↔b2 b2 ↔b3 id v 7→ v b1 ↔b3 3+ (right v) 7→ v 2+ v 7→ right v b1 ↔b3 b2 ↔b4 b1 ↔b3 b2 ↔b4 ×+ (left v) 7→ right v (b1+b2)↔(b3+b4) (b1×b2)↔(b3×b4) ×+ (right v) 7→ left v ≷+ (left v1) 7→ left (left v1) We introduce primitive operators correspondingto the left- ≷+ (right (left v2)) 7→ left (right v2) to-right and right-to-left reading of each isomorphism. We ≷+ (right (right v3)) 7→ right v3 gather these operators into the table below. ≶+ (left (left v1)) 7→ left v1 ≶+ (left (right v2)) 7→ right (left v2) id : b↔b :id ≶+ (right v3) 7→ right (right v3) 3 ((),v) 7→ v 3+: 0+b↔b :2+ × 2 v 7→ ((),v) ×+ : b1+b2 ↔b2+b1 :×+ × ≷+: b1+(b2+b3)↔(b1+b2)+b3 :≶+ ×× (v1,v2) 7→ (v2,v1) 3 : 1×b↔b :2 ≷× (v1,(v2,v3)) 7→ ((v1,v2),v3) × × ×≷(cid:6)×(cid:6)0A×::::: (b1b+1b×2)(b×b21b×b3×o0b↔ob3×l2)↔(↔↔bb1↔1(b×b2+10b××31)bb1+2)(b×2b×3b3) :::::≶B×(cid:7)(cid:7)×0× ≶(cid:7)(cid:6)(cid:6)(cid:7)× (((((llrr(eeviiffgg1tthh,ttv(vv21v(1),v2,,v2,vv3,v33)v3))3)))) 7→7→7→7→7→ lr(((evlriefgi1tfgh,tht((tvvv(211vv,,,22vvv,,333vv)))33))) A T 7→ left () A F 7→ right () Each line of this table is to be read as the definition of two B (left ()) 7→ T operators. For example corresponding to the identity of × B (right ()) 7→ F isomorphism we have the two operators 3 : 1×b ↔ b and × 2×:b↔1×b. Sincetherearenovaluesthathavethetype0,thereductions Nowthatwehaveprimitiveoperatorsweneedsomemeans for the combinators 3+, 2+, (cid:6)0 and (cid:7)0 omit the impossible ofcomposingthem.Weconstructthecompositioncombinators cases. The semantics of the other combinators is straightfor- outofthe closure conditionsforisomorphisms.Thuswe have ward. Composition combinators are defined as follows: one sequential composition combinator ◦ and two parallel c1 v1 7→v2 compositioncombinators,oneforsums⊕andoneforpairs⊗. (c1⊕c2) (left v1)7→left v2 c1 :b1 ↔b2 c2 :b2 ↔b3 c1 :b1 ↔b3 c2 :b2 ↔b4 c2 v1 7→v2 (c1◦c2):b1 ↔b3 (c1⊕c2):(b1+b2)↔(b3+b4) (c1⊕c2) (right v1)7→right v2 c1 v1 7→v3 c2 v2 7→v4 c1 v1 7→v c2 v 7→v2 c1 :b1 ↔b3 c2 :b2 ↔b4 (c1⊗c2) (v1,v2)7→(v3,v4) (c1◦c2) v1 7→v2 (c1⊗c2):(b1×b2)↔(b3×b4) For the inverse direction, it is a simple matter to establish the following property. Definition 6.1: (Syntax of Π) We collect our combinators, Proposition 6.2: For every Π program c, such that c v 7→ types and values to get the definition of our language for v′, we can construct its adjoint c† such that c†v′ 7→v. isomorphisms, which we will refer to as Π: Proof: We can construct the required c† by replacing every primitive isomorphism with its dual. For sequential b ::= 0 | 1 | b+b | b×b | bool compositionwehave(c1◦c2)† =c†2◦c†1 andforparallelcom- v ::= () | left v | right v | (v,v) | F | T positionwehave(c1⊗c2)† =c†1⊗c†2 and(c1⊕c2)† =c†1⊕c†2. t ::= b↔b iso ::= ×+ | ≷+ | ≶+ | 3+ | 2+ C. Dagger Symmetrical Monoidal Structure | ×× | ≷× | ≶× | 3× | 2× The language Π is rich enough to express the required | (cid:6)0 | (cid:7)0 | (cid:6) | (cid:7) | id | A | B dagger symmetric monoidal(but not the compact close struc- c ::= iso | c◦c | c⊗c | c⊕c ture) structure. The proof for this is straightforward and we contentourselveswith a brief outline.The languageΠ can be Given a program c : b1 ↔b2 in Π, we can run it either in interpretedas categorywhoseobjectsarethe basetypesb and the forward direction by applying it to a value v1 : b1 or run whose morphisms the combinators c. Identity morphisms are it in the opposite direction by applying it to a value v2 : b2. givenby id andassociativity followsfromthe compositionof isomorphisms, thus establishing the required properties for a sets; the operator state identifies a state of type S b with an category. arrow (relation) of type 1 R b [3]; finally the pair of opera- Further Π is a monoidal category (b,×,1) where × is the torsηb andε aretheuniteliminationandintroductionthatare tensor operation, 1 is the identity object and the required required for any compact closed category. The operation η is natural transforms α, λ and ρ are given by ≶ , 3 and indexed by a type b. × × × ◦3 respectively.Therequired“pentagon”and“triangle” We present the type system below. The remainder of this × × axiomsfollowfromthedefinitionsofthetheseisomorphisms. section explains the semantics of core RΠ formally and Braiding is provided by × at the appropriate types and it illustrates its use in several examples: × satisfies the “hexagon” axioms. Further that ×× at b1×b2 is ⊢v :b ⊢s1 :S b ⊢s2 :S b the same as ×−×1 at b2×b1 establishing symmetry. ⊢∅:S b ⊢{v}:S b ⊢s1 ⊎ s2 :S b Finally, proposition 6.2 tells us that for every morphism c there exists its adjoint c† establishing that Π is a dagger ⊢iso :b↔b ⊢r1 :b1 R b2 ⊢r2 :b2 R b3 symmetric monoidal category. ⊢arr iso :b R b ⊢r1 ≫ r2 :b1 R b3 ⊢r :b1 R b2 ⊢s:S b VII. THELANGUAGERΠ ⊢second r :(b×b1) R (b×b2) ⊢state s:1 R b The core language for discrete quantum computing is ob- tainedbyaddingalayerontopofthereversiblecorepresented ⊢strength :(b1×S b2) R (b1×b2) in the previoussection. The additionallayer is that of vectors and linear maps or equivalently that of sets and relations. ⊢ηb :1 R (b×b) ⊢ε:(b×b) R 1 Definition 7.1: (Syntax of Core RΠ) A. Semantics b ::= ... | S b | b R b AprograminRΠconsistsoftheapplicationofarelationr v ::= ... | s toasetsproducingaresultingsets′.Wemodelthisevaluation s ::= ∅ | {v} | s ⊎ s usingtwo applications:the applicationr @ s appliesthe rela- r ::= arr iso | r ≫ r | second r tionr tothesetsandtheapplicationr@v appliestherelation | strength | state s | ηb | ε r to an individual set element v. The first application @ simply iterates down the structure of the set until it finds The language RΠ extends Π as follows. The set of types individual elements which can be processed using @: is extended with the type S b of sets of values and the type b1 Rb2 ofrelationsbetweensetsofvaluesoftypeb1 andsets r @ ∅ 7→ ∅ of values of type b2. The set of valuesis extendedwith sets s r @ {v} 7→ r@v which can either be the empty set ∅, a singleton set {v}, or the exclusive union s1 ⊎ s2. The exclusive union of sets s1 r @ (s1 ⊎ s2) 7→ (r @ s1) ⊎ (r @ s2) ands2 istheunionofalltheelementsthatarenotincommon. Theapplication @ appliesarelationtoasinglevaluev and This union reflects the cyclic nature of the underlying finite returns the set of possible values that are related to v: field as was explained in Section IV. In more detail, we saw (arr iso)@v 7→ {iso(v)} for example that adding the vector F|0i + T|1i to the vector T|0i + T|1i produces the vector T|0i + F|1i where the (r1 ≫ r2)@v 7→ r2 @ (r1@v) two occurrences of the component |1i canceled each other. (second r)@(v1,v2) 7→ strength@(v1,r@v2) strength@(v,∅) 7→ ∅ Expressed as sets, we would have that {1}⊎{0,1} is equal to {0}. strength@(v1,{v2}) 7→ {(v1,v2)} The layer of sets corresponds to a strong monad with the strength@(v,s1 ⊎ s2) 7→ strength@(v,s1) ⊎ singleton set as the unit and the folding of the exclusive strength@(v,s2) (state s)@() 7→ s unionas the bind operation.The Kleisli arrowsof this monad are functions that map values to sets. In order to express ηb@() 7→ i {(vi,vi)}, wherevi ∈b these functions themselves as relations, we provide explicit ε@(v,v) 7→ U{()} ε@(v,v′) 7→ ∅ if v 6=v′ arrow operators to construct them. The language therefore includes a separate syntactic category of relations which is When applied to a value v, the relation arr iso simply usedtobuildtherequiredKleislimapsusingarrowprimitives. applies the underlying isomorphism to the value which is The operator arr lifts any isomorphism from the underlying wrapped in a singleton set. Applying the sequence r1 and r2 reversible language to a relation on sets. The operator ≫ to a value v applies r1 to v to produce a set which is passed sequences two relations and the operator second applies a to r2. To apply a relation r to the second component of a relation to the second component of a pair leaving the first pair (v1,v2), we first produce (v1,r@v2) and then use the componentunchanged.These three operatorsare the minimal tensorial strength of the monad to push the pair construction core operators for any arrow language. In addition, we must through the resulting set as shown in the three rules for includeenoughstructuretoprovideacompactclosedcategory: strength. The relation state s maps the unit value () to the the operator strength is used to express the tensor productof given set s. When applied to the unit value (), the relation ηb produces a superposition of all pairs of values vi where vi constructions [3]. is an element of the type b (which is finite). The relation ε adjoint : (a R b)→(b R a) maps a pair of equal values to the singleton set containing () and maps a pair of different values to the empty set. As the adjoint r = arr 2×≫ first ηa ≫ first (second r) ≫ arr ≶ ≫ semantics for ηb and ε shows, these constructs exploit the × second ε ≫ arr (× ◦3 ) fact that the underlying language of classical values is based × × on finite values (and hence values that can be compared for costate : S a→(a R 1) equalityandenumerated).Inordertoaccommodatesetswhose costate s = adjoint (state s) elements are themselves sets or relations, it is necessary to have a first-order representation of relations using the arrow h. | .i : S a→S a→(1 R 1) constructorsinstead of using the higher-orderKleisli maps of the monad. hs1 | s2i = state s1 ≫ costate s2 Itisaroutinetasktoverifythattheevaluationrulespreserve |.ih.| : S a→S a→(a R a) the types. |s1ihs2| = costate s2 ≫ state s1 Proposition 7.2: If ⊢ r : b1 R b2 and ⊢ s : S b1 then ⊢r @ s:S b2. Theresultofthe dotproductis arelationoftype1R 1which corresponds to a scalar [3]. B. Derived Relations C. Interpretations ThelanguageRΠissurprisinglyexpressive:usingstandard There are two isomorphic ways of thinking about RΠ: a categorical constructions, it can express higher-order func- value of type S b could be viewed as a set of values of tions, currying, uncurrying, recursion, adjoints, dot products, type b or as a vector which maps values of type b to scalars and outer products. We illustrate these derived relations. The in the field of booleans. For example, s : S (bool ×bool) = superdense coding protocol in Section VIII-C uses the s2r {(F,F)}⊎ {(T,T)}denotestheset{(F,F),(T,T)}inthefirst construction below. interpretation and denotes the vector: We start by defining for every relation r a relation first r that applies r to the first component of a pair: (F,F) T (F,T)F first : a R b→(a×c) R (b×c) (T,F) F first r = arr×× ≫ second r ≫ arr×× (T,T)T   Next we present currying and uncurrying and use them to in the second interpretation. In the vector notation, the labels turn any set of pairs to a relation: onthe leftenumerateallthe valuesof thegiventype.A value is present if the corresponding entry in the vector is T and curry : ((c×a) R b)→(c R (a×b)) absent if the corresponding entry is F. To avoid clutter we curry r = arr (2× ◦××) ≫ second ηa ≫ willassumeafixedpreferredorderingofthelabelsontheleft arr ≷×≫ first r ≫ arr×× and omit them. Similarlyavalueoftypeb1Rb2canbeviewedasarelation uncurry : (c R (a×b))→((c×a) R b) mapping sets of values of type b1 to sets of values of type b2 uncurry r = first r ≫ arr (××◦≷×) ≫ or as a linear map which given our preferred ordering could ε ≫3× be represented as a matrix. For example, the values: s2r : S (a,b)→(a R b) r1,r2 : bool R bool s2r s = arr 2×≫ uncurry (state s) r1 = s2r ({(F,F)}⊎ {(T,F)}⊎ {(T,T)}) r2 = s2r ({(F,F)}⊎ {(F,T)}⊎ {(T,F)}) We can also define a trace operation to model recursion denote the relations {(F,F),(T,F),(T,T)} and from cyclic sharing [17]: {(F,F),(F,T),(T,F)} in the first interpretation, and the trace : ((a×c) R (b×c))→(a R b) matrices: trace r = arr 2×≫ first ηc ≫ T T T T arr (××◦≷×) ≫ first r ≫ arr ≶× r1 =(cid:18)F T(cid:19) r2 =(cid:18)T F(cid:19) ≫ second ε ≫ arr (× ◦3 ) × × in the second interpretation. In the matrix notation, the Finally, we can also define an adjoint for every relation columnsareimplicitlyindexedwithFandTfromlefttoright, and use it to define a costate relation that matches a given and the rows are implicitly indexed with F and T from top to state. We can combine a state and a costate in two different bottom. An entry is T if the pair (column-label,row-label) is ways to simulate the dot product and the outer product in the relation and F otherwise. In a conventional setting, the composition of r1 and r2 for tensorsand the requirednaturaltransformsα, λ and ρ are would be: arr liftedformsoftheirΠequivalents.Similarlybraidingand symmetry are preserved by lifting × from Π. × r1 ≫ r2 ={(F,F),(F,T),(T,F),(T,T)} Thedaggerstructureonrelationsisgivenbythecontravari- This is the semantics one gets in conventional relational antfunctoradjoint :b1Rb2 →b2Rb1whichweconstructed programming,i.e.,purePrologandbacktrackingmonads[27], in Section VII-B and is easily verified to be involutive. [28] which indeed can be implemented and formalized using Finallytherequiredautonomousstructureisgivenbychoos- sequences or sets [29]. ing the dual of S b to be the object S b itself. The required However in RΠ, the composition of these two same rela- unit and counit are given by η and ε in RΠ. The required tions is {(F,F),(F,T),(T,T)} because the pair (T,F) can be adjunction triangles become the same as the right and left produced in two different ways which cancel due to interfer- duals on objects coincide. Thus the arrow fragment of RΠ ence. It is perhaps more intuitive to compute the composition forms a dagger compact closed category. in the world of matrices: T T T T T∨F T∨T T F VIII. USINGRΠFORQUANTUMCOMPUTATION r1 ≫ r2 =(cid:18)T F(cid:19)(cid:18)F T(cid:19)=(cid:18)T∨F T∨F(cid:19)=(cid:18)T T(cid:19) Two more things are needed to use RΠ for quantum We can give similar interpretations for each of the RΠ computation. First, the zero vector (which is denoted by ∅) should never be encountered during computation as it does constructs. In the world of matrices, second r denotes the not correspond to a valid quantum state. Second, we must matrix produced by the tensor product of the identity matrix define a notion of measurement. and the matrix corresponding to r. The construct state is a no-op: it allows us to view a vector of size n as a matrix of dimensionsn×1.Weillustratethematrixdenotedbystrength A. Evolution of Quantum States at the type (bool ×S bool) R (bool ×bool) AsSchumacherandWestmoreland[1]explain,theevolution F T F T F F F F of quantum states in DQC2 only requires that the linear maps be invertible. We have already established that every F F T T F F F F linearmaphasanadjointbuttheseadjointsdonotnecessarily F F F F F T F T   coincide with the inverses. Consider the matrix: F F F F F F T T   T T The rows are indexed from top to bottom by (F,F), (F,T), (T,F), and (T,T). The columnsare indexedfromleft to right (cid:18)T T(cid:19) by(F,∅),(F,{F}),(F,{T}),(F,{F}⊎ {T}),(T,∅),(T,{F}), The adjoint of this matrix is itself but when multiplied by (T,{T}), and (T,{F}⊎ {T}). itself in the field of booleans it produces the zero matrix. In Thematricescorrespondingtoηb andεarecolumnandrow other words, any RΠ expression that can denote this matrix vectors with entries T at the diagonal elements. For example, should not be allowed. All the expressions in the syntactic η :1 R (bool ×bool) and ε:(bool ×bool) R 1 are: bool category r in RΠ denote invertible matrices except for ε. T This suggests a possibility for tracking the uses of ε using an F extended type system to syntactically guarantee that a given η = ε= T F F T F expression denotes an invertible transformation.   (cid:0) (cid:1) T   B. Measurement Asaspecialcase,wenotethatrelationsoftype1R1denote matrices of dimension 1 × 1, i.e., scalars. We interpret the In standard QM, the postulate of measurementrequires the matrix T as the scalar T and the matrix F as the scalar F. notion of an orthogonal projection. However, as explained in Lemm(cid:0)a(cid:1)7.3: The semanticsof RΠis so(cid:0)un(cid:1)d withrespectto Section IV, discrete quantumtheorieslack inner productsand both the relational interpretationand the vector interpretation. hence lack a standard notion of orthogonality. Nevertheless it is possible to define a sensible notion of measurement as D. Dagger Compact Closed Structure explained by Schumacher and Westmoreland [1]. The key We can now verifythatthe arrowfragmentof the language technical observations are (i) any set of linearly independent RΠ forms a dagger compact closed category. The objects vectors can form a basis, and (ii) it is possible to define dual of the category are the types S b and the morphisms are vectors for a given basis. the relations b1 R b2. These form a category since we have In more detail, assuming the vector interpretation of RΠ, identity morphisms due to arr id and the composition of a measurement (or an observable) corresponds to a basis relations is associative due to the associativity of the matrix {s1,s2,...} where the collection of values si denote linearly multiplicationin the model(soundness).The categoryhas the independent vectors. As discussed in Section IV, the space requiredmonoidalstructurewithS (b1×b2)beingtheproduct of 1-qubit vectors contains just three vectors with any pair for the objects S b1 and S b2 and S 1 is the identity object forming a basis. For each choice of basis, we associate an observable: X-basis = {{T},{F}⊎ {T}} where dualbasis ={ {(F,T)}⊎ {(T,F)}⊎ {(T,T)}, Y-basis = {{F}⊎ {T},{F}} {(F,F)}⊎ {(T,F)}⊎ {(T,T)}, Z-basis = {{F},{T}} {(F,T)}⊎ {(T,F)}, {(F,F)}⊎ {(T,T)}} We then associate a basis dependent dualsi to each vector si Interestingly, it is possible to write this same example in such that hs | s i denotes the scalar T if and only if i = j. i j conventionalrelationalprogramming.The fact that intermedi- For example, the dual vectors for the vectors in the X-basis ateresultsareaccumulatedusingthestandardunioninsteadof are: theexclusiveunionisapparentintheresults.Howeverbecause X-dualX = {{F}⊎ {T},{F}} this computation does not use significant intermediate steps, the only values that need to be treated specially are the final ThesimplestwaythentoextendRΠistoaddoneconstruct results. Indeed if the results that appear an even number of measure that takes two arguments:a vector and a set of dual times are removed, then the Prolog execution performs the basis vectors along which the vector should be measured. superdense coding exactly. For example, to measure the vector {T} in the X-basis, we The complete program and its execution are below: would write: measure {T}{{F}⊎ {T},{F}} The result of measurementis any dual basis vector that can possibly match r(false,false). the given vector selected at random. In the above example, r(true,true). vd(false,false). only the first dual basis vector can possibly match the given vd(true,true). s(false,true). vector which means that the result is deterministic. s(true,false). eq(false,false). A remarkable feature of the categorical approach to QM is eq(true,true). u(false,false). thatthesemanticsofmeasurementcanbeexpressedasfollows u(false,true). id(false,false). in RΠ: u(true,true). id(true,true). v(false,false). g(false,true). v(false,true). g(true,false). v(true,false). measure s {d1,d2,...}=di if hdi | si denotes T k(false,false). (cid:0) (cid:1) rd(false,true). k(true,false). rd(true,false). k(true,true). As explained in Sections VII-B and VII-C, the dot product is rd(true,true). expressibleinRΠandtherelationsoftype1R1areidentified sd(false,false). with scalars. If more than one dual vectorproducesthe scalar sd(true,false). gk(X,Y) :− g(X,Z),k(Z,Y). Tthentheresultofmeasurementisnon-deterministicwiththe sd(true,true). alice(0,X,Y):− id(X,Y). dual vector di picked at random. ud(false,true). alice(1,X,Y):− g(X,Y). It should also be possible to exploit the fact that our ud(true,false). alice(2,X,Y):− k(X,Y). alice(3,X,Y):− gk(X,Y). categories have biproducts to extend the language in a richer sdcoding(N,M) :− r(X,Y),alice(N,X,B),measure((B,Y),M). way by allowing measurements to occur in the middle of computation [3]. measure((S1,S2),0) :− rd(B1,B2),dotP((B1,B2),(S1,S2)). measure((S1,S2),1) :− sd(B1,B2),dotP((B1,B2),(S1,S2)). measure((S1,S2),2) :− ud(B1,B2),dotP((B1,B2),(S1,S2)). C. Example: Superdense Coding measure((S1,S2),3) :− vd(B1,B2),dotP((B1,B2),(S1,S2)). dotP((B1,B2),(S1,S2)) :− eq(B1,S1),eq(B2,S2). The superdense coding example presented by Schumacher and Westmoreland [1] can be directly implemented in RΠ. AliceandBobinitiallyshareanentangledstate,representedby 28 ?- sdcoding(0,X). X = 3 ; {(F,F)}⊎ {(T,T)}. Depending on Alice’s choice of sending X = 1 ; X = 0 ; X = 3 ; X = 2 ; numbers0 to 3, Alice applies one of the followingoperations X = 0 ; X = 0 ; on the first bit: X = 1 ; X = 1 ; X = 3. X = 3. alice0 =arr id 29 ?- sdcoding(1,X). 31 ?- sdcoding(3,X). alice1 =arr (A◦××◦B) X = 0 ; X = 1 ; X = 1 ; X = 3 ; alice2 =s2r (state ({(F,F)}⊎ {(T,F)}⊎ {(T,T)})) X = 2 ; X = 0 ; alice3 =alice1 ≫ alice2 X = 0 ; X = 1 ; X = 2. X = 2 ; X = 0 ; By measuring in a particular dual basis described below, 30 ?- sdcoding(2,X). X = 2. X = 1 ; Bob will deterministically set a different dual vector for each possibleoperationthatAlicecouldhaveperformed.Theentire IX. CONCLUSION example is then written as follows: We have distilled a programming model for the discrete measure ((first alicen) @ ({(F,F)}⊎ {(T,T)})) dualbasis quantumtheory overthe field of booleansrecently introduced bySchumacherandWestmoreland[1].Themodelisexpressed [8] E. Moggi, “Computational lambda-calculus and monads,” in Proceed- in a small calculusRΠ with formaltype rules and semantics. ings of the Fourth Annual Symposium on Logic in computer science. IEEEPress,1989,pp.14–23. The language RΠ is directly inspired by the computational [9] J.Vizzotto, T.Altenkirch, andA.Sabry, “Structuring quantum effects: structures of quantum mechanics previously identified by superoperators as arrows,” Mathematical. Structures in Comp. Sci., Abramsky and Coecke and Selinger. The semantics of RΠ is vol.16,no.3,pp.453–468, 2006. [10] J.K.Vizzotto,G.R.Librelotto,andA.Sabry,“Reasoningaboutgeneral sound with respect to both a relational model with exclusive quantum programs over mixed states,” inSBMF,ser. Lecture Notes in unions or a vector space model over the field of booleans. ComputerScience,M.V.M.OliveiraandJ.Woodcock,Eds.,vol.5902. Computationally RΠ is a relational programming language Springer, 2009,pp.321–335. [11] J. K. Vizzotto, A. R. D. Bois, and A. Sabry, “The arrow calculus as surprisingly similar to traditional relational programminglan- a quantum programming language,” in WoLLIC, ser. Lecture Notes in gauges like Prolog with the significant difference that where ComputerScience, H.Ono,M.Kanazawa, andR.J.G.B.deQueiroz, Prologwouldaccumulateallpossibleanswerswithrepetitions, Eds.,vol.5514. Springer, 2009,pp.379–393. [12] J.K.Vizzotto, A.C.daRochaCosta,andA.Sabry,“Quantum arrows RΠ allows interference between possible answers. in haskell,” Electr. Notes Theor. Comput. Sci., vol. 210, pp. 139–152, Anaturalgoalofourresearchistounravelthemathematical 2008. underpinningsbehind the power of quantum computation.By [13] T. Altenkirch, J. Grattage, J. K. Vizzotto, and A. Sabry, “An algebra ofpurequantumprogramming,”Electr.NotesTheor.Comput.Sci.,vol. analyzing models such as those presented in this paper, we 170,pp.23–47,2007. hope we will be able to shed some light on this fundamental [14] J. Hughes, “Generalising monads to arrows,” Science of Computer issue. Deutsch’s quantum algorithm, which establishes in a Programming,vol.37,pp.67–111,May2000. [15] J.-Y. Girard, “Linear logic,” Theor. Comput. Sci., vol. 50, no. 1, pp. single measurement whether a boolean function is constant 1–102,1987. or balanced, makes use of interference and quantum paral- [16] G. Plotkin and J. Power, “Algebraic operations and generic effects,” lelism. Although discrete quantum computing over the field AppliedCategorical Structures,vol.11,pp.69–94,2003. [17] M. Hasegawa, “Recursion from cyclic sharing: Traced monoidal cate- of booleans, DQC2, contains both these properties, Deutsch’s goriesandmodelsofcycliclambdacalculi,”inProceedingsoftheThird algorithmcannotbeefficientlyimplementedwithinthismodel. International Conference on Typed Lambda Calculi and Applications. Thisexampleillustratesthenon-trivialcharacterofthequestto London,UK:Springer-Verlag, 1997,pp.196–213. [18] J. Power and E. Robinson, “Premonoidal categories and notions of disentanglethepowerofquantumcomputation.Inmoredetail, computation,” Mathematical. Structures in Comp. Sci., vol. 7, October having eliminated much of the structure of actual quantum 1997. mechanics, the connection between DQC2 and conventional [19] S. Abramsky, “Big toy models: Representing physical systems as Chu spaces,”CoRR,vol.abs/0910.2393, 2009. relationalprogrammingsingles out the use of exclusiveunion [20] A. van Tonder, “A lambda calculus for quantum computation,” SIAM as the source of all the “quantum-ness”. Assuming that the JournalonComputing, vol.33,no.5,pp.1109–1135, 2004. exclusive union would be performed in “constant time” by a [21] R. Duncan, “Types for quantum computation,” Ph.D. dissertation, Ox- fordUniversity, 2006. quantum computer,more work is needed to establish whether [22] T. Altenkirch and J. Grattage, “A functional quantum programming it is possible to write more efficient algorithms using the language,”inProceedingsoftheTwentiethAnnualIEEESymp.onLogic exclusive union. inComputerScience,LICS2005,P.Panangaden,Ed. IEEEComputer SocietyPress,June2005,pp.249–258. [23] P.SelingerandB.Valiron,“Alambdacalculusforquantumcomputation ACKNOWLEDGMENTS with classical control,” Mathematical Structures in Computer Science, vol.16,no.3,pp.527–552, 2006. WehavebenefitedfrommanydiscussionswiththeQuantum [24] R.P.JamesandA.Sabry,“Programmingwithisomorphisms:Thenotion andNaturalComputinggroupatIndianaUniversity,especially ofinformationeffects,” 2010,submittedforpublication. Mike Dunn, Andy Hanson, and Larry Moss. The presentation [25] E. Moggi, “Computational lambda-calculus and monads,” in the IEEE Symposium on Logic in Computer Science, 1989, pp. 14–23, also wasimprovedfollowingsuggestionsfromDanielP.Friedman. appeared as:LFCSReportECS-LFCS-88-86,University ofEdinburgh, 1988. REFERENCES [26] M. Fiore, “Isomorphisms of generic recursive polynomial types,” SIG- PLANNot.,vol.39,no.1,pp.77–88,2004. [1] B. Schumacher andM. D.Westmoreland, “Modal quantum theory,” in [27] R. Hinze, “Deriving backtracking monad transformers,” in ICFP ’00: QPL 2010, 7th workshop on Quantum Physics and Logic, B. Coecke, Proceedings of the 5th ACM SIGPLAN International Conference on P.Panangaden, andP.Selinger, Eds.,2010,pp.145–149. Functional Programming. ACMPress,2000,pp.186–197. [2] S.AbramskyandB.Coecke,“Acategorical semanticsofquantumpro- [28] O.Kiselyov, C.-c.Shan,D.P.Friedman, andA.Sabry,“Backtracking, tocols,”inLICS’04:Proceedings ofthe19thAnnualIEEESymposium interleaving, and terminating monad transformers: (functional pearl),” onLogicinComputerScience. Washington,DC,USA:IEEEComputer inProceedingsofthetenthACMSIGPLANinternationalconferenceon Society, 2004,pp.415–425. Functionalprogramming,ser.ICFP’05. NewYork,NY,USA:ACM, [3] K. Engesser, D. M. Gabbay, and D. Lehmann, Eds., Handbook of 2005,pp.192–203. Quantum Logic and Quantum Structures: Quantum Logic. Elsevier [29] P. L. Wadler, “How to replace failure by a list of successes,” in B.V.,2009,ch.7:Categorical QuantumMechanics, SamsonAbramsky Functional Programming Languages and Computer Architecture, ser. andBobCoecke. Lecture Notes in Computer Science, J.-P. Jouannaud, Ed., vol. 201. [4] P.Selinger,“Towardsaquantumprogramminglanguage,”Mathematical SpringerVerlag,Sep.1985,pp.113–128. Structures inComputer Science, vol.14,no.4,pp.527–586,2004. [5] ——,“Daggercompactclosedcategoriesandcompletelypositivemaps,” Electron. NotesTheor.Comput. Sci.,vol.170,March2007. [6] M. A. Nielsen and I. L. Chuang, Quantum computation and quantum information. NewYork,NY,USA:CambridgeUniversityPress,2000. [7] S.-C. Muand R. Bird, “Functional quantum programming,” in Second Asian Workshop on Programming Languages and Systems, KAIST, Korea,Dec.2001.

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.