  It follows from the famous Fagin's theorem that all problems in NP are
expressible in existential second-order logic (ESO), and vice versa. Indeed,
there are well-known ESO characterizations of NP-complete problems such as
3-colorability, Hamiltonicity and clique. Furthermore, the ESO sentences that
characterize those problems are simple and elegant. However, there are also NP
problems that do not seem to possess equally simple and elegant ESO
characterizations. In this work, we are mainly interested in this latter class
of problems. In particular, we characterize in second-order logic the class of
hypercube graphs and the classes SATQBF_k of satisfiable quantified Boolean
formulae with k alternations of quantifiers. We also provide detailed
descriptions of the strategies followed to obtain the corresponding nontrivial
second-order sentences. Finally, we sketch a third-order logic sentence that
defines the class SATQBF = \bigcup_{k \geq 1} SATQBF_k. The sub-formulae used
in the construction of these complex second- and third-order logic sentences,
are good candidates to form part of a library of formulae. Same as libraries of
frequently used functions simplify the writing of complex computer programs, a
library of formulae could potentially simplify the writing of complex second-
and third-order queries, minimizing the probability of error.
