return RewriteResponse(REWRITE_DONE, working);
}
+ RewriteResponse leqId(TNode node, bool isPreRewrite)
+ {
+ Assert(node.getKind() == kind::FLOATINGPOINT_LEQ);
+
+ if (node[0] == node[1])
+ {
+ NodeManager *nm = NodeManager::currentNM();
+ return RewriteResponse(
+ isPreRewrite ? REWRITE_DONE : REWRITE_AGAIN_FULL,
+ nm->mkNode(kind::NOT,
+ nm->mkNode(kind::FLOATINGPOINT_ISNAN, node[0])));
+ }
+ return RewriteResponse(REWRITE_DONE, node);
+ }
+
+ RewriteResponse ltId(TNode node, bool isPreRewrite)
+ {
+ Assert(node.getKind() == kind::FLOATINGPOINT_LT);
+
+ if (node[0] == node[1])
+ {
+ return RewriteResponse(REWRITE_DONE,
+ NodeManager::currentNM()->mkConst(false));
+ }
+ return RewriteResponse(REWRITE_DONE, node);
+ }
+
}; /* CVC4::theory::fp::rewrite */
/******** Comparisons ********/
preRewriteTable[kind::FLOATINGPOINT_EQ] = rewrite::then<rewrite::breakChain,rewrite::ieeeEqToEq>;
- preRewriteTable[kind::FLOATINGPOINT_LEQ] = rewrite::breakChain;
- preRewriteTable[kind::FLOATINGPOINT_LT] = rewrite::breakChain;
+ preRewriteTable[kind::FLOATINGPOINT_LEQ] =
+ rewrite::then<rewrite::breakChain, rewrite::leqId>;
+ preRewriteTable[kind::FLOATINGPOINT_LT] =
+ rewrite::then<rewrite::breakChain, rewrite::ltId>;
preRewriteTable[kind::FLOATINGPOINT_GEQ] = rewrite::then<rewrite::breakChain,rewrite::geqToleq>;
preRewriteTable[kind::FLOATINGPOINT_GT] = rewrite::then<rewrite::breakChain,rewrite::gtTolt>;
/******** Comparisons ********/
postRewriteTable[kind::FLOATINGPOINT_EQ] = rewrite::removed;
- postRewriteTable[kind::FLOATINGPOINT_LEQ] = rewrite::identity;
- postRewriteTable[kind::FLOATINGPOINT_LT] = rewrite::identity;
+ postRewriteTable[kind::FLOATINGPOINT_LEQ] = rewrite::leqId;
+ postRewriteTable[kind::FLOATINGPOINT_LT] = rewrite::ltId;
postRewriteTable[kind::FLOATINGPOINT_GEQ] = rewrite::removed;
postRewriteTable[kind::FLOATINGPOINT_GT] = rewrite::removed;