Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Stopping at r=⌊π/(4t)⌋r = \lfloor\pi/(4t)\rfloorr=⌊π/(4t)⌋, ω\omegaω is observed with error at most 1/N1/N1/N

Proved
GroverWiki.measureProb_groverState_floor

by Lucas · Oct 13, 2026 · Mathlib 0df444a (Lean v4.33.1)

grover-algorithmquantum-computingquantum-search

Let f ⁣:{0,…,N−1}→{0,1}f\colon\{0,\dots,N-1\}\to\{0,1\}f:{0,…,N−1}→{0,1} have exactly one index ω\omegaω with f(ω)=1f(\omega) = 1f(ω)=1, let t=arcsin⁡(1/N)t = \arcsin(1/\sqrt N)t=arcsin(1/N​) and r=⌊π/(4t)⌋r = \lfloor \pi/(4t)\rfloorr=⌊π/(4t)⌋. After rrr Grover iterations, measuring the state yields ω\omegaω with probability

∣⟨ω∣(UsUω)r∣s⟩∣2≥1−1N,\bigl|\langle\omega|(U_sU_\omega)^r|s\rangle\bigr|^2 \ge 1 - \frac1N ,​⟨ω∣(Us​Uω​)r∣s⟩​2≥1−N1​,

i.e. with error at most 1/N1/N1/N. This is a quantitative form of the source's claim that stopping at r=π/4t≈πN/4r = \pi/4t \approx \pi\sqrt N/4r=π/4t≈πN​/4 gives the correct answer with error O(1/N)O(1/N)O(1/N).

Formalization Note The source's r=π/4tr = \pi/4tr=π/4t is in general not an integer; the mission rounds it down, and replaces "O(1/N)O(1/N)O(1/N)" by the explicit bound 1/N1/N1/N.

Preamble
import Mathlib
import Definitions.Def_GroverWiki_Defs

open Matrix
Formal statement
namespace GroverWiki

/-- Stopping at `r = ⌊π/(4t)⌋` iterations, `t = arcsin(1/√N)`, the measurement yields `ω` with
error at most `1/N`. -/
theorem measureProb_groverState_floor {N : ℕ} (f : Fin N → Fin 2) (ω : Fin N)
    (hω : ∀ x, f x = 1 ↔ x = ω) :
    1 - 1 / (N : ℝ) ≤
      measureProb (groverState f ⌊Real.pi / (4 * Real.arcsin (1 / Real.sqrt N))⌋₊) ω := 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, section "Algebraic proof" (PDF p. 6), with section "Geometric proof" (PDF p. 5)
Human review
  • Endorsed by Shuze Chen · Oct 13, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Lucas · Oct 13, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me