mirror of
https://github.com/Z3Prover/z3
synced 2025-04-25 01:55:32 +00:00
Bugfixes for unspecified results from fp.to_* (models are still incomplete).
Relates to #507
This commit is contained in:
parent
3101d281e4
commit
99d7a47f82
8 changed files with 196 additions and 107 deletions
|
@ -54,6 +54,14 @@ void fpa2bv_model_converter::display(std::ostream & out) {
|
|||
out << mk_ismt2_pp(it->m_value.first, m, indent) << "; " <<
|
||||
mk_ismt2_pp(it->m_value.second, m, indent) << ")";
|
||||
}
|
||||
for (obj_hashtable<func_decl>::iterator it = m_unspecified_ufs.begin();
|
||||
it != m_unspecified_ufs.end();
|
||||
it++)
|
||||
{
|
||||
const symbol & n = (*it)->get_name();
|
||||
unsigned indent = n.size() + 4;
|
||||
out << n << " ";
|
||||
}
|
||||
out << ")" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -99,6 +107,14 @@ model_converter * fpa2bv_model_converter::translate(ast_translation & translator
|
|||
translator.to().inc_ref(v1);
|
||||
translator.to().inc_ref(v2);
|
||||
}
|
||||
for (obj_hashtable<func_decl>::iterator it = m_unspecified_ufs.begin();
|
||||
it != m_unspecified_ufs.end();
|
||||
it++)
|
||||
{
|
||||
func_decl * k = translator(*it);
|
||||
res->m_unspecified_ufs.insert(k);
|
||||
translator.to().inc_ref(k);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -367,6 +383,22 @@ void fpa2bv_model_converter::convert(model * bv_mdl, model * float_mdl) {
|
|||
float_mdl->register_decl(f, flt_fi);
|
||||
}
|
||||
|
||||
// fp.to_*_unspecified UFs.
|
||||
for (obj_hashtable<func_decl>::iterator it = m_unspecified_ufs.begin();
|
||||
it != m_unspecified_ufs.end();
|
||||
it++)
|
||||
{
|
||||
func_decl * f = *it;
|
||||
|
||||
if (bv_mdl->has_interpretation(f)) {
|
||||
func_interp * val = bv_mdl->get_func_interp(f)->copy();
|
||||
TRACE("fpa2bv_mc", tout << "Keeping interpretation for " << mk_ismt2_pp(f, m) << std::endl;);
|
||||
float_mdl->register_decl(f, val);
|
||||
}
|
||||
else
|
||||
TRACE("fpa2bv_mc", tout << "No interpretation for " << mk_ismt2_pp(f, m) << std::endl;);
|
||||
}
|
||||
|
||||
// Keep all the non-float constants.
|
||||
unsigned sz = bv_mdl->get_num_constants();
|
||||
for (unsigned i = 0; i < sz; i++)
|
||||
|
|
|
@ -28,6 +28,7 @@ class fpa2bv_model_converter : public model_converter {
|
|||
obj_map<func_decl, expr*> m_rm_const2bv;
|
||||
obj_map<func_decl, func_decl*> m_uf2bvuf;
|
||||
obj_map<func_decl, std::pair<app*, app*> > m_specials;
|
||||
obj_hashtable<func_decl> m_unspecified_ufs;
|
||||
|
||||
public:
|
||||
fpa2bv_model_converter(ast_manager & m, fpa2bv_converter const & conv) : m(m) {
|
||||
|
@ -63,6 +64,13 @@ public:
|
|||
m.inc_ref(it->m_value.first);
|
||||
m.inc_ref(it->m_value.second);
|
||||
}
|
||||
for (obj_hashtable<func_decl>::iterator it = conv.m_unspecified_ufs.begin();
|
||||
it != conv.m_unspecified_ufs.end();
|
||||
it++)
|
||||
{
|
||||
m_unspecified_ufs.insert(*it);
|
||||
m.inc_ref(*it);
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~fpa2bv_model_converter() {
|
||||
|
@ -76,6 +84,7 @@ public:
|
|||
m.dec_ref(it->m_value.first);
|
||||
m.dec_ref(it->m_value.second);
|
||||
}
|
||||
dec_ref_collection_values(m, m_unspecified_ufs);
|
||||
}
|
||||
|
||||
virtual void operator()(model_ref & md, unsigned goal_idx) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue