Skip to content

Commit

Permalink
Convert display_index_set to a free function
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasz A.J. Wrona committed Sep 13, 2017
1 parent 9fff116 commit 2b2a841
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
23 changes: 14 additions & 9 deletions src/solvers/refinement/string_refinement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,29 +96,34 @@ string_refinementt::string_refinementt(const infot &info):
string_refinementt(info, validate(info)) { }

/// display the current index set, for debugging
void string_refinementt::display_index_set()
static void display_index_set(
const messaget& message,
const namespacet& ns,
const std::map<exprt, std::set<exprt>>& current_index_set,
const std::map<exprt, std::set<exprt>>& index_set)
{
std::size_t count=0;
std::size_t count_current=0;
for(const auto &i : index_set)
{
const exprt &s=i.first;
debug() << "IS(" << from_expr(ns, "", s) << ")=={" << eom;
message.debug() << "IS(" << from_expr(ns, "", s) << ")=={" << message.eom;

for(auto j : i.second)
{
if(current_index_set[i.first].find(j)!=current_index_set[i.first].end())
const auto it=current_index_set.find(i.first);
if(it!=current_index_set.end() && it->second.find(j)!=it->second.end())
{
count_current++;
debug() << "**";
message.debug() << "**";
}
debug() << " " << from_expr(ns, "", j) << ";" << eom;
message.debug() << " " << from_expr(ns, "", j) << ";" << message.eom;
count++;
}
debug() << "}" << eom;
message.debug() << "}" << message.eom;
}
debug() << count << " elements in index set (" << count_current
<< " newly added)" << eom;
message.debug() << count << " elements in index set (" << count_current
<< " newly added)" << message.eom;
}

/// compute the index set for all formulas, instantiate the formulas with the
Expand Down Expand Up @@ -592,7 +597,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
}
}

display_index_set();
display_index_set(*this, ns, current_index_set, index_set);
debug()<< "instantiating NOT_CONTAINS constraints" << eom;
for(unsigned i=0; i<not_contains_axioms.size(); i++)
{
Expand Down
2 changes: 0 additions & 2 deletions src/solvers/refinement/string_refinement.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ class string_refinementt final: public bv_refinementt

void add_equivalence(const irep_idt & lhs, const exprt & rhs);

void display_index_set();

void add_lemma(const exprt &lemma,
bool simplify=true,
bool add_to_index_set=true);
Expand Down

0 comments on commit 2b2a841

Please sign in to comment.