Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Iteration count: r(N)=⌊π/(4arcsin⁡(1/N))⌋≤⌈π4N⌉r(N) = \lfloor \pi/(4\arcsin(1/\sqrt N))\rfloor \le \lceil \frac{\pi}{4}\sqrt N\rceilr(N)=⌊π/(4arcsin(1/N​))⌋≤⌈4π​N​⌉

Proved
GroverWiki.iterationCount_le

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

grover-algorithmquantum-computingquantum-search

Let N≥1N \ge 1N≥1 and t=arcsin⁡(1/N)t = \arcsin(1/\sqrt N)t=arcsin(1/N​). The number of Grover iterations r(N)=⌊π/(4t)⌋r(N) = \lfloor \pi/(4t)\rfloorr(N)=⌊π/(4t)⌋ satisfies

r(N)=⌊π4arcsin⁡(1/N)⌋≤⌈π4N⌉.r(N) = \left\lfloor \frac{\pi}{4\arcsin(1/\sqrt N)} \right\rfloor \le \left\lceil \frac{\pi}{4}\sqrt N \right\rceil .r(N)=⌊4arcsin(1/N​)π​⌋≤⌈4π​N​⌉.

Together with the error bound for this choice of rrr (milestone Algebraic proof — stopping at r=⌊π/(4t)⌋r = \lfloor\pi/(4t)\rfloorr=⌊π/(4t)⌋), this is the source's statement that the correctly chosen number of iterations is at most ⌈π4N⌉\lceil\frac{\pi}{4}\sqrt N\rceil⌈4π​N​⌉, i.e. O(N)O(\sqrt N)O(N​) applications of the oracle.

Formalization Note The source does not fix a rounding convention for "r=π/4tr = \pi/4tr=π/4t"; the mission uses the integer part ⌊π/(4t)⌋\lfloor\pi/(4t)\rfloor⌊π/(4t)⌋.

Preamble
import Mathlib
import Definitions.Def_GroverWiki_Defs

open Matrix
Formal statement
namespace GroverWiki

/-- The number of iterations `r(N) = ⌊π/(4 arcsin(1/√N))⌋` satisfies `r(N) ≤ ⌈(π/4)√N⌉`. -/
theorem iterationCount_le {N : ℕ} (hN : 1 ≤ N) :
    ⌊Real.pi / (4 * Real.arcsin (1 / Real.sqrt N))⌋₊ ≤ ⌈Real.pi / 4 * 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 "Algorithm" (PDF p. 4), with r=π/4tr = \pi/4tr=π/4t from section "Algebraic proof" (PDF p. 6)
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