182 The European Physical Journal D
that a program really implements the desired algorithm)than to be the starting point for translation of quantumspeciﬁcations to low level primitives. A related paper byZuliani  showed an interesting technique for transform-ing a generic
program into an equivalent but re-versible one, which has a direct application to the problemof implementing quantum oracles for classical functions(see Sect. 5.2).¨Omer [10,11] developed a procedural formalism (
)which shares many common points with the approach pre-sented in this article about the treatment of quantum reg-isters
is however an interpreted environment and isnot built on the top of a standard classical language. Inthis language, just like in
, non trivial unitary op-erations are functions (
) instead of objects (see Sects. 3.2 and 5.1), so that their manipulationis subject to the function call syntax; hence automatic op-erator construction (
controlled operators) and simpli-ﬁcation are very diﬃcult to implement, if not impossible.Last, no notion of parallelism for independent operatorsis present (see Sect. 3.3).In the following section, building on top of these pre-vious works, a list of desirable features for a quantumprogramming language is presented.
2 Desiderata for a quantum programminglanguage
A common theme in the ﬁeld of quantum computation isthe attempt to think about algorithms in the new “quan-tum way”, without being misled by classical intuition. Itcould seem that describing quantum computer algorithmsin an almost entirely classical way would hide rather thanemphasise the diﬀerence between quantum and classicalcomputing. The point of this common objection is not, of course, about criticising the assumption that the controlsystem which drives the evolution of the quantum devicedoes not behave according to classical mechanics. Rather,it could be originated by the guess that regarding a partof the quantum resources as
and another one as
, a sort of quantum von Neumann machine, could leadmore naturally to quantum algorithms. This guess hashowever been disproved by Chuang and Nielsen , whoshowed
that, if the program is to be executed determin-istically, nothing can be gained by specifying it through
Quantum registers in
are however dealt with in a nonuniform fashion: in addition to
, two other register typesare present, the
, which, for a propertype checking, require the knowledge of the quantum devicestate.
The authors of  showed that a programmable quan-tum gate array,
a quantum machine with a ﬁxed evolu-tion
which deterministically implements the transformation
, is such that if
aredistinct unitary evolutions up to global phase changes, then
here plays the role of the “program” and determines which operation
is to be ex-ecuted on the “data” register prepared in the state
a quantum state instead of through a classical one. Theseconsiderationscan be summarised by saying that quantumalgorithms are speciﬁed inherently by means of classicalprogramming.Subject of this article is the investigation and speciﬁca-tion of the desirable features of a quantum programminglanguage. The following list is a summary of the mainpoints:
: the language must be powerful enough toexpress the quantum circuit model. This means thatit must be possible to code every valid quantum algo-rithm and, conversely, every piece of code must corre-spond to a valid quantum algorithm;
: the language must include (
bean extension of) a high level
classical computing paradigm
in order to integrate quantum computing andclassical pre- and post-processing with the smallest ef-fort.
languages, with a limited implementationof classical primitives and facilities, would inevitablyfall behind whenever “standard” programming tech-nologies improve;
: the language must keep classical program-ming and quantum programming separated, in orderto be able to move to a classical machine all those com-putations which do not need, or which do not enjoy anyspeedup in being executed on, a quantum device;
: the language must provide a set of highlevel constructs which make the process of codingquantum algorithms closer to the programmer’s wayof thinking and to the pseudo-code modular notationof current research articles. The language must allowan automated scalable procedure for translating andoptionally optimising the high level code down to asequence of low level control instructions for quantummachines;
: the language must be inde-pendent from the actual hardware implementation of the quantum device which is going to be exploited.This allows “recompilation” of the code for diﬀerentquantum architectures without the programmer’s in-tervention.The next sections are organised along the followinglines. After a general introduction about the computa-tional model (Sect. 2.1), the guidelines for the envisionedlanguage (Sect. 2.2) are presented, together with a discus-sion on hardware requirements (Sect. 2.3). Section 3 thendescribes the syntax for high level constructs (Sects. 3.1and 3.2) as well as the low level, but still hardware inde-pendent, primitives to which these constructs get reduced(Sect. 3.3). Section 4 shows some code samples to clarifythe language layout. Section 5 discusses with more detailssome of the choices for the operator syntax (Sect. 5.1)and the open problem of the implementation of opera-tors for classical functions (Sect. 5.2). Appendixes (A.1,A.2, A.3) present possible approaches for implementingthe high level primitives previously described.
orthogonality of program states means that the program spec-iﬁcation is indeed a classical speciﬁcation.