debug_transform(0),
TransformMap(NULL)
{
- nf = new SimplifyingNodeFactory(*(bm->hashingNodeFactory), *bm);
+ nf = bm->defaultNodeFactory;
runTimes = bm->GetRunTimes();
ASTTrue = bm->CreateNode(TRUE);
ASTUndefined = bm->CreateNode(UNDEFINED);
}
- ~ArrayTransformer()
- {
- delete nf;
- }
-
// Takes a formula, transforms it by replacing array reads with
// variables, and returns the transformed formula
ASTNode TransformFormula_TopLevel(const ASTNode& form);
BEEV::ASTNode CreateNode(const BEEV::Kind kind, const BEEV::ASTVec & back_children);
BEEV::ASTNode CreateTerm(BEEV::Kind kind, unsigned int width,const BEEV::ASTVec &children);
+ virtual std::string getName() {return "hashing";}
};
#endif /* HASHINGNODEFACTORY_H_ */
ASTNode CreateConstant(BEEV::CBV cbv, unsigned width);
+ virtual std::string getName()=0;
};
#endif
virtual BEEV::ASTNode CreateNode(BEEV::Kind kind, const BEEV::ASTVec & children);
virtual BEEV::ASTNode CreateTerm(BEEV::Kind kind, unsigned int width, const BEEV::ASTVec &children);
+ virtual std::string getName() {return "simplifying";}
SimplifyingNodeFactory(NodeFactory& raw_, BEEV::STPMgr& bm_)
:hashing(raw_), NodeFactory(bm_), ASTTrue(bm_.ASTTrue), ASTFalse(bm_.ASTFalse), ASTUndefined(bm_.ASTUndefined)
BEEV::ASTNode CreateNode(BEEV::Kind kind, const BEEV::ASTVec& children);
BEEV::ASTNode CreateArrayTerm(Kind kind, unsigned int index,unsigned int width, const BEEV::ASTVec &children);
+ virtual string getName() {return "type checking";}
};
#endif /* TYPECHECKER_H_ */
if (bm->UserFlags.isSet("bitblast-simplification", "1") && initial_difficulty_score < 250000)
{
BBNodeManagerAIG bbnm;
- SimplifyingNodeFactory nf(*(bm->hashingNodeFactory), *bm);
- BitBlaster<BBNodeAIG, BBNodeManagerAIG> bb(&bbnm, simp, &nf , &(bm->UserFlags));
+ BitBlaster<BBNodeAIG, BBNodeManagerAIG> bb(&bbnm, simp, bm->defaultNodeFactory , &(bm->UserFlags));
ASTNodeMap fromTo;
ASTNodeMap equivs;
bb.getConsts(simplified_solved_InputToSAT, fromTo,equivs);
* difficult looking ASTNodes.
*/
ASTNodeMap cache;
- simplified_solved_InputToSAT = SubstitutionMap::replace(simplified_solved_InputToSAT, equivs, cache,&nf,false,true);
+ simplified_solved_InputToSAT = SubstitutionMap::replace(simplified_solved_InputToSAT, equivs, cache,bm->defaultNodeFactory,false,true);
bm->ASTNodeStats(bb_message.c_str(), simplified_solved_InputToSAT);
}
if (fromTo.size() > 0)
{
ASTNodeMap cache;
- simplified_solved_InputToSAT = SubstitutionMap:: replace(simplified_solved_InputToSAT, fromTo, cache,&nf);
+ simplified_solved_InputToSAT = SubstitutionMap:: replace(simplified_solved_InputToSAT, fromTo, cache,bm->defaultNodeFactory);
bm->ASTNodeStats(bb_message.c_str(), simplified_solved_InputToSAT);
}
actualBBSize = bbnm.totalNumberOfNodes();
ASTNode
STP::sizeReducing(ASTNode simplified_solved_InputToSAT, BVSolver* bvSolver, PropagateEqualities *pe)
{
+
simplified_solved_InputToSAT = pe->topLevel(simplified_solved_InputToSAT, arrayTransformer);
if (simp->hasUnappliedSubstitutions())
{
if (bm->UserFlags.bitConstantProp_flag)
{
bm->GetRunTimes()->start(RunTimes::ConstantBitPropagation);
- SimplifyingNodeFactory nf(*(bm->hashingNodeFactory), *bm);
- simplifier::constantBitP::ConstantBitPropagation cb(simp, &nf, simplified_solved_InputToSAT);
+ simplifier::constantBitP::ConstantBitPropagation cb(simp, bm->defaultNodeFactory, simplified_solved_InputToSAT);
simplified_solved_InputToSAT = cb.topLevelBothWays(simplified_solved_InputToSAT, true,false);
bm->GetRunTimes()->stop(RunTimes::ConstantBitPropagation);
if (simp->hasUnappliedSubstitutions())
{
- simplified_solved_InputToSAT = simp->applySubstitutionMap(simplified_solved_InputToSAT);
- simp->haveAppliedSubstitutionMap();
+ simplified_solved_InputToSAT = simp->applySubstitutionMap(simplified_solved_InputToSAT);
+ simp->haveAppliedSubstitutionMap();
}
bm->ASTNodeStats(cb_message.c_str(), simplified_solved_InputToSAT);
if (bm->UserFlags.isSet("always-true", "0"))
{
- SimplifyingNodeFactory nf(*(bm->hashingNodeFactory), *bm);
- AlwaysTrue always (simp,bm,&nf);
+ AlwaysTrue always (simp,bm,bm->defaultNodeFactory);
simplified_solved_InputToSAT = always.topLevel(simplified_solved_InputToSAT);
bm->ASTNodeStats("After removing always true: ", simplified_solved_InputToSAT);
}
if (bm->UserFlags.bitConstantProp_flag)
{
bm->GetRunTimes()->start(RunTimes::ConstantBitPropagation);
- SimplifyingNodeFactory nf(*(bm->hashingNodeFactory), *bm);
- simplifier::constantBitP::ConstantBitPropagation cb(simp, &nf, simplified_solved_InputToSAT);
+ simplifier::constantBitP::ConstantBitPropagation cb(simp, bm->defaultNodeFactory, simplified_solved_InputToSAT);
simplified_solved_InputToSAT = cb.topLevelBothWays(simplified_solved_InputToSAT);
bm->GetRunTimes()->stop(RunTimes::ConstantBitPropagation);
if (!worse && (bitblasted_difficulty != -1))
{
BBNodeManagerAIG bbnm;
- SimplifyingNodeFactory nf(*(bm->hashingNodeFactory), *bm);
- BitBlaster<BBNodeAIG, BBNodeManagerAIG> bb(&bbnm, simp, &nf , &(bm->UserFlags));
+ BitBlaster<BBNodeAIG, BBNodeManagerAIG> bb(&bbnm, simp, bm->defaultNodeFactory , &(bm->UserFlags));
bb.BBForm(simplified_solved_InputToSAT);
int newBB= bbnm.totalNumberOfNodes();
if (bm->UserFlags.stats_flag)
* step 5. Call SAT to determine if input is SAT or UNSAT
********************************************************************/
-typedef enum {PRINT_BACK_C=1, PRINT_BACK_CVC, PRINT_BACK_SMTLIB2,PRINT_BACK_SMTLIB1, PRINT_BACK_GDL, PRINT_BACK_DOT, OUTPUT_BENCH, OUTPUT_CNF, USE_SIMPLIFYING_SOLVER, SMT_LIB2_FORMAT, SMT_LIB1_FORMAT, DISABLE_CBITP,EXIT_AFTER_CNF,USE_CRYPTOMINISAT_SOLVER,USE_MINISAT_SOLVER, DISABLE_SIMPLIFICATIONS, OLDSTYLE_REFINEMENT, DISABLE_EQUALITY, RANDOM_SEED} OptionType;
+typedef enum {PRINT_BACK_C=1, PRINT_BACK_CVC, PRINT_BACK_SMTLIB2,PRINT_BACK_SMTLIB1, PRINT_BACK_GDL, PRINT_BACK_DOT, OUTPUT_BENCH, OUTPUT_CNF, USE_SIMPLIFYING_SOLVER, SMT_LIB2_FORMAT, SMT_LIB1_FORMAT, DISABLE_CBITP,EXIT_AFTER_CNF,USE_CRYPTOMINISAT_SOLVER,USE_MINISAT_SOLVER, DISABLE_SIMPLIFICATIONS, OLDSTYLE_REFINEMENT, DISABLE_EQUALITY, RANDOM_SEED,HASHING_NF} OptionType;
int main(int argc, char ** argv) {
STPMgr * bm = new STPMgr();
+ auto_ptr<SimplifyingNodeFactory> simplifyingNF( new SimplifyingNodeFactory(*bm->hashingNodeFactory, *bm));
+ bm->defaultNodeFactory = simplifyingNF.get();
+
+ // The simplified keeps a pointer to whatever is set as the default node factory.
Simplifier * simp = new Simplifier(bm);
auto_ptr<Simplifier> simpCleaner(simp);
Ctr_Example);
- auto_ptr<SimplifyingNodeFactory> simplifyingNF( new SimplifyingNodeFactory(*bm->hashingNodeFactory, *bm));
- bm->defaultNodeFactory = simplifyingNF.get();
-
-
//populate the help string
helpstring +=
"STP version : " + version + "\n"
lookup.insert(make_pair(tolower("--oldstyle-refinement"),OLDSTYLE_REFINEMENT));
lookup.insert(make_pair(tolower("--disable-equality"),DISABLE_EQUALITY));
lookup.insert(make_pair(tolower("--random-seed"),RANDOM_SEED));
+ lookup.insert(make_pair(tolower("--hash-nf"),HASHING_NF));
if (!strncmp(argv[i],"--config_",strlen("--config_")))
bm->UserFlags.random_seed = rand();
}
break;
+ case HASHING_NF:
+ bm->defaultNodeFactory = bm->hashingNodeFactory;
+ break;
default:
fprintf(stderr,usage,prog);
bm->GetRunTimes()->start(RunTimes::Parsing);
{
- TypeChecker nfTypeCheckSimp(*simplifyingNF.get(), *bm);
- TypeChecker nfTypeCheckDefault(*bm->defaultNodeFactory, *bm);
+ TypeChecker nfTypeCheckSimp(*bm->defaultNodeFactory, *bm);
+ TypeChecker nfTypeCheckDefault(*bm->hashingNodeFactory, *bm);
Cpp_interface piTypeCheckSimp(*bm, &nfTypeCheckSimp);
Cpp_interface piTypeCheckDefault(*bm, &nfTypeCheckDefault);
AIGSimplifyPropositionalCore(STPMgr *_bm)
{
bm = _bm;
- nf = new SimplifyingNodeFactory(*bm->hashingNodeFactory,*bm);
+ nf = _bm->defaultNodeFactory;
}
- virtual ~AIGSimplifyPropositionalCore()
- {
- delete nf;
- }
+
private:
// Convert theory nodes to fresh variables.
if (fromTo.size() > 0)
{
ASTNodeMap cache;
- SimplifyingNodeFactory nf(*(top.GetSTPMgr()->hashingNodeFactory), *top.GetSTPMgr());
+
bm.GetRunTimes()->stop(RunTimes::IntervalPropagation);
- return SubstitutionMap::replace(result,fromTo,cache,&nf);
+ return SubstitutionMap::replace(result,fromTo,cache,top.GetSTPMgr()->defaultNodeFactory);
}
bm.GetRunTimes()->stop(RunTimes::IntervalPropagation);
littleZero = makeCBV(1);
littleOne = makeCBV(1);
CONSTANTBV::BitVector_Fill(littleOne);
- nf = new SimplifyingNodeFactory(*(bm.hashingNodeFactory), bm);
+ nf = bm.defaultNodeFactory;
}
~EstablishIntervals()
likeAutoPtr.clear();
toDeleteLater.clear();
- delete nf;
}
};
}
RemoveUnconstrained::RemoveUnconstrained(STPMgr& _bm) :
bm(_bm)
{
- nf = new SimplifyingNodeFactory(*(_bm.hashingNodeFactory),_bm);
+ nf = _bm.defaultNodeFactory;
}
- RemoveUnconstrained::~RemoveUnconstrained()
- {
- delete nf;
- }
-
const bool debug_unconstrained = false;
ASTNode
public:
-
RemoveUnconstrained(STPMgr& bm);
- virtual
- ~RemoveUnconstrained();
ASTNode
topLevel(const ASTNode &n, Simplifier *s);
SubstitutionMap::~SubstitutionMap()
{
delete SolverMap;
- delete nf;
}
// if false. Don't simplify while creating the substitution map.
SolverMap = new ASTNodeMap(INITIAL_TABLE_SIZE);
loopCount = 0;
substitutionsLastApplied = 0;
- nf = new SimplifyingNodeFactory(*bm->hashingNodeFactory, *bm);
+ nf = bm->defaultNodeFactory;
}
void
UseITEContext(STPMgr *bm)
{
runtimes = bm->GetRunTimes();
- nf = new SimplifyingNodeFactory(*(bm->hashingNodeFactory) ,*bm);
+ nf = bm->defaultNodeFactory;
ASTTrue = bm->ASTTrue;
ASTFalse = bm->ASTFalse;
}
- ~UseITEContext()
- {
- delete nf;
- }
+
};
}
;
ASTFalse = _bm->CreateNode(FALSE);
ASTUndefined = _bm->CreateNode(UNDEFINED);
simplify=true;
- nf = new SimplifyingNodeFactory(*bm->hashingNodeFactory,*bm);
+ nf = bm->defaultNodeFactory;
};
//Destructor
~BVSolver()
{
ClearAllTables();
- delete nf;
}
//Top Level Solver: Goes over the input DAG, identifies the
ASTFalse = bm->CreateNode(FALSE);
ASTUndefined = bm->CreateNode(UNDEFINED);
- nf = new SimplifyingNodeFactory(*bm->hashingNodeFactory,*bm);
+ nf = bm->defaultNodeFactory;
}
~Simplifier()
delete SimplifyMap;
delete SimplifyNegMap;
//delete ReadOverWrite_NewName_Map;
- delete nf;
}
/****************************************************************