Grover's algorithm finds the marked item with probability within iterations
ProvedGroverWiki.grover_searchgrover-algorithmquantum-computingquantum-search
Let and let have exactly one index with . Let be the oracle, the uniform superposition and the Grover diffusion operator. Then there is a number of iterations with
That is, Grover's algorithm — prepare , apply the Grover iteration times, measure in the computational basis — outputs with probability at least (in particular at least for , and approaching for ) using applications of , compared with the evaluations needed classically.
Preamble
import Mathlib import Definitions.Def_GroverWiki_Defs open Matrix
Formal statement
namespace GroverWiki
/-- Grover's algorithm: with at most `⌈(π/4)√N⌉` Grover iterations (hence `O(√N)` applications of
`U_ω`), measuring the state yields the unique marked index `ω` with probability at least
`1 - 1/N`. -/
theorem grover_search {N : ℕ} (f : Fin N → Fin 2) (ω : Fin N)
(hω : ∀ x, f x = 1 ↔ x = ω) :
∃ r : ℕ, r ≤ ⌈Real.pi / 4 * Real.sqrt N⌉₊ ∧
1 - 1 / (N : ℝ) ≤ measureProb (groverState f r) ω := by sorry
end GroverWiki
Source
Wikipedia, "Grover's algorithm", revision oldid=1373498442, https://en.wikipedia.org/w/index.php?title=Grover%27s_algorithm&oldid=1373498442, lead section (PDF p. 1), section "Problem description" (PDF pp. 2–3) and section "Algorithm" (PDF p. 4)
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.