void MinisatSatSolver::toSatClause(Minisat::vec<Minisat::Lit>& clause, SatClause& sat_clause) { for (int i = 0; i < clause.size(); ++i) { sat_clause.push_back(toSatLiteral(clause[i])); } Assert((unsigned)clause.size() == sat_clause.size()); }
void CryptoMinisatSolver::toSatClause(std::vector<CMSat::Lit>& clause, SatClause& sat_clause) { for (unsigned i = 0; i < clause.size(); ++i) { sat_clause.push_back(toSatLiteral(clause[i])); } Assert(clause.size() == sat_clause.size()); }
void MinisatSatSolver::toMinisatClause(SatClause& clause, Minisat::vec<Minisat::Lit>& minisat_clause) { for (unsigned i = 0; i < clause.size(); ++i) { minisat_clause.push(toMinisatLit(clause[i])); } Assert(clause.size() == (unsigned)minisat_clause.size()); }
void CryptoMinisatSolver::toInternalClause(SatClause& clause, std::vector<CMSat::Lit>& internal_clause) { for (unsigned i = 0; i < clause.size(); ++i) { internal_clause.push_back(toInternalLit(clause[i])); } Assert(clause.size() == internal_clause.size()); }
void TheoryProxy::explainPropagation(SatLiteral l, SatClause& explanation) { TNode lNode = d_cnfStream->getNode(l); Debug("prop-explain") << "explainPropagation(" << lNode << ")" << std::endl; Node theoryExplanation = d_theoryEngine->getExplanation(lNode); Debug("prop-explain") << "explainPropagation() => " << theoryExplanation << std::endl; if (theoryExplanation.getKind() == kind::AND) { Node::const_iterator it = theoryExplanation.begin(); Node::const_iterator it_end = theoryExplanation.end(); explanation.push_back(l); for (; it != it_end; ++ it) { explanation.push_back(~d_cnfStream->getLiteral(*it)); } } else { explanation.push_back(l); explanation.push_back(~d_cnfStream->getLiteral(theoryExplanation)); } }
void TheoryProxy::notifyNewLemma(SatClause& lemma) { Assert(lemma.size() > 0); if(options::lemmaOutputChannel() != NULL) { if(lemma.size() == 1) { // cannot share units yet //options::lemmaOutputChannel()->notifyNewLemma(d_cnfStream->getNode(lemma[0]).toExpr()); } else { NodeBuilder<> b(kind::OR); for(unsigned i = 0, i_end = lemma.size(); i < i_end; ++i) { b << d_cnfStream->getNode(lemma[i]); } Node n = b; if(d_shared.find(n) == d_shared.end()) { d_shared.insert(n); options::lemmaOutputChannel()->notifyNewLemma(n.toExpr()); } else { Debug("shared") <<"drop new " << n << std::endl; } } } }
ClauseId CryptoMinisatSolver::addXorClause(SatClause& clause, bool rhs, bool removable) { Debug("sat::cryptominisat") << "Add xor clause " << clause <<" = " << rhs << "\n"; if (!d_okay) { Debug("sat::cryptominisat") << "Solver unsat: not adding clause.\n"; return ClauseIdError; } ++(d_statistics.d_xorClausesAdded); // ensure all sat literals have positive polarity by pushing // the negation on the result std::vector<CMSat::Var> xor_clause; for (unsigned i = 0; i < clause.size(); ++i) { xor_clause.push_back(toInternalLit(clause[i]).var()); rhs ^= clause[i].isNegated(); } bool res = d_solver->add_xor_clause(xor_clause, rhs); d_okay &= res; return ClauseIdError; }
void BVMinisatSatSolver::getUnsatCore(SatClause& unsatCore) { // TODO add assertion to check the call was after an unsat call for (int i = 0; i < d_minisat->conflict.size(); ++i) { unsatCore.push_back(toSatLiteral(d_minisat->conflict[i])); } }