3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00

add debug information in user-propagate #5687

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2021-11-29 08:59:24 -08:00
parent 1e9e52a58f
commit c083aa82ee
5 changed files with 22 additions and 4 deletions

View file

@ -855,6 +855,16 @@ br_status bv_rewriter::mk_bv_shl(expr * arg1, expr * arg2, expr_ref & result) {
return BR_REWRITE2;
}
expr* x = nullptr, *y = nullptr;
if (m_util.is_bv_shl(arg1, x, y)) {
expr_ref sum(m_util.mk_bv_add(y, arg2), m());
expr_ref cond(m_util.mk_ule(y, sum), m());
result = m().mk_ite(cond,
m_util.mk_bv_shl(x, sum),
mk_numeral(0, bv_size));
return BR_REWRITE3;
}
return BR_FAILED;
}

View file

@ -205,10 +205,12 @@ namespace seq {
drop_last_axiom(e, s);
return;
}
#if 1
if (is_extract_prefix(s, _i, _l)) {
extract_prefix_axiom(e, s, l);
return;
}
#endif
if (is_extract_suffix(s, _i, _l)) {
extract_suffix_axiom(e, s, i);
return;
@ -325,8 +327,7 @@ namespace seq {
0 <= l <= len(s) => len(e) = l
len(s) < l => e = s
*/
void axioms::extract_prefix_axiom(expr* e, expr* s, expr* l) {
void axioms::extract_prefix_axiom(expr* e, expr* s, expr* l) {
TRACE("seq", tout << "prefix " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << " " << mk_bounded_pp(l, m, 2) << "\n";);
expr_ref le = mk_len(e);
expr_ref ls = mk_len(s);

View file

@ -33,6 +33,7 @@ skolem::skolem(ast_manager& m, th_rewriter& rw):
m_aut_step = "aut.step";
m_pre = "seq.pre"; // (seq.pre s l): prefix of string s of length l
m_post = "seq.post"; // (seq.post s l): suffix of string s of length k, based on extract starting at index i of length l
m_postp = "seq.postp";
m_eq = "seq.eq";
m_max_unfolding = "seq.max_unfolding";
m_length_limit = "seq.length_limit";

View file

@ -37,7 +37,8 @@ namespace seq {
symbol m_aut_step; // regex unfolding state
symbol m_accept; // regex
symbol m_is_empty, m_is_non_empty; // regex emptiness check
symbol m_pre, m_post; // inverse of at: (pre s i) + (at s i) + (post s i) = s if 0 <= i < (len s)
symbol m_pre, m_post; // inverse of at: (pre s i) + (at s i) + (post s i) = s if 0 <= i < (len s)
symbol m_postp;
symbol m_eq; // equality atom
symbol m_max_unfolding, m_length_limit;
@ -84,6 +85,7 @@ namespace seq {
expr_ref mk_tail(expr* s, expr* i) { return mk(m_tail, s, i); }
expr_ref mk_post(expr* s, expr* i) { return mk(m_post, s, i); }
expr_ref mk_postp(expr* s, expr* i) { return mk(m_postp, s, i); }
expr_ref mk_ite(expr* c, expr* t, expr* e) { return mk(symbol("seq.if"), c, t, e, nullptr, t->get_sort()); }
expr_ref mk_last(expr* s);
expr_ref mk_first(expr* s);

View file

@ -52,7 +52,9 @@ void user_propagator::propagate_cb(
unsigned num_fixed, unsigned const* fixed_ids,
unsigned num_eqs, unsigned const* eq_lhs, unsigned const* eq_rhs,
expr* conseq) {
if (ctx.lit_internalized(conseq) && ctx.get_assignment(ctx.get_literal(conseq)) == l_true)
CTRACE("user_propagate", ctx.lit_internalized(conseq) && ctx.get_assignment(ctx.get_literal(conseq)) == l_true,
tout << "redundant consequence: " << mk_pp(conseq, m) << " relevant " << ctx.is_relevant(ctx.get_literal(conseq)) << "\n");
if (ctx.lit_internalized(conseq) && ctx.get_assignment(ctx.get_literal(conseq)) == l_true)
return;
m_prop.push_back(prop_info(num_fixed, fixed_ids, num_eqs, eq_lhs, eq_rhs, expr_ref(conseq, m)));
}
@ -113,6 +115,7 @@ bool user_propagator::can_propagate() {
}
void user_propagator::propagate() {
TRACE("user_propagate", tout << "propagating queue head: " << m_qhead << " prop queue: " << m_prop.size() << "\n");
if (m_qhead == m_prop.size())
return;
force_push();
@ -130,6 +133,7 @@ void user_propagator::propagate() {
DEBUG_CODE(for (unsigned id : prop.m_ids) VERIFY(m_fixed.contains(id)););
DEBUG_CODE(for (literal lit : m_lits) VERIFY(ctx.get_assignment(lit) == l_true););
TRACE("user_propagate", tout << "propagating: " << prop.m_conseq << "\n");
if (m.is_false(prop.m_conseq)) {
js = ctx.mk_justification(