summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLiana Hadarean <lianahady@gmail.com>2012-04-04 02:02:06 +0000
committerLiana Hadarean <lianahady@gmail.com>2012-04-04 02:02:06 +0000
commit52d6dc20c61007a5c066590aa1fd0b95ed3c2527 (patch)
tree040efec36cde7775b5c19eb43fcdd60cbeb61f9e /src
parent4fa8c7d1a0654e7780fd485c51463c06b34379b5 (diff)
* added propagation as lemmas to TheoryBV:
* modified BVMinisat to work incrementally * added more bv regressions
Diffstat (limited to 'src')
-rw-r--r--src/prop/bvminisat/bvminisat.cpp100
-rw-r--r--src/prop/bvminisat/bvminisat.h33
-rw-r--r--src/prop/bvminisat/core/Solver.cc144
-rw-r--r--src/prop/bvminisat/core/Solver.h43
-rw-r--r--src/prop/bvminisat/core/SolverTypes.h13
-rw-r--r--src/prop/bvminisat/simp/SimpSolver.cc15
-rw-r--r--src/prop/bvminisat/simp/SimpSolver.h14
-rw-r--r--src/prop/cryptominisat/MTRand/Makefile.in141
-rw-r--r--src/prop/cryptominisat/Makefile.in369
-rw-r--r--src/prop/cryptominisat/Solver/Makefile.in198
-rw-r--r--src/prop/cryptominisat/man/Makefile.in141
-rw-r--r--src/prop/cryptominisat/mtl/Makefile.in141
-rw-r--r--src/prop/minisat/core/Solver.cc2
-rw-r--r--src/prop/sat_solver.h11
-rw-r--r--src/prop/sat_solver_factory.cpp4
-rw-r--r--src/prop/sat_solver_factory.h2
-rw-r--r--src/theory/bv/bitblast_strategies.cpp237
-rw-r--r--src/theory/bv/bv_sat.cpp100
-rw-r--r--src/theory/bv/bv_sat.h13
-rw-r--r--src/theory/bv/kinds10
-rw-r--r--src/theory/bv/theory_bv.cpp109
-rw-r--r--src/theory/bv/theory_bv.h10
-rw-r--r--src/theory/bv/theory_bv_rewrite_rules.h50
-rw-r--r--src/theory/bv/theory_bv_rewrite_rules_constant_evaluation.h144
-rw-r--r--src/theory/bv/theory_bv_rewrite_rules_core.h40
-rw-r--r--src/theory/bv/theory_bv_rewrite_rules_normalization.h577
-rw-r--r--src/theory/bv/theory_bv_rewrite_rules_simplification.h355
-rw-r--r--src/theory/bv/theory_bv_rewriter.cpp256
-rw-r--r--src/theory/bv/theory_bv_rewriter.h78
-rw-r--r--src/theory/bv/theory_bv_utils.h45
-rw-r--r--src/util/bitvector.h4
31 files changed, 2543 insertions, 856 deletions
diff --git a/src/prop/bvminisat/bvminisat.cpp b/src/prop/bvminisat/bvminisat.cpp
index b32483cbe..232502696 100644
--- a/src/prop/bvminisat/bvminisat.cpp
+++ b/src/prop/bvminisat/bvminisat.cpp
@@ -22,13 +22,19 @@
using namespace CVC4;
using namespace prop;
-BVMinisatSatSolver::BVMinisatSatSolver() :
- d_minisat(new BVMinisat::SimpSolver())
+BVMinisatSatSolver::BVMinisatSatSolver(context::Context* mainSatContext)
+: context::ContextNotifyObj(mainSatContext, false),
+ d_minisat(new BVMinisat::SimpSolver(mainSatContext)),
+ d_solveCount(0),
+ d_assertionsCount(0),
+ d_assertionsRealCount(mainSatContext, 0),
+ d_lastPropagation(mainSatContext, 0)
{
- d_statistics.init(d_minisat);
+ d_statistics.init(d_minisat);
}
-BVMinisatSatSolver::~BVMinisatSatSolver() {
+
+BVMinisatSatSolver::~BVMinisatSatSolver() throw(AssertionException) {
delete d_minisat;
}
@@ -42,6 +48,42 @@ void BVMinisatSatSolver::addClause(SatClause& clause, bool removable) {
d_minisat->addClause(minisat_clause);
}
+void BVMinisatSatSolver::addMarkerLiteral(SatLiteral lit) {
+ d_minisat->addMarkerLiteral(BVMinisat::var(toMinisatLit(lit)));
+}
+
+bool BVMinisatSatSolver::getPropagations(std::vector<SatLiteral>& propagations) {
+ for (; d_lastPropagation < d_minisat->atom_propagations.size(); d_lastPropagation = d_lastPropagation + 1) {
+ propagations.push_back(toSatLiteral(d_minisat->atom_propagations[d_lastPropagation]));
+ }
+ return propagations.size() > 0;
+}
+
+void BVMinisatSatSolver::explainPropagation(SatLiteral lit, std::vector<SatLiteral>& explanation) {
+ std::vector<BVMinisat::Lit> minisat_explanation;
+ d_minisat->explainPropagation(toMinisatLit(lit), minisat_explanation);
+ for (unsigned i = 0; i < minisat_explanation.size(); ++i) {
+ explanation.push_back(toSatLiteral(minisat_explanation[i]));
+ }
+}
+
+SatValue BVMinisatSatSolver::assertAssumption(SatLiteral lit, bool propagate) {
+ d_assertionsCount ++;
+ d_assertionsRealCount = d_assertionsRealCount + 1;
+ return toSatLiteralValue(d_minisat->assertAssumption(toMinisatLit(lit), propagate));
+}
+
+void BVMinisatSatSolver::notify() {
+ while (d_assertionsCount > d_assertionsRealCount) {
+ popAssumption();
+ d_assertionsCount --;
+ }
+}
+
+void BVMinisatSatSolver::popAssumption() {
+ d_minisat->popAssumption();
+}
+
SatVariable BVMinisatSatSolver::newVar(bool freeze){
return d_minisat->newVar(true, true, freeze);
}
@@ -74,20 +116,28 @@ SatValue BVMinisatSatSolver::solve(long unsigned int& resource){
return result;
}
-SatValue BVMinisatSatSolver::solve(const context::CDList<SatLiteral> & assumptions){
- Debug("sat::minisat") << "Solve with assumptions ";
- context::CDList<SatLiteral>::const_iterator it = assumptions.begin();
- BVMinisat::vec<BVMinisat::Lit> assump;
- for(; it!= assumptions.end(); ++it) {
- SatLiteral lit = *it;
- Debug("sat::minisat") << lit <<" ";
- assump.push(toMinisatLit(lit));
- }
- Debug("sat::minisat") <<"\n";
-
- SatValue result = toSatLiteralValue(d_minisat->solve(assump));
- return result;
-}
+// SatValue BVMinisatSatSolver::solve(const context::CDList<SatLiteral> & assumptions, bool only_bcp){
+// ++d_solveCount;
+// ++d_statistics.d_statCallsToSolve;
+
+// Debug("sat::minisat") << "Solve with assumptions ";
+// context::CDList<SatLiteral>::const_iterator it = assumptions.begin();
+// BVMinisat::vec<BVMinisat::Lit> assump;
+// for(; it!= assumptions.end(); ++it) {
+// SatLiteral lit = *it;
+// Debug("sat::minisat") << lit <<" ";
+// assump.push(toMinisatLit(lit));
+// }
+// Debug("sat::minisat") <<"\n";
+
+// clock_t begin, end;
+// begin = clock();
+// d_minisat->setOnlyBCP(only_bcp);
+// SatLiteralValue result = toSatLiteralValue(d_minisat->solve(assump));
+// end = clock();
+// d_statistics.d_statSolveTime = d_statistics.d_statSolveTime.getData() + (end - begin)/(double)CLOCKS_PER_SEC;
+// return result;
+// }
void BVMinisatSatSolver::getUnsatCore(SatClause& unsatCore) {
@@ -98,13 +148,11 @@ void BVMinisatSatSolver::getUnsatCore(SatClause& unsatCore) {
}
SatValue BVMinisatSatSolver::value(SatLiteral l){
- Unimplemented();
- return SAT_VALUE_UNKNOWN;
+ return toSatLiteralValue(d_minisat->value(toMinisatLit(l)));
}
SatValue BVMinisatSatSolver::modelValue(SatLiteral l){
- Unimplemented();
- return SAT_VALUE_UNKNOWN;
+ return toSatLiteralValue(d_minisat->modelValue(toMinisatLit(l)));
}
void BVMinisatSatSolver::unregisterVar(SatLiteral lit) {
@@ -191,7 +239,9 @@ BVMinisatSatSolver::Statistics::Statistics() :
d_statLearntsLiterals("theory::bv::bvminisat::learnts_literals"),
d_statMaxLiterals("theory::bv::bvminisat::max_literals"),
d_statTotLiterals("theory::bv::bvminisat::tot_literals"),
- d_statEliminatedVars("theory::bv::bvminisat::eliminated_vars")
+ d_statEliminatedVars("theory::bv::bvminisat::eliminated_vars"),
+ d_statCallsToSolve("theory::bv::bvminisat::calls_to_solve", 0),
+ d_statSolveTime("theory::bv::bvminisat::solve_time", 0)
{
StatisticsRegistry::registerStat(&d_statStarts);
StatisticsRegistry::registerStat(&d_statDecisions);
@@ -203,6 +253,8 @@ BVMinisatSatSolver::Statistics::Statistics() :
StatisticsRegistry::registerStat(&d_statMaxLiterals);
StatisticsRegistry::registerStat(&d_statTotLiterals);
StatisticsRegistry::registerStat(&d_statEliminatedVars);
+ StatisticsRegistry::registerStat(&d_statCallsToSolve);
+ StatisticsRegistry::registerStat(&d_statSolveTime);
}
BVMinisatSatSolver::Statistics::~Statistics() {
@@ -216,6 +268,8 @@ BVMinisatSatSolver::Statistics::~Statistics() {
StatisticsRegistry::unregisterStat(&d_statMaxLiterals);
StatisticsRegistry::unregisterStat(&d_statTotLiterals);
StatisticsRegistry::unregisterStat(&d_statEliminatedVars);
+ StatisticsRegistry::unregisterStat(&d_statCallsToSolve);
+ StatisticsRegistry::unregisterStat(&d_statSolveTime);
}
void BVMinisatSatSolver::Statistics::init(BVMinisat::SimpSolver* minisat){
diff --git a/src/prop/bvminisat/bvminisat.h b/src/prop/bvminisat/bvminisat.h
index 4ca1164c0..19b605067 100644
--- a/src/prop/bvminisat/bvminisat.h
+++ b/src/prop/bvminisat/bvminisat.h
@@ -21,16 +21,27 @@
#include "prop/sat_solver.h"
#include "prop/sat_solver_registry.h"
#include "prop/bvminisat/simp/SimpSolver.h"
+#include "context/cdo.h"
namespace CVC4 {
namespace prop {
-class BVMinisatSatSolver: public BVSatSolverInterface {
+class BVMinisatSatSolver: public BVSatSolverInterface, public context::ContextNotifyObj {
BVMinisat::SimpSolver* d_minisat;
+ unsigned d_solveCount;
+ unsigned d_assertionsCount;
+ context::CDO<unsigned> d_assertionsRealCount;
+ context::CDO<unsigned> d_lastPropagation;
public:
- BVMinisatSatSolver();
- ~BVMinisatSatSolver();
+ BVMinisatSatSolver() :
+ ContextNotifyObj(NULL, false),
+ d_assertionsRealCount(NULL, (unsigned)0),
+ d_lastPropagation(NULL, (unsigned)0)
+ { Unreachable(); }
+ BVMinisatSatSolver(context::Context* mainSatContext);
+ ~BVMinisatSatSolver() throw(AssertionException);
+
void addClause(SatClause& clause, bool removable);
SatVariable newVar(bool theoryAtom = false);
@@ -38,10 +49,11 @@ public:
void markUnremovable(SatLiteral lit);
void interrupt();
-
+ void notify();
+
SatValue solve();
SatValue solve(long unsigned int&);
- SatValue solve(const context::CDList<SatLiteral> & assumptions);
+ SatValue solve(bool quick_solve);
void getUnsatCore(SatClause& unsatCore);
SatValue value(SatLiteral l);
@@ -62,6 +74,15 @@ public:
static void toMinisatClause(SatClause& clause, BVMinisat::vec<BVMinisat::Lit>& minisat_clause);
static void toSatClause (BVMinisat::vec<BVMinisat::Lit>& clause, SatClause& sat_clause);
+ void addMarkerLiteral(SatLiteral lit);
+
+ bool getPropagations(std::vector<SatLiteral>& propagations);
+
+ void explainPropagation(SatLiteral lit, std::vector<SatLiteral>& explanation);
+
+ SatValue assertAssumption(SatLiteral lit, bool propagate);
+
+ void popAssumption();
class Statistics {
public:
@@ -71,6 +92,8 @@ public:
ReferenceStat<uint64_t> d_statLearntsLiterals, d_statMaxLiterals;
ReferenceStat<uint64_t> d_statTotLiterals;
ReferenceStat<int> d_statEliminatedVars;
+ IntStat d_statCallsToSolve;
+ BackedStat<double> d_statSolveTime;
Statistics();
~Statistics();
void init(BVMinisat::SimpSolver* minisat);
diff --git a/src/prop/bvminisat/core/Solver.cc b/src/prop/bvminisat/core/Solver.cc
index 7ff7b50db..5066d5d8f 100644
--- a/src/prop/bvminisat/core/Solver.cc
+++ b/src/prop/bvminisat/core/Solver.cc
@@ -22,8 +22,10 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "mtl/Sort.h"
#include "core/Solver.h"
+#include <vector>
#include <iostream>
#include "util/output.h"
+#include "util/utility.h"
using namespace BVMinisat;
@@ -64,7 +66,7 @@ static DoubleOption opt_garbage_frac (_cat, "gc-frac", "The fraction o
// Constructor/Destructor:
-Solver::Solver() :
+Solver::Solver(CVC4::context::Context* c) :
// Parameters (user settable):
//
@@ -112,6 +114,8 @@ Solver::Solver() :
, conflict_budget (-1)
, propagation_budget (-1)
, asynch_interrupt (false)
+ , only_bcp(false)
+ , d_explanations(c)
{}
@@ -134,6 +138,7 @@ Var Solver::newVar(bool sign, bool dvar)
watches .init(mkLit(v, true ));
assigns .push(l_Undef);
vardata .push(mkVarData(CRef_Undef, 0));
+ marker .push(0);
//activity .push(0);
activity .push(rnd_init_act ? drand(random_seed) * 0.00001 : 0);
seen .push(0);
@@ -226,13 +231,20 @@ void Solver::cancelUntil(int level) {
for (int c = trail.size()-1; c >= trail_lim[level]; c--){
Var x = var(trail[c]);
assigns [x] = l_Undef;
+ if (marker[x] == 2) marker[x] = 1;
if (phase_saving > 1 || (phase_saving == 1) && c > trail_lim.last())
polarity[x] = sign(trail[c]);
insertVarOrder(x); }
qhead = trail_lim[level];
trail.shrink(trail.size() - trail_lim[level]);
trail_lim.shrink(trail_lim.size() - level);
- } }
+ }
+
+ if (level < atom_propagations_lim.size()) {
+ atom_propagations.shrink(atom_propagations.size() - atom_propagations_lim[level]);
+ atom_propagations_lim.shrink(atom_propagations_lim.size() - level);
+ }
+}
//=================================================================================================
@@ -278,7 +290,7 @@ Lit Solver::pickBranchLit()
| rest of literals. There may be others from the same level though.
|
|________________________________________________________________________________________________@*/
-void Solver::analyze(CRef confl, vec<Lit>& out_learnt, int& out_btlevel)
+void Solver::analyze(CRef confl, vec<Lit>& out_learnt, int& out_btlevel, UIP uip)
{
int pathC = 0;
Lit p = lit_Undef;
@@ -288,6 +300,7 @@ void Solver::analyze(CRef confl, vec<Lit>& out_learnt, int& out_btlevel)
out_learnt.push(); // (leave room for the asserting literal)
int index = trail.size() - 1;
+ bool done = false;
do{
assert(confl != CRef_Undef); // (otherwise should be UIP)
Clause& c = ca[confl];
@@ -315,7 +328,18 @@ void Solver::analyze(CRef confl, vec<Lit>& out_learnt, int& out_btlevel)
seen[var(p)] = 0;
pathC--;
- }while (pathC > 0);
+ switch (uip) {
+ case UIP_FIRST:
+ done = pathC == 0;
+ break;
+ case UIP_LAST:
+ done = confl == CRef_Undef || (pathC == 0 && marker[var(p)] == 2);
+ break;
+ default:
+ Unreachable();
+ break;
+ }
+ } while (!done);
out_learnt[0] = ~p;
// Simplify conflict clause:
@@ -427,8 +451,10 @@ void Solver::analyzeFinal(Lit p, vec<Lit>& out_conflict)
Var x = var(trail[i]);
if (seen[x]){
if (reason(x) == CRef_Undef){
+ if (marker[x] == 2) {
assert(level(x) > 0);
out_conflict.push(~trail[i]);
+ }
}else{
Clause& c = ca[reason(x)];
for (int j = 1; j < c.size(); j++)
@@ -449,8 +475,34 @@ void Solver::uncheckedEnqueue(Lit p, CRef from)
assigns[var(p)] = lbool(!sign(p));
vardata[var(p)] = mkVarData(from, decisionLevel());
trail.push_(p);
+ if (only_bcp && marker[var(p)] == 1 && from != CRef_Undef) {
+ atom_propagations.push(p);
+ }
+}
+
+void Solver::popAssumption() {
+ marker[var(assumptions.last())] = 1;
+ assumptions.pop();
+ conflict.clear();
+ cancelUntil(assumptions.size());
}
+lbool Solver::assertAssumption(Lit p, bool propagate) {
+
+ assert(marker[var(p)] == 1);
+
+ // add to the assumptions
+ assumptions.push(p);
+ conflict.clear();
+
+ // run the propagation
+ if (propagate) {
+ only_bcp = true;
+ return search(-1, UIP_FIRST);
+ } else {
+ return l_True;
+ }
+}
/*_________________________________________________________________________________________________
|
@@ -628,7 +680,7 @@ bool Solver::simplify()
| all variables are decision variables, this means that the clause set is satisfiable. 'l_False'
| if the clause set is unsatisfiable. 'l_Undef' if the bound on number of conflicts is reached.
|________________________________________________________________________________________________@*/
-lbool Solver::search(int nof_conflicts)
+lbool Solver::search(int nof_conflicts, UIP uip)
{
assert(ok);
int backtrack_level;
@@ -644,17 +696,27 @@ lbool Solver::search(int nof_conflicts)
if (decisionLevel() == 0) return l_False;
learnt_clause.clear();
- analyze(confl, learnt_clause, backtrack_level);
+ analyze(confl, learnt_clause, backtrack_level, uip);
cancelUntil(backtrack_level);
+ Lit p = learnt_clause[0];
+ bool assumption = marker[var(p)] == 2;
+
if (learnt_clause.size() == 1){
- uncheckedEnqueue(learnt_clause[0]);
+ uncheckedEnqueue(p);
}else{
CRef cr = ca.alloc(learnt_clause, true);
learnts.push(cr);
attachClause(cr);
claBumpActivity(ca[cr]);
- uncheckedEnqueue(learnt_clause[0], cr);
+ uncheckedEnqueue(p, cr);
+ }
+
+ // if an assumption, we're done
+ if (assumption) {
+ assert(decisionLevel() < assumptions.size());
+ analyzeFinal(p, conflict);
+ return l_False;
}
varDecayActivity();
@@ -699,12 +761,18 @@ lbool Solver::search(int nof_conflicts)
analyzeFinal(~p, conflict);
return l_False;
}else{
+ marker[var(p)] = 2;
next = p;
break;
}
}
if (next == lit_Undef){
+
+ if (only_bcp) {
+ return l_True;
+ }
+
// New variable decision:
decisions++;
next = pickBranchLit();
@@ -767,10 +835,12 @@ static double luby(double y, int x){
// NOTE: assumptions passed in member-variable 'assumptions'.
lbool Solver::solve_()
{
- Debug("bvminisat") <<"BVMinisat::Solving learned clauses " << learnts.size() <<"\n";
- Debug("bvminisat") <<"BVMinisat::Solving assumptions " << assumptions.size() <<"\n";
+ Debug("bvminisat") <<"BVMinisat::Solving learned clauses " << learnts.size() <<"\n";
+ Debug("bvminisat") <<"BVMinisat::Solving assumptions " << assumptions.size() <<"\n";
+
model.clear();
conflict.clear();
+
if (!ok) return l_False;
solves++;
@@ -799,19 +869,56 @@ lbool Solver::solve_()
if (verbosity >= 1)
printf("===============================================================================\n");
-
if (status == l_True){
// Extend & copy model:
- model.growTo(nVars());
- for (int i = 0; i < nVars(); i++) model[i] = value(i);
+ // model.growTo(nVars());
+ // for (int i = 0; i < nVars(); i++) model[i] = value(i);
}else if (status == l_False && conflict.size() == 0)
ok = false;
- cancelUntil(0);
return status;
}
//=================================================================================================
+// Bitvector propagations
+//
+
+void Solver::storeExplanation(Lit p) {
+}
+
+void Solver::explainPropagation(Lit p, std::vector<Lit>& explanation) {
+ vec<Lit> queue;
+ queue.push(p);
+
+ __gnu_cxx::hash_set<Var> visited;
+ visited.insert(var(p));
+ while(queue.size() > 0) {
+ Lit l = queue.last();
+ assert(value(l) == l_True);
+ queue.pop();
+ if (reason(var(l)) == CRef_Undef) {
+ if (marker[var(l)] == 2) {
+ explanation.push_back(l);
+ visited.insert(var(l));
+ }
+ } else {
+ Clause& c = ca[reason(var(l))];
+ for (int i = 1; i < c.size(); ++i) {
+ if (var(c[i]) >= vardata.size()) {
+ std::cerr << "BOOM" << std::endl;
+ }
+ if (visited.count(var(c[i])) == 0) {
+ queue.push(~c[i]);
+ visited.insert(var(c[i]));
+ }
+ }
+ }
+ }
+}
+
+
+
+//=================================================================================================
// Writing CNF to DIMACS:
//
// FIXME: this needs to be rewritten completely.
@@ -872,13 +979,13 @@ void Solver::toDimacs(FILE* f, const vec<Lit>& assumps)
}
// Assumptions are added as unit clauses:
- cnt += assumptions.size();
+ cnt += assumps.size();
fprintf(f, "p cnf %d %d\n", max, cnt);
- for (int i = 0; i < assumptions.size(); i++){
- assert(value(assumptions[i]) != l_False);
- fprintf(f, "%s%d 0\n", sign(assumptions[i]) ? "-" : "", mapVar(var(assumptions[i]), map, max)+1);
+ for (int i = 0; i < assumps.size(); i++){
+ assert(value(assumps[i]) != l_False);
+ fprintf(f, "%s%d 0\n", sign(assumps[i]) ? "-" : "", mapVar(var(assumps[i]), map, max)+1);
}
for (int i = 0; i < clauses.size(); i++)
@@ -940,4 +1047,3 @@ void Solver::garbageCollect()
ca.size()*ClauseAllocator::Unit_Size, to.size()*ClauseAllocator::Unit_Size);
to.moveTo(ca);
}
-
diff --git a/src/prop/bvminisat/core/Solver.h b/src/prop/bvminisat/core/Solver.h
index f364a2937..33d1900c9 100644
--- a/src/prop/bvminisat/core/Solver.h
+++ b/src/prop/bvminisat/core/Solver.h
@@ -27,6 +27,10 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "prop/bvminisat/mtl/Alg.h"
#include "prop/bvminisat/utils/Options.h"
+#include "context/cdhashmap.h"
+
+#include <ext/hash_set>
+#include <vector>
namespace BVMinisat {
@@ -38,7 +42,7 @@ public:
// Constructor/Destructor:
//
- Solver();
+ Solver(CVC4::context::Context* c);
virtual ~Solver();
// Problem specification:
@@ -63,6 +67,8 @@ public:
bool solve (Lit p, Lit q); // Search for a model that respects two assumptions.
bool solve (Lit p, Lit q, Lit r); // Search for a model that respects three assumptions.
bool okay () const; // FALSE means solver is in a conflicting state
+ lbool assertAssumption(Lit p, bool propagate); // Assert a new assumption, start BCP if propagate = true
+ void popAssumption(); // Pop an assumption
void toDimacs (FILE* f, const vec<Lit>& assumps); // Write CNF to file in DIMACS-format.
void toDimacs (const char *file, const vec<Lit>& assumps);
@@ -138,7 +144,20 @@ public:
uint64_t solves, starts, decisions, rnd_decisions, propagations, conflicts;
uint64_t dec_vars, clauses_literals, learnts_literals, max_literals, tot_literals;
-
+ // Bitvector Propagations
+ //
+
+ void addMarkerLiteral(Var var) {
+ marker[var] = 1;
+ }
+
+ __gnu_cxx::hash_set<Var> assumptions_vars; // all the variables that appear in the current assumptions
+ vec<Lit> atom_propagations; // the atom literals implied by the last call to solve with assumptions
+ vec<int> atom_propagations_lim; // for backtracking
+
+ bool only_bcp; // solving mode in which only boolean constraint propagation is done
+ void setOnlyBCP (bool val) { only_bcp = val;}
+ void explainPropagation(Lit l, std::vector<Lit>& explanation);
protected:
// Helper structures:
@@ -179,6 +198,7 @@ protected:
watches; // 'watches[lit]' is a list of constraints watching 'lit' (will go there if literal becomes true).
vec<lbool> assigns; // The current assignments.
vec<char> polarity; // The preferred polarity of each variable.
+ vec<char> marker; // Is the variable a marker literal
vec<char> decision; // Declares if a variable is eligible for selection in the decision heuristic.
vec<Lit> trail; // Assignment stack; stores all assigments made in the order they were made.
vec<int> trail_lim; // Separator indices for different decision levels in 'trail'.
@@ -220,10 +240,19 @@ protected:
bool enqueue (Lit p, CRef from = CRef_Undef); // Test if fact 'p' contradicts current state, enqueue otherwise.
CRef propagate (); // Perform unit propagation. Returns possibly conflicting clause.
void cancelUntil (int level); // Backtrack until a certain level.
- void analyze (CRef confl, vec<Lit>& out_learnt, int& out_btlevel); // (bt = backtrack)
+
+ enum UIP {
+ UIP_FIRST,
+ UIP_LAST
+ };
+
+ CVC4::context::CDHashMap<Lit, std::vector<Lit>, LitHashFunction> d_explanations;
+
+ void storeExplanation (Lit p); // make sure that the explanation of p is cached
+ void analyze (CRef confl, vec<Lit>& out_learnt, int& out_btlevel, UIP uip = UIP_FIRST); // (bt = backtrack)
void analyzeFinal (Lit p, vec<Lit>& out_conflict); // COULD THIS BE IMPLEMENTED BY THE ORDINARIY "analyze" BY SOME REASONABLE GENERALIZATION?
bool litRedundant (Lit p, uint32_t abstract_levels); // (helper method for 'analyze()')
- lbool search (int nof_conflicts); // Search for a given number of conflicts.
+ lbool search (int nof_conflicts, UIP uip = UIP_FIRST); // Search for a given number of conflicts.
lbool solve_ (); // Main solve method (assumptions given in 'assumptions').
void reduceDB (); // Reduce the set of learnt clauses.
void removeSatisfied (vec<CRef>& cs); // Shrink 'cs' to contain only non-satisfied clauses.
@@ -275,8 +304,8 @@ protected:
//=================================================================================================
// Implementation of inline methods:
-inline CRef Solver::reason(Var x) const { return vardata[x].reason; }
-inline int Solver::level (Var x) const { return vardata[x].level; }
+inline CRef Solver::reason(Var x) const { assert(x < vardata.size()); return vardata[x].reason; }
+inline int Solver::level (Var x) const { assert(x < vardata.size()); return vardata[x].level; }
inline void Solver::insertVarOrder(Var x) {
if (!order_heap.inHeap(x) && decision[x]) order_heap.insert(x); }
@@ -315,7 +344,7 @@ inline bool Solver::addClause (Lit p) { add_tmp.clear(
inline bool Solver::addClause (Lit p, Lit q) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); return addClause_(add_tmp); }
inline bool Solver::addClause (Lit p, Lit q, Lit r) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); add_tmp.push(r); return addClause_(add_tmp); }
inline bool Solver::locked (const Clause& c) const { return value(c[0]) == l_True && reason(var(c[0])) != CRef_Undef && ca.lea(reason(var(c[0]))) == &c; }
-inline void Solver::newDecisionLevel() { trail_lim.push(trail.size()); }
+inline void Solver::newDecisionLevel() { trail_lim.push(trail.size()); atom_propagations_lim.push(atom_propagations.size()); }
inline int Solver::decisionLevel () const { return trail_lim.size(); }
inline uint32_t Solver::abstractLevel (Var x) const { return 1 << (level(x) & 31); }
diff --git a/src/prop/bvminisat/core/SolverTypes.h b/src/prop/bvminisat/core/SolverTypes.h
index 0439a46c4..89ffc8a00 100644
--- a/src/prop/bvminisat/core/SolverTypes.h
+++ b/src/prop/bvminisat/core/SolverTypes.h
@@ -53,7 +53,6 @@ struct Lit {
bool operator < (Lit p) const { return x < p.x; } // '<' makes p, ~p adjacent in the ordering.
};
-
inline Lit mkLit (Var var, bool sign) { Lit p; p.x = var + var + (int)sign; return p; }
inline Lit operator ~(Lit p) { Lit q; q.x = p.x ^ 1; return q; }
inline Lit operator ^(Lit p, bool b) { Lit q; q.x = p.x ^ (unsigned int)b; return q; }
@@ -61,9 +60,15 @@ inline bool sign (Lit p) { return p.x & 1; }
inline int var (Lit p) { return p.x >> 1; }
// Mapping Literals to and from compact integers suitable for array indexing:
-inline int toInt (Var v) { return v; }
-inline int toInt (Lit p) { return p.x; }
-inline Lit toLit (int i) { Lit p; p.x = i; return p; }
+inline int toInt (Var v) { return v; }
+inline int toInt (Lit p) { return p.x; }
+inline Lit toLit (int i) { Lit p; p.x = i; return p; }
+
+struct LitHashFunction {
+ size_t operator () (const Lit& l) const {
+ return toInt(l);
+ }
+};
//const Lit lit_Undef = mkLit(var_Undef, false); // }- Useful special constants.
//const Lit lit_Error = mkLit(var_Undef, true ); // }
diff --git a/src/prop/bvminisat/simp/SimpSolver.cc b/src/prop/bvminisat/simp/SimpSolver.cc
index 4af756456..903ffa270 100644
--- a/src/prop/bvminisat/simp/SimpSolver.cc
+++ b/src/prop/bvminisat/simp/SimpSolver.cc
@@ -43,8 +43,9 @@ static DoubleOption opt_simp_garbage_frac(_cat, "simp-gc-frac", "The fraction of
// Constructor/Destructor:
-SimpSolver::SimpSolver() :
- grow (opt_grow)
+SimpSolver::SimpSolver(CVC4::context::Context* c) :
+ Solver(c)
+ , grow (opt_grow)
, clause_lim (opt_clause_lim)
, subsumption_lim (opt_subsumption_lim)
, simp_garbage_frac (opt_simp_garbage_frac)
@@ -99,7 +100,13 @@ Var SimpSolver::newVar(bool sign, bool dvar, bool freeze) {
lbool SimpSolver::solve_(bool do_simp, bool turn_off_simp)
{
+ vec<Lit> atom_propagations_backup;
+ atom_propagations.moveTo(atom_propagations_backup);
+ vec<int> atom_propagations_lim_backup;
+ atom_propagations_lim.moveTo(atom_propagations_lim_backup);
+ only_bcp = false;
+ cancelUntil(0);
vec<Var> extra_frozen;
lbool result = l_True;
@@ -128,8 +135,8 @@ lbool SimpSolver::solve_(bool do_simp, bool turn_off_simp)
else if (verbosity >= 1)
printf("===============================================================================\n");
- if (result == l_True)
- extendModel();
+ atom_propagations_backup.moveTo(atom_propagations);
+ atom_propagations_lim_backup.moveTo(atom_propagations_lim);
if (do_simp)
// Unfreeze the assumptions that were frozen:
diff --git a/src/prop/bvminisat/simp/SimpSolver.h b/src/prop/bvminisat/simp/SimpSolver.h
index e21a0a9ec..e3ef76212 100644
--- a/src/prop/bvminisat/simp/SimpSolver.h
+++ b/src/prop/bvminisat/simp/SimpSolver.h
@@ -24,6 +24,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "prop/bvminisat/mtl/Queue.h"
#include "prop/bvminisat/core/Solver.h"
#include "util/stats.h"
+#include "context/context.h"
namespace BVMinisat {
@@ -34,7 +35,7 @@ class SimpSolver : public Solver {
public:
// Constructor/Destructor:
//
- SimpSolver();
+ SimpSolver(CVC4::context::Context* c);
~SimpSolver();
// Problem specification:
@@ -95,7 +96,8 @@ class SimpSolver : public Solver {
int merges;
int asymm_lits;
int eliminated_vars;
- CVC4::TimerStat total_eliminate_time;
+ CVC4::TimerStat total_eliminate_time;
+
protected:
// Helper structures:
@@ -181,12 +183,14 @@ inline bool SimpSolver::addClause (Lit p, Lit q) { add_tmp.clear();
inline bool SimpSolver::addClause (Lit p, Lit q, Lit r) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); add_tmp.push(r); return addClause_(add_tmp); }
inline void SimpSolver::setFrozen (Var v, bool b) { frozen[v] = (char)b; if (use_simplification && !b) { updateElimHeap(v); } }
-inline bool SimpSolver::solve ( bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); return solve_(do_simp, turn_off_simp) == l_True; }
+inline bool SimpSolver::solve ( bool do_simp, bool turn_off_simp) { budgetOff(); return solve_(do_simp, turn_off_simp) == l_True; }
inline bool SimpSolver::solve (Lit p , bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); assumptions.push(p); return solve_(do_simp, turn_off_simp) == l_True; }
inline bool SimpSolver::solve (Lit p, Lit q, bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); return solve_(do_simp, turn_off_simp) == l_True; }
inline bool SimpSolver::solve (Lit p, Lit q, Lit r, bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); assumptions.push(r); return solve_(do_simp, turn_off_simp) == l_True; }
-inline bool SimpSolver::solve (const vec<Lit>& assumps, bool do_simp, bool turn_off_simp){
- budgetOff(); assumps.copyTo(assumptions); return solve_(do_simp, turn_off_simp) == l_True; }
+inline bool SimpSolver::solve (const vec<Lit>& assumps, bool do_simp, bool turn_off_simp){
+ budgetOff(); assumps.copyTo(assumptions);
+ return solve_(do_simp, turn_off_simp) == l_True;
+}
inline lbool SimpSolver::solveLimited (const vec<Lit>& assumps, bool do_simp, bool turn_off_simp){
assumps.copyTo(assumptions); return solve_(do_simp, turn_off_simp); }
diff --git a/src/prop/cryptominisat/MTRand/Makefile.in b/src/prop/cryptominisat/MTRand/Makefile.in
index 8cc478cdf..1693a70f2 100644
--- a/src/prop/cryptominisat/MTRand/Makefile.in
+++ b/src/prop/cryptominisat/MTRand/Makefile.in
@@ -34,17 +34,36 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-subdir = MTRand
+target_triplet = @target@
+subdir = src/prop/cryptominisat/MTRand
DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/antlr.m4 \
+ $(top_srcdir)/config/ax_prog_doxygen.m4 \
+ $(top_srcdir)/config/ax_tls.m4 \
+ $(top_srcdir)/config/bindings.m4 $(top_srcdir)/config/boost.m4 \
+ $(top_srcdir)/config/cudd.m4 $(top_srcdir)/config/cvc4.m4 \
+ $(top_srcdir)/config/gcc_version.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/pkg.m4 $(top_srcdir)/config/readline.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_HEADER = $(top_builddir)/cvc4autoconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -75,54 +94,128 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+ANTLR = @ANTLR@
+ANTLR_HOME = @ANTLR_HOME@
+ANTLR_INCLUDES = @ANTLR_INCLUDES@
+ANTLR_LDFLAGS = @ANTLR_LDFLAGS@
AR = @AR@
+AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LDPATH = @BOOST_LDPATH@
+BOOST_ROOT = @BOOST_ROOT@
+BOOST_THREAD_LDFLAGS = @BOOST_THREAD_LDFLAGS@
+BOOST_THREAD_LDPATH = @BOOST_THREAD_LDPATH@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
+CAMLP4O = @CAMLP4O@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CLN_CFLAGS = @CLN_CFLAGS@
+CLN_LIBS = @CLN_LIBS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CSHARP_CPPFLAGS = @CSHARP_CPPFLAGS@
+CUDD_CPPFLAGS = @CUDD_CPPFLAGS@
+CUDD_LDFLAGS = @CUDD_LDFLAGS@
+CUDD_LIBS = @CUDD_LIBS@
+CVC4_BINDINGS_LIBRARY_VERSION = @CVC4_BINDINGS_LIBRARY_VERSION@
+CVC4_BUILD_LIBCOMPAT = @CVC4_BUILD_LIBCOMPAT@
+CVC4_COMPAT_LIBRARY_VERSION = @CVC4_COMPAT_LIBRARY_VERSION@
+CVC4_HAS_THREADS = @CVC4_HAS_THREADS@
+CVC4_LANGUAGE_BINDINGS = @CVC4_LANGUAGE_BINDINGS@
+CVC4_LIBRARY_VERSION = @CVC4_LIBRARY_VERSION@
+CVC4_PARSER_LIBRARY_VERSION = @CVC4_PARSER_LIBRARY_VERSION@
+CVC4_TLS = @CVC4_TLS@
+CVC4_TLS_SUPPORTED = @CVC4_TLS_SUPPORTED@
+CVC4_USE_CLN_IMP = @CVC4_USE_CLN_IMP@
+CVC4_USE_GMP_IMP = @CVC4_USE_GMP_IMP@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
+CXXTEST = @CXXTEST@
+CXXTESTGEN = @CXXTESTGEN@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXTRACT_PRIVATE = @DOXYGEN_EXTRACT_PRIVATE@
+DOXYGEN_EXTRACT_STATIC = @DOXYGEN_EXTRACT_STATIC@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_DX_CURRENT_FEATURE = @DX_FLAG_DX_CURRENT_FEATURE@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+FLAG_VISIBILITY_HIDDEN = @FLAG_VISIBILITY_HIDDEN@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVAH = @JAVAH@
+JAVA_CPPFLAGS = @JAVA_CPPFLAGS@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LFSC = @LFSC@
+LFSCARGS = @LFSCARGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
+MAN_DATE = @MAN_DATE@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+OCAMLC = @OCAMLC@
+OCAMLFIND = @OCAMLFIND@
+OCAMLMKTOP = @OCAMLMKTOP@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
@@ -133,12 +226,33 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_CPPFLAGS = @PERL_CPPFLAGS@
+PHP_CPPFLAGS = @PHP_CPPFLAGS@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_CONFIG = @PYTHON_CONFIG@
+PYTHON_CXXFLAGS = @PYTHON_CXXFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDE = @PYTHON_INCLUDE@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
+RUBY_CPPFLAGS = @RUBY_CPPFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+STATIC_BINARY = @STATIC_BINARY@
STRIP = @STRIP@
+SWIG = @SWIG@
+TCL_CPPFLAGS = @TCL_CPPFLAGS@
+TEST_CPPFLAGS = @TEST_CPPFLAGS@
+TEST_CXXFLAGS = @TEST_CXXFLAGS@
+TEST_LDFLAGS = @TEST_LDFLAGS@
VERSION = @VERSION@
+WNO_CONVERSION_NULL = @WNO_CONVERSION_NULL@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -178,17 +292,26 @@ libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
+mk_include = @mk_include@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
+target = @target@
target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@@ -197,7 +320,7 @@ pkgincludesub_HEADERS = MersenneTwister.h
all: all-am
.SUFFIXES:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -206,9 +329,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu MTRand/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/prop/cryptominisat/MTRand/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu MTRand/Makefile
+ $(AUTOMAKE) --foreign src/prop/cryptominisat/MTRand/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -222,9 +345,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(top_srcdir)/configure: $(am__configure_deps)
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
diff --git a/src/prop/cryptominisat/Makefile.in b/src/prop/cryptominisat/Makefile.in
index 2d9ee8bf8..a6806f0b4 100644
--- a/src/prop/cryptominisat/Makefile.in
+++ b/src/prop/cryptominisat/Makefile.in
@@ -33,21 +33,37 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-subdir = .
-DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(srcdir)/config.h.in \
- $(top_srcdir)/configure AUTHORS INSTALL NEWS TODO config.guess \
- config.sub depcomp install-sh ltmain.sh missing
+target_triplet = @target@
+subdir = src/prop/cryptominisat
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ AUTHORS INSTALL NEWS TODO config.guess config.sub depcomp \
+ install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/antlr.m4 \
+ $(top_srcdir)/config/ax_prog_doxygen.m4 \
+ $(top_srcdir)/config/ax_tls.m4 \
+ $(top_srcdir)/config/bindings.m4 $(top_srcdir)/config/boost.m4 \
+ $(top_srcdir)/config/cudd.m4 $(top_srcdir)/config/cvc4.m4 \
+ $(top_srcdir)/config/gcc_version.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/pkg.m4 $(top_srcdir)/config/readline.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
- configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = config.h
+CONFIG_HEADER = $(top_builddir)/cvc4autoconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@@ -61,17 +77,11 @@ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
- distdir dist dist-all distcheck
+ distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-distdir = $(PACKAGE)-$(VERSION)
-top_distdir = $(distdir)
-am__remove_distdir = \
- { test ! -d "$(distdir)" \
- || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
- && rm -fr "$(distdir)"; }; }
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@@ -97,60 +107,130 @@ am__relativize = \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
-DIST_ARCHIVES = $(distdir).tar.gz
-GZIP_ENV = --best
-distuninstallcheck_listfiles = find . -type f -print
-distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+ANTLR = @ANTLR@
+ANTLR_HOME = @ANTLR_HOME@
+ANTLR_INCLUDES = @ANTLR_INCLUDES@
+ANTLR_LDFLAGS = @ANTLR_LDFLAGS@
AR = @AR@
+AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LDPATH = @BOOST_LDPATH@
+BOOST_ROOT = @BOOST_ROOT@
+BOOST_THREAD_LDFLAGS = @BOOST_THREAD_LDFLAGS@
+BOOST_THREAD_LDPATH = @BOOST_THREAD_LDPATH@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
+CAMLP4O = @CAMLP4O@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CLN_CFLAGS = @CLN_CFLAGS@
+CLN_LIBS = @CLN_LIBS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CSHARP_CPPFLAGS = @CSHARP_CPPFLAGS@
+CUDD_CPPFLAGS = @CUDD_CPPFLAGS@
+CUDD_LDFLAGS = @CUDD_LDFLAGS@
+CUDD_LIBS = @CUDD_LIBS@
+CVC4_BINDINGS_LIBRARY_VERSION = @CVC4_BINDINGS_LIBRARY_VERSION@
+CVC4_BUILD_LIBCOMPAT = @CVC4_BUILD_LIBCOMPAT@
+CVC4_COMPAT_LIBRARY_VERSION = @CVC4_COMPAT_LIBRARY_VERSION@
+CVC4_HAS_THREADS = @CVC4_HAS_THREADS@
+CVC4_LANGUAGE_BINDINGS = @CVC4_LANGUAGE_BINDINGS@
+CVC4_LIBRARY_VERSION = @CVC4_LIBRARY_VERSION@
+CVC4_PARSER_LIBRARY_VERSION = @CVC4_PARSER_LIBRARY_VERSION@
+CVC4_TLS = @CVC4_TLS@
+CVC4_TLS_SUPPORTED = @CVC4_TLS_SUPPORTED@
+CVC4_USE_CLN_IMP = @CVC4_USE_CLN_IMP@
+CVC4_USE_GMP_IMP = @CVC4_USE_GMP_IMP@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
+CXXTEST = @CXXTEST@
+CXXTESTGEN = @CXXTESTGEN@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXTRACT_PRIVATE = @DOXYGEN_EXTRACT_PRIVATE@
+DOXYGEN_EXTRACT_STATIC = @DOXYGEN_EXTRACT_STATIC@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_DX_CURRENT_FEATURE = @DX_FLAG_DX_CURRENT_FEATURE@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+FLAG_VISIBILITY_HIDDEN = @FLAG_VISIBILITY_HIDDEN@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVAH = @JAVAH@
+JAVA_CPPFLAGS = @JAVA_CPPFLAGS@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LFSC = @LFSC@
+LFSCARGS = @LFSCARGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
+MAN_DATE = @MAN_DATE@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+OCAMLC = @OCAMLC@
+OCAMLFIND = @OCAMLFIND@
+OCAMLMKTOP = @OCAMLMKTOP@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
@@ -161,12 +241,33 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_CPPFLAGS = @PERL_CPPFLAGS@
+PHP_CPPFLAGS = @PHP_CPPFLAGS@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_CONFIG = @PYTHON_CONFIG@
+PYTHON_CXXFLAGS = @PYTHON_CXXFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDE = @PYTHON_INCLUDE@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
+RUBY_CPPFLAGS = @RUBY_CPPFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+STATIC_BINARY = @STATIC_BINARY@
STRIP = @STRIP@
+SWIG = @SWIG@
+TCL_CPPFLAGS = @TCL_CPPFLAGS@
+TEST_CPPFLAGS = @TEST_CPPFLAGS@
+TEST_CXXFLAGS = @TEST_CXXFLAGS@
+TEST_LDFLAGS = @TEST_LDFLAGS@
VERSION = @VERSION@
+WNO_CONVERSION_NULL = @WNO_CONVERSION_NULL@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -206,17 +307,26 @@ libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
+mk_include = @mk_include@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
+target = @target@
target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@@ -229,71 +339,46 @@ SUBDIRS = Solver mtl MTRand man
EXTRA_DIST = HOWTO_VisualCpp HOWTO_MinGW32 \
LICENSE-GPL LICENSE-MIT TODO
-all: config.h
- $(MAKE) $(AM_MAKEFLAGS) all-recursive
+all: all-recursive
.SUFFIXES:
-am--refresh:
- @:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
- $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/prop/cryptominisat/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign Makefile
+ $(AUTOMAKE) --foreign src/prop/cryptominisat/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
- echo ' $(SHELL) ./config.status'; \
- $(SHELL) ./config.status;; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- $(SHELL) ./config.status --recheck
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(top_srcdir)/configure: $(am__configure_deps)
- $(am__cd) $(srcdir) && $(AUTOCONF)
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
- $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
-config.h: stamp-h1
- @if test ! -f $@; then \
- rm -f stamp-h1; \
- $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
- else :; fi
-
-stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
- @rm -f stamp-h1
- cd $(top_builddir) && $(SHELL) ./config.status config.h
-$(srcdir)/config.h.in: $(am__configure_deps)
- ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
- rm -f stamp-h1
- touch $@
-
-distclean-hdr:
- -rm -f config.h stamp-h1
-
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
-distclean-libtool:
- -rm -f libtool config.lt
-
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
@@ -374,7 +459,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
mkid -fID $$unique
tags: TAGS
-TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
@@ -391,7 +476,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
- list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
@@ -409,9 +494,9 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
fi; \
fi
ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
@@ -430,8 +515,6 @@ distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- $(am__remove_distdir)
- test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@@ -489,124 +572,9 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
- -test -n "$(am__skip_mode_fix)" \
- || find "$(distdir)" -type d ! -perm -755 \
- -exec chmod u+rwx,go+rx {} \; -o \
- ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
- ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
- ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
- || chmod -R a+r "$(distdir)"
-dist-gzip: distdir
- tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
- $(am__remove_distdir)
-
-dist-bzip2: distdir
- tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
- $(am__remove_distdir)
-
-dist-lzma: distdir
- tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
- $(am__remove_distdir)
-
-dist-xz: distdir
- tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
- $(am__remove_distdir)
-
-dist-tarZ: distdir
- tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
- $(am__remove_distdir)
-
-dist-shar: distdir
- shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
- $(am__remove_distdir)
-
-dist-zip: distdir
- -rm -f $(distdir).zip
- zip -rq $(distdir).zip $(distdir)
- $(am__remove_distdir)
-
-dist dist-all: distdir
- tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
- $(am__remove_distdir)
-
-# This target untars the dist file and tries a VPATH configuration. Then
-# it guarantees that the distribution is self-contained by making another
-# tarfile.
-distcheck: dist
- case '$(DIST_ARCHIVES)' in \
- *.tar.gz*) \
- GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
- *.tar.bz2*) \
- bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
- *.tar.lzma*) \
- lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
- *.tar.xz*) \
- xz -dc $(distdir).tar.xz | $(am__untar) ;;\
- *.tar.Z*) \
- uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
- *.shar.gz*) \
- GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
- *.zip*) \
- unzip $(distdir).zip ;;\
- esac
- chmod -R a-w $(distdir); chmod a+w $(distdir)
- mkdir $(distdir)/_build
- mkdir $(distdir)/_inst
- chmod a-w $(distdir)
- test -d $(distdir)/_build || exit 0; \
- dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
- && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
- && am__cwd=`pwd` \
- && $(am__cd) $(distdir)/_build \
- && ../configure --srcdir=.. --prefix="$$dc_install_base" \
- $(DISTCHECK_CONFIGURE_FLAGS) \
- && $(MAKE) $(AM_MAKEFLAGS) \
- && $(MAKE) $(AM_MAKEFLAGS) dvi \
- && $(MAKE) $(AM_MAKEFLAGS) check \
- && $(MAKE) $(AM_MAKEFLAGS) install \
- && $(MAKE) $(AM_MAKEFLAGS) installcheck \
- && $(MAKE) $(AM_MAKEFLAGS) uninstall \
- && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
- distuninstallcheck \
- && chmod -R a-w "$$dc_install_base" \
- && ({ \
- (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
- && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
- && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
- && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
- distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
- } || { rm -rf "$$dc_destdir"; exit 1; }) \
- && rm -rf "$$dc_destdir" \
- && $(MAKE) $(AM_MAKEFLAGS) dist \
- && rm -rf $(DIST_ARCHIVES) \
- && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
- && cd "$$am__cwd" \
- || exit 1
- $(am__remove_distdir)
- @(echo "$(distdir) archives ready for distribution: "; \
- list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
- sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
-distuninstallcheck:
- @$(am__cd) '$(distuninstallcheck_dir)' \
- && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
- || { echo "ERROR: files left after uninstall:" ; \
- if test -n "$(DESTDIR)"; then \
- echo " (check DESTDIR support)"; \
- fi ; \
- $(distuninstallcheck_listfiles) ; \
- exit 1; } >&2
-distcleancheck: distclean
- @if test '$(srcdir)' = . ; then \
- echo "ERROR: distcleancheck can only run from a VPATH build" ; \
- exit 1 ; \
- fi
- @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
- || { echo "ERROR: files left in build directory after distclean:" ; \
- $(distcleancheck_listfiles) ; \
- exit 1; } >&2
check-am: all-am
check: check-recursive
-all-am: Makefile config.h all-local
+all-am: Makefile all-local
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
@@ -639,10 +607,8 @@ clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
- -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-hdr \
- distclean-libtool distclean-tags
+distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
@@ -685,8 +651,6 @@ install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
- -rm -f $(am__CONFIG_DISTCLEAN_FILES)
- -rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -704,25 +668,22 @@ ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
- ctags-recursive install-am install-strip tags-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+ install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am all-local am--refresh check check-am clean \
- clean-generic clean-libtool ctags ctags-recursive dist \
- dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \
- dist-xz dist-zip distcheck distclean distclean-generic \
- distclean-hdr distclean-libtool distclean-tags distcleancheck \
- distdir distuninstallcheck dvi dvi-am html html-am info \
- info-am install install-am install-data install-data-am \
- install-dvi install-dvi-am install-exec install-exec-am \
- install-html install-html-am install-info install-info-am \
- install-man install-pdf install-pdf-am install-ps \
- install-ps-am install-strip installcheck installcheck-am \
- installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am
+ all all-am all-local check check-am clean clean-generic \
+ clean-libtool ctags ctags-recursive distclean \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am
all-local: Solver
diff --git a/src/prop/cryptominisat/Solver/Makefile.in b/src/prop/cryptominisat/Solver/Makefile.in
index dd524fba2..02344edd7 100644
--- a/src/prop/cryptominisat/Solver/Makefile.in
+++ b/src/prop/cryptominisat/Solver/Makefile.in
@@ -36,16 +36,29 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+target_triplet = @target@
bin_PROGRAMS = cryptominisat$(EXEEXT)
-subdir = Solver
+subdir = src/prop/cryptominisat/Solver
DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/antlr.m4 \
+ $(top_srcdir)/config/ax_prog_doxygen.m4 \
+ $(top_srcdir)/config/ax_tls.m4 \
+ $(top_srcdir)/config/bindings.m4 $(top_srcdir)/config/boost.m4 \
+ $(top_srcdir)/config/cudd.m4 $(top_srcdir)/config/cvc4.m4 \
+ $(top_srcdir)/config/gcc_version.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/pkg.m4 $(top_srcdir)/config/readline.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_HEADER = $(top_builddir)/cvc4autoconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -81,29 +94,47 @@ am_libcryptominisat_la_OBJECTS = ClauseCleaner.lo FailedLitSearcher.lo \
ClauseVivifier.lo CompleteDetachReattacher.lo DimacsParser.lo \
OnlyNonLearntBins.lo SolverConf.lo DataSync.lo BothCache.lo
libcryptominisat_la_OBJECTS = $(am_libcryptominisat_la_OBJECTS)
-libcryptominisat_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
- $(CXXFLAGS) $(libcryptominisat_la_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_lt = $(am__v_lt_$(V))
+am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__v_lt_0 = --silent
+libcryptominisat_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+ $(AM_CXXFLAGS) $(CXXFLAGS) $(libcryptominisat_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
PROGRAMS = $(bin_PROGRAMS)
am_cryptominisat_OBJECTS = Main.$(OBJEXT)
cryptominisat_OBJECTS = $(am_cryptominisat_OBJECTS)
cryptominisat_DEPENDENCIES = libcryptominisat.la
-cryptominisat_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
- $(CXXFLAGS) $(cryptominisat_LDFLAGS) $(LDFLAGS) -o $@
+cryptominisat_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+ $(AM_CXXFLAGS) $(CXXFLAGS) $(cryptominisat_LDFLAGS) $(LDFLAGS) \
+ -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_$(V))
+am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+am__v_CXX_0 = @echo " CXX " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
CXXLD = $(CXX)
-CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_$(V))
+am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libcryptominisat_la_SOURCES) $(cryptominisat_SOURCES)
DIST_SOURCES = $(libcryptominisat_la_SOURCES) $(cryptominisat_SOURCES)
HEADERS = $(pkgincludesub_HEADERS)
@@ -112,54 +143,128 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+ANTLR = @ANTLR@
+ANTLR_HOME = @ANTLR_HOME@
+ANTLR_INCLUDES = @ANTLR_INCLUDES@
+ANTLR_LDFLAGS = @ANTLR_LDFLAGS@
AR = @AR@
+AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LDPATH = @BOOST_LDPATH@
+BOOST_ROOT = @BOOST_ROOT@
+BOOST_THREAD_LDFLAGS = @BOOST_THREAD_LDFLAGS@
+BOOST_THREAD_LDPATH = @BOOST_THREAD_LDPATH@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
+CAMLP4O = @CAMLP4O@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CLN_CFLAGS = @CLN_CFLAGS@
+CLN_LIBS = @CLN_LIBS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CSHARP_CPPFLAGS = @CSHARP_CPPFLAGS@
+CUDD_CPPFLAGS = @CUDD_CPPFLAGS@
+CUDD_LDFLAGS = @CUDD_LDFLAGS@
+CUDD_LIBS = @CUDD_LIBS@
+CVC4_BINDINGS_LIBRARY_VERSION = @CVC4_BINDINGS_LIBRARY_VERSION@
+CVC4_BUILD_LIBCOMPAT = @CVC4_BUILD_LIBCOMPAT@
+CVC4_COMPAT_LIBRARY_VERSION = @CVC4_COMPAT_LIBRARY_VERSION@
+CVC4_HAS_THREADS = @CVC4_HAS_THREADS@
+CVC4_LANGUAGE_BINDINGS = @CVC4_LANGUAGE_BINDINGS@
+CVC4_LIBRARY_VERSION = @CVC4_LIBRARY_VERSION@
+CVC4_PARSER_LIBRARY_VERSION = @CVC4_PARSER_LIBRARY_VERSION@
+CVC4_TLS = @CVC4_TLS@
+CVC4_TLS_SUPPORTED = @CVC4_TLS_SUPPORTED@
+CVC4_USE_CLN_IMP = @CVC4_USE_CLN_IMP@
+CVC4_USE_GMP_IMP = @CVC4_USE_GMP_IMP@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
+CXXTEST = @CXXTEST@
+CXXTESTGEN = @CXXTESTGEN@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXTRACT_PRIVATE = @DOXYGEN_EXTRACT_PRIVATE@
+DOXYGEN_EXTRACT_STATIC = @DOXYGEN_EXTRACT_STATIC@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_DX_CURRENT_FEATURE = @DX_FLAG_DX_CURRENT_FEATURE@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+FLAG_VISIBILITY_HIDDEN = @FLAG_VISIBILITY_HIDDEN@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVAH = @JAVAH@
+JAVA_CPPFLAGS = @JAVA_CPPFLAGS@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LFSC = @LFSC@
+LFSCARGS = @LFSCARGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
+MAN_DATE = @MAN_DATE@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+OCAMLC = @OCAMLC@
+OCAMLFIND = @OCAMLFIND@
+OCAMLMKTOP = @OCAMLMKTOP@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
@@ -170,12 +275,33 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_CPPFLAGS = @PERL_CPPFLAGS@
+PHP_CPPFLAGS = @PHP_CPPFLAGS@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_CONFIG = @PYTHON_CONFIG@
+PYTHON_CXXFLAGS = @PYTHON_CXXFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDE = @PYTHON_INCLUDE@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
+RUBY_CPPFLAGS = @RUBY_CPPFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+STATIC_BINARY = @STATIC_BINARY@
STRIP = @STRIP@
+SWIG = @SWIG@
+TCL_CPPFLAGS = @TCL_CPPFLAGS@
+TEST_CPPFLAGS = @TEST_CPPFLAGS@
+TEST_CXXFLAGS = @TEST_CXXFLAGS@
+TEST_LDFLAGS = @TEST_LDFLAGS@
VERSION = @VERSION@
+WNO_CONVERSION_NULL = @WNO_CONVERSION_NULL@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -215,17 +341,26 @@ libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
+mk_include = @mk_include@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
+target = @target@
target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@@ -263,7 +398,7 @@ all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -272,9 +407,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Solver/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/prop/cryptominisat/Solver/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu Solver/Makefile
+ $(AUTOMAKE) --foreign src/prop/cryptominisat/Solver/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -288,9 +423,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(top_srcdir)/configure: $(am__configure_deps)
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@@ -325,7 +460,7 @@ clean-libLTLIBRARIES:
rm -f "$${dir}/so_locations"; \
done
libcryptominisat.la: $(libcryptominisat_la_OBJECTS) $(libcryptominisat_la_DEPENDENCIES)
- $(libcryptominisat_la_LINK) -rpath $(libdir) $(libcryptominisat_la_OBJECTS) $(libcryptominisat_la_LIBADD) $(LIBS)
+ $(AM_V_CXXLD)$(libcryptominisat_la_LINK) -rpath $(libdir) $(libcryptominisat_la_OBJECTS) $(libcryptominisat_la_LIBADD) $(LIBS)
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@@ -371,7 +506,7 @@ clean-binPROGRAMS:
rm -f $$list
cryptominisat$(EXEEXT): $(cryptominisat_OBJECTS) $(cryptominisat_DEPENDENCIES)
@rm -f cryptominisat$(EXEEXT)
- $(cryptominisat_LINK) $(cryptominisat_OBJECTS) $(cryptominisat_LDADD) $(LIBS)
+ $(AM_V_CXXLD)$(cryptominisat_LINK) $(cryptominisat_OBJECTS) $(cryptominisat_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -406,22 +541,25 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XorSubsumer.Plo@am__quote@
.cpp.o:
-@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
-@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
-@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/prop/cryptominisat/man/Makefile.in b/src/prop/cryptominisat/man/Makefile.in
index 5542511eb..7dc705cf1 100644
--- a/src/prop/cryptominisat/man/Makefile.in
+++ b/src/prop/cryptominisat/man/Makefile.in
@@ -33,16 +33,35 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-subdir = man
+target_triplet = @target@
+subdir = src/prop/cryptominisat/man
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/antlr.m4 \
+ $(top_srcdir)/config/ax_prog_doxygen.m4 \
+ $(top_srcdir)/config/ax_tls.m4 \
+ $(top_srcdir)/config/bindings.m4 $(top_srcdir)/config/boost.m4 \
+ $(top_srcdir)/config/cudd.m4 $(top_srcdir)/config/cvc4.m4 \
+ $(top_srcdir)/config/gcc_version.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/pkg.m4 $(top_srcdir)/config/readline.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_HEADER = $(top_builddir)/cvc4autoconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -73,54 +92,128 @@ MANS = $(man_MANS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+ANTLR = @ANTLR@
+ANTLR_HOME = @ANTLR_HOME@
+ANTLR_INCLUDES = @ANTLR_INCLUDES@
+ANTLR_LDFLAGS = @ANTLR_LDFLAGS@
AR = @AR@
+AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LDPATH = @BOOST_LDPATH@
+BOOST_ROOT = @BOOST_ROOT@
+BOOST_THREAD_LDFLAGS = @BOOST_THREAD_LDFLAGS@
+BOOST_THREAD_LDPATH = @BOOST_THREAD_LDPATH@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
+CAMLP4O = @CAMLP4O@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CLN_CFLAGS = @CLN_CFLAGS@
+CLN_LIBS = @CLN_LIBS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CSHARP_CPPFLAGS = @CSHARP_CPPFLAGS@
+CUDD_CPPFLAGS = @CUDD_CPPFLAGS@
+CUDD_LDFLAGS = @CUDD_LDFLAGS@
+CUDD_LIBS = @CUDD_LIBS@
+CVC4_BINDINGS_LIBRARY_VERSION = @CVC4_BINDINGS_LIBRARY_VERSION@
+CVC4_BUILD_LIBCOMPAT = @CVC4_BUILD_LIBCOMPAT@
+CVC4_COMPAT_LIBRARY_VERSION = @CVC4_COMPAT_LIBRARY_VERSION@
+CVC4_HAS_THREADS = @CVC4_HAS_THREADS@
+CVC4_LANGUAGE_BINDINGS = @CVC4_LANGUAGE_BINDINGS@
+CVC4_LIBRARY_VERSION = @CVC4_LIBRARY_VERSION@
+CVC4_PARSER_LIBRARY_VERSION = @CVC4_PARSER_LIBRARY_VERSION@
+CVC4_TLS = @CVC4_TLS@
+CVC4_TLS_SUPPORTED = @CVC4_TLS_SUPPORTED@
+CVC4_USE_CLN_IMP = @CVC4_USE_CLN_IMP@
+CVC4_USE_GMP_IMP = @CVC4_USE_GMP_IMP@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
+CXXTEST = @CXXTEST@
+CXXTESTGEN = @CXXTESTGEN@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXTRACT_PRIVATE = @DOXYGEN_EXTRACT_PRIVATE@
+DOXYGEN_EXTRACT_STATIC = @DOXYGEN_EXTRACT_STATIC@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_DX_CURRENT_FEATURE = @DX_FLAG_DX_CURRENT_FEATURE@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+FLAG_VISIBILITY_HIDDEN = @FLAG_VISIBILITY_HIDDEN@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVAH = @JAVAH@
+JAVA_CPPFLAGS = @JAVA_CPPFLAGS@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LFSC = @LFSC@
+LFSCARGS = @LFSCARGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
+MAN_DATE = @MAN_DATE@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+OCAMLC = @OCAMLC@
+OCAMLFIND = @OCAMLFIND@
+OCAMLMKTOP = @OCAMLMKTOP@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
@@ -131,12 +224,33 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_CPPFLAGS = @PERL_CPPFLAGS@
+PHP_CPPFLAGS = @PHP_CPPFLAGS@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_CONFIG = @PYTHON_CONFIG@
+PYTHON_CXXFLAGS = @PYTHON_CXXFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDE = @PYTHON_INCLUDE@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
+RUBY_CPPFLAGS = @RUBY_CPPFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+STATIC_BINARY = @STATIC_BINARY@
STRIP = @STRIP@
+SWIG = @SWIG@
+TCL_CPPFLAGS = @TCL_CPPFLAGS@
+TEST_CPPFLAGS = @TEST_CPPFLAGS@
+TEST_CXXFLAGS = @TEST_CXXFLAGS@
+TEST_LDFLAGS = @TEST_LDFLAGS@
VERSION = @VERSION@
+WNO_CONVERSION_NULL = @WNO_CONVERSION_NULL@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -176,17 +290,26 @@ libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
+mk_include = @mk_include@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
+target = @target@
target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@@ -195,7 +318,7 @@ EXTRA_DIST = $(man_MANS)
all: all-am
.SUFFIXES:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -204,9 +327,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/prop/cryptominisat/man/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu man/Makefile
+ $(AUTOMAKE) --foreign src/prop/cryptominisat/man/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -220,9 +343,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(top_srcdir)/configure: $(am__configure_deps)
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
diff --git a/src/prop/cryptominisat/mtl/Makefile.in b/src/prop/cryptominisat/mtl/Makefile.in
index eb9b73e19..7d8c8ce1b 100644
--- a/src/prop/cryptominisat/mtl/Makefile.in
+++ b/src/prop/cryptominisat/mtl/Makefile.in
@@ -34,17 +34,36 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-subdir = mtl
+target_triplet = @target@
+subdir = src/prop/cryptominisat/mtl
DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/antlr.m4 \
+ $(top_srcdir)/config/ax_prog_doxygen.m4 \
+ $(top_srcdir)/config/ax_tls.m4 \
+ $(top_srcdir)/config/bindings.m4 $(top_srcdir)/config/boost.m4 \
+ $(top_srcdir)/config/cudd.m4 $(top_srcdir)/config/cvc4.m4 \
+ $(top_srcdir)/config/gcc_version.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/pkg.m4 $(top_srcdir)/config/readline.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_HEADER = $(top_builddir)/cvc4autoconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -75,54 +94,128 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+ANTLR = @ANTLR@
+ANTLR_HOME = @ANTLR_HOME@
+ANTLR_INCLUDES = @ANTLR_INCLUDES@
+ANTLR_LDFLAGS = @ANTLR_LDFLAGS@
AR = @AR@
+AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LDPATH = @BOOST_LDPATH@
+BOOST_ROOT = @BOOST_ROOT@
+BOOST_THREAD_LDFLAGS = @BOOST_THREAD_LDFLAGS@
+BOOST_THREAD_LDPATH = @BOOST_THREAD_LDPATH@
+BOOST_THREAD_LIBS = @BOOST_THREAD_LIBS@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
+CAMLP4O = @CAMLP4O@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CLN_CFLAGS = @CLN_CFLAGS@
+CLN_LIBS = @CLN_LIBS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CSHARP_CPPFLAGS = @CSHARP_CPPFLAGS@
+CUDD_CPPFLAGS = @CUDD_CPPFLAGS@
+CUDD_LDFLAGS = @CUDD_LDFLAGS@
+CUDD_LIBS = @CUDD_LIBS@
+CVC4_BINDINGS_LIBRARY_VERSION = @CVC4_BINDINGS_LIBRARY_VERSION@
+CVC4_BUILD_LIBCOMPAT = @CVC4_BUILD_LIBCOMPAT@
+CVC4_COMPAT_LIBRARY_VERSION = @CVC4_COMPAT_LIBRARY_VERSION@
+CVC4_HAS_THREADS = @CVC4_HAS_THREADS@
+CVC4_LANGUAGE_BINDINGS = @CVC4_LANGUAGE_BINDINGS@
+CVC4_LIBRARY_VERSION = @CVC4_LIBRARY_VERSION@
+CVC4_PARSER_LIBRARY_VERSION = @CVC4_PARSER_LIBRARY_VERSION@
+CVC4_TLS = @CVC4_TLS@
+CVC4_TLS_SUPPORTED = @CVC4_TLS_SUPPORTED@
+CVC4_USE_CLN_IMP = @CVC4_USE_CLN_IMP@
+CVC4_USE_GMP_IMP = @CVC4_USE_GMP_IMP@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
+CXXTEST = @CXXTEST@
+CXXTESTGEN = @CXXTESTGEN@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXTRACT_PRIVATE = @DOXYGEN_EXTRACT_PRIVATE@
+DOXYGEN_EXTRACT_STATIC = @DOXYGEN_EXTRACT_STATIC@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_DX_CURRENT_FEATURE = @DX_FLAG_DX_CURRENT_FEATURE@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+FLAG_VISIBILITY_HIDDEN = @FLAG_VISIBILITY_HIDDEN@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVAH = @JAVAH@
+JAVA_CPPFLAGS = @JAVA_CPPFLAGS@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LFSC = @LFSC@
+LFSCARGS = @LFSCARGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
+MAN_DATE = @MAN_DATE@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+OCAMLC = @OCAMLC@
+OCAMLFIND = @OCAMLFIND@
+OCAMLMKTOP = @OCAMLMKTOP@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
@@ -133,12 +226,33 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_CPPFLAGS = @PERL_CPPFLAGS@
+PHP_CPPFLAGS = @PHP_CPPFLAGS@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_CONFIG = @PYTHON_CONFIG@
+PYTHON_CXXFLAGS = @PYTHON_CXXFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDE = @PYTHON_INCLUDE@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
+RUBY_CPPFLAGS = @RUBY_CPPFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+STATIC_BINARY = @STATIC_BINARY@
STRIP = @STRIP@
+SWIG = @SWIG@
+TCL_CPPFLAGS = @TCL_CPPFLAGS@
+TEST_CPPFLAGS = @TEST_CPPFLAGS@
+TEST_CXXFLAGS = @TEST_CXXFLAGS@
+TEST_LDFLAGS = @TEST_LDFLAGS@
VERSION = @VERSION@
+WNO_CONVERSION_NULL = @WNO_CONVERSION_NULL@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -178,17 +292,26 @@ libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
+mk_include = @mk_include@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
+target = @target@
target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@@ -197,7 +320,7 @@ pkgincludesub_HEADERS = Alg.h Heap.h Vec.h
all: all-am
.SUFFIXES:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -206,9 +329,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mtl/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/prop/cryptominisat/mtl/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu mtl/Makefile
+ $(AUTOMAKE) --foreign src/prop/cryptominisat/mtl/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -222,9 +345,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(top_srcdir)/configure: $(am__configure_deps)
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
diff --git a/src/prop/minisat/core/Solver.cc b/src/prop/minisat/core/Solver.cc
index 3a16b0d19..c602d8b9c 100644
--- a/src/prop/minisat/core/Solver.cc
+++ b/src/prop/minisat/core/Solver.cc
@@ -195,6 +195,8 @@ CRef Solver::reason(Var x) {
if (varLevel > explLevel) {
explLevel = varLevel;
}
+ Assert(value(explanation[i]) != l_Undef);
+ Assert(i == 0 || trail_index(var(explanation[0])) > trail_index(var(explanation[i])));
}
// Construct the reason (level 0)
diff --git a/src/prop/sat_solver.h b/src/prop/sat_solver.h
index f18335048..4fe24fc60 100644
--- a/src/prop/sat_solver.h
+++ b/src/prop/sat_solver.h
@@ -72,11 +72,20 @@ public:
class BVSatSolverInterface: public SatSolver {
public:
- virtual SatValue solve(const context::CDList<SatLiteral> & assumptions) = 0;
virtual void markUnremovable(SatLiteral lit) = 0;
virtual void getUnsatCore(SatClause& unsatCore) = 0;
+
+ virtual void addMarkerLiteral(SatLiteral lit) = 0;
+
+ virtual bool getPropagations(std::vector<SatLiteral>& propagations) = 0;
+
+ virtual void explainPropagation(SatLiteral lit, std::vector<SatLiteral>& explanation) = 0;
+
+ virtual SatValue assertAssumption(SatLiteral lit, bool propagate = false) = 0;
+
+ virtual void popAssumption() = 0;
};
diff --git a/src/prop/sat_solver_factory.cpp b/src/prop/sat_solver_factory.cpp
index e6ae5d1e7..3b048af47 100644
--- a/src/prop/sat_solver_factory.cpp
+++ b/src/prop/sat_solver_factory.cpp
@@ -27,8 +27,8 @@ namespace prop {
template class SatSolverConstructor<MinisatSatSolver>;
template class SatSolverConstructor<BVMinisatSatSolver>;
-BVSatSolverInterface* SatSolverFactory::createMinisat() {
- return new BVMinisatSatSolver();
+BVSatSolverInterface* SatSolverFactory::createMinisat(context::Context* mainSatContext) {
+ return new BVMinisatSatSolver(mainSatContext);
}
DPLLSatSolverInterface* SatSolverFactory::createDPLLMinisat() {
diff --git a/src/prop/sat_solver_factory.h b/src/prop/sat_solver_factory.h
index 367397fdf..379141cc6 100644
--- a/src/prop/sat_solver_factory.h
+++ b/src/prop/sat_solver_factory.h
@@ -30,7 +30,7 @@ namespace prop {
class SatSolverFactory {
public:
- static BVSatSolverInterface* createMinisat();
+ static BVSatSolverInterface* createMinisat(context::Context* mainSatContext);
static DPLLSatSolverInterface* createDPLLMinisat();
static SatSolver* create(const char* id);
diff --git a/src/theory/bv/bitblast_strategies.cpp b/src/theory/bv/bitblast_strategies.cpp
index c0855122e..edaf8c154 100644
--- a/src/theory/bv/bitblast_strategies.cpp
+++ b/src/theory/bv/bitblast_strategies.cpp
@@ -106,7 +106,7 @@ void inline makeZero(Bits& bits, unsigned width) {
* @return the carry-out
*/
Node inline rippleCarryAdder(const Bits&a, const Bits& b, Bits& res, Node carry) {
- Assert(res.size() == 0 && a.size() == b.size());
+ Assert(a.size() == b.size() && res.size() == 0);
for (unsigned i = 0 ; i < a.size(); ++i) {
Node sum = mkXor(mkXor(a[i], b[i]), carry);
@@ -119,6 +119,24 @@ Node inline rippleCarryAdder(const Bits&a, const Bits& b, Bits& res, Node carry)
return carry;
}
+inline void shiftAddMultiplier(const Bits&a, const Bits&b, Bits& res) {
+
+ for (unsigned i = 0; i < a.size(); ++i) {
+ res.push_back(mkNode(kind::AND, b[0], a[i]));
+ }
+
+ for(unsigned k = 1; k < res.size(); ++k) {
+ Node carry_in = mkFalse();
+ Node carry_out;
+ for(unsigned j = 0; j < res.size() -k; ++j) {
+ Node aj = mkAnd(a[j], b[k]);
+ carry_out = mkOr(mkAnd(res[j+k], aj),
+ mkAnd( mkXor(res[j+k], aj), carry_in));
+ res[j+k] = mkXor(mkXor(res[j+k], aj), carry_in);
+ carry_in = carry_out;
+ }
+ }
+}
Node inline uLessThanBB(const Bits&a, const Bits& b, bool orEqual) {
Assert (a.size() && b.size());
@@ -175,13 +193,13 @@ Node inline sLessThanBB(const Bits&a, const Bits& b, bool orEqual) {
Node UndefinedAtomBBStrategy(TNode node, Bitblaster* bb) {
- Trace("bitvector") << "TheoryBV::Bitblaster Undefined bitblasting strategy for kind: "
+ BVDebug("bitvector") << "TheoryBV::Bitblaster Undefined bitblasting strategy for kind: "
<< node.getKind() << "\n";
Unreachable();
}
Node DefaultEqBB(TNode node, Bitblaster* bb) {
- Debug("bitvector-bb") << "Bitblasting node " << node << "\n";
+ BVDebug("bitvector-bb") << "Bitblasting node " << node << "\n";
Assert(node.getKind() == kind::EQUAL);
Bits lhs, rhs;
@@ -203,7 +221,7 @@ Node DefaultEqBB(TNode node, Bitblaster* bb) {
Node AdderUltBB(TNode node, Bitblaster* bb) {
- Debug("bitvector-bb") << "Bitblasting node " << node << "\n";
+ BVDebug("bitvector-bb") << "Bitblasting node " << node << "\n";
Assert(node.getKind() == kind::BITVECTOR_ULT);
Bits a, b;
bb->bbTerm(node[0], a);
@@ -225,7 +243,7 @@ Node AdderUltBB(TNode node, Bitblaster* bb) {
Node DefaultUltBB(TNode node, Bitblaster* bb) {
- Debug("bitvector-bb") << "Bitblasting node " << node << "\n";
+ BVDebug("bitvector-bb") << "Bitblasting node " << node << "\n";
Assert(node.getKind() == kind::BITVECTOR_ULT);
Bits a, b;
bb->bbTerm(node[0], a);
@@ -238,7 +256,7 @@ Node DefaultUltBB(TNode node, Bitblaster* bb) {
}
Node DefaultUleBB(TNode node, Bitblaster* bb){
- Debug("bitvector-bb") << "Bitblasting node " << node << "\n";
+ BVDebug("bitvector-bb") << "Bitblasting node " << node << "\n";
Assert(node.getKind() == kind::BITVECTOR_ULE);
Bits a, b;
@@ -251,31 +269,31 @@ Node DefaultUleBB(TNode node, Bitblaster* bb){
}
Node DefaultUgtBB(TNode node, Bitblaster* bb){
- Debug("bitvector-bb") << "Bitblasting node " << node << "\n";
+ BVDebug("bitvector-bb") << "Bitblasting node " << node << "\n";
// should be rewritten
Unimplemented();
}
Node DefaultUgeBB(TNode node, Bitblaster* bb){
- Debug("bitvector-bb") << "Bitblasting node " << node << "\n";
+ BVDebug("bitvector-bb") << "Bitblasting node " << node << "\n";
// should be rewritten
Unimplemented();
}
// Node DefaultSltBB(TNode node, Bitblaster* bb){
-// Debug("bitvector-bb") << "Bitblasting node " << node << "\n";
+// BVDebug("bitvector-bb") << "Bitblasting node " << node << "\n";
// // shoudl be rewritten in terms of ult
// Unimplemented();
// }
// Node DefaultSleBB(TNode node, Bitblaster* bb){
-// Debug("bitvector-bb") << "Bitblasting node " << node << "\n";
+// BVDebug("bitvector-bb") << "Bitblasting node " << node << "\n";
// // shoudl be rewritten in terms of ule
// Unimplemented();
// }
Node DefaultSltBB(TNode node, Bitblaster* bb){
- Debug("bitvector-bb") << "Bitblasting node " << node << "\n";
+ BVDebug("bitvector-bb") << "Bitblasting node " << node << "\n";
Bits a, b;
bb->bbTerm(node[0], a);
@@ -287,7 +305,7 @@ Node DefaultSltBB(TNode node, Bitblaster* bb){
}
Node DefaultSleBB(TNode node, Bitblaster* bb){
- Debug("bitvector-bb") << "Bitblasting node " << node << "\n";
+ BVDebug("bitvector-bb") << "Bitblasting node " << node << "\n";
Bits a, b;
bb->bbTerm(node[0], a);
@@ -299,13 +317,13 @@ Node DefaultSleBB(TNode node, Bitblaster* bb){
}
Node DefaultSgtBB(TNode node, Bitblaster* bb){
- Debug("bitvector-bb") << "Bitblasting node " << node << "\n";
+ BVDebug("bitvector-bb") << "Bitblasting node " << node << "\n";
// should be rewritten
Unimplemented();
}
Node DefaultSgeBB(TNode node, Bitblaster* bb){
- Debug("bitvector-bb") << "Bitblasting node " << node << "\n";
+ BVDebug("bitvector-bb") << "Bitblasting node " << node << "\n";
// should be rewritten
Unimplemented();
}
@@ -314,7 +332,7 @@ Node DefaultSgeBB(TNode node, Bitblaster* bb){
/// Term bitblasting strategies
void UndefinedTermBBStrategy(TNode node, Bits& bits, Bitblaster* bb) {
- Trace("bitvector") << "theory::bv:: Undefined bitblasting strategy for kind: "
+ BVDebug("bitvector") << "theory::bv:: Undefined bitblasting strategy for kind: "
<< node.getKind() << "\n";
Unreachable();
}
@@ -327,12 +345,12 @@ void DefaultVarBB (TNode node, Bits& bits, Bitblaster* bb) {
bits.push_back(utils::mkBitOf(node, i));
}
- Debug("bitvector-bb") << "theory::bv::DefaultVarBB bitblasting " << node << "\n";
- Debug("bitvector-bb") << " with bits " << toString(bits);
+ BVDebug("bitvector-bb") << "theory::bv::DefaultVarBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << " with bits " << toString(bits);
}
void DefaultConstBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaultConstBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefaultConstBB bitblasting " << node << "\n";
Assert(node.getKind() == kind::CONST_BITVECTOR);
Assert(bits.size() == 0);
@@ -345,12 +363,12 @@ void DefaultConstBB (TNode node, Bits& bits, Bitblaster* bb) {
bits.push_back(utils::mkTrue());
}
}
- Debug("bitvector-bb") << "with bits: " << toString(bits) << "\n";
+ BVDebug("bitvector-bb") << "with bits: " << toString(bits) << "\n";
}
void DefaultNotBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaultNotBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefaultNotBB bitblasting " << node << "\n";
Assert(node.getKind() == kind::BITVECTOR_NOT);
Assert(bits.size() == 0);
Bits bv;
@@ -359,7 +377,7 @@ void DefaultNotBB (TNode node, Bits& bits, Bitblaster* bb) {
}
void DefaultConcatBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaultConcatBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefaultConcatBB bitblasting " << node << "\n";
Assert(bits.size() == 0);
Assert (node.getKind() == kind::BITVECTOR_CONCAT);
@@ -373,64 +391,68 @@ void DefaultConcatBB (TNode node, Bits& bits, Bitblaster* bb) {
}
}
Assert (bits.size() == utils::getSize(node));
- Debug("bitvector-bb") << "with bits: " << toString(bits) << "\n";
+ BVDebug("bitvector-bb") << "with bits: " << toString(bits) << "\n";
}
-
void DefaultAndBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaultAndBB bitblasting " << node << "\n";
-
- Assert(node.getNumChildren() == 2 &&
- node.getKind() == kind::BITVECTOR_AND &&
+ BVDebug("bitvector-bb") << "theory::bv::DefaultAndBB bitblasting " << node << "\n";
+
+ Assert(node.getKind() == kind::BITVECTOR_AND &&
bits.size() == 0);
- Bits lhs, rhs;
- bb->bbTerm(node[0], rhs);
- bb->bbTerm(node[1], lhs);
-
- Assert (lhs.size() == rhs.size());
- for (unsigned i = 0; i < lhs.size(); ++i) {
- bits.push_back(utils::mkAnd(lhs[i], rhs[i]));
+ for(unsigned j = 0; j < utils::getSize(node); ++j) {
+ NodeBuilder<> andBuilder(kind::AND);
+ for (unsigned i = 0; i < node.getNumChildren(); ++i) {
+ Bits current;
+ bb->bbTerm(node[i], current);
+ andBuilder << current[j];
+ Assert(utils::getSize(node) == current.size());
+ }
+ bits.push_back(andBuilder);
}
-
}
void DefaultOrBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaultOrBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefaultOrBB bitblasting " << node << "\n";
- Assert(node.getNumChildren() == 2 &&
- node.getKind() == kind::BITVECTOR_OR &&
+ Assert(node.getKind() == kind::BITVECTOR_OR &&
bits.size() == 0);
- Bits lhs, rhs;
- bb->bbTerm(node[0], lhs);
- bb->bbTerm(node[1], rhs);
- Assert(lhs.size() == rhs.size());
-
- for (unsigned i = 0; i < lhs.size(); ++i) {
- bits.push_back(utils::mkOr(lhs[i], rhs[i]));
+ for(unsigned j = 0; j < utils::getSize(node); ++j) {
+ NodeBuilder<> orBuilder(kind::OR);
+ for (unsigned i = 0; i < node.getNumChildren(); ++i) {
+ Bits current;
+ bb->bbTerm(node[i], current);
+ orBuilder << current[j];
+ Assert(utils::getSize(node) == current.size());
+ }
+ bits.push_back(orBuilder);
}
}
void DefaultXorBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaultXorBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefaultXorBB bitblasting " << node << "\n";
- Assert(node.getNumChildren() == 2 &&
- node.getKind() == kind::BITVECTOR_XOR &&
+ Assert(node.getKind() == kind::BITVECTOR_XOR &&
bits.size() == 0);
- Bits lhs, rhs;
- bb->bbTerm(node[0], lhs);
- bb->bbTerm(node[1], rhs);
- Assert(lhs.size() == rhs.size());
-
- for (unsigned i = 0; i < lhs.size(); ++i) {
- bits.push_back(utils::mkXor(lhs[i], rhs[i]));
+ for(unsigned j = 0; j < utils::getSize(node); ++j) {
+ Bits first;
+ bb->bbTerm(node[0], first);
+ Node bitj = first[j];
+
+ for (unsigned i = 1; i < node.getNumChildren(); ++i) {
+ Bits current;
+ bb->bbTerm(node[i], current);
+ bitj = utils::mkNode(kind::XOR, bitj, current[j]);
+ Assert(utils::getSize(node) == current.size());
+ }
+ bits.push_back(bitj);
}
}
void DefaultXnorBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaultXnorBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefaultXnorBB bitblasting " << node << "\n";
Assert(node.getNumChildren() == 2 &&
node.getKind() == kind::BITVECTOR_XNOR &&
@@ -447,17 +469,17 @@ void DefaultXnorBB (TNode node, Bits& bits, Bitblaster* bb) {
void DefaultNandBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector") << "theory::bv:: Unimplemented kind "
+ BVDebug("bitvector") << "theory::bv:: Unimplemented kind "
<< node.getKind() << "\n";
Unimplemented();
}
void DefaultNorBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector") << "theory::bv:: Unimplemented kind "
+ BVDebug("bitvector") << "theory::bv:: Unimplemented kind "
<< node.getKind() << "\n";
Unimplemented();
}
void DefaultCompBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector") << "theory::bv:: DefaultCompBB bitblasting "<< node << "\n";
+ BVDebug("bitvector") << "theory::bv:: DefaultCompBB bitblasting "<< node << "\n";
Assert(getSize(node) == 1 && bits.size() == 0 && node.getKind() == kind::BITVECTOR_COMP);
Bits a, b;
@@ -475,51 +497,50 @@ void DefaultCompBB (TNode node, Bits& bits, Bitblaster* bb) {
}
void DefaultMultBB (TNode node, Bits& res, Bitblaster* bb) {
- Debug("bitvector") << "theory::bv:: DefaultMultBB bitblasting "<< node << "\n";
+ BVDebug("bitvector") << "theory::bv:: DefaultMultBB bitblasting "<< node << "\n";
Assert(res.size() == 0 &&
node.getKind() == kind::BITVECTOR_MULT);
- Bits a, b;
- bb->bbTerm(node[0], a);
- bb->bbTerm(node[1], b);
- // constructs a simple shift and add multiplier building the result in
- // in res
-
- for (unsigned i = 0; i < a.size(); ++i) {
- res.push_back(mkNode(kind::AND, b[0], a[i]));
- }
-
- for(unsigned k = 1; k < res.size(); ++k) {
- Node carry_in = mkFalse();
- Node carry_out;
- for(unsigned j = 0; j < res.size() -k; ++j) {
- Node aj = mkAnd(a[j], b[k]);
- carry_out = mkOr(mkAnd(res[j+k], aj),
- mkAnd( mkXor(res[j+k], aj), carry_in));
- res[j+k] = mkXor(mkXor(res[j+k], aj), carry_in);
- carry_in = carry_out;
- }
+ Bits newres;
+ bb->bbTerm(node[0], res);
+ for(unsigned i = 1; i < node.getNumChildren(); ++i) {
+ Bits current;
+ bb->bbTerm(node[i], current);
+ newres.clear();
+ // constructs a simple shift and add multiplier building the result
+ // in res
+ shiftAddMultiplier(res, current, newres);
+ res = newres;
}
- Debug("bitvector-bb") << "with bits: " << toString(res) << "\n";
+ BVDebug("bitvector-bb") << "with bits: " << toString(res) << "\n";
}
void DefaultPlusBB (TNode node, Bits& res, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaulPlusBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefaulPlusBB bitblasting " << node << "\n";
Assert(node.getKind() == kind::BITVECTOR_PLUS &&
res.size() == 0);
- Bits a, b;
- bb->bbTerm(node[0], a);
- bb->bbTerm(node[1], b);
+ bb->bbTerm(node[0], res);
- Assert(a.size() == b.size() && utils::getSize(node) == a.size());
- rippleCarryAdder(a, b, res, mkFalse());
+ Bits newres;
+
+ for(unsigned i = 1; i < node.getNumChildren(); ++i) {
+ Bits current;
+ bb->bbTerm(node[i], current);
+ newres.clear();
+ rippleCarryAdder(res, current, newres, utils::mkFalse());
+ res = newres;
+ }
+
+ Assert(res.size() == utils::getSize(node));
}
void DefaultSubBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefautSubBB bitblasting " << node << "\n";
- Assert(node.getKind() == kind::BITVECTOR_SUB && bits.size() == 0);
+ BVDebug("bitvector-bb") << "theory::bv::DefautSubBB bitblasting " << node << "\n";
+ Assert(node.getKind() == kind::BITVECTOR_SUB &&
+ node.getNumChildren() == 2 &&
+ bits.size() == 0);
Bits a, b;
bb->bbTerm(node[0], a);
@@ -534,7 +555,7 @@ void DefaultSubBB (TNode node, Bits& bits, Bitblaster* bb) {
}
void DefaultNegBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefautNegBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefautNegBB bitblasting " << node << "\n";
Assert(node.getKind() == kind::BITVECTOR_NEG);
Bits a;
@@ -612,7 +633,7 @@ void uDivModRec(const Bits& a, const Bits& b, Bits& q, Bits& r, unsigned rec_wid
}
void DefaultUdivBB (TNode node, Bits& q, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefautUdivBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefautUdivBB bitblasting " << node << "\n";
Assert(node.getKind() == kind::BITVECTOR_UDIV && q.size() == 0);
Bits a, b;
@@ -628,7 +649,7 @@ void DefaultUdivBB (TNode node, Bits& q, Bitblaster* bb) {
}
void DefaultUremBB (TNode node, Bits& rem, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefautUremBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefautUremBB bitblasting " << node << "\n";
Assert(node.getKind() == kind::BITVECTOR_UREM && rem.size() == 0);
Bits a, b;
@@ -645,23 +666,23 @@ void DefaultUremBB (TNode node, Bits& rem, Bitblaster* bb) {
void DefaultSdivBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector") << "theory::bv:: Unimplemented kind "
+ BVDebug("bitvector") << "theory::bv:: Unimplemented kind "
<< node.getKind() << "\n";
Unimplemented();
}
void DefaultSremBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector") << "theory::bv:: Unimplemented kind "
+ BVDebug("bitvector") << "theory::bv:: Unimplemented kind "
<< node.getKind() << "\n";
Unimplemented();
}
void DefaultSmodBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector") << "theory::bv:: Unimplemented kind "
+ BVDebug("bitvector") << "theory::bv:: Unimplemented kind "
<< node.getKind() << "\n";
Unimplemented();
}
void DefaultShlBB (TNode node, Bits& res, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaultShlBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefaultShlBB bitblasting " << node << "\n";
Assert (node.getKind() == kind::BITVECTOR_SHL &&
res.size() == 0);
Bits a, b;
@@ -688,11 +709,11 @@ void DefaultShlBB (TNode node, Bits& res, Bitblaster* bb) {
}
}
}
- Debug("bitvector-bb") << "with bits: " << toString(res) << "\n";
+ BVDebug("bitvector-bb") << "with bits: " << toString(res) << "\n";
}
void DefaultLshrBB (TNode node, Bits& res, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaultLshrBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefaultLshrBB bitblasting " << node << "\n";
Assert (node.getKind() == kind::BITVECTOR_LSHR &&
res.size() == 0);
Bits a, b;
@@ -719,12 +740,12 @@ void DefaultLshrBB (TNode node, Bits& res, Bitblaster* bb) {
}
}
}
- Debug("bitvector-bb") << "with bits: " << toString(res) << "\n";
+ BVDebug("bitvector-bb") << "with bits: " << toString(res) << "\n";
}
void DefaultAshrBB (TNode node, Bits& res, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaultAshrBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefaultAshrBB bitblasting " << node << "\n";
Assert (node.getKind() == kind::BITVECTOR_ASHR &&
res.size() == 0);
Bits a, b;
@@ -752,7 +773,7 @@ void DefaultAshrBB (TNode node, Bits& res, Bitblaster* bb) {
}
}
}
- Debug("bitvector-bb") << "with bits: " << toString(res) << "\n";
+ BVDebug("bitvector-bb") << "with bits: " << toString(res) << "\n";
}
@@ -770,14 +791,14 @@ void DefaultExtractBB (TNode node, Bits& bits, Bitblaster* bb) {
}
Assert (bits.size() == high - low + 1);
- Debug("bitvector-bb") << "theory::bv::DefaultExtractBB bitblasting " << node << "\n";
- Debug("bitvector-bb") << " with bits " << toString(bits);
+ BVDebug("bitvector-bb") << "theory::bv::DefaultExtractBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << " with bits " << toString(bits);
}
void DefaultRepeatBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector") << "theory::bv:: Unimplemented kind "
+ BVDebug("bitvector") << "theory::bv:: Unimplemented kind "
<< node.getKind() << "\n";
// this should be rewritten
Unimplemented();
@@ -785,7 +806,7 @@ void DefaultRepeatBB (TNode node, Bits& bits, Bitblaster* bb) {
void DefaultZeroExtendBB (TNode node, Bits& res_bits, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaultZeroExtendBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefaultZeroExtendBB bitblasting " << node << "\n";
// this should be rewritten
Unimplemented();
@@ -793,7 +814,7 @@ void DefaultZeroExtendBB (TNode node, Bits& res_bits, Bitblaster* bb) {
}
void DefaultSignExtendBB (TNode node, Bits& res_bits, Bitblaster* bb) {
- Debug("bitvector-bb") << "theory::bv::DefaultSignExtendBB bitblasting " << node << "\n";
+ BVDebug("bitvector-bb") << "theory::bv::DefaultSignExtendBB bitblasting " << node << "\n";
Assert (node.getKind() == kind::BITVECTOR_SIGN_EXTEND &&
res_bits.size() == 0);
@@ -816,14 +837,14 @@ void DefaultSignExtendBB (TNode node, Bits& res_bits, Bitblaster* bb) {
}
void DefaultRotateRightBB (TNode node, Bits& res, Bitblaster* bb) {
- Debug("bitvector") << "theory::bv:: Unimplemented kind "
+ BVDebug("bitvector") << "theory::bv:: Unimplemented kind "
<< node.getKind() << "\n";
Unimplemented();
}
void DefaultRotateLeftBB (TNode node, Bits& bits, Bitblaster* bb) {
- Debug("bitvector") << "theory::bv:: Unimplemented kind "
+ BVDebug("bitvector") << "theory::bv:: Unimplemented kind "
<< node.getKind() << "\n";
Unimplemented();
}
diff --git a/src/theory/bv/bv_sat.cpp b/src/theory/bv/bv_sat.cpp
index 6f91335ce..f5c43688a 100644
--- a/src/theory/bv/bv_sat.cpp
+++ b/src/theory/bv/bv_sat.cpp
@@ -23,6 +23,7 @@
#include "prop/cnf_stream.h"
#include "prop/sat_solver.h"
#include "prop/sat_solver_factory.h"
+#include "theory_bv_rewrite_rules_simplification.h"
using namespace std;
@@ -57,7 +58,7 @@ Bitblaster::Bitblaster(context::Context* c) :
d_assertedAtoms(c),
d_statistics()
{
- d_satSolver = prop::SatSolverFactory::createMinisat();
+ d_satSolver = prop::SatSolverFactory::createMinisat(c);
d_cnfStream = new TseitinCnfStream(d_satSolver, new NullRegistrar());
// initializing the bit-blasting strategies
@@ -83,7 +84,7 @@ void Bitblaster::bbAtom(TNode node) {
}
BVDebug("bitvector-bitblast") << "Bitblasting node " << node <<"\n";
-
+ ++d_statistics.d_numAtoms;
// the bitblasted definition of the atom
Node atom_bb = d_atomBBStrategies[node.getKind()](node, this);
// asserting that the atom is true iff the definition holds
@@ -101,14 +102,78 @@ void Bitblaster::bbTerm(TNode node, Bits& bits) {
return;
}
BVDebug("bitvector-bitblast") << "Bitblasting node " << node <<"\n";
- d_termBBStrategies[node.getKind()] (node, bits,this);
+ ++d_statistics.d_numTerms;
+
+ Node optimized = bbOptimize(node);
+
+ // if we already bitblasted the optimized version
+ if(hasBBTerm(optimized)) {
+ getBBTerm(optimized, bits);
+ // cache it as the same for this node
+ cacheTermDef(node, bits);
+ return;
+ }
+
+ d_termBBStrategies[optimized.getKind()] (optimized, bits,this);
- Assert (bits.size() == utils::getSize(node));
+ Assert (bits.size() == utils::getSize(node) &&
+ bits.size() == utils::getSize(optimized));
+
+ if(optimized != node) {
+ cacheTermDef(optimized, bits);
+ }
cacheTermDef(node, bits);
}
+Node Bitblaster::bbOptimize(TNode node) {
+ std::vector<Node> children;
+
+ if (node.getKind() == kind::BITVECTOR_PLUS) {
+ if (RewriteRule<BBPlusNeg>::applies(node)) {
+ Node res = RewriteRule<BBPlusNeg>::run<false>(node);
+ return res;
+ }
+ // if (RewriteRule<BBFactorOut>::applies(node)) {
+ // Node res = RewriteRule<BBFactorOut>::run<false>(node);
+ // return res;
+ // }
+
+ } else if (node.getKind() == kind::BITVECTOR_MULT) {
+ if (RewriteRule<MultPow2>::applies(node)) {
+ Node res = RewriteRule<MultPow2>::run<false>(node);
+ return res;
+ }
+ }
+
+ return node;
+}
+
/// Public methods
+void Bitblaster::addAtom(TNode atom) {
+ d_cnfStream->ensureLiteral(atom);
+ SatLiteral lit = d_cnfStream->getLiteral(atom);
+ d_satSolver->addMarkerLiteral(lit);
+}
+bool Bitblaster::getPropagations(std::vector<TNode>& propagations) {
+ std::vector<SatLiteral> propagated_literals;
+ if (d_satSolver->getPropagations(propagated_literals)) {
+ for (unsigned i = 0; i < propagated_literals.size(); ++i) {
+ propagations.push_back(d_cnfStream->getNode(propagated_literals[i]));
+ }
+ return true;
+ }
+ return false;
+}
+
+void Bitblaster::explainPropagation(TNode atom, std::vector<Node>& explanation) {
+ std::vector<SatLiteral> literal_explanation;
+ d_satSolver->explainPropagation(d_cnfStream->getLiteral(atom), literal_explanation);
+ for (unsigned i = 0; i < literal_explanation.size(); ++i) {
+ explanation.push_back(d_cnfStream->getNode(literal_explanation[i]));
+ }
+}
+
/**
* Called from preregistration bitblasts the node
*
@@ -153,7 +218,7 @@ void Bitblaster::bitblast(TNode node) {
*
*/
-void Bitblaster::assertToSat(TNode lit) {
+bool Bitblaster::assertToSat(TNode lit, bool propagate) {
// strip the not
TNode atom;
if (lit.getKind() == kind::NOT) {
@@ -163,17 +228,22 @@ void Bitblaster::assertToSat(TNode lit) {
}
Assert (hasBBAtom(atom));
- Node rewr_atom = Rewriter::rewrite(atom);
+
SatLiteral markerLit = d_cnfStream->getLiteral(atom);
if(lit.getKind() == kind::NOT) {
markerLit = ~markerLit;
}
- Debug("bitvector-bb") << "TheoryBV::Bitblaster::assertToSat asserting node: " << atom <<"\n";
- Debug("bitvector-bb") << "TheoryBV::Bitblaster::assertToSat with literal: " << markerLit << "\n";
+ BVDebug("bitvector-bb") << "TheoryBV::Bitblaster::assertToSat asserting node: " << atom <<"\n";
+ BVDebug("bitvector-bb") << "TheoryBV::Bitblaster::assertToSat with literal: " << markerLit << "\n";
+
+ SatValue ret = d_satSolver->assertAssumption(markerLit, propagate);
d_assertedAtoms.push_back(markerLit);
+
+ Assert(ret != prop::SAT_VALUE_UNKNOWN);
+ return ret == prop::SAT_VALUE_TRUE;
}
/**
@@ -183,9 +253,9 @@ void Bitblaster::assertToSat(TNode lit) {
* @return true for sat, and false for unsat
*/
-bool Bitblaster::solve() {
- Trace("bitvector") << "Bitblaster::solve() asserted atoms " << d_assertedAtoms.size() <<"\n";
- return SAT_VALUE_TRUE == d_satSolver->solve(d_assertedAtoms);
+bool Bitblaster::solve(bool quick_solve) {
+ BVDebug("bitvector") << "Bitblaster::solve() asserted atoms " << d_assertedAtoms.size() <<"\n";
+ return SAT_VALUE_TRUE == d_satSolver->solve();
}
void Bitblaster::getConflict(std::vector<TNode>& conflict) {
@@ -287,11 +357,15 @@ void Bitblaster::getBBTerm(TNode node, Bits& bits) {
Bitblaster::Statistics::Statistics() :
d_numTermClauses("theory::bv::NumberOfTermSatClauses", 0),
- d_numAtomClauses("theory::bv::NumberOfAtomSatClauses", 0),
+ d_numAtomClauses("theory::bv::NumberOfAtomSatClauses", 0),
+ d_numTerms("theory::bv::NumberOfBitblastedTerms", 0),
+ d_numAtoms("theory::bv::NumberOfBitblastedAtoms", 0),
d_bitblastTimer("theory::bv::BitblastTimer")
{
StatisticsRegistry::registerStat(&d_numTermClauses);
StatisticsRegistry::registerStat(&d_numAtomClauses);
+ StatisticsRegistry::registerStat(&d_numTerms);
+ StatisticsRegistry::registerStat(&d_numAtoms);
StatisticsRegistry::registerStat(&d_bitblastTimer);
}
@@ -299,6 +373,8 @@ Bitblaster::Statistics::Statistics() :
Bitblaster::Statistics::~Statistics() {
StatisticsRegistry::unregisterStat(&d_numTermClauses);
StatisticsRegistry::unregisterStat(&d_numAtomClauses);
+ StatisticsRegistry::unregisterStat(&d_numTerms);
+ StatisticsRegistry::unregisterStat(&d_numAtoms);
StatisticsRegistry::unregisterStat(&d_bitblastTimer);
}
diff --git a/src/theory/bv/bv_sat.h b/src/theory/bv/bv_sat.h
index c0f3b75ed..647e4fe9f 100644
--- a/src/theory/bv/bv_sat.h
+++ b/src/theory/bv/bv_sat.h
@@ -97,6 +97,8 @@ class Bitblaster {
void initAtomBBStrategies();
void initTermBBStrategies();
+ // returns a node that might be easier to bitblast
+ Node bbOptimize(TNode node);
void bbAtom(TNode node);
// division is bitblasted in terms of constraints
@@ -110,17 +112,20 @@ public:
public:
Bitblaster(context::Context* c);
~Bitblaster();
- void assertToSat(TNode node);
- bool solve();
+ bool assertToSat(TNode node, bool propagate = true);
+ bool solve(bool quick_solve = false);
void bitblast(TNode node);
void getConflict(std::vector<TNode>& conflict);
-
+ void addAtom(TNode atom);
+ bool getPropagations(std::vector<TNode>& propagations);
+ void explainPropagation(TNode atom, std::vector<Node>& explanation);
private:
class Statistics {
public:
- IntStat d_numTermClauses, d_numAtomClauses;
+ IntStat d_numTermClauses, d_numAtomClauses;
+ IntStat d_numTerms, d_numAtoms;
TimerStat d_bitblastTimer;
Statistics();
~Statistics();
diff --git a/src/theory/bv/kinds b/src/theory/bv/kinds
index 36d25de2a..6ef2cb0a9 100644
--- a/src/theory/bv/kinds
+++ b/src/theory/bv/kinds
@@ -28,16 +28,16 @@ constant CONST_BITVECTOR \
"a fixed-width bit-vector constant"
operator BITVECTOR_CONCAT 2: "bit-vector concatenation"
-operator BITVECTOR_AND 2 "bitwise and"
-operator BITVECTOR_OR 2 "bitwise or"
-operator BITVECTOR_XOR 2 "bitwise xor"
+operator BITVECTOR_AND 2: "bitwise and"
+operator BITVECTOR_OR 2: "bitwise or"
+operator BITVECTOR_XOR 2: "bitwise xor"
operator BITVECTOR_NOT 1 "bitwise not"
operator BITVECTOR_NAND 2 "bitwise nand"
operator BITVECTOR_NOR 2 "bitwise nor"
operator BITVECTOR_XNOR 2 "bitwise xnor"
operator BITVECTOR_COMP 2 "equality comparison (returns one bit)"
-operator BITVECTOR_MULT 2 "bit-vector multiplication"
-operator BITVECTOR_PLUS 2 "bit-vector addition"
+operator BITVECTOR_MULT 2: "bit-vector multiplication"
+operator BITVECTOR_PLUS 2: "bit-vector addition"
operator BITVECTOR_SUB 2 "bit-vector subtraction"
operator BITVECTOR_NEG 1 "bit-vector unary negation"
operator BITVECTOR_UDIV 2 "bit-vector unsigned division, truncating towards 0 (undefined if divisor is 0)"
diff --git a/src/theory/bv/theory_bv.cpp b/src/theory/bv/theory_bv.cpp
index 45d99f9c9..e8e1aead6 100644
--- a/src/theory/bv/theory_bv.cpp
+++ b/src/theory/bv/theory_bv.cpp
@@ -32,12 +32,13 @@ using namespace std;
using namespace CVC4::theory::bv::utils;
TheoryBV::TheoryBV(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation)
- : Theory(THEORY_BV, c, u, out, valuation),
+ : Theory(THEORY_BV, c, u, out, valuation),
d_context(c),
d_assertions(c),
d_bitblaster(new Bitblaster(c) ),
- d_statistics()
- {
+ d_statistics(),
+ d_alreadyPropagatedSet(c)
+ {
d_true = utils::mkTrue();
}
TheoryBV::~TheoryBV() {
@@ -61,35 +62,54 @@ TheoryBV::Statistics::~Statistics() {
void TheoryBV::preRegisterTerm(TNode node) {
BVDebug("bitvector-preregister") << "TheoryBV::preRegister(" << node << ")" << std::endl;
- //marker literal: bitblast all terms before we start
- //d_bitblaster->bitblast(node);
+ if (node.getKind() == kind::EQUAL ||
+ node.getKind() == kind::BITVECTOR_ULT ||
+ node.getKind() == kind::BITVECTOR_ULE ||
+ node.getKind() == kind::BITVECTOR_SLT ||
+ node.getKind() == kind::BITVECTOR_SLE) {
+ d_bitblaster->bitblast(node);
+ d_bitblaster->addAtom(node);
+ }
}
void TheoryBV::check(Effort e) {
- if (fullEffort(e) && !done()) {
- Trace("bitvector")<< "TheoryBV::check(" << e << ")" << std::endl;
- std::vector<TNode> assertions;
-
+ if (e == EFFORT_STANDARD) {
+ BVDebug("bitvector") << "TheoryBV::check " << e << "\n";
+ BVDebug("bitvector")<< "TheoryBV::check(" << e << ")" << std::endl;
while (!done()) {
TNode assertion = get();
- Trace("bitvector-assertions") << "TheoryBV::check assertion " << assertion << "\n";
- d_bitblaster->bitblast(assertion);
- d_bitblaster->assertToSat(assertion);
+ // make sure we do not assert things we propagated
+ if (!hasBeenPropagated(assertion)) {
+ BVDebug("bitvector-assertions") << "TheoryBV::check assertion " << assertion << "\n";
+ bool ok = d_bitblaster->assertToSat(assertion, true);
+ if (!ok) {
+ std::vector<TNode> conflictAtoms;
+ d_bitblaster->getConflict(conflictAtoms);
+ d_statistics.d_avgConflictSize.addEntry(conflictAtoms.size());
+ Node conflict = mkConjunction(conflictAtoms);
+ d_out->conflict(conflict);
+ BVDebug("bitvector") << "TheoryBV::check returns conflict: " <<conflict <<" \n ";
+ return;
+ }
+ }
}
+ }
- TimerStat::CodeTimer codeTimer(d_statistics.d_solveTimer);
- bool res = d_bitblaster->solve();
- if (res == false) {
+ if (e == EFFORT_FULL) {
+ BVDebug("bitvector") << "TheoryBV::check " << e << "\n";
+ // in standard effort we only do boolean constraint propagation
+ bool ok = d_bitblaster->solve(false);
+ if (!ok) {
std::vector<TNode> conflictAtoms;
d_bitblaster->getConflict(conflictAtoms);
d_statistics.d_avgConflictSize.addEntry(conflictAtoms.size());
-
Node conflict = mkConjunction(conflictAtoms);
d_out->conflict(conflict);
- Trace("bitvector") << "TheoryBV::check returns conflict. \n ";
+ BVDebug("bitvector") << "TheoryBV::check returns conflict: " <<conflict <<" \n ";
return;
}
}
+
}
@@ -109,19 +129,56 @@ Node TheoryBV::getValue(TNode n) {
}
}
-Node TheoryBV::explain(TNode node) {
- BVDebug("bitvector") << "TheoryBV::explain(" << node << ")" << std::endl;
+bool TheoryBV::hasBeenPropagated(TNode node) {
+ return d_alreadyPropagatedSet.count(node);
+}
- TNode equality = node.getKind() == kind::NOT ? node[0] : node;
- Assert(equality.getKind() == kind::EQUAL);
- Assert(0);
- return node;
+void TheoryBV::propagate(Effort e) {
+ BVDebug("bitvector") << "TheoryBV::propagate() \n";
+
+ // get new propagations from the sat solver
+ std::vector<TNode> propagations;
+ d_bitblaster->getPropagations(propagations);
+
+ // propagate the facts on the propagation queue
+ for (unsigned i = 0; i < propagations.size(); ++ i) {
+ TNode node = propagations[i];
+ BVDebug("bitvector") << "TheoryBV::propagate " << node <<" \n";
+ if (d_valuation.getSatValue(node) == Node::null()) {
+ vector<Node> explanation;
+ d_bitblaster->explainPropagation(node, explanation);
+ if (explanation.size() == 0) {
+ d_out->lemma(node);
+ } else {
+ NodeBuilder<> nb(kind::OR);
+ nb << node;
+ for (unsigned i = 0; i < explanation.size(); ++ i) {
+ nb << explanation[i].notNode();
+ }
+ Node lemma = nb;
+ d_out->lemma(lemma);
+ }
+ d_alreadyPropagatedSet.insert(node);
+ }
+ }
}
-// Node TheoryBV::preprocessTerm(TNode term) {
-// return term; //d_staticEqManager.find(term);
-// }
+Node TheoryBV::explain(TNode n) {
+ BVDebug("bitvector") << "TheoryBV::explain node " << n <<"\n";
+ std::vector<Node> explanation;
+ d_bitblaster->explainPropagation(n, explanation);
+ Node exp;
+
+ if (explanation.size() == 0) {
+ return utils::mkTrue();
+ }
+
+ exp = utils::mkAnd(explanation);
+
+ BVDebug("bitvector") << "TheoryBV::explain with " << exp <<"\n";
+ return exp;
+}
Theory::PPAssertStatus TheoryBV::ppAssert(TNode in, SubstitutionMap& outSubstitutions) {
switch(in.getKind()) {
diff --git a/src/theory/bv/theory_bv.h b/src/theory/bv/theory_bv.h
index 36ba17b52..d147c8bb5 100644
--- a/src/theory/bv/theory_bv.h
+++ b/src/theory/bv/theory_bv.h
@@ -24,6 +24,7 @@
#include "theory/theory.h"
#include "context/context.h"
#include "context/cdlist.h"
+#include "context/cdhashset.h"
#include "theory/bv/theory_bv_utils.h"
#include "util/stats.h"
@@ -41,7 +42,6 @@ class Bitblaster;
class TheoryBV : public Theory {
-public:
private:
@@ -54,7 +54,11 @@ private:
/** Bitblaster */
Bitblaster* d_bitblaster;
Node d_true;
-
+
+ /** Context dependent set of atoms we already propagated */
+ context::CDHashSet<TNode, TNodeHashFunction> d_alreadyPropagatedSet;
+
+ bool hasBeenPropagated(TNode node);
public:
TheoryBV(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation);
@@ -66,7 +70,7 @@ public:
void check(Effort e);
- void propagate(Effort e) { }
+ void propagate(Effort e);
Node explain(TNode n);
diff --git a/src/theory/bv/theory_bv_rewrite_rules.h b/src/theory/bv/theory_bv_rewrite_rules.h
index b01a0646c..30437a76e 100644
--- a/src/theory/bv/theory_bv_rewrite_rules.h
+++ b/src/theory/bv/theory_bv_rewrite_rules.h
@@ -87,7 +87,9 @@ enum RewriteRuleId {
EvalRotateLeft,
EvalRotateRight,
EvalNeg,
-
+ EvalSlt,
+ EvalSle,
+
/// simplification rules
/// all of these rules decrease formula size
ShlByConst,
@@ -136,12 +138,26 @@ enum RewriteRuleId {
ExtractArith,
ExtractArith2,
DoubleNeg,
+ NegMult,
+ NegSub,
+ NegPlus,
NotConcat,
NotAnd, // not sure why this would help (not done)
NotOr, // not sure why this would help (not done)
- NotXor // not sure why this would help (not done)
+ NotXor, // not sure why this would help (not done)
+ FlattenAssocCommut,
+ PlusCombineLikeTerms,
+ MultSimplify,
+ MultDistribConst,
+ AndSimplify,
+ OrSimplify,
+ XorSimplify,
+
+ // rules to simplify bitblasting
+ BBPlusNeg
};
+
inline std::ostream& operator << (std::ostream& out, RewriteRuleId ruleId) {
switch (ruleId) {
case EmptyRule: out << "EmptyRule"; return out;
@@ -183,6 +199,8 @@ inline std::ostream& operator << (std::ostream& out, RewriteRuleId ruleId) {
case EvalAshr : out << "EvalAshr"; return out;
case EvalUlt : out << "EvalUlt"; return out;
case EvalUle : out << "EvalUle"; return out;
+ case EvalSlt : out << "EvalSlt"; return out;
+ case EvalSle : out << "EvalSle"; return out;
case EvalExtract : out << "EvalExtract"; return out;
case EvalSignExtend : out << "EvalSignExtend"; return out;
case EvalRotateLeft : out << "EvalRotateLeft"; return out;
@@ -241,6 +259,17 @@ inline std::ostream& operator << (std::ostream& out, RewriteRuleId ruleId) {
case SignExtendEliminate : out << "SignExtendEliminate"; return out;
case NotIdemp : out << "NotIdemp"; return out;
case UleSelf: out << "UleSelf"; return out;
+ case FlattenAssocCommut: out << "FlattenAssocCommut"; return out;
+ case PlusCombineLikeTerms: out << "PlusCombineLikeTerms"; return out;
+ case MultSimplify: out << "MultSimplify"; return out;
+ case MultDistribConst: out << "MultDistribConst"; return out;
+ case NegMult : out << "NegMult"; return out;
+ case NegSub : out << "NegSub"; return out;
+ case AndSimplify : out << "AndSimplify"; return out;
+ case OrSimplify : out << "OrSimplify"; return out;
+ case XorSimplify : out << "XorSimplify"; return out;
+ case NegPlus : out << "NegPlus"; return out;
+ case BBPlusNeg : out << "BBPlusNeg"; return out;
default:
Unreachable();
}
@@ -346,6 +375,8 @@ struct AllRewriteRules {
RewriteRule<SgtEliminate> rule12;
RewriteRule<UgeEliminate> rule13;
RewriteRule<SgeEliminate> rule14;
+ RewriteRule<NegMult> rule15;
+ RewriteRule<NegSub> rule16;
RewriteRule<RepeatEliminate> rule17;
RewriteRule<RotateLeftEliminate> rule18;
RewriteRule<RotateRightEliminate> rule19;
@@ -359,8 +390,10 @@ struct AllRewriteRules {
RewriteRule<EvalOr> rule27;
RewriteRule<EvalXor> rule28;
RewriteRule<EvalNot> rule29;
+ RewriteRule<EvalSlt> rule30;
RewriteRule<EvalMult> rule31;
RewriteRule<EvalPlus> rule32;
+ RewriteRule<XorSimplify> rule33;
RewriteRule<EvalUdiv> rule34;
RewriteRule<EvalUrem> rule35;
RewriteRule<EvalShl> rule36;
@@ -368,6 +401,7 @@ struct AllRewriteRules {
RewriteRule<EvalAshr> rule38;
RewriteRule<EvalUlt> rule39;
RewriteRule<EvalUle> rule40;
+ RewriteRule<EvalSle> rule41;
RewriteRule<EvalExtract> rule43;
RewriteRule<EvalSignExtend> rule44;
RewriteRule<EvalRotateLeft> rule45;
@@ -428,14 +462,22 @@ struct AllRewriteRules {
RewriteRule<SignExtendEliminate> rule101;
RewriteRule<NotIdemp> rule102;
RewriteRule<UleSelf> rule103;
+ RewriteRule<FlattenAssocCommut> rule104;
+ RewriteRule<PlusCombineLikeTerms> rule105;
+ RewriteRule<MultSimplify> rule106;
+ RewriteRule<MultDistribConst> rule107;
+ RewriteRule<AndSimplify> rule108;
+ RewriteRule<OrSimplify> rule109;
+ RewriteRule<NegPlus> rule110;
+ RewriteRule<BBPlusNeg> rule111;
};
-template<>
+template<> inline
bool RewriteRule<EmptyRule>::applies(Node node) {
return false;
}
-template<>
+template<> inline
Node RewriteRule<EmptyRule>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EmptyRule> for " << node.getKind() <<"\n";
Unreachable();
diff --git a/src/theory/bv/theory_bv_rewrite_rules_constant_evaluation.h b/src/theory/bv/theory_bv_rewrite_rules_constant_evaluation.h
index 1dc053b5d..da3ef4485 100644
--- a/src/theory/bv/theory_bv_rewrite_rules_constant_evaluation.h
+++ b/src/theory/bv/theory_bv_rewrite_rules_constant_evaluation.h
@@ -28,13 +28,13 @@ namespace CVC4 {
namespace theory {
namespace bv {
-template<>
+template<> inline
bool RewriteRule<EvalAnd>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_AND &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalAnd>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalAnd>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -44,13 +44,13 @@ Node RewriteRule<EvalAnd>::apply(Node node) {
return utils::mkConst(res);
}
-template<>
+template<> inline
bool RewriteRule<EvalOr>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_OR &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalOr>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalOr>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -60,13 +60,13 @@ Node RewriteRule<EvalOr>::apply(Node node) {
return utils::mkConst(res);
}
-template<>
+template<> inline
bool RewriteRule<EvalXor>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_XOR &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalXor>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalXor>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -76,13 +76,13 @@ Node RewriteRule<EvalXor>::apply(Node node) {
return utils::mkConst(res);
}
-// template<>
+// template<> inline
// bool RewriteRule<EvalXnor>::applies(Node node) {
// return (node.getKind() == kind::BITVECTOR_XNOR &&
// utils::isBVGroundTerm(node));
// }
-// template<>
+// template<> inline
// Node RewriteRule<EvalXnor>::apply(Node node) {
// BVDebug("bv-rewrite") << "RewriteRule<EvalXnor>(" << node << ")" << std::endl;
// BitVector a = node[0].getConst<BitVector>();
@@ -91,13 +91,13 @@ Node RewriteRule<EvalXor>::apply(Node node) {
// return utils::mkConst(res);
// }
-template<>
+template<> inline
bool RewriteRule<EvalNot>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_NOT &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalNot>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalNot>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -105,13 +105,13 @@ Node RewriteRule<EvalNot>::apply(Node node) {
return utils::mkConst(res);
}
-// template<>
+// template<> inline
// bool RewriteRule<EvalComp>::applies(Node node) {
// return (node.getKind() == kind::BITVECTOR_COMP &&
// utils::isBVGroundTerm(node));
// }
-// template<>
+// template<> inline
// Node RewriteRule<EvalComp>::apply(Node node) {
// BVDebug("bv-rewrite") << "RewriteRule<EvalComp>(" << node << ")" << std::endl;
// BitVector a = node[0].getConst<BitVector>();
@@ -126,13 +126,13 @@ Node RewriteRule<EvalNot>::apply(Node node) {
// return utils::mkConst(res);
// }
-template<>
+template<> inline
bool RewriteRule<EvalMult>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_MULT &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalMult>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalMult>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -142,13 +142,13 @@ Node RewriteRule<EvalMult>::apply(Node node) {
return utils::mkConst(res);
}
-template<>
+template<> inline
bool RewriteRule<EvalPlus>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_PLUS &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalPlus>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalPlus>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -158,13 +158,13 @@ Node RewriteRule<EvalPlus>::apply(Node node) {
return utils::mkConst(res);
}
-// template<>
+// template<> inline
// bool RewriteRule<EvalSub>::applies(Node node) {
// return (node.getKind() == kind::BITVECTOR_SUB &&
// utils::isBVGroundTerm(node));
// }
-// template<>
+// template<> inline
// Node RewriteRule<EvalSub>::apply(Node node) {
// BVDebug("bv-rewrite") << "RewriteRule<EvalSub>(" << node << ")" << std::endl;
// BitVector a = node[0].getConst<BitVector>();
@@ -173,13 +173,13 @@ Node RewriteRule<EvalPlus>::apply(Node node) {
// return utils::mkConst(res);
// }
-template<>
+template<> inline
bool RewriteRule<EvalNeg>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_NEG &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalNeg>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalNeg>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -187,13 +187,13 @@ Node RewriteRule<EvalNeg>::apply(Node node) {
return utils::mkConst(res);
}
-template<>
+template<> inline
bool RewriteRule<EvalUdiv>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_UDIV &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalUdiv>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalUdiv>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -202,13 +202,13 @@ Node RewriteRule<EvalUdiv>::apply(Node node) {
return utils::mkConst(res);
}
-template<>
+template<> inline
bool RewriteRule<EvalUrem>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_UREM &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalUrem>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalUrem>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -217,13 +217,13 @@ Node RewriteRule<EvalUrem>::apply(Node node) {
return utils::mkConst(res);
}
-template<>
+template<> inline
bool RewriteRule<EvalShl>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_SHL &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalShl>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalShl>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -233,13 +233,13 @@ Node RewriteRule<EvalShl>::apply(Node node) {
return utils::mkConst(res);
}
-template<>
+template<> inline
bool RewriteRule<EvalLshr>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_LSHR &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalLshr>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalLshr>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -249,13 +249,13 @@ Node RewriteRule<EvalLshr>::apply(Node node) {
return utils::mkConst(res);
}
-template<>
+template<> inline
bool RewriteRule<EvalAshr>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_ASHR &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalAshr>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalAshr>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -265,13 +265,13 @@ Node RewriteRule<EvalAshr>::apply(Node node) {
return utils::mkConst(res);
}
-template<>
+template<> inline
bool RewriteRule<EvalUlt>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_ULT &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalUlt>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalUlt>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -283,32 +283,32 @@ Node RewriteRule<EvalUlt>::apply(Node node) {
return utils::mkFalse();
}
-// template<>
-// bool RewriteRule<EvalSlt>::applies(Node node) {
-// return (node.getKind() == kind::BITVECTOR_SLT &&
-// utils::isBVGroundTerm(node));
-// }
+template<> inline
+bool RewriteRule<EvalSlt>::applies(Node node) {
+ return (node.getKind() == kind::BITVECTOR_SLT &&
+ utils::isBVGroundTerm(node));
+}
-// template<>
-// Node RewriteRule<EvalSlt>::apply(Node node) {
-// BVDebug("bv-rewrite") << "RewriteRule<EvalSlt>(" << node << ")" << std::endl;
-// BitVector a = node[0].getConst<BitVector>();
-// BitVector b = node[1].getConst<BitVector>();
+template<> inline
+Node RewriteRule<EvalSlt>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<EvalSlt>(" << node << ")" << std::endl;
+ BitVector a = node[0].getConst<BitVector>();
+ BitVector b = node[1].getConst<BitVector>();
-// if (a.signedLessThan(b)) {
-// return utils::mkTrue();
-// }
-// return utils::mkFalse();
+ if (a.signedLessThan(b)) {
+ return utils::mkTrue();
+ }
+ return utils::mkFalse();
-// }
+}
-template<>
+template<> inline
bool RewriteRule<EvalUle>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_ULE &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalUle>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalUle>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -320,31 +320,31 @@ Node RewriteRule<EvalUle>::apply(Node node) {
return utils::mkFalse();
}
-// template<>
-// bool RewriteRule<EvalSle>::applies(Node node) {
-// return (node.getKind() == kind::BITVECTOR_SLE &&
-// utils::isBVGroundTerm(node));
-// }
+template<> inline
+bool RewriteRule<EvalSle>::applies(Node node) {
+ return (node.getKind() == kind::BITVECTOR_SLE &&
+ utils::isBVGroundTerm(node));
+}
-// template<>
-// Node RewriteRule<EvalSle>::apply(Node node) {
-// BVDebug("bv-rewrite") << "RewriteRule<EvalSle>(" << node << ")" << std::endl;
-// BitVector a = node[0].getConst<BitVector>();
-// BitVector b = node[1].getConst<BitVector>();
+template<> inline
+Node RewriteRule<EvalSle>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<EvalSle>(" << node << ")" << std::endl;
+ BitVector a = node[0].getConst<BitVector>();
+ BitVector b = node[1].getConst<BitVector>();
-// if (a.signedLessThanEq(b)) {
-// return utils::mkTrue();
-// }
-// return utils::mkFalse();
-// }
+ if (a.signedLessThanEq(b)) {
+ return utils::mkTrue();
+ }
+ return utils::mkFalse();
+}
-template<>
+template<> inline
bool RewriteRule<EvalExtract>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_EXTRACT &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalExtract>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalExtract>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -356,13 +356,13 @@ Node RewriteRule<EvalExtract>::apply(Node node) {
}
-template<>
+template<> inline
bool RewriteRule<EvalConcat>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_CONCAT &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalConcat>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalConcat>(" << node << ")" << std::endl;
unsigned num = node.getNumChildren();
@@ -374,13 +374,13 @@ Node RewriteRule<EvalConcat>::apply(Node node) {
return utils::mkConst(res);
}
-template<>
+template<> inline
bool RewriteRule<EvalSignExtend>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_SIGN_EXTEND &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalSignExtend>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalSignExtend>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
@@ -390,13 +390,13 @@ Node RewriteRule<EvalSignExtend>::apply(Node node) {
return utils::mkConst(res);
}
-template<>
+template<> inline
bool RewriteRule<EvalEquals>::applies(Node node) {
return (node.getKind() == kind::EQUAL &&
utils::isBVGroundTerm(node));
}
-template<>
+template<> inline
Node RewriteRule<EvalEquals>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<EvalEquals>(" << node << ")" << std::endl;
BitVector a = node[0].getConst<BitVector>();
diff --git a/src/theory/bv/theory_bv_rewrite_rules_core.h b/src/theory/bv/theory_bv_rewrite_rules_core.h
index 3240ef5f3..f3d28072e 100644
--- a/src/theory/bv/theory_bv_rewrite_rules_core.h
+++ b/src/theory/bv/theory_bv_rewrite_rules_core.h
@@ -28,12 +28,12 @@ namespace CVC4 {
namespace theory {
namespace bv {
-template<>
+template<> inline
bool RewriteRule<ConcatFlatten>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_CONCAT);
}
-template<>
+template<> inline
Node RewriteRule<ConcatFlatten>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ConcatFlatten>(" << node << ")" << std::endl;
NodeBuilder<> result(kind::BITVECTOR_CONCAT);
@@ -54,12 +54,12 @@ Node RewriteRule<ConcatFlatten>::apply(Node node) {
return resultNode;
}
-template<>
+template<> inline
bool RewriteRule<ConcatExtractMerge>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_CONCAT);
}
-template<>
+template<> inline
Node RewriteRule<ConcatExtractMerge>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ConcatExtractMerge>(" << node << ")" << std::endl;
@@ -115,12 +115,12 @@ Node RewriteRule<ConcatExtractMerge>::apply(Node node) {
return utils::mkConcat(mergedExtracts);
}
-template<>
+template<> inline
bool RewriteRule<ConcatConstantMerge>::applies(Node node) {
return node.getKind() == kind::BITVECTOR_CONCAT;
}
-template<>
+template<> inline
Node RewriteRule<ConcatConstantMerge>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ConcatConstantMerge>(" << node << ")" << std::endl;
@@ -157,7 +157,7 @@ Node RewriteRule<ConcatConstantMerge>::apply(Node node) {
return utils::mkConcat(mergedConstants);
}
-template<>
+template<> inline
bool RewriteRule<ExtractWhole>::applies(Node node) {
if (node.getKind() != kind::BITVECTOR_EXTRACT) return false;
unsigned length = utils::getSize(node[0]);
@@ -168,20 +168,20 @@ bool RewriteRule<ExtractWhole>::applies(Node node) {
return true;
}
-template<>
+template<> inline
Node RewriteRule<ExtractWhole>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ExtractWhole>(" << node << ")" << std::endl;
return node[0];
}
-template<>
+template<> inline
bool RewriteRule<ExtractConstant>::applies(Node node) {
if (node.getKind() != kind::BITVECTOR_EXTRACT) return false;
if (node[0].getKind() != kind::CONST_BITVECTOR) return false;
return true;
}
-template<>
+template<> inline
Node RewriteRule<ExtractConstant>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ExtractConstant>(" << node << ")" << std::endl;
Node child = node[0];
@@ -189,7 +189,7 @@ Node RewriteRule<ExtractConstant>::apply(Node node) {
return utils::mkConst(childValue.extract(utils::getExtractHigh(node), utils::getExtractLow(node)));
}
-template<>
+template<> inline
bool RewriteRule<ExtractConcat>::applies(Node node) {
//BVDebug("bv-rewrite") << "RewriteRule<ExtractConcat>(" << node << ")" << std::endl;
if (node.getKind() != kind::BITVECTOR_EXTRACT) return false;
@@ -197,7 +197,7 @@ bool RewriteRule<ExtractConcat>::applies(Node node) {
return true;
}
-template<>
+template<> inline
Node RewriteRule<ExtractConcat>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ExtractConcat>(" << node << ")" << std::endl;
int extract_high = utils::getExtractHigh(node);
@@ -223,14 +223,14 @@ Node RewriteRule<ExtractConcat>::apply(Node node) {
return utils::mkConcat(resultChildren);
}
-template<>
+template<> inline
bool RewriteRule<ExtractExtract>::applies(Node node) {
if (node.getKind() != kind::BITVECTOR_EXTRACT) return false;
if (node[0].getKind() != kind::BITVECTOR_EXTRACT) return false;
return true;
}
-template<>
+template<> inline
Node RewriteRule<ExtractExtract>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ExtractExtract>(" << node << ")" << std::endl;
@@ -244,7 +244,7 @@ Node RewriteRule<ExtractExtract>::apply(Node node) {
return result;
}
-template<>
+template<> inline
bool RewriteRule<FailEq>::applies(Node node) {
//BVDebug("bv-rewrite") << "RewriteRule<FailEq>(" << node << ")" << std::endl;
if (node.getKind() != kind::EQUAL) return false;
@@ -253,29 +253,29 @@ bool RewriteRule<FailEq>::applies(Node node) {
return node[0] != node[1];
}
-template<>
+template<> inline
Node RewriteRule<FailEq>::apply(Node node) {
return utils::mkFalse();
}
-template<>
+template<> inline
bool RewriteRule<SimplifyEq>::applies(Node node) {
if (node.getKind() != kind::EQUAL) return false;
return node[0] == node[1];
}
-template<>
+template<> inline
Node RewriteRule<SimplifyEq>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<SimplifyEq>(" << node << ")" << std::endl;
return utils::mkTrue();
}
-template<>
+template<> inline
bool RewriteRule<ReflexivityEq>::applies(Node node) {
return (node.getKind() == kind::EQUAL && node[0] < node[1]);
}
-template<>
+template<> inline
Node RewriteRule<ReflexivityEq>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ReflexivityEq>(" << node << ")" << std::endl;
return node[1].eqNode(node[0]);
diff --git a/src/theory/bv/theory_bv_rewrite_rules_normalization.h b/src/theory/bv/theory_bv_rewrite_rules_normalization.h
index 4e974881c..5587e25eb 100644
--- a/src/theory/bv/theory_bv_rewrite_rules_normalization.h
+++ b/src/theory/bv/theory_bv_rewrite_rules_normalization.h
@@ -33,7 +33,7 @@ namespace bv {
* (x bvop y) [i:j] ==> x[i:j] bvop y[i:j]
* where bvop is bvand,bvor, bvxor
*/
-template<>
+template<> inline
bool RewriteRule<ExtractBitwise>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_EXTRACT &&
(node[0].getKind() == kind::BITVECTOR_AND ||
@@ -41,7 +41,7 @@ bool RewriteRule<ExtractBitwise>::applies(Node node) {
node[0].getKind() == kind::BITVECTOR_XOR ));
}
-template<>
+template<> inline
Node RewriteRule<ExtractBitwise>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ExtractBitwise>(" << node << ")" << std::endl;
unsigned high = utils::getExtractHigh(node);
@@ -57,13 +57,13 @@ Node RewriteRule<ExtractBitwise>::apply(Node node) {
*
* (~ a) [i:j] ==> ~ (a[i:j])
*/
-template<>
+template<> inline
bool RewriteRule<ExtractNot>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_EXTRACT &&
node[0].getKind() == kind::BITVECTOR_NOT);
}
-template<>
+template<> inline
Node RewriteRule<ExtractNot>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ExtractNot>(" << node << ")" << std::endl;
unsigned low = utils::getExtractLow(node);
@@ -78,7 +78,7 @@ Node RewriteRule<ExtractNot>::apply(Node node) {
* (a bvop b) [k:0] ==> (a[k:0] bvop b[k:0])
*/
-template<>
+template<> inline
bool RewriteRule<ExtractArith>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_EXTRACT &&
utils::getExtractLow(node) == 0 &&
@@ -86,7 +86,7 @@ bool RewriteRule<ExtractArith>::applies(Node node) {
node[0].getKind() == kind::BITVECTOR_MULT));
}
-template<>
+template<> inline
Node RewriteRule<ExtractArith>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ExtractArith>(" << node << ")" << std::endl;
unsigned low = utils::getExtractLow(node);
@@ -107,14 +107,14 @@ Node RewriteRule<ExtractArith>::apply(Node node) {
*/
// careful not to apply in a loop
-template<>
+template<> inline
bool RewriteRule<ExtractArith2>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_EXTRACT &&
(node[0].getKind() == kind::BITVECTOR_PLUS ||
node[0].getKind() == kind::BITVECTOR_MULT));
}
-template<>
+template<> inline
Node RewriteRule<ExtractArith2>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ExtractArith2>(" << node << ")" << std::endl;
unsigned low = utils::getExtractLow(node);
@@ -128,13 +128,570 @@ Node RewriteRule<ExtractArith2>::apply(Node node) {
return utils::mkExtract(a_op_b, high, low);
}
+template<> inline
+bool RewriteRule<FlattenAssocCommut>::applies(Node node) {
+ return (node.getKind() == kind::BITVECTOR_PLUS ||
+ node.getKind() == kind::BITVECTOR_MULT ||
+ node.getKind() == kind::BITVECTOR_OR ||
+ node.getKind() == kind::BITVECTOR_XOR ||
+ node.getKind() == kind::BITVECTOR_AND);
+}
+
+
+template<> inline
+Node RewriteRule<FlattenAssocCommut>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<FlattenAssocCommut>(" << node << ")" << std::endl;
+ std::vector<Node> processingStack;
+ processingStack.push_back(node);
+ std::vector<Node> children;
+ Kind kind = node.getKind();
+
+ while (! processingStack.empty()) {
+ TNode current = processingStack.back();
+ processingStack.pop_back();
+
+ // flatten expression
+ if (current.getKind() == kind) {
+ for (unsigned i = 0; i < current.getNumChildren(); ++i) {
+ processingStack.push_back(current[i]);
+ }
+ } else {
+ children.push_back(current);
+ }
+ }
+ return utils::mkSortedNode(kind, children);
+}
+
+static inline void addToCoefMap(std::map<Node, BitVector>& map,
+ TNode term, const BitVector& coef) {
+ if (map.find(term) != map.end()) {
+ map[term] = map[term] + coef;
+ } else {
+ map[term] = coef;
+ }
+}
+
+
+template<> inline
+bool RewriteRule<PlusCombineLikeTerms>::applies(Node node) {
+ return (node.getKind() == kind::BITVECTOR_PLUS);
+}
+
+template<> inline
+Node RewriteRule<PlusCombineLikeTerms>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<PlusCombineLikeTerms>(" << node << ")" << std::endl;
+ unsigned size = utils::getSize(node);
+ BitVector constSum(size, (unsigned)0);
+ std::map<Node, BitVector> factorToCoefficient;
+
+ // combine like-terms
+ for(unsigned i= 0; i < node.getNumChildren(); ++i) {
+ TNode current = node[i];
+
+ // look for c * x, where c is a constant
+ if (current.getKind() == kind::BITVECTOR_MULT &&
+ (current[0].getKind() == kind::CONST_BITVECTOR ||
+ current[1].getKind() == kind::CONST_BITVECTOR)) {
+ // if we are multiplying by a constant
+ BitVector coeff;
+ TNode term;
+ // figure out which part is the constant
+ if (current[0].getKind() == kind::CONST_BITVECTOR) {
+ coeff = current[0].getConst<BitVector>();
+ term = current[1];
+ } else {
+ coeff = current[1].getConst<BitVector>();
+ term = current[0];
+ }
+ if(term.getKind() == kind::BITVECTOR_SUB) {
+ TNode a = term[0];
+ TNode b = term[1];
+ addToCoefMap(factorToCoefficient, a, coeff);
+ addToCoefMap(factorToCoefficient, b, -coeff);
+ }
+ else if(term.getKind() == kind::BITVECTOR_NEG) {
+ addToCoefMap(factorToCoefficient, term[0], -BitVector(size, coeff));
+ }
+ else {
+ addToCoefMap(factorToCoefficient, term, coeff);
+ }
+ }
+ else if (current.getKind() == kind::BITVECTOR_SUB) {
+ // turn into a + (-1)*b
+ addToCoefMap(factorToCoefficient, current[0], BitVector(size, (unsigned)1));
+ addToCoefMap(factorToCoefficient, current[1], -BitVector(size, (unsigned)1));
+ }
+ else if (current.getKind() == kind::BITVECTOR_NEG) {
+ addToCoefMap(factorToCoefficient, current[0], -BitVector(size, (unsigned)1));
+ }
+ else if (current.getKind() == kind::CONST_BITVECTOR) {
+ BitVector constValue = current.getConst<BitVector>();
+ constSum = constSum + constValue;
+ }
+ else {
+ // store as 1 * current
+ addToCoefMap(factorToCoefficient, current, BitVector(size, (unsigned)1));
+ }
+ }
+
+ std::vector<Node> children;
+ if ( constSum!= BitVector(size, (unsigned)0)) {
+ children.push_back(utils::mkConst(constSum));
+ }
+
+ // construct result
+ std::map<Node, BitVector>::const_iterator it = factorToCoefficient.begin();
+
+ for (; it != factorToCoefficient.end(); ++it) {
+ BitVector bv_coeff = it->second;
+ TNode term = it->first;
+ if(bv_coeff == BitVector(size, (unsigned)0)) {
+ continue;
+ }
+ else if (bv_coeff == BitVector(size, (unsigned)1)) {
+ children.push_back(term);
+ }
+ else if (bv_coeff == -BitVector(size, (unsigned)1)) {
+ // avoid introducing an extra multiplication
+ children.push_back(utils::mkNode(kind::BITVECTOR_NEG, term));
+ }
+ else {
+ Node coeff = utils::mkConst(bv_coeff);
+ Node product = utils::mkSortedNode(kind::BITVECTOR_MULT, coeff, term);
+ children.push_back(product);
+ }
+ }
+
+ if(children.size() == 0) {
+ return utils::mkConst(size, (unsigned)0);
+ }
+
+ return utils::mkSortedNode(kind::BITVECTOR_PLUS, children);
+}
+
+
+template<> inline
+bool RewriteRule<MultSimplify>::applies(Node node) {
+ return (node.getKind() == kind::BITVECTOR_MULT);
+}
+
+template<> inline
+Node RewriteRule<MultSimplify>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<MultSimplify>(" << node << ")" << std::endl;
+ unsigned size = utils::getSize(node);
+ BitVector constant(size, Integer(1));
+
+ std::vector<Node> children;
+ for(unsigned i = 0; i < node.getNumChildren(); ++i) {
+ TNode current = node[i];
+ if (current.getKind() == kind::CONST_BITVECTOR) {
+ BitVector value = current.getConst<BitVector>();
+ if(value == BitVector(size, (unsigned) 0)) {
+ return utils::mkConst(size, 0);
+ }
+ constant = constant * current.getConst<BitVector>();
+ } else {
+ children.push_back(current);
+ }
+ }
+
+
+ if(constant != BitVector(size, (unsigned)1)) {
+ children.push_back(utils::mkConst(constant));
+ }
+
+
+ if(children.size() == 0) {
+ return utils::mkConst(size, (unsigned)1);
+ }
+
+ return utils::mkSortedNode(kind::BITVECTOR_MULT, children);
+}
+
+template<> inline
+bool RewriteRule<MultDistribConst>::applies(Node node) {
+ if (node.getKind() != kind::BITVECTOR_MULT)
+ return false;
+
+ TNode factor;
+ if (node[0].getKind() == kind::CONST_BITVECTOR) {
+ factor = node[1];
+ } else if (node[1].getKind() == kind::CONST_BITVECTOR) {
+ factor = node[0];
+ } else {
+ return false;
+ }
+
+ return (factor.getKind() == kind::BITVECTOR_PLUS ||
+ factor.getKind() == kind::BITVECTOR_SUB ||
+ factor.getKind() == kind::BITVECTOR_NEG);
+}
+
+template<> inline
+Node RewriteRule<MultDistribConst>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<MultDistribConst>(" << node << ")" << std::endl;
+
+ TNode constant;
+ TNode factor;
+ if (node[0].getKind() == kind::CONST_BITVECTOR) {
+ constant = node[0];
+ factor = node[1];
+ } else {
+ Assert(node[1].getKind() == kind::CONST_BITVECTOR);
+ constant = node[1];
+ factor = node[0];
+ }
+
+ if (factor.getKind() == kind::BITVECTOR_NEG) {
+ // push negation on the constant part
+ BitVector const_bv = constant.getConst<BitVector>();
+ return utils::mkSortedNode(kind::BITVECTOR_MULT,
+ utils::mkConst(-const_bv),
+ factor[0]);
+ }
+
+ std::vector<Node> children;
+ for(unsigned i = 0; i < factor.getNumChildren(); ++i) {
+ children.push_back(utils::mkSortedNode(kind::BITVECTOR_MULT, constant, factor[i]));
+ }
+
+ return utils::mkSortedNode(factor.getKind(), children);
+
+}
+
+
+/**
+ * -(c * expr) ==> (-c * expr)
+ * where c is a constant
+ */
+template<> inline
+bool RewriteRule<NegMult>::applies(Node node) {
+ if(node.getKind()!= kind::BITVECTOR_NEG ||
+ node[0].getKind() != kind::BITVECTOR_MULT) {
+ return false;
+ }
+ TNode mult = node[0];
+ for (unsigned i = 0; i < mult.getNumChildren(); ++i) {
+ if (mult[i].getKind() == kind::CONST_BITVECTOR) {
+ return true;
+ }
+ }
+ return false;
+}
+
+template<> inline
+Node RewriteRule<NegMult>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<NegMult>(" << node << ")" << std::endl;
+ TNode mult = node[0];
+ std::vector<Node> children;
+ bool has_const = false;
+ for(unsigned i = 0; i < mult.getNumChildren(); ++i) {
+ if(mult[i].getKind() == kind::CONST_BITVECTOR) {
+ Assert(has_const == false);
+ has_const = true;
+ BitVector bv = mult[i].getConst<BitVector>();
+ children.push_back(utils::mkConst(-bv));
+ } else {
+ children.push_back(mult[i]);
+ }
+ }
+ Assert (has_const);
+ return utils::mkSortedNode(kind::BITVECTOR_MULT, children);
+}
+
+template<> inline
+bool RewriteRule<NegSub>::applies(Node node) {
+ return (node.getKind() == kind::BITVECTOR_NEG &&
+ node[0].getKind() == kind::BITVECTOR_SUB);
+}
+
+template<> inline
+Node RewriteRule<NegSub>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<NegSub>(" << node << ")" << std::endl;
+ return utils::mkNode(kind::BITVECTOR_SUB, node[0][1], node[0][0]);
+}
+
+template<> inline
+bool RewriteRule<NegPlus>::applies(Node node) {
+ return (node.getKind() == kind::BITVECTOR_NEG &&
+ node[0].getKind() == kind::BITVECTOR_PLUS);
+}
+
+template<> inline
+Node RewriteRule<NegPlus>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<NegPlus>(" << node << ")" << std::endl;
+ std::vector<Node> children;
+ for (unsigned i = 0; i < node[0].getNumChildren(); ++i) {
+ children.push_back(utils::mkNode(kind::BITVECTOR_NEG, node[0][i]));
+ }
+ return utils::mkSortedNode(kind::BITVECTOR_PLUS, children);
+}
+
+
+
+
+struct Count {
+ unsigned pos;
+ unsigned neg;
+ Count() : pos(0), neg(0) {}
+ Count(unsigned p, unsigned n):
+ pos(p),
+ neg(n)
+ {}
+};
+
+inline static void insert(std::hash_map<TNode, Count, TNodeHashFunction>& map, TNode node, bool neg) {
+ if(map.find(node) == map.end()) {
+ Count c = neg? Count(0,1) : Count(1, 0);
+ map[node] = c;
+ } else {
+ if (neg) {
+ ++(map[node].neg);
+ } else {
+ ++(map[node].pos);
+ }
+ }
+}
+
+template<> inline
+bool RewriteRule<AndSimplify>::applies(Node node) {
+ return (node.getKind() == kind::BITVECTOR_AND);
+}
+
+template<> inline
+Node RewriteRule<AndSimplify>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<AndSimplify>(" << node << ")" << std::endl;
+
+ // this will remove duplicates
+ std::hash_map<TNode, Count, TNodeHashFunction> subterms;
+ unsigned size = utils::getSize(node);
+ BitVector constant = utils::mkBitVectorOnes(size);
+
+ for (unsigned i = 0; i < node.getNumChildren(); ++i) {
+ TNode current = node[i];
+ // simplify constants
+ if (current.getKind() == kind::CONST_BITVECTOR) {
+ BitVector bv = current.getConst<BitVector>();
+ constant = constant & bv;
+ } else {
+ if (current.getKind() == kind::BITVECTOR_NOT) {
+ insert(subterms, current[0], true);
+ } else {
+ insert(subterms, current, false);
+ }
+ }
+ }
+
+ std::vector<Node> children;
+
+ if (constant == BitVector(size, (unsigned)0)) {
+ return utils::mkConst(BitVector(size, (unsigned)0));
+ }
+
+ if (constant != utils::mkBitVectorOnes(size)) {
+ children.push_back(utils::mkConst(constant));
+ }
+
+ std::hash_map<TNode, Count, TNodeHashFunction>::const_iterator it = subterms.begin();
+
+ for (; it != subterms.end(); ++it) {
+ if (it->second.pos > 0 && it->second.neg > 0) {
+ // if we have a and ~a
+ return utils::mkConst(BitVector(size, (unsigned)0));
+ } else {
+ // idempotence
+ if (it->second.neg > 0) {
+ // if it only occured negated
+ children.push_back(utils::mkNode(kind::BITVECTOR_NOT, it->first));
+ } else {
+ // if it only occured positive
+ children.push_back(it->first);
+ }
+ }
+ }
+ if (children.size() == 0) {
+ return utils::mkOnes(size);
+ }
+
+ return utils::mkSortedNode(kind::BITVECTOR_AND, children);
+}
+
+template<> inline
+bool RewriteRule<OrSimplify>::applies(Node node) {
+ return (node.getKind() == kind::BITVECTOR_OR);
+}
+
+template<> inline
+Node RewriteRule<OrSimplify>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<OrSimplify>(" << node << ")" << std::endl;
+
+ // this will remove duplicates
+ std::hash_map<TNode, Count, TNodeHashFunction> subterms;
+ unsigned size = utils::getSize(node);
+ BitVector constant(size, (unsigned)0);
+
+ for (unsigned i = 0; i < node.getNumChildren(); ++i) {
+ TNode current = node[i];
+ // simplify constants
+ if (current.getKind() == kind::CONST_BITVECTOR) {
+ BitVector bv = current.getConst<BitVector>();
+ constant = constant | bv;
+ } else {
+ if (current.getKind() == kind::BITVECTOR_NOT) {
+ insert(subterms, current[0], true);
+ } else {
+ insert(subterms, current, false);
+ }
+ }
+ }
+
+ std::vector<Node> children;
+
+ if (constant == utils::mkBitVectorOnes(size)) {
+ return utils::mkOnes(size);
+ }
+
+ if (constant != BitVector(size, (unsigned)0)) {
+ children.push_back(utils::mkConst(constant));
+ }
+
+ std::hash_map<TNode, Count, TNodeHashFunction>::const_iterator it = subterms.begin();
+
+ for (; it != subterms.end(); ++it) {
+ if (it->second.pos > 0 && it->second.neg > 0) {
+ // if we have a or ~a
+ return utils::mkOnes(size);
+ } else {
+ // idempotence
+ if (it->second.neg > 0) {
+ // if it only occured negated
+ children.push_back(utils::mkNode(kind::BITVECTOR_NOT, it->first));
+ } else {
+ // if it only occured positive
+ children.push_back(it->first);
+ }
+ }
+ }
+
+ if (children.size() == 0) {
+ return utils::mkConst(BitVector(size, (unsigned)0));
+ }
+ return utils::mkSortedNode(kind::BITVECTOR_OR, children);
+}
+
+template<> inline
+bool RewriteRule<XorSimplify>::applies(Node node) {
+ return (node.getKind() == kind::BITVECTOR_XOR);
+}
+
+template<> inline
+Node RewriteRule<XorSimplify>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<XorSimplify>(" << node << ")" << std::endl;
+
+
+ std::hash_map<TNode, Count, TNodeHashFunction> subterms;
+ unsigned size = utils::getSize(node);
+ BitVector constant;
+ bool const_set = false;
+
+ for (unsigned i = 0; i < node.getNumChildren(); ++i) {
+ TNode current = node[i];
+ // simplify constants
+ if (current.getKind() == kind::CONST_BITVECTOR) {
+ BitVector bv = current.getConst<BitVector>();
+ if (const_set) {
+ constant = constant ^ bv;
+ } else {
+ const_set = true;
+ constant = bv;
+ }
+ } else {
+ // collect number of occurances of each term and its negation
+ if (current.getKind() == kind::BITVECTOR_NOT) {
+ insert(subterms, current[0], true);
+ } else {
+ insert(subterms, current, false);
+ }
+ }
+ }
+
+ std::vector<Node> children;
+
+ std::hash_map<TNode, Count, TNodeHashFunction>::const_iterator it = subterms.begin();
+ unsigned true_count = 0;
+ bool seen_false = false;
+ for (; it != subterms.end(); ++it) {
+ unsigned pos = it->second.pos; // number of positive occurances
+ unsigned neg = it->second.neg; // number of negated occurances
+
+ // remove duplicates using the following rules
+ // a xor a ==> false
+ // false xor false ==> false
+ seen_false = seen_false? seen_false : (pos > 1 || neg > 1);
+ // check what did not reduce
+ if (pos % 2 && neg % 2) {
+ // we have a xor ~a ==> true
+ ++true_count;
+ } else if (pos % 2) {
+ // we had a positive occurence left
+ children.push_back(it->first);
+ } else if (neg % 2) {
+ // we had a negative occurence left
+ children.push_back(utils::mkNode(kind::BITVECTOR_NOT, it->first));
+ }
+ // otherwise both reduced to false
+ }
+
+ std::vector<BitVector> xorConst;
+ BitVector true_bv = utils::mkBitVectorOnes(size);
+ BitVector false_bv(size, (unsigned)0);
+
+ if (true_count) {
+ // true xor ... xor true ==> true (odd)
+ // ==> false (even)
+ xorConst.push_back(true_count % 2? true_bv : false_bv);
+ }
+ if (seen_false) {
+ xorConst.push_back(false_bv);
+ }
+ if(const_set) {
+ xorConst.push_back(constant);
+ }
+
+ if (xorConst.size() > 0) {
+ BitVector result = xorConst[0];
+ for (unsigned i = 1; i < xorConst.size(); ++i) {
+ result = result ^ xorConst[i];
+ }
+ children.push_back(utils::mkConst(result));
+ }
+
+ Assert(children.size());
+
+ return utils::mkSortedNode(kind::BITVECTOR_XOR, children);
+}
+
+
+
+
+// template<> inline
+// bool RewriteRule<AndSimplify>::applies(Node node) {
+// return (node.getKind() == kind::BITVECTOR_AND);
+// }
+
+// template<> inline
+// Node RewriteRule<AndSimplify>::apply(Node node) {
+// BVDebug("bv-rewrite") << "RewriteRule<AndSimplify>(" << node << ")" << std::endl;
+// return resultNode;
+// }
+
-// template<>
+// template<> inline
// bool RewriteRule<>::applies(Node node) {
// return (node.getKind() == kind::BITVECTOR_CONCAT);
// }
-// template<>
+// template<> inline
// Node RewriteRule<>::apply(Node node) {
// BVDebug("bv-rewrite") << "RewriteRule<>(" << node << ")" << std::endl;
// return resultNode;
diff --git a/src/theory/bv/theory_bv_rewrite_rules_simplification.h b/src/theory/bv/theory_bv_rewrite_rules_simplification.h
index 507f98c91..cf8310e5a 100644
--- a/src/theory/bv/theory_bv_rewrite_rules_simplification.h
+++ b/src/theory/bv/theory_bv_rewrite_rules_simplification.h
@@ -36,14 +36,14 @@ namespace bv {
*
* Left Shift by constant amount
*/
-template<>
+template<> inline
bool RewriteRule<ShlByConst>::applies(Node node) {
// if the shift amount is constant
return (node.getKind() == kind::BITVECTOR_SHL &&
node[1].getKind() == kind::CONST_BITVECTOR);
}
-template<>
+template<> inline
Node RewriteRule<ShlByConst>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ShlByConst>(" << node << ")" << std::endl;
Integer amount = node[1].getConst<BitVector>().toInteger();
@@ -72,14 +72,14 @@ Node RewriteRule<ShlByConst>::apply(Node node) {
* Right Logical Shift by constant amount
*/
-template<>
+template<> inline
bool RewriteRule<LshrByConst>::applies(Node node) {
// if the shift amount is constant
return (node.getKind() == kind::BITVECTOR_LSHR &&
node[1].getKind() == kind::CONST_BITVECTOR);
}
-template<>
+template<> inline
Node RewriteRule<LshrByConst>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<LshrByConst>(" << node << ")" << std::endl;
Integer amount = node[1].getConst<BitVector>().toInteger();
@@ -108,14 +108,14 @@ Node RewriteRule<LshrByConst>::apply(Node node) {
* Right Arithmetic Shift by constant amount
*/
-template<>
+template<> inline
bool RewriteRule<AshrByConst>::applies(Node node) {
// if the shift amount is constant
return (node.getKind() == kind::BITVECTOR_ASHR &&
node[1].getKind() == kind::CONST_BITVECTOR);
}
-template<>
+template<> inline
Node RewriteRule<AshrByConst>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<AshrByConst>(" << node << ")" << std::endl;
Integer amount = node[1].getConst<BitVector>().toInteger();
@@ -150,14 +150,14 @@ Node RewriteRule<AshrByConst>::apply(Node node) {
* (a bvor a) ==> a
*/
-template<>
+template<> inline
bool RewriteRule<BitwiseIdemp>::applies(Node node) {
return ((node.getKind() == kind::BITVECTOR_AND ||
node.getKind() == kind::BITVECTOR_OR) &&
node[0] == node[1]);
}
-template<>
+template<> inline
Node RewriteRule<BitwiseIdemp>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<BitwiseIdemp>(" << node << ")" << std::endl;
return node[0];
@@ -169,7 +169,7 @@ Node RewriteRule<BitwiseIdemp>::apply(Node node) {
* (a bvand 0) ==> 0
*/
-template<>
+template<> inline
bool RewriteRule<AndZero>::applies(Node node) {
unsigned size = utils::getSize(node);
return (node.getKind() == kind::BITVECTOR_AND &&
@@ -177,7 +177,7 @@ bool RewriteRule<AndZero>::applies(Node node) {
node[1] == utils::mkConst(size, 0)));
}
-template<>
+template<> inline
Node RewriteRule<AndZero>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<AndZero>(" << node << ")" << std::endl;
return utils::mkConst(utils::getSize(node), 0);
@@ -189,7 +189,7 @@ Node RewriteRule<AndZero>::apply(Node node) {
* (a bvand 1) ==> a
*/
-template<>
+template<> inline
bool RewriteRule<AndOne>::applies(Node node) {
unsigned size = utils::getSize(node);
Node ones = utils::mkOnes(size);
@@ -198,7 +198,7 @@ bool RewriteRule<AndOne>::applies(Node node) {
node[1] == ones));
}
-template<>
+template<> inline
Node RewriteRule<AndOne>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<AndOne>(" << node << ")" << std::endl;
unsigned size = utils::getSize(node);
@@ -217,7 +217,7 @@ Node RewriteRule<AndOne>::apply(Node node) {
* (a bvor 0) ==> a
*/
-template<>
+template<> inline
bool RewriteRule<OrZero>::applies(Node node) {
unsigned size = utils::getSize(node);
return (node.getKind() == kind::BITVECTOR_OR &&
@@ -225,7 +225,7 @@ bool RewriteRule<OrZero>::applies(Node node) {
node[1] == utils::mkConst(size, 0)));
}
-template<>
+template<> inline
Node RewriteRule<OrZero>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<OrZero>(" << node << ")" << std::endl;
@@ -244,7 +244,7 @@ Node RewriteRule<OrZero>::apply(Node node) {
* (a bvor 1) ==> 1
*/
-template<>
+template<> inline
bool RewriteRule<OrOne>::applies(Node node) {
unsigned size = utils::getSize(node);
Node ones = utils::mkOnes(size);
@@ -253,7 +253,7 @@ bool RewriteRule<OrOne>::applies(Node node) {
node[1] == ones));
}
-template<>
+template<> inline
Node RewriteRule<OrOne>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<OrOne>(" << node << ")" << std::endl;
return utils::mkOnes(utils::getSize(node));
@@ -266,13 +266,13 @@ Node RewriteRule<OrOne>::apply(Node node) {
* (a bvxor a) ==> 0
*/
-template<>
+template<> inline
bool RewriteRule<XorDuplicate>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_XOR &&
node[0] == node[1]);
}
-template<>
+template<> inline
Node RewriteRule<XorDuplicate>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<XorDuplicate>(" << node << ")" << std::endl;
return utils::mkConst(BitVector(utils::getSize(node), Integer(0)));
@@ -284,27 +284,39 @@ Node RewriteRule<XorDuplicate>::apply(Node node) {
* (a bvxor 1) ==> ~a
*/
-template<>
+template<> inline
bool RewriteRule<XorOne>::applies(Node node) {
- Node ones = utils::mkOnes(utils::getSize(node));
- return (node.getKind() == kind::BITVECTOR_XOR &&
- (node[0] == ones ||
- node[1] == ones));
+ if (node.getKind() != kind::BITVECTOR_XOR) {
+ return false;
+ }
+ Node ones = utils::mkOnes(utils::getSize(node));
+ for (unsigned i = 0; i < node.getNumChildren(); ++i) {
+ if (node[i] == ones) {
+ return true;
+ }
+ }
+ return false;
}
-template<>
+template<> inline
Node RewriteRule<XorOne>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<XorOne>(" << node << ")" << std::endl;
Node ones = utils::mkOnes(utils::getSize(node));
- Node a;
- if (node[0] == ones) {
- a = node[1];
- } else {
- Assert(node[1] == ones);
- a = node[0];
+ std::vector<Node> children;
+ bool found_ones = false;
+ // XorSimplify should have been called before
+ for(unsigned i = 0; i < node.getNumChildren(); ++i) {
+ if (node[i] == ones) {
+ // make sure only ones occurs only once
+ Assert(!found_ones);
+ found_ones = true;
+ } else {
+ children.push_back(node[i]);
+ }
}
- return utils::mkNode(kind::BITVECTOR_NOT, a);
+ children[0] = utils::mkNode(kind::BITVECTOR_NOT, children[0]);
+ return utils::mkSortedNode(kind::BITVECTOR_XOR, children);
}
@@ -314,24 +326,39 @@ Node RewriteRule<XorOne>::apply(Node node) {
* (a bvxor 0) ==> a
*/
-template<>
+template<> inline
bool RewriteRule<XorZero>::applies(Node node) {
- Node zero = utils::mkConst(utils::getSize(node), 0);
- return (node.getKind() == kind::BITVECTOR_XOR &&
- (node[0] == zero ||
- node[1] == zero));
+ if (node.getKind() != kind::BITVECTOR_XOR) {
+ return false;
+ }
+ Node zero = utils::mkConst(utils::getSize(node), 0);
+ for (unsigned i = 0; i < node.getNumChildren(); ++i) {
+ if (node[i] == zero) {
+ return true;
+ }
+ }
+ return false;
}
-template<>
+template<> inline
Node RewriteRule<XorZero>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<XorZero>(" << node << ")" << std::endl;
- Node zero = utils::mkConst(utils::getSize(node), 0);
- if (node[0] == zero) {
- return node[1];
+ std::vector<Node> children;
+ bool found_zero = false;
+ Node zero = utils::mkConst(utils::getSize(node), 0);
+
+ // XorSimplify should have been called before
+ for(unsigned i = 0; i < node.getNumChildren(); ++i) {
+ if (node[i] == zero) {
+ // make sure zero occurs only once
+ Assert(!found_zero);
+ found_zero = true;
+ } else {
+ children.push_back(node[i]);
+ }
}
-
- Assert(node[1] == zero);
- return node[0];
+
+ return utils::mkNode(kind::BITVECTOR_XOR, children);
}
@@ -341,14 +368,14 @@ Node RewriteRule<XorZero>::apply(Node node) {
* (a bvand (~ a)) ==> 0
*/
-template<>
+template<> inline
bool RewriteRule<BitwiseNotAnd>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_AND &&
((node[0].getKind() == kind::BITVECTOR_NOT && node[0][0] == node[1]) ||
(node[1].getKind() == kind::BITVECTOR_NOT && node[1][0] == node[0])));
}
-template<>
+template<> inline
Node RewriteRule<BitwiseNotAnd>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<BitwiseNegAnd>(" << node << ")" << std::endl;
return utils::mkConst(BitVector(utils::getSize(node), Integer(0)));
@@ -360,14 +387,14 @@ Node RewriteRule<BitwiseNotAnd>::apply(Node node) {
* (a bvor (~ a)) ==> 1
*/
-template<>
+template<> inline
bool RewriteRule<BitwiseNotOr>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_OR &&
((node[0].getKind() == kind::BITVECTOR_NOT && node[0][0] == node[1]) ||
(node[1].getKind() == kind::BITVECTOR_NOT && node[1][0] == node[0])));
}
-template<>
+template<> inline
Node RewriteRule<BitwiseNotOr>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<BitwiseNotOr>(" << node << ")" << std::endl;
uint32_t size = utils::getSize(node);
@@ -381,14 +408,14 @@ Node RewriteRule<BitwiseNotOr>::apply(Node node) {
* ((~ a) bvxor (~ b)) ==> (a bvxor b)
*/
-template<>
+template<> inline
bool RewriteRule<XorNot>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_XOR &&
node[0].getKind() == kind::BITVECTOR_NOT &&
node[1].getKind() == kind::BITVECTOR_NOT);
}
-template<>
+template<> inline
Node RewriteRule<XorNot>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<XorNot>(" << node << ")" << std::endl;
Node a = node[0][0];
@@ -402,19 +429,19 @@ Node RewriteRule<XorNot>::apply(Node node) {
* ~(a bvxor b) ==> (~ a bvxor b)
*/
-template<>
+template<> inline
bool RewriteRule<NotXor>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_NOT &&
node[0].getKind() == kind::BITVECTOR_XOR);
}
-template<>
+template<> inline
Node RewriteRule<NotXor>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<XorNot>(" << node << ")" << std::endl;
Node a = node[0][0];
Node b = node[0][1];
Node nota = utils::mkNode(kind::BITVECTOR_NOT, a);
- return utils::mkNode(kind::BITVECTOR_XOR, nota, b);
+ return utils::mkSortedNode(kind::BITVECTOR_XOR, nota, b);
}
/**
@@ -423,13 +450,13 @@ Node RewriteRule<NotXor>::apply(Node node) {
* ~ (~ a) ==> a
*/
-template<>
+template<> inline
bool RewriteRule<NotIdemp>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_NOT &&
node[0].getKind() == kind::BITVECTOR_NOT);
}
-template<>
+template<> inline
Node RewriteRule<NotIdemp>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<XorIdemp>(" << node << ")" << std::endl;
return node[0][0];
@@ -443,14 +470,14 @@ Node RewriteRule<NotIdemp>::apply(Node node) {
* a < a ==> false
*/
-template<>
+template<> inline
bool RewriteRule<LtSelf>::applies(Node node) {
return ((node.getKind() == kind::BITVECTOR_ULT ||
node.getKind() == kind::BITVECTOR_SLT) &&
node[0] == node[1]);
}
-template<>
+template<> inline
Node RewriteRule<LtSelf>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<LtSelf>(" << node << ")" << std::endl;
return utils::mkFalse();
@@ -462,14 +489,14 @@ Node RewriteRule<LtSelf>::apply(Node node) {
* a <= a ==> true
*/
-template<>
+template<> inline
bool RewriteRule<LteSelf>::applies(Node node) {
return ((node.getKind() == kind::BITVECTOR_ULE ||
node.getKind() == kind::BITVECTOR_SLE) &&
node[0] == node[1]);
}
-template<>
+template<> inline
Node RewriteRule<LteSelf>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<LteSelf>(" << node << ")" << std::endl;
return utils::mkTrue();
@@ -481,13 +508,13 @@ Node RewriteRule<LteSelf>::apply(Node node) {
* a < 0 ==> false
*/
-template<>
+template<> inline
bool RewriteRule<UltZero>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_ULT &&
node[1] == utils::mkConst(BitVector(utils::getSize(node[0]), Integer(0))));
}
-template<>
+template<> inline
Node RewriteRule<UltZero>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<UltZero>(" << node << ")" << std::endl;
return utils::mkFalse();
@@ -499,13 +526,13 @@ Node RewriteRule<UltZero>::apply(Node node) {
* a < a ==> false
*/
-template<>
+template<> inline
bool RewriteRule<UltSelf>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_ULT &&
node[1] == node[0]);
}
-template<>
+template<> inline
Node RewriteRule<UltSelf>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<UltSelf>(" << node << ")" << std::endl;
return utils::mkFalse();
@@ -518,13 +545,13 @@ Node RewriteRule<UltSelf>::apply(Node node) {
* a <= 0 ==> a = 0
*/
-template<>
+template<> inline
bool RewriteRule<UleZero>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_ULE &&
node[1] == utils::mkConst(BitVector(utils::getSize(node[0]), Integer(0))));
}
-template<>
+template<> inline
Node RewriteRule<UleZero>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<UleZero>(" << node << ")" << std::endl;
return utils::mkNode(kind::EQUAL, node[0], node[1]);
@@ -536,13 +563,13 @@ Node RewriteRule<UleZero>::apply(Node node) {
* a <= a ==> true
*/
-template<>
+template<> inline
bool RewriteRule<UleSelf>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_ULE &&
node[1] == node[0]);
}
-template<>
+template<> inline
Node RewriteRule<UleSelf>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<UleSelf>(" << node << ")" << std::endl;
return utils::mkTrue();
@@ -555,13 +582,13 @@ Node RewriteRule<UleSelf>::apply(Node node) {
* 0 <= a ==> true
*/
-template<>
+template<> inline
bool RewriteRule<ZeroUle>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_ULE &&
node[0] == utils::mkConst(BitVector(utils::getSize(node[0]), Integer(0))));
}
-template<>
+template<> inline
Node RewriteRule<ZeroUle>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ZeroUle>(" << node << ")" << std::endl;
return utils::mkTrue();
@@ -573,7 +600,7 @@ Node RewriteRule<ZeroUle>::apply(Node node) {
* a <= 11..1 ==> true
*/
-template<>
+template<> inline
bool RewriteRule<UleMax>::applies(Node node) {
if (node.getKind()!= kind::BITVECTOR_ULE) {
return false;
@@ -584,7 +611,7 @@ bool RewriteRule<UleMax>::applies(Node node) {
node[1] == utils::mkConst(BitVector(size, ones)));
}
-template<>
+template<> inline
Node RewriteRule<UleMax>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<UleMax>(" << node << ")" << std::endl;
return utils::mkTrue();
@@ -596,13 +623,13 @@ Node RewriteRule<UleMax>::apply(Node node) {
* ~ ( a < b) ==> b <= a
*/
-template<>
+template<> inline
bool RewriteRule<NotUlt>::applies(Node node) {
return (node.getKind() == kind::NOT &&
node[0].getKind() == kind::BITVECTOR_ULT);
}
-template<>
+template<> inline
Node RewriteRule<NotUlt>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<NotUlt>(" << node << ")" << std::endl;
Node ult = node[0];
@@ -617,13 +644,13 @@ Node RewriteRule<NotUlt>::apply(Node node) {
* ~ ( a <= b) ==> b < a
*/
-template<>
+template<> inline
bool RewriteRule<NotUle>::applies(Node node) {
return (node.getKind() == kind::NOT &&
node[0].getKind() == kind::BITVECTOR_ULE);
}
-template<>
+template<> inline
Node RewriteRule<NotUle>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<NotUle>(" << node << ")" << std::endl;
Node ult = node[0];
@@ -638,7 +665,7 @@ Node RewriteRule<NotUle>::apply(Node node) {
* (a * 1) ==> a
*/
-template<>
+template<> inline
bool RewriteRule<MultOne>::applies(Node node) {
unsigned size = utils::getSize(node);
return (node.getKind() == kind::BITVECTOR_MULT &&
@@ -646,7 +673,7 @@ bool RewriteRule<MultOne>::applies(Node node) {
node[1] == utils::mkConst(size, 1)));
}
-template<>
+template<> inline
Node RewriteRule<MultOne>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<MultOne>(" << node << ")" << std::endl;
unsigned size = utils::getSize(node);
@@ -663,7 +690,7 @@ Node RewriteRule<MultOne>::apply(Node node) {
* (a * 0) ==> 0
*/
-template<>
+template<> inline
bool RewriteRule<MultZero>::applies(Node node) {
unsigned size = utils::getSize(node);
return (node.getKind() == kind::BITVECTOR_MULT &&
@@ -671,7 +698,7 @@ bool RewriteRule<MultZero>::applies(Node node) {
node[1] == utils::mkConst(size, 0)));
}
-template<>
+template<> inline
Node RewriteRule<MultZero>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<MultZero>(" << node << ")" << std::endl;
return utils::mkConst(utils::getSize(node), 0);
@@ -683,33 +710,39 @@ Node RewriteRule<MultZero>::apply(Node node) {
* (a * 2^k) ==> a[n-k-1:0] 0_k
*/
-template<>
+template<> inline
bool RewriteRule<MultPow2>::applies(Node node) {
- return (node.getKind() == kind::BITVECTOR_MULT &&
- (utils::isPow2Const(node[0]) ||
- utils::isPow2Const(node[1])));
+ if (node.getKind() != kind::BITVECTOR_MULT)
+ return false;
+
+ for(unsigned i = 0; i < node.getNumChildren(); ++i) {
+ if (utils::isPow2Const(node[i])) {
+ return true;
+ }
+ }
+ return false;
}
-template<>
+template<> inline
Node RewriteRule<MultPow2>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<MultPow2>(" << node << ")" << std::endl;
- Node a;
- unsigned power;
- power = utils::isPow2Const(node[0]);
-
- if (power != 0) {
- a = node[1];
- // isPow2Const returns the power + 1
- --power;
- } else {
- power = utils::isPow2Const(node[1]);
- Assert(power != 0);
- a = node[0];
- power--;
+
+ std::vector<Node> children;
+ unsigned exponent = 0;
+ for(unsigned i = 0; i < node.getNumChildren(); ++i) {
+ unsigned exp = utils::isPow2Const(node[i]);
+ if (exp) {
+ exponent += exp - 1;
+ }
+ else {
+ children.push_back(node[i]);
+ }
}
- Node extract = utils::mkExtract(a, utils::getSize(node) - power - 1, 0);
- Node zeros = utils::mkConst(power, 0);
+ Node a = utils::mkSortedNode(kind::BITVECTOR_MULT, children);
+
+ Node extract = utils::mkExtract(a, utils::getSize(node) - exponent - 1, 0);
+ Node zeros = utils::mkConst(exponent, 0);
return utils::mkConcat(extract, zeros);
}
@@ -719,7 +752,7 @@ Node RewriteRule<MultPow2>::apply(Node node) {
* (a + 0) ==> a
*/
-template<>
+template<> inline
bool RewriteRule<PlusZero>::applies(Node node) {
Node zero = utils::mkConst(utils::getSize(node), 0);
return (node.getKind() == kind::BITVECTOR_PLUS &&
@@ -727,7 +760,7 @@ bool RewriteRule<PlusZero>::applies(Node node) {
node[1] == zero));
}
-template<>
+template<> inline
Node RewriteRule<PlusZero>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<PlusZero>(" << node << ")" << std::endl;
Node zero = utils::mkConst(utils::getSize(node), 0);
@@ -744,13 +777,13 @@ Node RewriteRule<PlusZero>::apply(Node node) {
* -(-a) ==> a
*/
-template<>
+template<> inline
bool RewriteRule<NegIdemp>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_NEG &&
node[0].getKind() == kind::BITVECTOR_NEG);
}
-template<>
+template<> inline
Node RewriteRule<NegIdemp>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<NegIdemp>(" << node << ")" << std::endl;
return node[0][0];
@@ -762,13 +795,13 @@ Node RewriteRule<NegIdemp>::apply(Node node) {
* (a udiv 2^k) ==> 0_k a[n-1: k]
*/
-template<>
+template<> inline
bool RewriteRule<UdivPow2>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_UDIV &&
utils::isPow2Const(node[1]));
}
-template<>
+template<> inline
Node RewriteRule<UdivPow2>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<UdivPow2>(" << node << ")" << std::endl;
Node a = node[0];
@@ -786,13 +819,13 @@ Node RewriteRule<UdivPow2>::apply(Node node) {
* (a udiv 1) ==> a
*/
-template<>
+template<> inline
bool RewriteRule<UdivOne>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_UDIV &&
node[1] == utils::mkConst(utils::getSize(node), 1));
}
-template<>
+template<> inline
Node RewriteRule<UdivOne>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<UdivOne>(" << node << ")" << std::endl;
return node[0];
@@ -804,13 +837,13 @@ Node RewriteRule<UdivOne>::apply(Node node) {
* (a udiv a) ==> 1
*/
-template<>
+template<> inline
bool RewriteRule<UdivSelf>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_UDIV &&
node[0] == node[1]);
}
-template<>
+template<> inline
Node RewriteRule<UdivSelf>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<UdivSelf>(" << node << ")" << std::endl;
return utils::mkConst(utils::getSize(node), 1);
@@ -822,13 +855,13 @@ Node RewriteRule<UdivSelf>::apply(Node node) {
* (a urem 2^k) ==> 0_(n-k) a[k-1:0]
*/
-template<>
+template<> inline
bool RewriteRule<UremPow2>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_UREM &&
utils::isPow2Const(node[1]));
}
-template<>
+template<> inline
Node RewriteRule<UremPow2>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<UremPow2>(" << node << ")" << std::endl;
TNode a = node[0];
@@ -844,13 +877,13 @@ Node RewriteRule<UremPow2>::apply(Node node) {
* (a urem 1) ==> 0
*/
-template<>
+template<> inline
bool RewriteRule<UremOne>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_UREM &&
node[1] == utils::mkConst(utils::getSize(node), 1));
}
-template<>
+template<> inline
Node RewriteRule<UremOne>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<UremOne>(" << node << ")" << std::endl;
return utils::mkConst(utils::getSize(node), 0);
@@ -862,13 +895,13 @@ Node RewriteRule<UremOne>::apply(Node node) {
* (a urem a) ==> 0
*/
-template<>
+template<> inline
bool RewriteRule<UremSelf>::applies(Node node) {
return (node.getKind() == kind::BITVECTOR_UREM &&
node[0] == node[1]);
}
-template<>
+template<> inline
Node RewriteRule<UremSelf>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<UremSelf>(" << node << ")" << std::endl;
return utils::mkConst(utils::getSize(node), 0);
@@ -880,7 +913,7 @@ Node RewriteRule<UremSelf>::apply(Node node) {
* (0_k >> a) ==> 0_k
*/
-template<>
+template<> inline
bool RewriteRule<ShiftZero>::applies(Node node) {
return ((node.getKind() == kind::BITVECTOR_SHL ||
node.getKind() == kind::BITVECTOR_LSHR ||
@@ -888,24 +921,110 @@ bool RewriteRule<ShiftZero>::applies(Node node) {
node[0] == utils::mkConst(utils::getSize(node), 0));
}
-template<>
+template<> inline
Node RewriteRule<ShiftZero>::apply(Node node) {
BVDebug("bv-rewrite") << "RewriteRule<ShiftZero>(" << node << ")" << std::endl;
return node[0];
}
+/**
+ * BBPlusNeg
+ *
+ * -a1 - a2 - ... - an + ak + .. ==> - (a1 + a2 + ... + an) + ak
+ *
+ */
+
+template<> inline
+bool RewriteRule<BBPlusNeg>::applies(Node node) {
+ if (node.getKind() != kind::BITVECTOR_PLUS) {
+ return false;
+ }
+
+ unsigned neg_count = 0;
+ for(unsigned i = 0; i < node.getNumChildren(); ++i) {
+ if (node[i].getKind()== kind::BITVECTOR_NEG) {
+ ++neg_count;
+ }
+ }
+ return neg_count > 1;
+}
+
+template<> inline
+Node RewriteRule<BBPlusNeg>::apply(Node node) {
+ BVDebug("bv-rewrite") << "RewriteRule<BBPlusNeg>(" << node << ")" << std::endl;
+
+ std::vector<Node> children;
+ unsigned neg_count = 0;
+ for(unsigned i = 0; i < node.getNumChildren(); ++i) {
+ if (node[i].getKind() == kind::BITVECTOR_NEG) {
+ ++neg_count;
+ children.push_back(utils::mkNode(kind::BITVECTOR_NOT, node[i][0]));
+ } else {
+ children.push_back(node[i]);
+ }
+ }
+ Assert(neg_count!= 0);
+ children.push_back(utils::mkConst(utils::getSize(node), neg_count));
+
+ return utils::mkSortedNode(kind::BITVECTOR_PLUS, children);
+}
+
+// /**
+// *
+// *
+// *
+// */
+
+// template<> inline
+// bool RewriteRule<BBFactorOut>::applies(Node node) {
+// if (node.getKind() != kind::BITVECTOR_PLUS) {
+// return false;
+// }
+
+// for (unsigned i = 0; i < node.getNumChildren(); ++i) {
+// if (node[i].getKind() != kind::BITVECTOR_MULT) {
+// return false;
+// }
+// }
+// }
+
+// template<> inline
+// Node RewriteRule<BBFactorOut>::apply(Node node) {
+// BVDebug("bv-rewrite") << "RewriteRule<BBFactorOut>(" << node << ")" << std::endl;
+// std::hash_set<TNode, TNodeHashFunction> factors;
+
+// for (unsigned i = 0; i < node.getNumChildren(); ++i) {
+// Assert (node[i].getKind() == kind::BITVECTOR_MULT);
+// for (unsigned j = 0; j < node[i].getNumChildren(); ++j) {
+// factors.insert(node[i][j]);
+// }
+// }
+
+// std::vector<TNode> gcd;
+// std::hash_set<TNode, TNodeHashFunction>::const_iterator it;
+// for (it = factors.begin(); it != factors.end(); ++it) {
+// // for each factor check if it occurs in all children
+// TNode f = *it;
+// for (unsigned i = 0; i < node.getNumChildren
+
+// }
+// }
+// return ;
+// }
+
+
// /**
// *
// *
// *
// */
-// template<>
+// template<> inline
// bool RewriteRule<>::applies(Node node) {
// return (node.getKind() == );
// }
-// template<>
+// template<> inline
// Node RewriteRule<>::apply(Node node) {
// BVDebug("bv-rewrite") << "RewriteRule<>(" << node << ")" << std::endl;
// return ;
diff --git a/src/theory/bv/theory_bv_rewriter.cpp b/src/theory/bv/theory_bv_rewriter.cpp
index 2b48977b6..c2649e881 100644
--- a/src/theory/bv/theory_bv_rewriter.cpp
+++ b/src/theory/bv/theory_bv_rewriter.cpp
@@ -49,19 +49,31 @@ void TheoryBVRewriter::shutdown() {
}
RewriteResponse TheoryBVRewriter::preRewrite(TNode node) {
- Debug("bitvector-rewrite") << "TheoryBV::preRewrite(" << node << ")" << std::endl;
- //return d_rewriteTable[node.getKind()](node);
- return RewriteResponse(REWRITE_DONE, node);
+ RewriteResponse res = d_rewriteTable[node.getKind()](node, true);
+ if(res.node != node) {
+ Debug("bitvector-rewrite") << "TheoryBV::preRewrite " << node << std::endl;
+ Debug("bitvector-rewrite") << "TheoryBV::preRewrite to " << res.node << std::endl;
+ }
+ return res;
}
RewriteResponse TheoryBVRewriter::postRewrite(TNode node) {
- //TimerStat::CodeTimer codeTimer(*d_rewriteTimer);
- Debug("bitvector-rewrite") << "TheoryBV::postRewrite(" << node << ")" << std::endl;
- RewriteResponse res = d_rewriteTable[node.getKind()](node);
+ RewriteResponse res = d_rewriteTable[node.getKind()](node, false);
+ if(res.node!= node) {
+ Debug("bitvector-rewrite") << "TheoryBV::postRewrite " << node << std::endl;
+ Debug("bitvector-rewrite") << "TheoryBV::postRewrite to " << res.node << std::endl;
+ }
+ // if (res.status == REWRITE_DONE) {
+ // Node rewr = res.node;
+ // Node rerewr = d_rewriteTable[rewr.getKind()](rewr, false).node;
+ // Assert(rewr == rerewr);
+ // }
+
return res;
}
-RewriteResponse TheoryBVRewriter::RewriteUlt(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteUlt(TNode node, bool preregister) {
+ // reduce common subexpressions on both sides
Node resultNode = LinearRewriteStrategy
< RewriteRule<EvalUlt>,
// if both arguments are constants evaluates
@@ -72,8 +84,13 @@ RewriteResponse TheoryBVRewriter::RewriteUlt(TNode node) {
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteSlt(TNode node){
- return RewriteResponse(REWRITE_DONE, node);
+RewriteResponse TheoryBVRewriter::RewriteSlt(TNode node, bool preregister){
+ Node resultNode = LinearRewriteStrategy
+ < RewriteRule < EvalSlt >
+ >::apply(node);
+
+ return RewriteResponse(REWRITE_DONE, resultNode);
+
// Node resultNode = LinearRewriteStrategy
// < RewriteRule < SltEliminate >
// // a <_s b ==> a + 2^{n-1} <_u b + 2^{n-1}
@@ -82,7 +99,7 @@ RewriteResponse TheoryBVRewriter::RewriteSlt(TNode node){
// return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteUle(TNode node){
+RewriteResponse TheoryBVRewriter::RewriteUle(TNode node, bool preregister){
Node resultNode = LinearRewriteStrategy
< RewriteRule<EvalUle>,
RewriteRule<UleMax>,
@@ -93,16 +110,15 @@ RewriteResponse TheoryBVRewriter::RewriteUle(TNode node){
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteSle(TNode node){
- return RewriteResponse(REWRITE_DONE, node);
- // Node resultNode = LinearRewriteStrategy
- // < RewriteRule<SleEliminate>
- // >::apply(node);
+RewriteResponse TheoryBVRewriter::RewriteSle(TNode node, bool preregister){
+ Node resultNode = LinearRewriteStrategy
+ < RewriteRule < EvalSle >
+ >::apply(node);
- // return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+ return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteUgt(TNode node){
+RewriteResponse TheoryBVRewriter::RewriteUgt(TNode node, bool preregister){
Node resultNode = LinearRewriteStrategy
< RewriteRule<UgtEliminate>
>::apply(node);
@@ -110,16 +126,16 @@ RewriteResponse TheoryBVRewriter::RewriteUgt(TNode node){
return RewriteResponse(REWRITE_AGAIN, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteSgt(TNode node){
+RewriteResponse TheoryBVRewriter::RewriteSgt(TNode node, bool preregister){
Node resultNode = LinearRewriteStrategy
< RewriteRule<SgtEliminate>
//RewriteRule<SltEliminate>
>::apply(node);
- return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+ return RewriteResponse(REWRITE_AGAIN, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteUge(TNode node){
+RewriteResponse TheoryBVRewriter::RewriteUge(TNode node, bool preregister){
Node resultNode = LinearRewriteStrategy
< RewriteRule<UgeEliminate>
>::apply(node);
@@ -127,7 +143,7 @@ RewriteResponse TheoryBVRewriter::RewriteUge(TNode node){
return RewriteResponse(REWRITE_AGAIN, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteSge(TNode node){
+RewriteResponse TheoryBVRewriter::RewriteSge(TNode node, bool preregister){
Node resultNode = LinearRewriteStrategy
< RewriteRule<SgeEliminate>
// RewriteRule<SleEliminate>
@@ -136,8 +152,9 @@ RewriteResponse TheoryBVRewriter::RewriteSge(TNode node){
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteNot(TNode node){
- Node resultNode = node;
+RewriteResponse TheoryBVRewriter::RewriteNot(TNode node, bool preregister){
+ Node resultNode = node;
+
if(RewriteRule<NotXor>::applies(node)) {
resultNode = RewriteRule<NotXor>::run<false>(node);
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
@@ -150,8 +167,9 @@ RewriteResponse TheoryBVRewriter::RewriteNot(TNode node){
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteExtract(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteExtract(TNode node, bool preregister) {
Node resultNode = node;
+
if (RewriteRule<ExtractConcat>::applies(node)) {
resultNode = RewriteRule<ExtractConcat>::run<false>(node);
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
@@ -184,7 +202,8 @@ RewriteResponse TheoryBVRewriter::RewriteExtract(TNode node) {
}
-RewriteResponse TheoryBVRewriter::RewriteConcat(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteConcat(TNode node, bool preregister) {
+
Node resultNode = LinearRewriteStrategy
< RewriteRule<ConcatFlatten>,
// Flatten the top level concatenations
@@ -197,45 +216,53 @@ RewriteResponse TheoryBVRewriter::RewriteConcat(TNode node) {
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteAnd(TNode node){
- Node resultNode = LinearRewriteStrategy
- < RewriteRule<EvalAnd>,
- RewriteRule<BitwiseIdemp>,
- RewriteRule<AndZero>,
- RewriteRule<AndOne>
+RewriteResponse TheoryBVRewriter::RewriteAnd(TNode node, bool preregister){
+ Node resultNode = node;
+
+ resultNode = LinearRewriteStrategy
+ < RewriteRule<FlattenAssocCommut>,
+ RewriteRule<AndSimplify>
+ // RewriteRule<EvalAnd>,
+ // RewriteRule<BitwiseIdemp>,
+ // //RewriteRule<BitwiseSlice>, -> might need rw again
+ // RewriteRule<AndZero>,
+ // RewriteRule<AndOne>
>::apply(node);
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteOr(TNode node){
- Node resultNode = LinearRewriteStrategy
- < RewriteRule<EvalOr>,
- RewriteRule<BitwiseIdemp>,
- RewriteRule<OrZero>,
- RewriteRule<OrOne>
+RewriteResponse TheoryBVRewriter::RewriteOr(TNode node, bool preregister){
+ Node resultNode = node;
+
+ resultNode = LinearRewriteStrategy
+ < RewriteRule<FlattenAssocCommut>,
+ RewriteRule<OrSimplify>
>::apply(node);
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteXor(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteXor(TNode node, bool preregister) {
Node resultNode = node;
- if (RewriteRule<XorOne>::applies(node)) {
- resultNode = RewriteRule<XorOne>::run<false> (node);
- return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
- }
+
resultNode = LinearRewriteStrategy
- < RewriteRule<XorNot>,
- RewriteRule<EvalXor>,
- RewriteRule<XorDuplicate>,
- RewriteRule<XorZero>
+ < RewriteRule<FlattenAssocCommut>, // flatten the expression
+ RewriteRule<XorSimplify>, // simplify duplicates and constants
+ RewriteRule<XorZero> // checks if the constant part is zero and eliminates it
>::apply(node);
-
+
+ // this simplification introduces new terms and might require further
+ // rewriting
+ if (RewriteRule<XorOne>::applies(resultNode)) {
+ resultNode = RewriteRule<XorOne>::run<false> (resultNode);
+ return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+ }
+
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteXnor(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteXnor(TNode node, bool preregister) {
Node resultNode = LinearRewriteStrategy
< RewriteRule<XnorEliminate>
>::apply(node);
@@ -243,7 +270,7 @@ RewriteResponse TheoryBVRewriter::RewriteXnor(TNode node) {
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteNand(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteNand(TNode node, bool preregister) {
Node resultNode = LinearRewriteStrategy
< RewriteRule<NandEliminate>
>::apply(node);
@@ -251,7 +278,7 @@ RewriteResponse TheoryBVRewriter::RewriteNand(TNode node) {
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteNor(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteNor(TNode node, bool preregister) {
Node resultNode = LinearRewriteStrategy
< RewriteRule<NorEliminate>
>::apply(node);
@@ -259,7 +286,7 @@ RewriteResponse TheoryBVRewriter::RewriteNor(TNode node) {
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteComp(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteComp(TNode node, bool preregister) {
Node resultNode = LinearRewriteStrategy
< RewriteRule<CompEliminate>
>::apply(node);
@@ -267,54 +294,81 @@ RewriteResponse TheoryBVRewriter::RewriteComp(TNode node) {
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteMult(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteMult(TNode node, bool preregister) {
Node resultNode = node;
- if(RewriteRule<MultPow2>::applies(node)) {
- resultNode = RewriteRule<MultPow2>::run <false> (node);
- return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
- }
resultNode = LinearRewriteStrategy
- < RewriteRule<EvalMult>,
- RewriteRule<MultOne>,
- RewriteRule<MultZero>
+ < RewriteRule<FlattenAssocCommut>, // flattens and sorts
+ RewriteRule<MultSimplify> // multiplies constant part and checks for 0
>::apply(node);
+ // only apply if every subterm was already rewritten
+ if (!preregister) {
+ // distributes multiplication by constant over +, - and unary -
+ if(RewriteRule<MultDistribConst>::applies(resultNode)) {
+ resultNode = RewriteRule<MultDistribConst>::run<false>(resultNode);
+ // creating new terms that might simplify further
+ return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+ }
+ }
+
+ if(resultNode == node) {
+ return RewriteResponse(REWRITE_DONE, resultNode);
+ }
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewritePlus(TNode node) {
- Node resultNode = LinearRewriteStrategy
- < RewriteRule<EvalPlus>,
- RewriteRule<PlusZero>
- // RewriteRule<PlusSelf>,
- // RewriteRule<PlusNegSelf>
- // RewriteRule<PlusLiftConcat>
- >::apply(node);
+RewriteResponse TheoryBVRewriter::RewritePlus(TNode node, bool preregister) {
+ Node resultNode = node;
- return RewriteResponse(REWRITE_DONE, resultNode);
+ resultNode = LinearRewriteStrategy
+ < RewriteRule<FlattenAssocCommut>,
+ RewriteRule<PlusCombineLikeTerms>
+ // RewriteRule<PlusLiftConcat>
+ >::apply(resultNode);
+ if (resultNode == node) {
+ return RewriteResponse(REWRITE_DONE, resultNode);
+ } else {
+ return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+ }
}
-RewriteResponse TheoryBVRewriter::RewriteSub(TNode node){
- return RewriteResponse(REWRITE_DONE, node);
- // Node resultNode = LinearRewriteStrategy
- // < RewriteRule<SubEliminate>
- // >::apply(node);
+RewriteResponse TheoryBVRewriter::RewriteSub(TNode node, bool preregister){
+ // return RewriteResponse(REWRITE_DONE, node);
+ Node resultNode = LinearRewriteStrategy
+ < RewriteRule<SubEliminate>
+ >::apply(node);
- // return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+ return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteNeg(TNode node) {
- Node resultNode = LinearRewriteStrategy
+RewriteResponse TheoryBVRewriter::RewriteNeg(TNode node, bool preregister) {
+ Node resultNode = node;
+
+ resultNode = LinearRewriteStrategy
< RewriteRule<EvalNeg>,
- RewriteRule<NegIdemp>
- >::apply(node);
+ RewriteRule<NegIdemp>,
+ RewriteRule<NegSub>
+ >::apply(node);
+
+ if (RewriteRule<NegPlus>::applies(node)) {
+ resultNode = RewriteRule<NegPlus>::run<false>(node);
+ return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+ }
+ if(!preregister) {
+ if (RewriteRule<NegMult>::applies(node)) {
+ resultNode = RewriteRule<NegMult>::run<false>(node);
+ return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+ }
+ }
+
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteUdiv(TNode node){
- Node resultNode = node;
+RewriteResponse TheoryBVRewriter::RewriteUdiv(TNode node, bool preregister){
+ Node resultNode = node;
+
if(RewriteRule<UdivPow2>::applies(node)) {
resultNode = RewriteRule<UdivPow2>::run <false> (node);
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
@@ -329,8 +383,10 @@ RewriteResponse TheoryBVRewriter::RewriteUdiv(TNode node){
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteUrem(TNode node) {
- Node resultNode = node;
+RewriteResponse TheoryBVRewriter::RewriteUrem(TNode node, bool preregister) {
+ Node resultNode = node;
+ return RewriteResponse(REWRITE_DONE, resultNode);
+
if(RewriteRule<UremPow2>::applies(node)) {
resultNode = RewriteRule<UremPow2>::run <false> (node);
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
@@ -344,7 +400,7 @@ RewriteResponse TheoryBVRewriter::RewriteUrem(TNode node) {
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteSmod(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteSmod(TNode node, bool preregister) {
Node resultNode = LinearRewriteStrategy
< RewriteRule<SmodEliminate>
>::apply(node);
@@ -352,7 +408,7 @@ RewriteResponse TheoryBVRewriter::RewriteSmod(TNode node) {
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteSdiv(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteSdiv(TNode node, bool preregister) {
Node resultNode = LinearRewriteStrategy
< RewriteRule<SdivEliminate>
>::apply(node);
@@ -360,14 +416,14 @@ RewriteResponse TheoryBVRewriter::RewriteSdiv(TNode node) {
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteSrem(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteSrem(TNode node, bool preregister) {
Node resultNode = LinearRewriteStrategy
< RewriteRule<SremEliminate>
>::apply(node);
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteShl(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteShl(TNode node, bool preregister) {
Node resultNode = node;
if(RewriteRule<ShlByConst>::applies(node)) {
resultNode = RewriteRule<ShlByConst>::run <false> (node);
@@ -382,7 +438,7 @@ RewriteResponse TheoryBVRewriter::RewriteShl(TNode node) {
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteLshr(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteLshr(TNode node, bool preregister) {
Node resultNode = node;
if(RewriteRule<LshrByConst>::applies(node)) {
resultNode = RewriteRule<LshrByConst>::run <false> (node);
@@ -397,7 +453,7 @@ RewriteResponse TheoryBVRewriter::RewriteLshr(TNode node) {
return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteAshr(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteAshr(TNode node, bool preregister) {
Node resultNode = node;
if(RewriteRule<AshrByConst>::applies(node)) {
resultNode = RewriteRule<AshrByConst>::run <false> (node);
@@ -413,7 +469,7 @@ RewriteResponse TheoryBVRewriter::RewriteAshr(TNode node) {
}
-RewriteResponse TheoryBVRewriter::RewriteRepeat(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteRepeat(TNode node, bool preregister) {
Node resultNode = LinearRewriteStrategy
< RewriteRule<RepeatEliminate >
>::apply(node);
@@ -421,7 +477,7 @@ RewriteResponse TheoryBVRewriter::RewriteRepeat(TNode node) {
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteZeroExtend(TNode node){
+RewriteResponse TheoryBVRewriter::RewriteZeroExtend(TNode node, bool preregister){
Node resultNode = LinearRewriteStrategy
< RewriteRule<ZeroExtendEliminate >
>::apply(node);
@@ -429,17 +485,17 @@ RewriteResponse TheoryBVRewriter::RewriteZeroExtend(TNode node){
return RewriteResponse(REWRITE_AGAIN, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteSignExtend(TNode node) {
- // Node resultNode = LinearRewriteStrategy
- // < RewriteRule<SignExtendEliminate >
- // >::apply(node);
+RewriteResponse TheoryBVRewriter::RewriteSignExtend(TNode node, bool preregister) {
+ Node resultNode = LinearRewriteStrategy
+ < RewriteRule<EvalSignExtend>
+ >::apply(node);
// return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
- return RewriteResponse(REWRITE_DONE, node);
+ return RewriteResponse(REWRITE_DONE, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteRotateRight(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteRotateRight(TNode node, bool preregister) {
Node resultNode = LinearRewriteStrategy
< RewriteRule<RotateRightEliminate >
>::apply(node);
@@ -447,7 +503,7 @@ RewriteResponse TheoryBVRewriter::RewriteRotateRight(TNode node) {
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteRotateLeft(TNode node){
+RewriteResponse TheoryBVRewriter::RewriteRotateLeft(TNode node, bool preregister){
Node resultNode = LinearRewriteStrategy
< RewriteRule<RotateLeftEliminate >
>::apply(node);
@@ -455,7 +511,7 @@ RewriteResponse TheoryBVRewriter::RewriteRotateLeft(TNode node){
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
-RewriteResponse TheoryBVRewriter::RewriteEqual(TNode node) {
+RewriteResponse TheoryBVRewriter::RewriteEqual(TNode node, bool preregister) {
Node resultNode = LinearRewriteStrategy
< RewriteRule<FailEq>,
RewriteRule<SimplifyEq>,
@@ -466,11 +522,11 @@ RewriteResponse TheoryBVRewriter::RewriteEqual(TNode node) {
}
-RewriteResponse TheoryBVRewriter::IdentityRewrite(TNode node) {
+RewriteResponse TheoryBVRewriter::IdentityRewrite(TNode node, bool prerewrite) {
return RewriteResponse(REWRITE_DONE, node);
}
-RewriteResponse TheoryBVRewriter::UndefinedRewrite(TNode node) {
+RewriteResponse TheoryBVRewriter::UndefinedRewrite(TNode node, bool prerewrite) {
Debug("bv-rewrite") << "TheoryBV::UndefinedRewrite for" << node;
Unimplemented();
}
diff --git a/src/theory/bv/theory_bv_rewriter.h b/src/theory/bv/theory_bv_rewriter.h
index 7ce914477..0ce3fa303 100644
--- a/src/theory/bv/theory_bv_rewriter.h
+++ b/src/theory/bv/theory_bv_rewriter.h
@@ -30,7 +30,7 @@ namespace theory {
namespace bv {
struct AllRewriteRules;
-typedef RewriteResponse (*RewriteFunction) (TNode);
+typedef RewriteResponse (*RewriteFunction) (TNode, bool);
class TheoryBVRewriter {
// static CVC4_THREADLOCAL(AllRewriteRules*) s_allRules;
@@ -39,47 +39,47 @@ class TheoryBVRewriter {
#warning "TODO: Double check thread safety and make sure the fix compiles on mac."
static RewriteFunction d_rewriteTable[kind::LAST_KIND];
- static RewriteResponse IdentityRewrite(TNode node);
- static RewriteResponse UndefinedRewrite(TNode node);
+ static RewriteResponse IdentityRewrite(TNode node, bool prerewrite = false);
+ static RewriteResponse UndefinedRewrite(TNode node, bool prerewrite = false);
static void initializeRewrites();
- static RewriteResponse RewriteEqual(TNode node);
- static RewriteResponse RewriteUlt(TNode node);
- static RewriteResponse RewriteSlt(TNode node);
- static RewriteResponse RewriteUle(TNode node);
- static RewriteResponse RewriteSle(TNode node);
- static RewriteResponse RewriteUgt(TNode node);
- static RewriteResponse RewriteSgt(TNode node);
- static RewriteResponse RewriteUge(TNode node);
- static RewriteResponse RewriteSge(TNode node);
- static RewriteResponse RewriteNot(TNode node);
- static RewriteResponse RewriteConcat(TNode node);
- static RewriteResponse RewriteAnd(TNode node);
- static RewriteResponse RewriteOr(TNode node);
- static RewriteResponse RewriteXnor(TNode node);
- static RewriteResponse RewriteXor(TNode node);
- static RewriteResponse RewriteNand(TNode node);
- static RewriteResponse RewriteNor(TNode node);
- static RewriteResponse RewriteComp(TNode node);
- static RewriteResponse RewriteMult(TNode node);
- static RewriteResponse RewritePlus(TNode node);
- static RewriteResponse RewriteSub(TNode node);
- static RewriteResponse RewriteNeg(TNode node);
- static RewriteResponse RewriteUdiv(TNode node);
- static RewriteResponse RewriteUrem(TNode node);
- static RewriteResponse RewriteSmod(TNode node);
- static RewriteResponse RewriteSdiv(TNode node);
- static RewriteResponse RewriteSrem(TNode node);
- static RewriteResponse RewriteShl(TNode node);
- static RewriteResponse RewriteLshr(TNode node);
- static RewriteResponse RewriteAshr(TNode node);
- static RewriteResponse RewriteExtract(TNode node);
- static RewriteResponse RewriteRepeat(TNode node);
- static RewriteResponse RewriteZeroExtend(TNode node);
- static RewriteResponse RewriteSignExtend(TNode node);
- static RewriteResponse RewriteRotateRight(TNode node);
- static RewriteResponse RewriteRotateLeft(TNode node);
+ static RewriteResponse RewriteEqual(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteUlt(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteSlt(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteUle(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteSle(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteUgt(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteSgt(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteUge(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteSge(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteNot(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteConcat(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteAnd(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteOr(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteXnor(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteXor(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteNand(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteNor(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteComp(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteMult(TNode node, bool prerewrite = false);
+ static RewriteResponse RewritePlus(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteSub(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteNeg(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteUdiv(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteUrem(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteSmod(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteSdiv(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteSrem(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteShl(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteLshr(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteAshr(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteExtract(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteRepeat(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteZeroExtend(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteSignExtend(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteRotateRight(TNode node, bool prerewrite = false);
+ static RewriteResponse RewriteRotateLeft(TNode node, bool prerewrite = false);
public:
diff --git a/src/theory/bv/theory_bv_utils.h b/src/theory/bv/theory_bv_utils.h
index 60e459958..8b5dd0499 100644
--- a/src/theory/bv/theory_bv_utils.h
+++ b/src/theory/bv/theory_bv_utils.h
@@ -79,6 +79,27 @@ inline Node mkAnd(std::vector<TNode>& children) {
}
}
+inline Node mkSortedNode(Kind kind, std::vector<Node>& children) {
+ Assert (kind == kind::BITVECTOR_PLUS ||
+ kind == kind::BITVECTOR_MULT ||
+ kind == kind::BITVECTOR_AND ||
+ kind == kind::BITVECTOR_OR ||
+ kind == kind::BITVECTOR_XOR);
+
+ if (children.size() == 1) {
+ return children[0];
+ }
+ std::sort(children.begin(), children.end());
+ return NodeManager::currentNM()->mkNode(kind, children);
+}
+
+
+inline Node mkNode(Kind kind, std::vector<Node>& children) {
+ if (children.size() == 1) {
+ return children[0];
+ }
+ return NodeManager::currentNM()->mkNode(kind, children);
+}
inline Node mkNode(Kind kind, TNode child) {
return NodeManager::currentNM()->mkNode(kind, child);
@@ -88,6 +109,21 @@ inline Node mkNode(Kind kind, TNode child1, TNode child2) {
return NodeManager::currentNM()->mkNode(kind, child1, child2);
}
+
+inline Node mkSortedNode(Kind kind, TNode child1, TNode child2) {
+ Assert (kind == kind::BITVECTOR_PLUS ||
+ kind == kind::BITVECTOR_MULT ||
+ kind == kind::BITVECTOR_AND ||
+ kind == kind::BITVECTOR_OR ||
+ kind == kind::BITVECTOR_XOR);
+
+ if (child1 < child2) {
+ return NodeManager::currentNM()->mkNode(kind, child1, child2);
+ } else {
+ return NodeManager::currentNM()->mkNode(kind, child2, child1);
+ }
+}
+
inline Node mkNode(Kind kind, TNode child1, TNode child2, TNode child3) {
return NodeManager::currentNM()->mkNode(kind, child1, child2, child3);
}
@@ -156,8 +192,14 @@ inline Node mkConcat(TNode t1, TNode t2) {
return NodeManager::currentNM()->mkNode(kind::BITVECTOR_CONCAT, t1, t2);
}
+
+inline BitVector mkBitVectorOnes(unsigned size) {
+ Assert(size > 0);
+ return BitVector(1, Integer(1)).signExtend(size - 1);
+}
+
inline Node mkOnes(unsigned size) {
- BitVector val = BitVector(1, Integer(1)).signExtend(size-1);
+ BitVector val = mkBitVectorOnes(size);
return NodeManager::currentNM()->mkConst<BitVector>(val);
}
@@ -276,6 +318,7 @@ inline Node mkConjunction(const std::vector<TNode>& nodes) {
std::vector<TNode>::const_iterator it_end = nodes.end();
while (it != it_end) {
TNode current = *it;
+
if (current != mkTrue()) {
Assert(isBVPredicate(current));
expandedNodes.push_back(current);
diff --git a/src/util/bitvector.h b/src/util/bitvector.h
index 7429ac8c9..512f23136 100644
--- a/src/util/bitvector.h
+++ b/src/util/bitvector.h
@@ -337,9 +337,9 @@ public:
}
/**
- Returns k is the integer is equal to 2^k and zero
+ Returns k is the integer is equal to 2^{k-1} and zero
otherwise
- @return k if the integer is equal to 2^k and zero otherwise
+ @return k if the integer is equal to 2^{k-1} and zero otherwise
*/
unsigned isPow2() {
return d_value.isPow2();
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback