// We assume there are no duplicate constant indexes in the list of readindexes,
// so "i" and "j" will never be equal.
if (BVCONST == index_i.GetKind() && index_j.GetKind() == BVCONST)
+ {
+ assert(index_i != index_j);
continue;
+ }
//prepare for SAT LOOP
//first construct the antecedent for the LA axiom
+++ /dev/null
-#ifndef COUNTOFSYMBOLS_H_
-#define COUNTOFSYMBOLS_H_
-
-#include "../AST/AST.h"
-#include <cassert>
-#include "Symbols.h"
-
-// Count the number of times each symbol appears in the input term.
-// This can be expensive to build for large terms, so it's built lazily.
-
-namespace BEEV
-{
-class CountOfSymbols {
-
- typedef hash_map<ASTNode, int, ASTNode::ASTNodeHasher,
- ASTNode::ASTNodeEqual> ASTNodeToIntMap;
-
- ASTNodeToIntMap Vars;
- const Symbols* top;
- bool loaded;
-
- // If no variables are found in "term", then it's cached---we don't need to visit there
- // again. However, if it's true, we need to revisit (and hence recount), the next time it's
- // encountered.
-
- void VarsInTheTerm(const Symbols* term) {
- assert(!term->empty());
-
- if (!term->found.IsNull())
- {
- Vars[term->found]++;
- }
- else
- {
- const vector<Symbols*>& c = term->children;
- for (vector<Symbols*>::const_iterator it = c.begin(), itend = c.end(); it
- != itend; it++)
- {
- VarsInTheTerm(*it);
- }
- }
- } //end of VarsInTheTerm()
-
-public:
-
- CountOfSymbols(const Symbols* top_v) :
- top(top_v) {
- loaded = false;
- }
-
- bool single(const ASTNode &m) {
- if (!loaded)
- {
- VarsInTheTerm(top);
- loaded = true;
- }
-
- ASTNodeToIntMap::const_iterator it = Vars.find(m);
- if (it == Vars.end())
- return false;
- else
- return (it->second == 1);
- }
-};
-}
-#endif /* COUNTOFSYMBOLS_H_ */
#include "../AST/AST.h"
#include "../STPManager/STPManager.h"
#include "bvsolver.h"
-#include "CountOfSymbols.h"
//This file contains the implementation of member functions of
//bvsolver class, which represents the bitvector arithmetic linear
//collect all the vars in the lhs and rhs
BuildSymbolGraph(eq);
- CountOfSymbols count(symbol_graph[eq]);
//handle BVPLUS case
ASTVec c = FlattenKind(BVPLUS, lhs.GetChildren());
&& !chosen_symbol
&& !DoNotSolveThis(var)
&& ((SYMBOL == var.GetKind()
- && count.single(var)
+ && !VarSeenInTerm(var,rhs)
)
|| (BVEXTRACT == var.GetKind()
&& SYMBOL == var[0].GetKind()
&& BVCONST == var[1].GetKind()
&& zero == var[2]
&& !DoNotSolveThis(var[0])
- && count.single(var[0])
+ && !VarSeenInTerm(var[0],rhs)
))
)
{
&& BVCONST == monom[1].GetKind()
&& zero == monom[2]
&& !DoNotSolveThis(monom[0])
- && count.single(monom[0])
+ && !VarSeenInTerm(monom[0],rhs)
)
{
outmonom = monom;
&& BVCONST == monom[0][1].GetKind()
&& zero == monom[0][2]
&& !DoNotSolveThis(monom[0][0])
- && count.single(monom[0][0])
+ && !VarSeenInTerm(monom[0][0],rhs)
)
{
outmonom = monom;