A theory solver for difference logic