mirror of
https://github.com/Z3Prover/z3
synced 2025-09-05 17:47:41 +00:00
Merge remote-tracking branch 'Z3Prover/polysat' into polysat
This commit is contained in:
commit
74ec28201e
41 changed files with 2206 additions and 661 deletions
|
@ -135,8 +135,8 @@ namespace {
|
|||
|
||||
namespace polysat {
|
||||
|
||||
ule_constraint::ule_constraint(constraint_manager& m, pdd const& l, pdd const& r) :
|
||||
constraint(m, ckind_t::ule_t), m_lhs(l), m_rhs(r) {
|
||||
ule_constraint::ule_constraint(pdd const& l, pdd const& r) :
|
||||
constraint(ckind_t::ule_t), m_lhs(l), m_rhs(r) {
|
||||
|
||||
m_vars.append(m_lhs.free_vars());
|
||||
for (auto v : m_rhs.free_vars())
|
||||
|
@ -185,9 +185,9 @@ namespace polysat {
|
|||
signed_constraint sc(this, is_positive);
|
||||
|
||||
LOG_H3("Narrowing " << sc);
|
||||
LOG_V("Assignment: " << assignments_pp(s));
|
||||
LOG_V("Substituted LHS: " << lhs() << " := " << p);
|
||||
LOG_V("Substituted RHS: " << rhs() << " := " << q);
|
||||
LOG_V(10, "Assignment: " << assignments_pp(s));
|
||||
LOG_V(10, "Substituted LHS: " << lhs() << " := " << p);
|
||||
LOG_V(10, "Substituted RHS: " << rhs() << " := " << q);
|
||||
|
||||
if (is_always_false(is_positive, p, q)) {
|
||||
s.set_conflict(sc);
|
||||
|
@ -353,9 +353,16 @@ namespace polysat {
|
|||
return other.is_ule() && lhs() == other.to_ule().lhs() && rhs() == other.to_ule().rhs();
|
||||
}
|
||||
|
||||
void ule_constraint::add_to_univariate_solver(solver& s, univariate_solver& us, unsigned dep, bool is_positive) const {
|
||||
auto p_coeff = s.subst(lhs()).get_univariate_coefficients();
|
||||
auto q_coeff = s.subst(rhs()).get_univariate_coefficients();
|
||||
us.add_ule(p_coeff, q_coeff, !is_positive, dep);
|
||||
void ule_constraint::add_to_univariate_solver(pvar v, solver& s, univariate_solver& us, unsigned dep, bool is_positive) const {
|
||||
pdd p = s.subst(lhs());
|
||||
pdd q = s.subst(rhs());
|
||||
bool p_ok = p.is_univariate_in(v);
|
||||
bool q_ok = q.is_univariate_in(v);
|
||||
if (!is_positive && !q_ok) // add p > 0
|
||||
us.add_ugt(p.get_univariate_coefficients(), rational::zero(), false, dep);
|
||||
if (!is_positive && !p_ok) // add -1 > q <==> q+1 > 0
|
||||
us.add_ugt((q + 1).get_univariate_coefficients(), rational::zero(), false, dep);
|
||||
if (p_ok && q_ok)
|
||||
us.add_ule(p.get_univariate_coefficients(), q.get_univariate_coefficients(), !is_positive, dep);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue