Query a known set of inputs and store its output table. If no function collision occurs there, each of its distinct outputs has exactly one partner in the complement, for a two-to-one function. A compute-phase-uncompute construction marks those partners using two function queries and reversible table comparison. Known-subset Grover search then uses such phase queries. Including table preparation and a final verification query gives
Choosing balances both terms and gives . The Grover rotation angle rounding bound gives success tending to one. This is a query bound; it does not make reversible table lookup free in a gate or physical-memory cost model.
For a known finite set , prepare the uniform superposition state and implement its reflection operator . If exactly basis states in are marked, the same two-dimensional Grover rotation angle argument uses phase queries. Preparation and reflection are known operations with no calls to the unknown predicate. Their gate cost must be accounted for separately. The success guarantee requires , and choosing the optimal iteration number uses a known .
A good item must exist, so assume ; if , the requested search is impossible, while makes every output good. Put and . Normalize the good and bad components of the uniform superposition state as
The Boolean phase oracle negates and fixes . The Grover diffusion operator is . Its implementation is independent of : conjugate the reflection about by Hadamard gates. One Grover search algorithm iteration is
Hence, by the Grover rotation angle formula,
Choose the nonnegative integer nearest to . Its final angle differs from by at most , so a computational-basis measurement succeeds with probability at least . The allowed small-density regime includes , giving the requested bound. Each iteration uses one Boolean phase oracle query, and .
For , and one iteration reaches exactly. Thus one query gives a good outcome with certainty:
This is exact Grover search on four entries applied to a marked fraction of one quarter, not only to a four-element register.
Interpret a function collision as two distinct inputs with equal outputs. Without distinctness the request is vacuous, since an input paired with itself always qualifies. Set (handling small by direct queries), choose a known set of size , and query all its inputs. Store a classical table of their outputs and corresponding inputs. If this table contains a function collision, return it immediately.
Otherwise the table contains distinct outputs. Because is exactly two-to-one, each has exactly one partner in , the known complement of . None lies in , and different table outputs have different partners. Thus exactly inputs in , of size , satisfy the known-table membership predicate
Build a marked-state phase oracle for this predicate by a compute-phase-uncompute construction: use on a clean answer quantum register, reversibly compare its output against the classical table, apply the conditional minus sign, undo the comparison, and apply again. Since the answer operation is bitwise exclusive or, . All workspace returns to zero, and each phase query costs two calls to .
Perform known-subset Grover search in the span of the computational basis states labelled by , starting in their uniform superposition state. Reflection about this known state uses no queries; choosing as an initial interval makes a known interval that can also be encoded by its own labels. Its marked fraction is , so the previous Grover rotation angle analysis uses phase queries. On measuring , one further query checks the output and retrieves its partner from the table. The inputs are distinct because the two sets are disjoint.
Consequently the quantum query complexity is
For large , rounding the optimal Grover search algorithm iteration count gives success at least . An internal table function collision already gives certain success. The balance explains the cube-root choice. This is the Brassard–Høyer–Tapp collision algorithm: its table uses classical bits. The bound counts calls to , as requested; it does not charge table lookup and its reversible implementation as constant-time gates, or claim an overall polynomial time in .
Because ,
which is the reflection operator in the line spanned by . Meanwhile changes the sign of every good basis state and fixes every bad basis state; on
it is the reflection in the axis. Both reflections preserve , so their product does too.
Write
In Euclidean geometry, the composition of reflections in two lines through the origin has a rotation matrix through twice the oriented angle between the lines. Hence rotates the good-bad plane by from toward . In particular, the Grover rotation angle formula is
Use the construction in part (c) for the marked-state phase reflection in each Grover search algorithm iteration. Every such reflection costs one query to ; the identity-oracle circuit, Hadamard gates, and are independent of .
Starting from , after iterations the success probability is
by the Grover rotation angle. Choose an integer
Then differs from by at most , so
For every sufficiently large this is greater than , while
Thus measuring the search register determines the faulty input with the required constant success probability using oracle queries.