|| k == kind::DIVISIBLE;
}
-RewriteResponse ArithRewriter::rewriteConstant(TNode t){
- Assert(t.isConst());
- Assert(t.getKind() == CONST_RATIONAL || t.getKind() == CONST_INTEGER);
-
- return RewriteResponse(REWRITE_DONE, t);
-}
-
-RewriteResponse ArithRewriter::rewriteRAN(TNode t)
-{
- Assert(t.getKind() == REAL_ALGEBRAIC_NUMBER);
-
- const RealAlgebraicNumber& r =
- t.getOperator().getConst<RealAlgebraicNumber>();
- if (r.isRational())
- {
- return RewriteResponse(
- REWRITE_DONE, NodeManager::currentNM()->mkConstReal(r.toRational()));
- }
-
- return RewriteResponse(REWRITE_DONE, t);
-}
-
-RewriteResponse ArithRewriter::rewriteVariable(TNode t)
-{
- Assert(t.isVar());
-
- return RewriteResponse(REWRITE_DONE, t);
-}
-
RewriteResponse ArithRewriter::rewriteNeg(TNode t, bool pre)
{
Assert(t.getKind() == kind::NEG);
RewriteResponse ArithRewriter::preRewriteTerm(TNode t){
if(t.isConst()){
- return rewriteConstant(t);
+ return RewriteResponse(REWRITE_DONE, t);
}else if(t.isVar()){
return rewriteVariable(t);
}else{
RewriteResponse ArithRewriter::postRewriteTerm(TNode t){
if(t.isConst()){
- return rewriteConstant(t);
+ return RewriteResponse(REWRITE_DONE, t);
}else if(t.isVar()){
return rewriteVariable(t);
}else{
}
}
+RewriteResponse ArithRewriter::rewriteRAN(TNode t)
+{
+ Assert(rewriter::isRAN(t));
+ const RealAlgebraicNumber& r = rewriter::getRAN(t);
+ if (r.isRational())
+ {
+ return RewriteResponse(REWRITE_DONE, rewriter::mkConst(r.toRational()));
+ }
+ return RewriteResponse(REWRITE_DONE, t);
+}
+
+RewriteResponse ArithRewriter::rewriteVariable(TNode t)
+{
+ Assert(t.isVar());
+
+ return RewriteResponse(REWRITE_DONE, t);
+}
RewriteResponse ArithRewriter::preRewritePlus(TNode t)
{
static RewriteResponse preRewriteTerm(TNode t);
static RewriteResponse postRewriteTerm(TNode t);
- static RewriteResponse rewriteConstant(TNode t);
+ /** rewrite real algebraic numbers */
static RewriteResponse rewriteRAN(TNode t);
+ /** rewrite variables */
static RewriteResponse rewriteVariable(TNode t);
/** rewrite unary minus */