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 agree with @yilongli . An alternative is to keep for each set of equivalent sorts a representative, and then have a ```HashMap``` from each sort to the representative of the equivalence class. The ```relations``` should only contain pairs of representatives of equivalence classes.