  In the oracle identification problem, we are given oracle access to an
unknown N-bit string x promised to belong to a known set C of size M and our
task is to identify x. We present a quantum algorithm for the problem that is
optimal in its dependence on N and M. Our algorithm considerably simplifies and
improves the previous best algorithm due to Ambainis et al. Our algorithm also
has applications in quantum learning theory, where it improves the complexity
of exact learning with membership queries, resolving a conjecture of Hunziker
et al.
  The algorithm is based on ideas from classical learning theory and a new
composition theorem for solutions of the filtered $\gamma_2$-norm semidefinite
program, which characterizes quantum query complexity. Our composition theorem
is quite general and allows us to compose quantum algorithms with
input-dependent query complexities without incurring a logarithmic overhead for
error reduction. As an application of the composition theorem, we remove all
log factors from the best known quantum algorithm for Boolean matrix
multiplication.
