3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-12 14:10:54 +00:00

add rewrites for moduli as exercised in example from #2319

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-11-24 19:02:28 -08:00
parent fad4356159
commit 84025d5c11
4 changed files with 61 additions and 39 deletions

View file

@ -84,10 +84,8 @@ bound_propagator::~bound_propagator() {
}
void bound_propagator::del_constraints_core() {
constraint_vector::iterator it = m_constraints.begin();
constraint_vector::iterator end = m_constraints.end();
for (; it != end; ++it) {
del_constraint(*it);
for (auto & c : m_constraints) {
del_constraint(c);
}
m_constraints.reset();
}
@ -98,10 +96,9 @@ void bound_propagator::del_constraints() {
return;
del_constraints_core();
m_constraints.finalize();
vector<wlist>::iterator it = m_watches.begin();
vector<wlist>::iterator end = m_watches.end();
for (; it != end; ++it)
it->finalize();
for (auto& wl : m_watches) {
wl.finalize();
}
}
void bound_propagator::del_constraint(constraint & c) {
@ -164,10 +161,8 @@ void bound_propagator::del_var(var x) {
m_dead[x] = true;
// mark constraints containing x as dead.
wlist & wl = m_watches[x];
wlist::iterator it = wl.begin();
wlist::iterator end = wl.end();
for (; it != end; ++it) {
m_constraints[*it].m_dead = true;
for (auto c : wl) {
m_constraints[c].m_dead = true;
}
}
@ -473,10 +468,7 @@ void bound_propagator::propagate() {
TRACE("bound_propagator_detail", tout << "propagating x" << x << "\n";);
m_qhead++;
wlist const & wl = m_watches[x];
wlist::const_iterator it = wl.begin();
wlist::const_iterator end = wl.end();
for (; it != end; ++it) {
unsigned c_idx = *it;
for (unsigned c_idx : wl) {
constraint & c = m_constraints[c_idx];
// We don't need to visit c if it was already propagated using b.
// Whenever we visit c we store in c.m_timestamp the current timestamp
@ -490,10 +482,8 @@ void bound_propagator::propagate() {
}
}
unsigned_vector::iterator it = m_to_reset_ts.begin();
unsigned_vector::iterator end = m_to_reset_ts.end();
for (; it != end; ++it)
m_constraints[*it].m_timestamp = 0;
for (unsigned c : m_to_reset_ts)
m_constraints[c].m_timestamp = 0;
}
bool bound_propagator::propagate(unsigned c_idx) {
@ -936,10 +926,7 @@ void bound_propagator::display_bounds(std::ostream & out, bool approx, bool prec
}
void bound_propagator::display_constraints(std::ostream & out) const {
constraint_vector::const_iterator it = m_constraints.begin();
constraint_vector::const_iterator end = m_constraints.end();
for (; it != end; ++it) {
constraint const & c = *it;
for (constraint const& c : m_constraints) {
if (c.m_kind == LINEAR) {
m_eq_manager.display(out, *(c.m_eq));
out << "\n";