Skip to content

Commit 61503f0

Browse files
author
Joel Allred
committed
Add non-negative length constraint earlier
Add non-negativeness constraint on string lengths before doing the first iteration over the index set. These constraints used to be added after that step, and some of the length variables were missing these constraints. This is made very visible by the upcoming changes to the way we deal with string lengths.
1 parent 09fa70f commit 61503f0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/solvers/strings/string_refinement.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,13 @@ decision_proceduret::resultt string_refinementt::dec_solve()
737737
for(const exprt &lemma : generator.constraints.existential)
738738
add_lemma(lemma);
739739

740+
// All generated strings should have non-negative length
741+
for(const auto &string : generator.array_pool.created_strings())
742+
{
743+
add_lemma(binary_relation_exprt{
744+
string.length(), ID_ge, from_integer(0, string.length_type())});
745+
}
746+
740747
// Initial try without index set
741748
const auto get = [this](const exprt &expr) { return this->get(expr); };
742749
dependencies.clean_cache();
@@ -776,13 +783,6 @@ decision_proceduret::resultt string_refinementt::dec_solve()
776783
for(const auto &instance : initial_instances)
777784
add_lemma(instance);
778785

779-
// All generated strings should have non-negative length
780-
for(const auto &string : generator.array_pool.created_strings())
781-
{
782-
add_lemma(binary_relation_exprt{
783-
string.length(), ID_ge, from_integer(0, string.length_type())});
784-
}
785-
786786
while((loop_bound_--) > 0)
787787
{
788788
dependencies.clean_cache();

0 commit comments

Comments
 (0)