mirror of
https://github.com/Z3Prover/z3
synced 2025-10-01 13:39:28 +00:00
fix model generation: don't build interpretations for Length()
This commit is contained in:
parent
fb5f3cbc13
commit
bdf755156c
4 changed files with 80 additions and 9 deletions
|
@ -64,7 +64,7 @@ void str_decl_plugin::set_manager(ast_manager * m, family_id id) {
|
|||
|
||||
MK_OP(m_concat_decl, "Concat", OP_STRCAT, s);
|
||||
|
||||
m_length_decl = m->mk_func_decl(symbol("Length"), s, i); m_manager->inc_ref(m_length_decl);
|
||||
m_length_decl = m->mk_func_decl(symbol("Length"), s, i, func_decl_info(id, OP_STRLEN)); m_manager->inc_ref(m_length_decl);
|
||||
}
|
||||
|
||||
decl_plugin * str_decl_plugin::mk_fresh() {
|
||||
|
@ -120,6 +120,20 @@ app * str_decl_plugin::mk_string(const char * val) {
|
|||
return mk_string(key);
|
||||
}
|
||||
|
||||
app * str_decl_plugin::mk_fresh_string() {
|
||||
// cheating.
|
||||
// take the longest string in the cache, append the letter "A", and call it fresh.
|
||||
std::string longestString = "";
|
||||
std::map<std::string, app*>::iterator it = string_cache.begin();
|
||||
for (; it != string_cache.end(); ++it) {
|
||||
if (it->first.length() > longestString.length()) {
|
||||
longestString = it->first;
|
||||
}
|
||||
}
|
||||
longestString += "A";
|
||||
return mk_string(longestString);
|
||||
}
|
||||
|
||||
void str_decl_plugin::get_op_names(svector<builtin_name> & op_names, symbol const & logic) {
|
||||
op_names.push_back(builtin_name("Concat", OP_STRCAT));
|
||||
op_names.push_back(builtin_name("Length", OP_STRLEN));
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
|
||||
app * mk_string(const char * val);
|
||||
app * mk_string(std::string & val);
|
||||
app * mk_fresh_string();
|
||||
|
||||
virtual void get_op_names(svector<builtin_name> & op_names, symbol const & logic);
|
||||
virtual void get_sort_names(svector<builtin_name> & sort_names, symbol const & logic);
|
||||
|
@ -97,6 +98,9 @@ public:
|
|||
app * mk_string(std::string & val) {
|
||||
return m_plugin->mk_string(val);
|
||||
}
|
||||
app * mk_fresh_string() {
|
||||
return m_plugin->mk_fresh_string();
|
||||
}
|
||||
// TODO
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue