3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 20:05:51 +00:00

Support watching inactive constraints

This allows us to handle non-redundant clauses (like we get from quot_rem)
This commit is contained in:
Jakob Rath 2022-05-27 15:49:54 +02:00
parent 6bf897aad8
commit 2345fb6428
5 changed files with 119 additions and 34 deletions

View file

@ -149,6 +149,7 @@ namespace polysat {
unsigned_vector m_vars;
lbool m_external_sign = l_undef;
bool m_is_active = false;
bool m_is_pwatched = false;
/** The boolean variable associated to this constraint, if any.
* If this is not null_bool_var, then the constraint corresponds to a literal on the assignment stack.
* Convention: the plain constraint corresponds the positive sat::literal.
@ -207,6 +208,9 @@ namespace polysat {
bool is_active() const { return m_is_active; }
void set_active(bool f) { m_is_active = f; }
bool is_pwatched() const { return m_is_pwatched; }
void set_pwatched(bool f) { m_is_pwatched = f; }
/// Assuming the constraint is univariate under the current assignment of 's',
/// adds the constraint to the univariate solver 'us'.
virtual void add_to_univariate_solver(solver& s, univariate_solver& us, unsigned dep, bool is_positive) const = 0;
@ -297,4 +301,15 @@ namespace polysat {
}
};
};
class constraint_pp {
constraint const* c;
lbool status;
public:
constraint_pp(constraint const* c, lbool status): c(c), status(status) {}
std::ostream& display(std::ostream& out) const;
};
inline std::ostream& operator<<(std::ostream& out, constraint_pp const& p) { return p.display(out); }
}