mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
move qhead to attribute on the state instead of the simplifier,
- add sat.smt option to enable the new incremental core (it is not ready for mainstream consumption as cloning and other features are not implemented and it hasn't been tested in any detail yet). - move "name" into attribute on simplifier so it can be reused for diagnostics by the seq-simplifier.
This commit is contained in:
parent
ac023935a3
commit
dd1ca8f6bd
37 changed files with 132 additions and 85 deletions
|
@ -47,6 +47,7 @@ def_module_params('sat',
|
|||
('threads', UINT, 1, 'number of parallel threads to use'),
|
||||
('dimacs.core', BOOL, False, 'extract core from DIMACS benchmarks'),
|
||||
('drat.disable', BOOL, False, 'override anything that enables DRAT'),
|
||||
('smt', BOOL, False, 'use the SAT solver based incremental SMT core'),
|
||||
('smt.proof.check', BOOL, False, 'check SMT proof while it is created'),
|
||||
('smt.proof.check_rup', BOOL, True, 'apply forward RUP proof checking'),
|
||||
('drat.file', SYMBOL, '', 'file to dump DRAT proofs'),
|
||||
|
@ -73,11 +74,11 @@ def_module_params('sat',
|
|||
('local_search_mode', SYMBOL, 'wsat', 'local search algorithm, either default wsat or qsat'),
|
||||
('local_search_dbg_flips', BOOL, False, 'write debug information for number of flips'),
|
||||
('binspr', BOOL, False, 'enable SPR inferences of binary propagation redundant clauses. This inprocessing step eliminates models'),
|
||||
('anf', BOOL, False, 'enable ANF based simplification in-processing'),
|
||||
('anf.delay', UINT, 2, 'delay ANF simplification by in-processing round'),
|
||||
('anf', BOOL, False, 'enable ANF based simplification in-processing'),
|
||||
('anf.delay', UINT, 2, 'delay ANF simplification by in-processing round'),
|
||||
('anf.exlin', BOOL, False, 'enable extended linear simplification'),
|
||||
('cut', BOOL, False, 'enable AIG based simplification in-processing'),
|
||||
('cut.delay', UINT, 2, 'delay cut simplification by in-processing round'),
|
||||
('cut', BOOL, False, 'enable AIG based simplification in-processing'),
|
||||
('cut.delay', UINT, 2, 'delay cut simplification by in-processing round'),
|
||||
('cut.aig', BOOL, False, 'extract aigs (and ites) from cluases for cut simplification'),
|
||||
('cut.lut', BOOL, False, 'extract luts from clauses for cut simplification'),
|
||||
('cut.xor', BOOL, False, 'extract xors from clauses for cut simplification'),
|
||||
|
|
|
@ -44,7 +44,7 @@ void init_preprocess(ast_manager& m, params_ref const& p, seq_simplifier& s, dep
|
|||
simp2_p.set_bool("flat_and_or", false);
|
||||
|
||||
sat_params sp(p);
|
||||
if (sp.euf()) {
|
||||
if (sp.euf() || sp.smt()) {
|
||||
s.add_simplifier(alloc(rewriter_simplifier, m, p, st));
|
||||
s.add_simplifier(alloc(propagate_values, m, p, st));
|
||||
//
|
||||
|
|
|
@ -130,7 +130,7 @@ class sat_smt_solver : public solver {
|
|||
trail_stack& m_trail;
|
||||
dependency2assumptions m_dep;
|
||||
goal2sat m_goal2sat;
|
||||
expr_ref_vector m_assumptions, m_core, m_ors, m_aux_fmls;
|
||||
expr_ref_vector m_assumptions, m_core, m_ors, m_aux_fmls, m_internalized_fmls;
|
||||
atom2bool_var m_map;
|
||||
generic_model_converter_ref m_mc;
|
||||
unsigned m_mc_size = 0;
|
||||
|
@ -140,9 +140,8 @@ class sat_smt_solver : public solver {
|
|||
// access formulas after they have been pre-processed and handled by the sat solver.
|
||||
// this allows to access the internal state of the SAT solver and carry on partial results.
|
||||
bool m_internalized_converted = false; // have internalized formulas been converted back
|
||||
expr_ref_vector m_internalized_fmls; // formulas in internalized format
|
||||
|
||||
bool is_internalized() const { return m_preprocess.qhead() == m_fmls.size(); }
|
||||
bool is_internalized() const { return m_preprocess_state.qhead() == m_fmls.size(); }
|
||||
|
||||
public:
|
||||
sat_smt_solver(ast_manager& m, params_ref const& p):
|
||||
|
@ -152,16 +151,12 @@ public:
|
|||
m_trail(m_preprocess_state.m_trail),
|
||||
m_dep(m, m_trail),
|
||||
m_solver(p, m.limit()),
|
||||
m_assumptions(m),
|
||||
m_core(m),
|
||||
m_ors(m),
|
||||
m_aux_fmls(m),
|
||||
m_assumptions(m), m_core(m), m_ors(m), m_aux_fmls(m), m_internalized_fmls(m),
|
||||
m_map(m),
|
||||
m_internalized_fmls(m) {
|
||||
m_mc(alloc(generic_model_converter, m, "sat-smt-solver")) {
|
||||
updt_params(p);
|
||||
init_preprocess();
|
||||
m_solver.set_incremental(true);
|
||||
m_mc = alloc(generic_model_converter, m, "sat-smt-solver");
|
||||
}
|
||||
|
||||
solver* translate(ast_manager& dst_m, params_ref const& p) override {
|
||||
|
@ -214,7 +209,7 @@ public:
|
|||
expr_ref_vector assumptions(m);
|
||||
for (unsigned i = 0; i < sz; ++i)
|
||||
assumptions.push_back(ensure_literal(_assumptions[i]));
|
||||
TRACE("sat", tout << _assumptions << "\n";);
|
||||
TRACE("sat", tout << assumptions << "\n";);
|
||||
lbool r = internalize_formulas();
|
||||
if (r != l_true)
|
||||
return r;
|
||||
|
@ -267,8 +262,7 @@ public:
|
|||
}
|
||||
|
||||
void pop(unsigned n) override {
|
||||
if (n > m_trail.get_num_scopes()) // allow inc_sat_solver to
|
||||
n = m_trail.get_num_scopes(); // take over for another solver.
|
||||
n = std::min(n, m_trail.get_num_scopes()); // allow sat_smt_solver to take over for another solver.
|
||||
|
||||
m_preprocess.pop(n);
|
||||
m_preprocess_state.pop(n);
|
||||
|
@ -357,7 +351,7 @@ public:
|
|||
m_solver.updt_params(m_params);
|
||||
m_solver.set_incremental(true);
|
||||
m_preprocess.updt_params(m_params);
|
||||
if (sp.euf())
|
||||
if (sp.smt())
|
||||
ensure_euf();
|
||||
}
|
||||
|
||||
|
@ -537,7 +531,7 @@ public:
|
|||
|
||||
void convert_internalized() {
|
||||
m_solver.pop_to_base_level();
|
||||
if (!is_internalized() && m_preprocess.qhead() > 0)
|
||||
if (!is_internalized() && m_preprocess_state.qhead() > 0)
|
||||
internalize_formulas();
|
||||
if (!is_internalized() || m_internalized_converted)
|
||||
return;
|
||||
|
@ -623,15 +617,19 @@ private:
|
|||
if (is_internalized())
|
||||
return l_true;
|
||||
|
||||
unsigned qhead = m_preprocess.qhead();
|
||||
unsigned qhead = m_preprocess_state.qhead();
|
||||
m_trail.push(restore_vector(m_assumptions));
|
||||
m_trail.push(restore_vector(m_fmls));
|
||||
m_trail.push(value_trail(m_mc_size));
|
||||
TRACE("sat", tout << "qhead " << qhead << "\n");
|
||||
|
||||
m_internalized_converted = false;
|
||||
|
||||
m_preprocess_state.replay(qhead);
|
||||
m_preprocess.reduce();
|
||||
if (!m.inc())
|
||||
return l_undef;
|
||||
m_preprocess_state.advance_qhead();
|
||||
m_preprocess_state.append(*m_mc);
|
||||
m_solver.pop_to_base_level();
|
||||
m_aux_fmls.reset();
|
||||
|
@ -695,7 +693,7 @@ private:
|
|||
mdl = nullptr;
|
||||
if (!m_solver.model_is_current())
|
||||
return;
|
||||
if (m_fmls.size() > m_preprocess.qhead())
|
||||
if (m_fmls.size() > m_preprocess_state.qhead())
|
||||
return;
|
||||
TRACE("sat", m_solver.display_model(tout););
|
||||
CTRACE("sat", m_sat_mc, m_sat_mc->display(tout););
|
||||
|
|
|
@ -629,7 +629,7 @@ namespace q {
|
|||
|
||||
void mbqi::init_solver() {
|
||||
if (!m_solver)
|
||||
m_solver = mk_smt2_solver(m, m_no_drat_params);
|
||||
m_solver = mk_smt2_solver(m, m_no_drat_params, symbol::null);
|
||||
}
|
||||
|
||||
void mbqi::init_search() {
|
||||
|
|
|
@ -99,7 +99,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
|
|||
sat_params sp(p);
|
||||
m_ite_extra = p.get_bool("ite_extra", true);
|
||||
m_max_memory = megabytes_to_bytes(p.get_uint("max_memory", UINT_MAX));
|
||||
m_euf = sp.euf();
|
||||
m_euf = sp.euf() || sp.smt();
|
||||
}
|
||||
|
||||
void throw_op_not_handled(std::string const& s) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue