mirror of
https://github.com/Z3Prover/z3
synced 2025-05-08 00:05:46 +00:00
fix model conversion bugs
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
b129ee764f
commit
ece5ad90e0
11 changed files with 68 additions and 88 deletions
|
@ -1419,7 +1419,9 @@ void cmd_context::restore_assertions(unsigned old_sz) {
|
|||
SASSERT(m_assertions.empty());
|
||||
return;
|
||||
}
|
||||
SASSERT(old_sz <= m_assertions.size());
|
||||
if (old_sz == m_assertions.size())
|
||||
return;
|
||||
SASSERT(old_sz < m_assertions.size());
|
||||
SASSERT(!m_interactive_mode || m_assertions.size() == m_assertion_strings.size());
|
||||
restore(m(), m_assertions, old_sz);
|
||||
if (produce_unsat_cores())
|
||||
|
@ -1520,7 +1522,6 @@ void cmd_context::check_sat(unsigned num_assumptions, expr * const * assumptions
|
|||
}
|
||||
display_sat_result(r);
|
||||
if (r == l_true) {
|
||||
complete_model();
|
||||
validate_model();
|
||||
}
|
||||
validate_check_sat_result(r);
|
||||
|
@ -1528,9 +1529,8 @@ void cmd_context::check_sat(unsigned num_assumptions, expr * const * assumptions
|
|||
// get_opt()->display_assignment(regular_stream());
|
||||
}
|
||||
|
||||
if (r == l_true && m_params.m_dump_models) {
|
||||
model_ref md;
|
||||
get_check_sat_result()->get_model(md);
|
||||
model_ref md;
|
||||
if (r == l_true && m_params.m_dump_models && is_model_available(md)) {
|
||||
display_model(md);
|
||||
}
|
||||
}
|
||||
|
@ -1695,14 +1695,10 @@ struct contains_underspecified_op_proc {
|
|||
/**
|
||||
\brief Complete the model if necessary.
|
||||
*/
|
||||
void cmd_context::complete_model() {
|
||||
model_ref md;
|
||||
if (!is_model_available(md) ||
|
||||
gparams::get_value("model.completion") != "true")
|
||||
void cmd_context::complete_model(model_ref& md) const {
|
||||
if (gparams::get_value("model.completion") != "true" || !md.get())
|
||||
return;
|
||||
|
||||
get_check_sat_result()->get_model(md);
|
||||
SASSERT(md.get() != 0);
|
||||
params_ref p;
|
||||
p.set_uint("max_degree", UINT_MAX); // evaluate algebraic numbers of any degree.
|
||||
p.set_uint("sort_store", true);
|
||||
|
@ -1770,7 +1766,6 @@ void cmd_context::validate_model() {
|
|||
return;
|
||||
if (!is_model_available(md))
|
||||
return;
|
||||
get_check_sat_result()->get_model(md);
|
||||
SASSERT(md.get() != 0);
|
||||
params_ref p;
|
||||
p.set_uint("max_degree", UINT_MAX); // evaluate algebraic numbers of any degree.
|
||||
|
@ -1902,6 +1897,7 @@ bool cmd_context::is_model_available(model_ref& md) const {
|
|||
has_manager() &&
|
||||
(cs_state() == css_sat || cs_state() == css_unknown)) {
|
||||
get_check_sat_result()->get_model(md);
|
||||
complete_model(md);
|
||||
return md.get() != 0;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -365,7 +365,7 @@ public:
|
|||
void set_check_sat_result(check_sat_result * r) { m_check_sat_result = r; }
|
||||
check_sat_result * get_check_sat_result() const { return m_check_sat_result.get(); }
|
||||
check_sat_state cs_state() const;
|
||||
void complete_model();
|
||||
void complete_model(model_ref& mdl) const;
|
||||
void validate_model();
|
||||
void display_model(model_ref& mdl);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ Revision History:
|
|||
--*/
|
||||
#include "cmd_context/pdecl.h"
|
||||
#include "ast/datatype_decl_plugin.h"
|
||||
#include <sstream>
|
||||
using namespace format_ns;
|
||||
|
||||
class psort_inst_cache {
|
||||
|
@ -866,8 +867,6 @@ psort * pdecl_manager::mk_psort_cnst(sort * s) {
|
|||
}
|
||||
|
||||
psort * pdecl_manager::register_psort(psort * n) {
|
||||
enable_trace("register_psort");
|
||||
TRACE("register_psort", tout << "registering psort...\n"; n->display(tout); tout << "\n";);
|
||||
psort * r = m_table.insert_if_not_there(n);
|
||||
if (r != n) {
|
||||
del_decl_core(n);
|
||||
|
@ -947,7 +946,6 @@ void pdecl_manager::del_decl_core(pdecl * p) {
|
|||
}
|
||||
|
||||
void pdecl_manager::del_decl(pdecl * p) {
|
||||
enable_trace("register_psort");
|
||||
TRACE("register_psort", tout << "del psort "; p->display(tout); tout << "\n";);
|
||||
if (p->is_psort()) {
|
||||
psort * _p = static_cast<psort*>(p);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue