3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-22 11:07:51 +00:00

updates to poly

This commit is contained in:
Nikolaj Bjorner 2023-12-15 13:50:26 -08:00
parent cecaf25c6f
commit d48247c5f2
7 changed files with 55 additions and 38 deletions

View file

@ -177,10 +177,9 @@ namespace polysat {
s.set_lemma(m_viable.get_core(), m_viable.explain());
// propagate_unsat_core();
return sat::check_result::CR_CONTINUE;
case find_t::singleton: {
case find_t::singleton:
s.propagate(m_constraints.eq(var2pdd(m_var), m_value), m_viable.explain());
return sat::check_result::CR_CONTINUE;
}
return sat::check_result::CR_CONTINUE;
case find_t::multiple:
s.add_eq_literal(m_var, m_value);
return sat::check_result::CR_CONTINUE;

View file

@ -60,10 +60,10 @@ namespace polysat {
// attributes associated with variables
vector<pdd> m_vars; // for each variable a pdd
vector<rational> m_values; // current value of assigned variable
svector<dependency> m_justification; // justification for assignment
activity m_activity; // activity of variables
var_queue<activity> m_var_queue; // priority queue of variables to assign
vector<unsigned_vector> m_watch; // watch lists for variables for constraints on m_prop_queue where they occur
svector<dependency> m_justification; // justification for assignment
activity m_activity; // activity of variables
var_queue<activity> m_var_queue; // priority queue of variables to assign
vector<unsigned_vector> m_watch; // watch lists for variables for constraints on m_prop_queue where they occur
// values to split on
rational m_value;
@ -101,6 +101,7 @@ namespace polysat {
constraint_id register_constraint(signed_constraint& sc, dependency d);
bool propagate();
void assign_eh(constraint_id idx, bool sign, unsigned level);
pvar next_var() { return m_var_queue.next_var(); }
pdd value(rational const& v, unsigned sz);
pdd subst(pdd const&);

View file

@ -96,7 +96,21 @@ namespace polysat {
}
lbool op_constraint::eval_ashr(pdd const& p, pdd const& q, pdd const& r) {
NOT_IMPLEMENTED_YET();
auto& m = p.manager();
if (r.is_val() && p.is_val() && q.is_val()) {
auto M = m.max_value();
auto N = M + 1;
if (p.val() >= N/2) {
if (q.val() >= m.power_of_2())
return to_lbool(r.val() == M);
unsigned k = q.val().get_unsigned();
return to_lbool(r.val() == p.val() - rational::power_of_two(k));
}
else
return eval_lshr(p, q, r);
}
if (q.is_val() && q.is_zero() && p == r)
return l_true;
return l_undef;
}