3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-13 20:38:43 +00:00

Fix bugs in iuc generation

This commit is contained in:
Arie Gurfinkel 2018-06-20 23:04:44 -04:00
parent 4ed6783aff
commit ac23002dce
2 changed files with 43 additions and 42 deletions

View file

@ -33,7 +33,7 @@ public:
bool is_h_marked(proof* p) {return m_h_mark.is_marked(p);}
bool is_b_pure (proof *p) {
return !is_h_marked (p) && is_core_pure(m.get_fact (p));
return !is_h_marked(p) && !this->is_a_marked(p) && is_core_pure(m.get_fact(p));
}
void display_dot(std::ostream &out);

View file

@ -102,7 +102,7 @@ namespace spacer {
symbol sym;
if (!m_learner.is_closed(step) && // if step is not already interpolated
is_farkas_lemma(m, step)) {
// weaker check: d->get_num_parameters() >= m.get_num_parents(step) + 2
// weaker check : d->get_num_parameters() >= m.get_num_parents(step) + 2
SASSERT(d->get_num_parameters() == m.get_num_parents(step) + 2);
SASSERT(m.has_fact(step));
@ -135,13 +135,13 @@ namespace spacer {
*/
parameter const* params = d->get_parameters() + 2; // point to the first Farkas coefficient
STRACE("spacer.farkas",
verbose_stream() << "Farkas input: "<< "\n";
TRACE("spacer.farkas",
tout << "Farkas input: "<< "\n";
for (unsigned i = 0; i < m.get_num_parents(step); ++i) {
proof * prem = m.get_parent(step, i);
rational coef = params[i].get_rational();
bool b_pure = m_learner.m_pr.is_b_pure (prem);
verbose_stream() << (b_pure?"B":"A") << " " << coef << " " << mk_pp(m.get_fact(prem), m) << "\n";
tout << (b_pure?"B":"A") << " " << coef << " " << mk_pp(m.get_fact(prem), m) << "\n";
}
);
@ -153,13 +153,14 @@ namespace spacer {
if (m_learner.is_b_open (premise)) {
SASSERT(!m_learner.m_pr.is_a_marked(premise));
if (m_learner.m_pr.is_b_pure (step)) {
if (m_learner.m_pr.is_b_pure (premise)) {
if (!m_use_constant_from_a) {
rational coefficient = params[i].get_rational();
coeff_lits.push_back(std::make_pair(abs(coefficient), (app*)m.get_fact(premise)));
}
}
else {
// -- mixed premise, won't be able to close this proof step
can_be_closed = false;
if (m_use_constant_from_a) {
@ -205,11 +206,11 @@ namespace spacer {
}
// only if all b-premises can be used directly, add the farkas core and close the step
// AG: this decision needs to be re-evaluated. If the proof cannot be closed, literals above
// AG: it will go into the core. However, it does not mean that this literal should/could not be added.
if (can_be_closed) {
m_learner.set_closed(step, true);
expr_ref res = compute_linear_combination(coeff_lits);
m_learner.add_lemma_to_core(res);
}
}