mirror of
https://github.com/Z3Prover/z3
synced 2025-08-27 05:26:01 +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).
76 lines
2.2 KiB
C++
76 lines
2.2 KiB
C++
/*++
|
|
Copyright (c) 2013 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
dl_mk_backwards.cpp
|
|
|
|
Abstract:
|
|
|
|
Create Horn clauses for backwards flow.
|
|
|
|
Author:
|
|
|
|
Nikolaj Bjorner (nbjorner) 2013-04-17
|
|
|
|
Revision History:
|
|
|
|
--*/
|
|
|
|
#include "muz/transforms/dl_mk_backwards.h"
|
|
#include "muz/base/dl_context.h"
|
|
|
|
namespace datalog {
|
|
|
|
mk_backwards::mk_backwards(context & ctx, unsigned priority):
|
|
plugin(priority),
|
|
m(ctx.get_manager()),
|
|
m_ctx(ctx) {
|
|
}
|
|
|
|
rule_set * mk_backwards::operator()(rule_set const & source) {
|
|
context& ctx = source.get_context();
|
|
rule_manager& rm = source.get_rule_manager();
|
|
scoped_ptr<rule_set> result = alloc(rule_set, ctx);
|
|
unsigned sz = source.get_num_rules();
|
|
rule_ref new_rule(rm);
|
|
app_ref_vector tail(m);
|
|
app_ref head(m);
|
|
bool_vector neg;
|
|
app_ref query(m);
|
|
query = m.mk_fresh_const("Q", m.mk_bool_sort());
|
|
result->set_output_predicate(query->get_decl());
|
|
m_ctx.register_predicate(query->get_decl(), false);
|
|
for (unsigned i = 0; i < sz; ++i) {
|
|
tail.reset();
|
|
neg.reset();
|
|
rule & r = *source.get_rule(i);
|
|
unsigned utsz = r.get_uninterpreted_tail_size();
|
|
unsigned tsz = r.get_tail_size();
|
|
if (!source.is_output_predicate(r.get_decl())) {
|
|
tail.push_back(r.get_head());
|
|
neg.push_back(false);
|
|
}
|
|
for (unsigned j = utsz; j < tsz; ++j) {
|
|
tail.push_back(r.get_tail(j));
|
|
neg.push_back(false);
|
|
}
|
|
for (unsigned j = 0; j <= utsz; ++j) {
|
|
if (j == utsz && j > 0) {
|
|
break;
|
|
}
|
|
if (j == utsz) {
|
|
head = query;
|
|
}
|
|
else {
|
|
head = r.get_tail(j);
|
|
}
|
|
new_rule = rm.mk(head, tail.size(), tail.data(), neg.data(), r.name(), true);
|
|
result->add_rule(new_rule);
|
|
}
|
|
}
|
|
TRACE(dl, result->display(tout););
|
|
return result.detach();
|
|
}
|
|
|
|
};
|