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

fixes to reset

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-12-28 15:31:20 -08:00
parent 36b2e7f0fc
commit 1fd4c91fbf
6 changed files with 98 additions and 26 deletions

View file

@ -240,17 +240,25 @@ namespace dd {
equation_vector trivial;
unsigned j = 0;
for (equation* src : linear) {
equation_vector const& uses = use_list[src->poly().var()];
unsigned v = src->poly().var();
equation_vector const& uses = use_list[v];
TRACE("grobner",
display(tout << "uses of: ", *src) << "\n";
for (equation* e : uses) {
display(tout, *e) << "\n";
});
bool changed_leading_term;
bool all_reduced = true;
for (equation* dst : uses) {
if (src == dst || is_trivial(*dst)) {
continue;
}
if (!src->poly().is_binary() && !dst->poly().is_linear()) {
pdd q = dst->poly();
if (!src->poly().is_binary() && !q.is_linear()) {
all_reduced = false;
continue;
}
remove_from_use(dst, use_list, v);
simplify_using(*dst, *src, changed_leading_term);
if (is_trivial(*dst)) {
trivial.push_back(dst);
@ -264,6 +272,9 @@ namespace dd {
pop_equation(dst);
push_equation(to_simplify, dst);
}
// v has been eliminated.
SASSERT(!m.free_vars(dst->poly()).contains(v));
add_to_use(dst, use_list);
}
if (all_reduced) {
linear[j++] = src;
@ -466,6 +477,16 @@ namespace dd {
}
}
void grobner::remove_from_use(equation* e, use_list_t& use_list, unsigned except_v) {
unsigned_vector const& fv = m.free_vars(e->poly());
for (unsigned v : fv) {
if (v != except_v) {
use_list.reserve(v + 1);
use_list[v].erase(e);
}
}
}
grobner::use_list_t grobner::get_use_list() {
use_list_t use_list;
for (equation * e : m_to_simplify) {
@ -823,6 +844,15 @@ namespace dd {
}
}
if (!head_vars.empty()) {
for (auto * e : m_to_simplify) {
for (auto v : m.free_vars(e->poly())) VERIFY(!head_vars.contains(v));
}
for (auto * e : m_processed) {
for (auto v : m.free_vars(e->poly())) VERIFY(!head_vars.contains(v));
}
}
// equations in to_simplify have correct indices
// they are labeled as non-processed
// their top-most variable is watched

View file

@ -168,6 +168,7 @@ private:
use_list_t get_use_list();
void add_to_use(equation* e, use_list_t& use_list);
void remove_from_use(equation* e, use_list_t& use_list);
void remove_from_use(equation* e, use_list_t& use_list, unsigned except_v);
bool simplify_cc_step();
bool simplify_elim_pure_step();