@@ -26,6 +26,7 @@ Author: Alberto Griggio, alberto.griggio@gmail.com
2626#include < unordered_set>
2727#include < util/expr_iterator.h>
2828#include < util/expr_util.h>
29+ #include < util/format_expr.h>
2930#include < util/magic.h>
3031#include < util/range.h>
3132#include < util/simplify_expr.h>
@@ -92,12 +93,14 @@ exprt simplify_sum(const exprt &f);
9293static void update_index_set (
9394 index_set_pairt &index_set,
9495 const namespacet &ns,
95- const std::vector<exprt> ¤t_constraints);
96+ const std::vector<exprt> ¤t_constraints,
97+ messaget &log);
9698
9799static void update_index_set (
98100 index_set_pairt &index_set,
99101 const namespacet &ns,
100- const exprt &formula);
102+ const exprt &formula,
103+ messaget &log);
101104
102105static std::vector<exprt> instantiate (
103106 const string_not_contains_constraintt &axiom,
@@ -808,7 +811,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
808811 }
809812
810813 initial_index_set (index_sets, ns, axioms);
811- update_index_set (index_sets, ns, current_constraints);
814+ update_index_set (index_sets, ns, current_constraints, log );
812815 current_constraints.clear ();
813816 const auto initial_instances =
814817 generate_instantiations (index_sets, axioms, not_contain_witnesses);
@@ -850,7 +853,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
850853 // and instantiating universal formulas with this indices.
851854 // We will then relaunch the solver with these added lemmas.
852855 index_sets.current .clear ();
853- update_index_set (index_sets, ns, current_constraints);
856+ update_index_set (index_sets, ns, current_constraints, log );
854857
855858 display_index_set (log.debug (), index_sets);
856859
@@ -1526,10 +1529,11 @@ static void initial_index_set(
15261529static void update_index_set (
15271530 index_set_pairt &index_set,
15281531 const namespacet &ns,
1529- const std::vector<exprt> ¤t_constraints)
1532+ const std::vector<exprt> ¤t_constraints,
1533+ messaget &log)
15301534{
15311535 for (const auto &axiom : current_constraints)
1532- update_index_set (index_set, ns, axiom);
1536+ update_index_set (index_set, ns, axiom, log );
15331537}
15341538
15351539// / An expression representing an array of characters can be in the form of an
@@ -1685,7 +1689,8 @@ static void initial_index_set(
16851689static void update_index_set (
16861690 index_set_pairt &index_set,
16871691 const namespacet &ns,
1688- const exprt &formula)
1692+ const exprt &formula,
1693+ messaget &log)
16891694{
16901695 std::list<exprt> to_process;
16911696 to_process.push_back (formula);
@@ -1694,6 +1699,7 @@ static void update_index_set(
16941699 {
16951700 exprt cur = to_process.back ();
16961701 to_process.pop_back ();
1702+ log.debug () << format (cur) << messaget::eom;
16971703 if (cur.id () == ID_index && is_char_type (cur.type ()))
16981704 {
16991705 const exprt &s = to_index_expr (cur).array ();
@@ -1702,6 +1708,7 @@ static void update_index_set(
17021708 s.type ().id () == ID_array,
17031709 string_refinement_invariantt (" index expressions must index on arrays" ));
17041710 exprt simplified = simplify_sum (i);
1711+ log.debug () << " simplified: " << format (simplified) << messaget::eom;
17051712 if (s.id () != ID_array) // do not update index set of constant arrays
17061713 add_to_index_set (index_set, ns, s, simplified);
17071714 }
0 commit comments