  Traditional derivation of Gibbs canonical distribution and the justification
of thermodynamics are based on the assumption concerning an isoenergetic
ergodicity of a system of $n$ weakly interacting identical subsystems and
passage to the limit $n\to\infty$. In the presented work we develop another
approach to these problems assuming that $n$ is fixed and $n\ge2$. The ergodic
hypothesis (which frequently is not valid due to known results of the
KAM-theory) is substituted by a weaker assumption that the perturbed system
does not have additional first integrals independent of the energy integral.
The proof of nonintegrability of perturbed Hamiltonian systems is based on the
Poincare method. Moreover, we use the natural Gibbs assumption concerning a
thermodynamic equilibrium of bsystems at vanishing interaction. The general
results are applied to the system of the weakly connected pendula. The
averaging with respect to the Gibbs measure allows to pass from usual dynamics
of mechanical systems to the classical thermodynamic model.
