basic implementation of  a merge sort and a invariance finder that piggybacks on the same concept