Quantum counting is a fundamental quantum algorithm that estimates the fraction of marked elements using a membership oracle, achieving a quadratic speedup over classical sampling. The membership oracle, however, assumes exact labeling of each element, but this assumption fails when the labels are inherently probabilistic. We study quantum counting with \emph{Bernoulli oracles}, where given m Bernoulli distributions with unknown biases p1,…,pm and a gap parameter Δ, the goal is to estimate the fraction ρ of \emph{positive} distributions (pi≥1/2+Δ) to within additive error ε. We prove an upper bound of O~(Δερ+Δε1) queries, achieving a quadratic speedup over the classical sample complexity. % of Θ(ρ/Δ2ε2).
Our algorithm first uses the Quantum Singular Value Transformation (QSVT) to coherently amplify the bias gap without collapsing the superposition over distributions, and then applies two-stage adaptive amplitude estimation. We complement this upper bound with a near-matching lower bound of Ω(ρ/(Δε)) via a new composition theorem for the quantum adversary method in the Boolean-over-average-case direction. For the special case of a constant gap Δ=Θ(1), which corresponds to the bounded-error oracle where each query returns the correct label with constant probability, our bounds specialize to O~(ερ+ε1) and Ω(ερ), thereby characterizing the query complexity of quantum counting with bounded-error oracles.
In this paper, we analyze the quantum counting under the decoherence, which can find the number of solutions satisfying a given oracle. We investigate probability distributions related to the first order term of the error rate on the quantum counting with the depolarizing channel. We also implement two circuits for the quantum counting -- the ascending-order circuit and the descending-order circuit -- by reversing ordering of application of controlled-Grover operations. By theoretical and numerical calculations for probability distributions, we reveal the difference of probability distributions on two circuits in the presence of decoherence and show that the ascending-order circuit is more robust against the decoherence than the descending-order circuit. This property of the robustness is applicable to the phase estimation such as the factoring.