implement equivalent sorts

Very crude first implementation. Some tests are expected to fail. Not ready for merge.

@yilongli @andreistefanescu can you have a look?
I suggest you set a larger limit in your IDE, we agreed in the past that we should not collapse import statements like these