Skip to content

Commit f91af02

Browse files
mtrberziNikolajBjorner
authored andcommitted
z3str3: set up axioms on string terms that are added during the search
1 parent 9ae1a6f commit f91af02

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/smt/theory_str.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8160,6 +8160,16 @@ namespace smt {
81608160
sort * rhs_sort = m.get_sort(rhs);
81618161
sort * str_sort = u.str.mk_string_sort();
81628162

8163+
// Pick up new terms added during the search (e.g. recursive function expansion).
8164+
if (!existing_toplevel_exprs.contains(lhs)) {
8165+
existing_toplevel_exprs.insert(lhs);
8166+
set_up_axioms(lhs);
8167+
}
8168+
if (!existing_toplevel_exprs.contains(rhs)) {
8169+
existing_toplevel_exprs.insert(rhs);
8170+
set_up_axioms(rhs);
8171+
}
8172+
81638173
if (lhs_sort != str_sort || rhs_sort != str_sort) {
81648174
TRACE("str", tout << "skip equality: not String sort" << std::endl;);
81658175
return;
@@ -8615,7 +8625,12 @@ namespace smt {
86158625
}
86168626

86178627
void theory_str::assign_eh(bool_var v, bool is_true) {
8618-
TRACE("str", tout << "assert: v" << v << " #" << get_context().bool_var2expr(v)->get_id() << " is_true: " << is_true << std::endl;);
8628+
expr * e = get_context().bool_var2expr(v);
8629+
TRACE("str", tout << "assert: v" << v << " " << mk_pp(e, get_manager()) << " is_true: " << is_true << std::endl;);
8630+
if (!existing_toplevel_exprs.contains(e)) {
8631+
existing_toplevel_exprs.insert(e);
8632+
set_up_axioms(e);
8633+
}
86198634
}
86208635

86218636
void theory_str::push_scope_eh() {

src/smt/theory_str.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ class theory_str : public theory {
346346
// include an occurrence of the term for which axioms are being generated
347347
obj_hashtable<expr> axiomatized_terms;
348348

349+
// hashtable of all top-level exprs for which set_up_axioms() has been called
350+
obj_hashtable<expr> existing_toplevel_exprs;
351+
349352
int tmpStringVarCount;
350353
int tmpXorVarCount;
351354
int tmpLenTestVarCount;

0 commit comments

Comments
 (0)