26
26
#include < unordered_set>
27
27
#include < util/expr_iterator.h>
28
28
#include < util/expr_util.h>
29
+ #include < util/format_expr.h>
29
30
#include < util/magic.h>
30
31
#include < util/range.h>
31
32
#include < util/simplify_expr.h>
@@ -92,12 +93,14 @@ exprt simplify_sum(const exprt &f);
92
93
static void update_index_set (
93
94
index_set_pairt &index_set,
94
95
const namespacet &ns,
95
- const std::vector<exprt> ¤t_constraints);
96
+ const std::vector<exprt> ¤t_constraints,
97
+ messaget &log);
96
98
97
99
static void update_index_set (
98
100
index_set_pairt &index_set,
99
101
const namespacet &ns,
100
- const exprt &formula);
102
+ const exprt &formula,
103
+ messaget &log);
101
104
102
105
static std::vector<exprt> instantiate (
103
106
const string_not_contains_constraintt &axiom,
@@ -808,7 +811,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
808
811
}
809
812
810
813
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 );
812
815
current_constraints.clear ();
813
816
const auto initial_instances =
814
817
generate_instantiations (index_sets, axioms, not_contain_witnesses);
@@ -850,7 +853,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
850
853
// and instantiating universal formulas with this indices.
851
854
// We will then relaunch the solver with these added lemmas.
852
855
index_sets.current .clear ();
853
- update_index_set (index_sets, ns, current_constraints);
856
+ update_index_set (index_sets, ns, current_constraints, log );
854
857
855
858
display_index_set (log .debug (), index_sets);
856
859
@@ -1526,10 +1529,11 @@ static void initial_index_set(
1526
1529
static void update_index_set (
1527
1530
index_set_pairt &index_set,
1528
1531
const namespacet &ns,
1529
- const std::vector<exprt> ¤t_constraints)
1532
+ const std::vector<exprt> ¤t_constraints,
1533
+ messaget &log)
1530
1534
{
1531
1535
for (const auto &axiom : current_constraints)
1532
- update_index_set (index_set, ns, axiom);
1536
+ update_index_set (index_set, ns, axiom, log );
1533
1537
}
1534
1538
1535
1539
// / An expression representing an array of characters can be in the form of an
@@ -1685,7 +1689,8 @@ static void initial_index_set(
1685
1689
static void update_index_set (
1686
1690
index_set_pairt &index_set,
1687
1691
const namespacet &ns,
1688
- const exprt &formula)
1692
+ const exprt &formula,
1693
+ messaget &log)
1689
1694
{
1690
1695
std::list<exprt> to_process;
1691
1696
to_process.push_back (formula);
@@ -1694,6 +1699,7 @@ static void update_index_set(
1694
1699
{
1695
1700
exprt cur = to_process.back ();
1696
1701
to_process.pop_back ();
1702
+ log .debug () << format (cur) << messaget::eom;
1697
1703
if (cur.id () == ID_index && is_char_type (cur.type ()))
1698
1704
{
1699
1705
const exprt &s = to_index_expr (cur).array ();
@@ -1702,6 +1708,7 @@ static void update_index_set(
1702
1708
s.type ().id () == ID_array,
1703
1709
string_refinement_invariantt (" index expressions must index on arrays" ));
1704
1710
exprt simplified = simplify_sum (i);
1711
+ log .debug () << " simplified: " << format (simplified) << messaget::eom;
1705
1712
if (s.id () != ID_array) // do not update index set of constant arrays
1706
1713
add_to_index_set (index_set, ns, s, simplified);
1707
1714
}
0 commit comments