mirror of
https://github.com/Z3Prover/z3
synced 2025-04-14 04:48:45 +00:00
record statistics setting in config_params so that fp engine can access them, fix serialization bug when check-assumptions returns unsat
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
24b6ff90cd
commit
84c7df75d6
src
cmd_context
muz
sat
shell
|
@ -37,6 +37,7 @@ context_params::context_params() {
|
|||
m_model_compress = true;
|
||||
m_timeout = UINT_MAX;
|
||||
m_rlimit = 0;
|
||||
m_statistics = false;
|
||||
updt_params();
|
||||
}
|
||||
|
||||
|
@ -109,6 +110,9 @@ void context_params::set(char const * param, char const * value) {
|
|||
else if (p == "dump_models") {
|
||||
set_bool(m_dump_models, param, value);
|
||||
}
|
||||
else if (p == "stats") {
|
||||
set_bool(m_statistics, param, value);
|
||||
}
|
||||
else if (p == "trace") {
|
||||
set_bool(m_trace, param, value);
|
||||
}
|
||||
|
@ -158,6 +162,7 @@ void context_params::updt_params(params_ref const & p) {
|
|||
m_unsat_core = p.get_bool("unsat_core", m_unsat_core);
|
||||
m_debug_ref_count = p.get_bool("debug_ref_count", m_debug_ref_count);
|
||||
m_smtlib2_compliant = p.get_bool("smtlib2_compliant", m_smtlib2_compliant);
|
||||
m_statistics = p.get_bool("stats", m_statistics);
|
||||
}
|
||||
|
||||
void context_params::collect_param_descrs(param_descrs & d) {
|
||||
|
@ -174,6 +179,8 @@ void context_params::collect_param_descrs(param_descrs & d) {
|
|||
d.insert("dot_proof_file", CPK_STRING, "file in which to output graphical proofs", "proof.dot");
|
||||
d.insert("debug_ref_count", CPK_BOOL, "debug support for AST reference counting", "false");
|
||||
d.insert("smtlib2_compliant", CPK_BOOL, "enable/disable SMT-LIB 2.0 compliance", "false");
|
||||
d.insert("stats", CPK_BOOL, "enable/disable statistics", "false");
|
||||
// statistics are hidden as they are controlled by the /st option.
|
||||
collect_solver_param_descrs(d);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ 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;
|
||||
bool m_statistics;
|
||||
|
||||
unsigned rlimit() const { return m_rlimit; }
|
||||
context_params();
|
||||
|
|
|
@ -64,7 +64,7 @@ expr_ref bind_variables::abstract(expr* term, cache_t& cache, unsigned scope) {
|
|||
}
|
||||
switch(e->get_kind()) {
|
||||
case AST_VAR: {
|
||||
SASSERT(to_var(e)->get_idx() < scope);
|
||||
// SASSERT(to_var(e)->get_idx() >= scope);
|
||||
// mixing bound variables and free is possible for the caller,
|
||||
// but not proper use.
|
||||
// So we assert here even though we don't check for it.
|
||||
|
|
|
@ -83,9 +83,9 @@ def_module_params('fp',
|
|||
('print_boogie_certificate', BOOL, False,
|
||||
'print certificate for reachability or non-reachability using a ' +
|
||||
'format understood by Boogie'),
|
||||
('print_statistics', BOOL, False, 'print statistics'),
|
||||
('print_aig', SYMBOL, '',
|
||||
'Dump clauses in AIG text format (AAG) to the given file name'),
|
||||
('print_statistics', BOOL, False, 'print statistics'),
|
||||
('tab.selection', SYMBOL, 'weight',
|
||||
'selection method for tabular strategy: weight (default), first, var-use'),
|
||||
('xform.bit_blast', BOOL, False,
|
||||
|
|
|
@ -355,7 +355,7 @@ private:
|
|||
}
|
||||
|
||||
void print_statistics(cmd_context& ctx) {
|
||||
if (m_dl_ctx->get_params().print_statistics()) {
|
||||
if (ctx.params().m_statistics) {
|
||||
statistics st;
|
||||
datalog::context& dlctx = m_dl_ctx->dlctx();
|
||||
dlctx.collect_statistics(st);
|
||||
|
|
|
@ -2683,7 +2683,7 @@ lbool context::solve(unsigned from_lvl)
|
|||
if (m_last_result == l_true) {
|
||||
m_stats.m_cex_depth = get_cex_depth ();
|
||||
}
|
||||
|
||||
|
||||
if (m_params.print_statistics ()) {
|
||||
statistics st;
|
||||
collect_statistics (st);
|
||||
|
@ -3063,13 +3063,13 @@ lbool context::solve_core (unsigned from_lvl)
|
|||
IF_VERBOSE(1,verbose_stream() << "Entering level "<< lvl << "\n";);
|
||||
|
||||
STRACE("spacer_progress", tout << "\n* LEVEL " << lvl << "\n";);
|
||||
|
||||
IF_VERBOSE(1,
|
||||
if (m_params.print_statistics ()) {
|
||||
statistics st;
|
||||
collect_statistics (st);
|
||||
};
|
||||
);
|
||||
|
||||
}
|
||||
// communicate failure to datalog::context
|
||||
if (m_context) { m_context->set_status(datalog::BOUNDED); }
|
||||
|
|
|
@ -483,6 +483,7 @@ public:
|
|||
s2g(m_solver, m_map, m_params, g, m_sat_mc);
|
||||
m_internalized_fmls.reset();
|
||||
g.get_formulas(m_internalized_fmls);
|
||||
TRACE("sat", m_solver.display(tout); tout << m_internalized_fmls << "\n";);
|
||||
m_internalized_converted = true;
|
||||
}
|
||||
|
||||
|
@ -529,7 +530,7 @@ private:
|
|||
throw default_exception("generation of proof objects is not supported in this mode");
|
||||
}
|
||||
SASSERT(!g->proofs_enabled());
|
||||
TRACE("sat", g->display(tout););
|
||||
TRACE("sat", m_solver.display(tout); g->display(tout););
|
||||
try {
|
||||
(*m_preprocess)(g, m_subgoals);
|
||||
}
|
||||
|
@ -712,23 +713,35 @@ private:
|
|||
m_asms.reset();
|
||||
unsigned j = 0;
|
||||
sat::literal lit;
|
||||
sat::literal_set seen;
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
if (dep2asm.find(asms[i], lit)) {
|
||||
SASSERT(lit.var() <= m_solver.num_vars());
|
||||
m_asms.push_back(lit);
|
||||
if (i != j && !m_weights.empty()) {
|
||||
m_weights[j] = m_weights[i];
|
||||
if (!seen.contains(lit)) {
|
||||
m_asms.push_back(lit);
|
||||
seen.insert(lit);
|
||||
if (i != j && !m_weights.empty()) {
|
||||
m_weights[j] = m_weights[i];
|
||||
}
|
||||
++j;
|
||||
}
|
||||
++j;
|
||||
}
|
||||
}
|
||||
for (unsigned i = 0; i < get_num_assumptions(); ++i) {
|
||||
if (dep2asm.find(get_assumption(i), lit)) {
|
||||
SASSERT(lit.var() <= m_solver.num_vars());
|
||||
m_asms.push_back(lit);
|
||||
if (!seen.contains(lit)) {
|
||||
m_asms.push_back(lit);
|
||||
seen.insert(lit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CTRACE("sat", dep2asm.size() != m_asms.size(),
|
||||
tout << dep2asm.size() << " vs " << m_asms.size() << "\n";
|
||||
tout << m_asms << "\n";
|
||||
for (auto const& kv : dep2asm) {
|
||||
tout << mk_pp(kv.m_key, m) << " " << kv.m_value << "\n";
|
||||
});
|
||||
SASSERT(dep2asm.size() == m_asms.size());
|
||||
}
|
||||
|
||||
|
@ -751,6 +764,7 @@ private:
|
|||
tout << mk_pp(kv.m_key, m) << " |-> " << mk_pp(kv.m_value, m) << "\n";
|
||||
}
|
||||
tout << "core: "; for (auto c : core) tout << c << " "; tout << "\n";
|
||||
m_solver.display(tout);
|
||||
);
|
||||
|
||||
m_core.reset();
|
||||
|
|
|
@ -1167,7 +1167,7 @@ struct sat2goal::imp {
|
|||
}
|
||||
|
||||
void operator()(sat::solver & s, atom2bool_var const & map, goal & r, ref<mc> & mc) {
|
||||
if (s.inconsistent()) {
|
||||
if (s.at_base_lvl() && s.inconsistent()) {
|
||||
r.assert_expr(m.mk_false());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -199,6 +199,7 @@ void parse_cmd_line_args(int argc, char ** argv) {
|
|||
}
|
||||
else if (strcmp(opt_name, "st") == 0) {
|
||||
g_display_statistics = true;
|
||||
gparams::set("stats", "true");
|
||||
}
|
||||
else if (strcmp(opt_name, "ist") == 0) {
|
||||
g_display_istatistics = true;
|
||||
|
|
Loading…
Reference in a new issue