Initial implementation of factor; note that some functionality (e.g. forall) is still missing. Fixed a bug in rm_equalRel where the tuples were not sorted before the equality check.