  We define a new query measure we call quantum distinguishing complexity,
denoted QD(f) for a Boolean function f. Unlike a quantum query algorithm, which
must output a state close to |0> on a 0-input and a state close to |1> on a
1-input, a "quantum distinguishing algorithm" can output any state, as long as
the output states for any 0-input and 1-input are distinguishable.
  Using this measure, we establish a new relationship in query complexity: For
all total functions f, Q_0(f)=O~(Q(f)^5), where Q_0(f) and Q(f) denote the
zero-error and bounded-error quantum query complexity of f respectively,
improving on the previously known sixth power relationship.
  We also define a query measure based on quantum statistical zero-knowledge
proofs, QSZK(f), which is at most Q(f). We show that QD(f) in fact lower bounds
QSZK(f) and not just Q(f). QD(f) also upper bounds the (positive-weights)
adversary bound, which yields the following relationships for all f: Q(f) >=
QSZK(f) >= QS(f) = Omega(Adv(f)). This sheds some light on why the adversary
bound proves suboptimal bounds for problems like Collision and Set Equality,
which have low QSZK complexity.
  Lastly, we show implications for lifting theorems in communication
complexity. We show that a general lifting theorem for either zero-error
quantum query complexity or for QSZK would imply a general lifting theorem for
bounded-error quantum query complexity.
