3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-11 09:44:43 +00:00
z3/src/math/polysat/var_constraint.cpp
Jakob Rath f7e476a4a0
Polysat: fixes in solver, forbidden intervals for eq_constraint (#5240)
* Rename to neg_cond

* Add some logging utilities

* Implement case of forbidden interval covering the whole domain

* Implement diseq_narrow

* Do not activate constraint if we are in a conflict state

* comments

* Assert that lemma isn't undefined

* Update revert_decision to work in the case where narrowing causes propagation

* Fix case of non-disjunctive lemma from forbidden intervals

* Conflict should not leak outside user scope

* Add guard to decide(), some notes

* Add test case

* Add constraints to watchlist of unassigned variable during propagation

* Move common propagation functionality into base class

* Combine eq/diseq narrow

* Compute forbidden interval for equality constraints by considering them as p <=u 0 (or p >u 0 for disequalities)
2021-05-03 09:30:17 -07:00

45 lines
914 B
C++

/*++
Copyright (c) 2021 Microsoft Corporation
Module Name:
polysat var_constraint
Author:
Nikolaj Bjorner (nbjorner) 2021-03-19
Jakob Rath 2021-04-6
--*/
#include "math/polysat/var_constraint.h"
#include "math/polysat/solver.h"
namespace polysat {
std::ostream& var_constraint::display(std::ostream& out) const {
return out << "v" << m_var << ": " << m_viable << "\n";
}
constraint* var_constraint::resolve(solver& s, pvar v) {
UNREACHABLE();
return nullptr;
}
bool var_constraint::is_always_false() {
return false;
}
bool var_constraint::is_currently_false(solver& s) {
return s.m_viable[m_var].is_false();
}
bool var_constraint::is_currently_true(solver& s) {
return !s.m_viable[m_var].is_false();
}
void var_constraint::narrow(solver& s) {
s.intersect_viable(m_var, m_viable);
}
}