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

remove incorrect assertions

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-02-06 17:40:30 -08:00
parent 200f47369d
commit ff6b3304f8
3 changed files with 16 additions and 8 deletions

View file

@ -357,25 +357,35 @@ void asserted_formulas::flatten_clauses() {
if (m.proofs_enabled()) return;
bool change = true;
vector<justified_expr> new_fmls;
auto mk_not = [this](expr* e) { return m.is_not(e, e) ? e : m.mk_not(e); };
auto is_literal = [this](expr *e) { m.is_not(e, e); return !is_app(e) || to_app(e)->get_num_args() == 0; };
expr *a = nullptr, *b = nullptr, *c = nullptr;
while (change) {
change = false;
new_fmls.reset();
unsigned sz = m_formulas.size();
for (unsigned i = m_qhead; i < sz; ++i) {
auto const& j = m_formulas.get(i);
expr* f = j.get_fml(), *a = nullptr, *b = nullptr;
expr* f = j.get_fml();
bool decomposed = false;
if (m.is_or(f, a, b) && m.is_not(b, b) && m.is_or(b) && b->get_ref_count() == 1) {
if (m.is_or(f, a, b) && m.is_not(b, b) && m.is_or(b) && (b->get_ref_count() == 1 || is_literal(a))) {
decomposed = true;
}
else if (m.is_or(f, b, a) && m.is_not(b, b) && m.is_or(b) && b->get_ref_count() == 1) {
else if (m.is_or(f, b, a) && m.is_not(b, b) && m.is_or(b) && (b->get_ref_count() == 1 || is_literal(a))) {
decomposed = true;
}
}
if (decomposed) {
for (expr* arg : *to_app(b)) {
justified_expr j1(m, m.mk_or(a, m.is_not(arg, arg) ? arg : m.mk_not(arg)), nullptr);
justified_expr j1(m, m.mk_or(a, mk_not(arg)), nullptr);
new_fmls.push_back(j1);
}
change = true;
continue;
}
if (m.is_ite(f, a, b, c)) {
new_fmls.push_back(justified_expr(m, m.mk_or(mk_not(a), b), nullptr));
new_fmls.push_back(justified_expr(m, m.mk_or(a, c), nullptr));
change = true;
continue;
}
new_fmls.push_back(j);