3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00
This commit is contained in:
Nikolaj Bjorner 2023-04-08 17:14:39 -07:00
parent af9c760a68
commit e6ea81546e
4 changed files with 29 additions and 1 deletions

View file

@ -28,6 +28,7 @@ Revision History:
#include "ast/rewriter/rewriter_def.h"
#include "ast/ast_pp.h"
#include "ast/array_decl_plugin.h"
#include "ast/special_relations_decl_plugin.h"
#include "ast/ast_smt2_pp.h"
#include "smt/smt_model_checker.h"
#include "smt/smt_context.h"
@ -358,7 +359,7 @@ namespace smt {
TRACE("model_checker", tout << "[complete] model-checker result: " << to_sat_str(r) << "\n";);
if (r != l_true) {
return r == l_false; // quantifier is satisfied by m_curr_model
return is_safe_for_mbqi(q) && r == l_false; // quantifier is satisfied by m_curr_model
}
model_ref complete_cex;
@ -398,6 +399,26 @@ namespace smt {
return false;
}
bool model_checker::is_safe_for_mbqi(quantifier * q) const {
special_relations_util sp(m);
if (!sp.has_special_relation())
return true;
ast_fast_mark1 visited;
struct proc {
special_relations_util& sp;
bool found = false;
proc(special_relations_util& sp):sp(sp) {}
void operator()(app* f) {
found |= sp.is_special_relation(f);
}
void operator()(expr* e) {}
};
proc p(sp);
quick_for_each_expr(p, visited, q);
return !p.found;
}
void model_checker::init_aux_context() {
if (!m_fparams) {
m_fparams = alloc(smt_params, m_context->get_fparams());

View file

@ -87,6 +87,7 @@ namespace smt {
expr_mark m_visited;
bool contains_model_value(expr * e);
void add_instance(quantifier * q, expr_ref_vector const & bindings, unsigned max_generation, expr * def);
bool is_safe_for_mbqi(quantifier * q) const;
public:
model_checker(ast_manager & m, qi_params const & p, model_finder & mf);