Grover's search algorithm (R5+) — as an instance of amplitude amplification #
Category: 3-Local (QM-validity).
Grover's algorithm: search for a single marked item w : Fin n → Fin 2 in an unstructured
database of N = 2ⁿ items. The search step is the composition of the oracle (phase flip on
w, I - 2|w⟩⟨w|) and the diffusion operator (inversion about the mean, 2|s⟩⟨s| - I,
where |s⟩ is the uniform superposition).
Rebuilt 2026-08-29 (plan specs/amplitude-amplification-plan.md, brick AA-3): the step
operators are proved to be the BHMT amplification step of
Mathlib/QuantumInfo/AmplitudeAmplification.lean — oracle w = oracleFlip {w}
(oracle_eq_oracleFlip) and diffusion = reflect uniformState (diffusion_eq_reflect) — and
the headline is re-derived from the general theorem: the uniform state is the rotation-plane
state at the Grover angle (uniformState_eq_ampState), so ampStep_iterate gives
grover_success : prob ((groverStep w)^[k] uniformState) w = sin²((2k+1)·θ),
sin θ = 1/√N. The file's previous self-contained rotation development (the symState
coefficient family and its operator-action lemmas) is retired — the general two-reflection
rotation now carries it, and keeping both would be exactly the parallel-development duplication
the Algorithm Atlas assessment (RESULT 4) documents. New at the same stroke, free from the
general theorem: the k-marked-items distribution grover_multi_success, which the
single-marked file could not state.
Honest scope. QM-validity breadth: genuine reflection operators on the EuclideanSpace
inner-product structure; amplitudes real, carried as ℂ-coercions. The optimal iteration count
and the success bound live with the general theorem (amplitude_amplification_succeeds,
amplification_query_bound) — the deferral the earlier version of this file recorded is closed
there, not here. Round counting is abstract-step counting; no oracle model is claimed.
Extraction cost record (the atlas assessment's priced pilot, AA-3): the rebuild of this
file on the general theorem — bridge lemmas, plane instantiation, re-derived headlines, deleted
parallel development — took ≈25 minutes wall-clock including two build-fix iterations
(2026-08-29, 14:22–14:47 session segment). The full AA-1..AA-3 session (general module written
and debugged + this refactor) was ≈90 minutes. See specs/amplitude-amplification-plan.md.
The database size N = 2ⁿ as a real number.
Equations
Instances For
The all-ones vector J = ∑ z |z⟩: amplitude 1 on every basis state.
Equations
- CSD.Empirical.QM.Grover.J n = ∑ z : Fin n → Fin 2, QuantumInfo.basisState z
Instances For
The uniform superposition |s⟩ = (1/√N) ∑ z |z⟩.
Equations
Instances For
The Grover entry point is the Hadamard output: uniformState = H^⊗n |0ⁿ⟩. This ties the
uniform superposition (defined here as the normalized all-ones vector) to the R2 Hadamard layer,
where Hn_apply_zero gives the same amplitude (√2⁻¹)ⁿ = (√(2ⁿ))⁻¹ on every basis state.
The oracle O_w = I - 2|w⟩⟨w|: a phase flip on the marked item w.
Equations
- CSD.Empirical.QM.Grover.oracle w ψ = ψ - (2 * ψ.ofLp w) • QuantumInfo.basisState w
Instances For
The diffusion operator 2|s⟩⟨s| - I: inversion about the mean.
Equations
Instances For
One Grover step: oracle then diffusion.
Equations
Instances For
The bridge: Grover's operators ARE the BHMT amplification step #
The oracle is the good-set reflection at G = {w}.
The diffusion is the reflection about the uniform state.
One Grover step is one amplification step at φ = uniformState, G = {w}.
The rotation plane: |w⟩ and the normalized rest #
1 ≤ 2ⁿ as a real, hence 0 ≤ 2ⁿ - 1.
The normalized rest state (√(N-1))⁻¹ (J − |w⟩): the bad unit component of the uniform
state against {w}.
Equations
- CSD.Empirical.QM.Grover.restState w = (↑√(2 ^ n - 1))⁻¹ • (CSD.Empirical.QM.Grover.J n - QuantumInfo.basisState w)
Instances For
The marked basis state is supported on {w}.
⟨|w⟩, |w⟩⟩ = 1.
⟨|w⟩, rest⟩ = 0.
The uniform state is the rotation-plane state at the Grover angle: given
sin θ = 1/√N, cos θ = √(N-1)/√N, uniformState = ampState |w⟩ rest θ.
The headline, re-derived from the general theorem #
Grover success probability (headline): after k Grover steps from the uniform
superposition, the probability of measuring the marked item w is sin²((2k+1)·θ), where
θ is the Grover rotation half-angle (sin θ = 1/√N, cos θ = √(N-1)/√N). Re-derived from
ampStep_iterate (BHMT) via the operator identity groverStep_eq_ampStep.
Optimal iteration gives certainty: when the accumulated angle hits π/2, i.e.
(2k+1)·θ = π/2, the marked item is measured with probability 1. (The general
closest-integer bound is amplitude_amplification_succeeds in
Mathlib/QuantumInfo/AmplitudeAmplification.lean.)
The k-marked generalisation — free from the general theorem #
The uniform state is a unit vector.
The uniform success probability against a good set of size k is k/N.
★ The k-marked-items Grover distribution. For a good set G of size strictly between
0 and N on the uniform start, j amplification rounds give success probability exactly
sin²((2j+1)·arcsin √(|G|/N)) — the generalisation the single-marked development could not
state, obtained as a direct instance of amplitude_amplification.