fixed Term#compareTo to conform to its general contract

fixed https://github.com/kframework/k/issues/1073

@dwightguth please review