UremOne,
UremSelf,
ShiftZero,
+ UgtUrem,
UltOne,
SltZero,
case UremOne : out << "UremOne"; return out;
case UremSelf : out << "UremSelf"; return out;
case ShiftZero : out << "ShiftZero"; return out;
+ case UgtUrem: out << "UgtUrem"; return out;
case SubEliminate : out << "SubEliminate"; return out;
case CompEliminate : out << "CompEliminate"; return out;
case XnorEliminate : out << "XnorEliminate"; return out;
RewriteRule<SdivEliminate> rule143;
RewriteRule<SremEliminate> rule144;
RewriteRule<SmodEliminate> rule145;
+ RewriteRule<UgtUrem> rule146;
};
template<> inline
#pragma once
+#include "options/bv_options.h"
#include "theory/bv/theory_bv_rewrite_rules.h"
#include "theory/bv/theory_bv_utils.h"
#include "theory/rewriter.h"
/* -------------------------------------------------------------------------- */
+/**
+ * UgtUrem
+ *
+ * (bvugt (bvurem T x) x)
+ * ==> (ite (= x 0_k) (bvugt T x) false)
+ * ==> (and (=> (= x 0_k) (bvugt T x)) (=> (not (= x 0_k)) false))
+ * ==> (and (=> (= x 0_k) (bvugt T x)) (= x 0_k))
+ * ==> (and (bvugt T x) (= x 0_k))
+ * ==> (and (bvugt T 0_k) (= x 0_k))
+ */
+
+template <>
+inline bool RewriteRule<UgtUrem>::applies(TNode node)
+{
+ return (options::bitvectorDivByZeroConst()
+ && node.getKind() == kind::BITVECTOR_UGT
+ && node[0].getKind() == kind::BITVECTOR_UREM_TOTAL
+ && node[0][1] == node[1]);
+}
+
+template <>
+inline Node RewriteRule<UgtUrem>::apply(TNode node)
+{
+ Debug("bv-rewrite") << "RewriteRule<UgtUrem>(" << node << ")" << std::endl;
+ const Node& T = node[0][0];
+ const Node& x = node[1];
+ Node zero = utils::mkConst(utils::getSize(x), 0);
+ NodeManager* nm = NodeManager::currentNM();
+ return nm->mkNode(kind::AND,
+ nm->mkNode(kind::EQUAL, x, zero),
+ nm->mkNode(kind::BITVECTOR_UGT, T, zero));
+}
+
+/* -------------------------------------------------------------------------- */
+
/**
* BBPlusNeg
*
}
RewriteResponse TheoryBVRewriter::RewriteUgt(TNode node, bool prerewrite){
- Node resultNode = LinearRewriteStrategy
- < RewriteRule<UgtEliminate>
- >::apply(node);
+ Node resultNode =
+ LinearRewriteStrategy<RewriteRule<UgtUrem>,
+ RewriteRule<UgtEliminate>>::apply(node);
return RewriteResponse(REWRITE_AGAIN, resultNode);
}
regress0/bv/mul-neg-unsat.smt2
regress0/bv/mul-negpow2.smt2
regress0/bv/mult-pow2-negative.smt2
+ regress0/bv/pr4993-bvugt-bvurem-a.smt2
+ regress0/bv/pr4993-bvugt-bvurem-b.smt2
regress0/bv/sizecheck.cvc
regress0/bv/smtcompbug.smtv1.smt2
regress0/bv/test-bv_intro_pow2.smt2
--- /dev/null
+; COMMAND-LINE: --bv-div-zero-const --no-check-unsat-cores
+(set-logic QF_BV)
+(set-info :status unsat)
+(declare-const x (_ BitVec 4))
+(declare-const y (_ BitVec 4))
+(assert (not (= (bvugt (bvurem y x) x) (ite (= x #x0) (bvugt y #x0) false))))
+(check-sat)
--- /dev/null
+; COMMAND-LINE: --no-bv-div-zero-const --no-check-unsat-cores
+(set-logic QF_BV)
+(set-info :status sat)
+(declare-const x (_ BitVec 4))
+(declare-const y (_ BitVec 4))
+(assert (not (= (bvugt (bvurem y x) x) (ite (= x #x0) (bvugt y #x0) false))))
+(check-sat)