Foundations of the theory of probability