Result SmtEngine::checkSat(const Expr& ex) throw(TypeCheckingException, ModalException, LogicException) {
Assert(ex.isNull() || ex.getExprManager() == d_exprManager);
-#ifdef CVC4_PROOF
- // if (options::proof()) { <-- SEGFAULT!!
- ProofManager::currentPM()->addAssertion(ex);
- //}
-#endif
SmtScope smts(this);
finalOptionsAreSet();
doPendingPops();
+
+
+ PROOF( ProofManager::currentPM()->addAssertion(ex); );
+
Trace("smt") << "SmtEngine::checkSat(" << ex << ")" << endl;
if(d_queryMade && !options::incrementalSolving()) {
Result SmtEngine::assertFormula(const Expr& ex) throw(TypeCheckingException, LogicException) {
Assert(ex.getExprManager() == d_exprManager);
-#ifdef CVC4_PROOF
- // if (options::proof()) { <-- SEGFAULT!!!
- ProofManager::currentPM()->addAssertion(ex);
- // }
-#endif
SmtScope smts(this);
finalOptionsAreSet();
doPendingPops();
+ PROOF( ProofManager::currentPM()->addAssertion(ex););
Trace("smt") << "SmtEngine::assertFormula(" << ex << ")" << endl;
// Substitute out any abstract values in ex
PlusCombineLikeTerms,
MultSimplify,
MultDistribConst,
+ MultDistribVariable,
SolveEq,
BitwiseEq,
AndSimplify,
case PlusCombineLikeTerms: out << "PlusCombineLikeTerms"; return out;
case MultSimplify: out << "MultSimplify"; return out;
case MultDistribConst: out << "MultDistribConst"; return out;
+ case MultDistribVariable: out << "MultDistribConst"; return out;
case SolveEq : out << "SolveEq"; return out;
case BitwiseEq : out << "BitwiseEq"; return out;
case NegMult : out << "NegMult"; return out;
RewriteRule<SltZero> rule115;
RewriteRule<BVToNatEliminate> rule116;
RewriteRule<IntToBVEliminate> rule117;
+ RewriteRule<MultDistribVariable> rule118;
};
template<> inline
return utils::mkNode(kind::BITVECTOR_MULT, children);
}
+template<> inline
+bool RewriteRule<MultDistribVariable>::applies(TNode node) {
+ if (node.getKind() != kind::BITVECTOR_MULT ||
+ node.getNumChildren() != 2) {
+ return false;
+ }
+ Assert(!node[0].isConst());
+ if (!node[1].getNumChildren() == 0) {
+ return false;
+ }
+ TNode factor = node[0];
+ return (factor.getKind() == kind::BITVECTOR_PLUS ||
+ factor.getKind() == kind::BITVECTOR_SUB);
+}
+
+template<> inline
+Node RewriteRule<MultDistribVariable>::apply(TNode node) {
+ Debug("bv-rewrite") << "RewriteRule<MultDistrib>(" << node << ")" << std::endl;
+ TNode var = node[1];
+ TNode factor = node[0];
+
+ std::vector<Node> children;
+ for(unsigned i = 0; i < factor.getNumChildren(); ++i) {
+ children.push_back(utils::mkNode(kind::BITVECTOR_MULT, factor[i], var));
+ }
+
+ return utils::mkNode(factor.getKind(), children);
+}
+
+
template<> inline
bool RewriteRule<MultDistribConst>::applies(TNode node) {
if (node.getKind() != kind::BITVECTOR_MULT ||
// creating new terms that might simplify further
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
+ if(RewriteRule<MultDistribVariable>::applies(resultNode)) {
+ resultNode = RewriteRule<MultDistribVariable>::run<false>(resultNode);
+ // creating new terms that might simplify further
+ return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+ }
+
}
if(resultNode == node) {