Skip to content

Commit 46876b4

Browse files
Rename premise in index_guard in string constraint
1 parent 59e58aa commit 46876b4

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

src/solvers/refinement/string_constraint.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
void replace(string_constraintt &axiom, const replace_mapt &symbol_resolve)
99
{
10-
replace_expr(symbol_resolve, axiom.premise);
10+
replace_expr(symbol_resolve, axiom.index_guard);
1111
replace_expr(symbol_resolve, axiom.body);
1212
replace_expr(symbol_resolve, axiom.univ_var);
1313
replace_expr(symbol_resolve, axiom.upper_bound);
@@ -26,7 +26,7 @@ std::string to_string(const string_constraintt &expr)
2626
std::ostringstream out;
2727
out << "forall " << format(expr.univ_var) << " in ["
2828
<< format(expr.lower_bound) << ", " << format(expr.upper_bound) << "). "
29-
<< format(expr.premise) << " => " << format(expr.body);
29+
<< format(expr.index_guard) << " => " << format(expr.body);
3030
return out.str();
3131
}
3232

@@ -138,11 +138,13 @@ bool is_valid_string_constraint(
138138
const string_constraintt &constraint)
139139
{
140140
const auto eom = messaget::eom;
141-
// Condition 1: The premise cannot contain any string indices
142-
const array_index_mapt premise_indices = gather_indices(constraint.premise);
141+
// Condition 1: The index guard cannot contain any string indices
142+
const array_index_mapt premise_indices =
143+
gather_indices(constraint.index_guard);
143144
if(!premise_indices.empty())
144145
{
145-
stream << "Premise has indices: " << to_string(constraint) << ", map: {";
146+
stream << "Index guard has indices: "
147+
<< to_string(constraint) << ", map: {";
146148
for(const auto &pair : premise_indices)
147149
{
148150
stream << format(pair.first) << ": {";

src/solvers/refinement/string_constraint.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ Author: Romain Brenguier, [email protected]
6060
class string_constraintt final
6161
{
6262
public:
63-
// String constraints are of the form
64-
// forall univ_var in [lower_bound,upper_bound[. premise => body
65-
exprt premise = true_exprt(); // Index guard
66-
exprt body; // value constraint
63+
/// String constraints are of the form
64+
/// forall univ_var in [lower_bound,upper_bound[. index_guard => body
65+
exprt index_guard = true_exprt(); // Index guard
66+
exprt body; // value constraint
6767
symbol_exprt univ_var;
6868
// \todo avoid depending on java type
6969
exprt lower_bound = from_integer(0, java_int_type());
@@ -73,7 +73,7 @@ class string_constraintt final
7373
inline void
7474
replace(string_constraintt &axiom, const union_find_replacet &symbol_resolve)
7575
{
76-
symbol_resolve.replace_expr(axiom.premise);
76+
symbol_resolve.replace_expr(axiom.index_guard);
7777
symbol_resolve.replace_expr(axiom.body);
7878
symbol_resolve.replace_expr(axiom.univ_var);
7979
symbol_resolve.replace_expr(axiom.upper_bound);

src/solvers/refinement/string_refinement.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,10 +1405,10 @@ static exprt negation_of_constraint(const string_constraintt &axiom)
14051405

14061406
// If the premise is false, the implication is trivially true, so the
14071407
// negation is false.
1408-
if(axiom.premise == false_exprt())
1408+
if(axiom.index_guard == false_exprt())
14091409
return false_exprt();
14101410

1411-
const and_exprt premise(axiom.premise, univ_within_bounds(axiom));
1411+
const and_exprt premise(axiom.index_guard, univ_within_bounds(axiom));
14121412
const and_exprt negaxiom(premise, not_exprt(axiom.body));
14131413

14141414
return negaxiom;
@@ -1531,15 +1531,15 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
15311531
const symbol_exprt &univ_var = axiom.univ_var;
15321532
const exprt &bound_inf = axiom.lower_bound;
15331533
const exprt &bound_sup = axiom.upper_bound;
1534-
const exprt &prem = axiom.premise;
1534+
const exprt &prem = axiom.index_guard;
15351535
INVARIANT(
15361536
prem == true_exprt(), "string constraint premises are not supported");
15371537

15381538
string_constraintt axiom_in_model;
15391539
axiom_in_model.univ_var = univ_var;
15401540
axiom_in_model.lower_bound = get(bound_inf);
15411541
axiom_in_model.upper_bound = get(bound_sup);
1542-
axiom_in_model.premise = get(prem);
1542+
axiom_in_model.index_guard = get(prem);
15431543
axiom_in_model.body = get(axiom.body);
15441544

15451545
exprt negaxiom=negation_of_constraint(axiom_in_model);
@@ -1634,7 +1634,7 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
16341634
const exprt &val=v.second;
16351635
const string_constraintt &axiom=axioms.universal[v.first];
16361636

1637-
implies_exprt instance(axiom.premise, axiom.body);
1637+
implies_exprt instance(axiom.index_guard, axiom.body);
16381638
replace_expr(axiom.univ_var, val, instance);
16391639
// We are not sure the index set contains only positive numbers
16401640
and_exprt bounds(
@@ -2135,7 +2135,7 @@ static exprt instantiate(
21352135
and_exprt(
21362136
binary_relation_exprt(axiom.univ_var, ID_ge, axiom.lower_bound),
21372137
binary_relation_exprt(axiom.univ_var, ID_lt, axiom.upper_bound),
2138-
axiom.premise),
2138+
axiom.index_guard),
21392139
axiom.body);
21402140
replace_expr(axiom.univ_var, r, instance);
21412141
return instance;

0 commit comments

Comments
 (0)