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

Centralize and document TRACE tags using X-macros (#7657)

* Introduce X-macro-based trace tag definition
- Created trace_tags.def to centralize TRACE tag definitions
- Each tag includes a symbolic name and description
- Set up enum class TraceTag for type-safe usage in TRACE macros

* Add script to generate Markdown documentation from trace_tags.def
- Python script parses trace_tags.def and outputs trace_tags.md

* Refactor TRACE_NEW to prepend TraceTag and pass enum to is_trace_enabled

* trace: improve trace tag handling system with hierarchical tagging

- Introduce hierarchical tag-class structure: enabling a tag class activates all child tags
- Unify TRACE, STRACE, SCTRACE, and CTRACE under enum TraceTag
- Implement initial version of trace_tag.def using X(tag, tag_class, description)
  (class names and descriptions to be refined in a future update)

* trace: replace all string-based TRACE tags with enum TraceTag
- Migrated all TRACE, STRACE, SCTRACE, and CTRACE macros to use enum TraceTag values instead of raw string literals

* trace : add cstring header

* trace : Add Markdown documentation generation from trace_tags.def via mk_api_doc.py

* trace : rename macro parameter 'class' to 'tag_class' and remove Unicode comment in trace_tags.h.

* trace : Add TODO comment for future implementation of tag_class activation

* trace : Disable code related to tag_class until implementation is ready (#7663).
This commit is contained in:
LeeYoungJoon 2025-05-28 22:31:25 +09:00 committed by GitHub
parent d766292dab
commit 0a93ff515d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
583 changed files with 8698 additions and 7299 deletions

View file

@ -125,7 +125,7 @@ class add_bounds_tactic : public tactic {
if (proc.m_num_bounds > 0)
g->updt_prec(goal::UNDER);
report_tactic_progress(":added-bounds", proc.m_num_bounds);
TRACE("add_bounds", g->display(tout););
TRACE(add_bounds, g->display(tout););
}
};

View file

@ -76,7 +76,7 @@ struct arith_bounds_tactic : public tactic {
goal_ref s(g); // initialize result.
obj_map<expr, info> lower, upper;
expr* e1, *e2;
TRACE("arith_subsumption", s->display(tout); );
TRACE(arith_subsumption, s->display(tout); );
for (unsigned i = 0; i < s->size(); ++i) {
checkpoint();
expr* lemma = s->form(i);
@ -140,7 +140,7 @@ struct arith_bounds_tactic : public tactic {
}
s->elim_true();
result.push_back(s.get());
TRACE("arith_subsumption", s->display(tout); );
TRACE(arith_subsumption, s->display(tout); );
}
void cleanup() override {}

View file

@ -84,7 +84,7 @@ void bv2int_rewriter_ctx::collect_power2(goal const& s) {
expr* logx = m.mk_fresh_const("log2_v", bv.mk_sort(log2));
logx = bv.mk_zero_extend(num_bits - log2, logx);
m_trail.push_back(logx);
TRACE("bv2int_rewriter", tout << mk_pp(v, m) << " |-> " << mk_pp(logx, m) << "\n";);
TRACE(bv2int_rewriter, tout << mk_pp(v, m) << " |-> " << mk_pp(logx, m) << "\n";);
m_power2.insert(v, logx);
}
}
@ -237,7 +237,7 @@ br_status bv2int_rewriter::mk_mod(expr * s, expr * t, expr_ref & result) {
if (is_ubv2int(s, s1) && is_ubv2int(t, t1)) {
align_sizes(s1, t1, false);
result = m_bv.mk_ubv2int(m_bv.mk_bv_urem(s1, t1));
TRACE("bv2int_rewriter", tout << result << "\n";);
TRACE(bv2int_rewriter, tout << result << "\n";);
return BR_DONE;
}
@ -252,7 +252,7 @@ br_status bv2int_rewriter::mk_mod(expr * s, expr * t, expr_ref & result) {
u1 = mk_bv_add(s1, u1, false);
align_sizes(u1, t1, false);
result = m_bv.mk_ubv2int(m_bv.mk_bv_urem(u1, t1));
TRACE("bv2int_rewriter", tout << result << "\n";);
TRACE(bv2int_rewriter, tout << result << "\n";);
return BR_DONE;
}

View file

@ -315,7 +315,7 @@ bool bv2real_util::mk_is_divisible_by(expr_ref& s, rational const& _overflow) {
SASSERT(overflow.is_int());
SASSERT(overflow.is_pos());
SASSERT(!overflow.is_one());
TRACE("bv2real_rewriter",
TRACE(bv2real_rewriter,
tout << mk_pp(s, m()) << " " << overflow << "\n";);
unsigned power2 = 0;
while ((overflow % rational(2)) == rational(0)) {
@ -336,7 +336,7 @@ bool bv2real_util::mk_is_divisible_by(expr_ref& s, rational const& _overflow) {
}
}
TRACE("bv2real_rewriter",
TRACE(bv2real_rewriter,
tout << mk_pp(s, m()) << " " << overflow << "\n";);
return overflow.is_one();
@ -360,7 +360,7 @@ bv2real_rewriter::bv2real_rewriter(ast_manager& m, bv2real_util& util):
br_status bv2real_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * const * args, expr_ref & result) {
TRACE("bv2real_rewriter",
TRACE(bv2real_rewriter,
tout << mk_pp(f, m()) << " ";
for (unsigned i = 0; i < num_args; ++i) {
tout << mk_pp(args[i], m()) << " ";
@ -469,7 +469,7 @@ bool bv2real_rewriter::mk_le(expr* s, expr* t, bool is_pos, bool is_neg, expr_re
u().add_side_condition(e4);
}
TRACE("bv2real_rewriter", tout << "mk_le\n";);
TRACE(bv2real_rewriter, tout << "mk_le\n";);
if (is_pos) {
result = le_proxy;
@ -546,7 +546,7 @@ br_status bv2real_rewriter::mk_le(expr * s, expr * t, expr_ref & result) {
expr* e2 = m().mk_or(m().mk_not(gz1), m().mk_not(lz2), ge);
expr* e3 = m().mk_or(m().mk_not(gz2), m().mk_not(lz1), le);
result = m().mk_and(e1, e2, e3);
TRACE("bv2real_rewriter", tout << "\n";);
TRACE(bv2real_rewriter, tout << "\n";);
return BR_DONE;
}
return BR_FAILED;

View file

@ -172,7 +172,7 @@ class degree_shift_tactic : public tactic {
for (auto [f, d, p] : g)
collect(f, visited);
TRACE("degree_shift", display_candidates(tout););
TRACE(degree_shift, display_candidates(tout););
}
void discard_non_candidates() {
@ -257,7 +257,7 @@ class degree_shift_tactic : public tactic {
g->inc_depth();
g->add(mc.get());
result.push_back(g.get());
TRACE("degree_shift", g->display(tout); if (mc) mc->display(tout););
TRACE(degree_shift, g->display(tout); if (mc) mc->display(tout););
}
};

View file

@ -168,7 +168,7 @@ class diff_neq_tactic : public tactic {
unsigned sz = g.size();
for (unsigned i = 0; i < sz; i++) {
expr * f = g.form(i);
TRACE("diff_neq_tactic", tout << "processing: " << mk_ismt2_pp(f, m) << "\n";);
TRACE(diff_neq_tactic, tout << "processing: " << mk_ismt2_pp(f, m) << "\n";);
if (u.is_le(f, lhs, rhs))
process_le(lhs, rhs);
else if (u.is_ge(f, lhs, rhs))
@ -290,14 +290,14 @@ class diff_neq_tactic : public tactic {
while (m_stack.size() < nvars) {
if (!m.inc())
throw tactic_exception(m.limit().get_cancel_msg());
TRACE("diff_neq_tactic", display_model(tout););
TRACE(diff_neq_tactic, display_model(tout););
var x = m_stack.size();
if (extend_model(x))
continue;
if (!resolve_conflict())
return false;
}
TRACE("diff_neq_tactic", display_model(tout););
TRACE(diff_neq_tactic, display_model(tout););
return true;
}
@ -324,7 +324,7 @@ class diff_neq_tactic : public tactic {
return;
}
compile(*g);
TRACE("diff_neq_tactic", g->display(tout); display(tout););
TRACE(diff_neq_tactic, g->display(tout); display(tout););
bool r = search();
report_tactic_progress(":conflicts", m_num_conflicts);
if (r) {

View file

@ -173,7 +173,7 @@ class factor_tactic : public tactic {
scoped_mpz d2(m_qm);
m_expr2poly.to_polynomial(lhs, p1, d1);
m_expr2poly.to_polynomial(rhs, p2, d2);
TRACE("factor_tactic_bug",
TRACE(factor_tactic_bug,
tout << "lhs: " << mk_ismt2_pp(lhs, m) << "\n";
tout << "p1: " << p1 << "\n";
tout << "d1: " << d1 << "\n";
@ -190,10 +190,10 @@ class factor_tactic : public tactic {
if (is_const(p))
return BR_FAILED;
polynomial::factors fs(m_pm);
TRACE("factor_tactic_bug", tout << "p: " << p << "\n";);
TRACE(factor_tactic_bug, tout << "p: " << p << "\n";);
m_pm.factor(p, fs, m_fparams);
SASSERT(fs.distinct_factors() > 0);
TRACE("factor_tactic_bug", tout << "factors:\n"; fs.display(tout); tout << "\n";);
TRACE(factor_tactic_bug, tout << "factors:\n"; fs.display(tout); tout << "\n";);
if (fs.distinct_factors() == 1 && fs.get_degree(0) == 1)
return BR_FAILED;
if (m.is_eq(f)) {

View file

@ -46,7 +46,7 @@ class fix_dl_var_tactic : public tactic {
}
void throw_failed(expr * ctx1, expr * ctx2 = nullptr) {
TRACE("fix_dl_var", tout << mk_ismt2_pp(ctx1, m) << "\n"; if (ctx2) tout << mk_ismt2_pp(ctx2, m) << "\n";);
TRACE(fix_dl_var, tout << mk_ismt2_pp(ctx1, m) << "\n"; if (ctx2) tout << mk_ismt2_pp(ctx2, m) << "\n";);
throw failed();
}
@ -104,7 +104,7 @@ class fix_dl_var_tactic : public tactic {
visit(s, nested);
}
else {
CTRACE("fix_dl_var", m_util.is_add(lhs, t, ms),
CTRACE(fix_dl_var, m_util.is_add(lhs, t, ms),
s = 0;
tout << "is_times_minus_one: " << m_util.is_times_minus_one(ms, s) << "\n";
tout << "is_uninterp(t): " << is_uninterp(t) << "\n";
@ -197,7 +197,7 @@ class fix_dl_var_tactic : public tactic {
app * r1, * r2;
r1 = most_occs(m_non_nested_occs, best1);
r2 = most_occs(m_occs, best2);
TRACE("fix_dl_var",
TRACE(fix_dl_var,
if (r1) {
tout << "r1 occs: " << best1 << "\n";
tout << mk_ismt2_pp(r1, m) << "\n";
@ -246,7 +246,7 @@ class fix_dl_var_tactic : public tactic {
goal_ref_buffer & result) {
tactic_report report("fix-dl-var", *g);
m_produce_models = g->models_enabled();
TRACE("fix_dl_var", g->display(tout););
TRACE(fix_dl_var, g->display(tout););
app * var = is_target(u)(*g);
if (var != nullptr) {

View file

@ -198,7 +198,7 @@ class fm_tactic : public tactic {
void get_units(obj_map<expr, bool>& units) override { units.reset(); }
void operator()(model_ref & md) override {
TRACE("fm_mc", model_v2_pp(tout, *md); display(tout););
TRACE(fm_mc, model_v2_pp(tout, *md); display(tout););
model::scoped_model_completion _sc(*md, true);
//model_evaluator ev(*(md.get()));
//ev.set_model_completion(true);
@ -218,23 +218,23 @@ class fm_tactic : public tactic {
rational val;
expr_ref val_e(m), val_upper_e(m), val_lower_e(m);
bool has_lower = false, has_upper = false;
TRACE("fm_mc", tout << "processing " << x->get_name() << "\n";);
TRACE(fm_mc, tout << "processing " << x->get_name() << "\n";);
for (expr* cl : m_clauses[i]) {
if (!m.inc())
throw tactic_exception(m.limit().get_cancel_msg());
switch (process(x, cl, u, *md, val, val_e)) {
case NONE:
TRACE("fm_mc", tout << "no bound for:\n" << mk_ismt2_pp(cl, m) << "\n";);
TRACE(fm_mc, tout << "no bound for:\n" << mk_ismt2_pp(cl, m) << "\n";);
break;
case LOWER:
TRACE("fm_mc", tout << "lower bound: " << val << " for:\n" << mk_ismt2_pp(cl, m) << "\n";);
TRACE(fm_mc, tout << "lower bound: " << val << " for:\n" << mk_ismt2_pp(cl, m) << "\n";);
if (val_e)
val_lower_e = val_lower_e != nullptr ? mk_max(val_lower_e, val_e) : val_e;
else if (!has_lower || val > lower)
lower = val, has_lower = true;
break;
case UPPER:
TRACE("fm_mc", tout << "upper bound: " << val << " for:\n" << mk_ismt2_pp(cl, m) << "\n";);
TRACE(fm_mc, tout << "upper bound: " << val << " for:\n" << mk_ismt2_pp(cl, m) << "\n";);
if (val_e)
val_upper_e = val_upper_e != nullptr ? mk_min(val_upper_e, val_e) : val_e;
else if (!has_upper || val < upper)
@ -285,10 +285,10 @@ class fm_tactic : public tactic {
else
x_val = u.mk_numeral(rational(0), false);
}
TRACE("fm_mc", tout << x->get_name() << " --> " << mk_ismt2_pp(x_val, m) << "\n";);
TRACE(fm_mc, tout << x->get_name() << " --> " << mk_ismt2_pp(x_val, m) << "\n";);
md->register_decl(x, x_val);
}
TRACE("fm_mc", model_v2_pp(tout, *md););
TRACE(fm_mc, model_v2_pp(tout, *md););
}
@ -519,7 +519,7 @@ class fm_tactic : public tactic {
bool is_linear_ineq(expr * t) const {
m.is_not(t, t);
expr * lhs, * rhs;
TRACE("is_occ_bug", tout << mk_pp(t, m) << "\n";);
TRACE(is_occ_bug, tout << mk_pp(t, m) << "\n";);
if (m_util.is_le(t, lhs, rhs) || m_util.is_ge(t, lhs, rhs)) {
if (!m_util.is_numeral(rhs))
return false;
@ -595,7 +595,7 @@ class fm_tactic : public tactic {
cnstr->m_xs = reinterpret_cast<var*>(mem_xs);
cnstr->m_as = reinterpret_cast<rational*>(mem_as);
for (unsigned i = 0; i < num_vars; i++) {
TRACE("mk_constraint_bug", tout << "xs[" << i << "]: " << xs[i] << "\n";);
TRACE(mk_constraint_bug, tout << "xs[" << i << "]: " << xs[i] << "\n";);
cnstr->m_xs[i] = xs[i];
new (cnstr->m_as + i) rational(as[i]);
}
@ -787,7 +787,7 @@ class fm_tactic : public tactic {
if (c2->m_dead)
continue;
if (subsumes(c, *c2)) {
TRACE("fm_subsumption", display(tout, c); tout << "\nsubsumed:\n"; display(tout, *c2); tout << "\n";);
TRACE(fm_subsumption, display(tout, c); tout << "\nsubsumed:\n"; display(tout, *c2); tout << "\n";);
c2->m_dead = true;
continue;
}
@ -858,7 +858,7 @@ class fm_tactic : public tactic {
expr * f = g.form(i);
if (is_occ(f))
continue;
TRACE("is_occ_bug", tout << "not OCC:\n" << mk_ismt2_pp(f, m) << "\n";);
TRACE(is_occ_bug, tout << "not OCC:\n" << mk_ismt2_pp(f, m) << "\n";);
quick_for_each_expr(proc, visited, f);
}
}
@ -1009,7 +1009,7 @@ class fm_tactic : public tactic {
x = mk_var(t);
SASSERT(m_expr2var.contains(t));
SASSERT(m_var2expr.get(x) == t);
TRACE("to_var_bug", tout << mk_ismt2_pp(t, m) << " --> " << x << "\n";);
TRACE(to_var_bug, tout << mk_ismt2_pp(t, m) << " --> " << x << "\n";);
return x;
}
@ -1108,7 +1108,7 @@ class fm_tactic : public tactic {
}
}
TRACE("to_var_bug", tout << "before mk_constraint: "; for (unsigned i = 0; i < xs.size(); i++) tout << " " << xs[i]; tout << "\n";);
TRACE(to_var_bug, tout << "before mk_constraint: "; for (unsigned i = 0; i < xs.size(); i++) tout << " " << xs[i]; tout << "\n";);
constraint * new_c = mk_constraint(lits.size(),
lits.data(),
@ -1119,7 +1119,7 @@ class fm_tactic : public tactic {
strict,
dep);
TRACE("to_var_bug", tout << "add_constraint: "; display(tout, *new_c); tout << "\n";);
TRACE(to_var_bug, tout << "add_constraint: "; display(tout, *new_c); tout << "\n";);
VERIFY(register_constraint(new_c));
}
@ -1132,7 +1132,7 @@ class fm_tactic : public tactic {
if (is_false(*c)) {
del_constraint(c);
m_inconsistent = true;
TRACE("add_constraint_bug", tout << "is false "; display(tout, *c); tout << "\n";);
TRACE(add_constraint_bug, tout << "is false "; display(tout, *c); tout << "\n";);
return false;
}
@ -1155,7 +1155,7 @@ class fm_tactic : public tactic {
return true;
}
else {
TRACE("add_constraint_bug", tout << "all variables are forbidden "; display(tout, *c); tout << "\n";);
TRACE(add_constraint_bug, tout << "all variables are forbidden "; display(tout, *c); tout << "\n";);
m_new_goal->assert_expr(to_expr(*c), nullptr, c->m_dep);
del_constraint(c);
return false;
@ -1211,7 +1211,7 @@ class fm_tactic : public tactic {
}
// x_cost_lt is not a total order on variables
std::stable_sort(x_cost_vector.begin(), x_cost_vector.end(), x_cost_lt(m_is_int));
TRACE("fm",
TRACE(fm,
for (auto const& [v,c] : x_cost_vector)
tout << "(" << mk_ismt2_pp(m_var2expr.get(v), m) << " " << c << ") ";
tout << "\n";);
@ -1390,7 +1390,7 @@ class fm_tactic : public tactic {
if (new_xs.empty() && (new_c.is_pos() || (!new_strict && new_c.is_zero()))) {
// literal is true
TRACE("fm", tout << "resolution " << x << " consequent literal is always true: \n";
TRACE(fm, tout << "resolution " << x << " consequent literal is always true: \n";
display(tout, l);
tout << "\n";
display(tout, u); tout << "\n";);
@ -1434,7 +1434,7 @@ class fm_tactic : public tactic {
}
if (tautology) {
TRACE("fm", tout << "resolution " << x << " tautology: \n";
TRACE(fm, tout << "resolution " << x << " tautology: \n";
display(tout, l);
tout << "\n";
display(tout, u); tout << "\n";);
@ -1444,7 +1444,7 @@ class fm_tactic : public tactic {
expr_dependency * new_dep = m.mk_join(l.m_dep, u.m_dep);
if (new_lits.empty() && new_xs.empty() && (new_c.is_neg() || (new_strict && new_c.is_zero()))) {
TRACE("fm", tout << "resolution " << x << " inconsistent: \n";
TRACE(fm, tout << "resolution " << x << " inconsistent: \n";
display(tout, l);
tout << "\n";
display(tout, u); tout << "\n";);
@ -1462,7 +1462,7 @@ class fm_tactic : public tactic {
new_strict,
new_dep);
TRACE("fm", tout << "resolution " << x << "\n";
TRACE(fm, tout << "resolution " << x << "\n";
display(tout, l);
tout << "\n";
display(tout, u);
@ -1485,7 +1485,7 @@ class fm_tactic : public tactic {
if (l.empty() || u.empty()) {
// easy case
mark_constraints_dead(x);
TRACE("fm", tout << "variables was eliminated (trivial case)\n";);
TRACE(fm, tout << "variables was eliminated (trivial case)\n";);
return true;
}
@ -1503,7 +1503,7 @@ class fm_tactic : public tactic {
m_counter += num_lowers * num_uppers;
TRACE("fm_bug", tout << "eliminating " << mk_ismt2_pp(m_var2expr.get(x), m) << "\nlowers:\n";
TRACE(fm_bug, tout << "eliminating " << mk_ismt2_pp(m_var2expr.get(x), m) << "\nlowers:\n";
display_constraints(tout, l); tout << "uppers:\n"; display_constraints(tout, u););
unsigned num_old_cnstrs = num_uppers + num_lowers;
@ -1513,7 +1513,7 @@ class fm_tactic : public tactic {
for (unsigned i = 0; i < num_lowers; i++) {
for (unsigned j = 0; j < num_uppers; j++) {
if (m_inconsistent || num_new_cnstrs > limit) {
TRACE("fm", tout << "too many new constraints: " << num_new_cnstrs << "\n";);
TRACE(fm, tout << "too many new constraints: " << num_new_cnstrs << "\n";);
del_constraints(new_constraints.size(), new_constraints.data());
return false;
}
@ -1538,7 +1538,7 @@ class fm_tactic : public tactic {
backward_subsumption(*c);
register_constraint(c);
}
TRACE("fm", tout << "variables was eliminated old: " << num_old_cnstrs << " new_constraints: " << sz << "\n";);
TRACE(fm, tout << "variables was eliminated old: " << num_old_cnstrs << " new_constraints: " << sz << "\n";);
return true;
}
@ -1548,7 +1548,7 @@ class fm_tactic : public tactic {
if (!c->m_dead) {
c->m_dead = true;
expr * new_f = to_expr(*c);
TRACE("fm_bug", tout << "asserting...\n" << mk_ismt2_pp(new_f, m) << "\nnew_dep: " << c->m_dep << "\n";);
TRACE(fm_bug, tout << "asserting...\n" << mk_ismt2_pp(new_f, m) << "\nnew_dep: " << c->m_dep << "\n";);
m_new_goal->assert_expr(new_f, nullptr, c->m_dep);
}
}
@ -1589,7 +1589,7 @@ class fm_tactic : public tactic {
m_new_goal->assert_expr(m.mk_false(), nullptr, m_inconsistent_core);
}
else {
TRACE("fm", display(tout););
TRACE(fm, display(tout););
subsume();
var_vector candidates;
@ -1623,7 +1623,7 @@ class fm_tactic : public tactic {
}
reset_constraints();
result.push_back(m_new_goal.get());
TRACE("fm", m_new_goal->display(tout););
TRACE(fm, m_new_goal->display(tout););
}
void display_constraints(std::ostream & out, constraints const & cs) const {

View file

@ -84,7 +84,7 @@ class lia2card_tactic : public tactic {
else {
return BR_FAILED;
}
TRACE("pbsum", tout << expr_ref(m.mk_app(f, sz, es), m) << " ==>\n" << result << "\n";);
TRACE(pbsum, tout << expr_ref(m.mk_app(f, sz, es), m) << " ==>\n" << result << "\n";);
return BR_DONE;
}
@ -202,7 +202,7 @@ public:
expr_ref b = mk_bounded(axioms, to_app(x), lo.get_unsigned(), hi.get_unsigned());
rep.insert(x, b);
m_bounds.insert(x, bound(lo.get_unsigned(), hi.get_unsigned(), b));
TRACE("pb", tout << "add bound " << lo << " " << hi << ": " << mk_pp(x, m) << "\n";);
TRACE(pb, tout << "add bound " << lo << " " << hi << ": " << mk_pp(x, m) << "\n";);
}
}
for (unsigned i = 0; !g->inconsistent() && i < g->size(); i++) {
@ -330,7 +330,7 @@ public:
conds.pop_back();
}
else {
TRACE("pb", tout << "Can't handle " << mk_pp(x, m) << "\n";);
TRACE(pb, tout << "Can't handle " << mk_pp(x, m) << "\n";);
ok = false;
}
return ok;

View file

@ -94,7 +94,7 @@ class lia2pb_tactic : public tactic {
visitor(imp & o):m_owner(o) {}
void throw_failed(expr * n) {
TRACE("lia2pb", tout << "Failed at:\n" << mk_ismt2_pp(n, m_owner.m) << "\n";);
TRACE(lia2pb, tout << "Failed at:\n" << mk_ismt2_pp(n, m_owner.m) << "\n";);
throw failed();
}
@ -200,7 +200,7 @@ class lia2pb_tactic : public tactic {
for (unsigned i = 0; i < g->size(); ++i)
m_bm(g->form(i), g->dep(i), g->pr(i));
TRACE("lia2pb", m_bm.display(tout););
TRACE(lia2pb, m_bm.display(tout););
// check if there is some variable to be converted
if (!has_target()) {
@ -256,7 +256,7 @@ class lia2pb_tactic : public tactic {
if (dep != nullptr)
m_new_deps.push_back(dep);
}
TRACE("lia2pb", tout << mk_ismt2_pp(x, m) << " -> " << dep << "\n";);
TRACE(lia2pb, tout << mk_ismt2_pp(x, m) << " -> " << dep << "\n";);
subst.insert(x, def, nullptr, dep);
if (m_produce_models) {
gmc->add(x, def);

View file

@ -82,7 +82,7 @@ class nla2bv_tactic : public tactic {
void updt_params(params_ref const& p) {}
void operator()(goal & g, model_converter_ref & mc) {
TRACE("nla2bv", g.display(tout);
TRACE(nla2bv, g.display(tout);
tout << "Muls: " << count_mul(g) << "\n";
);
tactic_report report("nla->bv", g);
@ -99,10 +99,10 @@ class nla2bv_tactic : public tactic {
return;
}
substitute_vars(g);
TRACE("nla2bv", g.display(tout << "substitute vars\n"));
TRACE(nla2bv, g.display(tout << "substitute vars\n"));
reduce_bv2int(g);
reduce_bv2real(g);
TRACE("nla2bv", g.display(tout << "after reduce\n"));
TRACE(nla2bv, g.display(tout << "after reduce\n"));
mc = m_fmc.get();
for (unsigned i = 0; i < m_vars.size(); ++i)
m_fmc->add(m_vars.get(i), m_defs.get(i));
@ -110,8 +110,8 @@ class nla2bv_tactic : public tactic {
m_fmc->hide(m_bv2real.get_aux_decl(i));
}
IF_VERBOSE(TACTIC_VERBOSITY_LVL, verbose_stream() << "(nla->bv :sat-preserving " << m_is_sat_preserving << ")\n";);
TRACE("nla2bv_verbose", g.display(tout));
TRACE("nla2bv", tout << "Muls: " << count_mul(g) << "\n");
TRACE(nla2bv_verbose, g.display(tout));
TRACE(nla2bv, tout << "Muls: " << count_mul(g) << "\n");
g.inc_depth();
if (!is_sat_preserving())
g.updt_prec(goal::UNDER);
@ -134,7 +134,7 @@ class nla2bv_tactic : public tactic {
expr* w = m_bv.mk_ubv2int(m_bv.mk_bv_shl(m_bv.mk_numeral(1, num_bits), v));
m_trail.push_back(w);
m_subst.insert(kv.m_key, w);
TRACE("nla2bv", tout << mk_ismt2_pp(kv.m_key, m_manager) << " " << mk_ismt2_pp(w, m_manager) << "\n";);
TRACE(nla2bv, tout << mk_ismt2_pp(kv.m_key, m_manager) << " " << mk_ismt2_pp(w, m_manager) << "\n";);
}
// eliminate the variables that are power of two.
substitute_vars(g);
@ -174,7 +174,7 @@ class nla2bv_tactic : public tactic {
g.assert_expr(conditions[i]);
set_satisfiability_preserving(false);
}
TRACE("nla2bv",
TRACE(nla2bv,
for (unsigned i = 0; i < sz; ++i) {
tout << mk_ismt2_pp(conditions[i], m_manager) << "\n";
});
@ -229,7 +229,7 @@ class nla2bv_tactic : public tactic {
num_bits = log2(abs(*up - *low)+numeral(1));
}
else {
TRACE("nla2bv", tout << "no bounds for " << mk_ismt2_pp(n, m_manager) << "\n";);
TRACE(nla2bv, tout << "no bounds for " << mk_ismt2_pp(n, m_manager) << "\n";);
set_satisfiability_preserving(false);
}
bv_sort = m_bv.mk_sort(num_bits);
@ -351,7 +351,7 @@ class nla2bv_tactic : public tactic {
m_no_arith = false;
}
else if (n->get_family_id() != m.get_basic_family_id()) {
TRACE("nla2bv", tout << "Not supported: " << mk_ismt2_pp(n, m) << "\n";);
TRACE(nla2bv, tout << "Not supported: " << mk_ismt2_pp(n, m) << "\n";);
m_in_supported_fragment = false;
}
m_imp.update_num_bits(n);

View file

@ -68,7 +68,7 @@ class normalize_bounds_tactic : public tactic {
bool has_lowers() {
for (auto* e : m_bm) {
TRACE("normalize_bounds_tactic",
TRACE(normalize_bounds_tactic,
rational val; bool strict;
tout << mk_ismt2_pp(e, m) << " has_lower: " << m_bm.has_lower(e, val, strict) << " val: " << val << "\n";);
if (is_target(e))
@ -129,7 +129,7 @@ class normalize_bounds_tactic : public tactic {
}
in->update(idx, new_curr, new_pr, in->dep(idx));
}
TRACE("normalize_bounds_tactic", in->display(tout););
TRACE(normalize_bounds_tactic, in->display(tout););
in->inc_depth();
result.push_back(in.get());
}

View file

@ -56,7 +56,7 @@ void pb2bv_model_converter::get_units(obj_map<expr, bool>& units) {
void pb2bv_model_converter::operator()(model_ref & md) {
TRACE("pb2bv", tout << "converting model:\n"; model_v2_pp(tout, *md); display(tout););
TRACE(pb2bv, tout << "converting model:\n"; model_v2_pp(tout, *md); display(tout););
arith_util a_util(m);
for (auto const& kv : m_c2bit) {

View file

@ -52,7 +52,7 @@ public:
}
void throw_non_pb(expr * n) {
TRACE("pb2bv", tout << "Not pseudo-Boolean: " << mk_ismt2_pp(n, m) << "\n";);
TRACE(pb2bv, tout << "Not pseudo-Boolean: " << mk_ismt2_pp(n, m) << "\n";);
throw non_pb(n);
}
@ -227,7 +227,7 @@ private:
if (owner.is_constraint_core(s)) {
owner.convert(to_app(s), m_saved_res, true, false);
t = m_saved_res;
TRACE("pb2bv_convert", tout << mk_ismt2_pp(s, m) << "\n-->\n" << mk_ismt2_pp(t, m) << "\n";);
TRACE(pb2bv_convert, tout << mk_ismt2_pp(s, m) << "\n-->\n" << mk_ismt2_pp(t, m) << "\n";);
return true;
}
return false;
@ -425,13 +425,13 @@ private:
}
}
TRACE("pb2bv_bv", tout << "BV Cardinality: " << mk_ismt2_pp(tmp.back(), m) << std::endl;);
TRACE(pb2bv_bv, tout << "BV Cardinality: " << mk_ismt2_pp(tmp.back(), m) << std::endl;);
r = tmp.back();
return;
}
}
TRACE("pb2bv_bv_detail", tout << "encoding:\n"; display(tout, m_p, m_c););
TRACE(pb2bv_bv_detail, tout << "encoding:\n"; display(tout, m_p, m_c););
// [Leo] improving number of bits needed.
// using (sum-of-coeffs).get_num_bits()
numeral sum;
@ -449,7 +449,7 @@ private:
unsigned bits = sum.get_num_bits();
TRACE("num_bits_bug", tout << "bits: " << bits << " sum: " << sum << " size: " << m_p.size() << "\n";);
TRACE(num_bits_bug, tout << "bits: " << bits << " sum: " << sum << " size: " << m_p.size() << "\n";);
// [Leo]: The following assertion should hold, right?
// I mean, the constraints are normalized, then mo.m_a <= m_c for every monomial in cnstr.
@ -511,7 +511,7 @@ private:
}
void mk_pbc(polynomial & m_p, numeral & m_c, expr_ref & r, bool enable_split) {
TRACE("mk_pbc", display(tout, m_p, m_c); );
TRACE(mk_pbc, display(tout, m_p, m_c); );
if (m_c.is_nonpos()) {
// constraint is equivalent to true.
r = m.mk_true();
@ -532,7 +532,7 @@ private:
it->m_a /= a_gcd;
m_c = ceil(m_c/a_gcd);
}
TRACE("mk_pbc", tout << "GCD = " << a_gcd << "; Normalized: "; display(tout, m_p, m_c); tout << "\n"; );
TRACE(mk_pbc, tout << "GCD = " << a_gcd << "; Normalized: "; display(tout, m_p, m_c); tout << "\n"; );
it = m_p.begin();
numeral a_sum;
for (; it != end; ++it) {
@ -546,10 +546,10 @@ private:
return;
}
polynomial clause;
TRACE("split_bug", display(tout, m_p, m_c););
TRACE(split_bug, display(tout, m_p, m_c););
if (enable_split)
split(m_p, m_c, clause);
TRACE("split_bug", display(tout, m_p, m_c); display(tout, clause, rational(1)););
TRACE(split_bug, display(tout, m_p, m_c); display(tout, clause, rational(1)););
if (clause.empty()) {
bitblast_pbc(m_p, m_c, r);
}
@ -558,7 +558,7 @@ private:
expr_ref r2(m);
bitblast_pbc(m_p, m_c, r1);
bitblast_pbc(clause, numeral(1), r2);
TRACE("split_bug", tout << mk_ismt2_pp(r1, m) << "\nAND\n" << mk_ismt2_pp(r2, m) << "\n";);
TRACE(split_bug, tout << mk_ismt2_pp(r1, m) << "\nAND\n" << mk_ismt2_pp(r2, m) << "\n";);
m_b_rw.mk_and(r1, r2, r);
}
}
@ -582,7 +582,7 @@ private:
}
void throw_non_pb(expr * n) {
TRACE("pb2bv", tout << "Not pseudo-Boolean: " << mk_ismt2_pp(n, m) << "\n";);
TRACE(pb2bv, tout << "Not pseudo-Boolean: " << mk_ismt2_pp(n, m) << "\n";);
throw non_pb(n);
}
@ -590,7 +590,7 @@ private:
// a_0*x_0 + a_0*~y_0 + ... + a_{n-1}*x_{n - 1} + a_{n - 1}*~y_{n - 1} = c
// x_0 = y_0, ..., x_{n - 1} = y_{n - 1}
bool is_eq_vector(polynomial const & p, numeral const & c) {
TRACE("is_eq_vector", display(tout, p, c););
TRACE(is_eq_vector, display(tout, p, c););
unsigned sz = p.size();
if (sz % 2 == 1)
return false; // size must be even
@ -653,7 +653,7 @@ private:
else if ((c.is_zero() && k == LE) ||
(c.is_one() && k == GE)) {
// redundant 0 <= x, 1 >= x
TRACE("pb2bv", tout << "discarding:\n" << mk_ismt2_pp(t, m) << "\n";);
TRACE(pb2bv, tout << "discarding:\n" << mk_ismt2_pp(t, m) << "\n";);
SASSERT(pos);
r = m.mk_true();
}
@ -678,7 +678,7 @@ private:
add_bounds_dependencies(lhs);
if (k == EQ) {
TRACE("pb2bv_bug", tout << "c: " << c << "\n";);
TRACE(pb2bv_bug, tout << "c: " << c << "\n";);
if (!c.is_zero() && !c.is_one()) {
// x = k --> true where k is not 0 or 1
r = pos ? m.mk_false() : m.mk_true();
@ -696,7 +696,7 @@ private:
if (k == LE) {
// x <= c >= 1
if (c >= numeral(1)) {
TRACE("pb2bv", tout << "discarding:\n" << mk_ismt2_pp(t, m) << "\n";);
TRACE(pb2bv, tout << "discarding:\n" << mk_ismt2_pp(t, m) << "\n";);
r = m.mk_true();
return;
}
@ -709,7 +709,7 @@ private:
}
else if (k == GE) {
if (c.is_nonpos()) {
TRACE("pb2bv", tout << "discarding:\n" << mk_ismt2_pp(t, m) << "\n";);
TRACE(pb2bv, tout << "discarding:\n" << mk_ismt2_pp(t, m) << "\n";);
// x >= a <= 0
r = m.mk_true();
return;
@ -721,13 +721,13 @@ private:
}
SASSERT(c.is_one());
}
CTRACE("pb2bv", !(c.is_zero() || c.is_one()),
CTRACE(pb2bv, !(c.is_zero() || c.is_one()),
tout << "BUG: " << mk_ismt2_pp(t, m) << "\nk: " << k << " " << c << "\n";);
SASSERT(c.is_zero() || c.is_one());
SASSERT(!((c.is_zero() && k == GE) ||
(c.is_one() && k == LE)));
CTRACE("pb2bv_bug", !((c.is_zero() && k == LE) || (c.is_one() && k == GE)),
CTRACE(pb2bv_bug, !((c.is_zero() && k == LE) || (c.is_one() && k == GE)),
tout << "c: " << c << ", k: " << k << "\n";
tout << "t: " << mk_ismt2_pp(t, m) << "\n";);
SASSERT((c.is_zero() && k == LE) ||
@ -801,7 +801,7 @@ private:
SASSERT(k == EQ);
if (is_eq_vector(m_p, m_c)) {
TRACE("is_eq_vector", tout << "found eq vector\n";);
TRACE(is_eq_vector, tout << "found eq vector\n";);
unsigned sz = m_p.size();
expr_ref_vector eqs(m);
for (unsigned i = 0; i < sz; i += 2) {
@ -829,7 +829,7 @@ private:
expr_ref r2(m);
mk_pbc(m_p, m_c, r1, false);
mk_pbc(m_p2, m_c2, r2, false);
TRACE("pb2bv_convert", tout << mk_ismt2_pp(t, m) << "\n";
TRACE(pb2bv_convert, tout << mk_ismt2_pp(t, m) << "\n";
display(tout, m_p, m_c);
display(tout, m_p2, m_c2);
tout << "--->\n" << mk_ismt2_pp(r1, m) << "\nAND\n" << mk_ismt2_pp(r2, m) << "\n";);
@ -900,7 +900,7 @@ private:
void operator()(goal_ref const & g,
goal_ref_buffer & result) {
TRACE("pb2bv", g->display(tout););
TRACE(pb2bv, g->display(tout););
fail_if_proof_generation("pb2bv", g);
m_produce_models = g->models_enabled();
m_produce_unsat_cores = g->unsat_core_enabled();
@ -917,7 +917,7 @@ private:
for (unsigned i = 0; i < size; i++)
m_bm(g->form(i), g->dep(i), g->pr(i));
TRACE("pb2bv", m_bm.display(tout););
TRACE(pb2bv, m_bm.display(tout););
try {
quick_pb_check(g);
@ -939,7 +939,7 @@ private:
bool pos;
if (is_constraint(curr, atom, pos)) {
convert(to_app(atom), new_f, pos, true);
TRACE("pb2bv_convert", tout << "pos: " << pos << "\n" << mk_ismt2_pp(atom, m) << "\n--->\n" << mk_ismt2_pp(new_f, m) << "\n";);
TRACE(pb2bv_convert, tout << "pos: " << pos << "\n" << mk_ismt2_pp(atom, m) << "\n--->\n" << mk_ismt2_pp(new_f, m) << "\n";);
}
else {
proof_ref pr(m);

View file

@ -136,7 +136,7 @@ struct has_nlmul {
has_nlmul(ast_manager& m):m(m), a(m) {}
void throw_found(expr* e) {
TRACE("probe", tout << expr_ref(e, m) << ": " << sort_ref(e->get_sort(), m) << "\n";);
TRACE(probe, tout << expr_ref(e, m) << ": " << sort_ref(e->get_sort(), m) << "\n";);
throw found();
}
@ -438,7 +438,7 @@ struct is_non_nira_functor {
is_non_nira_functor(ast_manager & _m, bool _int, bool _real, bool _quant, bool linear):m(_m), u(m), m_int(_int), m_real(_real), m_quant(_quant), m_linear(linear) {}
void throw_found(expr* e) {
TRACE("probe", tout << expr_ref(e, m) << ": " << sort_ref(e->get_sort(), m) << "\n";);
TRACE(probe, tout << expr_ref(e, m) << ": " << sort_ref(e->get_sort(), m) << "\n";);
throw found();
}
@ -615,13 +615,13 @@ struct is_non_qfufnra_functor {
return;
case OP_IDIV: case OP_DIV: case OP_REM: case OP_MOD:
if (!u.is_numeral(n->get_arg(1))) {
TRACE("arith", tout << "non-linear " << expr_ref(n, m) << "\n";);
TRACE(arith, tout << "non-linear " << expr_ref(n, m) << "\n";);
throw_found();
}
return;
case OP_POWER:
if (!u.is_numeral(n->get_arg(1))) {
TRACE("arith", tout << "non-linear " << expr_ref(n, m) << "\n";);
TRACE(arith, tout << "non-linear " << expr_ref(n, m) << "\n";);
throw_found();
}
m_has_nonlinear = true;
@ -632,7 +632,7 @@ struct is_non_qfufnra_functor {
throw_found();
return;
default:
TRACE("arith", tout << "non-linear " << expr_ref(n, m) << "\n";);
TRACE(arith, tout << "non-linear " << expr_ref(n, m) << "\n";);
throw_found();
}
}

View file

@ -299,7 +299,7 @@ struct purify_arith_proc {
void push_cnstr(expr * cnstr) {
m_new_cnstrs.push_back(cnstr);
TRACE("purify_arith", tout << mk_pp(cnstr, m()) << "\n";);
TRACE(purify_arith, tout << mk_pp(cnstr, m()) << "\n";);
}
void cache_result(app * t, expr * r, proof * pr) {
@ -765,7 +765,7 @@ struct purify_arith_proc {
expr_ref new_body(m());
proof_ref new_body_pr(m());
r(q->get_expr(), new_body, new_body_pr);
TRACE("purify_arith",
TRACE(purify_arith,
tout << "body: " << mk_ismt2_pp(q->get_expr(), m()) << "\nnew_body: " << new_body << "\n";);
result = m().update_quantifier(q, new_body);
if (m_produce_proofs) {
@ -792,8 +792,8 @@ struct purify_arith_proc {
// add constraints
sz = r.cfg().m_new_cnstrs.size();
TRACE("purify_arith", tout << r.cfg().m_new_cnstrs << "\n";);
TRACE("purify_arith", tout << r.cfg().m_new_cnstr_prs << "\n";);
TRACE(purify_arith, tout << r.cfg().m_new_cnstrs << "\n";);
TRACE(purify_arith, tout << r.cfg().m_new_cnstr_prs << "\n";);
for (unsigned i = 0; i < sz; i++) {
m_goal.assert_expr(r.cfg().m_new_cnstrs.get(i), m_produce_proofs ? r.cfg().m_new_cnstr_prs.get(i) : nullptr, nullptr);
}
@ -923,7 +923,7 @@ public:
goal_ref_buffer & result) override {
try {
tactic_report report("purify-arith", *g);
TRACE("goal", g->display(tout););
TRACE(goal, g->display(tout););
bool produce_proofs = g->proofs_enabled();
bool produce_models = g->models_enabled();
bool elim_root_objs = m_params.get_bool("elim_root_objects", true);

View file

@ -300,7 +300,7 @@ class recover_01_tactic : public tactic {
else
x_def = m_util.mk_add(def_args);
TRACE("recover_01", tout << x->get_name() << " --> " << mk_ismt2_pp(x_def, m) << "\n";);
TRACE(recover_01, tout << x->get_name() << " --> " << mk_ismt2_pp(x_def, m) << "\n";);
subst->insert(m.mk_const(x), x_def);
if (m_produce_models) {
gmc->add(x, x_def);
@ -373,7 +373,7 @@ class recover_01_tactic : public tactic {
new_goal->update(idx, new_curr);
}
result.push_back(new_goal.get());
TRACE("recover_01", new_goal->display(tout); if (new_goal->mc()) new_goal->mc()->display(tout););
TRACE(recover_01, new_goal->display(tout); if (new_goal->mc()) new_goal->mc()->display(tout););
SASSERT(new_goal->is_well_formed());
}