  Kirkwood-Dirac representations of quantum states are increasingly finding use
in many areas within quantum theory. Usually, representations of this sort are
only applied to provide a representation of quantum states (as complex
functions over some set). We show how standard Kirkwood-Dirac representations
can be extended to a fully compositional representation of all of quantum
theory (including channels, measurements and so on), and prove that this
extension satisfies the essential features of functoriality (namely, that the
representation commutes with composition of channels), linearity, and
quasistochasticity. Interestingly, the representation of a POVM element is
uniquely picked out to be the collection of weak values for it relative to the
bases defining the representation. We then prove that if one can find any
Kirkwood-Dirac representation that is everywhere real and nonnegative for a
given experimental scenario or fragment of quantum theory, then the scenario or
fragment is consistent with the principle of generalized noncontextuality, a
key notion of classicality in quantum foundations. We also show that the
converse does not hold: even if one verifies that all Kirkwood-Dirac
representations (as defined herein) of an experiment require negativity or
imaginarity, one cannot generally conclude that the experiment witnesses
contextuality.
