invariants for mergesort