The query complexity of uniformity testing
with purified unitary access
Abstract
We determine the bounded-error query complexity of uniformity testing when access to a distribution is provided by a preparation unitary with arbitrary garbage. For every integer and , distinguishing the uniform distribution on labels from distributions at total-variation distance greater than requires queries. This matches the upper bound of Canonne, Kothari, and O’Donnell (TQC, 2025) and remains valid when inverse and controlled queries are allowed. In particular, it determines the joint dependence on dimension and accuracy, including the transition at . The main obstacle is to control information obtained from the action of the entire unitary, not merely from the state it prepares. We construct reflection oracles with finite-dimensional, phase-randomized garbage and compare the uniform distribution with a symmetric Dirichlet prior. Our adversary operator combines a quadratic cutoff on label degrees with normalized Dirichlet moments. An exact posterior covariance identity controls the radial directions orthogonal to these moment vectors. The resulting full-operator norm estimate yields both branches of the lower bound.
Note. This paper was generated entirely by AI, including MiMo, using an automated research pipeline developed by Chenghua Liu and Hanyu Li.
1 Introduction
A program that prepares a sample can be used coherently: a quantum algorithm may apply the preparation unitary, reverse it, and query it on states other than its designated input. Uniformity testing asks how many such queries are needed to distinguish the uniform distribution on labels from a distribution at total-variation distance greater than . The problem measures the benefit of coherent access without assuming that the sampler discards its garbage or has a particular reversible implementation.
In the classical sampling model, Paninski’s coincidence test [9] identifies the sample scale in the sparse regime: repeated observations reveal departures from uniformity before the full distribution can be learned. Bravyi, Harrow, and Hassidim [2] gave an quantum uniformity tester at constant accuracy for distributions supplied by reversible function oracles. Gilyén and Li [5] developed a framework for purified quantum access that treats classical distributions and quantum states together, with algorithms for closeness, independence, and entropy estimation. These access models differ in the side information exposed by the oracle, so lower bounds must keep the oracle specification explicit.
For purified unitary access, the closeness tester of Luo, Wang, and Li [8] gives an uniformity tester. Canonne, Kothari, and O’Donnell [3] improved the upper bound to and conjectured that it is optimal. More recently, Chen, Wang, and Zhang [4, Theorem 2.3] obtained the lower bound by combining a collision lower bound with quantum sample-to-query lifting. That result captures the optimal dependence on either parameter when the other is fixed, but leaves a gap when both vary. For example, at it gives , whereas the upper bound is .
We prove the matching joint lower bound in the purified unitary model of [3, Section 3.2]. Thus we establish the purified-access assertion of their Conjecture 2. The same conjecture also asks for a lower bound in the stronger quantum string-oracle model, where the oracle evaluates a function reversibly on arbitrary inputs. Our result does not establish that stronger assertion.
The central difficulty is to limit the information available through the entire preparation unitary, rather than just through its prepared state. We choose reflection extensions of phase-randomized purifications and compare the uniform distribution with a symmetric Dirichlet prior. The independent phases provide Fourier indices, and Dirichlet moments specify one normalized radial vector in each Fourier sector. A quadratic cutoff on the label degrees penalizes repeated use of a single label more heavily than use of distinct labels. Spreading each label over many independently phased garbage coordinates makes degree-decreasing transitions sparse.
The proof follows the progress-measure principle of the adversary method [6]; adversary bounds for state-generating oracles and distributional input problems were developed by Belovs [1]. We give the progress argument directly on latent spaces. The problem-specific step is a full-operator norm estimate for the Fourier–Dirichlet construction. In particular, the radial complement of the chosen moment vectors cannot be discarded: an exact Dirichlet covariance identity bounds its contribution. Balancing the cutoff with posterior displacement and posterior fluctuations gives the two parameter regimes. Kutin’s collision lower bound [7] handles the remaining constant-accuracy range.
1.1 The model and the main result
Write , let be the probability simplex on , and let . We use . A valid preparation oracle is a unitary with a designated zero state such that
| (1) |
Measuring the first register samples . The garbage states need not be orthogonal, and the action of away from is unrestricted. The algorithm may apply and ; all its other operations must be independent of the unknown oracle. We also consider algorithms allowed controlled versions of these queries. Each oracle call has unit cost, and oracle-independent computation is free.
Theorem 1.
There is an absolute constant such that, for every integer and , any quantum algorithm that distinguishes
with success probability at least on every valid promised preparation oracle has worst-case query complexity at least
The conclusion remains valid when controlled and controlled are also available.
The success probability can be replaced by any fixed constant strictly between and , at the expense of changing . Together with [3], the theorem determines the bounded-error query complexity up to absolute constant factors. The cube-root expression applies when , and the square-root expression applies when , in each case within the stated range . Both expressions equal at the transition. The case has no nonuniform alternative and is excluded.
The lower bound is a worst-case statement over preparation unitaries, including their garbage spaces. Our hard instances have finite garbage dimension and use only oracle qubits. Every oracle is specified on its entire space, so the proof accounts for queries on arbitrary inputs.
2 A Fourier–Dirichlet adversary
Let be a positive integer, to be chosen later, and set
For and , define
| (2) | ||||
| (3) |
The operator is a Hermitian unitary and satisfies . Its conditional garbage state for label is , which has norm . The state can be encoded as the designated all-zero input, with an extra flag separating it from the output subspace. After embedding in a qubit space, assign the action to unused dimensions.
The construction also works with pairwise orthogonal garbage states. Indeed, apply the known isometry to the output subspace and extend it to an isometric embedding of . Conjugating by this embedding and using on the orthogonal complement gives such an oracle. This extension has zero query difference on the complementary subspace, so it does not affect the norm estimates below.
Let be normalized Haar measure on the phase torus, and let be the symmetric Dirichlet measure on . Under the null prior, and . Under the alternative prior, and independently. We initially allow any ; the application uses . The alternative prior need not be supported entirely on the promise set. In Section 4 we show that it assigns an absolute positive probability to distributions satisfying the strict separation condition.
To analyze an arbitrary tester, introduce inaccessible latent spaces
The initial latent state on each side is the constant function . The oracle acts pointwise on these spaces. Thus the joint state is a square-integrable, vector-valued function of the oracle parameters, and tracing out the latent space gives the algorithm’s state averaged over the corresponding prior. This representation does not give the algorithm access to the parameters.
We prove the lower bound even with controlled queries available. Truncating a tester at its worst-case query bound on promised inputs and padding halted branches with inactive controlled queries gives a fixed number of query steps on all inputs, without changing its behavior on the promise. Intermediate measurements and randomness can be purified and retained in the workspace. We may therefore work with joint pure states throughout, including on inputs outside the promise.
Suppose is a bounded operator satisfying and . For the joint state after queries under prior , set
Initially . Oracle-independent operations commute with and leave unchanged. Write for the pointwise oracle on side . If
| (4) |
then a query changes by at most : the difference of the two progress operators is
Tensoring with an arbitrary workspace preserves the norm bound. For a controlled query, the inactive block has zero difference and the active block is exactly (4). Inverse queries coincide with forward queries for our Hermitian oracles.
Let be the final probability of rejecting uniformity under prior . Decomposing according to the final acceptance and rejection projections, which commute with , and applying Cauchy–Schwarz yields
| (5) |
A constant separation between these output distributions therefore forces a constant fractional decrease in the progress measure, and hence . We will verify the required separation after choosing .
We now construct . For , define
For a degree vector , define and . We abbreviate these by and when is fixed; in particular, . We use for a coordinate vector in and for one in . The rising factorial is for , with . The Dirichlet density is proportional to , so its normalizing integral gives the moments
| (6) |
Set
The functions form an orthonormal basis of , and the functions form an orthonormal family in . Indeed, phase integration separates distinct indices, while normalizes the radial vector in each sector. They are not a basis of : each Fourier sector also contains the radial directions orthogonal to . All inner products below are conjugate-linear in the first argument.
For , define
| (7) |
where . Only finitely many indices satisfy , so is finite-rank. Orthogonality gives and , as required. The sum of squared degrees controls both the total degree and the concentration of degree on any one label.
3 The full query norm bound
Lemma 1.
Proof.
We first reduce the full reflection to its preparation and erasure blocks. Let be the isometry , and write . Relative to the decomposition into and , the oracle is
Define
The lower-right block of the query difference is . Since and are isometries,
| (9) |
In particular, bounding both of these operators controls queries on arbitrary inputs, including inputs orthogonal to the prepared state.
Principal Fourier directions. Let . For a fixed Fourier index with degree vector , set
The measure is , so is its mean. Multiplication by shifts the Fourier index from to . If , this increases by ; we call it a creation direction. The moment ratio in (6) gives the exact identity
| (10) |
If , the shift decreases by ; we call it an erasure direction. In this case define
| (11) |
Here and , so the ratio is well-defined and lies in . The identity shows that the projection of onto has coefficient .
For , distinct input vectors have orthogonal output columns: an output component has coordinates , which determine uniquely. For , the row with output index has input coordinates , and distinct rows have disjoint input blocks. Consequently, the two norms are bounded by the supremum of the Euclidean norms of their column and row coefficients, respectively.
In a creation direction, these coefficients are, respectively,
| (12) |
There are at most such directions for each label . A nonzero coefficient implies . Splitting either coefficient into a change of weight times and a weight times separates the two effects we need to bound. Since , the first contribution is at most
| (13) |
For the second, with square roots taken componentwise,
| (14) |
The first inequality follows by dividing by . Since every weight is at most , the second contribution is bounded by
Thus the creation contribution to either principal norm is at most .
For erasure directions, the coefficients are obtained from (12) by replacing with and with . There are at most coordinates with . If at least one adjacent weight is nonzero, then
To check the boundary case, if , then and . Each erasure coefficient has absolute value at most . Its total contribution to either principal norm is therefore at most
| (15) |
The radial complement. In the Fourier sector , the radial space of is , whereas retains only . Let , suppressing its Fourier factor. For , a creation direction contributes the functional
Indeed, (10) gives , and the constant part vanishes against . The posterior covariance, obtained from the first two Dirichlet moments, is
It follows that the residual vectors have the exact Gram matrix
| (16) |
Thus the map has norm at most . More explicitly, the squared norm of its weighted creation output is at most
Erasure directions give zero on this complement, because . The output blocks for distinct are orthogonal, so
| (17) |
For , fix an output Fourier index with degree vector . Its input in query coordinate has Fourier index . If , the input radial complement is orthogonal to , so (10) makes its contribution zero. If , the input degree vector is . Put
The residual of orthogonal to is
Under the Dirichlet posterior with degree vector , the mean of is and the total parameter is . Hence
Different query coordinates are orthogonal input blocks, and at most of them have . The norm of this output row is at most
Distinct output rows have disjoint input blocks, including their full radial spaces. Therefore
| (18) |
4 Completing the lower bound
To turn the operator estimate into a testing lower bound, we need enough mass on the strict alternative. The following dimension-uniform estimate allows us to take proportional to , even for small .
Lemma 2.
If , , and , then
Proof.
Fix and let . Its variance is
where we used and . The marginal has distribution , with . Expanding the centered fourth moment using for gives
For the first inequality, discard the negative term in the numerator, use , and note that . Hölder’s inequality gives , and hence
For , it follows that
The Paley–Zygmund inequality now yields
Since , this proves the claim. ∎
Proof of Theorem 1.
First suppose , and choose
Lemma 2 gives . In particular, the alternative prior assigns probability at least to the strict promise .
Let be the original algorithm’s worst-case query count, and amplify its success probability by nine independent repetitions and majority vote. The error on any promised input is at most . After truncation and padding as in Section 2, the amplified algorithm uses query steps on all inputs. Put . Its average rejection probabilities satisfy
We make no assumption about its answers outside the promise. By (5) and ,
Since and each query changes the progress by at most , this implies , and therefore .
It remains to choose the cutoff. If , take . Then
Lemma 1 gives and . If , take . Each term in (8) is then , giving . Together these estimates show
| (21) |
Substituting yields
The constants are absolute, including near ; absorbing the fixed powers of does not require the two cutoffs to meet at exactly that value.
Now suppose . By Kutin’s collision lower bound [7, Theorem 1.1], for , distinguishing a one-to-one function from a four-to-one function requires standard quantum function queries. For , set and consider the preparation
| (22) |
It is a valid oracle of the form (1). If is one-to-one, the output distribution is exactly . If is four-to-one, labels have probability , another labels have probability zero, and the remaining labels have probability . Its distance from uniform is therefore
The inequality follows by writing with and .
For completeness, the full preparation unitary and its inverse and controlled versions all require only function queries. Prepare a uniform superposition of by a known unitary. Reversibly evaluate for into a scratch register, using a fixed legal dummy input to when . Copy the appropriate value, either or , into the output register and uncompute the scratch register. This specifies a unitary circuit for (22), with clean scratch registers on its designated input. Reversing the circuit implements its inverse. To control a function evaluation, compute its value unconditionally into scratch space, conditionally add that value to the target register, and uncompute. Thus controlled evaluations also cost standard queries; for an additive function oracle, its inverse is obtained by conjugating with negation of the target register. Consequently, a uniformity tester with the permitted query types would give a collision tester at constant-factor query overhead. Kutin’s bound therefore implies .
For , uniformity and a point mass are distinct promised inputs, since the latter has distance from uniform. No zero-query algorithm distinguishes them with success probability on both, giving for these finitely many values of . Finally, throughout the constant-accuracy range,
so this completes the lower bound for all parameters.
In the Dirichlet construction we may choose . Our choices satisfy , and , so encoding the label and garbage registers, including the optional label copy, takes qubits. The collision construction uses oracle qubits. This also verifies the stated finite-register realization of the hard instances. ∎
References
- [1] Aleksandrs Belovs. Quantum algorithms for classical probability distributions. In 27th Annual European Symposium on Algorithms (ESA 2019), LIPIcs, volume 144, pages 16:1–16:11, 2019. doi:10.4230/LIPIcs.ESA.2019.16.
- [2] Sergey Bravyi, Aram W. Harrow, and Avinatan Hassidim. Quantum algorithms for testing properties of distributions. IEEE Transactions on Information Theory, 57(6):3971–3981, 2011. doi:10.1109/TIT.2011.2134250.
- [3] Clément L. Canonne, Robin Kothari, and Ryan O’Donnell. Uniformity testing when you have the source code. In 20th Conference on the Theory of Quantum Computation, Communication and Cryptography (TQC 2025), LIPIcs, volume 350, pages 7:1–7:20, 2025. doi:10.4230/LIPIcs.TQC.2025.7.
- [4] Kean Chen, Qisheng Wang, and Zhicheng Zhang. A list of complexity bounds for property testing by quantum sample-to-query lifting. Preprint, arXiv:2512.01971, 2025. arXiv:2512.01971.
- [5] András Gilyén and Tongyang Li. Distributional property testing in a quantum world. In 11th Innovations in Theoretical Computer Science Conference (ITCS 2020), LIPIcs, volume 151, pages 25:1–25:19, 2020. doi:10.4230/LIPIcs.ITCS.2020.25.
- [6] Peter Høyer, Troy Lee, and Robert Špalek. Negative weights make adversaries stronger. In Proceedings of the 39th Annual ACM Symposium on Theory of Computing (STOC 2007), pages 526–535, 2007. doi:10.1145/1250790.1250867.
- [7] Samuel Kutin. Quantum lower bound for the collision problem with small range. Theory of Computing, 1(2):29–36, 2005. doi:10.4086/toc.2005.v001a002.
- [8] Jingquan Luo, Qisheng Wang, and Lvzhou Li. Succinct quantum testers for closeness and -wise uniformity of probability distributions. IEEE Transactions on Information Theory, 70(7):5092–5103, 2024. doi:10.1109/TIT.2024.3393756.
- [9] Liam Paninski. A coincidence-based test for uniformity given very sparsely sampled discrete data. IEEE Transactions on Information Theory, 54(10):4750–4755, 2008. doi:10.1109/TIT.2008.928987.