On a poset of quantum exact promise problems

Two of the most well-known quantum algorithms, those introduced by Deutsch–Jozsa and Bernstein–Vazirani, can solve promise problems with just one function query, showing an oracular separation with deterministic classical algorithms. In this work, we generalise those methods to study a family of quantum algorithms that can, with just one query, exactly solve promise problems stated over Boolean functions. We also show that these problems can be naturally ordered, inducing a partially ordered set of promise problems. We study the properties of such a poset, showing that the Deutsch–Jozsa and Bernstein–Vazirani problems are, in a certain sense, extremal problems in it, determining some of its automorphisms and proving that it is connected. We also prove that, for the problems in the poset, the corresponding classical query complexities can take any value between 1 and 2n-1+1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$2^{n-1}+1$$\end{document}.


Introduction
Since the dawn of quantum computing [7,9,14], special attention has been paid to promise problems defined over Boolean functions. In fact, Deutsch's algorithm [7], which is arguably the first quantum algorithm, its generalisation in Deutsch-Jozsa algorithm [8] and the famous Bernstein-Vazirani [1] algorithm are all of them methods of this kind. The interest of these algorithms lies in the fact that they can exactly solve promise problems with just one function query (through the use of a quantum oracle that can be queried in superposition), whereas classical deterministic algorithms require a number of queries that grows (even exponentially, as in the case of the Deutsch-Jozsa problem) with the size of the function input in order to complete the same task.
Although the importance of these problems and algorithms is mainly theoretical, they prepared the ground, together with related methods such as the one used to solve Simon's problem [18], for later quantum computing breakthroughs, including the celebrated Grover algorithm [11] and the famous Shor's methods for factoring and for finding discrete logarithms [17].
Studying these and other quantum algorithms under a common framework is also interesting because it can lead to the discovery of new algorithms and to a better understanding of their properties. For instance, both Shor's and Simon's algorithms are particular cases of quantum solutions to the Hidden Subgroup Problem [13] and it has also been shown (see [6]) that both Grover's algorithm and a number of quantum walks [16,19,20] can be seen as instances of a family of methods called quantum abstract detecting systems, something that can help achieve better detection rates in some practical problems [4,5].
In this work, we introduce an extension of the concept of promise problem over Boolean functions and study in which cases they can be solved in the quantum setting with just one query by using the same scheme as in Deutsch-Jozsa and Bernstein-Vazirani algorithms. We show that these problems naturally form a partially ordered set and we study some of its properties, such as its maximal and minimal elements. We also prove that in the deterministic classical case, these problems may require any number of queries from 1 to 2 n−1 + 1.
The rest of the paper is organised as follows. In Sect. 2, we define the type of promise problems that we will be studying in this work and show that the problems solved by Deutsch-Jozsa and Bernstein-Vazirani algorithms are particular cases of them. We also prove some useful results about these problems. In Sect. 3, we show that, by defining a natural binary relationship, the set of these problems can be partially ordered and we study some of the properties of the resulting poset, including its minimal and maximal elements, some of its automorphisms and showing that it is connected. Section 4 states and proves one of the main theorems of this work: That the range of complexities of deterministic classical algorithms for solving the promise problems considered in this paper is as diverse as possible. After that, in Sect. 5, we present numerical results of the execution on actual quantum computers of some the problems introduced in this paper. Finally, in Sect. 6, we raise some conclusions and present some ideas for future research.

Quantum exact promise problems
The problems that are solved with the Deutsch-Jozsa and Bernstein-Vazirani algorithms are promise problems defined over Boolean functions. In the first of these algorithms, we are given a Boolean function f which is either constant or balanced (that is, f takes value 0 on exactly half of inputs and value 1 on the other half) and we need to determine which of the two cases we are in; in the second, we are given a linear Boolean function f and we are asked to find the Boolean string s such that f (x) = x · s mod 2.
In this paper, we study a generalisation of this kind of problems that is given in the following definition.
Definition 1 A promise problem over Boolean functions of n variables is given by a collection of m ≥ 2 non-empty and pairwise disjoint subsets of functions f : The problem we are asked to solve is, given (a black box for computing) When the size n is clear from the context, we will call {F i } m i=1 simply a promise problem.
Notice that, for a fixed n, both Deutsch-Jozsa and Bernstein-Vazirani solve problems as those considered in Definition 1. In the case of Deutsch-Jozsa, we have m = 2, F 1 = { f : f ∈ 2 {0,1} n and f is constant} and F 2 = { f : f ∈ 2 {0,1} n and f is balanced}. In the case of Bernstein-Vazirani, m = 2 n and F i = { f s i }, where f s i (x) = x · s i mod 2 and s i is the string of length n that gives the binary expansion of i.
Of the possible promise problems over Boolean functions, we are especially interested in those that can be solved exactly with quantum algorithms that have access to a quantum oracle implementing the Boolean function f whose set F i we need to determine. This is formalised in the following definition.
, a promise problem over Boolean functions of n variables and a quantum algorithm A that has access to an oracle O f for a Boolean function f of n variables and gives a string r ∈ {0, 1} n as output. We say that A is exact for P if there exists a partition That is, if O f is a quantum oracle for a function f in F i , then A will always return a string from B i .
in Definition 2 is not necessarily unique. For instance, there may exist strings which are never output by the algorithm, so they can belong to any of the B i 's with no effect on its exactness.
If we have a quantum algorithm A that is exact for a promise problem P, then we can, obviously, solve P by using A once. Given f , we just need to run A with oracle O f and determine which B i the output belongs to. This is the case of the Deutsch-Jozsa and Bernstein-Vazirani algorithms, which use the circuit given in Fig. 1 to solve their promise problems. In the case of Deutsch-Jozsa, the partition is given by B 1 = {0 n } and B 2 = {0, 1} n \{0 n }. If the algorithm returns 0 n , we know that f is constant; otherwise, the function is balanced. For the Bernstein-Vazirani algorithm, the partition is clearly {B i } 2 n −1 i=0 with B i = {s i } (and, s i , as above, the binary expansion of i). In fact, both algorithms use just one query to the oracle O f , which leads us to our main definition. Definition 3 A promise problem P over Boolean functions of n variables is said to be 1-quantum exact (or, simply, 1-qe) if the algorithm that uses one query to oracle following the circuit of Fig. 1 is exact for P.
It is a well-known fact that the ancillary lowermost qubit in the circuit of Fig. 1 is only used to facilitate a phase kickback when the Boolean function f implemented by the oracle returns 1. Thus, such an ancillary qubit can be removed if we replace the usual Boolean oracle with a phase oracle (see, for instance, [10]). That is, instead |x (which is clearly unitary). Then, the circuit with phase oracle is the one depicted in Fig. 2.
We will consider all our oracles to be phase oracles from now on, something that will greatly simplify our definitions and proofs. We redefine, accordingly, 1-qe algorithms in terms of the quantum circuit of Fig. 2. We will also identify Boolean functions with their phase oracles so, for instance, the constant function f = 0 will be identified with the identity I and the constant function f = 1 will be identified with −I .
Our goal in the rest of this section is to prove some necessary and sufficient conditions that promise problems need to verify in order to be 1-qe. We start by fixing some notation and by stating and proving a useful lemma about the representation of phase oracles.

Definition 4
For a fixed non-negative integer n,s we denote by Z i , with 1 ≤ i ≤ n, the tensor product of matrices The following, very useful lemma follows from the results in [3]. For the sake of completeness, we provide here a different, self-contained proof.

Lemma 1 If O f is the phase oracle of a Boolean function f of n variables, then
We also know (see [15], for instance) that any 2 n × 2 n matrix can be written as a linear combination of tensor products of n Pauli matrices. Thus, O f = b P P where the matrices P are tensor products of Paulis. If Q is also a tensor product of Paulis, we have because the product of two different tensor products of Paulis is traceless and the square of a tensor product of Paulis is the identity. Now, suppose P contains at least one X or one Y . Then Thus, it holds that if b P = 0 then P is of the form Z t for some binary string t.
Now, we prove a couple of lemmas that relate the expression for phase oracles that we have found in Lemma 1 with the probabilities of measuring certain outcomes with the circuit of Fig. 2. Fig. 2, then the probability of measuring s is

then the probability of measuring s is 1 if s = t and 0 otherwise.
Proof The probability of measuring s is given by and, consequently, it holds that The result now follows from the expression of a t given in Lemma 1 and the fact that both Z s and O f are real operators.
Lemma 3 Consider f a Boolean function of n variables and define S = {s ∈ {0, 1} n : f (s) = 1}. For a fixed binary string t = 0, define also T 0 = {s ∈ S : s · t = 0} and To prove the first equivalence, we just need to notice that O f = I −2 s∈S |s s| and thus As a consequence of these lemmas, we have the following necessary condition for a Boolean function to be part of a 1-qe promise problem. The condition in Proposition 1 is not sufficient for a function to be part of a 1-qe problem, as the next example shows.

Example 1
The Boolean function f on 4 variables that takes value 1 on 0110, 0111, 1001, 1011, 1101, 1110 and 0 on the rest of strings is not part of any 1-qe problem. Indeed, it can be readily seen that T r(Z t O f ) = 0 for every string t ∈ {0, 1} 4 .
However, we can give some sufficient conditions for Boolean functions to be included in 1-qe problems. We state and prove them in the following proposition. Observe that because of Proposition 2, Example 1 is minimal in the number of variables and size of S.
To close this section, we give a characterisation of 1-qe promise problems. To do that, we first need to define a notion that will also prove useful in the rest of this paper.
shows that this partition makes the problem 1-qe.
, 1} n such that when we take f ∈ F i and we use the circuit of Fig. 2 with O f we always obtain a string from B i . Lemma 2 then implies that T (F i ) ⊆ B i and the result follows because the sets B i are pairwise disjoint.

A poset of quantum exact promise problems
In this section, we define a natural order relationship among promise problems and we show that Deutsch-Jozsa and Bernstein-Varizirani are maximal and minimal elements in the poset of 1-qe problems for a fixed number of variables. Then, we study some of the automorphisms of the poset. We also introduce some notions that allow us to prove that it is connected.
We begin by defining the order relationship.
and {G j } m 2 j=1 be promise problems on n variables. We say Obviously, ≤ is reflexive and transitive. It is also antisymmetric, for suppose {F i } ≤ {G j } and {G j } ≤ {F i }. Then, for every F k we know that there exists G l such that F k ⊆ G l . Also, there exists F i such that G l ⊆ F i , which implies F k ⊆ F i . But all the sets in {F i } are pairwise disjoint, so this implies F k = F i and, hence, F k = G l . Therefore, {F i } = {G j }.
As an example of this order relationship, notice, for instance, that for fixed n, Bernstein-Vazirani ≤ Deutsch-Jozsa, because all nonzero linear functions are balanced. Now, we define some additional notions that will help us proving properties of the poset of 1-qe problems.

Definition 7 Consider a 1-qe problem
We say that the problem is complete if The intuitive meaning of this definition is that if a problem is complete, then you cannot extend it, to form another 1-qe problem, by including a new Boolean function in any of its sets (for it already includes all the Boolean functions that can be exactly distinguished with those outputs). A related notion is given in the following definition.

Definition 8 Consider a promise problem {F
on n variables. We say that it is exhaustive if for every s ∈ {0, 1} n there exists i such that s ∈ T (F i ).
Notice that a complete problem is also exhaustive. In fact, suppose that In the following, we are interested in studying the structure of the poset of 1qe problems for a fixed number of variables n. We will focus first on its minimal and maximal elements, because it is clear that in general, there are no minimum or maximum elements. For instance, it is easy to see that {{I }, {Z 1 }} and {{−I }, {Z 1 }} are incomparable and there cannot be any element that is strictly smaller than any of them. For n = 1, the poset (see Fig. 3 for its structure) possesses a maximum element, which is Deutsch-Jozsa because it contains all possible Boolean functions and they cannot be partitioned in a different way because T (I ) = T (−I ) = {0} and T (Z 1 ) = T (−Z 1 ) = {1}. However, for n > 1 there is no maximal element. To see it, we first prove the following proposition.

Proposition 3 For n ≥ 1, Deutsch-Jozsa is a maximal element of the poset of 1-qe problems (and also a maximum element if n = 1).
Proof It follows easily from noticing that Deutsch-Jozsa only has two elements and it is complete.
The number of maximal elements can be determined with the following proposition.
Proof Clearly, any maximal problem must have exactly two sets of functions. (Otherwise, we can obtain join two of the sets to obtain a new problem which is above the original one.) For any ∅ B {0, 1} n , we can consider It is easy to see that {F 1 , F 2 } is maximal and that any maximal problem must be of this form. There are 2 2 n − 2 choices for B. However, choosing B and {0, 1} n \B leads to the same problem. Thus, the total number of possibilities is 2 2 n −1 − 1.
Notice, also, that every maximal element is necessarily complete and thus exhaustive. Now, we turn our attention to minimal elements. It is easy to see that if f 1 and f 2 are Boolean functions such that T ( f 1 ) ∩ T ( f 2 ) = ∅ then {{ f 1 }, { f 2 }} is minimal in the poset of 1-qe problems. A situation a little bit more interesting appears when we restrict ourselves to exhaustive problems. This is addressed in the next proposition.

Proposition 5 There are at least 2 2 n minimal elements in the poset of 1-qe exhaustive problems on n variables and Bernstein-Vazirani is one of them.
Proof For s ∈ {0, 1} n , we define F s as either {Z s } or {−Z s }. It is clear that, then, {F s } is exhaustive and that there is no other exhaustive problem G such that G < {F s }. The number of such problems is exactly 2 2 n and when choose F s = {Z s } for all s we obtain the Bernstein-Vazirani problem.
We now consider two natural transformations of 1-qe problems that, in fact, induce automorphisms of the poset (that is, bijective transformations that preserve the order of the elements). We start with the simplest one, which simply takes each function f in a problem to its complement (i.e. the function that is 0 when f is 1 and 1 when f is 0).

Theorem 2 Consider the transformation I that takes
given by

Then, I is an automorphism of the poset of 1-qe problems and Deutsch-Jozsa is one of its fixed points.
Proof Notice that if the oracle associated with f is O f , then the oracle associated with f ⊕ 1 is −O f . As a consequence, {F i } m i=1 is a 1-qe problem and if F ≤ G, then I(F) ≤ I(G). Also, I is bijective because it is its own inverse, so it is an automorphism. Finally, it is clear that I takes Deutsch-Jozsa to itself, because the complement of a balanced function is balanced and the complement of the constantly 0 function is the constantly 1 function.
The other transformation of 1-qe problems depends on the choice of a string s ∈ {0, 1} n and it is given in the following theorem.

Theorem 3 Given s ∈ {0, 1} n , consider the transformation L s that takes
where l s is the linear form l s (x) = x · s mod 2. Then, L s is an automorphism of the poset of 1-qe problems and Bernstein-Vazirani is one of its fixed points.
Proof The proof is similar to the one of the previous theorem. We only need to note that if the oracle associated with f is O f , then the oracle associated with f ⊕ l s is O f Z s . From this, it follows easily that {F i } m i=1 is 1-qe and that L s preserves the order. Moreover, L s is its own inverse and, hence, an automorphism. Since the xor of linear Boolean functions is, again, a Boolean linear function, it also follows that L s fixes the Bernstein-Vazirani problem.
It is interesting to note that if we apply L s to the Deutsch-Jozsa problem, then we recover the generalised Deutsch-Jozsa problems introduced in Section 4 of [3].
Another property of these automorphisms is that they preserve the properties of being exhaustive and complete.
To complete this section, we are now going to prove that the poset of 1-qe problems is connected.

Theorem 4 For each fixed n, the poset of 1-qe problems on n variables is connected.
Proof It is enough to prove that, given F = {F i } m i=1 , it is connected to Bernstein-Vazirani. Define G by for i = 1, . . . , m − 1 and Clearly, F ≤ G and G is complete and, thus, exhaustive. Then, in particular, every Z i is in some set of G and, thus, Bernstein-Vazirani is below G and, consequently, connected to F.

Complexity with classical deterministic algorithms
This section shows that the classical query complexity of the 1-qe problems we have been studying can have a wide range of values. In fact, in the two theorems of this section we give constructions to obtain 1-qe problems with particular classical query complexities.
Theorem 5 Fix n ≥ 1 and consider k such that 1 ≤ k ≤ 2 n−1 + 1. Then, there exists a 1-qe problem that, with a deterministic classical algorithm, requires exactly k queries to be solved.
Proof Consider A a set of exactly k binary strings of length n. Consider, also, B the set of Boolean functions f such that f is balanced and there exists s ∈ A such that f (s) = 1.
Clearly, {{I }, B} is a 1-qe problem, because if f ∈ B, then f is balanced and thus the probability of obtaining 0 when using the circuit of Fig. 2 is 0, while for I that probability is 1.
Obviously, the problem can be solved with k classical queries because, given f , it is enough to check f (s) for every s ∈ A. If f (s) = 1 for some s, then f ∈ B. Otherwise, f = I (remember that we are using phase oracles and, hence, I is the Boolean function that is identically 0). However, k − 1 classical queries are not sufficient to solve the problem. In fact, for any set C of k − 1 strings there exists f ∈ B such that f (s) = 0 for every s ∈ C. To see this, notice that k − 1 ≤ 2 n−1 and then we can define f such that In order to prove this, we need to consider two possible cases. If A ∩ C = ∅ then necessarily k − 1 ≤ 2 n−1 − 1, because if we had k−1 = 2 n−1 then we would have |C| = 2 n−1 and |A| = 2 n−1 + 1 and then these two sets would not be disjoint. Then, f is 0 on k − 1 strings, 1 on k strings and since k + (k − 1) = 2k − 1 ≤ 2 n − 1 we have enough "unset" strings to make f balanced.
On the other hand, if A∩C = ∅ then |C| = k−1 ≤ 2 n−1 and |A\C| ≤ k−1 ≤ 2 n−1 so, again, we have enough free strings to make f balanced.
The construction used in the proof of the previous theorem can be extended to obtain uniform families of 1-qe problems with given classical query complexities, as the following corollary shows. Corollary 1 If g : N → N is a computable function such that 1 ≤ g(n) ≤ 2 n−1 + 1 for each n, then there exists a uniform family of 1-qe problems F n such that the classical query complexity of F n is exactly g(n).
Proof We can simply use the construction in the proof of Theorem 5 with A = A n = {The first g(n) strings in {0, 1} n } to construct F n . Then, the classical query complexity of F n is exactly g(n).

Experiments on quantum hardware
In this section, we present some experiments that we have conducted on actual quantum computers with the type of problems that we have introduced in this paper. Although, as we have shown, 1-qe problems can be solved exactly with just one quantum query, this presupposes the existence of fault-tolerant quantum computers, while the devices that are available today are still subject to noise and gate and readout errors.
To test the possibility of solving 1-qe problems on current quantum computers, we have designed phase oracles for the four Boolean functions involved in the 1-qe problems of Fig. 3 and implemented them on one of the quantum devices accessible through IBM Quantum [12]. Namely, we have used ibmq_armonk, an IBM Quantum Canary Processor of one qubit. The implementations of these phase oracles were then integrated in the circuit of Fig. 2 to obtain the circuits shown in Fig. 4. We have included barriers on both sides of the oracle to prevent cancellation or simplifications of the Hadamard gates with the gates of the oracle (which must be treated as a black box). This leads to the transpiled circuits shown in Fig. 5, which are the ones actually executed on the quantum computer.
Notice that the IBM Quantum transpiler detects the presence of a physically irrelevant global phase in the circuits for −I and −Z and generates exactly the same transpiled circuits for I and −I and for Z and −Z . For this reason, we only need to actually run the circuits of Fig. 5a, b. We executed these two circuits on both the simulator and on the ibmq_armonk quantum processor, where we run each circuit 75 times with 8192 shots (or samples) each time. These are the maximum numbers allowed at IBM Quantum. The simulator always obtained the correct results, as expected from  Table 1. The average probability of success for solving any of the 1-qe problems of Fig. 3 would, then, be the average of the probability of measuring 0 with either I or −I and of the probability of measuring 1 with either Z or −Z , giving a final result of 0.91995. This is strictly less than the probability 1 predicted by our mathematical results (and obtained with the simulator) and can be explained by the gate and readout errors and the noise present in actual quantum hardware. Moreover, the values obtained here are consistent with the ones reported in [2] for similarly simple circuits executed on the same quantum processor. In fact, in that work, it was also observed that a readout error of obtaining 0 when the correct value was 1 is usually higher than a readout error of obtaining 1 when 0 is the correct value.

Conclusions and future work
In this paper, we have introduced a generalisation of promise problems such as Deutsch-Jozsa or Bernstein-Vazirani and we have shown that all of them can be solved with just one oracle query in the quantum circuit model. We have also studied necessary and sufficient conditions for Boolean functions on n variables to be part of such promise problems.
Then, we have defined a natural order relationship among these problems and we have proved that the Deutsch-Jozsa and Bernstein-Vazirani problems are, under some conditions, maximal and minimal elements in the poset of these promise problems. We have also studied some of the automorphisms of the poset and shown that it is always connected.
Finally, we have proved that, although in the quantum setting one oracle query is enough to solve these promise problems, if we only use classical resources then the query complexity can vary from 1 to 2 n−1 + 1, taking all the values in between, and we have also presented numerical results of the execution of some 1-qe problems on actual quantum hardware.
There are some open questions that we would like to explore in future works. An interesting problem is to give a more explicit characterisation of the Boolean functions that can take part in 1-qe problems. Also, we are interested in determining all the automorphisms of the poset of such problems. Finally, we would like to extend the study done in this paper to other quantum schemes (with different quantum circuits) that also allow to solve some promise problems with a small number of oracle queries.