3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-08 00:05:46 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-04-30 09:30:43 -07:00
commit f525f43e43
155 changed files with 3188 additions and 1043 deletions

View file

@ -502,7 +502,7 @@ public:
ctx.set_random_seed(to_unsigned(val));
}
else if (m_option == m_reproducible_resource_limit) {
ctx.params().m_rlimit = to_unsigned(val);
ctx.params().set_rlimit(to_unsigned(val));
}
else if (m_option == m_verbosity) {
set_verbosity_level(to_unsigned(val));

View file

@ -720,8 +720,8 @@ void cmd_context::init_manager_core(bool new_manager) {
}
m_dt_eh = alloc(dt_eh, *this);
m_pmanager->set_new_datatype_eh(m_dt_eh.get());
if (!has_logic()) {
TRACE("cmd_context", tout << "init manager\n";);
if (!has_logic() && new_manager) {
TRACE("cmd_context", tout << "init manager " << m_logic << "\n";);
// add list type only if the logic is not specified.
// it prevents clashes with builtin types.
insert(pm().mk_plist_decl());
@ -759,6 +759,7 @@ void cmd_context::init_external_manager() {
}
bool cmd_context::set_logic(symbol const & s) {
TRACE("cmd_context", tout << s << "\n";);
if (has_logic())
throw cmd_exception("the logic has already been set");
if (has_manager() && m_main_ctx)
@ -1259,7 +1260,7 @@ void cmd_context::insert_aux_pdecl(pdecl * p) {
m_aux_pdecls.push_back(p);
}
void cmd_context::reset(bool finalize) {
void cmd_context::reset(bool finalize) {
m_processing_pareto = false;
m_logic = symbol::null;
m_check_sat_result = nullptr;
@ -1346,7 +1347,8 @@ void cmd_context::push() {
s.m_macros_stack_lim = m_macros_stack.size();
s.m_aux_pdecls_lim = m_aux_pdecls.size();
s.m_assertions_lim = m_assertions.size();
if (m_solver)
m().limit().push(m_params.rlimit());
if (m_solver)
m_solver->push();
if (m_opt)
m_opt->push();
@ -1369,9 +1371,10 @@ void cmd_context::restore_func_decls(unsigned old_sz) {
}
void cmd_context::restore_psort_inst(unsigned old_sz) {
for (unsigned i = old_sz; i < m_psort_inst_stack.size(); ++i) {
for (unsigned i = m_psort_inst_stack.size(); i-- > old_sz; ) {
pdecl * s = m_psort_inst_stack[i];
s->reset_cache(*m_pmanager);
s->reset_cache(pm());
pm().dec_ref(s);
}
m_psort_inst_stack.resize(old_sz);
}
@ -1461,6 +1464,9 @@ void cmd_context::pop(unsigned n) {
restore_assertions(s.m_assertions_lim);
restore_psort_inst(s.m_psort_inst_stack_lim);
m_scopes.shrink(new_lvl);
while (n--) {
m().limit().pop();
}
}
@ -1471,7 +1477,7 @@ void cmd_context::check_sat(unsigned num_assumptions, expr * const * assumptions
TRACE("before_check_sat", dump_assertions(tout););
init_manager();
unsigned timeout = m_params.m_timeout;
unsigned rlimit = m_params.m_rlimit;
unsigned rlimit = m_params.rlimit();
scoped_watch sw(*this);
lbool r;
bool was_opt = false;
@ -1546,7 +1552,7 @@ void cmd_context::check_sat(unsigned num_assumptions, expr * const * assumptions
void cmd_context::get_consequences(expr_ref_vector const& assumptions, expr_ref_vector const& vars, expr_ref_vector & conseq) {
unsigned timeout = m_params.m_timeout;
unsigned rlimit = m_params.m_rlimit;
unsigned rlimit = m_params.rlimit();
lbool r;
m_check_sat_result = m_solver.get(); // solver itself stores the result.
m_solver->set_progress_callback(this);
@ -2039,8 +2045,8 @@ void cmd_context::dt_eh::operator()(sort * dt, pdecl* pd) {
}
}
if (m_owner.m_scopes.size() > 0) {
m_owner.pm().inc_ref(pd);
m_owner.m_psort_inst_stack.push_back(pd);
}
}

View file

@ -135,7 +135,7 @@ void context_params::set(char const * param, char const * value) {
}
void context_params::updt_params() {
updt_params(gparams::get());
updt_params(gparams::get_ref());
}
void context_params::updt_params(params_ref const & p) {

View file

@ -27,6 +27,8 @@ class context_params {
void set_bool(bool & opt, char const * param, char const * value);
void set_uint(unsigned & opt, char const * param, char const * value);
unsigned m_rlimit;
public:
bool m_auto_config;
bool m_proof;
@ -42,10 +44,11 @@ public:
bool m_unsat_core;
bool m_smtlib2_compliant; // it must be here because it enable/disable the use of coercions in the ast_manager.
unsigned m_timeout;
unsigned m_rlimit;
unsigned rlimit() const { return m_rlimit; }
context_params();
void set(char const * param, char const * value);
void set_rlimit(unsigned lim) { m_rlimit = lim; }
void updt_params();
void updt_params(params_ref const & p);
static void collect_param_descrs(param_descrs & d);

View file

@ -271,7 +271,7 @@ UNARY_CMD(elim_unused_vars_cmd, "dbg-elim-unused-vars", "<expr>", "eliminate unu
return;
}
expr_ref r(ctx.m());
elim_unused_vars(ctx.m(), to_quantifier(arg), gparams::get(), r);
elim_unused_vars(ctx.m(), to_quantifier(arg), gparams::get_ref(), r);
SASSERT(!is_quantifier(r) || !to_quantifier(r)->may_have_unused_vars());
ctx.display(ctx.regular_stream(), r);
ctx.regular_stream() << std::endl;

View file

@ -207,7 +207,7 @@ public:
tref->set_logic(ctx.get_logic());
ast_manager & m = ctx.m();
unsigned timeout = p.get_uint("timeout", ctx.params().m_timeout);
unsigned rlimit = p.get_uint("rlimit", ctx.params().m_rlimit);
unsigned rlimit = p.get_uint("rlimit", ctx.params().rlimit());
labels_vec labels;
goal_ref g = alloc(goal, m, ctx.produce_proofs(), ctx.produce_models(), ctx.produce_unsat_cores());
assert_exprs_from(ctx, *g);
@ -323,7 +323,7 @@ public:
assert_exprs_from(ctx, *g);
unsigned timeout = p.get_uint("timeout", ctx.params().m_timeout);
unsigned rlimit = p.get_uint("rlimit", ctx.params().m_rlimit);
unsigned rlimit = p.get_uint("rlimit", ctx.params().rlimit());
goal_ref_buffer result_goals;