Sortcheck: Code for Checking Refinement Well-formedness