mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 09:35:32 +00:00
Merge branch 'opt' of https://github.com/nikolajbjorner/z3 into opt
This commit is contained in:
commit
c6cb739b44
142 changed files with 1469 additions and 2908 deletions
|
@ -61,7 +61,6 @@ class inc_sat_solver : public solver {
|
|||
model_converter_ref m_mc;
|
||||
model_converter_ref m_mc0;
|
||||
model_converter_ref m_sat_mc;
|
||||
expr_dependency_ref m_dep_core;
|
||||
svector<double> m_weights;
|
||||
std::string m_unknown;
|
||||
// access formulas after they have been pre-processed and handled by the sat solver.
|
||||
|
@ -82,7 +81,6 @@ public:
|
|||
m_core(m),
|
||||
m_map(m),
|
||||
m_num_scopes(0),
|
||||
m_dep_core(m),
|
||||
m_unknown("no reason given"),
|
||||
m_internalized(false),
|
||||
m_internalized_converted(false),
|
||||
|
@ -495,7 +493,6 @@ private:
|
|||
lbool internalize_goal(goal_ref& g, dep2asm_t& dep2asm, bool is_lemma) {
|
||||
m_mc.reset();
|
||||
m_pc.reset();
|
||||
m_dep_core.reset();
|
||||
m_subgoals.reset();
|
||||
init_preprocess();
|
||||
SASSERT(g->models_enabled());
|
||||
|
@ -505,7 +502,7 @@ private:
|
|||
SASSERT(!g->proofs_enabled());
|
||||
TRACE("sat", g->display(tout););
|
||||
try {
|
||||
(*m_preprocess)(g, m_subgoals, m_mc, m_pc, m_dep_core);
|
||||
(*m_preprocess)(g, m_subgoals);
|
||||
}
|
||||
catch (tactic_exception & ex) {
|
||||
IF_VERBOSE(0, verbose_stream() << "exception in tactic " << ex.msg() << "\n";);
|
||||
|
@ -520,6 +517,8 @@ private:
|
|||
}
|
||||
g = m_subgoals[0];
|
||||
expr_ref_vector atoms(m);
|
||||
m_pc = g->pc();
|
||||
m_mc = g->mc();
|
||||
TRACE("sat", g->display_with_dependencies(tout););
|
||||
m_goal2sat(*g, m_params, m_solver, m_map, dep2asm, false, is_lemma);
|
||||
m_goal2sat.get_interpreted_atoms(atoms);
|
||||
|
|
|
@ -881,8 +881,9 @@ struct sat2goal::imp {
|
|||
|
||||
// Wrapper for sat::model_converter: converts it into an "AST level" model_converter.
|
||||
class sat_model_converter : public model_converter {
|
||||
sat::model_converter m_mc;
|
||||
expr_ref_vector m_var2expr;
|
||||
model_converter_ref m_cached_mc;
|
||||
sat::model_converter m_mc;
|
||||
expr_ref_vector m_var2expr;
|
||||
generic_model_converter_ref m_fmc; // filter for eliminating fresh variables introduced in the assertion-set --> sat conversion
|
||||
|
||||
sat_model_converter(ast_manager & m):
|
||||
|
@ -921,8 +922,7 @@ struct sat2goal::imp {
|
|||
}
|
||||
}
|
||||
|
||||
virtual void operator()(model_ref & md, unsigned goal_idx) {
|
||||
SASSERT(goal_idx == 0);
|
||||
virtual void operator()(model_ref & md) {
|
||||
TRACE("sat_mc", tout << "before sat_mc\n"; model_v2_pp(tout, *md); display(tout););
|
||||
// REMARK: potential problem
|
||||
// model_evaluator can't evaluate quantifiers. Then,
|
||||
|
@ -1025,6 +1025,9 @@ struct sat2goal::imp {
|
|||
if (m_fmc) m_fmc->collect(visitor);
|
||||
}
|
||||
|
||||
void operator()(expr_ref& formula) override {
|
||||
NOT_IMPLEMENTED_YET();
|
||||
}
|
||||
};
|
||||
|
||||
typedef ref<sat_model_converter> sat_model_converter_ref;
|
||||
|
@ -1033,7 +1036,6 @@ struct sat2goal::imp {
|
|||
expr_ref_vector m_lit2expr;
|
||||
unsigned long long m_max_memory;
|
||||
bool m_learned;
|
||||
unsigned m_glue;
|
||||
|
||||
imp(ast_manager & _m, params_ref const & p):m(_m), m_lit2expr(m) {
|
||||
updt_params(p);
|
||||
|
@ -1041,7 +1043,6 @@ struct sat2goal::imp {
|
|||
|
||||
void updt_params(params_ref const & p) {
|
||||
m_learned = p.get_bool("learned", false);
|
||||
m_glue = p.get_uint("glue", UINT_MAX);
|
||||
m_max_memory = megabytes_to_bytes(p.get_uint("max_memory", UINT_MAX));
|
||||
}
|
||||
|
||||
|
@ -1131,7 +1132,6 @@ struct sat2goal::imp {
|
|||
checkpoint();
|
||||
lits.reset();
|
||||
sat::clause const & c = *cp;
|
||||
unsigned sz = c.size();
|
||||
if (asserted || m_learned || c.glue() <= s.get_config().m_gc_small_lbd) {
|
||||
for (sat::literal l : c) {
|
||||
lits.push_back(lit2expr(mc, l));
|
||||
|
@ -1142,8 +1142,7 @@ struct sat2goal::imp {
|
|||
}
|
||||
|
||||
sat::ba_solver* get_ba_solver(sat::solver const& s) {
|
||||
sat::extension* ext = s.get_extension();
|
||||
return dynamic_cast<sat::ba_solver*>(ext);
|
||||
return dynamic_cast<sat::ba_solver*>(s.get_extension());
|
||||
}
|
||||
|
||||
void operator()(sat::solver const & s, atom2bool_var const & map, goal & r, model_converter_ref & mc) {
|
||||
|
@ -1229,7 +1228,6 @@ sat2goal::sat2goal():m_imp(0) {
|
|||
void sat2goal::collect_param_descrs(param_descrs & r) {
|
||||
insert_max_memory(r);
|
||||
r.insert("learned", CPK_BOOL, "(default: false) collect also learned clauses.");
|
||||
r.insert("glue", CPK_UINT, "(default: max-int) collect learned clauses with glue level below parameter.");
|
||||
}
|
||||
|
||||
struct sat2goal::scoped_set_imp {
|
||||
|
|
|
@ -39,11 +39,7 @@ class sat_tactic : public tactic {
|
|||
}
|
||||
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
proof_converter_ref & pc,
|
||||
expr_dependency_ref & core) {
|
||||
mc = 0; pc = 0; core = 0;
|
||||
goal_ref_buffer & result) {
|
||||
fail_if_proof_generation("sat", g);
|
||||
bool produce_models = g->models_enabled();
|
||||
bool produce_core = g->unsat_core_enabled();
|
||||
|
@ -103,7 +99,7 @@ class sat_tactic : public tactic {
|
|||
}
|
||||
}
|
||||
TRACE("sat_tactic", model_v2_pp(tout, *md););
|
||||
mc = model2model_converter(md.get());
|
||||
g->add(model2model_converter(md.get()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -112,7 +108,9 @@ class sat_tactic : public tactic {
|
|||
IF_VERBOSE(TACTIC_VERBOSITY_LVL, verbose_stream() << "\"formula constains interpreted atoms, recovering formula from sat solver...\"\n";);
|
||||
#endif
|
||||
m_solver.pop_to_base_level();
|
||||
model_converter_ref mc;
|
||||
m_sat2goal(m_solver, map, m_params, *(g.get()), mc);
|
||||
g->add(mc.get());
|
||||
}
|
||||
g->inc_depth();
|
||||
result.push_back(g.get());
|
||||
|
@ -175,14 +173,11 @@ public:
|
|||
}
|
||||
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
proof_converter_ref & pc,
|
||||
expr_dependency_ref & core) {
|
||||
goal_ref_buffer & result) {
|
||||
imp proc(g->m(), m_params);
|
||||
scoped_set_imp set(this, &proc);
|
||||
try {
|
||||
proc(g, result, mc, pc, core);
|
||||
proc(g, result);
|
||||
proc.m_solver.collect_statistics(m_stats);
|
||||
}
|
||||
catch (sat::solver_exception & ex) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue