A mathematical theory of chromosomal rearrangements