Inverting a permutation is as hard as unordered search

We show how an algorithm for the problem of inverting a permutation may be used to design one for the problem of unordered search (with a unique solution). Since there is a straightforward reduction in the reverse direction, the problems are essentially equivalent. The reduction we present helps us bypass the hybrid argument due to Bennett, Bernstein, Brassard, and Vazirani (1997) and the quantum adversary method due to Ambainis (2002) that were earlier used to derive lower bounds on the quantum query complexity of the problem of inverting permutations. It directly implies that the quantum query complexity of the problem is asymptotically the same as that for unordered search, namely in Theta(sqrt(n)).


Introduction
Let n be a positive integer. The problem Permutation n of inverting a permutation π on the set [n] = {1, 2, . . . , n} is defined as follows. Given π in the form of an oracle, and n as input, output "yes" if the pre-image π −1 (1) is even and "no" if it is odd. This is a natural decision version of the problem that asks us to find π −1 (1). A related problem is that of unordered search: Given a function f : [n] → {0, 1} as an oracle, and n as input, output "yes" if f −1 (1) is non-empty and "no" otherwise. In other words, determine if f maps any element i ∈ [n] to 1. In this article, we restrict ourselves to functions f which map at most one element to 1. As we might expect, these constitute the hardest instances of unordered search. We refer to the corresponding sub-problem as Unique Search n .
The two problems were originally used by Bennett, Brassard, Bernstein, and Vazirani [2] to show limitations of quantum computers. The search problem Unique Search was used to show that relative to a random boolean oracle A, with probability 1, NP A ⊆ BQP A . The inversion problem Permutation was similarly used to show that relative to a random permutation oracle A, with probability 1, NP A ∩co-NP A ⊆ BQP A . For the first result, Bennett et al. showed that any quantum algorithm for Unique Search n requires Ω( √ n ) queries for a constant probability of error. This involved a hybrid argument that works for both worst-case error and distributional error under an equal mixture of uniform distributions over "yes" and "no" instances. The lower bound is matched by the Grover quantum search algorithm [3], and is therefore optimal. For the second result, Bennett et al. used a nested hybrid argument and showed that any quantum algorithm for the inversion problem requires Ω( 3 √ n ) queries (for constant probability of error under the uniform distribution). The optimal bound of Ω( √ n ) was established for worst-case query complexity by Ambainis [1] using the then-newly-minted quantum adversary method.
An algorithm for unordered search (in fact, for Unique Search n ) may be used to solve the inversion problem Permutation n in the obvious manner, using at most twice the number of oracle queries. Namely, we define a boolean function f on [n] such that f (i) = 1 iff π(i) = 1 and i is even. This function may be evaluated with one classical query to an oracle for π. An additional query is used in the quantum case to "erase" the answer to the first query (see the discussion regarding quantum queries at the end of the proof of Theorem 2.1 in Section 2). Therefore the Grover quantum search algorithm [3] solves this problem with O( √ n ) queries to an oracle for π. We describe a reduction in the reverse direction, i.e., we show how any algorithm that solves Permutation n may be modified to solve Unique Search n/2 when n is even. The intuition behind the reduction comes from a hybrid argument in which we consider runs of the algorithm on oracles not in its domain. This kind of device has been used in numerous works on quantum query complexity to great effect.
The reduction we present is randomized and is between distributional versions of the problems, with equal weight on "yes" and "no" instances, and with uniform conditional distributions for each kind of instance. Due to the inherent symmetry in the two problems under consideration, the distributional and worst-case versions of the problems are, in fact, equivalent in query complexity (for the distributions described above; see Lemma 2.2 and the discussion following it). Thus, we are also able to derive an algorithm for Unique Search n/2 with a bound on its worst-case error.
Let µ n denote the distribution obtained by taking an equal mixture of the sole "no" instance and the uniform distribution over "yes" instances of Unique Search n . Theorem 1.1. Let n be an even positive integer. Let A be an algorithm (classical or quantum) that solves Permutation n with distributional error at most ε < 1/2 on the uniform distribution over permutations on [n], with q queries to the permutation oracle. Then there is an algorithm of the same kind as A (classical or quantum) with distributional error at most (1 + 2ε)/4 with respect to the distribution µ n/2 , that solves Unique Search n/2 with at most q queries to the search oracle in the classical case, and at most 2q queries in the quantum case. Moreover, this may be modified to an algorithm for Unique Search n/2 with worst-case error at most 1 3−2ε < 1/2 and with the same query complexity. We emphasize that the reduction uses only the knowledge of a bound ε on the distributional error of A, and not its precise value. An algorithm for Permutation n for n > 2 with distributional error at most ε on the uniform distribution may be used to solve Permutation n−1 with the same query complexity and distributional error at most ε + 1/2n on the uniform distribution (see the discussion after Lemma 2.2). So a reduction similar to the one in the theorem above exists for odd n as well.
Any quantum algorithm for Unique Search n/2 with constant probability of error < 1/2 with respect to µ n/2 requires Ω( √ n ) queries [2]. Theorem 1.1 therefore implies a similar lower bound for quantum algorithms for Permutation n , and an Ω(n) query lower bound for classical algorithms for the problem. (The lower bound of Ω(n) for Permutation n in the classical case is straightforward to prove directly.) Corollary 1.2. Any quantum algorithm that solves Permutation n (for any integer n > 1) with constant distributional error ε < 1/2 on the uniform distribution over permutations on [n] requires Ω( √ n ) queries.
Consequently, the same query lower bound holds for algorithms for Permutation n with worst-case error at most ε.
Naturally, Theorem 1.1 and Corollary 1.2 both also hold for any quantum algorithm for the search version of Permutation n with the same kind of error bound as in the statements above.
The reduction we present bypasses the hybrid argument due to Bennett, Bernstein, Brassard, and Vazirani [2] and the quantum adversary method due to Ambainis [1], and shows a direct connection between inversion and search. The hybrid argument underlying the reduction was discovered in 2004 and communicated informally to a few people. The reduction is written up here for wider dissemination.

The reduction
We start by fixing some notation and making preliminary observations. Then we sketch a hybrid argument which paves the way for the reduction (Theorem 2.1). Lemma 2.2 derives a worst-case algorithm for Unique Search n from an average-case algorithm, and together with Theorem 2.1 implies Theorem 1.1. We finish by sketching how Theorem 1.1 extends to odd n.
We also consider oracles that compute functions h : [n] → [n] with a unique collision at 1, with one odd and one even number in the colliding pair. In other words, these functions h are such that there are precisely two distinct elements i, j with the same image under h. Moreover, h(i) = h(j) = 1, and precisely one of i, j is odd (and the other is even). Let Q denote the set of all such functions. Consider any fixed permutation π on [n]. Consider also the functions in Q that differ from π in exactly one point. These are functions h with a unique collision such that the collision is at 1, and π −1 (1) ∩ h −1 (1) = 1. If π ∈ P 0 , then the even element that is also mapped to 1 by h is precisely the one on which π and h differ. Similarly, if π ∈ P 1 , then the odd element that is also mapped to 1 by h is precisely the one on which π and h differ. Let Q π denote the set of such functions h. If we pick a uniformly random permutation π ∈ P 0 , and then pick a uniformly random function h in Q π , then h is uniformly random in Q. The same holds if we switch P 0 with P 1 .
Given a permutation π on [n] with n even, and a function f : [n/2] → {0, 1}, we define a function h π,f : [n] → [n] as follows. If π ∈ P 0 , for any i ∈ [n], h π,f (i) = 1 if i is even and f (i/2) = 1 π(i) if (i is odd) or (i is even and f (i/2) = 0). (1) If π ∈ P 1 , for any i ∈ [n], h π,f (i) = 1 if (i is odd) and f ((i + 1)/2) = 1 π(i) if (i is even) or (i is odd and f ((i + 1)/2) = 0). ( The function h π,f coincides with π if f −1 (1) is empty and belongs to Q π otherwise. We make use of the above properties of P 0 , P 1 , Q, Q π and h π,f in our reduction. The essential idea behind our reduction is that any algorithm that distinguishes a uniformly random permutation in P 0 from a uniformly random one in P 1 necessarily distinguishes a random permutation from P i from a uniformly random unique-collision function in Q, for at least one i ∈ {0, 1}. Suppose that i = 0. Using convexity, we may further deduce that such an algorithm also distinguishes the permutation π ∈ P 0 from a uniformly random unique-collision function h ∈ Q π , for at least one π. Since any function h ∈ Q π differs from π in exactly one of n/2 points when n is even, this final problem is equivalent to the problem of unique unordered search over a domain of size n/2. The above hybrid argument suffices to prove a query lower bound for Permutation n , but is not entirely satisfactory because it corresponds to a non-uniform reduction. (A priori, we do not know which i ∈ {0, 1} and which π ∈ P i would give us a correct algorithm for Unique Search n/2 .) We may however glean a reduction in the uniform sense from this argument. The idea is to replace the choices made on the basis of existential arguments by randomized ones. We therefore try distinguishing a uniformly random π ∈ P 0 from a uniformly random h π,f ∈ Q π , and similarly with a uniformly random permutation from P 1 , with equal probability. At least one of these probabilistic attempts succeeds, and gives us a bounded-error algorithm.
Recall that µ n is the distribution which assigns probability 1/2 to the constant function 0, and probability 1/2n to each of the "yes" instances of Unique Search n . Let µ 1 n be the uniform distribution on "yes" instances alone, and let µ 0 n be the analogue for the lone "no" instance.
Theorem 2.1. Let n be an even positive integer. Let A be an algorithm (classical or quantum) that solves Permutation n with distributional error at most ε < 1/2 on the uniform distribution over permutations on [n], with q queries to the permutation oracle. Then there is an algorithm of the same kind as A with distributional error at most 1+2ε 4 < 1/2 with respect to µ n/2 that solves Unique Search n/2 with at most q queries to the search oracle in the classical case, and at most 2q queries in the quantum case. Moreover, its error probability on an input drawn from µ 0 n/2 is at most ε and that for µ 1 n/2 is 1/2.
Proof. Suppose we are given an algorithm A as in the statement of the theorem that takes as input an even integer n ≥ 1, and an oracle g : [n] → [n]. Let f be an input oracle for Unique Search n/2 . Recall the definition of the function h π,f : [n] → [n], where π is a permutation on [n], as in Eqs. (1,2). The following reduction B solves Unique Search n/2 with distributional error as claimed: With probability 1 2 , pick a uniformly random permutation π ∈ P 0 , output A(n, h π,f ) and stop. With probability 1 2 , pick a uniformly random permutation π ∈ P 1 , output ¬A(n, h π,f ) and stop. We may calculate the probability of error of the algorithm B by considering "yes" and "no" instances separately. The output of B on the lone "no" instance of Unique Search n/2 is A(n, π) with probability 1 2 , for a uniformly random π ∈ P 0 , and ¬A(n, π) with probability 1 2 , for a uniformly random π ∈ P 1 . Let ε 0 be the probability of error of A on a uniformly random oracle from P 0 , and let ε 1 be the corresponding quantity for P 1 . We have ε 0 + ε 1 ≤ 2ε. The probability of error of B on the "no" instance is thus bounded by (ε 0 + ε 1 )/2 ≤ ε.
The output of B on a uniformly random "yes" instance of Unique Search n/2 is A(n, h) with probability 1 2 , for a uniformly random h ∈ Q, and ¬A(n, h) with probability 1 2 , for a uniformly random h ∈ Q. If p denotes the probability that the output A(n, h) is "no" for a uniformly random h ∈ Q, the probability of error of B on a uniformly random "yes" instance of Unique Search n/2 is p/2 + (1 − p)/2 = 1/2.
Since π is known explicitly in the algorithm B, the function h π,f can be evaluated with at most one query to f in the classical case. In the quantum case, the situation is not as straightforward. Data in quantum memory generated during computations may prevent the quantum interference necessary for correct working of an algorithm. This may be the case with the answers to oracle queries to f that are used to compute h π,f . It is therefore important to simulate queries to h π,f cleanly, i.e., without modifying any part of the workspace except the answer register. With a standard implementation of the oracle to f as a unitary operator, a query to h π,f can be simulated cleanly by using two queries (see [2,Section 4] or [4, Section 1.5]). We note that by working with a different implementation of the oracle for f , it is possible to simulate a query to h π,f cleanly with only one query. As this leads to only a minor improvement in our reduction, we omit the details.
Any algorithm with worst-case error ε implies an algorithm with distributional error ε with respect to any distribution. We point out that Unique Search and Permutation both admit random self-reductions, so the average-case algorithm described in Theorem 2.1 implies the worst-case algorithm claimed in Theorem 1.1.
Lemma 2.2. Suppose B is an algorithm for Unique Search n with distributional error at most ε 1 on distribution µ 1 n , and at most ε 0 on µ 0 n such that ε 0 +ε 1 < 1. Then, there is an algorithm for Unique Search n that makes the same number of queries as B, and has worst-case error at most Proof. Composing a function f : [n] → {0, 1} with a permutation σ on [n] preserves the "yes" and the "no" instances of Unique Search n . Consider the algorithm B sym : Pick a uniformly random permutation σ on [n], and then return the value given by the algorithm B with every oracle query i ∈ [n] replaced by a query to σ(i).
Effectively, any single instance of Unique Search n is mapped to a uniformly random instance with the same answer. So the worst-case error on the "no" instance is at most ε 0 , and on any "yes" instance is at most ε 1 . It only remains to equalize the bounds on error on the two kinds of instance, and this may be accomplished by a standard modification: depending on whether ε 0 < ε 1 or not, we accept or reject with some probability p, and run the algorithm B sym with probability 1 − p. The choice of p = |ε 1 − ε 0 | /(1 + |ε 1 − ε 0 |) gives us the claimed error bound. There is a similar randomized self-reduction for Permutation n . Let ω, σ be uniformly random permutations on [n] such that ω maps 1 to itself, and σ permutes odd integers among themselves and even integers among themselves. Then for any permutation π on [n], the composition ω • π • σ is uniformly distributed in P 1 if π is a "yes" instance, and in P 0 if it is a "no" instance. Therefore, an algorithm A for Permutation n with distributional error at most ε 1 , ε 0 on uniformly random "yes" and "no" instances, respectively, leads to a worst-case algorithm which makes error at most ε 1 on any "yes" instance and at most ε 0 on any "no" instance. When n is even, the distributional error of A on the uniform distribution is at most ε = (ε 0 + ε 1 )/2 and when n is odd, it is at most ε = ((1 + 1/n)ε 0 + (1 − 1/n)ε 1 )/2. We may now rebalance the bound on error in the two kinds of instance to obtain a worst-case algorithm. The self-reduction also allows us to use an algorithm A for Permutation n to solve Permutation n−1 as claimed in Section 1. We first symmetrize the algorithm A through the self-reduction, and then run it on the extension of the input permutation π on [n − 1] obtained by defining π(n) = n.