3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-14 21:08:46 +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_h_marked(proof* p) {return m_h_mark.is_marked(p);}
bool is_b_pure (proof *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); void display_dot(std::ostream &out);

View file

@ -102,7 +102,7 @@ namespace spacer {
symbol sym; symbol sym;
if (!m_learner.is_closed(step) && // if step is not already interpolated if (!m_learner.is_closed(step) && // if step is not already interpolated
is_farkas_lemma(m, step)) { 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(d->get_num_parameters() == m.get_num_parents(step) + 2);
SASSERT(m.has_fact(step)); SASSERT(m.has_fact(step));
@ -135,13 +135,13 @@ namespace spacer {
*/ */
parameter const* params = d->get_parameters() + 2; // point to the first Farkas coefficient parameter const* params = d->get_parameters() + 2; // point to the first Farkas coefficient
STRACE("spacer.farkas", TRACE("spacer.farkas",
verbose_stream() << "Farkas input: "<< "\n"; tout << "Farkas input: "<< "\n";
for (unsigned i = 0; i < m.get_num_parents(step); ++i) { for (unsigned i = 0; i < m.get_num_parents(step); ++i) {
proof * prem = m.get_parent(step, i); proof * prem = m.get_parent(step, i);
rational coef = params[i].get_rational(); rational coef = params[i].get_rational();
bool b_pure = m_learner.m_pr.is_b_pure (prem); 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)) { if (m_learner.is_b_open (premise)) {
SASSERT(!m_learner.m_pr.is_a_marked(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) { if (!m_use_constant_from_a) {
rational coefficient = params[i].get_rational(); rational coefficient = params[i].get_rational();
coeff_lits.push_back(std::make_pair(abs(coefficient), (app*)m.get_fact(premise))); coeff_lits.push_back(std::make_pair(abs(coefficient), (app*)m.get_fact(premise)));
} }
} }
else { else {
// -- mixed premise, won't be able to close this proof step
can_be_closed = false; can_be_closed = false;
if (m_use_constant_from_a) { 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 // 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) { if (can_be_closed) {
m_learner.set_closed(step, true); m_learner.set_closed(step, true);
expr_ref res = compute_linear_combination(coeff_lits); expr_ref res = compute_linear_combination(coeff_lits);
m_learner.add_lemma_to_core(res); m_learner.add_lemma_to_core(res);
} }
} }