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

move all saturation functionality into saturation.cpp, differentiate basic multiplication by -1, 1 from other powers of 2.

This commit is contained in:
Nikolaj Bjorner 2023-12-31 14:42:10 -08:00
parent 7bd7faa722
commit 483508d257
6 changed files with 68 additions and 38 deletions

View file

@ -27,13 +27,34 @@ TODO: when we check that 'x' is "unary":
#include "sat/smt/polysat/saturation.h"
#include "sat/smt/polysat/umul_ovfl_constraint.h"
#include "sat/smt/polysat/ule_constraint.h"
#include "util/log.h"
namespace polysat {
saturation::saturation(core& c) : c(c), C(c.cs()) {}
lbool saturation::operator()() {
bool has_conflict = false;
for (auto idx : c.assigned_constraints()) {
auto sc = c.get_constraint(idx);
lbool eval_value = c.eval_unfold(sc);
if (eval_value == l_true)
continue;
TRACE("bv", sc.display(tout << "eval: ") << " evaluates to " << eval_value << "\n");
SASSERT(eval_value != l_undef);
has_conflict = true;
auto vars = c.find_conflict_variables(idx);
for (auto v : vars)
if (resolve(v, idx))
return l_false;
}
if (has_conflict)
return l_undef;
return l_true;
}
bool saturation::resolve(pvar v, constraint_id id) {
if (c.eval_unfold(id) == l_true)
return false;
@ -59,10 +80,6 @@ namespace polysat {
try_ugt_z(v, i);
}
void saturation::propagate(signed_constraint const& sc, std::initializer_list<constraint_id> const& premises) {
// c.propagate(sc, constraint_id_vector(premises));
}
void saturation::add_clause(char const* name, clause const& cs, bool is_redundant) {
vector<constraint_or_dependency> lemma;
for (auto const& e : cs) {