Quantum Programming in Polylogarithmic Time
Abstract
Polylogarithmic time delineates a relevant notion of feasibility on several classical computational models such as Boolean circuits or parallel random access machines. As far as the quantum paradigm is concerned, this notion yields the complexity class fbqpolylog of functions approximable in polylogarithmic time with a quantum random access Turing machine. We introduce a quantum programming language with first-order recursive procedures, which provides the first programming language-based characterization of fbqpolylog. Each program computes a function in fbqpolylog (soundness) and, conversely, each function of this complexity class is computed by a program (completeness). We also provide a compilation strategy from programs to uniform families of quantum circuits of polylogarithmic depth and polynomial size, whose set of computed functions is known as qnc, and recover the well-known separation result .
Keywords and phrases:
Quantum programming languages, Polylogarithmic time, Quantum circuits, Implicit computational complexityCopyright and License:
2012 ACM Subject Classification:
Theory of computation Quantum complexity theoryFunding:
This work is supported by the the Plan France 2030 through the PEPR integrated project EPiQ ANR-22-PETQ-0007 and the HQI platform ANR-22-PNCQ-0002; and by the European Union through the MSCA SE project QCOMICAL (Grant Agreement ID: 101182520), project NEASQC (Grant Agreement 951821), and project HPCQS (Grant Agreement 101018180).Editors:
Paweł Gawrychowski, Filip Mazowiecki, and Michał SkrzypczakSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
1.1 Motivation
Quantum computing is a field of research, which is drawing a great amount of interest as it leverages quantum superposition and interference to obtain computational advantage. The development of quantum programming languages is thus a key issue, which raises major technical and conceptual challenges to ensure their physicality. In order to check that quantum programs can be compiled and executed on a quantum computer, one has to design restrictions and constraints implying that quantum programs do not break the laws of quantum mechanics, for example, no-cloning of data and unitarity of operators. In addition, there is a need to tame their complexity in order to ensure their feasibility. By feasibility, we mean that quantum executions do not use too many ancillary qubits and run in tractable time.
Taking inspiration from the classical world, this kind of issue has lead to the definition and study of several quantum polynomial time classes. One of the most striking examples of such classes is bqp, the quantum analog of the class of bounded-error probabilistic polynomial time problems bpp. By Yao’s theorem [23], bqp corresponds exactly to what can be computed by uniform families of quantum circuits of polynomial size. This class, as well as its extension to functions, fbqp, have been characterized through various means, including function algebras [19] and first-order programs [12].
A natural question is then to study subpolynomial complexity classes. As for classical programs, it allows to express notions of parallel complexity, which is highly relevant in the quantum setting where program superpositions can be viewed as a kind of parallelism with interferences. Parallelization can be used to reduce the maximum number of operations performed in total on each qubit. This is particularly challenging as qubit fidelity, i.e., the ability of qubits to align with their intended states through time and unitary operations, is a bottleneck of quantum computation [14]. While polynomial time algorithms performed in sequence are useful in the fewer qubits, higher fidelity setting [12], parallelized computation becomes more interesting in the case of more qubits, lower fidelity [15], as the total number of operations on individual qubits, and their necessary coherence time, scale more slowly. Moreover, separation results between those small complexity classes could lead to a proof of the quantum advantage, as constant depth quantum circuits have been shown to be strictly more powerful than their classical counterparts [5].
In the literature, polylogarithmic (polylog) time has been introduced and studied on Quantum Random-Access Turing Machine (QRATM) [10]. As in the classical case, this definition uses random-access machines, as opposed to standard quantum Turing machines, because of the sub-linearity of time: although the machine cannot read its entire input, it can access any input bit or qubit. On quantum models, polylog time corresponds to problems that a QRATM can solve in a polylog number of steps, leading to the definition of the complexity class fbqpolylog [20, 21] of functions computable with bounded-error in quantum polylog time.
A main open problem is to design programming languages characterizing such a polylog class abstracting from the low-level considerations (machines, uniformity conditions, etc.) [22].
1.2 Contributions
This paper makes a first step towards solving this problem. Towards that end, we introduce a quantum programming language with first-order recursive procedures, named plp for PolyLog Programs (Figure 1), on which we obtain the following results:
-
plp is complete for fbqpolylog (Theorem 10), i.e., each function of this complexity class is computed by a plp program. Completeness is shown by a direct encoding of polylog QRATM in plp.
-
plp is also sound but not complete for qnc. For soundness, we outline a compilation algorithm that from a plp program and its input size outputs a quantum circuit of polylog depth and polynomial size, i.e., circuits computing functions in qnc (Theorem 13). There is an implementation of this algorithm available at https://gitlab.inria.fr/mmachado/pfoq-compiler, whose compiler works for programs even beyond the plp fragment, namely non-polylog programs. Completeness does not hold (Theorem 19) as it is well-known that fbqpolylog is strictly included in qnc.
1.3 Related Work
Different characterizations of quantum complexity classes have been obtained for polynomial time using, non-exhaustively, lambda-calculus [8], function algebra [19], and a first-order programming language [12]. A characterization of bqpolylog based on a function algebra has been provided in [20, 21], where a fast quantum recursion scheme is used to ensure that programs terminate in polylogarithmic time. Our work employs a similar bounded recursion scheme, using a simple divide-and-conquer strategy on qubits. This characterization can be seen as simpler and more natural approach since an imperative first-order programming language is more accessible to the typical programmer. Similar divide-and-conquer strategies have been explored in quantum computation not only for the purpose of finding quantum advantage [5, 6] but also to leverage classically-inspired techniques in the quantum scenario, where reversibility and unitarity must be satisfied [18, 17]. Our work is mostly focused on this second aspect, where the objective is to balance the expressivity of a quantum programming language with the statically-verifiable properties of its programs, namely unitarity, time complexity, as well as circuit size and depth.
2 First-Order Quantum Programs
(Integers) (Booleans) (Qubit lists) (Qubits) (Statements) (Procedure decl.) (Programs)
2.1 Syntax
The considered language is a quantum programming language with first-order recursive procedures whose syntax is provided in Figure 1. There are four basic types for expressions:
-
1.
Integer expressions are variables , constant , arithmetic operations like or ,111The semantics of will be defined as the ceiling of the result, hence it preserves the set of integers. as well as the size of a list of qubits .
-
2.
Boolean expressions are defined in a standard way.
-
3.
Qubit lists are lists of unique (i.e., non-duplicable) qubit pointers. A qubit list expression is either a variable , the first (respectively second) half (resp. ) of the qubit list , or a list where the -th element of has been removed. We will also use some syntactic sugar for removing multiple elements of a list with .
-
4.
Qubit expressions are of the shape , which denotes the -th qubit in . We also define syntactic sugar for pointing to the -th last qubit in a list, by defining for any , .
Throughout the paper, , , will denote arbitrary expressions of any type. Given a syntactic object , let be the set of qubit variables used in , e.g., is the set of qubit variables in the expression .
A program is defined in Figure 1 as a list of (possibly recursive) procedure declarations , followed by a program statement . We assume that holds. In what follows, it will be convenient to order the set by to fix a precise memory representation of quantum states.
Let Procedures be an enumerable set of procedure names . We write to denote that appears in . Each procedure of name is defined by a unique procedure declaration , which takes the lists of qubits as parameters. It always holds that . We will sometimes write to explicitly state that is the statement of .
Statements include the no-op instruction, (single-qubit) unitary application, sequences, conditional, quantum case, and procedure calls. For sake of universality [4], in a unitary application , the unitary transformation can take an integer and a function as optional arguments222In the case of quantum polynomial time, Adleman et al. [1] showed how the choice of amplitudes can affect the expressivity of classes such as bqp, requiring the restriction of polynomial-time approximable complex amplitudes. How the set of amplitudes influences the class fbqpolylog remains an open question, as discussed in [20, 21], and so we abstain from the use of the entire set of complex numbers and instead use a field which may refer to, for instance, polynomial-time approximable complex amplitudes., and we omit them when they are of no use. As we shall see in next section, unitary transformations will be restricted to phase gate, rotation gates, and NOT gate.
The quantum conditional allows branching by executing statements and in superposition according to the state of qubit . When we want to treat cases on multiple qubits, we will sometimes simplify the nested qcases, for example is a shorthand notation for
In each procedure call , the no-cloning theorem of quantum mechanics imposes the restriction that .
The syntax of Figure 1 can be used to define typical quantum computing primitives such as controlled-NOT, swap, as well as Toffoli gates, as syntactic sugar:
2.2 Semantics
Let denote the set of Booleans and denote the set of lists of natural numbers, being the empty list. We interpret basic types as follows:
Qubits are interpreted as integers (pointers) and qubit lists are interpreted as lists of pointers. Each of arity comes with a basic type signature and computes a fixed total function . We set . For example, . Constants are treated as particular operators of arity . Given a program , for each basic type , the semantics of expressions is described standardly in Figure 2 as a function
holds when expression of type evaluates to the value under the context . The context is just a map from each program input to a list of qubit pointers taken into consideration when evaluating . For instance, we have that (the second qubit is of index ), ( is used for errors on type ), (index is used for error on type ), and (the third qubit has been removed).
Let denote the Hilbert space of qubits with tensor product and let denote the powerset of . Given a program , let the length of be a function mapping each qubit variable to an integer . We write as a shorthand for and as a shorthand for .
A configuration of program over qubits is of the shape
where and are two special symbols denoting termination and error, respectively, where is a quantum state, and where, for each qubit list , is the set of qubit pointers accessible from and is the list of qubit pointers assigned to . Given a qubit such that , we write as a shorthand for and we write for the function defined by , and .
Given a program , with , let be the set of configurations over qubits. The initial configuration in on input state is . A final configuration can be defined in the same way as .
Each unitary transformation of a unitary application comes with a function assigning a unitary matrix to each integer and function . We restrict ourselves to three kinds of gates: the phase gate , rotation gate and gate , whose semantics is defined as follows:
The big-step semantics is defined in Figure 3 as a relation in . The symbols and for error and termination, respectively, are terminal states: they cannot appear on the left-hand-side of a rule. In Figure 3, the function of accessible qubits is used to ensure that unitary operations on qubits can be physically implemented. For example, the statements and of a quantum branch cannot access the control qubit to ensure reversibility. To avoid cumbersome use of nested conditionals in the program syntax, each procedure call on a (at least one) empty qubit list is semantically equivalent to a (see Figure 3).
We write , whenever holds. If the program terminates on all inputs (i.e., always reaches a final configuration) then is a total function on quantum states. Note that if a program terminates then it is obviously error-free (i.e., does not reach a configuration with a ) but the converse property does not hold. However, every program can be efficiently transformed into an error-free program such that , if is defined then . This can be done, for instance, by checking the size of qubit lists before accessing them. Hence we will restrict ourselves to error-free programs in what follows.
When an input state is defined by different qubit lists, we denote them in subscript. For instance, for and , we have that indicates state given as input to qubit list , state given as input to qubit list .
Example 1 (Binary search).
Let be a sorted string and denote the encoding of as a binary given by , , and . Program SEARCH in Figure 4 computes the function , where indicates whether contains a or not.
Example 2 (Square Log).
Program SQLOG of Figure 4 defines two recursive procedures f and g and its complexity is square logarithmic in the size of the first qubit list . The procedure g has logarithmic complexity in as each recursive call to g divides the size of the first argument by 2. Similarly, the procedure f calls itself a logarithmic number of times and calls g each time, hence accounting for a complexity.
2.3 Polylogarithmic Time Restrictions
We now define some restrictions on the admissible programs to guarantee that they terminate in polylogarithmic time (i.e., each procedure cannot perform more than a polylogarithmic number of recursive calls in the input size) and that their total number of sequential procedure calls (i.e., calls that are not in superposition) is bounded polylogarithmically.
Towards that end, we define a relation between procedures to account for recursion. Given a program , the call relation is defined for any two procedures as whenever . The relation is then the transitive closure of . The relation is defined by if as well as both hold. Finally, the relation is defined as if and both hold. A procedure is recursive whenever holds. Two procedures and are mutually recursive whenever holds
Definition 3.
A program is said to be recursively halving, denoted , if for each procedure and for each procedure call ,
This restriction can be viewed as a recursion scheme, which implies a polylogarithmic time bound on programs in half by ensuring that in every (mutually) recursive procedure call at least one of the input qubit lists is cut in half.
Now we impose a further condition on the number of sequential (mutually) recursive procedure calls. For that purpose, we define the width of a program in the following way.
Definition 4.
Given a program , the width of a procedure is defined by where is defined inductively on statements by:
The width of a program is defined by . Let be defined by .
Definition 5.
The set plp of PolyLog Programs is defined by .
As we will see in next Section (Theorem 10), the restriction to plp programs ensures that they can be simulated by quantum random-access Turing machines running in polylogarithmic time.
Example 6.
Both programs SEARCH and SQLOG of Figure 4 can be shown to be in plp. Let us consider the case of SQLOG which has two recursive procedures: f and g. We have . It is easy to check that as the procedure f recursively calls itself on and g recursively calls itself on . Furthermore, we verify that:
2.4 Properties of PLP Programs
Because of the half condition, programs in plp can be shown to be terminating.
Theorem 7.
If , then terminates.
Proof.
This is trivially ensured by the half condition, which shows that the size of arguments is strictly decreasing in recursive calls whenever the arguments are not empty as seen in the semantics of in Figure 2, and the program semantics of Figure 3, as procedure calls terminate on empty list.
As plp programs are quantum programs, they must be reversible. We show that we can constructively define a plp program that computes the inverse of .
Theorem 8 (Reversibility).
There exists a program transformation such that, for any , is the identity and .
Proof.
The program transformation can be constructively defined on program statements. For instance, and .
3 A Characterization of Quantum Polylog Time
In this section, we will show that plp characterizes exactly the functions in fbqpolylog, the class of quantum polylog time approximable functions. That is, programs in plp compute functions in fbqpolylog (Soundness) and, reciprocally, for any function in fbqpolylog, there exists a plp program that computes it (Completeness).
3.1 Quantum Random Access Turing Machines and Polylog Time
To define the class fbqpolylog, we introduce the computational model of quantum random-access Turing machines (QRATMs) [20, 21]. fbqpolylog is not defined on standard quantum Turing machines because, due to its sub-linear time complexity, such a machine would not be able to access all of its input. Random-access machines solve part of the problem by allowing the machine to jump over its input.
A QRATM has a random access input tape, a log-space index tape, and work tapes and is then defined as a triplet , where is a finite set of states containing an initial state and two (disjoint) subsets and for accepting and rejecting states, is the tape alphabet, and the transition function is such that
This transition maps the state and read symbols on the index tape and work tapes to a function mapping each state, each written symbol, and each head move to an amplitude. Note that the input tape does not have a tape head, hence is not taken into account in this transition function.
To get access to any character of the input, a special transition of the machine is defined: when the machine is in a special state , the cell of input tape corresponding to the binary number written on the index tape is swapped with the cell under the work tape head, and the machine transitions to a state . Note that, in contrast with [20, 21], the input tape is not read-only as we consider a class of functions rather than decision problems, hence having the modified input be part of the output is necessary. This allows for example to consider the identity function.
A pure configuration of a QRATM is a tuple where is a state, the word written on the input tape, assumed to begin in cell , is the word on the index tape, , …, the words written on the work tapes, is the position of the index tape head, , …, the tape head positions for the work tapes, all positions are relative to the first character of the word. The initial configuration for input is . We call a superposition of pure configurations a surface configuration. Surface configurations can be written as , with ranging over pure configurations, is the amplitude associated with configuration . QRATMs are also required to satisfy reversibility and well-formedness condition: a configuration may have only one predecessor, and the transition function must preserve the norm of configurations, that means that for all reachable surface configurations, .
A QRATM halts in time on input if, starting from the initial configuration , after steps, its surface configuration is a superposition of pure configurations in accepting states. If for all input , a QRATM halts on input in time , we say that halts in time . In particular, if there exists such that halts in time , halts in polylog time. If a QRATM halts, its output is defined as the linear combination of the words on the input tape and work tapes, using the previous notations, it corresponds to . Given a function , we say that a QRATM approximates with probability if for all input , starting from the initial configuration , halts with an output such that .
Definition 9.
The class fbqpolylog is defined as the set of functions such that there exists a QRATM approximating with probability at least in polylog time.
Although a natural theoretical model for describing polylogarithmic time, QRATMs are problematic because they are too semantic in nature: to characterise their complexity, the time bound must be given explicit and their halting condition depends on the inner state of the machine, which is a semantic condition. This motivates the provided characterization in the next section.
3.2 Main Result
We denote by the set of functions computed by programs in plp. That is . A program approximates function with probability if , in other words if for all input, the output of coincides with with probability at least . The set of functions that can be approximated with probability at least is denoted by .
Theorem 10 (Soundness & Completeness).
.
Proof.
Soundness is proved via the fact that the half and restrictions imply a polylogarithmic bound for the depth of the call tree and a logarithmic bound on the degree of this tree. Then we show that if some plp program approximates , then the poly-logarithmic time QRATM simulating also approximates and guarantees that .
Conversely, for completeness, given a polylog time QRATM , we define a plp program that simulates . To achieve this, we represent the input tape, the index tape and the work tapes using qubit lists, the state of the Turing machine is encoded inside the work tape by writing it to the left of the character under the tape head. To simulate the execution of , we define the following procedures:
-
access_input: allows for QRATM-like access to the input tape by performing quantum branching on each cell of the index tape. The correct cell on the input tape to be read is determined by “splitting” in half the set of possible input tape addresses according to the value of each index tape cell.
-
local_step: simulates a constant-time transition of locally on three adjacent cells of the index tape and the work tape, or calls access_input for the query step.
-
full_step: performs local_step iteratively to simulate a transition of over the entirety of the index and work tapes.
-
iterate: executes full_step a polylogarithmic number of times, simulating the entire run of .
These procedures can be combined to obtain a plp program simulating , by encoding ’s tapes in a way that allows for a local evolution of the state.
4 Circuit Compilation
In this section, we sketch an algorithm that compiles plp programs into circuits of polynomial size and polylogarithmic depth. An implementation of this algorithm, that also works for non-plp programs, is available at https://gitlab.inria.fr/mmachado/pfoq-compiler. The two plp programs SEARCH and SQLOG displayed in Figure 4 are also provided in the repository. Here, we describe the salient points of the compilation and show that the circuit obtained indeed has polylogarithmic depth.
The compilation strategy takes inspiration from [12, 13] which in particular uses ancillas to factorize the circuits representing procedure calls in branches so as to prevent exponential blow-up of the circuit size. Their technique is called anchoring and merging as when a procedure call is first encountered, an ancilla is associated to this call (anchoring), and when a subsequent call to this procedure happens with an input of the same size, this second call is then merged with the first (merging). This way, instead of doubling the size of the circuit whenever recursive calls appear in separate branches of a qcase, as in programs SEARCH and SQLOG of Figure 4, the size grows linearly in the number of nested recursive calls, hence preventing the exponential blow-up in complexity from the use of the quantum control statement [24].
Figure 5 exemplifies this phenomenon on the SEARCH program: the circuit on the left represented by a grey and white box the circuit for the search procedure applied to . Since this procedure has two calls to itself, its natural compilation gives an in-depth duplication of the calls. The anchoring/merging process entails a single recursive compilation at the price of an overhead in terms of ancillary qubits and permutations.
4.1 Outline of the Compilation Algorithm
The compilation algorithm takes as input a program together with a list of the sizes of its inputs. As in the semantics, the algorithm maintains a function that maps qubit list variables to lists of pointers to their qubits. Since the values of this function only depend on the size of the qubit variable, the generation of the circuit does not need to take qubit values into account.
The main compilation algorithm works by induction on the structure of the program statement. Compiling statements such as is straightforward: use the semantics to compute the wire number and which quantum gate to put into the circuit. Compiling a sequence is naturally done by composing the circuits obtained from compiling each statement. For compiling an if statement, note that Booleans only depend on constants and the size of qubit lists, and hence can be computed from the knowledge of list .
A qcase statement is compiled using controlled operations: consider , the circuit compiled for should be controlled negatively on the wire computed for , the circuit compiled for should be controlled positively on the same wire. To keep track of those controls, a structure is maintained that lists the control qubits and their state. The compilation of a non-recursive call consists in compiling the statement of the procedure after substituting its arguments by their expressions provided the qubit lists are non empty.
The only case that introduces complexity is that of recursive calls. A naive compilation strategy for recursive calls with a recursive procedure calling itself in both branches of a qcase, which is allowed by the restriction, would yield a number of gates in the compiled circuit exponential in the recursion depth. To prevent this blow-up, the process (anchoring and merging) maintains a dictionary of ancillaries that associates an ancillary qubit to pairs of procedure names and sizes of the inputs: if the dictionary does not have a key for the considered procedure call, an anchoring ancillary is created, this ancillary is initialized through a multiple controlled-NOT (Toffoli gate) encoding the qcase control considered and used to control the quantum circuit of the procedure statement; if the key is present in the dictionary, this ancillary is updated with another Toffoli gate and the two procedure calls are automatically merged as illustrated in Figure 5. This strategy is sound as the restriction ensures that two repeated calls always occur in orthogonal branches and can be simply combined in the same ancillary qubit.
To show the polylogarithmic depth bound on circuits implementing plp programs, we first need to demonstrate that merging in the context of plp can be done in polylogarithmic depth. Second, we show that the and half restrictions imply that the number of nested recursive procedure calls is polylogarithmically bounded.
4.2 Compilation to a Circuit of Polylog Depth
In a plp program, a recursive procedure call always cuts one input qubit list in half. This means that the procedure will work either on the first half or on the second half of the qubit list. In the worst case, which is also the most typical, the procedure will be called recursively on each half depending on some condition. To avoid doubling the treatment of those calls, the anchoring and merging process merges those calls in such a way that the subcircuit for the procedure on half as many qubits is able to work on both halves. This implies conditionally swapping the two halves.
For instance, consider the SEARCH program in Figure 4 performing binary search. The procedure body of search, in the recursive case (i.e. where the input has size at least 4) consists of three (non-trivial) quantum cases. According to the state of the control qubits, we either (1) perform a recursive call to search on the second half of , (2) apply a gate to , or (3) perform a recursive call to search on the first half of . Compiling these three branches in sequence incurs a recursive doubling of instances of search, as shown on the left circuit of Figure 5 where the circuit corresponding to the search procedure is symbolized by a gray box and a white box. This doubling can be avoided by merging the two calls to search in the same circuit, using controlled-swap gates (also called Fredkin gates). This new circuit, given on the right of Figure 5, contains only a single call to search. Note that two ancillas are used: one for controlling whether the recursive search is executed, the other for controlling the swapping between the first and second half. This accounts for a constant added cost for each recursive call. In addition, the cost of the controlled permutation between the first and second halves of should be taken into account.
Lemma 11.
A controlled permutation on qubits can be performed by a quantum circuit of size and depth .
Proof.
Any permutation can be written as the composition of two sets of disjoint transpositions, and therefore any permutation can be performed in constant time, using two time steps [16]. To perform a controlled permutation, it suffices to create ancillas with the correct controlled state, which can be done in depth with gates.
Note that the ancillas used to control the permutation are linear in number but can be reused for nested recursive calls, hence the total number of ancillary qubits used for compiling a program on qubits will be linear in .
In the case of Figure 5, we are able to merge the two instances of search since they have the same input size and therefore encode precisely the same unitary operation, up to a renaming of qubits. In a general program, one needs to account for the total number of procedures that differ either in procedure name, input size and integer input. We prove that this number is polylogarithmically bounded.
Lemma 12.
A procedure call occurring in an plp program on input qubits results in calls to mutually recursive procedures with unique sizes.
In the above lemma, the number of input qubits is obtained by summing the sizes of (i.e., the number of qubits in) each operand of the procedure call. From those results, we obtain that the compilation process produces a quantum circuit of polynomial size and polylog depth in the size of the inputs.
Theorem 13 (Compilation).
Given a plp program , and input size , the quantum circuit produced by the compilation process is of size and depth .
Example 14.
To illustrate the compilation algorithm and the polylogarithmic depth bound, consider the SEARCH program from Figure 4. The compilation of this program with gives the quantum circuit depicted in Figure 6. Each recursive call yields a constant number of controlled gates and makes use of ancillary qubits: for anchoring and to swap the first and second half. Thus the circuit obtained has depth and a number of ancillary qubits.
4.3 Limits of Quantum Polylogarithmic Time
Theorem 13 shows that programs in plp can be compiled to quantum circuits of polylog depth and polynomial size, which means that they compute operators in qnc. In this section, we show that plp is however not complete for qnc, thus recovering the known separation between fbqpolylog and qnc.
qnc is defined in [16] as the union for all of the classes of quantum unitary transformations that can be computed by a family of quantum circuits of depth with a polynomial number of ancillas. To compare with fbqpolylog, we define fbqnc (for Bounded-error qnc) as in [7] as the class of functions that can be approximated with probability at least by a qnc transformation.
To study the relationship between plp and fbqnc, we use the query model of quantum computation which is the scenario in which one wishes to compute a function by making use of black boxes that are accessed via queries [2]. A black box performs a unitary transformation on the quantum state according to some oracle function , where the operation is usually defined as , which is considered to be performed in a single step.
Given a function , we denote by the function that maps to the least number of queries necessary for a quantum algorithm to approximate with bounded-error on inputs of size . The function gives a lower bound on the time complexity of approximating . For instance, for the OR, AND, and PARITY defined as
we have that, while Grover’s algorithm [11] allows for a quadratic speedup in the query complexity of AND and OR, no speedup exists for PARITY.
Lemma 15 ([25]).
For , we have that .
In contrast to the lower bounds on the query complexity for AND, OR, and PARITY, we can show that there is an upper bound on the query complexity of functions approximable by programs in plp. This bound on quantum random-access Turing machines can be obtained by viewing the read-input transition as an oracle query as in [20, 21] and noting that the access to this oracle is bounded by the step-count of the QRATM.
Lemma 17.
Let . There exists such that .
Lemma 17 gives a polylogarithmic upper bound on the query complexity of functions in . Lemmas 15 and 16 give lower bounds on the query complexity of AND, OR, and PARITY that are bigger than polylogarithms, hence proving that those functions are not in even though they can be approximated by circuits of polylogarithmic depth and polynomial size.
Lemma 18.
.
Combining this result with Theorem 13, we obtain a strict inclusion in fbqnc. Note that this strict inclusion is mandated by the well-known result that .
Theorem 19.
.
5 Conclusion and Future Work
We presented a quantum programming language plp that captures exactly fbqpolylog, that is functions approximated in polylog time by a QRATM. This characterization relies on some restrictions, in particular on the arguments of recursive calls to guarantee the complexity bound. We show a compilation procedure that produces quantum circuits of polylog depth, hence recovering the inclusion in the class of quantum circuits of polylog depth and polynomial size qnc.
Extending plp. The conditions imposed in the definition of plp are by no means hard to extend while safeguarding most or even all the results presented here. For instance, the half condition can be relaxed such that we consider halving of the input not at every procedure call but in every closed loop of procedure calls within a given rank. Such an extension would increase the expressive power of the language, thus allowing a programmer more flexibility. In this paper we chose to have a streamlined language with restrictions that are simple to check in order to obtain a more readable characterization.
Characterizing qnc. To our knowledge, there are currently no implicit characterizations of fbqnc. Extending plp to characterize this class would be particularly interesting. For example, adding a statement for recursively forking on each half of the quantum state would make it possible to capture AND, OR, and PARITY while still being sound for fbqnc.
References
- [1] Leonard M. Adleman, Jonathan DeMarrais, and Ming-Deh A. Huang. Quantum computability. SIAM Journal on Computing, 26(5):1524–1540, 1997. doi:10.1137/S0097539795293639.
- [2] Andris Ambainis. Understanding quantum algorithms via query complexity. In Proceedings of the International Congress of Mathematicians: Rio de Janeiro 2018, pages 3265–3285. World Scientific, 2018. doi:10.1142/9789813272880_0181.
- [3] Robert Beals, Harry Buhrman, Richard Cleve, Michele Mosca, and Ronald De Wolf. Quantum lower bounds by polynomials. Journal of the ACM (JACM), 48(4):778–797, 2001. doi:10.1145/502090.502097.
- [4] P. Oscar Boykin, Tal Mor, Matthew Pulver, Vwani Roychowdhury, and Farrokh Vatan. On universal and fault-tolerant quantum computing, 1999. doi:10.48550/arXiv.QUANT-PH/9906054.
- [5] Sergey Bravyi, David Gosset, and Robert König. Quantum advantage with shallow circuits. Science, 362(6412):308–311, 2018. doi:10.1126/science.aar3106.
- [6] Andrew M. Childs, Robin Kothari, Matt Kovacs-Deak, Aarthi Sundaram, and Daochen Wang. Quantum divide and conquer, 2022. doi:10.48550/arXiv.2210.06419.
- [7] Richard Cleve and John Watrous. Fast parallel circuits for the quantum Fourier transform. In Proceedings 41st Annual Symposium on Foundations of Computer Science, SFCS-00, pages 526–536. IEEE Comput. Soc, 2000. doi:10.1109/sfcs.2000.892140.
- [8] Ugo Dal Lago, Andrea Masini, and Margherita Zorzi. Quantum implicit computational complexity. Theoretical Computer Science, 411(2):377–409, 2010. doi:10.1016/j.tcs.2009.07.045.
- [9] Edward Farhi, Jeffrey Goldstone, Sam Gutmann, and Michael Sipser. Limit on the speed of quantum computation in determining parity. Physical Review Letters, 81(24):5442–5444, December 1998. doi:10.1103/physrevlett.81.5442.
- [10] Vittorio Giovannetti, Seth Lloyd, and Lorenzo Maccone. Quantum random access memory. Phys. Rev. Lett., 100:160501, April 2008. doi:10.1103/PhysRevLett.100.160501.
- [11] Lov K. Grover. A fast quantum mechanical algorithm for database search. In Proceedings of the Twenty-Eighth Annual ACM Symposium on Theory of Computing, STOC ’96, pages 212–219, New York, NY, USA, 1996. Association for Computing Machinery. doi:10.1145/237814.237866.
- [12] Emmanuel Hainry, Romain Péchoux, and Mário Silva. A programming language characterizing quantum polynomial time. In Foundations of Software Science and Computation Structures, pages 156–175. Springer, 2023. doi:10.1007/978-3-031-30829-1_8.
- [13] Emmanuel Hainry, Romain Péchoux, and Mário Silva. Branch sequentialization in quantum polytime. In Formal Structures for Computation and Deduction, FSCD 2025, volume 337 of LIPIcs, 2025.
- [14] W. Huang, C. H. Yang, K. W. Chan, T. Tanttu, B. Hensen, R. C. C. Leon, M. A. Fogarty, J. C. C. Hwang, F. E. Hudson, K. M. Itoh, A. Morello, A. Laucht, and A. S. Dzurak. Fidelity benchmarks for two-qubit gates in silicon. Nature, 569(7757):532–536, May 2019. doi:10.1038/s41586-019-1197-0.
- [15] Gushu Li, Yufei Ding, and Yuan Xie. Tackling the qubit mapping problem for NISQ-era quantum devices. In Proceedings of the Twenty-Fourth International Conference on Architectural Support for Programming Languages and Operating Systems, ASPLOS ’19, pages 1001–1014, New York, NY, USA, 2019. Association for Computing Machinery. doi:10.1145/3297858.3304023.
- [16] Cristopher Moore and Martin Nilsson. Parallel quantum computation and quantum codes. SIAM Journal on Computing, 31(3):799–815, 2001. doi:10.1137/S0097539799355053.
- [17] Yasuhiro Takahashi and Noboru Kunihiro. A fast quantum circuit for addition with few qubits. Quantum Information and Computation, 8(6):636–649, July 2008. doi:10.26421/QIC8.6-7-5.
- [18] Vlatko Vedral, Adriano Barenco, and Artur Ekert. Quantum networks for elementary arithmetic operations. Phys. Rev. A, 54:147–153, July 1996. doi:10.1103/PhysRevA.54.147.
- [19] Tomoyuki Yamakami. A schematic definition of quantum polynomial time computability. J. Symb. Log., 85(4):1546–1587, 2020. doi:10.1017/jsl.2020.45.
- [20] Tomoyuki Yamakami. Expressing power of elementary quantum recursion schemes for quantum logarithmic-time computability. In Logic, Language, Information, and Computation (WoLLIC 2022), pages 88–104. Springer, 2022. doi:10.1007/978-3-031-15298-6_6.
- [21] Tomoyuki Yamakami. Elementary quantum recursion schemes that capture quantum polylogarithmic-time computability of quantum functions. Mathematical Structures in Computer Science, 34(7):710–745, August 2024. doi:10.1017/s0960129524000264.
- [22] Tomoyuki Yamakami. Quantum first-order logics that capture logarithmic-time/space quantum computability. In Ludovic Levy Patey, Elaine Pimentel, Lorenzo Galeotti, and Florin Manea, editors, CiE 2024, pages 311–323. Springer, 2024. doi:10.1007/978-3-031-64309-5_25.
- [23] Andrew Chi-Chih Yao. Quantum circuit complexity. In Proceedings of 1993 IEEE 34th Annual Foundations of Computer Science, pages 352–361, 1993. doi:10.1109/SFCS.1993.366852.
- [24] Charles Yuan and Michael Carbin. Tower: Data structures in quantum superposition. Proceedings of the ACM on Programming Languages, 6(OOPSLA2):259–288, October 2022. doi:10.1145/3563297.
- [25] Christof Zalka. Grover’s quantum searching algorithm is optimal. Physical Review A, 60(4):2746, 1999. doi:10.1103/PhysRevA.60.2746.
