Grover's algorithm #
Grover's algorithm finds the marked item among N ≥ 2 with O(√N) queries, matching the BBBV
lower bound (Cslib.Quantum.card_sub_two_le) up to a constant Grover. In the query
model of Cslib.Quantum.run, with a trivial workspace, it starts in the uniform superposition
|s⟩ of the query indices with control bit 1 (Cslib.Quantum.uniform) and alternates the
controlled phase oracle with the diffusion D = 2|s⟩⟨s| - I, the reflection about |s⟩
(Cslib.Quantum.diffusion, Cslib.Quantum.grover). The state never leaves the control-1
subspace, where the oracle acts as the phase oracle (-1)^{x_i}.
Let θ = arcsin(1 / √N). After k queries on the input marking z, the amplitude of z is
sin((2k + 1) θ) and every other amplitude with control bit 1 is cos((2k + 1) θ) / √(N - 1)
(Cslib.Quantum.run_grover): each round rotates the state by 2θ in the plane spanned by |z⟩
and the uniform superposition of the other items. So z is measured with probability
sin²((2k + 1) θ) (Cslib.Quantum.regProb_run_grover). With k = ⌊π / (4θ)⌋ ≤ π√N / 4 queries,
(2k + 1) θ lies within θ of π / 2, and the success probability is at least 1 - 1 / N
(Cslib.Quantum.grover_success).
Main definitions #
Cslib.Quantum.uniform: the uniform superposition.Cslib.Quantum.diffusion: the reflection about the uniform superposition.Cslib.Quantum.grover: the isometries of Grover's algorithm.
Main results #
Cslib.Quantum.run_grover: the state of Grover's algorithm afterkqueries.Cslib.Quantum.regProb_run_grover: its success probabilitysin²((2k + 1) θ).Cslib.Quantum.grover_success:⌊π / (4θ)⌋ ≤ π√N / 4queries find the marked item with probability at least1 - 1 / N.
References #
The uniform superposition |s⟩ = N^{-1/2} ∑_i |i, 1⟩ with control bit 1.
Instances For
The Grover angle θ = arcsin(1 / √N).
Instances For
The state of Grover's algorithm after k queries on the input marking z: with control
bit 1, amplitude sin((2k + 1) θ) on z and cos((2k + 1) θ) / √(N - 1) elsewhere; with
control bit 0, amplitude 0.
Grover's success probability: after k queries on the input marking z, measuring the
query register gives z with probability sin²((2k + 1) θ).
Grover's algorithm Grover: for N ≥ 2 and every z, with
T = ⌊π / (4θ)⌋ queries, where θ = arcsin(1 / √N), the algorithm outputs the marked item z
with probability at least 1 - 1 / N, and T ≤ π √N / 4.