3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-11-29 16:59: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

@ -172,7 +172,7 @@ void lemma_quantifier_generalizer::find_candidates(expr *e,
}
app *index = indices.get(idx);
TRACE ("spacer_qgen", tout << "Candidate: "<< mk_pp(index, m)
TRACE(spacer_qgen, tout << "Candidate: "<< mk_pp(index, m)
<< " in " << mk_pp(e, m) << "\n";);
extra.push_back(index);
if (m_arith.is_add(index)) {
@ -254,7 +254,7 @@ void lemma_quantifier_generalizer::cleanup(expr_ref_vector &cube,
for (expr *e : cube) {
if (match_sk_idx(e, zks, idx, sk)) {
CTRACE("spacer_qgen", idx != sk,
CTRACE(spacer_qgen, idx != sk,
tout << "Possible cleanup of " << mk_pp(idx, m) << " in "
<< mk_pp(e, m) << " on " << mk_pp(sk, m) << "\n";);
@ -278,7 +278,7 @@ void lemma_quantifier_generalizer::cleanup(expr_ref_vector &cube,
rep = arith.mk_add(kids.size(), kids.data());
bind = arith.mk_add(kids_bind.size(), kids_bind.data());
TRACE("spacer_qgen",
TRACE(spacer_qgen,
tout << "replace " << mk_pp(idx, m) << " with " << mk_pp(rep, m) << "\n"
<< "bind is: " << bind << "\n";);
break;
@ -290,7 +290,7 @@ void lemma_quantifier_generalizer::cleanup(expr_ref_vector &cube,
rw.insert(sk, rep);
rw.insert(idx, sk);
rw(cube);
TRACE("spacer_qgen",
TRACE(spacer_qgen,
tout << "Cleaned cube to: " << mk_and(cube) << "\n";);
}
}
@ -507,12 +507,12 @@ bool lemma_quantifier_generalizer::generalize (lemma_ref &lemma, app *term) {
mk_abs_cube(lemma, term, var, gnd_cube, abs_cube, lb, ub, stride);
if (abs_cube.empty()) {return false;}
if (has_nlira(abs_cube)) {
TRACE("spacer_qgen",
TRACE(spacer_qgen,
tout << "non-linear expression: " << abs_cube << "\n";);
return false;
}
TRACE("spacer_qgen",
TRACE(spacer_qgen,
tout << "abs_cube is: " << mk_and(abs_cube) << "\n";
tout << "term: " << mk_pp(term, m) << "\n";
tout << "lb = ";
@ -544,7 +544,7 @@ bool lemma_quantifier_generalizer::generalize (lemma_ref &lemma, app *term) {
if (stride > 1 && m_arith.is_numeral(constant, init)) {
unsigned mod = init.get_unsigned() % stride;
TRACE("spacer_qgen",
TRACE(spacer_qgen,
tout << "mod=" << mod << " init=" << init << " stride=" << stride << "\n";
tout.flush(););
abs_cube.push_back
@ -558,14 +558,14 @@ bool lemma_quantifier_generalizer::generalize (lemma_ref &lemma, app *term) {
ground_expr(mk_and(abs_cube), gnd, zks);
flatten_and(gnd, gnd_cube);
TRACE("spacer_qgen",
TRACE(spacer_qgen,
tout << "New CUBE is: " << gnd_cube << "\n";);
// check if the result is a true lemma
unsigned uses_level = 0;
pred_transformer &pt = lemma->get_pob()->pt();
if (pt.check_inductive(lemma->level(), gnd_cube, uses_level, lemma->weakness())) {
TRACE("spacer_qgen",
TRACE(spacer_qgen,
tout << "Quantifier Generalization Succeeded!\n"
<< "New CUBE is: " << gnd_cube << "\n";);
SASSERT(zks.size() >= static_cast<unsigned>(m_offset));
@ -612,7 +612,7 @@ bool lemma_quantifier_generalizer::find_stride(expr_ref_vector &cube,
app_ref_vector indices(m);
get_select_indices(pattern, indices);
CTRACE("spacer_qgen", indices.empty(),
CTRACE(spacer_qgen, indices.empty(),
tout << "Found no select indices in: " << pattern << "\n";);
// TBD: handle multi-dimensional arrays and literals with multiple
@ -664,7 +664,7 @@ bool lemma_quantifier_generalizer::find_stride(expr_ref_vector &cube,
if (candidate->get_num_args() == matched)
instances.push_back(0);
TRACE("spacer_qgen",
TRACE(spacer_qgen,
tout << "Match succeeded!\n";);
}
@ -674,7 +674,7 @@ bool lemma_quantifier_generalizer::find_stride(expr_ref_vector &cube,
std::sort(instances.begin(), instances.end());
stride = instances[1]-instances[0];
TRACE("spacer_qgen", tout << "Index Stride is: " << stride << "\n";);
TRACE(spacer_qgen, tout << "Index Stride is: " << stride << "\n";);
return true;
}
@ -686,7 +686,7 @@ void lemma_quantifier_generalizer::operator()(lemma_ref &lemma) {
m_st.count++;
scoped_watch _w_(m_st.watch);
TRACE("spacer_qgen",
TRACE(spacer_qgen,
tout << "initial cube: " << mk_and(lemma->get_cube()) << "\n";);
// setup the cube
@ -700,7 +700,7 @@ void lemma_quantifier_generalizer::operator()(lemma_ref &lemma) {
normalize(c, c, false, true);
m_cube.reset();
flatten_and(c, m_cube);
TRACE("spacer_qgen",
TRACE(spacer_qgen,
tout << "normalized cube:\n" << mk_and(m_cube) << "\n";);
}