Finding all marked elements with O(√(|M| 2^n)) oracle calls
ProvedQAlgorithms.Nannicini.findAllMarked_knownCountLet be accessed through and let be the set of marked elements. There is an absolute constant such that for every and every known value there is a quantum query algorithm making queries to , with
whose output is a subset of and which, for every with exactly marked elements, outputs exactly the set with probability at least .
As in Corollary 4.9, the algorithm is a fixed initial state followed by -independent unitaries interleaved with applications of , then a measurement in the computational basis and a fixed output map; it may depend on and but not on .
The source obtains this by repeatedly finding a marked element and unmarking it; the total cost is the sum .
Formalization Note The success probability is not printed; is the bounded-error convention. The adaptive procedure (measure, unmark, repeat) is represented by a single query algorithm with deferred measurements and the same query count. The case is included: then and the algorithm outputs the empty set.
import Definitions.Def_QAlgorithms_Defs_AmplitudeEstimation set_option autoImplicit false
namespace QAlgorithms.Nannicini
/-- Nannicini p.80, Corollary 4.10: let `M = {j ∈ {0,1}^n : f(j) = 1}` be the set of marked
elements, with `|M|` known. Then all elements of `M` can be determined using `O(√(|M| 2^n))`
applications of `f` (through `U_f : |j⟩|y⟩ ↦ |j⟩|y ⊕ f(j)⟩`). Formally: there is a constant `C > 0`
such that for all `n` and every known count `t` there is a `T`-query algorithm with an output map
to subsets of `{0,1}^n`, with `T ≤ C √(t 2^n)`, which for every `f` with exactly `t` marked
elements outputs the set `M` with probability at least `2/3` (bounded-error convention). -/
theorem findAllMarked_knownCount :
∃ C : ℝ, 0 < C ∧ ∀ n t : ℕ,
∃ (w T : ℕ) (A : QueryAlg (Qubits n) Bool (Fin w) T)
(out : (Qubits n × Bool) × Fin w → Finset (Qubits n)),
(T : ℝ) ≤ C * Real.sqrt ((t : ℝ) * (2 : ℝ) ^ n) ∧
∀ f : Qubits n → Bool, (Finset.univ.filter fun j => f j = true).card = t →
2 / 3 ≤ probEvent (A.finalState (xorOracle f))
fun z => out z = Finset.univ.filter fun j => f j = true := by
sorry
end QAlgorithms.Nannicini
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Model. Query algorithms, final states and the XOR oracle are as in the previous entry. A -query algorithm alternates input-independent unitaries with applications of , starting from a fixed unit vector.
Statement. There is a real with the following property. Take any natural numbers and ; there is no constraint relating them. Then there exist:
- natural numbers and ;
- a -query algorithm on index set , answer bit, and workspace ;
- a function assigning a finite subset of to each computational-basis label.
These satisfy two conditions. First,
Second, take every with exactly marked strings. Measure the final state of on in the computational basis. Then the outcome satisfies
with probability at least .
Edge cases.
- For , the bound forces . The only admissible is identically , and must return .
- For , no has exactly marked strings. The success condition is then vacuous.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.