<p>As  pointed out by Logan Mayfield, <a href="http://www.scottaaronson.com/blog/?p=451" rel="nofollow">Scott Aaronson's blogpost</a> on the topic completely resolves my question. Oracles is a fundamental tool for rigorous investigation of computational complexity classes, </p>

<blockquote>
  <p><a href="http://www.scottaaronson.com/blog/?p=451#comment-16187" rel="nofollow">“bring out the latent strengths” of one class over another class</a>.</p>
</blockquote>

<p>The root cause of my concerns was that little (as far as I understand - nothing) can be proven unconditionally about quantum speedups in the unrelativized (compiled to physical hardware) world. Of course, this obstacle does not diminish the power of the oracle framework as a major tool enabling progress in quantum computation theory, including the celebrated example of Shor's algorithm.  </p>

<p>Personally, it is a consolation to learn from Scott that </p>

<blockquote>
  <p>This [<em>relativized vs. unrelatized complexity</em>] is an absolutely crucial distinction that trips up just about
  <em>everyone</em> when they’re first learning quantum computing.</p>
</blockquote>

CC BY-SA 3.0
2013-03-02T10:53:41.873Z
2013-03-02T10:53:41.873Z
Slaviks
<p>If you have a circuit which implements a function on a classical computer, then you can implement that function on a quantum computer with only small overhead (a factor of 2 I think).  So in that sense, there is not much oracle overhead.  Grover's algorithm for finding a needle in a haystack calls the oracle $O(\sqrt{N})$ times and the classical sequential "Is the needle here? How about here?" search calls the oracle $O(N)$ times.  So there is a quantum speedup for Grover versus the classical sequential search even if the quantum oracle runs twice as slow as the classical one.</p>

<p>However, one then has to consider whether the classical sequential search was in fact the fastest way to do it.  In the case of an oracle that is implemented using a polynomial size circuit, if P=NP then there would be a $\textrm{polylog}(N)$ time algorithm to find the needle in the haystack.  To prove that there is no better way that sequential search in general, you need to construct something like a random oracle, which ends up not being efficient to build.</p>

<p>A separate but related issue is that in the context of query complexity one only considers the number of times the oracle is queried, and not the complexity of the intermediate operations.  Considering these intermediate operations, Grover's algorithm actually takes $O(\log(N)\sqrt{N})$ time in addition to the $O(\sqrt{N})$ oracle queries, which isn't really all that bad.  The general hidden subgroup problem, if I recall correctly, has a rather low query complexity but known algorithms make use of unitary operations that are exponentially difficult to implement.  So in this case the quantum algorithm is not so practical.</p>

CC BY-SA 3.0
2013-03-02T14:34:09.017Z
2013-03-02T14:34:09.017Z
Dan Stahlke
<p>I am a physicist  getting acquainted with one of the typical constructs for formulation and analysis of quantum algorithms (such as search problems or query complexity models), namely the "oracle function". As far as I understand, the oracle is a quantum black-box entity which computes the quantity to be analyzed. For example, in a qubit circuit formulation of a universal quantum computer the oracle is a deterministically computed Boolean function (correct me here if I'm wrong).</p>

<p>My question is:</p>

<ul>
<li>Is quantum oracle implementation overhead counted when the
computational complexity of specific/well-known algorithms is compared to
alternatives?</li>
</ul>

<p><strong>Examples</strong>: deterministic <a href="http://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm" rel="nofollow">Deutsch-Jozsa algorithm</a> algorithm is exponentially faster than a classical counterpart only if the implementation of the unknown function $f$ requires less than $2^n$ classical "steps'' (including obtaining the guarantee that $f$ is either <em>partial</em> or <em>constant</em>). A stochastic example: collapse of the Grover algorithm speedup by a <a href="http://www.cims.nyu.edu/~regev/papers/faultygrover.pdf" rel="nofollow">faulty oracle</a> with an arbitrary small but constant failure probability.</p>

<p><strong>Why do one care</strong>: Of course, one can alsways say that we look just at the non-oracle part or count only the number of queries etc. But any talk of quantum speedup has any chance of empirical relevance only if the overhead for implementation of all of the quantum parts of the construction is taken into account (if it is trivial/constant - no problem). In other words, I find it meaningful to compare quantum algorithms only after they are "fully compiled'' onto (at least hypothetically) realizable classically-driven hardware (e.g., universal set of gates plus as many qubits as one needs - but we'll count all the time &amp; memory required). </p>

<p>My question is probably fairly typical for a non-expert, perhaps I just got confused by some less sophisticated introductions to quantum computation. Please deconfuse me.</p>

CC BY-SA 3.0
2013-03-01T20:58:46.817Z
When we say Deutsch-Jozsa is exponentially faster than its classical counterpart, we're usually talking about query complexity which is relative to queries to the oracle. So your comment that its speedup comes from the implementation of the Oracle itself doesn't make sense in that context (or I miss understood your point).
It sounds like you're talking about a different complexity model than that of query complexity.  Query complexity is typically what we look at with Oracle-based quantum algorithms.
So maybe the short answer to your question is, "no it's not counted."
Logan Mayfield
CC BY-SA 3.0
2013-03-01T21:13:29.417Z
I think this is relevant to what you're thinking about: [Aaronson: Doing My Oracle Duty](http://www.scottaaronson.com/blog/?p=451)
Logan Mayfield
CC BY-SA 3.0
2013-03-02T07:35:56.667Z
@LoganMayfield Thanks for an extremely relevant link! That explains that uncoditional speedups are a known to exist only in "relativized world" (with oracles).
Slaviks
<quantum-computing><circuit-complexity><oracles>
Quantum oracle implementation overhead
Slaviks
# Quantum oracle implementation overhead

(Asked by: username_0 on 2013-03-01)

I am a physicist getting acquainted with one of the typical constructs for formulation and analysis of quantum algorithms (such as search problems or query complexity models), namely the "oracle function". As far as I understand, the oracle is a quantum black-box entity which computes the quantity to be analyzed. For example, in a qubit circuit formulation of a universal quantum computer the oracle is a deterministically computed Boolean function (correct me here if I'm wrong).

My question is:

* Is quantum oracle implementation overhead counted when the
  computational complexity of specific/well-known algorithms is compared to
  alternatives?

**Examples**: deterministic [Deutsch-Jozsa algorithm](http://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm) algorithm is exponentially faster than a classical counterpart only if the implementation of the unknown function $f$ requires less than $2^n$ classical "steps'' (including obtaining the guarantee that $f$ is either *partial* or *constant*). A stochastic example: collapse of the Grover algorithm speedup by a [faulty oracle](http://www.cims.nyu.edu/~regev/papers/faultygrover.pdf) with an arbitrary small but constant failure probability.

**Why do one care**: Of course, one can alsways say that we look just at the non-oracle part or count only the number of queries etc. But any talk of quantum speedup has any chance of empirical relevance only if the overhead for implementation of all of the quantum parts of the construction is taken into account (if it is trivial/constant - no problem). In other words, I find it meaningful to compare quantum algorithms only after they are "fully compiled'' onto (at least hypothetically) realizable classically-driven hardware (e.g., universal set of gates plus as many qubits as one needs - but we'll count all the time & memory required).

My question is probably fairly typical for a non-expert, perhaps I just got confused by some less sophisticated introductions to quantum computation. Please deconfuse me.

**Tags:** quantum-computing, circuit-complexity, oracles
> **Comments:**
> **username_1**: When we say Deutsch-Jozsa is exponentially faster than its classical counterpart, we're usually talking about query complexity which is relative to queries to the oracle. So your comment that its speedup comes from the implementation of the Oracle itself doesn't make sense in that context (or I miss understood your point). It sounds like you're talking about a different complexity model than that of query complexity.  Query complexity is typically what we look at with Oracle-based quantum algorithms. So maybe the short answer to your question is, "no it's not counted."  
> **username_1**: I think this is relevant to what you're thinking about: [Aaronson: Doing My Oracle Duty](http://www.scottaaronson.com/blog/?p=451)  
> **username_0**: @LoganMayfield Thanks for an extremely relevant link! That explains that uncoditional speedups are a known to exist only in "relativized world" (with oracles).  

---

## 2 answers

### Answer by username_0 on 2013-03-02. Score: 1 | Accepted answer

As pointed out by Logan Mayfield, [Scott Aaronson's blogpost](http://www.scottaaronson.com/blog/?p=451) on the topic completely resolves my question. Oracles is a fundamental tool for rigorous investigation of computational complexity classes,

> [“bring out the latent strengths” of one class over another class](http://www.scottaaronson.com/blog/?p=451#comment-16187).

The root cause of my concerns was that little (as far as I understand - nothing) can be proven unconditionally about quantum speedups in the unrelativized (compiled to physical hardware) world. Of course, this obstacle does not diminish the power of the oracle framework as a major tool enabling progress in quantum computation theory, including the celebrated example of Shor's algorithm.

Personally, it is a consolation to learn from Scott that

> This [*relativized vs. unrelatized complexity*] is an absolutely crucial distinction that trips up just about
> *everyone* when they’re first learning quantum computing.


---

### Answer by username_2 on 2013-03-02. Score: 0

If you have a circuit which implements a function on a classical computer, then you can implement that function on a quantum computer with only small overhead (a factor of 2 I think). So in that sense, there is not much oracle overhead. Grover's algorithm for finding a needle in a haystack calls the oracle $O(\sqrt{N})$ times and the classical sequential "Is the needle here? How about here?" search calls the oracle $O(N)$ times. So there is a quantum speedup for Grover versus the classical sequential search even if the quantum oracle runs twice as slow as the classical one.

However, one then has to consider whether the classical sequential search was in fact the fastest way to do it. In the case of an oracle that is implemented using a polynomial size circuit, if P=NP then there would be a $\textrm{polylog}(N)$ time algorithm to find the needle in the haystack. To prove that there is no better way that sequential search in general, you need to construct something like a random oracle, which ends up not being efficient to build.

A separate but related issue is that in the context of query complexity one only considers the number of times the oracle is queried, and not the complexity of the intermediate operations. Considering these intermediate operations, Grover's algorithm actually takes $O(\log(N)\sqrt{N})$ time in addition to the $O(\sqrt{N})$ oracle queries, which isn't really all that bad. The general hidden subgroup problem, if I recall correctly, has a rather low query complexity but known algorithms make use of unitary operations that are exponentially difficult to implement. So in this case the quantum algorithm is not so practical.


---

