3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-23 11:37:54 +00:00

integrating int-blaster

This commit is contained in:
Nikolaj Bjorner 2023-12-10 19:55:25 -08:00
parent d72938ba9a
commit a5491804c7
13 changed files with 209 additions and 69 deletions

View file

@ -1,4 +1,4 @@
/*++
/*++
Copyright (c) 2021 Microsoft Corporation
Module Name:
@ -12,6 +12,7 @@ Author:
--*/
#include "util/log.h"
#include "sat/smt/polysat/polysat_core.h"
#include "sat/smt/polysat/polysat_constraints.h"
#include "sat/smt/polysat/polysat_ule.h"
@ -23,16 +24,34 @@ namespace polysat {
pdd lhs = p, rhs = q;
bool is_positive = true;
ule_constraint::simplify(is_positive, lhs, rhs);
auto* c = alloc(ule_constraint, p, q);
m_trail.push(new_obj_trail(c));
auto sc = signed_constraint(ckind_t::ule_t, c);
auto* cnstr = alloc(ule_constraint, p, q);
c.trail().push(new_obj_trail(cnstr));
auto sc = signed_constraint(ckind_t::ule_t, cnstr);
return is_positive ? sc : ~sc;
}
signed_constraint constraints::umul_ovfl(pdd const& p, pdd const& q) {
auto* c = alloc(umul_ovfl_constraint, p, q);
m_trail.push(new_obj_trail(c));
return signed_constraint(ckind_t::umul_ovfl_t, c);
auto* cnstr = alloc(umul_ovfl_constraint, p, q);
c.trail().push(new_obj_trail(cnstr));
return signed_constraint(ckind_t::umul_ovfl_t, cnstr);
}
bool signed_constraint::is_eq(pvar& v, rational& val) {
if (m_sign)
return false;
if (!is_ule())
return false;
auto const& ule = to_ule();
auto const& l = ule.lhs(), &r = ule.rhs();
if (!r.is_zero())
return false;
if (!l.is_unilinear())
return false;
if (!l.hi().is_one())
return false;
v = l.var();
val = -l.lo().val();
return true;
}
lbool signed_constraint::eval(assignment& a) const {
@ -44,4 +63,11 @@ namespace polysat {
if (m_sign) out << "~";
return out << *m_constraint;
}
bool signed_constraint::is_always_true() const {
return m_sign ? m_constraint->is_always_false() : m_constraint->is_always_true();
}
bool signed_constraint::is_always_false() const {
return m_sign ? m_constraint->is_always_true() : m_constraint->is_always_false();
}
}