mirror of
https://github.com/Z3Prover/z3
synced 2025-05-04 06:15:46 +00:00
Simplify constraint evaluation
This commit is contained in:
parent
e4999b07aa
commit
fdc186b204
10 changed files with 95 additions and 113 deletions
|
@ -83,12 +83,18 @@ namespace polysat {
|
|||
virtual std::ostream& display(std::ostream& out, lbool status) const = 0;
|
||||
virtual std::ostream& display(std::ostream& out) const = 0;
|
||||
|
||||
virtual bool is_always_false(bool is_positive) const = 0;
|
||||
bool is_currently_false(solver& s, bool is_positive) const;
|
||||
virtual bool is_currently_false(assignment const& a, bool is_positive) const = 0;
|
||||
bool is_always_true(bool is_positive) const { return is_always_false(!is_positive); }
|
||||
bool is_currently_true(solver& s, bool is_positive) const { return is_currently_false(s, !is_positive); }
|
||||
bool is_currently_true(assignment const& a, bool is_positive) const { return is_currently_false(a, !is_positive); }
|
||||
/** Evaluate the positive-polarity constraint under the empty assignment */
|
||||
virtual lbool eval() const = 0;
|
||||
/** Evaluate the positive-polarity constraint under the given assignment */
|
||||
virtual lbool eval(assignment const& a) const = 0;
|
||||
/** Evaluate the positive-polarity constraint under the solver's current assignment */
|
||||
lbool eval(solver const& s) const;
|
||||
bool is_always_true(bool is_positive) const { return eval() == to_lbool(is_positive); }
|
||||
bool is_always_false(bool is_positive) const { return is_always_true(!is_positive); }
|
||||
bool is_currently_true(assignment const& a, bool is_positive) const { return eval(a) == to_lbool(is_positive); }
|
||||
bool is_currently_false(assignment const& a, bool is_positive) const { return is_currently_true(a, !is_positive); }
|
||||
bool is_currently_true(solver const& s, bool is_positive) const { return eval(s) == to_lbool(is_positive); }
|
||||
bool is_currently_false(solver const& s, bool is_positive) const { return is_currently_true(s, !is_positive); }
|
||||
|
||||
virtual void narrow(solver& s, bool is_positive, bool first) = 0;
|
||||
virtual inequality as_inequality(bool is_positive) const = 0;
|
||||
|
@ -147,12 +153,18 @@ namespace polysat {
|
|||
bool is_positive() const { return m_positive; }
|
||||
bool is_negative() const { return !is_positive(); }
|
||||
|
||||
/** Evaluate the constraint under the empty assignment */
|
||||
lbool eval() const { return is_positive() ? get()->eval() : ~get()->eval(); }
|
||||
/** Evaluate the constraint under the given assignment */
|
||||
lbool eval(assignment const& a) const { return is_positive() ? get()->eval(a) : ~get()->eval(a); }
|
||||
/** Evaluate the constraint under the solver's current assignment */
|
||||
lbool eval(solver const& s) const { return is_positive() ? get()->eval(s) : ~get()->eval(s); }
|
||||
bool is_always_false() const { return get()->is_always_false(is_positive()); }
|
||||
bool is_always_true() const { return get()->is_always_false(is_negative()); }
|
||||
bool is_currently_false(solver& s) const { return get()->is_currently_false(s, is_positive()); }
|
||||
bool is_currently_true(solver& s) const { return get()->is_currently_false(s, is_negative()); }
|
||||
bool is_always_true() const { return get()->is_always_true(is_positive()); }
|
||||
bool is_currently_false(assignment const& a) const { return get()->is_currently_false(a, is_positive()); }
|
||||
bool is_currently_true(assignment const& a) const { return get()->is_currently_false(a, is_negative()); }
|
||||
bool is_currently_true(assignment const& a) const { return get()->is_currently_true(a, is_positive()); }
|
||||
bool is_currently_false(solver const& s) const { return get()->is_currently_false(s, is_positive()); }
|
||||
bool is_currently_true(solver const& s) const { return get()->is_currently_true(s, is_positive()); }
|
||||
lbool bvalue(solver& s) const;
|
||||
void narrow(solver& s, bool first) { get()->narrow(s, is_positive(), first); }
|
||||
inequality as_inequality() const { return get()->as_inequality(is_positive()); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue