Mathematical theory of entropy