Approximate quantum counting estimates the number of satisfying assignments of a Boolean function, using a quantum oracle and quantum measurement. Controlled repetitions of a Grover search algorithm iteration let quantum interference reveal the count. For one input bit, a Hadamard test can give Pauli Z gate expectation value : with the complemented phase oracle and , use to obtain . Repeated preparations estimate this expectation value; one binary measurement result does not distinguish all three counts .
Function oracle 2026-10-24
A function oracle supplies access to an unknown function : given an allowed input , one query returns . Query complexity counts these accesses separately from known local computation. A classical query receives one definite answer; a quantum oracle specifies coherent access through a unitary operator, allowing inputs in quantum superposition. The distinction is part of the access model, not a change to the mathematical function.
A Boolean quantum oracle preserves and adds a one-bit value into an answer qubit by exclusive or. On known computational-basis states, its output determines the same value as a classical function oracle query.
Apply one Hadamard gate to each of the qubits, with all gates acting in parallel. This quantum circuit implements the tensor product ; it needs single-qubit gates and one layer. For one qubit,
Taking the tensor product of these expressions multiplies the probability amplitudes and adds their exponents, giving
Here the dot product is evaluated using modular arithmetic modulo two.
Figure 1.
The Hadamard transform applies one Hadamard gate to each qubit in a parallel layer
. Details.
In particular, an initially zero quantum register becomes the uniform quantum superposition
This is useful at the start of a quantum algorithm because a subsequent quantum oracle acts on all these components coherently. Later quantum interference can reveal a global property of the function. Measuring immediately would merely produce a uniformly random binary string; the useful resource is the preserved quantum coherence, rather than the ability to read every function value in one run.
Write for bitwise exclusive or. Both quantum registers begin in . After the first Hadamard transform their joint quantum state is
The quantum oracle maps each component to . By linearity, the required quantum state is therefore
The different first-register computational-basis states are orthogonal, so there are orthogonal joint components of squared probability amplitude , even though some second-register values coincide. Thus the displayed quantum state is normalized.
Each run of Simon's algorithm uses one oracle call and returns one uniform sample from . Collect samples as rows of a matrix and solve over the two-element field using Gaussian elimination. Once the rows have matrix rank , the kernel is , so the promised nonzero vector is uniquely determined. Dependent samples, including , must be allowed for; exactly runs need not suffice.
For a rough quantitative estimate, put . When the existing samples span an -dimensional vector subspace of , the next sample increases the matrix rank with probability . The random spanning of a binary vector space estimate gives
Alternatively, samples fail to span with probability less than : failure means some nonzero linear functional on the -dimensional space vanishes on every sample, and a union bound gives . Consequently
The Gaussian elimination requires only a polynomial amount of classical work, for example bit operations for samples. The degenerate case needs no calls because the promise already specifies .
Classically, distinct inputs with equal function values reveal . Uniformly sampling distinct inputs finds such a function collision after roughly calls, by the birthday square-root scale. For sampled inputs, the expected number of colliding pairs is . The usual randomized classical query complexity of Simon's problem is therefore exponential in , on the scale
A straightforward exhaustive classical search instead uses calls. The square-root collision estimate is the sharper classical comparison; the quantum advantage concerns access to the promised quantum oracle, rather than an explicit table of all function values.
Normalize the second qubit as . Since a Pauli X gate changes to , the Boolean quantum oracle acts as
This quantum phase kickback leaves the second qubit uncorrelated with the first. Put : for a constant function and for a balanced Boolean function. Apart from the irrelevant global phase , the first qubit and environment reach
The population-preserving interaction commutes with the quantum oracle on this answer-register input, so its placement before or after the oracle, between the two Hadamard gates, gives the same result. Substitute into b:
The printed Deutsch algorithm uses the rule zero means constant function; one means balanced Boolean function. With that rule, the Deutsch algorithm with pure dephasing succeeds for either class with
For real nonnegative environment overlap this is , ranging from certainty at to random guessing at . For general complex overlap, a coherent shift can invert the printed answer: for example makes the printed rule always wrong. If the overlap is known but the printed quantum measurement is retained, choose the better labeling of its outcomes; this gives
There is a further improvement if a known can be compensated by the phase gate before the final Hadamard gate. It removes the coherent shift without reversing any actual quantum decoherence, and yields
This is optimal when only the first qubit is accessible, with equal prior probabilities for the two classes. Before the final Hadamard gate, their reduced density matrices are
The difference has eigenvalues , giving trace distance . The Holevo–Helstrom theorem therefore bounds the success probability by , exactly attained by the compensated procedure. A known phase shift and loss of coherence have different effects: at the two density matrices coincide and no measurement on the available qubit can reveal the answer.
In the oracle machine model, a function is accessed through a black box whose internal gate cost is excluded; the resource counted is the number of calls. A reversible classical oracle maps basis inputs as . Its quantum oracle extension applies the same permutation coherently to arbitrary superpositions, without measuring its input. A classical random mixture of inputs is not that coherent extension.
Write the two truth-table entries as , . Then , with the four cases
Two classical query circuits, and , recover the whole function with certainty. One call fixes only one entry, leaving two compatible functions; hence two are necessary classically. Randomization cannot remove this obstruction to certainty.
The minimum for full exact function identification remains two even with coherent quantum queries. To see this, expand the oracle target into its eigenstates: it is identity on , and gives phases on . Any one-query input, including an auxiliary system, has orthogonal sector weights , and summing to one. The output overlap between functions differing only at is , so perfect distinction requires ; differing only at likewise requires . Then , but functions differing at both entries have overlap . They are the same ray rather than distinguishable states. Thus one query cannot identify all four functions. The following one-query task recovers only whether the entries agree.
Let and let be one only at the marked input. A three-qubit implementation of Grover's algorithm starts with , applies a Hadamard gate to each qubit, queries the reversible quantum oracle , applies the Grover diffusion operator to the first two qubits, and measures those two qubits in the computational basis. Here . The full three-wire quantum circuit is the composition
Figure 1.
Three- and two-qubit implementations of Grover's algorithm for four inputs
. Details.
Here . Since , phase kickback gives . The third qubit remains separable and unchanged. A direct marked-state phase oracle therefore replaces the three-qubit query using only two qubits:
For the explicit choice only at , is a Controlled-Z gate. Immediately after it,
The mean of these four probability amplitudes is . The Grover diffusion operator maps each probability amplitude to . The three unmarked probability amplitudes become zero and the marked one becomes one. A single query consequently finds with probability one.
A gate-level implementation of is . Up to an irrelevant global phase, it is . For any other chosen marked word, conjugate the Controlled-Z gate by Pauli X gates on precisely the positions where the marked word has a zero.
Phase oracle 2026-10-25
A phase oracle encodes a Boolean function in the signs of computational basis states. Its diagonal entries have modulus one, so it is a unitary operator. The usual convention changes the sign when . A complemented convention instead changes the sign when , with ; denotes exclusive or. The two conventions differ by a global phase when used without coherent control, but the global phase of a controlled quantum gate makes that difference observable when the quantum oracle is controlled.
Quantum oracle 2026-10-25
A quantum oracle supplies coherent access to a function through a specified unitary operator. For a function with binary string output, the standard construction retains the input and adds the output into an answer quantum register by bitwise exclusive or. This operation is its own inverse, even when the function is not injective. A Boolean quantum oracle is the single-output-bit case; Simon's algorithm uses several answer qubits. Other encodings, such as a modular-addition quantum oracle or a phase gate encoding, require their own explicit query conventions.
Query complexity 2026-10-24
The number of accesses to an unknown input needed to solve a specified task. The input might be a string with individually readable entries, or an implicitly supplied function. A complete statement specifies deterministic, randomized, or quantum access, the accepted error, and worst-case or expected cost. Quantum query complexity permits coherent input access through a quantum oracle.