int,
ClauseList *,
ltint> ClauseBuckets;
-
+
+ typedef MAP<
+ int,
+ ASTVec,
+ ltint> UserGuided_AbsRefine_Asserts;
+
// Function to dump contents of ASTNodeMap
ostream &operator<<(ostream &os, const ASTNodeMap &nmap);
}; // end namespace BEEV
bm->GetRunTimes()->start(RunTimes::CreateSubstitutionMap);
simplified_solved_InputToSAT =
arrayTransformer->
- CreateSubstitutionMap(simplified_solved_InputToSAT);
+ CreateSubstitutionMap(simplified_solved_InputToSAT);
bm->GetRunTimes()->stop(RunTimes::CreateSubstitutionMap);
//printf("##################################################\n");
bm->ASTNodeStats("after pure substitution: ",
- simplified_solved_InputToSAT);
+ simplified_solved_InputToSAT);
simplified_solved_InputToSAT =
simp->SimplifyFormula_TopLevel(simplified_solved_InputToSAT,
- false);
+ false);
bm->ASTNodeStats("after simplification: ",
- simplified_solved_InputToSAT);
+ simplified_solved_InputToSAT);
}
if(bm->UserFlags.wordlevel_solve_flag)
bm->GetRunTimes()->start(RunTimes::CreateSubstitutionMap);
simplified_solved_InputToSAT =
arrayTransformer->
- CreateSubstitutionMap(simplified_solved_InputToSAT);
+ CreateSubstitutionMap(simplified_solved_InputToSAT);
bm->GetRunTimes()->stop(RunTimes::CreateSubstitutionMap);
bm->ASTNodeStats("after pure substitution: ",
- simplified_solved_InputToSAT);
+ simplified_solved_InputToSAT);
simplified_solved_InputToSAT =
simp->SimplifyFormula_TopLevel(simplified_solved_InputToSAT,
- false);
+ false);
bm->ASTNodeStats("after simplification: ",
- simplified_solved_InputToSAT);
+ simplified_solved_InputToSAT);
}
if(bm->UserFlags.wordlevel_solve_flag)
~STPMgr()
{
- ClearAllTables();
+ ClearAllTables();
vector<ASTVec*>::iterator it = _asserts.begin();
vector<ASTVec*>::iterator itend = _asserts.end();
delete letmgr;
delete runTimes;
-
+
_interior_unique_table.clear();
_bvconst_unique_table.clear();
_symbol_unique_table.clear();
nodestar persistNode(node n)
{
- persist.push_back(new node(n));
- return persist.back();
+ persist.push_back(new node(n));
+ return persist.back();
}
}
node output = b->CreateNode(BEEV::ARRAY,(*ti)[0],(*td)[0]);
- return persistNode(output);
+ return persistNode(output);
}
//! Create an expression for the value of array at the given index
// }
for (vector<nodestar>::iterator it = persist.begin(); it!= persist.end();it++)
- delete *it;
- persist.clear();
+ delete *it;
+ persist.clear();
delete decls;
delete (stpstar)vc;
lexCVC.cpp: CVC.lex parseCVC_defs.h ../AST/AST.h
$(LEX) -olexCVC.cpp -Pcvc CVC.lex
-#For rules with multiple targets. Make runs the rule once for each target.
-#These rules are "pattern rules" which only run once (rather than twice).
+#For rules with multiple targets. Make runs the rule once for each
+#target. These rules are "pattern rules" which only run once (rather
+#than twice).
+
parseCV%_defs.h parseCV%.cpp: CVC.y
$(YACC) -o cvc.tab.c -p cvc CVC.y
@cp cvc.tab.c parseCVC.cpp
@cp cvc.tab.h parseCVC_defs.h
lexSMT.cpp: parseSMT_defs.h smtlib.lex ../AST/AST.h
- $(LEX) -o lexSMT.cpp --prefix smt smtlib.lex
+ $(LEX) -olexSMT.cpp -Psmt smtlib.lex
parseSM%_defs.h parseSM%.cpp:smtlib.y
$(YACC) -o smt.tab.c -p smt smtlib.y
}
~LETMgr()
- {
- delete _letid_expr_map;
- }
+ {
+ delete _letid_expr_map;
+ }
ASTNode ResolveID(const ASTNode& var);
static string tolower(const char * name)
{
- string s(name);
- for (size_t i = 0; i < s.size(); ++i)
- s[i] = ::tolower(s[i]);
- return s;
+ string s(name);
+ for (size_t i = 0; i < s.size(); ++i)
+ s[i] = ::tolower(s[i]);
+ return s;
}
string functionToSMTLIBName(const BEEV::Kind k);
#define SAT_H_
#ifdef CRYPTOMINISAT
- #include "cryptominisat/Solver.h"
- #include "cryptominisat/SolverTypes.h"
+#include "cryptominisat/Solver.h"
+#include "cryptominisat/SolverTypes.h"
#endif
#ifdef CORE
- #include "core/Solver.h"
- #include "core/SolverTypes.h"
+#include "core/Solver.h"
+#include "core/SolverTypes.h"
#endif
#ifdef SIMP
- #include "simp/SimpSolver.h"
- #include "core/SolverTypes.h"
+#include "simp/SimpSolver.h"
+#include "core/SolverTypes.h"
#endif
#ifdef UNSOUND
- #include "unsound/UnsoundSimpSolver.h"
- #include "core/SolverTypes.h"
+#include "unsound/UnsoundSimpSolver.h"
+#include "core/SolverTypes.h"
#endif
#endif
//Sort the clauses, and bucketize by the size of the clauses
for(ClauseList::iterator it = cl->begin(), itend = cl->end();
- it!=itend; it++)
+ it!=itend; it++)
{
- ClausePtr cptr = *it;
- int cl_size = cptr->size();
- if(cl_size >= MAX_BUCKET_LIMIT)
- {
- cl_size = MAX_BUCKET_LIMIT;
- }
-
- //If no clauses of size cl_size have been seen, then create a
- //bucket for that size
- if(cb->find(cl_size) == cb->end())
- {
- ClauseList * cllist = new ClauseList();
- cllist->push_back(cptr);
- (*cb)[cl_size] = cllist;
- }
- else
- {
- ClauseList * cllist = (*cb)[cl_size];
- cllist->push_back(cptr);
- }
+ ClausePtr cptr = *it;
+ int cl_size = cptr->size();
+ if(cl_size >= MAX_BUCKET_LIMIT)
+ {
+ cl_size = MAX_BUCKET_LIMIT;
+ }
+
+ //If no clauses of size cl_size have been seen, then create a
+ //bucket for that size
+ if(cb->find(cl_size) == cb->end())
+ {
+ ClauseList * cllist = new ClauseList();
+ cllist->push_back(cptr);
+ (*cb)[cl_size] = cllist;
+ }
+ else
+ {
+ ClauseList * cllist = (*cb)[cl_size];
+ cllist->push_back(cptr);
+ }
}
return cb;
} //End of SortClauseList_IntoBuckets()
bool ToSAT::CallSAT_On_ClauseBuckets(MINISAT::Solver& SatSolver,
- ClauseBuckets * cb)
+ ClauseBuckets * cb)
{
ClauseBuckets::iterator it = cb->begin();
ClauseBuckets::iterator itend = cb->end();
bool sat = false;
for(;it!=itend;it++)
{
- ClauseList *cl = (*it).second;
- sat = toSATandSolve(SatSolver,*cl);
- if(!sat)
- {
- return sat;
- }
+ ClauseList *cl = (*it).second;
+ sat = toSATandSolve(SatSolver,*cl);
+ if(!sat)
+ {
+ return sat;
+ }
}
return sat;
}
if(!sat)
{
- return sat;
+ return sat;
}
#ifdef CRYPTOMINISAT
if(!xorcl->empty())
- {
- sat = toSATandSolve(SatSolver, *xorcl, true);
+ {
+ sat = toSATandSolve(SatSolver, *xorcl, true);
}
cm->DELETE(xorcl);
#endif
#ifdef CRYPTOMINISAT
if ((x->clausespos != NULL
- && x->clausespos->size() > 1)
- || (doRenamePos(*x) && !wasVisited(*x)))
+ && x->clausespos->size() > 1)
+ || (doRenamePos(*x) && !wasVisited(*x)))
{
if (doSibRenamingPos(*x)
- || sharesPos(*x) > 1
- || doRenamePos(*x))
+ || sharesPos(*x) > 1
+ || doRenamePos(*x))
{
doRenamingPos(varphi, defs);
}
if (x->clausespos != NULL && x->clausespos->size() > 1)
{
if (doSibRenamingPos(*x)
- || sharesPos(*x) > 1)
+ || sharesPos(*x) > 1)
{
doRenamingPos(varphi, defs);
}
{
convertFormulaToCNF(*it, defs); // make pos and neg clause set
- //Creating a new variable name for each of the children of the
- //XOR node
- //doRenamingPos(*it, defs);
- doRenamingNeg(*it, defs);
- xor_clause->insert(xor_clause->end(),
- ((*(info[*it]->clausespos))[0])->begin(),
- ((*(info[*it]->clausespos))[0])->end());
+ //Creating a new variable name for each of the children of the
+ //XOR node
+ //doRenamingPos(*it, defs);
+ doRenamingNeg(*it, defs);
+ xor_clause->insert(xor_clause->end(),
+ ((*(info[*it]->clausespos))[0])->begin(),
+ ((*(info[*it]->clausespos))[0])->end());
}
doRenamingPosXor(varphi);
//ClauseList* psi = convertFormulaToCNFPosXORAux(varphi, 0, defs);
// && sharesPos(*xx) > 0
// && sharesNeg(*xx) > 0)
// {
- // return;
+ // return;
// }
ASTVec::const_iterator it = varphi.GetChildren().begin();
{
convertFormulaToCNF(*it, defs); // make pos and neg clause set
- //Creating a new variable name for each of the children of the
- //XOR node doRenamingPos(*it, defs);
- doRenamingNeg(*it, defs);
- xor_clause->insert(xor_clause->end(),
- ((*(info[*it]->clausespos))[0])->begin(),
- ((*(info[*it]->clausespos))[0])->end());
+ //Creating a new variable name for each of the children of the
+ //XOR node doRenamingPos(*it, defs);
+ doRenamingNeg(*it, defs);
+ xor_clause->insert(xor_clause->end(),
+ ((*(info[*it]->clausespos))[0])->begin(),
+ ((*(info[*it]->clausespos))[0])->end());
}
doRenamingPosXor(varphi);
//ClauseList* psi = convertFormulaToCNFPosXORAux(varphi, 0, defs);
{
cerr << "Number of clauses:" << defs->size() << endl;
PrintClauseList(cout, *defs);
- cerr << "Number of xor-clauses:" << clausesxor->size() << endl;
- PrintClauseList(cout, *clausesxor);
+ cerr << "Number of xor-clauses:" << clausesxor->size() << endl;
+ PrintClauseList(cout, *clausesxor);
}
return defs;
namespace BEEV
{
-bool isTseitinVariable(const ASTNode& n) {
- if (n.GetKind() == SYMBOL && n.GetType() == BOOLEAN_TYPE) {
- const char * zz = n.GetName();
- //if the variables ARE cnf variables then dont make them
- // decision variables.
- if (0 == strncmp("cnf", zz, 3))
- {
- return true;
- }
- }
- return false;
-}
+ bool isTseitinVariable(const ASTNode& n) {
+ if (n.GetKind() == SYMBOL && n.GetType() == BOOLEAN_TYPE) {
+ const char * zz = n.GetName();
+ //if the variables ARE cnf variables then dont make them
+ // decision variables.
+ if (0 == strncmp("cnf", zz, 3))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
- /* FUNCTION: lookup or create a new MINISAT literal
- * lookup or create new MINISAT Vars from the global MAP
- * _ASTNode_to_SATVar.
- */
+ /* FUNCTION: lookup or create a new MINISAT literal
+ * lookup or create new MINISAT Vars from the global MAP
+ * _ASTNode_to_SATVar.
+ */
MINISAT::Var
ToSAT::LookupOrCreateSATVar(MINISAT::Solver& newS, const ASTNode& n)
// experimental. Don't add Tseitin variables as decision variables.
if (!bm->UserFlags.tseitin_are_decision_variables_flag && isTseitinVariable(n))
- {
- newS.setDecisionVar(v,false);
- }
+ {
+ newS.setDecisionVar(v,false);
+ }
- }
+ }
else
v = it->second;
return v;
* unsat. else continue.
*/
bool ToSAT::toSATandSolve(MINISAT::Solver& newS,
- ClauseList& cll, bool add_xor_clauses)
+ ClauseList& cll, bool add_xor_clauses)
{
CountersAndStats("SAT Solver", bm);
bm->GetRunTimes()->start(RunTimes::SendingToSAT);
// continue;
// }
#ifdef CRYPTOMINISAT
- if(add_xor_clauses)
- {
- //cout << "addXorClause:\n";
- newS.addXorClause(satSolverClause, false, 0, "z");
- }
- else
- {
- newS.addClause(satSolverClause,0,"z");
- }
+ if(add_xor_clauses)
+ {
+ //cout << "addXorClause:\n";
+ newS.addXorClause(satSolverClause, false, 0, "z");
+ }
+ else
+ {
+ newS.addClause(satSolverClause,0,"z");
+ }
#else
newS.addClause(satSolverClause);
#endif
float percentage=CLAUSAL_ABSTRACTION_CUTOFF;
if(count++ >= input_clauselist_size*percentage)
{
- //Arbitrary adding only 60% of the clauses in the hopes of
+ //Arbitrary adding only 60% of the clauses in the hopes of
//terminating early
// cout << "Percentage clauses added: "
// << percentage << endl;
bm->GetRunTimes()->stop(RunTimes::SendingToSAT);
bm->GetRunTimes()->start(RunTimes::Solving);
#ifdef CRYPTOMINISAT
- if (newS.simplify() == MINISAT::l_Undef)
+ if (newS.simplify() == MINISAT::l_Undef)
#endif
- newS.solve();
+ newS.solve();
bm->GetRunTimes()->stop(RunTimes::Solving);
if(!newS.okay())
{
namespace BEEV
{
- #define CLAUSAL_ABSTRACTION_CUTOFF 0.5
+#define CLAUSAL_ABSTRACTION_CUTOFF 0.5
class ToSAT {
private:
//Iteratively goes through the Clause Buckets, and calls
//toSATandSolve()
bool CallSAT_On_ClauseBuckets(MINISAT::Solver& SatSolver,
- ClauseBuckets * cb);
+ ClauseBuckets * cb);
// Converts the clause to SAT and calls SAT solver
bool toSATandSolve(MINISAT::Solver& S,
- ClauseList& cll, bool add_xor_clauses=false);
+ ClauseList& cll, bool add_xor_clauses=false);
//print the STP solver output
void PrintOutput(SOLVER_RETURN_TYPE ret);