  We study how Thomson's formulation of the second law: no work is extracted
from an equilibrium ensemble by a cyclic process, emerges in the quantum
situation through the averaging over fluctuations of work. The latter concept
is carefully defined for an ensemble of quantum systems interacting with
macroscopic sources of work. The approach is based on first splitting a mixed
quantum ensemble into pure subensembles, which according to quantum mechanics
are maximally complete and irreducible. The splitting is done by filtering the
outcomes of a measurement process. A critical review is given of two other
approaches to fluctuations of work proposed in the literature. It is shown that
in contrast to those ones, the present definition {\it i)} is consistent with
the physical meaning of the concept of work as mechanical energy lost by the
macroscopic sources, or, equivalently, as the average energy acquired by the
ensemble; {\it ii)} applies to an arbitrary non-equilibrium state. There is no
direct generalization of the classical work-fluctuation theorem to the proper
quantum domain. This implies some non-classical scenarios for the emergence of
the second law.

Statistical Mechanics