3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 11:55:51 +00:00

add some of the SMT2.5 features

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2015-12-02 18:41:10 -08:00
parent 6580f1daf3
commit e2565d8d82
4 changed files with 256 additions and 27 deletions

View file

@ -313,6 +313,7 @@ cmd_context::cmd_context(bool main_ctx, ast_manager * m, symbol const & l):
m_print_success(m_params.m_smtlib2_compliant),
m_random_seed(0),
m_produce_unsat_cores(false),
m_produce_unsat_assumptions(false),
m_produce_assignments(false),
m_status(UNKNOWN),
m_numeral_as_real(false),
@ -831,6 +832,17 @@ void cmd_context::insert(symbol const & s, object_ref * r) {
m_object_refs.insert(s, r);
}
void cmd_context::insert_rec_fun(func_decl* f, expr_ref_vector const& binding, svector<symbol> const& ids, expr* e) {
expr_ref eq(m()), lhs(m());
lhs = m().mk_app(f, binding.size(), binding.c_ptr());
eq = m().mk_eq(lhs, e);
if (!ids.empty()) {
eq = m().mk_forall(ids.size(), f->get_domain(), ids.c_ptr(), eq);
}
warning_msg("recursive functions are currently only partially supported: they are translated into recursive equations without special handling");
// TBD: basic implementation asserts axiom. Life-time of recursive equation follows scopes (unlikely to be what SMT-LIB 2.5 wants).
assert_expr(eq);
}
func_decl * cmd_context::find_func_decl(symbol const & s) const {
builtin_decl d;
@ -1480,6 +1492,24 @@ void cmd_context::check_sat(unsigned num_assumptions, expr * const * assumptions
}
}
void cmd_context::reset_assertions() {
if (m_opt) {
m_opt = 0;
}
if (m_solver) {
m_solver = 0;
mk_solver();
}
restore_assertions(0);
svector<scope>::iterator it = m_scopes.begin();
svector<scope>::iterator end = m_scopes.end();
for (; it != end; ++it) {
it->m_assertions_lim = 0;
if (m_solver) m_solver->push();
}
}
void cmd_context::display_model(model_ref& mdl) {
if (mdl) {
model_params p;
@ -1672,6 +1702,7 @@ void cmd_context::display_statistics(bool show_total_time, double total_time) {
st.display_smt2(regular_stream());
}
void cmd_context::display_assertions() {
if (!m_interactive_mode)
throw cmd_exception("command is only available in interactive mode, use command (set-option :interactive-mode true)");