mirror of
https://github.com/Z3Prover/z3
synced 2025-06-25 23:33:41 +00:00
* 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).
83 lines
2.3 KiB
C++
83 lines
2.3 KiB
C++
/*++
|
|
Copyright (c) 2012 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
replace_proof_converter.cpp
|
|
|
|
Abstract:
|
|
|
|
Proof converter that replaces asserted by sub-proof.
|
|
|
|
Author:
|
|
|
|
Nikolaj Bjorner (nbjorner) 2012-9-16
|
|
|
|
Revision History:
|
|
|
|
--*/
|
|
|
|
#include "ast/converters/replace_proof_converter.h"
|
|
#include "ast/expr_functors.h"
|
|
#include "ast/ast_pp.h"
|
|
#include "ast/for_each_expr.h"
|
|
|
|
/**
|
|
\brief Replace expressions by other expressions.
|
|
|
|
replace_map is caching, so inserting src |-> dst has no effect if
|
|
src is a sub-expression of something that has already been visited.
|
|
The assumption is that proof replacements are inserted into
|
|
the replace_proof_converter in the order that they are introduced, so
|
|
there are no such clashes.
|
|
|
|
map_proc is used as expr_replacer behaves differently
|
|
when proof mode is turned on.
|
|
*/
|
|
class replace_map : public map_proc {
|
|
public:
|
|
replace_map(ast_manager& m): map_proc(m) {}
|
|
|
|
void insert(expr* src, expr* dst) {
|
|
m_map.insert(src, dst, nullptr);
|
|
}
|
|
|
|
void operator()(var* v) { visit(v); }
|
|
void operator()(app* a) { if (!get_expr(a)) { reconstruct(a); } }
|
|
void operator()(quantifier* q) { visit(q); }
|
|
|
|
void apply(expr_ref& e) {
|
|
for_each_expr(*this, e);
|
|
e = get_expr(e);
|
|
}
|
|
};
|
|
|
|
|
|
proof_ref replace_proof_converter::operator()(ast_manager & m, unsigned num_source, proof * const * source) {
|
|
SASSERT(num_source == 1);
|
|
replace_map replace(m);
|
|
proof_ref p(m);
|
|
expr_ref tmp(source[0], m), e(m), f(m);
|
|
|
|
// apply the substitution to the prefix before inserting it.
|
|
for (unsigned i = 0; i < m_proofs.size(); ++i) {
|
|
p = m_proofs[i].get();
|
|
e = p;
|
|
replace.apply(e);
|
|
f = m.mk_asserted(m.get_fact(p));
|
|
replace.insert(f, e);
|
|
TRACE(proof_converter, tout << f->get_id() << " " << mk_pp(f, m) <<
|
|
"\n|-> " << mk_pp(e, m) << "\n";);
|
|
}
|
|
replace.apply(tmp);
|
|
TRACE(proof_converter, tout << mk_pp(source[0], m) << "\n";
|
|
tout << mk_pp(tmp.get(), m) << "\n";);
|
|
return proof_ref(to_app(tmp), m);
|
|
}
|
|
|
|
proof_converter * replace_proof_converter::translate(ast_translation & translator) {
|
|
replace_proof_converter* rp = alloc(replace_proof_converter, m);
|
|
for (proof* p : m_proofs) rp->insert(translator(p));
|
|
return rp;
|
|
}
|
|
|