3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-04 14:25:46 +00:00

set solver on simplify command

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2016-07-27 15:35:44 -07:00
parent 0997eba700
commit b7de813c63
5 changed files with 48 additions and 3 deletions

View file

@ -24,9 +24,30 @@ Notes:
#include"scoped_timer.h"
#include"scoped_ctrl_c.h"
#include"cancel_eh.h"
#include"seq_rewriter.h"
#include<iomanip>
class simplify_cmd : public parametric_cmd {
class th_solver : public expr_solver {
cmd_context& m_ctx;
params_ref m_params;
ref<solver> m_solver;
public:
th_solver(cmd_context& ctx): m_ctx(ctx) {}
virtual lbool check_sat(expr* e) {
if (!m_solver) {
m_solver = m_ctx.get_solver_factory()(m_ctx.m(), m_params, false, true, false, symbol::null);
}
m_solver->push();
m_solver->assert_expr(e);
lbool r = m_solver->check_sat(0,0);
m_solver->pop(1);
return r;
}
};
expr * m_target;
public:
simplify_cmd(char const * name = "simplify"):parametric_cmd(name) {}
@ -70,10 +91,12 @@ public:
if (m_params.get_bool("som", false))
m_params.set_bool("flat", true);
th_rewriter s(ctx.m(), m_params);
th_solver solver(ctx);
s.set_solver(alloc(th_solver, ctx));
unsigned cache_sz;
unsigned num_steps = 0;
unsigned timeout = m_params.get_uint("timeout", UINT_MAX);
unsigned rlimit = m_params.get_uint("rlimit", UINT_MAX);
unsigned rlimit = m_params.get_uint("rlimit", UINT_MAX);
bool failed = false;
cancel_eh<reslimit> eh(ctx.m().limit());
{