@@ -71,6 +71,18 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
71
71
ui_message_handlert::uit ui,
72
72
const replace_mapt& symbol_resolve);
73
73
74
+ static void initial_index_set (
75
+ std::map<exprt, std::set<exprt>> &index_set,
76
+ std::map<exprt, std::set<exprt>> ¤t_index_set,
77
+ const namespacet &ns,
78
+ const string_constraintt &axiom);
79
+
80
+ static void initial_index_set (
81
+ std::map<exprt, std::set<exprt>> &index_set,
82
+ std::map<exprt, std::set<exprt>> ¤t_index_set,
83
+ const namespacet &ns,
84
+ const std::vector<string_constraintt> &string_axioms);
85
+
74
86
exprt simplify_sum (const exprt &f);
75
87
76
88
// / Convert exprt to a specific type. Throw bad_cast if conversion
@@ -669,7 +681,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
669
681
}
670
682
}
671
683
672
- initial_index_set (universal_axioms);
684
+ initial_index_set (index_set, current_index_set, ns, universal_axioms);
673
685
update_index_set (cur);
674
686
cur.clear ();
675
687
for (const auto & lemma :
@@ -1602,11 +1614,14 @@ static bool find_qvar(const exprt index, const symbol_exprt &qvar)
1602
1614
// / add to the index set all the indices that appear in the formulas and the
1603
1615
// / upper bound minus one
1604
1616
// / \par parameters: a list of string constraints
1605
- void string_refinementt::initial_index_set (
1617
+ static void initial_index_set (
1618
+ std::map<exprt, std::set<exprt>> &index_set,
1619
+ std::map<exprt, std::set<exprt>> ¤t_index_set,
1620
+ const namespacet &ns,
1606
1621
const std::vector<string_constraintt> &string_axioms)
1607
1622
{
1608
1623
for (const auto &axiom : string_axioms)
1609
- initial_index_set (axiom);
1624
+ initial_index_set (index_set, current_index_set, ns, axiom);
1610
1625
}
1611
1626
1612
1627
// / add to the index set all the indices that appear in the formulas
@@ -1644,7 +1659,11 @@ static std::vector<exprt> sub_arrays(const exprt &array_expr)
1644
1659
// / add to the index set all the indices that appear in the formula and the
1645
1660
// / upper bound minus one
1646
1661
// / \par parameters: a string constraint
1647
- void string_refinementt::add_to_index_set (const exprt &s, exprt i)
1662
+ static void add_to_index_set (
1663
+ std::map<exprt, std::set<exprt>> &index_set,
1664
+ std::map<exprt, std::set<exprt>> ¤t_index_set,
1665
+ const namespacet &ns,
1666
+ const exprt &s, exprt i)
1648
1667
{
1649
1668
simplify (i, ns);
1650
1669
if (i.id ()!=ID_constant || expr_cast<size_t >(i))
@@ -1655,7 +1674,11 @@ void string_refinementt::add_to_index_set(const exprt &s, exprt i)
1655
1674
}
1656
1675
}
1657
1676
1658
- void string_refinementt::initial_index_set (const string_constraintt &axiom)
1677
+ static void initial_index_set (
1678
+ std::map<exprt, std::set<exprt>> &index_set,
1679
+ std::map<exprt, std::set<exprt>> ¤t_index_set,
1680
+ const namespacet &ns,
1681
+ const string_constraintt &axiom)
1659
1682
{
1660
1683
symbol_exprt qvar=axiom.univ_var ();
1661
1684
std::list<exprt> to_process;
@@ -1675,7 +1698,7 @@ void string_refinementt::initial_index_set(const string_constraintt &axiom)
1675
1698
// if cur is of the form s[i] and no quantified variable appears in i
1676
1699
if (!has_quant_var)
1677
1700
{
1678
- add_to_index_set (s, i);
1701
+ add_to_index_set (index_set, current_index_set, ns, s, i);
1679
1702
}
1680
1703
else
1681
1704
{
@@ -1685,7 +1708,7 @@ void string_refinementt::initial_index_set(const string_constraintt &axiom)
1685
1708
axiom.upper_bound (),
1686
1709
from_integer (1 , axiom.upper_bound ().type ()));
1687
1710
replace_expr (qvar, kminus1, e);
1688
- add_to_index_set (s, e);
1711
+ add_to_index_set (index_set, current_index_set, ns, s, e);
1689
1712
}
1690
1713
}
1691
1714
else
@@ -1713,7 +1736,7 @@ void string_refinementt::update_index_set(const exprt &formula)
1713
1736
s.type ().id ()==ID_array,
1714
1737
string_refinement_invariantt (" index expressions must index on arrays" ));
1715
1738
exprt simplified=simplify_sum (i);
1716
- add_to_index_set (s, simplified);
1739
+ add_to_index_set (index_set, current_index_set, ns, s, simplified);
1717
1740
}
1718
1741
else
1719
1742
{
0 commit comments