1 //********************* */
2 /*! \file bv_solver_types.h
4 ** Original author: lianah
5 ** Major contributors: none
6 ** Minor contributors (to current version): none
7 ** This file is part of the CVC4 prototype.
8 ** Copyright (c) 2009, 2010, 2011 The Analysis of Computer Systems Group (ACSys)
9 ** Courant Institute of Mathematical Sciences
10 ** New York University
11 ** See the file COPYING in the top-level source directory for licensing
12 ** information.\endverbatim
14 ** \brief Definitions of the SatSolver literal and clause types
18 #include "cvc4_private.h"
20 #ifndef __CVC4__BV__SOLVER__TYPES_H
21 #define __CVC4__BV__SOLVER__TYPES_H
26 #ifdef BV_MINISAT /* BV_MINISAT if we are using the minisat solver for the theory of bitvectors*/
27 #include "theory/bv/bvminisat/core/Solver.h"
28 #include "theory/bv/bvminisat/core/SolverTypes.h"
29 #include "theory/bv/bvminisat/simp/SimpSolver.h"
30 #endif /* BV_MINISAT */
32 #ifdef BV_PICOSAT /* BV_PICOSAT */
33 #include "picosat/picosat.h"
34 #endif /* BV_PICOSAT */
36 #include "expr/node.h"
41 #include <ext/hash_map>
42 #include "context/cdlist.h"
43 #include "util/stats.h"
50 #endif /* BV_MINISAT */
54 // #ifdef BV_PICOSAT /* BV_PICOSAT */
56 // * PICOSAT type-definitions
61 // typedef int SatVar;
62 // typedef int SatLit;
64 // std::string toStringLit(SatLit lit);
67 // SatLit neg(const SatLit& lit);
69 // struct SatLitHash {
70 // static size_t hash (const SatLit& lit) {
71 // return (size_t) lit;
76 // struct SatLitHashFunction {
77 // size_t operator()(SatLit lit) const {
78 // return (size_t) lit;
83 // static bool compare(const SatLit& x, const SatLit& y)
89 // #endif /* BV_PICOSAT */
91 // #ifdef BV_PICOSAT /* BV_PICOSAT */
94 // * Some helper functions that should be defined for each SAT solver supported
100 // SatLit mkLit(SatVar var);
101 // SatVar mkVar(SatLit lit);
102 // bool polarity(SatLit lit);
106 // * Wrapper to create the impression of a SatSolver class for Picosat
107 // * which is written in C
110 // class SatSolver: public SatSolverInterface {
118 // picosat_init(); /// call constructor
119 // picosat_enable_trace_generation(); // required for unsat cores
126 // void addClause(const SatClause* cl) {
128 // const SatClause& clause = *cl;
129 // for (unsigned i = 0; i < clause.size(); ++i ) {
130 // picosat_add(clause[i]);
132 // picosat_add(0); // ends clause
137 // picosat_remove_learned(100);
139 // int res = picosat_sat(-1); // no decision limit
140 // // 0 UNKNOWN, 10 SATISFIABLE and 20 UNSATISFIABLE
142 // Assert (res == 10 || res == 20);
146 // bool solve(const context::CDList<SatLit> & assumps) {
147 // context::CDList<SatLit>::const_iterator it = assumps.begin();
148 // for (; it!= assumps.end(); ++it) {
149 // picosat_assume(*it);
154 // SatVar newVar() { return ++d_varCount; }
156 // void setUnremovable(SatLit lit) {};
158 // SatClause* getUnsatCore() {
159 // const int* failedAssumption = picosat_failed_assumptions();
160 // Assert(failedAssumption);
162 // SatClause* unsatCore = new SatClause();
163 // while (*failedAssumption != 0) {
164 // SatLit lit = *failedAssumption;
165 // unsatCore->addLiteral(neg(lit));
166 // ++failedAssumption;
168 // unsatCore->sort();
174 // #endif /* BV_PICOSAT */
181 } /* theory namespace */
183 } /* CVC4 namespace */
185 #endif /* __CVC4__BV__SOLVER__TYPES_H */