3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-24 03:57:51 +00:00

fix dotnet build

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-08-30 14:46:31 -07:00
parent 9f0b303263
commit 25106866b5
9 changed files with 153 additions and 99 deletions

View file

@ -66,7 +66,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
bool m_ite_extra;
unsigned long long m_max_memory;
expr_ref_vector m_trail;
func_decl_ref_vector m_interpreted_funs;
func_decl_ref_vector m_unhandled_funs;
bool m_default_external;
bool m_xor_solver;
bool m_euf;
@ -80,7 +80,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
m_map(map),
m_dep2asm(dep2asm),
m_trail(m),
m_interpreted_funs(m),
m_unhandled_funs(m),
m_default_external(default_external) {
updt_params(p);
m_true = sat::null_literal;
@ -174,7 +174,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
return;
}
else
m_interpreted_funs.push_back(to_app(t)->get_decl());
m_unhandled_funs.push_back(to_app(t)->get_decl());
}
}
}
@ -398,8 +398,8 @@ struct goal2sat::imp : public sat::sat_internalizer {
SASSERT(t->get_num_args() == 2);
unsigned sz = m_result_stack.size();
SASSERT(sz >= 2);
sat::literal l1 = m_result_stack[sz - 1];
sat::literal l2 = m_result_stack[sz - 2];
sat::literal l2 = m_result_stack[sz - 1];
sat::literal l1 = m_result_stack[sz - 2];
if (root) {
SASSERT(sz == 2);
if (sign) {
@ -469,6 +469,13 @@ struct goal2sat::imp : public sat::sat_internalizer {
convert_iff2(t, root, sign);
}
func_decl_ref_vector const& interpreted_funs() {
auto* ext = dynamic_cast<euf::solver*>(m_solver.get_extension());
if (ext)
return ext->unhandled_functions();
return m_unhandled_funs;
}
void convert_euf(expr* e, bool root, bool sign) {
sat::extension* ext = m_solver.get_extension();
euf::solver* euf = nullptr;
@ -693,6 +700,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
}
void operator()(goal const & g) {
g.display(std::cout);
struct scoped_reset {
imp& i;
scoped_reset(imp& i) :i(i) {}
@ -741,6 +749,12 @@ struct goal2sat::imp : public sat::sat_internalizer {
}
}
void update_model(model_ref& mdl) {
auto* ext = dynamic_cast<euf::solver*>(m_solver.get_extension());
if (ext)
ext->update_model(mdl);
}
};
struct unsupported_bool_proc {
@ -792,7 +806,7 @@ void goal2sat::operator()(goal const & g, params_ref const & p, sat::solver_core
(*m_imp)(g);
if (!t.get_extension() && m_imp->m_interpreted_funs.empty()) {
if (!t.get_extension() && m_imp->interpreted_funs().empty()) {
dealloc(m_imp);
m_imp = nullptr;
}
@ -801,12 +815,17 @@ void goal2sat::operator()(goal const & g, params_ref const & p, sat::solver_core
void goal2sat::get_interpreted_funs(func_decl_ref_vector& atoms) {
if (m_imp) {
atoms.append(m_imp->m_interpreted_funs);
atoms.append(m_imp->interpreted_funs());
}
}
bool goal2sat::has_interpreted_funs() const {
return m_imp && !m_imp->m_interpreted_funs.empty();
return m_imp && !m_imp->interpreted_funs().empty();
}
void goal2sat::update_model(model_ref& mdl) {
if (m_imp)
m_imp->update_model(mdl);
}

View file

@ -61,12 +61,14 @@ public:
*/
void operator()(goal const & g, params_ref const & p, sat::solver_core & t, atom2bool_var & m, dep2asm_map& dep2asm, bool default_external = false);
void get_interpreted_funs(func_decl_ref_vector& atoms);
void get_interpreted_funs(func_decl_ref_vector& funs);
bool has_interpreted_funs() const;
sat::sat_internalizer& si(ast_manager& m, params_ref const& p, sat::solver_core& t, atom2bool_var& a2b, dep2asm_map& dep2asm, bool default_external = false);
void update_model(model_ref& mdl);
};

View file

@ -50,11 +50,12 @@ class sat_tactic : public tactic {
obj_map<expr, sat::literal> dep2asm;
sat::literal_vector assumptions;
m_goal2sat(*g, m_params, *m_solver, map, dep2asm);
TRACE("sat", tout << "interpreted_atoms: " << map.interpreted_atoms() << "\n";
for (auto const& kv : map) {
if (!is_uninterp_const(kv.m_key))
tout << mk_ismt2_pp(kv.m_key, m) << "\n";
});
TRACE("sat", tout << "interpreted_atoms: " << m_goal2sat.has_interpreted_funs() << "\n";
func_decl_ref_vector funs(m);
m_goal2sat.get_interpreted_funs(funs);
for (func_decl* f : funs)
tout << mk_ismt2_pp(f, m) << "\n";
);
g->reset();
g->m().compact_memory();
@ -78,7 +79,7 @@ class sat_tactic : public tactic {
}
g->assert_expr(m.mk_false(), nullptr, lcore);
}
else if (r == l_true && !map.interpreted_atoms()) {
else if (r == l_true && !m_goal2sat.has_interpreted_funs()) {
// register model
if (produce_models) {
model_ref md = alloc(model, m);
@ -99,6 +100,7 @@ class sat_tactic : public tactic {
break;
}
}
m_goal2sat.update_model(md);
TRACE("sat_tactic", model_v2_pp(tout, *md););
g->add(model2model_converter(md.get()));
}