  The problem of joint detection and lossless source coding is considered. We
derive asymptotically optimal decision rules for deciding whether or not a
sequence of observations has emerged from a desired information source, and to
compress it if has. In particular, our decision rules asymptotically minimize
the cost of compression in the case that the data has been classified as
`desirable', subject to given constraints on the two kinds of the probability
of error. In another version of this performance criterion, the constraint on
the false alarm probability is replaced by the a constraint on the cost of
compression in the false alarm event. We then analyze the asymptotic
performance of these decision rules and demonstrate that they may exhibit
certain phase transitions. We also derive universal decision rules for the case
where the underlying sources (under either hypothesis or both) are unknown, and
training sequences from each source may or may not be available. Finally, we
discuss how our framework can be extended in several directions.
