mirror of
https://github.com/Z3Prover/z3
synced 2025-08-22 02:57:50 +00:00
bugfixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
737913b67e
commit
ac8efad7e1
6 changed files with 84 additions and 20 deletions
|
@ -186,10 +186,27 @@ namespace polysat {
|
|||
propagate_assignment(m_var, m_value, d);
|
||||
return sat::check_result::CR_CONTINUE;
|
||||
}
|
||||
case find_t::multiple:
|
||||
case find_t::multiple: {
|
||||
TRACE("bv", tout << "check-multiple v" << m_var << " := " << m_value << "\n");
|
||||
s.add_eq_literal(m_var, m_value);
|
||||
do {
|
||||
dependency d = null_dependency;
|
||||
lbool value = s.add_eq_literal(m_var, m_value, d);
|
||||
switch (value) {
|
||||
case l_true:
|
||||
propagate_assignment(m_var, m_value, d);
|
||||
break;
|
||||
case l_false:
|
||||
m_value = mod(m_value + 1, rational::power_of_two(size(m_var)));
|
||||
continue;
|
||||
default:
|
||||
// let core assign equality.
|
||||
m_var_queue.unassign_var_eh(m_var);
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (false);
|
||||
return sat::check_result::CR_CONTINUE;
|
||||
}
|
||||
case find_t::resource_out:
|
||||
TRACE("bv", tout << "check-resource out v" << m_var << "\n");
|
||||
m_var_queue.unassign_var_eh(m_var);
|
||||
|
@ -206,8 +223,7 @@ namespace polysat {
|
|||
auto [sc, d, value] = m_constraint_index[idx.id];
|
||||
SASSERT(value != l_undef);
|
||||
lbool eval_value = eval(sc);
|
||||
sc.display(verbose_stream()) << " eval: " << eval_value << "\n";
|
||||
CTRACE("bv", eval_value == l_undef, sc.display(tout << "eval: ") << " evaluates to " << eval_value << "\n");
|
||||
CTRACE("bv", eval_value == l_undef, sc.display(tout << "eval: ") << " evaluates to " << eval_value << "\n"; display(tout););
|
||||
SASSERT(eval_value != l_undef);
|
||||
if (eval_value == value)
|
||||
continue;
|
||||
|
|
|
@ -36,7 +36,10 @@ namespace polysat {
|
|||
}
|
||||
|
||||
// p := coeff*x*y where coeff_x = coeff*x, x a variable
|
||||
bool is_coeffxY(pdd const& coeff_x, pdd const& p, pdd& y) const { throw default_exception("nyi"); }
|
||||
bool is_coeffxY(pdd const& x, pdd const& p, pdd& y) const {
|
||||
pdd xy = x.manager().zero();
|
||||
return x.is_unary() && p.try_div(x.hi().val(), xy) && xy.factor(x.var(), 1, y);
|
||||
}
|
||||
|
||||
public:
|
||||
static inequality from_ule(core& c, constraint_id id);
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace polysat {
|
|||
class solver_interface {
|
||||
public:
|
||||
virtual ~solver_interface() {}
|
||||
virtual void add_eq_literal(pvar v, rational const& val) = 0;
|
||||
virtual lbool add_eq_literal(pvar v, rational const& val, dependency& d) = 0;
|
||||
virtual bool add_axiom(char const* name, constraint_or_dependency const* begin, constraint_or_dependency const* end, bool redundant) = 0;
|
||||
virtual void set_conflict(dependency_vector const& core) = 0;
|
||||
virtual dependency propagate(signed_constraint sc, dependency_vector const& deps) = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue