5. Query Complexity I
Let us now change our focus from the last few lectures and dive into complexity theoretic questions related to specific models of computation. We begin with randomized query complexity.
Query Complexity
Query complexity considers the simple computational model where an algorithm gets some input
In the query model, the input
Query complexity is also called decision tree complexity because query algorithms have a natural representation as decision trees.
In our setting of Boolean values, decision trees are rooted binary trees whose internal nodes are each labelled with an index in
The cost of a deterministic algorithm on a given input corresponds to the depth of the leaf in its tree reached by that input. And so the worst-case cost of a deterministic algorithm corresponds to the height (or maximum depth) of the corresponding decision tree. A randomized algorithm in the query complexity setting corresponds to a distribution over decision trees. The worst-case and average-case costs of randomized algorithms and the corresponding query complexity measures of functions follow the definitions introduced in the Definitions lecture.
Our ultimate goal in studying randomized query complexity is a complete understanding of the query complexity of all functions.
There are many other interesting questions we can ask along the way:
Which functions have “small” query complexity?
(Here “small” can be interpreted as constant, logarithmic in the length
Does randomness even help in the query complexity setting?
As we will see, even this preliminary question is far from trivial; it corresponds to the task of proving (the existence or absence of) separations between deterministic and randomized query complexity.
Separations between and
There are two ways that randomness might help reduce the query complexity of specific functions. First, it might be that the average cost of randomized decision trees is less than the worst-case cost for some functions. Second, it might be that allowing for some bounded error probability makes the computation of some functions much easier. We examine both of these possible sources of efficiency improvement separately.
If we consider partial functions
Theorem 1. There exists a partial function
, for which
One way to design a partial function to prove Theorem 1 is to construct a natural extension of a search problem where there are many copies of the element we’re trying to find.
Specifically, partition the
If we consider total functions, however, the situation is very different: in this case, there can be at most a quadratic gap between the deterministic and zero-error randomized query complexity.
Theorem 2. For every Boolean function
,
The easiest way to prove this theorem, somewhat counter-intuitively, is to prove an even stronger bound.
A certificate for an input
Note that an algorithm (deterministic or randomized) that computes
Lemma 3. For every function
, .
We can also further refine the notion of certificate complexity by considering certificates for 0-valued and 1-valued inputs separately:
These measures correspond to the DNF width and CNF width complexity of
Theorem 4. For every function
,
The key observation at the heart of the proof of this theorem is the following: for any
So we know that the deterministic and zero-error randomized query complexities of total functions can not be arbitrarily far apart from each other… but could we strengthen the lower bound even further, or is there a polynomial separation between the two measures for some functions?
Recursive NAND function
If you stop and really try to answer the last question from scratch, you may find that it is not as easy as one might think to find a total function for which a separation exists. For a very large number of Boolean functions (like the Majority function, AND or OR functions, dictator functions, XOR function, etc.) there is in fact at most a constant-factor gap between their deterministic and zero-error randomized query complexities. To find an asymptotic separation, it appears that we have to design a function specifically with our goal in mind. As it turns out, binary trees are a great way to do that.
Consider the binary NAND gate: it takes in two binary inputs, and outputs 1 if and only if the two inputs are not both 1.
We can obtain a Boolean function on
We can see how randomness might help reduce our query complexity if we start to evaluate this function: to compute the value of the output of the function, we must first compute the value of one of the two NAND gates below the root gate. If this lower NAND gate evaluates to 1, then we need to evaluate the other second-level NAND gate because it’s value will determine the value of the function. But if the first lower NAND gate evaluates to 0, then there is no need to evaluate its sibling gate: we already know that the output of the root gate will be 1.
If we have a deterministic algorithm, the above observation does not help, because an adversary can fix the values of the input bits in a way that will always force the value of the first of two sibling NAND gates to evaluate to 1. But with randomness, for every NAND gate that evaluates to 1, if we choose uniformly at random which of its children gates to evaluate first, we have probability at least 1/2 of choosing one that evaluates to 0 and saves us from having to evaluate its sibling gate. Using this strategy recursively, we obtain the following separation result.
Theorem 5. For every
, the function on variables satisfies and
Saks and Wigderson (1986) showed that the above upper bound on the zero-error randomized query complexity of the recursive NAND function is tight. They also conjectured that this separation between deterministic and zero-error randomized query complexity was optimal. This conjecture remained open for nearly 30 years.
Shortcut functions
The conjecture of Saks and Wigderson remained open for around 30 years, until the optimal separation (up to logarithmic factors) was recently established by Ambainis, Balodis, Belovs, Lee, Santha, and Smotrovs (2017). They showed that (ignoring once again logarithmic factors) the quadratic separation between deterministic and zero-error randomized query complexity does indeed occur for some total Boolean functions.
One of the main insights that led to the breakthrough was the observation that to construct functions with a very large gap between deterministic and zero-error randomized query complexity, we should move away from recursively-defined functions like the NAND function above and instead look for functions that include “shortcuts” that can only be used effectively by randomized algorithms.
This idea of using “shortcuts” to separate two measures of complexity arises naturally in some settings.
For example, if we want to obtain a separation between
but
because the first array has more than one column with all 1’s while the second one has none.
With an adversary argument, we can show that
Göös, Pitassi, and Watson (2015) were the first to show the real power of “shortcut” functions. They were interested in separating deterministic query complexity from unambiguous 1-certificate complexity, a variant of the 1-certificate complexity measure described above that is also known as partition complexity. For this complexity measure, the function above does not give a reasonable separation, but the key observation that they made was that we don’t need to restrict ourselves just to have values in each entry of the table. That is, we can consider tables that have some value entries and additional information like pointers to other cells in the table. This idea is remarkably powerful.
For randomized query complexity, we can implement the shortcut idea by taking a function that evaluates to 1 if and only if the table contains exactly one column whose values are all ones and where exactly one of the entries in this column is the root of a binary tree whose nodes are 0-entries of all of the other columns. With this construction (and after handling all the related technical issues), we obtain the following separation result.
Theorem 6. There is a total function
that satisfies
See the original paper for all the technical details along with a more detailed discussion of the intuition behind the construction.
Theorems 2 and 6 match up to logarithmic factors, giving us an essentially complete picture of the maximum separation possible between the deterministic and zero-error randomized query complexities of total Boolean functions. But we should emphasize that our understanding of deterministic vs. zero-error randomized query complexity is still far from complete. For example, we don’t even know what is the exact zero-error randomized complexity of the recursive 3-Majority function, the function that we obtain when we replace the binary tree of NAND gates in the recursive NAND function with a ternary tree with Majority-of-3 gates.
But instead of diving deeper in this direction, let us instead explore another equally fundamental question: does giving randomized algorithms the ability to err with some bounded probability also help reduce query complexity, or are all the savings obtainable by randomness strictly due to the average-case vs. worst-case cost model?