Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Quantum minimum finding (Dürr–Høyer), with explicit bit width, interruption and gate model

Proved
QAlgorithms.Nannicini.quantumMinimumFinding

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

lecture-notesnanniciniquantum-information

Let f:{0,1}n→Zf : \{0,1\}^n \to \mathbb{Z}f:{0,1}n→Z take values of bit width bbb, i.e. ∣f(j)∣<2b|f(j)| < 2^b∣f(j)∣<2b for all jjj, and let Uf:∣j⟩∣k⟩↦∣j⟩∣k⊕f(j)⟩U_f : |j\rangle|k\rangle \mapsto |j\rangle|k \oplus f(j)\rangleUf​:∣j⟩∣k⟩↦∣j⟩∣k⊕f(j)⟩ evaluate fff in binary. Algorithm 2 with budget TTT starts from a uniformly random incumbent ℓ\ellℓ and repeatedly runs Algorithm 1 (search with an unknown number of marked items) with the marking unitary Um:∣j⟩∣y⟩↦∣j⟩∣y⊕I(f(j)<f(ℓ))⟩U_m : |j\rangle|y\rangle \mapsto |j\rangle|y \oplus \mathbb{I}(f(j) < f(\ell))\rangleUm​:∣j⟩∣y⟩↦∣j⟩∣y⊕I(f(j)<f(ℓ))⟩, replacing ℓ\ellℓ by the returned index kkk whenever f(k)<f(ℓ)f(k) < f(\ell)f(k)<f(ℓ); a call of Algorithm 1 that would exceed the budget is interrupted at the TTT-th application of UfU_fUf​, and the algorithm then returns ℓ\ellℓ. Each application of UmU_mUm​ counts as one application of UfU_fUf​ and is charged 3n+2b+13n + 2b + 13n+2b+1 additional gates; each round of Algorithm 1 with mmm qubits of precision is charged m+m(m+1)/2m + m(m+1)/2m+m(m+1)/2 further gates (Hadamards and the inverse QFT).

There are absolute constants c,C>0c, C > 0c,C>0 such that for every nnn, bbb, every such fff and every δ∈(0,1)\delta \in (0,1)δ∈(0,1) the following holds. Run Algorithm 2 independently k=⌈log⁡3(1/δ)⌉k = \lceil \log_3(1/\delta) \rceilk=⌈log3​(1/δ)⌉ times with budget T=⌈c2n⌉T = \lceil c\sqrt{2^n} \rceilT=⌈c2n​⌉ and output an fff-minimal one of the kkk returned indices. Then:

  1. with probability at least 1−δ1 - \delta1−δ the output is a global minimizer of fff;
  2. on every outcome, the total number of applications of UfU_fUf​ (including the kkk evaluations used to select the output) is at most
C2n (1+log⁡(1/δ)),C\sqrt{2^n}\,\bigl(1 + \log(1/\delta)\bigr),C2n​(1+log(1/δ)),

and the number of additional gates is at most C2n (n+b+1) (1+log⁡(1/δ))C\sqrt{2^n}\,(n + b + 1)\,(1 + \log(1/\delta))C2n​(n+b+1)(1+log(1/δ)).

This is the quadratic quantum speedup for unstructured minimization, the basis of the optimization applications of Grover search.

Formalization Note The source's O~(2n)\tilde O(\sqrt{2^n})O~(2n​) gate bound is stated with the suppressed polylogarithmic factors n+b+1n + b + 1n+b+1 and 1+log⁡(1/δ)1 + \log(1/\delta)1+log(1/δ) explicit, the interruption rule for the budget is made explicit, and TTT, kkk are the choices of the source's proof. Algorithm 1 is the shared formalization of the earlier corollary; the outcome law is a weight on (returned index, applications of UfU_fUf​, gates).

Preamble
import Definitions.Def_QAlgorithms_Defs_AmplitudeEstimation
import Definitions.Def_QAlgorithms_Nannicini_Ch04c_Model
set_option autoImplicit false
Formal statement
namespace QAlgorithms.Nannicini

open scoped ENNReal











/-- Corrected statement. Nannicini p.96, Theorem 4.31 (Quantum minimum finding; Dürr–Høyer).
Printed: for `f : {0,1}^n → ℤ` evaluated in binary by `U_f` and `δ > 0`, Alg. 2 determines the
global minimum of `f` with probability at least `1 − δ` using `O(√2^n log 1/δ)` applications of
`U_f` in total and `Õ(√2^n)` additional gates.

Changed: (1) the bit width `b` of the values of `f` (`|f(j)| < 2^b`) is a named parameter, the
constants are uniform in it, and the gate bound is `C √2^n (n + b + 1)(1 + log 1/δ)` in the cost
model of this section (`mfStepGates`, `mfRoundOverhead`): the factors `n + b + 1` and
`1 + log 1/δ` are the polylogarithmic factors that `Õ` suppresses (Def. 1.11), made explicit;
(2) a call of Alg. 1 that would exceed the budget `T` is interrupted at the `T`-th application of
`U_f` and Alg. 2 then returns its incumbent (`minFindLoop`); (3) the budget and the number of
repetitions are the proof's (p.97): `T = ⌈c √2^n⌉` for an absolute constant `c` (the proof's
`3t̄ = 9c'√2^n`, `c'` the constant of Cor. 4.30), and `k = ⌈log₃ 1/δ⌉` independent runs, the
answer being an `f`-minimal one of the `k` returned indices, which is a global minimizer iff
some returned index is (its selection costs `k` more evaluations, counted); (4) `δ < 1` and
`log 1/δ` read as `1 + log 1/δ`, since at least one evaluation is needed for every `δ < 1`.

Why: each application of `U_m` compares a `b`-bit value with `f(ℓ)` (`Θ(b)` gates) and the source
never fixes `b`, so `Õ(√2^n)` is false when `b` is not polylogarithmic in `2^n` unless `b` is
among the suppressed parameters; and without interruption a call of Alg. 1 with no marked item
(always the case once `ℓ` is the minimum) enumerates all `2^n` strings, so the printed loop
condition alone does not give the `O(√2^n log 1/δ)` total. -/
theorem quantumMinimumFinding :
    ∃ c : ℝ, 0 < c ∧ ∃ C : ℝ, 0 < C ∧
      ∀ (n b : ℕ) (f : Qubits n → ℤ), (∀ j, |f j| < 2 ^ b) →
      ∀ δ : ℝ, 0 < δ → δ < 1 →
        ENNReal.ofReal (1 - δ) ≤
            minFindRepeatProb f b ⌈c * Real.sqrt ((2 : ℝ) ^ n)⌉₊ ⌈Real.logb 3 (1 / δ)⌉₊
              (fun outs => ∃ i, ∀ j, f (outs i).1 ≤ f j) ∧
        ∀ outs : Fin ⌈Real.logb 3 (1 / δ)⌉₊ → Qubits n × ℕ × ℕ,
          (∏ i, minFindWeight f b ⌈c * Real.sqrt ((2 : ℝ) ^ n)⌉₊ (outs i)) ≠ 0 →
            (((∑ i, (outs i).2.1) + ⌈Real.logb 3 (1 / δ)⌉₊ : ℕ) : ℝ) ≤
                C * Real.sqrt ((2 : ℝ) ^ n) * (1 + Real.log (1 / δ)) ∧
            (((∑ i, (outs i).2.2) + ⌈Real.logb 3 (1 / δ)⌉₊ * mfStepGates n b : ℕ) : ℝ) ≤
                C * Real.sqrt ((2 : ℝ) ^ n) * ((n + b + 1 : ℕ) : ℝ) * (1 + Real.log (1 / δ)) := by
  sorry

end QAlgorithms.Nannicini
Source
Giacomo Nannicini, Quantum algorithms for optimizers, 2025, v5; notes dated 9 July 2025, PDF p. 96, Theorem 4.31. https://arxiv.org/pdf/2408.07086v5
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Undefined names. The statement uses three names that do not appear in the frozen definition layer supplied: minFindRepeatProb\mathrm{minFindRepeatProb}minFindRepeatProb, minFindWeight\mathrm{minFindWeight}minFindWeight and mfStepGates\mathrm{mfStepGates}mfStepGates. Their meaning cannot be unfolded here, so they are treated as opaque. The only information about them comes from how they are used:

  • minFindRepeatProb(f,b,K,R,E)\mathrm{minFindRepeatProb}(f, b, K, R, E)minFindRepeatProb(f,b,K,R,E) takes a function fff, a bit bound bbb, a natural number KKK, a repetition count RRR and an event EEE. Its value is an extended nonnegative real in [0,∞][0,\infty][0,∞]. The event EEE is a property of an RRR-tuple of outcomes.
  • An outcome is a triple (j,q,g)(j, q, g)(j,q,g) with j∈{0,1}nj \in \{0,1\}^nj∈{0,1}n and q,g∈Nq, g \in \mathbb{N}q,g∈N.
  • minFindWeight(f,b,K,o)\mathrm{minFindWeight}(f, b, K, o)minFindWeight(f,b,K,o) assigns a value with a zero element to a single outcome ooo.
  • mfStepGates(n,b)\mathrm{mfStepGates}(n, b)mfStepGates(n,b) is a natural number.

What the statement asserts. There exist real constants c>0c > 0c>0 and C>0C > 0C>0, fixed once and independent of everything below, such that the following holds. Take any:

  • natural numbers nnn and bbb;
  • function f:{0,1}n→Zf : \{0,1\}^n \to \mathbb{Z}f:{0,1}n→Z with ∣f(j)∣<2b|f(j)| < 2^b∣f(j)∣<2b for every jjj;
  • real number δ\deltaδ with 0<δ<10 < \delta < 10<δ<1.

Abbreviate

K=⌈c2n ⌉,R=⌈log⁡3(1/δ)⌉,K = \left\lceil c\sqrt{2^n}\,\right\rceil, \qquad R = \left\lceil \log_3(1/\delta) \right\rceil,K=⌈c2n​⌉,R=⌈log3​(1/δ)⌉,

where ⌈⋅⌉\lceil\cdot\rceil⌈⋅⌉ is the natural-number ceiling. Then two properties hold.

(1) Success probability. Let EEE be the event that some i<Ri < Ri<R has an outcome whose first component jij_iji​ satisfies f(ji)≤f(j)f(j_i) \le f(j)f(ji​)≤f(j) for all jjj, that is, jij_iji​ is a global minimiser of fff. Then

max⁡(1−δ, 0)  ≤  minFindRepeatProb(f,b,K,R,E),\max(1-\delta,\,0) \;\le\; \mathrm{minFindRepeatProb}(f, b, K, R, E),max(1−δ,0)≤minFindRepeatProb(f,b,K,R,E),

where the left side is 1−δ1-\delta1−δ embedded into [0,∞][0,\infty][0,∞].

(2) Cost bounds. Take every RRR-tuple of outcomes ((ji,qi,gi))i<R\big((j_i, q_i, g_i)\big)_{i<R}((ji​,qi​,gi​))i<R​ with

∏i<RminFindWeight(f,b,K,(ji,qi,gi))≠0.\prod_{i<R} \mathrm{minFindWeight}(f, b, K, (j_i,q_i,g_i)) \neq 0.i<R∏​minFindWeight(f,b,K,(ji​,qi​,gi​))=0.

Every such tuple satisfies both

∑i<Rqi+R  ≤  C2n (1+ln⁡(1/δ))\sum_{i<R} q_i + R \;\le\; C\sqrt{2^n}\,\big(1 + \ln(1/\delta)\big)i<R∑​qi​+R≤C2n​(1+ln(1/δ))

and

∑i<Rgi+R⋅mfStepGates(n,b)  ≤  C2n (n+b+1) (1+ln⁡(1/δ)).\sum_{i<R} g_i + R\cdot \mathrm{mfStepGates}(n,b) \;\le\; C\sqrt{2^n}\,(n+b+1)\,\big(1+\ln(1/\delta)\big).i<R∑​gi​+R⋅mfStepGates(n,b)≤C2n​(n+b+1)(1+ln(1/δ)).

The left sides are computed in N\mathbb{N}N and then read as reals.

Edge cases.

  • Mixed logarithms. The repetition count RRR uses log⁡3\log_3log3​, while the bounds use the natural logarithm ln⁡\lnln.
  • Range of RRR. Since 0<δ<10<\delta<10<δ<1, we have 1/δ>11/\delta > 11/δ>1, so R≥1R \ge 1R≥1. In particular, R=1R = 1R=1 for every δ≥1/3\delta \ge 1/3δ≥1/3.
  • n=0n = 0n=0. The domain {0,1}0\{0,1\}^0{0,1}0 has a single point, 20=1\sqrt{2^0} = 120​=1, and K=⌈c⌉K = \lceil c\rceilK=⌈c⌉.
  • b=0b = 0b=0. The hypothesis forces f≡0f \equiv 0f≡0.
  • Vacuous product condition. If the weight product is zero for every tuple, the cost bounds in (2) hold vacuously.
  • Hypotheses are satisfiable. No hypothesis is impossible; for example, f≡0f \equiv 0f≡0 with b=1b = 1b=1 meets the requirement ∣f(j)∣<2b|f(j)| < 2^b∣f(j)∣<2b.
Human review
  • Endorsed by Shuze Chen · Oct 13, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Goku · 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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me