implement equivalent sorts

Very crude first implementation. Some tests are expected to fail. Not ready for merge.

@yilongli @andreistefanescu can you have a look?
A ```Poset``` should be generic enough to have nothing to do with ```Sort```.