  We consider the light scattering from ultracold atoms trapped in an optical
lattice inside a cavity. In such a system, both the light and atomic motion
should be treated in a fully quantum mechanical way. The unitary evolution of
the light-matter quantum state is shown to demonstrate the non-trivial phase
dependence, quadratic in the atom number. This is essentially due to the
dynamical self-consistent nature of the light modes assumed in our model. The
collapse of the quantum state during the photocounting process is analyzed as
well. It corresponds to the measurement-induced atom number squeezing. We show
that, at the final stage of the state collapse, the shrinking of the width of
the atom number distribution behaves exponentially in time. This is much faster
than the square root time dependence, obtained for the initial stage of the
state collapse. The exponentially fast squeezing appears due to the discrete
nature of the atom number distribution.
