}else{
return RewriteResponse(REWRITE_DONE, t);
}
- }else if(t[0].getKind() == kind::PLUS ){
+ }
+ else if (t[0].getKind() == kind::PLUS)
+ {
std::vector<Node> product;
- for( unsigned i=0; i<t[0].getNumChildren(); i++ ){
- product.push_back(nm->mkNode(kind::EXPONENTIAL, t[0][i]));
+ for (const Node tc : t[0])
+ {
+ product.push_back(nm->mkNode(kind::EXPONENTIAL, tc));
}
- return RewriteResponse(REWRITE_AGAIN, nm->mkNode(kind::MULT, product));
+ // We need to do a full rewrite here, since we can get exponentials of
+ // constants, e.g. when we are rewriting exp(2 + x)
+ return RewriteResponse(REWRITE_AGAIN_FULL,
+ nm->mkNode(kind::MULT, product));
}
}
break;
regress0/arith/issue1399.smt2
regress0/arith/issue3412.smt2
regress0/arith/issue3413.smt2
+ regress0/arith/issue3683.smt2
regress0/arith/ite-lift.smt2
regress0/arith/leq.01.smtv1.smt2
regress0/arith/miplib.cvc
--- /dev/null
+(set-logic ALL)
+(declare-fun a () Real)
+(assert (= (+ 2 (exp (+ 2 a))) 0))
+(set-info :status unsat)
+(check-sat)
void testIntNormalForm() {
Node x = d_nm->mkVar(*d_intType);
+ Node xr = d_nm->mkVar(*d_realType);
Node c0 = d_nm->mkConst<Rational>(d_zero);
Node c1 = d_nm->mkConst<Rational>(d_one);
Node c2 = d_nm->mkConst<Rational>(Rational(2));
// (abs x) --> (abs x)
Node absX = d_nm->mkNode(ABS, x);
TS_ASSERT_EQUALS(Rewriter::rewrite(absX), absX);
+
+ // (exp (+ 2 + x)) --> (* (exp x) (exp 1) (exp 1))
+ Node t = d_nm->mkNode(EXPONENTIAL, d_nm->mkNode(PLUS, c2, xr)).eqNode(c0);
+ TS_ASSERT_EQUALS(Rewriter::rewrite(Rewriter::rewrite(t)),
+ Rewriter::rewrite(t));
}
};