Mathematical Preliminaries for Lossless compression