Skip to content

Commit 9962b7c

Browse files
Constrain all generated strings to have non-negative length
Generated strings should have positive length, not adding these lemmas could potentially lead to overflow errors in check_axioms which means the solver will end with an error because the index set is empty.
1 parent 36e579c commit 9962b7c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/solvers/strings/string_refinement.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,13 @@ decision_proceduret::resultt string_refinementt::dec_solve()
790790
for(const auto &instance : initial_instances)
791791
add_lemma(instance);
792792

793+
// All generated strings should have non-negative length
794+
for(const auto &string : generator.array_pool.created_strings())
795+
{
796+
add_lemma(binary_relation_exprt{
797+
string.length(), ID_ge, from_integer(0, string.length().type())});
798+
}
799+
793800
while((loop_bound_--) > 0)
794801
{
795802
dependencies.clean_cache();

0 commit comments

Comments
 (0)