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

add limit checks in Grobner. Issue #599

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2016-05-15 11:34:48 -07:00
parent c35e1c9852
commit 42726171b5
4 changed files with 45 additions and 16 deletions

View file

@ -670,7 +670,7 @@ grobner::equation * grobner::simplify(equation const * source, equation * target
simplify(target);
}
}
while (simplified);
while (simplified && !m_manager.canceled());
TRACE("grobner", tout << "result: "; display_equation(tout, *target););
return result ? target : 0;
}
@ -697,7 +697,10 @@ grobner::equation * grobner::simplify_using_processed(equation * eq) {
simplified = true;
eq = new_eq;
}
}
if (m_manager.canceled()) {
return 0;
}
}
}
while (simplified);
TRACE("grobner", tout << "simplification result: "; display_equation(tout, *eq););
@ -749,13 +752,13 @@ grobner::equation * grobner::pick_next() {
/**
\brief Use the given equation to simplify processed terms.
*/
void grobner::simplify_processed(equation * eq) {
bool grobner::simplify_processed(equation * eq) {
ptr_buffer<equation> to_insert;
ptr_buffer<equation> to_remove;
ptr_buffer<equation> to_delete;
equation_set::iterator it = m_processed.begin();
equation_set::iterator end = m_processed.end();
for (; it != end; ++it) {
for (; it != end && !m_manager.canceled(); ++it) {
equation * curr = *it;
m_changed_leading_term = false;
// if the leading term is simplified, then the equation has to be moved to m_to_process
@ -795,6 +798,7 @@ void grobner::simplify_processed(equation * eq) {
end1 = to_delete.end();
for (; it1 != end1; ++it1)
del_equation(*it1);
return !m_manager.canceled();
}
/**
@ -944,7 +948,8 @@ bool grobner::compute_basis_step() {
m_equations_to_unfreeze.push_back(eq);
eq = new_eq;
}
simplify_processed(eq);
if (m_manager.canceled()) return false;
if (!simplify_processed(eq)) return false;
superpose(eq);
m_processed.insert(eq);
simplify_to_process(eq);
@ -954,7 +959,7 @@ bool grobner::compute_basis_step() {
bool grobner::compute_basis(unsigned threshold) {
compute_basis_init();
while (m_num_new_equations < threshold) {
while (m_num_new_equations < threshold && !m_manager.canceled()) {
if (compute_basis_step()) return true;
}
return false;

View file

@ -175,7 +175,7 @@ protected:
equation * pick_next();
void simplify_processed(equation * eq);
bool simplify_processed(equation * eq);
void simplify_to_process(equation * eq);