return _node_num;
} //End of GetNodeNum()
+
+ virtual bool isSimplified() const
+ {
+ return false;
+ }
+
+ virtual void hasBeenSimplified() const
+ {
+ cerr << "astinternal has been";
+ }
+
+
void SetNodeNum(int nn)
{
_node_num = nn;
// The vector of children
ASTVec _children;
+ /// todo. This should be a bitfield in a superclass if it can fit without increasing the sizeof..
+ mutable bool is_simplified;
+
public:
virtual ASTVec const &GetChildren() const
return _children;
}
+ bool isSimplified() const
+ {
+ return is_simplified;
+ }
+
+ void hasBeenSimplified() const
+ {
+ is_simplified =true;
+ }
+
// Constructor (kind and children).
ASTInternalWithChildren(Kind kind, const ASTVec &children, int nodenum = 0) :
ASTInternal(kind,nodenum), _children(children)
{
+ is_simplified = false;
}
// Constructor (kind only, empty children, int nodenum)
ASTInternalWithChildren(Kind kind, int nodenum = 0) :
ASTInternal(kind,nodenum)
{
+ is_simplified = false;
}
}; //End of Class ASTInternalBase
}; //end of namespace
}
} //End of NFASTPrint()
+ bool
+ ASTNode::isSimplfied() const
+ {
+ return _int_node_ptr->isSimplified();
+ }
+
+ void
+ ASTNode::hasBeenSimplfied() const
+ {
+ _int_node_ptr->hasBeenSimplified();
+ }
+
+
//traverse "*this", and construct "let variables" for terms that
//occur more than once in "*this".
void ASTNode::LetizeNode(void) const
return (k == BVCONST || k == TRUE || k == FALSE);
}
+ bool isSimplfied() const;
+
+ void hasBeenSimplfied() const;
+
bool isITE() const
{
{
return false;
}
+
+ if (!pushNeg && key.isSimplfied())
+ {
+ output = key;
+ return true;
+ }
+
+
ASTNodeMap::iterator it, itend;
it = pushNeg ? SimplifyNegMap->find(key) : SimplifyMap->find(key);
itend = pushNeg ? SimplifyNegMap->end() : SimplifyMap->end();
// to cache.
if (0 == key.Degree())
return;
-
+
if (pushNeg)
(*SimplifyNegMap)[key] = value;
else
(*SimplifyMap)[key] = value;
+
+ if (!pushNeg && key == value)
+ {
+ key.hasBeenSimplfied();
+ }
}
// Substitution Map methods....
if (n.isConstant())
return true;
+ if (n.isSimplfied())
+ return true;
+
//If it's a symbol that's not in the substitition Map.
if (n.GetKind() == SYMBOL && CheckSubstitutionMap(n))
return false;