"array_" + string(arrName.GetName()));
Arrayread_SymbolMap[processedTerm] = CurrentSymbol;
- Introduced_SymbolsSet.insert(CurrentSymbol);
}
ASTNode ite = CurrentSymbol;
// Read(A,j) is replaced with the following ITE: ITE(i=j,v1,v2)
ASTNodeMap * Arrayread_IteMap;
- // Set of new symbols introduced that replace the array read terms
- ASTNodeSet Introduced_SymbolsSet;
-
+
// Count to keep track of new symbolic constants introduced
// corresponding to Array Reads
unsigned int _symbol_count;
// Constructor
ArrayTransformer(STPMgr * bm, Simplifier* s) :
Arrayread_SymbolMap(),
- Introduced_SymbolsSet(),
bm(bm),
simp(s),
debug_transform(0),
{
Arrayread_IteMap->clear();
delete Arrayread_IteMap;
- Introduced_SymbolsSet.clear();
ASTNodeToVecMap::iterator it= Arrayname_ReadindicesMap->begin();
ASTNodeToVecMap::iterator itend= Arrayname_ReadindicesMap->end();
for(;it!=itend;it++)
return (*Arrayread_IteMap)[arrread];
} //End of ArrayRead_Ite
- bool FoundIntroducedSymbolSet(const ASTNode& in)
- {
- if(Introduced_SymbolsSet.find(in) != Introduced_SymbolsSet.end())
- {
- return true;
- }
- return false;
- } // End of IntroduceSymbolSet
void ClearAllTables(void)
{
Arrayname_ReadindicesMap->clear();
Arrayread_SymbolMap.clear();
Arrayread_IteMap->clear();
- Introduced_SymbolsSet.clear();
}
}; //end of class Transformer
return newn;
}
- //Create a new variable of ValueWidth 'n'
- ASTNode STPMgr::NewVar(unsigned int n)
- {
- std::string c("v");
- char d[32];
- sprintf(d, "%d", _symbol_count++);
- std::string ccc(d);
- c += "_solver_" + ccc;
-
- ASTNode CurrentSymbol = CreateSymbol(c.c_str(),0,n);
- assert(0 !=n);
- return CurrentSymbol;
- } //end of NewVar()
-
bool STPMgr::VarSeenInTerm(const ASTNode& var, const ASTNode& term)
{
if (READ == term.GetKind()
ASTVec ones;
ASTVec max;
+ // Set of new symbols introduced that replace the array read terms
+ ASTNodeSet Introduced_SymbolsSet;
+
public:
/****************************************************************
// Print assertions to the input stream
void printAssertsToStream(ostream &os, int simplify);
- // Create New Variables
- ASTNode NewVar(unsigned int n);
-
+ // Variables are added automatically to the introduced_symbolset. Variables
+ // in the set aren't printed out as part of the counter example.
ASTNode CreateFreshVariable(int indexWidth, int valueWidth, std::string prefix)
{
char d[32 + prefix.length()];
sprintf(d, "%s_%d", prefix.c_str(), _symbol_count++);
BEEV::ASTNode CurrentSymbol = CreateSymbol(d,indexWidth,valueWidth);
+ Introduced_SymbolsSet.insert(CurrentSymbol);
return CurrentSymbol;
}
+ bool FoundIntroducedSymbolSet(const ASTNode& in)
+ {
+ if(Introduced_SymbolsSet.find(in) != Introduced_SymbolsSet.end())
+ {
+ return true;
+ }
+ return false;
+ } // End of IntroduceSymbolSet
+
+
bool VarSeenInTerm(const ASTNode& var, const ASTNode& term);
TermsAlreadySeenMap.clear();
}
+ // This is called before SAT solving, so only junk that isn't needed
+ // after SAT solving should be cleaned out.
void ClearAllTables(void)
{
NodeLetVarMap.clear();
}
//skip over introduced variables
- if (f.GetKind() == SYMBOL && (ArrayTransform->FoundIntroducedSymbolSet(
+ if (f.GetKind() == SYMBOL && (bm->FoundIntroducedSymbolSet(
f)))
{
continue;
//then also add another entry for x = x1@t
ASTNode var = lhs[0];
ASTNode newvar =
- _bm->NewVar(var.GetValueWidth() - lhs.GetValueWidth());
+ _bm->CreateFreshVariable(0, var.GetValueWidth() - lhs.GetValueWidth(), "v_solver");
newvar =
_bm->CreateTerm(BVCONCAT, var.GetValueWidth(), newvar, rhs);
assert(BVTypeCheck(newvar));
if (ChosenVar_Is_Extract)
{
const ASTNode& var = lhs[1][0];
+
ASTNode newvar =
- _bm->NewVar(var.GetValueWidth() - lhs[1].GetValueWidth());
+ _bm->CreateFreshVariable(0, var.GetValueWidth() - lhs[1].GetValueWidth(), "v_solver");
newvar =
_bm->CreateTerm(BVCONCAT,
var.GetValueWidth(),
ASTNode newVar;
if (!CheckSimplifyMap(input, newVar, false))
{
- newVar = _bm->NewVar(input.GetValueWidth());
+ newVar = _bm->CreateFreshVariable(0,input.GetValueWidth(),"v_solver");
(*ReadOverWrite_NewName_Map)[input] = newVar;
NewName_ReadOverWrite_Map[newVar] = input;