mirror of
https://github.com/Z3Prover/z3
synced 2025-08-16 07:45:27 +00:00
z3str3: add is_var() similar to theory_seq's implementation
This commit is contained in:
parent
1c70bcee69
commit
f29b033253
2 changed files with 17 additions and 1 deletions
|
@ -8374,6 +8374,21 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
bool theory_str::is_var(expr * e) const {
|
||||
ast_manager & m = get_manager();
|
||||
sort * ex_sort = m.get_sort(e);
|
||||
sort * str_sort = u.str.mk_string_sort();
|
||||
// non-string-sort terms cannot be string variables
|
||||
if (ex_sort != str_sort) return false;
|
||||
// string constants cannot be variables
|
||||
if (u.str.is_string(e)) return false;
|
||||
if (u.str.is_concat(e) || u.str.is_at(e) || u.str.is_extract(e) || u.str.is_replace(e) || u.str.is_itos(e))
|
||||
return false;
|
||||
if (m.is_ite(e))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void theory_str::set_up_axioms(expr * ex) {
|
||||
ast_manager & m = get_manager();
|
||||
context & ctx = get_context();
|
||||
|
@ -8417,7 +8432,7 @@ namespace smt {
|
|||
TRACE("str", tout << "found string-integer conversion term: " << mk_pp(ex, get_manager()) << std::endl;);
|
||||
string_int_conversion_terms.push_back(ap);
|
||||
m_library_aware_axiom_todo.push_back(n);
|
||||
} else if (/*ap->get_num_args() == 0 &&*/ !u.str.is_string(ap)) {
|
||||
} else if (is_var(ex)) {
|
||||
// if ex is a variable, add it to our list of variables
|
||||
TRACE("str", tout << "tracking variable " << mk_ismt2_pp(ap, get_manager()) << std::endl;);
|
||||
variable_set.insert(ex);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue