Randomized query algorithms for Deutsch–Jozsa #
Deterministically, the Deutsch–Jozsa promise problem over N = 2m positions needs m + 1
queries (CslibFrontier/Computability/QueryComplexity/DeutschJozsa.lean). With randomness and a
small error it needs only a constant number. de Wolf, §2.4.1 observes that querying
two random positions and answering "constant" exactly when the two bits agree is always correct
on constant inputs and correct with probability 1/2 on balanced inputs. So the quantum–classical
separation for this problem holds only for exact algorithms.
Here the randomized algorithm Cslib.QueryComplexity.randomDeutschJozsa k draws k positions
independently and uniformly, with replacement, queries them, and answers whether the bits read are
all equal. It makes at most k queries. It never errs on a constant input. On a balanced input it
errs exactly when all k positions fall among the N/2 true positions or all among the N/2 false
ones, which has probability 2 · (1/2)^k = 2/2^k for k ≥ 1
(Cslib.QueryComplexity.errorProb_randomDeutschJozsa_of_isBalanced). For k = 2 this is the
error 1/2 of de Wolf's remark. For k = 3 the error 1/4 is below the usual bounded-error
threshold 1/3, against m + 1 deterministic queries
(Cslib.QueryComplexity.randomDeutschJozsa_separation).
The library's Cslib.QueryComplexity.randomizedComplexity asks for small error on every input,
while the Deutsch–Jozsa problem is a promise problem. So these bounds are stated for the error on
the promise inputs, as in the deterministic module.
Main definitions #
Cslib.QueryComplexity.randomDeutschJozsa: querykrandom positions and answer whether the bits read are all equal.
Main results #
Cslib.QueryComplexity.depth_randomDeutschJozsa_le: the algorithm makes at mostkqueries.Cslib.QueryComplexity.errorProb_randomDeutschJozsa_const: no error on constant inputs.Cslib.QueryComplexity.errorProb_randomDeutschJozsa_of_isBalanced: error exactly2/2^kon balanced inputs.Cslib.QueryComplexity.randomDeutschJozsa_separation: three random queries with error at most1/4on the promise, againstm + 1deterministic queries.
References #
Query k positions drawn independently and uniformly at random, and answer whether the bits
read are all equal.
The algorithm randomDeutschJozsa k makes at most k queries.
randomDeutschJozsa k never errs on a constant input.
On a balanced input x, 2 · weight(x)^k of the (2 · weight(x))^k position tuples read
bits that are all equal.
The error on balanced inputs: for k ≥ 1, randomDeutschJozsa k errs on a balanced
input with probability exactly 2/2^k. For k = 2 this is the error 1/2 of
de Wolf, §2.4.1.
The error on the promise: randomDeutschJozsa k errs with probability at most 2/2^k on
every constant or balanced input.
Deutsch–Jozsa is easy with bounded error de Wolf, §2.4.1: over N = 2m
positions, three random queries solve the promise problem with error at most 1/4 < 1/3, while
every deterministic decision tree needs m + 1 queries.