diff --git a/src/cmd_context/context_params.cpp b/src/cmd_context/context_params.cpp index dc3880674..c0ab1e3e2 100644 --- a/src/cmd_context/context_params.cpp +++ b/src/cmd_context/context_params.cpp @@ -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); } diff --git a/src/cmd_context/context_params.h b/src/cmd_context/context_params.h index 8ca36dfc9..f00d39641 100644 --- a/src/cmd_context/context_params.h +++ b/src/cmd_context/context_params.h @@ -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(); diff --git a/src/muz/base/bind_variables.cpp b/src/muz/base/bind_variables.cpp index cbafc57b0..1e918b172 100644 --- a/src/muz/base/bind_variables.cpp +++ b/src/muz/base/bind_variables.cpp @@ -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. diff --git a/src/muz/base/fp_params.pyg b/src/muz/base/fp_params.pyg index dea7ad328..8cee99540 100644 --- a/src/muz/base/fp_params.pyg +++ b/src/muz/base/fp_params.pyg @@ -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, diff --git a/src/muz/fp/dl_cmds.cpp b/src/muz/fp/dl_cmds.cpp index 6fa4b39c4..231dca0d3 100644 --- a/src/muz/fp/dl_cmds.cpp +++ b/src/muz/fp/dl_cmds.cpp @@ -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); diff --git a/src/muz/spacer/spacer_context.cpp b/src/muz/spacer/spacer_context.cpp index 693812a31..f0e86f1a5 100644 --- a/src/muz/spacer/spacer_context.cpp +++ b/src/muz/spacer/spacer_context.cpp @@ -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); } diff --git a/src/sat/sat_solver/inc_sat_solver.cpp b/src/sat/sat_solver/inc_sat_solver.cpp index 8b7e2e63c..ff55598c2 100644 --- a/src/sat/sat_solver/inc_sat_solver.cpp +++ b/src/sat/sat_solver/inc_sat_solver.cpp @@ -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(); diff --git a/src/sat/tactic/goal2sat.cpp b/src/sat/tactic/goal2sat.cpp index 029ddf924..7faa89370 100644 --- a/src/sat/tactic/goal2sat.cpp +++ b/src/sat/tactic/goal2sat.cpp @@ -1167,7 +1167,7 @@ struct sat2goal::imp { } void operator()(sat::solver & s, atom2bool_var const & map, goal & r, ref & mc) { - if (s.inconsistent()) { + if (s.at_base_lvl() && s.inconsistent()) { r.assert_expr(m.mk_false()); return; } diff --git a/src/shell/main.cpp b/src/shell/main.cpp index f6c809bb2..bb1c19b47 100644 --- a/src/shell/main.cpp +++ b/src/shell/main.cpp @@ -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;