  We introduce a notion of the quantum query complexity of a certificate
structure. This is a formalisation of a well-known observation that many
quantum query algorithms only require the knowledge of the disposition of
possible certificates in the input string, not the precise values therein.
  Next, we derive a dual formulation of the complexity of a non-adaptive
learning graph, and use it to show that non-adaptive learning graphs are tight
for all certificate structures. By this, we mean that there exists a function
possessing the certificate structure and such that a learning graph gives an
optimal quantum query algorithm for it.
  For a special case of certificate structures generated by certificates of
bounded size, we construct a relatively general class of functions having this
property. The construction is based on orthogonal arrays, and generalizes the
quantum query lower bound for the $k$-sum problem derived recently in
arXiv:1206.6528.
  Finally, we use these results to show that the learning graph for the
triangle problem from arXiv:1210.1014 is almost optimal in these settings. This
also gives a quantum query lower bound for the triangle-sum problem.
