Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Log inSign up
Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Blog
Job Board
Q3AS

© 2026 Aqora Quantum S.A.S.

TermsPrivacyLegal Notice

arXiv:2611.17804

Tight Quantum Query Bounds for Collision Finding over Arbitrary Bounded Types

Tianci Peng, Shiqi Hou, Xiaoyang Dong

quant-phcs.CCSubmitted Nov 13, 2026• Announced Nov 16, 2026• 0 citations
arXivHTMLPDF

Abstract

We determine the bounded-error quantum query complexity of finding one $r$-collision in an $N$-input function of prescribed type, which specifies all equality-class sizes. For every fixed maximum class size and collision order, we give a tight bound as the maximum of scales determined by the numbers of classes of size at least $2,\ldots,r$. The lower bound holds for a uniformly random function of that type, and a matching algorithm succeeds on every such function. No intermediate class size is required to occur, and every feasible output alphabet is allowed. The characterization connects the abundant-collision regime associated with set equality to the sparse-target regime of $k$-distinctness. In particular, finding the unique $(k+1)$-collision in type $(k^n,k+1)$ has complexity $Θ_k(N^{3/4-1/[4(2^{k+1}-1)]})$, where $N=kn+k+1$, resolving an open problem of Belovs. For the lower bound, we introduce a filtered compressed permutation oracle that projects onto a harmonic database subspace after each complete function query. Its $O(T/N)$ comparison error over $T$ queries overcomes the square-root limitation of the unfiltered process. Hidden capacity extensions and moment estimates retain the populations at each intermediate collision order. Matching upper bounds use sampled collision lists and colored adaptive learning graphs, with a coherent decision-to-search conversion that avoids logarithmic overhead. We also give an alternative nested quantum-walk algorithm for three-collision search, matching the bound up to polylogarithmic factors.

AI Summary

The paper studies how a prescribed multiplicity profile determines the quantum query complexity of finding one $r$-collision. For a function on $N$ inputs with exactly $n_d$ equality classes of size $d\le K$, define $B_j=\sum_{d\ge j}n_d$ and $M=B_r\ge1$. For fixed $K$ and $r$, it gives the bounded-error characterization $\Theta_{K,r}\!\left(\max_{2\le j\le r}\left[\frac{N^{2^{j-1}}\prod_{i=2}^{j-1}B_i^{2^{i-2}}}{M^{2^{j-2}}}\right]^{1/(2^j-1)}\right)$. The lower bound holds for uniformly random functions of the exact type; the matching algorithm succeeds on every such function, for every feasible output alphabet. For type $(k^n,k+1)$, finding the unique $(k+1)$-collision requires $\Theta_k(N^{3/4-1/[4(2^{k+1}-1)]})$ queries, resolving the stated open question of Belovs. For type $(1^n,2^b,3)$, the bound is $\Theta(\max\{N^{2/3},N^{4/7}(b+1)^{1/7}\})$, exhibiting a transition controlled by the population of non-extendable pairs. The lower-bound method projects a compressed permutation database onto a harmonic subspace after each complete function query. Its $O(T/N)$ comparison error avoids the unfiltered process’s square-root soundness barrier. Hidden capacity-extension maps and collision-occupancy moments retain the intermediate populations. Upper bounds combine sampled collision lists below the square-root scale with colored adaptive learning graphs above it; coherent decision-to-search conversion avoids logarithmic overhead. A separate nested-walk construction matches three-collision bounds up to polylogarithmic factors. The results concern one collision and fixed $K,r$. They do not establish matching time complexity, multi-target enumeration bounds, or guarantees when class sizes or collision order grow with $N$.

Almost certainly largely AI-generatedAI use disclosed
Through iterative discussions with the authors, GPT-6 Astra developed the detailed proofs for all of these components.

Written by gpt-6.1-sol from the paper's full text. Automated: it can be wrong.

DOI
10.48550/arxiv.2611.17804

Related papers

Quantum Lower Bounds for Collision Problems

Pan Peng, Jingyu Wu

We establish tight lower bounds on the adaptive and non-adaptive quantum query complexities of Promised $k$-to-one Finding on an exactly $k$-to-one input string $x\in\mathbb Z_q^n$, for every fixed $k\ge2$ and every feasible alphabet size $q\ge n/k$. The lower bounds are $Ω_k(n^{1/2-1/(2(2^k-1))})$ for unrestricted adaptive algorithms and $Ω_k(n^{1-1/k})$ for one-round non-adaptive algorithms. The former matches the adaptive quantum algorithm of Liu and Zhandry [LZ19], whereas the latter matches classical birthday sampling even when the parallel queries are arbitrarily entangled. We also establish the non-adaptive lower bound $Ω_k(\sqrt{n/k})$ for $k$-to-one Testing when $q\ge n$, resolving an open question posed by Koiran, Landes, Portier, and Yao [KLPY10]. Our proofs generate the balanced input from a uniformly random permutation and use compressed permutation oracles to describe the information learned by the algorithm. The adaptive proof bounds the growth of partial collisions through successive queries. The one-round proof instead analyzes the state after the parallel queries directly, bounding the probability that the compressed database contains a full collision. In both proofs, a short verification step accounts for correct outputs that include unrecorded positions. For the decision problem, we also compare one-round states with independent and distinct output labels.

quant-pharXiv:2611.01767•Nov 3, 2026•1 citation

Tight Time-Space Lower Bounds for Collision Finding and Element Distinctness under Label Symmetry

Frédéric Magniez, Sebastian Zur

How much memory is needed to retain the quantum speedup for collision finding? For a uniformly random function $f:[N]\to [N]$, the BHT algorithm finds a collision using $O(N^{1/3})$ queries and a quantumly accessible classical table containing $O(N^{1/3})$ input-output pairs, whereas a logarithmic-space Grover search uses $O(\sqrt N)$ queries. Determining the optimal query-space tradeoff between these extremes remains a major open problem. We resolve this equation within the class of label-symmetric algorithms, which treat the function $f$'s output labels as interchangeable. We prove that such algorithm that makes $T$ queries, uses $S$ qubits, and finds a collision in a uniformly random function $f:[M]\to [N]$ with constant probability satisfies $$T=Ω(N^{1/3}) \qquad\text{and}\qquad T^2S=Ω(N\log N).$$ For the setting where $M=N$, these bounds are matched by a space-efficient implementation of the BHT algorithm. As a consequence of our tradeoff, any label-symmetric algorithm for the search version of Element Distinctness on $f: [n] \to [n^2]$ must satisfy $$T=Ω(n^{2/3}) \qquad\text{and}\qquad T^2S=Ω(n^2\log n),$$ matching Ambainis's quantum walk. Thus, both tradeoffs are optimal within the class of label-symmetric algorithms. To prove these results, we develop a space-sensitive version of the compressed oracle technique. The compressed oracle records the information learned by the algorithm in an evolving superposition of databases. Using label symmetry and representation theory, we show that an algorithm using $S$ qubits can effectively retain information about only $O(S/\log N)$ collision-free database entries. Substituting this estimate into the compressed oracle technique yields the stated tradeoffs.

quant-pharXiv:2609.10808•Sep 11, 2026•1 citation

Breaking the quantum barriers for Graph Collision

Arjan Cornelissen, Amin Shiraz Gilani, Shiva Kintali +3 more

In the graph collision problem, the task is to decide whether a known graph on $n$ vertices contains an edge with both endpoints marked, given query access to the input bits specifying the marked vertices. We first refute the conjectured $Ω(n^{2/3})$ query lower bound with a bounded error quantum algorithm using $\widetilde O(n^{92/139})$ queries. We then refine this approach to obtain a $\widetilde O(n^{11/17})$ query algorithm. We also obtain a $\widetilde O((nq)^{11/17})$ query bound for all (partial) Boolean output functions with positive certificate complexity at most 2 and alphabet size $q$, contrasting a known $Ω(n^{2/3})$ lower bound for such problems with large alphabet sizes. We complement these algorithms with an $Ω(\sqrt{n\log n})$ quantum query lower bound for graph collision, exceeding the $O(\sqrt n)$ certificate complexity barrier for the positive adversary method.

quant-pharXiv:2611.05356•Nov 4, 2026•0 citations

A Tight Quantum Algorithm for Multiple Collision Search

Xavier Bonnetain, Johanna Loyer, André Schrottenloher +1 more

Searching for collisions in random functions is a fundamental computational problem, with many applications in symmetric and asymmetric cryptanalysis. When one searches for a single collision, the known quantum algorithms match the query lower bound. This is not the case for the problem of finding multiple collisions, despite its regular appearance as a sub-component in sieving-type algorithms. At EUROCRYPT 2019, Liu and Zhandry gave a query lower bound $Ω(2^{m/3 + 2k/3})$ for finding $2^k$ collisions in a random function with m-bit output. At EUROCRYPT 2023, Bonnetain et al. gave a quantum algorithm matching this bound for a large range of $m$ and $k$, but not all admissible values. Like many previous collision-finding algorithms, theirs is based on the MNRS quantum walk framework, but it chains the walks by reusing the state after outputting a collision. In this paper, we give a new algorithm that tackles the remaining non-optimal range, closing the problem. Our algorithm is tight (up to a polynomial factor) in queries, and also in time under a quantum RAM assumption. The idea is to extend the chained walk to a regime in which several collisions are returned at each step, and the ``walks'' themselves only perform a single diffusion layer.

arXiv:2509.13909•Sep 17, 2025•1 citation

Quantum Query Algorithms for the Constructive Diagonal Ramsey Theorem

Cheng Xin

The constructive diagonal Ramsey problem asks, given adjacency-oracle access to an $N$-vertex graph, for a clique or independent set of the order guaranteed by Ramsey's theorem. We give a bounded-error quantum algorithm that, for every $K\ge2$ and $N\ge4^{K-1}$, finds and verifies a homogeneous $K$-set using $O\!\left(2^K K\log\frac Kη\right)$ edge queries with failure probability at most $η$. At the Ramsey scale $N=2^n$, this yields a homogeneous set of order $\lfloor n/2\rfloor+1$ using $O(\sqrt N\log N\log(\log N/η))$ queries, improving on the $O(N)$ queries of the explicit classical recursion and giving, to our knowledge, the first sublinear worst-case algorithm for the Ramsey relation. We also derive an $Ω(N^{1/12})$ quantum lower bound by a reduction from collision finding. The algorithm runs the constructive recursion over implicit candidate sets. Each set is represented by a short conjunction of adjacency constraints and sampled using capped unknown-solution quantum search, and a scale-aware concentration schedule balances estimation accuracy against the increasing cost of sampling deeper sets. We complement the upper bound with an $Ω(N^{1-1/\sqrt2})$ randomized lower bound, transported from the random-Painter analysis of online Ramsey numbers, which holds on the uniform distribution $G(N,1/2)$. On that distribution a greedy quantum search uses only $\widetilde O(N^{1/4})$ queries, giving a provable polynomial quantum speedup for Ramsey search on random graphs. We also give an estimation-free size-biased recursion and extend it to every fixed number of edge colours.

quant-pharXiv:2609.05812•Sep 8, 2026•0 citations

Quantum Search With Generalized Wildcards

Arjan Cornelissen, Nikhil S. Mande, Subhasree Patro +2 more

In the search with wildcards problem [Ambainis, Montanaro, Quantum Inf.~Comput.'14], one's goal is to learn an unknown bit-string $x \in \{-1,1\}^n$. An algorithm may, at unit cost, test equality of any subset of the hidden string with a string of its choice. Ambainis and Montanaro showed a quantum algorithm of cost $O(\sqrt{n} \log n)$ and a near-matching lower bound of $Ω(\sqrt{n})$. Belovs [Comput.~Comp.'15] subsequently showed a tight $O(\sqrt{n})$ upper bound. We consider a natural generalization of this problem, parametrized by a subset $\cal{Q} \subseteq 2^{[n]}$, where an algorithm may test whether $x_S = b$ for an arbitrary $S \in \cal{Q}$ and $b \in \{-1,1\}^S$ of its choice, at unit cost. We show near-tight bounds when $\cal{Q}$ is any of the following collections: bounded-size sets, contiguous blocks, prefixes, and only the full set. All of these results are derived using a framework that we develop. Using symmetries of the task at hand we show that the quantum query complexity of learning $x$ is characterized, up to a constant factor, by an optimization program, which is succinctly described as follows: `maximize over all odd functions $f : \{-1,1\}^n \to \mathbb{R}$ the ratio of the maximum value of $f$ to the maximum (over $T \in \cal{Q}$) standard deviation of $f$ on a subcube whose free variables are exactly $T$.' To the best of our knowledge, ours is the first work to use the primal version of the negative-weight adversary bound (which is a maximization program typically used to show lower bounds) to show new quantum query upper bounds without explicitly resorting to SDP duality.

quant-pharXiv:2511.04669•Leibniz international proceedings in informatics•Nov 7, 2025•1 citation
We determine the bounded-error quantum query complexity of finding one rrr-collision in an NNN-input function of prescribed type, which specifies all equality-class sizes. For every fixed maximum class size and collision order, we give a tight bound as the maximum of scales determined by the numbers of classes of size at least 2,…,r2,\ldots,r2,…,r. The lower bound holds for a uniformly random function of that type, and a matching algorithm succeeds on every such function. No intermediate class size is required to occur, and every feasible output alphabet is allowed.
The characterization connects the abundant-collision regime associated with set equality to the sparse-target regime of kkk-distinctness. In particular, finding the unique (k+1)(k+1)(k+1)-collision in type (kn,k+1)(k^n,k+1)(kn,k+1) has complexity Θk(N3/4−1/[4(2k+1−1)])Θ_k(N^{3/4-1/[4(2^{k+1}-1)]})Θk​(N3/4−1/[4(2k+1−1)]), where N=kn+k+1N=kn+k+1N=kn+k+1, resolving an open problem of Belovs.
For the lower bound, we introduce a filtered compressed permutation oracle that projects onto a harmonic database subspace after each complete function query. Its O(T/N)O(T/N)O(T/N) comparison error over TTT queries overcomes the square-root limitation of the unfiltered process. Hidden capacity extensions and moment estimates retain the populations at each intermediate collision order. Matching upper bounds use sampled collision lists and colored adaptive learning graphs, with a coherent decision-to-search conversion that avoids logarithmic overhead. We also give an alternative nested quantum-walk algorithm for three-collision search, matching the bound up to polylogarithmic factors.
The paper studies how a prescribed multiplicity profile determines the quantum query complexity of finding one rrr-collision. For a function on NNN inputs with exactly ndn_dnd​ equality classes of size d≤Kd\le Kd≤K, define Bj=∑d≥jndB_j=\sum_{d\ge j}n_dBj​=∑d≥j​nd​ and M=Br≥1M=B_r\ge1M=Br​≥1. For fixed KKK and rrr, it gives the bounded-error characterization
ΘK,r ⁣(max⁡2≤j≤r[N2j−1∏i=2j−1Bi2i−2M2j−2]1/(2j−1))\Theta_{K,r}\!\left(\max_{2\le j\le r}\left[\frac{N^{2^{j-1}}\prod_{i=2}^{j-1}B_i^{2^{i-2}}}{M^{2^{j-2}}}\right]^{1/(2^j-1)}\right)ΘK,r​(max2≤j≤r​[M2j−2N2j−1∏i=2j−1​Bi2i−2​​]1/(2j−1)).
The lower bound holds for uniformly random functions of the exact type; the matching algorithm succeeds on every such function, for every feasible output alphabet.
For type (kn,k+1)(k^n,k+1)(kn,k+1), finding the unique (k+1)(k+1)(k+1)-collision requires Θk(N3/4−1/[4(2k+1−1)])\Theta_k(N^{3/4-1/[4(2^{k+1}-1)]})Θk​(N3/4−1/[4(2k+1−1)]) queries, resolving the stated open question of Belovs. For type (1n,2b,3)(1^n,2^b,3)(1n,2b,3), the bound is Θ(max⁡{N2/3,N4/7(b+1)1/7})\Theta(\max\{N^{2/3},N^{4/7}(b+1)^{1/7}\})Θ(max{N2/3,N4/7(b+1)1/7}), exhibiting a transition controlled by the population of non-extendable pairs.
The lower-bound method projects a compressed permutation database onto a harmonic subspace after each complete function query. Its O(T/N)O(T/N)O(T/N) comparison error avoids the unfiltered process’s square-root soundness barrier. Hidden capacity-extension maps and collision-occupancy moments retain the intermediate populations. Upper bounds combine sampled collision lists below the square-root scale with colored adaptive learning graphs above it; coherent decision-to-search conversion avoids logarithmic overhead. A separate nested-walk construction matches three-collision bounds up to polylogarithmic factors.
The results concern one collision and fixed K,rK,rK,r. They do not establish matching time complexity, multi-target enumeration bounds, or guarantees when class sizes or collision order grow with NNN.
We establish tight lower bounds on the adaptive and non-adaptive quantum query complexities of Promised kkk-to-one Finding on an exactly kkk-to-one input string x∈Zqnx\in\mathbb Z_q^nx∈Zqn​, for every fixed k≥2k\ge2k≥2 and every feasible alphabet size q≥n/kq\ge n/kq≥n/k. The lower bounds are Ωk(n1/2−1/(2(2k−1)))Ω_k(n^{1/2-1/(2(2^k-1))})Ωk​(n1/2−1/(2(2k−1))) for unrestricted adaptive algorithms and Ωk(n1−1/k)Ω_k(n^{1-1/k})Ωk​(n1−1/k) for one-round non-adaptive algorithms. The former matches the adaptive quantum algorithm of Liu and Zhandry [LZ19], whereas the latter matches classical birthday sampling even when the parallel queries are arbitrarily entangled. We also establish the non-adaptive lower bound Ωk(n/k)Ω_k(\sqrt{n/k})Ωk​(n/k​) for kkk-to-one Testing when q≥nq\ge nq≥n, resolving an open question posed by Koiran, Landes, Portier, and Yao [KLPY10]. Our proofs generate the balanced input from a uniformly random permutation and use compressed permutation oracles to describe the information learned by the algorithm. The adaptive proof bounds the growth of partial collisions through successive queries. The one-round proof instead analyzes the state after the parallel queries directly, bounding the probability that the compressed database contains a full collision. In both proofs, a short verification step accounts for correct outputs that include unrecorded positions. For the decision problem, we also compare one-round states with independent and distinct output labels.
How much memory is needed to retain the quantum speedup for collision finding? For a uniformly random function f:[N]→[N]f:[N]\to [N]f:[N]→[N], the BHT algorithm finds a collision using O(N1/3)O(N^{1/3})O(N1/3) queries and a quantumly accessible classical table containing O(N1/3)O(N^{1/3})O(N1/3) input-output pairs, whereas a logarithmic-space Grover search uses O(N)O(\sqrt N)O(N​) queries. Determining the optimal query-space tradeoff between these extremes remains a major open problem. We resolve this equation within the class of label-symmetric algorithms, which treat the function fff's output labels as interchangeable. We prove that such algorithm that makes TTT queries, uses SSS qubits, and finds a collision in a uniformly random function f:[M]→[N]f:[M]\to [N]f:[M]→[N] with constant probability satisfies T=Ω(N1/3)andT2S=Ω(Nlog⁡N).T=Ω(N^{1/3}) \qquad\text{and}\qquad T^2S=Ω(N\log N).T=Ω(N1/3)andT2S=Ω(NlogN). For the setting where M=NM=NM=N, these bounds are matched by a space-efficient implementation of the BHT algorithm. As a consequence of our tradeoff, any label-symmetric algorithm for the search version of Element Distinctness on f:[n]→[n2]f: [n] \to [n^2]f:[n]→[n2] must satisfy T=Ω(n2/3)andT2S=Ω(n2log⁡n),T=Ω(n^{2/3}) \qquad\text{and}\qquad T^2S=Ω(n^2\log n),T=Ω(n2/3)andT2S=Ω(n2logn), matching Ambainis's quantum walk. Thus, both tradeoffs are optimal within the class of label-symmetric algorithms. To prove these results, we develop a space-sensitive version of the compressed oracle technique. The compressed oracle records the information learned by the algorithm in an evolving superposition of databases. Using label symmetry and representation theory, we show that an algorithm using SSS qubits can effectively retain information about only O(S/log⁡N)O(S/\log N)O(S/logN) collision-free database entries. Substituting this estimate into the compressed oracle technique yields the stated tradeoffs.
In the graph collision problem, the task is to decide whether a known graph on nnn vertices contains an edge with both endpoints marked, given query access to the input bits specifying the marked vertices. We first refute the conjectured Ω(n2/3)Ω(n^{2/3})Ω(n2/3) query lower bound with a bounded error quantum algorithm using O~(n92/139)\widetilde O(n^{92/139})O(n92/139) queries. We then refine this approach to obtain a O~(n11/17)\widetilde O(n^{11/17})O(n11/17) query algorithm. We also obtain a O~((nq)11/17)\widetilde O((nq)^{11/17})O((nq)11/17) query bound for all (partial) Boolean output functions with positive certificate complexity at most 2 and alphabet size qqq, contrasting a known Ω(n2/3)Ω(n^{2/3})Ω(n2/3) lower bound for such problems with large alphabet sizes. We complement these algorithms with an Ω(nlog⁡n)Ω(\sqrt{n\log n})Ω(nlogn​) quantum query lower bound for graph collision, exceeding the O(n)O(\sqrt n)O(n​) certificate complexity barrier for the positive adversary method.
Searching for collisions in random functions is a fundamental computational problem, with many applications in symmetric and asymmetric cryptanalysis. When one searches for a single collision, the known quantum algorithms match the query lower bound. This is not the case for the problem of finding multiple collisions, despite its regular appearance as a sub-component in sieving-type algorithms. At EUROCRYPT 2019, Liu and Zhandry gave a query lower bound Ω(2m/3+2k/3)Ω(2^{m/3 + 2k/3})Ω(2m/3+2k/3) for finding 2k2^k2k collisions in a random function with m-bit output. At EUROCRYPT 2023, Bonnetain et al. gave a quantum algorithm matching this bound for a large range of mmm and kkk, but not all admissible values. Like many previous collision-finding algorithms, theirs is based on the MNRS quantum walk framework, but it chains the walks by reusing the state after outputting a collision. In this paper, we give a new algorithm that tackles the remaining non-optimal range, closing the problem. Our algorithm is tight (up to a polynomial factor) in queries, and also in time under a quantum RAM assumption. The idea is to extend the chained walk to a regime in which several collisions are returned at each step, and the ``walks'' themselves only perform a single diffusion layer.
The constructive diagonal Ramsey problem asks, given adjacency-oracle access to an NNN-vertex graph, for a clique or independent set of the order guaranteed by Ramsey's theorem. We give a bounded-error quantum algorithm that, for every K≥2K\ge2K≥2 and N≥4K−1N\ge4^{K-1}N≥4K−1, finds and verifies a homogeneous KKK-set using O ⁣(2KKlog⁡Kη)O\!\left(2^K K\log\frac Kη\right)O(2KKlogηK​) edge queries with failure probability at most ηηη. At the Ramsey scale N=2nN=2^nN=2n, this yields a homogeneous set of order ⌊n/2⌋+1\lfloor n/2\rfloor+1⌊n/2⌋+1 using O(Nlog⁡Nlog⁡(log⁡N/η))O(\sqrt N\log N\log(\log N/η))O(N​logNlog(logN/η)) queries, improving on the O(N)O(N)O(N) queries of the explicit classical recursion and giving, to our knowledge, the first sublinear worst-case algorithm for the Ramsey relation. We also derive an Ω(N1/12)Ω(N^{1/12})Ω(N1/12) quantum lower bound by a reduction from collision finding. The algorithm runs the constructive recursion over implicit candidate sets. Each set is represented by a short conjunction of adjacency constraints and sampled using capped unknown-solution quantum search, and a scale-aware concentration schedule balances estimation accuracy against the increasing cost of sampling deeper sets. We complement the upper bound with an Ω(N1−1/2)Ω(N^{1-1/\sqrt2})Ω(N1−1/2​) randomized lower bound, transported from the random-Painter analysis of online Ramsey numbers, which holds on the uniform distribution G(N,1/2)G(N,1/2)G(N,1/2). On that distribution a greedy quantum search uses only O~(N1/4)\widetilde O(N^{1/4})O(N1/4) queries, giving a provable polynomial quantum speedup for Ramsey search on random graphs. We also give an estimation-free size-biased recursion and extend it to every fixed number of edge colours.
In the search with wildcards problem [Ambainis, Montanaro, Quantum Inf.~Comput.'14], one's goal is to learn an unknown bit-string x∈{−1,1}nx \in \{-1,1\}^nx∈{−1,1}n. An algorithm may, at unit cost, test equality of any subset of the hidden string with a string of its choice. Ambainis and Montanaro showed a quantum algorithm of cost O(nlog⁡n)O(\sqrt{n} \log n)O(n​logn) and a near-matching lower bound of Ω(n)Ω(\sqrt{n})Ω(n​). Belovs [Comput.~Comp.'15] subsequently showed a tight O(n)O(\sqrt{n})O(n​) upper bound. We consider a natural generalization of this problem, parametrized by a subset Q⊆2[n]\cal{Q} \subseteq 2^{[n]}Q⊆2[n], where an algorithm may test whether xS=bx_S = bxS​=b for an arbitrary S∈QS \in \cal{Q}S∈Q and b∈{−1,1}Sb \in \{-1,1\}^Sb∈{−1,1}S of its choice, at unit cost. We show near-tight bounds when Q\cal{Q}Q is any of the following collections: bounded-size sets, contiguous blocks, prefixes, and only the full set. All of these results are derived using a framework that we develop. Using symmetries of the task at hand we show that the quantum query complexity of learning xxx is characterized, up to a constant factor, by an optimization program, which is succinctly described as follows: `maximize over all odd functions f:{−1,1}n→Rf : \{-1,1\}^n \to \mathbb{R}f:{−1,1}n→R the ratio of the maximum value of fff to the maximum (over T∈QT \in \cal{Q}T∈Q) standard deviation of fff on a subcube whose free variables are exactly TTT.' To the best of our knowledge, ours is the first work to use the primal version of the negative-weight adversary bound (which is a maximization program typically used to show lower bounds) to show new quantum query upper bounds without explicitly resorting to SDP duality.