10.4 Oracles and query complexity
The computational power of quantum interference was discovered by counting how many times certain Boolean functions have to be evaluated in order to find the answer to a given problem. Imagine a “black box” (also called an oracle) that computes some fixed Boolean function, but whose inner workings are unknown to us, and a scenario in which one wants to learn about a given property of the Boolean function but has to “pay” (in energy, or in money!) for each use (often referred to as a query) of the box. In such a setting, the objective is to minimise number of queries to the oracle while finding out as much information as possible about the function computed by the oracle. For this purpose, we ignore everything that happens inside the black box: the Boolean function evaluation counts as just one computational step.
10.4.1 Deutsch’s algorithm
We start, once more, with the simplest quantum interference circuit:
Suppose you can prepare the input, you can read the output, you cannot see the phase shifter, but you are promised that the phase shifter is set to either
Of course you can!
One way of doing it is to set your input to
We are presented with an oracle that computes some unknown function
constant | ||
balanced |
Our task is to determine, using the fewest queries possible, whether the function computed by the oracle is constant or balanced.
Note that we are not asked for the particular values
(Deutsch’s).
First register:
During the function evaluation, the second register “kicks back” the phase factor
This evolution can be represented by the circuit diagram
where the relative phase is
Deutsch’s result laid the foundation for the new field of quantum computation, and was followed by several other quantum algorithms for various problems. They all seem to rest on the same generic sequence: a Hadamard transform, followed by a function evaluation, followed by another Hadamard (or Fourier) transform.130 As we shall see in a moment, in some cases (such as in Grover’s search algorithm) this sequence is repeated several times. Let me now take you through the three early quantum algorithms, each one offering a higher-order speed-up when compared to their classical analogues than the last.