Mathematical Theory and Biological Applications of Diversity