mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 17:45:32 +00:00
use assert instead of explicit check
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
efbb382646
commit
60972de562
3 changed files with 7 additions and 12 deletions
|
@ -62,6 +62,7 @@ namespace polysat {
|
|||
void assign_eh(bool is_true) { m_status = (is_true ^ !m_sign) ? l_true : l_false; }
|
||||
bool is_positive() const { return m_status == l_true; }
|
||||
bool is_negative() const { return m_status == l_false; }
|
||||
bool is_undef() const { return m_status == l_undef; }
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& out, constraint const& c) { return c.display(out); }
|
||||
|
|
|
@ -128,10 +128,7 @@ namespace polysat {
|
|||
if (delta == 0)
|
||||
return;
|
||||
m_vars[v].m_value += delta;
|
||||
if (is_base(v)) {
|
||||
add_patch(v);
|
||||
return;
|
||||
}
|
||||
SASSERT(!is_base(v));
|
||||
|
||||
//
|
||||
// v <- v + delta
|
||||
|
@ -144,9 +141,8 @@ namespace polysat {
|
|||
row r = c.get_row();
|
||||
row_info& ri = m_rows[r.id()];
|
||||
var_t s = ri.m_base;
|
||||
var_info& si = m_vars[s];
|
||||
ri.m_value += delta * c.get_row_entry().m_coeff;
|
||||
si.m_value = 0 - (ri.m_value / ri.m_base_coeff);
|
||||
m_vars[s].m_value = 0 - (ri.m_value / ri.m_base_coeff);
|
||||
add_patch(s);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,12 +109,11 @@ namespace polysat {
|
|||
|
||||
bool ule_constraint::is_always_false(pdd const& lhs, pdd const& rhs) {
|
||||
// TODO: other conditions (e.g. when forbidden interval would be full)
|
||||
VERIFY(!is_undef());
|
||||
if (is_positive())
|
||||
return lhs.is_val() && rhs.is_val() && !(lhs.val() <= rhs.val());
|
||||
if (is_negative())
|
||||
else
|
||||
return lhs.is_val() && rhs.is_val() && !(lhs.val() > rhs.val());
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ule_constraint::is_always_false() {
|
||||
|
@ -130,12 +129,11 @@ namespace polysat {
|
|||
bool ule_constraint::is_currently_true(solver& s) {
|
||||
auto p = lhs().subst_val(s.m_search);
|
||||
auto q = rhs().subst_val(s.m_search);
|
||||
VERIFY(!is_undef());
|
||||
if (is_positive())
|
||||
return p.is_val() && q.is_val() && p.val() <= q.val();
|
||||
if (is_negative())
|
||||
else
|
||||
return p.is_val() && q.is_val() && p.val() > q.val();
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue