How much does a quantum oracle to find a needle in a haystack really cost? - MathOverflow most recent 30 from http://mathoverflow.net 2013-05-18T22:21:59Z http://mathoverflow.net/feeds/question/102779 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://mathoverflow.net/questions/102779/how-much-does-a-quantum-oracle-to-find-a-needle-in-a-haystack-really-cost How much does a quantum oracle to find a needle in a haystack really cost? Mirco Mannucci 2012-07-20T22:53:53Z 2012-08-09T15:44:39Z <p>Among the basic algorithms of quantum computations Lov Grover's <a href="http://en.wikipedia.org/wiki/Grover%27s_algorithm" rel="nofollow">result</a> on quantum search stands out, both in regards to its intrinsic interest, and for its undisputable elegance. </p> <p>Grover's algorithm enables one to search an unsorted database of N elements in $O(N^{1/2})$ time, which is pretty remarkable.</p> <p>However, I do have one perplexity, which perhaps someone here can dissipate. </p> <p>The starting point of Grover is this one (from the wiki entry):</p> <p>Consider an unsorted database with N entries. The algorithm requires an N-dimensional state space H, which can be supplied by n=log2 N qubits. Consider the problem of determining the index of the database entry which satisfies some search criterion.</p> <blockquote> <p>Let f be the function which maps database entries to 0 or 1, where f(ω)=1 if and only if ω satisfies the search criterion. We are provided with (quantum black box) access to a subroutine in the form of a unitary operator, $U_{f}$, which acts as:</p> <p>$U_{f}|\omega \rangle =-|\omega \rangle$</p> <p>and </p> <p>$U_{f}|x \rangle = |x \rangle$ $\forall x \neq \omega$</p> </blockquote> <p>Now, my problem with Grover is this: </p> <p>IF you have your unitary oracle, THEN you can find your needle in the haystack. But, suppose a real life scenario, in which you have your database and you have your $f$ above as given input data. </p> <p><strong>You still need a preliminary step to create your operator, FROM $f$</strong>. </p> <p>If there is a simple way to write a program which carries out this preliminary step, you are cool. But if this step turned out to be expensive, you must add this cost in the total bill (and that in turn might erode your quantum benefits). </p> <p>Assuming you have $f$, how complicated is it to produce $U_{f}$? </p> http://mathoverflow.net/questions/102779/how-much-does-a-quantum-oracle-to-find-a-needle-in-a-haystack-really-cost/104363#104363 Answer by Robin Kothari for How much does a quantum oracle to find a needle in a haystack really cost? Robin Kothari 2012-08-09T15:44:39Z 2012-08-09T15:44:39Z <p>$U_f$ is easy to create from a circuit that computes $f$. (I'm assuming you have a circuit that computes $f$. If you have a Turing machine, convert it to a circuit in the standard way.)</p> <p>Now given a circuit (using AND, OR, NOT gates) of G gates that computes $f$, i.e., accepts a binary string $x$ as input and outputs the 1 bit answer $f(x)$, this can be converted to a quantum circuit that uses a Toffoli gate and NOT gates to simulate the AND and OR gates. This will create a unitary matrix that on input $|x\rangle|0^k\rangle$ gives you $|f(x)\rangle|\text{junk}(x)\rangle$. Using the standard "uncomputation trick", you can now get a circuit that performs $|x\rangle|b\rangle \mapsto |x\rangle |b \oplus f(x)\rangle$. Finally, if you put in the state $\frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)$ for $|b\rangle$, you'll get a circuit that exactly implements $U_f$.</p> <p>Note that this circuit for $U_f$ has increased the size and depth of the original circuit for $f$ by only a constant factor. Thus if $f$ had an efficient circuit, then so does $U_f$.</p>