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.
Function collision Created 2026-10-06 Updated 2026-10-14
A function collision is a pair of distinct inputs with . An injective function has no collisions. For a two-to-one function every nonempty fiber has two elements and hence one unordered collision pair. Finding such a pair through an oracle is the task of quantum collision finding.
In the finite example under image and preimage of a function, the pair is a function collision: both inputs give zero. The function retains their shared output but loses the distinction between them. If a finite set has more inputs than the number of available outputs, the pigeonhole principle forces a function collision. Equal source and target cardinalities alone do not prevent one.
For a finite function, let be the cardinality of its fiber of a function over . The number of unordered function collisions is , because each pair must lie in one common fiber. The example's nonempty fiber sizes are , giving exactly one collision pair.
Hash collision 2026-10-13
A hash collision is a function collision of a hash function : two distinct inputs have the same output, . Repeating the same input is not a hash collision. Unequal hash values prove the keys differ; equal hash values only identify candidates that might be equal. This makes a hash function useful as a compact filter before comparing the original data.
Here is a deliberately simple example using modular arithmetic. Let for nonnegative integer keys, and let a four-bucket hash table use the further bucket index . For keys , the hash values are , while all three bucket indices are . Thus and form a hash collision for ; and share a table bucket even though their full hash values differ. Always specify which function is being compared: a table collision concerns the bucket-index function, which may discard more information than the original hash function.
Figure 1.
A shared hash value and a shared table bucket discard different distinctions
. Constructed integer keys pass through and . Orange highlights the hash collision between and ; blue key joins them only after bucket reduction. Separate chaining retains all three keys. This is a toy calculation, not a measured workload or a cryptographic hash function. Details.
With separate chaining, bucket holds all three records in a linked list. A search for visits that bucket and compares the stored keys until it finds ; a search for visits the same bucket but rejects every stored key. A hash collision changes the search work, while key comparison preserves correctness. Storing only one record per hash value would incorrectly merge distinct keys. This is the purpose of collision handling in a hash table.[ref]
The pigeonhole principle explains inevitability: if a hash function has only possible outputs, any distinct inputs contain a hash collision. In particular, a function whose domain of a function is larger than its finite codomain cannot be an injective function. This is an existence statement; it gives neither an efficient way to find the pair nor a probability for a smaller collection of keys. A particular small collection might have no hash collision at all.
For a cryptographic hash function, collision resistance asks that finding any two distinct messages with equal full digests be computationally infeasible under the specified model and resources. It does not mean that hash collisions do not exist. Preimage resistance asks a different question: given a target digest , how hard is it to find a message with ? The collision finder may choose both messages and their common digest; the preimage finder is given the digest in advance. These definitions distinguish two search tasks, independently of how a hash table stores records.[ref]
Image of a function Created 2026-10-05 Updated 2026-10-14
For a function and a subset , its image is
The full image of a function is . The set notation ignores repeated outputs: in the finite example above, , rather than a list containing zero twice. A function collision can therefore reduce the cardinality of an image.
Images of a function preserve unions:
An output reached from the union is reached from at least one of its two input sets. For intersections, however, only
holds in general. In the finite example, take and . Their intersection is the empty set, so . But , giving . Distinct witnesses in the two input sets can produce the same output.
Figure 1.
An image of a function can merge disjoint inputs, while a preimage tests both output conditions on the same input
. Details.
For an injective function, an output shared by and must come from the same input. That input lies in , so equality holds. Conversely, preserving intersections for every pair of input subsets forces injectivity: two distinct inputs with the same output would give the singleton counterexample above. The image and preimage laws are stated in Jiří Lebl, Basic Analysis I, Propositions 0.3.15–0.3.16; the finite example makes the missing reverse inclusion visible.
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.
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 .