mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
enable concurrent sls with new solver core
allow using sls engine (for bit-vectors) with the new core. Examples z3 sat.smt=true tactic.default_tactic=smt /v:1 smt.sls.enable=true smt.bv.solver=0 /st C:\QF_BV_SAT\bench_10.smt2 z3 sat.smt=true tactic.default_tactic=smt /v:1 smt.sls.enable=true smt.bv.solver=2 /st C:\QF_BV_SAT\bench_10.smt2 z3 C:\QF_BV_SAT\bench_11100.smt2 sat.smt=true tactic.default_tactic=smt /v:1 smt.sls.enable=true smt.bv.solver=2 /st
This commit is contained in:
parent
510534dbd4
commit
c0bdc7cdd6
19 changed files with 206 additions and 83 deletions
|
@ -93,6 +93,18 @@ namespace bv {
|
|||
|
||||
if (m_to_repair.empty())
|
||||
return;
|
||||
|
||||
// add fresh units, if any
|
||||
bool new_assertion = false;
|
||||
while (m_get_unit) {
|
||||
auto e = m_get_unit();
|
||||
if (!e)
|
||||
break;
|
||||
new_assertion = true;
|
||||
assert_expr(e);
|
||||
}
|
||||
if (new_assertion)
|
||||
init();
|
||||
|
||||
std::function<bool(expr*, unsigned)> eval = [&](expr* e, unsigned i) {
|
||||
unsigned id = e->get_id();
|
||||
|
@ -212,9 +224,7 @@ namespace bv {
|
|||
void sls::try_repair_down(app* e) {
|
||||
unsigned n = e->get_num_args();
|
||||
if (n == 0) {
|
||||
m_eval.commit_eval(e);
|
||||
|
||||
IF_VERBOSE(3, verbose_stream() << "done\n");
|
||||
m_eval.commit_eval(e);
|
||||
for (auto p : m_terms.parents(e))
|
||||
m_repair_up.insert(p->get_id());
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace bv {
|
|||
sls_engine m_engine;
|
||||
bool m_engine_model = false;
|
||||
bool m_engine_init = false;
|
||||
std::function<expr_ref()> m_get_unit;
|
||||
|
||||
std::pair<bool, app*> next_to_repair();
|
||||
|
||||
|
@ -81,7 +82,6 @@ namespace bv {
|
|||
|
||||
/*
|
||||
* Invoke init after all expressions are asserted.
|
||||
* No other expressions can be asserted after init.
|
||||
*/
|
||||
void init();
|
||||
|
||||
|
@ -91,6 +91,11 @@ namespace bv {
|
|||
*/
|
||||
void init_eval(std::function<bool(expr*, unsigned)>& eval);
|
||||
|
||||
/**
|
||||
* add callback to retrieve new units
|
||||
*/
|
||||
void init_unit(std::function<expr_ref()> get_unit) { m_get_unit = get_unit; }
|
||||
|
||||
/**
|
||||
* Run (bounded) local search to find feasible assignments.
|
||||
*/
|
||||
|
|
|
@ -58,16 +58,16 @@ namespace bv {
|
|||
expr* t, * s;
|
||||
rational v;
|
||||
if (bv.is_concat(e, t, s)) {
|
||||
auto& val = wval(s);
|
||||
if (val.lo() != val.hi() && (val.lo() < val.hi() || val.hi() == 0))
|
||||
auto& vals = wval(s);
|
||||
if (vals.lo() != vals.hi() && (vals.lo() < vals.hi() || vals.hi() == 0))
|
||||
// lo <= e
|
||||
add_range(e, val.lo(), rational::zero(), false);
|
||||
add_range(e, vals.lo(), rational::zero(), false);
|
||||
auto valt = wval(t);
|
||||
#if 0
|
||||
if (val.lo() < val.hi())
|
||||
// e < (2^|s|) * hi
|
||||
add_range(e, rational::zero(), val.hi() * rational::power_of_two(bv.get_bv_size(s)), false);
|
||||
#endif
|
||||
if (valt.lo() != valt.hi() && (valt.lo() < valt.hi() || valt.hi() == 0)) {
|
||||
// (2^|s|) * lo <= e < (2^|s|) * hi
|
||||
auto p = rational::power_of_two(bv.get_bv_size(s));
|
||||
add_range(e, valt.lo() * p, valt.hi() * p, false);
|
||||
}
|
||||
}
|
||||
else if (bv.is_bv_add(e, s, t) && bv.is_numeral(s, v)) {
|
||||
auto& val = wval(t);
|
||||
|
|
|
@ -206,6 +206,7 @@ namespace bv {
|
|||
m_todo.push_back(arg);
|
||||
}
|
||||
// populate parents
|
||||
m_parents.reset();
|
||||
m_parents.reserve(m_terms.size());
|
||||
for (expr* e : m_terms) {
|
||||
if (!e || !is_app(e))
|
||||
|
@ -213,6 +214,7 @@ namespace bv {
|
|||
for (expr* arg : *to_app(e))
|
||||
m_parents[arg->get_id()].push_back(e);
|
||||
}
|
||||
m_assertion_set.reset();
|
||||
for (auto a : m_assertions)
|
||||
m_assertion_set.insert(a->get_id());
|
||||
}
|
||||
|
|
|
@ -245,6 +245,7 @@ namespace bv {
|
|||
}
|
||||
|
||||
bool sls_valuation::set_random_at_most(bvect const& src, random_gen& r) {
|
||||
m_tmp.set_bw(bw);
|
||||
if (!get_at_most(src, m_tmp))
|
||||
return false;
|
||||
|
||||
|
@ -639,6 +640,14 @@ namespace bv {
|
|||
|
||||
if (has_range() && !in_range(m_bits))
|
||||
m_bits = m_lo;
|
||||
|
||||
if (mod(lo() + 1, rational::power_of_two(bw)) == hi())
|
||||
for (unsigned i = 0; i < nw; ++i)
|
||||
fixed[i] = ~0;
|
||||
if (lo() < hi() && hi() < rational::power_of_two(bw - 1))
|
||||
for (unsigned i = 0; i < bw; ++i)
|
||||
if (hi() < rational::power_of_two(i))
|
||||
fixed.set(i, true);
|
||||
|
||||
SASSERT(well_formed());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue