switch(n.getKind()) {
case kind::TYPE_CONSTANT:
switch(n.getConst<TypeConstant>()) {
- case BOOLEAN_TYPE: out << "Boolean"; break;
+ case BOOLEAN_TYPE: out << "Bool"; break;
case REAL_TYPE: out << "Real"; break;
case INTEGER_TYPE: out << "Int"; break;
default:
case kind::CONST_INTEGER: {
Integer i = n.getConst<Integer>();
if(i < 0) {
- out << "(- " << i << ')';
+ out << "(- " << -i << ')';
} else {
out << i;
}
case kind::CONST_RATIONAL: {
Rational r = n.getConst<Rational>();
if(r < 0) {
- out << "(- " << r << ')';
+ if(r.getDenominator() == 1) {
+ out << "(- " << -r << ')';
+ } else {
+ out << "(- (/ " << (-r).getNumerator() << ' ' << (-r).getDenominator() << "))";
+ }
} else {
- out << r;
+ if(r.getDenominator() == 1) {
+ out << r;
+ } else {
+ out << "(/ " << r.getNumerator() << ' ' << r.getDenominator() << ')';
+ }
}
break;
}
+
default:
// fall back on whatever operator<< does on underlying type; we
// might luck out and be SMT-LIB v2 compliant
case kind::MINUS:
case kind::UMINUS:
case kind::DIVISION:
+ case kind::INTS_DIVISION:
+ case kind::INTS_MODULUS:
case kind::LT:
case kind::LEQ:
case kind::GT:
case kind::MINUS: return "-";
case kind::UMINUS: return "-";
case kind::DIVISION: return "/";
+ case kind::INTS_DIVISION: return "div";
+ case kind::INTS_MODULUS: return "mod";
case kind::LT: return "<";
case kind::LEQ: return "<=";
case kind::GT: return ">";