mirror of
https://github.com/Z3Prover/z3
synced 2025-06-25 15:23:41 +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:
parent
d766292dab
commit
0a93ff515d
583 changed files with 8698 additions and 7299 deletions
|
@ -184,11 +184,66 @@ def configure_file(template_file_path, output_file_path, substitutions):
|
||||||
with open(output_file_path, 'w') as f:
|
with open(output_file_path, 'w') as f:
|
||||||
f.write(template_string)
|
f.write(template_string)
|
||||||
|
|
||||||
|
def generate_trace_tag_docs():
|
||||||
|
"""Generate trace tag documentation from trace_tags.def file.
|
||||||
|
|
||||||
|
This function reads the trace_tags.def file and generates a markdown table with the following format:
|
||||||
|
|
||||||
|
# Z3 Trace Tags Documentation
|
||||||
|
|
||||||
|
This document contains the trace tags and their descriptions used in Z3.
|
||||||
|
|
||||||
|
| Tag | Class | Description |
|
||||||
|
|-----|-------|-------------|
|
||||||
|
| Global | Global | Unknown Class |
|
||||||
|
| add_bounds_tactic | arith_bounds_tactic | add bounds tactic |
|
||||||
|
| parser | parser | parser functionality |
|
||||||
|
|
||||||
|
The def file format should be:
|
||||||
|
X(class, tag, "description")
|
||||||
|
|
||||||
|
For example:
|
||||||
|
X(Global, Global, "Unknown Class")
|
||||||
|
X(add_bounds_tactic, arith_bounds_tactic, "add bounds tactic")
|
||||||
|
"""
|
||||||
|
print("Generating trace tag documentation...")
|
||||||
|
def_file = os.path.join(SCRIPT_DIR, "../src/util/trace_tags.def")
|
||||||
|
output_md = os.path.join(OUTPUT_DIRECTORY, "trace_tags.md")
|
||||||
|
|
||||||
|
if not os.path.exists(def_file):
|
||||||
|
print(f"Warning: {def_file} not found. Skipping trace tag documentation generation.")
|
||||||
|
return
|
||||||
|
|
||||||
|
with open(def_file, "r") as f:
|
||||||
|
lines = f.readlines()
|
||||||
|
|
||||||
|
entries = []
|
||||||
|
for line in lines:
|
||||||
|
match = re.match(r'X\(\s*(\w+)\s*,\s*(\w+)\s*,\s*"([^"]+)"\s*\)', line)
|
||||||
|
if match:
|
||||||
|
tag_class, tag, desc = match.groups()
|
||||||
|
entries.append((tag_class, tag, desc))
|
||||||
|
|
||||||
|
mk_dir(os.path.dirname(output_md))
|
||||||
|
with open(output_md, "w", encoding='utf-8') as f:
|
||||||
|
f.write("# Z3 Trace Tags Documentation\n\n")
|
||||||
|
f.write("This document contains the trace tags and their descriptions used in Z3.\n\n")
|
||||||
|
f.write("| Tag | Class | Description |\n")
|
||||||
|
f.write("|-----|-------|-------------|\n")
|
||||||
|
for tag, class_name, desc in sorted(entries):
|
||||||
|
f.write(f"| {tag} | {class_name} | {desc} |\n")
|
||||||
|
|
||||||
|
print(f"Trace tag documentation has been generated at {output_md}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
parse_options()
|
parse_options()
|
||||||
|
|
||||||
print("Creating temporary directory \"{}\"".format(TEMP_DIR))
|
print("Creating temporary directory \"{}\"".format(TEMP_DIR))
|
||||||
mk_dir(TEMP_DIR)
|
mk_dir(TEMP_DIR)
|
||||||
|
|
||||||
|
# Generate trace tag documentation
|
||||||
|
generate_trace_tag_docs()
|
||||||
|
|
||||||
# Short-hand for path to temporary file
|
# Short-hand for path to temporary file
|
||||||
def temp_path(path):
|
def temp_path(path):
|
||||||
return os.path.join(TEMP_DIR, path)
|
return os.path.join(TEMP_DIR, path)
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
tactic_report report("ackermannize_bv", *g);
|
tactic_report report("ackermannize_bv", *g);
|
||||||
fail_if_unsat_core_generation("ackermannize", g);
|
fail_if_unsat_core_generation("ackermannize", g);
|
||||||
fail_if_proof_generation("ackermannize", g);
|
fail_if_proof_generation("ackermannize", g);
|
||||||
TRACE("goal", g->display(tout << "in\n"););
|
TRACE(goal, g->display(tout << "in\n"););
|
||||||
|
|
||||||
ptr_vector<expr> flas;
|
ptr_vector<expr> flas;
|
||||||
const unsigned sz = g->size();
|
const unsigned sz = g->size();
|
||||||
|
@ -46,7 +46,7 @@ public:
|
||||||
goal_ref resg(alloc(goal, *g, true));
|
goal_ref resg(alloc(goal, *g, true));
|
||||||
const bool success = lackr.mk_ackermann(resg, m_lemma_limit);
|
const bool success = lackr.mk_ackermann(resg, m_lemma_limit);
|
||||||
if (!success) { // Just pass on the input unchanged
|
if (!success) { // Just pass on the input unchanged
|
||||||
TRACE("ackermannize", tout << "ackermannize not run due to limit" << std::endl;);
|
TRACE(ackermannize, tout << "ackermannize not run due to limit" << std::endl;);
|
||||||
result.reset();
|
result.reset();
|
||||||
result.push_back(g.get());
|
result.push_back(g.get());
|
||||||
return;
|
return;
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
resg->inc_depth();
|
resg->inc_depth();
|
||||||
TRACE("goal", resg->display(tout << "out\n"););
|
TRACE(goal, resg->display(tout << "out\n"););
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
}
|
}
|
||||||
p.prune_non_select();
|
p.prune_non_select();
|
||||||
double total = ackr_helper::calculate_lemma_bound(p.m_fun2terms, p.m_sel2terms);
|
double total = ackr_helper::calculate_lemma_bound(p.m_fun2terms, p.m_sel2terms);
|
||||||
TRACE("ackermannize", tout << "total=" << total << std::endl;);
|
TRACE(ackermannize, tout << "total=" << total << std::endl;);
|
||||||
return result(total);
|
return result(total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,9 @@ public:
|
||||||
void get_units(obj_map<expr, bool>& units) override { units.reset(); }
|
void get_units(obj_map<expr, bool>& units) override { units.reset(); }
|
||||||
|
|
||||||
void operator()(model_ref & md) override {
|
void operator()(model_ref & md) override {
|
||||||
TRACE("ackermannize", tout << (fixed_model? "fixed" : "nonfixed") << "\n";);
|
TRACE(ackermannize, tout << (fixed_model? "fixed" : "nonfixed") << "\n";);
|
||||||
CTRACE("ackermannize", md, tout << *md << "\n");
|
CTRACE(ackermannize, md, tout << *md << "\n");
|
||||||
CTRACE("ackermannize", fixed_model, tout << *abstr_model << "\n");
|
CTRACE(ackermannize, fixed_model, tout << *abstr_model << "\n");
|
||||||
|
|
||||||
model* new_model = alloc(model, m);
|
model* new_model = alloc(model, m);
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ void ackr_model_converter::convert(model * source, model * destination) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ackr_model_converter::convert_constants(model * source, model * destination) {
|
void ackr_model_converter::convert_constants(model * source, model * destination) {
|
||||||
TRACE("ackermannize", tout << "converting constants\n";);
|
TRACE(ackermannize, tout << "converting constants\n";);
|
||||||
obj_map<func_decl, func_interp*> interpretations;
|
obj_map<func_decl, func_interp*> interpretations;
|
||||||
obj_map<app, expr*> array_interpretations;
|
obj_map<app, expr*> array_interpretations;
|
||||||
model_evaluator evaluator(*source);
|
model_evaluator evaluator(*source);
|
||||||
|
@ -107,7 +107,7 @@ void ackr_model_converter::convert_constants(model * source, model * destination
|
||||||
func_decl * const c = source->get_constant(i);
|
func_decl * const c = source->get_constant(i);
|
||||||
app * const term = info->find_term(c);
|
app * const term = info->find_term(c);
|
||||||
expr * value = source->get_const_interp(c);
|
expr * value = source->get_const_interp(c);
|
||||||
TRACE("ackermannize", tout << mk_ismt2_pp(c, m) << " " << mk_ismt2_pp(term, m) << "\n";);
|
TRACE(ackermannize, tout << mk_ismt2_pp(c, m) << " " << mk_ismt2_pp(term, m) << "\n";);
|
||||||
if (!term)
|
if (!term)
|
||||||
destination->register_decl(c, value);
|
destination->register_decl(c, value);
|
||||||
else if (autil.is_select(term))
|
else if (autil.is_select(term))
|
||||||
|
@ -160,7 +160,7 @@ void ackr_model_converter::add_entry(model_evaluator & evaluator,
|
||||||
void ackr_model_converter::add_entry(model_evaluator & evaluator,
|
void ackr_model_converter::add_entry(model_evaluator & evaluator,
|
||||||
app* term, expr* value,
|
app* term, expr* value,
|
||||||
obj_map<func_decl, func_interp*>& interpretations) {
|
obj_map<func_decl, func_interp*>& interpretations) {
|
||||||
TRACE("ackermannize", tout << "add_entry"
|
TRACE(ackermannize, tout << "add_entry"
|
||||||
<< mk_ismt2_pp(term, m, 2)
|
<< mk_ismt2_pp(term, m, 2)
|
||||||
<< "->"
|
<< "->"
|
||||||
<< mk_ismt2_pp(value, m, 2) << "\n";);
|
<< mk_ismt2_pp(value, m, 2) << "\n";);
|
||||||
|
@ -178,7 +178,7 @@ void ackr_model_converter::add_entry(model_evaluator & evaluator,
|
||||||
args.push_back(evaluator(info->abstract(arg)));
|
args.push_back(evaluator(info->abstract(arg)));
|
||||||
}
|
}
|
||||||
if (fi->get_entry(args.data()) == nullptr) {
|
if (fi->get_entry(args.data()) == nullptr) {
|
||||||
TRACE("ackermannize",
|
TRACE(ackermannize,
|
||||||
tout << mk_ismt2_pp(declaration, m) << " args: " << std::endl;
|
tout << mk_ismt2_pp(declaration, m) << " args: " << std::endl;
|
||||||
for (expr* arg : args) {
|
for (expr* arg : args) {
|
||||||
tout << mk_ismt2_pp(arg, m) << std::endl;
|
tout << mk_ismt2_pp(arg, m) << std::endl;
|
||||||
|
@ -187,7 +187,7 @@ void ackr_model_converter::add_entry(model_evaluator & evaluator,
|
||||||
fi->insert_new_entry(args.data(), value);
|
fi->insert_new_entry(args.data(), value);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("ackermannize", tout << "entry already present\n";);
|
TRACE(ackermannize, tout << "entry already present\n";);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ lbool lackr::operator()() {
|
||||||
if (rv == l_true) {
|
if (rv == l_true) {
|
||||||
m_solver->get_model(m_model);
|
m_solver->get_model(m_model);
|
||||||
}
|
}
|
||||||
CTRACE("ackermannize", rv == l_true, model_smt2_pp(tout << "abstr_model(\n", m, *(m_model.get()), 2); tout << ")\n"; );
|
CTRACE(ackermannize, rv == l_true, model_smt2_pp(tout << "abstr_model(\n", m, *(m_model.get()), 2); tout << ")\n"; );
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ bool lackr::init() {
|
||||||
// Introduce ackermann lemma for the two given terms.
|
// Introduce ackermann lemma for the two given terms.
|
||||||
//
|
//
|
||||||
bool lackr::ackr(app * const t1, app * const t2) {
|
bool lackr::ackr(app * const t1, app * const t2) {
|
||||||
TRACE("ackermannize", tout << "ackr " << mk_ismt2_pp(t1, m, 2) << " , " << mk_ismt2_pp(t2, m, 2) << "\n";);
|
TRACE(ackermannize, tout << "ackr " << mk_ismt2_pp(t1, m, 2) << " , " << mk_ismt2_pp(t2, m, 2) << "\n";);
|
||||||
const unsigned sz = t1->get_num_args();
|
const unsigned sz = t1->get_num_args();
|
||||||
SASSERT(t2->get_num_args() == sz);
|
SASSERT(t2->get_num_args() == sz);
|
||||||
expr_ref_vector eqs(m);
|
expr_ref_vector eqs(m);
|
||||||
|
@ -112,7 +112,7 @@ bool lackr::ackr(app * const t1, app * const t2) {
|
||||||
expr * const arg2 = t2->get_arg(i);
|
expr * const arg2 = t2->get_arg(i);
|
||||||
if (m.are_equal(arg1, arg2)) continue; // quickly skip syntactically equal
|
if (m.are_equal(arg1, arg2)) continue; // quickly skip syntactically equal
|
||||||
if (m.are_distinct(arg1, arg2)){ // quickly abort if there are two distinct (e.g. numerals)
|
if (m.are_distinct(arg1, arg2)){ // quickly abort if there are two distinct (e.g. numerals)
|
||||||
TRACE("ackermannize", tout << "never eq\n";);
|
TRACE(ackermannize, tout << "never eq\n";);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
eqs.push_back(m.mk_eq(arg1, arg2));
|
eqs.push_back(m.mk_eq(arg1, arg2));
|
||||||
|
@ -125,7 +125,7 @@ bool lackr::ackr(app * const t1, app * const t2) {
|
||||||
expr_ref cg(m.mk_implies(lhs, rhs), m);
|
expr_ref cg(m.mk_implies(lhs, rhs), m);
|
||||||
expr_ref cga = m_info->abstract(cg); // constraint needs abstraction due to nested applications
|
expr_ref cga = m_info->abstract(cg); // constraint needs abstraction due to nested applications
|
||||||
m_simp(cga);
|
m_simp(cga);
|
||||||
TRACE("ackermannize",
|
TRACE(ackermannize,
|
||||||
tout << "abstr1 " << mk_ismt2_pp(a1, m, 2) << "\n";
|
tout << "abstr1 " << mk_ismt2_pp(a1, m, 2) << "\n";
|
||||||
tout << "abstr2 " << mk_ismt2_pp(a2, m, 2) << "\n";
|
tout << "abstr2 " << mk_ismt2_pp(a2, m, 2) << "\n";
|
||||||
tout << "ackr constr lhs" << mk_ismt2_pp(lhs, m, 2) << "\n";
|
tout << "ackr constr lhs" << mk_ismt2_pp(lhs, m, 2) << "\n";
|
||||||
|
@ -144,7 +144,7 @@ bool lackr::ackr(app * const t1, app * const t2) {
|
||||||
// Introduce the ackermann lemma for each pair of terms.
|
// Introduce the ackermann lemma for each pair of terms.
|
||||||
//
|
//
|
||||||
void lackr::eager_enc() {
|
void lackr::eager_enc() {
|
||||||
TRACE("ackermannize", tout << "#funs: " << m_fun2terms.size() << " #sels: " << m_sel2terms.size() << std::endl;);
|
TRACE(ackermannize, tout << "#funs: " << m_fun2terms.size() << " #sels: " << m_sel2terms.size() << std::endl;);
|
||||||
for (auto const& [k,v] : m_fun2terms) {
|
for (auto const& [k,v] : m_fun2terms) {
|
||||||
checkpoint();
|
checkpoint();
|
||||||
ackr(v);
|
ackr(v);
|
||||||
|
@ -227,7 +227,7 @@ void lackr::push_abstraction() {
|
||||||
lbool lackr::eager() {
|
lbool lackr::eager() {
|
||||||
SASSERT(m_is_init);
|
SASSERT(m_is_init);
|
||||||
push_abstraction();
|
push_abstraction();
|
||||||
TRACE("ackermannize", tout << "run sat 0\n"; );
|
TRACE(ackermannize, tout << "run sat 0\n"; );
|
||||||
lbool rv0 = m_solver->check_sat(0, nullptr);
|
lbool rv0 = m_solver->check_sat(0, nullptr);
|
||||||
if (rv0 == l_false) {
|
if (rv0 == l_false) {
|
||||||
return l_false;
|
return l_false;
|
||||||
|
@ -236,7 +236,7 @@ lbool lackr::eager() {
|
||||||
expr_ref all = mk_and(m_ackrs);
|
expr_ref all = mk_and(m_ackrs);
|
||||||
m_simp(all);
|
m_simp(all);
|
||||||
m_solver->assert_expr(all);
|
m_solver->assert_expr(all);
|
||||||
TRACE("ackermannize", tout << "run sat all\n"; );
|
TRACE(ackermannize, tout << "run sat all\n"; );
|
||||||
return m_solver->check_sat(0, nullptr);
|
return m_solver->check_sat(0, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ lbool lackr::lazy() {
|
||||||
while (true) {
|
while (true) {
|
||||||
m_st.m_it++;
|
m_st.m_it++;
|
||||||
checkpoint();
|
checkpoint();
|
||||||
TRACE("ackermannize", tout << "lazy check: " << m_st.m_it << "\n";);
|
TRACE(ackermannize, tout << "lazy check: " << m_st.m_it << "\n";);
|
||||||
const lbool r = m_solver->check_sat(0, nullptr);
|
const lbool r = m_solver->check_sat(0, nullptr);
|
||||||
if (r == l_undef) return l_undef; // give up
|
if (r == l_undef) return l_undef; // give up
|
||||||
if (r == l_false) return l_false; // abstraction unsat
|
if (r == l_false) return l_false; // abstraction unsat
|
||||||
|
|
|
@ -199,12 +199,12 @@ private:
|
||||||
for (unsigned i = 0; i < num; ++i) {
|
for (unsigned i = 0; i < num; ++i) {
|
||||||
expr * val = nullptr;
|
expr * val = nullptr;
|
||||||
const bool b = eval_cached(to_app(args[i]), val); // TODO: OK conversion to_app?
|
const bool b = eval_cached(to_app(args[i]), val); // TODO: OK conversion to_app?
|
||||||
CTRACE("model_constructor", m_conflicts.empty() && !b, tout << "fail arg val(\n" << mk_ismt2_pp(args[i], m, 2) << '\n'; );
|
CTRACE(model_constructor, m_conflicts.empty() && !b, tout << "fail arg val(\n" << mk_ismt2_pp(args[i], m, 2) << '\n'; );
|
||||||
if (!b) {
|
if (!b) {
|
||||||
// bailing out because args eval failed previously
|
// bailing out because args eval failed previously
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TRACE("model_constructor", tout <<
|
TRACE(model_constructor, tout <<
|
||||||
"arg val " << i << "(\n" << mk_ismt2_pp(args[i], m, 2)
|
"arg val " << i << "(\n" << mk_ismt2_pp(args[i], m, 2)
|
||||||
<< " : " << mk_ismt2_pp(val, m, 2) << '\n'; );
|
<< " : " << mk_ismt2_pp(val, m, 2) << '\n'; );
|
||||||
SASSERT(b);
|
SASSERT(b);
|
||||||
|
@ -233,15 +233,15 @@ private:
|
||||||
bool mk_value(app * a) {
|
bool mk_value(app * a) {
|
||||||
if (is_val(a))
|
if (is_val(a))
|
||||||
return true; // skip numerals
|
return true; // skip numerals
|
||||||
TRACE("model_constructor", tout << "mk_value(\n" << mk_ismt2_pp(a, m, 2) << ")\n";);
|
TRACE(model_constructor, tout << "mk_value(\n" << mk_ismt2_pp(a, m, 2) << ")\n";);
|
||||||
SASSERT(!m_app2val.contains(a));
|
SASSERT(!m_app2val.contains(a));
|
||||||
expr_ref result(m);
|
expr_ref result(m);
|
||||||
if (!evaluate(a, result))
|
if (!evaluate(a, result))
|
||||||
return false;
|
return false;
|
||||||
TRACE("model_constructor",
|
TRACE(model_constructor,
|
||||||
tout << "map term(\n" << mk_ismt2_pp(a, m, 2) << "\n->"
|
tout << "map term(\n" << mk_ismt2_pp(a, m, 2) << "\n->"
|
||||||
<< mk_ismt2_pp(result.get(), m, 2)<< ")\n"; );
|
<< mk_ismt2_pp(result.get(), m, 2)<< ")\n"; );
|
||||||
CTRACE("model_constructor",
|
CTRACE(model_constructor,
|
||||||
!is_val(result.get()),
|
!is_val(result.get()),
|
||||||
tout << "eval didn't create a constant \n" << mk_ismt2_pp(a, m, 2) << " " << mk_ismt2_pp(result, m, 2) << "\n";
|
tout << "eval didn't create a constant \n" << mk_ismt2_pp(a, m, 2) << " " << mk_ismt2_pp(result, m, 2) << "\n";
|
||||||
);
|
);
|
||||||
|
@ -284,7 +284,7 @@ private:
|
||||||
SASSERT(vi.source_term);
|
SASSERT(vi.source_term);
|
||||||
const bool ok = vi.value == value;
|
const bool ok = vi.value == value;
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
TRACE("model_constructor",
|
TRACE(model_constructor,
|
||||||
tout << "already mapped by(\n" << mk_ismt2_pp(vi.source_term, m, 2) << "\n->"
|
tout << "already mapped by(\n" << mk_ismt2_pp(vi.source_term, m, 2) << "\n->"
|
||||||
<< mk_ismt2_pp(vi.value, m, 2) << ")\n"; );
|
<< mk_ismt2_pp(vi.value, m, 2) << ")\n"; );
|
||||||
m_conflicts.push_back(std::make_pair(a, vi.source_term));
|
m_conflicts.push_back(std::make_pair(a, vi.source_term));
|
||||||
|
@ -315,7 +315,7 @@ private:
|
||||||
expr_ref term(m);
|
expr_ref term(m);
|
||||||
term = m.mk_app(a->get_decl(), num, values.data());
|
term = m.mk_app(a->get_decl(), num, values.data());
|
||||||
m_evaluator->operator() (term, result);
|
m_evaluator->operator() (term, result);
|
||||||
TRACE("model_constructor",
|
TRACE(model_constructor,
|
||||||
tout << "eval(\n" << mk_ismt2_pp(term.get(), m, 2) << "\n->"
|
tout << "eval(\n" << mk_ismt2_pp(term.get(), m, 2) << "\n->"
|
||||||
<< mk_ismt2_pp(result.get(), m, 2) << ")\n"; );
|
<< mk_ismt2_pp(result.get(), m, 2) << ")\n"; );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -30,7 +30,7 @@ void register_z3_replayer_cmds(z3_replayer & in);
|
||||||
|
|
||||||
|
|
||||||
void throw_invalid_reference() {
|
void throw_invalid_reference() {
|
||||||
TRACE("z3_replayer", tout << "invalid argument reference\n";);
|
TRACE(z3_replayer, tout << "invalid argument reference\n";);
|
||||||
throw z3_replayer_exception("invalid argument reference");
|
throw z3_replayer_exception("invalid argument reference");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,14 +72,14 @@ struct z3_replayer::imp {
|
||||||
|
|
||||||
void check_arg(unsigned pos, value_kind k) const {
|
void check_arg(unsigned pos, value_kind k) const {
|
||||||
if (pos >= m_args.size()) {
|
if (pos >= m_args.size()) {
|
||||||
TRACE("z3_replayer", tout << pos << " too few arguments " << m_args.size() << " expecting " << kind2string(k) << "\n";);
|
TRACE(z3_replayer, tout << pos << " too few arguments " << m_args.size() << " expecting " << kind2string(k) << "\n";);
|
||||||
throw z3_replayer_exception("invalid argument reference");
|
throw z3_replayer_exception("invalid argument reference");
|
||||||
}
|
}
|
||||||
if (m_args[pos].m_kind != k) {
|
if (m_args[pos].m_kind != k) {
|
||||||
std::stringstream strm;
|
std::stringstream strm;
|
||||||
strm << "expecting " << kind2string(k) << " at position "
|
strm << "expecting " << kind2string(k) << " at position "
|
||||||
<< pos << " but got " << kind2string(m_args[pos].m_kind);
|
<< pos << " but got " << kind2string(m_args[pos].m_kind);
|
||||||
TRACE("z3_replayer", tout << strm.str() << "\n";);
|
TRACE(z3_replayer, tout << strm.str() << "\n";);
|
||||||
throw z3_replayer_exception(std::move(strm).str());
|
throw z3_replayer_exception(std::move(strm).str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ struct z3_replayer::imp {
|
||||||
throw z3_replayer_exception("invalid escaped character");
|
throw z3_replayer_exception("invalid escaped character");
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
TRACE("z3_replayer_escape", tout << "val: " << val << "\n";);
|
TRACE(z3_replayer_escape, tout << "val: " << val << "\n";);
|
||||||
m_string.push_back(static_cast<char>(val));
|
m_string.push_back(static_cast<char>(val));
|
||||||
}
|
}
|
||||||
else if (c == delimiter) {
|
else if (c == delimiter) {
|
||||||
|
@ -300,7 +300,7 @@ struct z3_replayer::imp {
|
||||||
|
|
||||||
void read_ptr() {
|
void read_ptr() {
|
||||||
if (!(('0' <= curr() && curr() <= '9') || ('A' <= curr() && curr() <= 'F') || ('a' <= curr() && curr() <= 'f'))) {
|
if (!(('0' <= curr() && curr() <= '9') || ('A' <= curr() && curr() <= 'F') || ('a' <= curr() && curr() <= 'f'))) {
|
||||||
TRACE("invalid_ptr", tout << "curr: " << curr() << "\n";);
|
TRACE(invalid_ptr, tout << "curr: " << curr() << "\n";);
|
||||||
throw z3_replayer_exception("invalid ptr");
|
throw z3_replayer_exception("invalid ptr");
|
||||||
}
|
}
|
||||||
unsigned pos = 0;
|
unsigned pos = 0;
|
||||||
|
@ -380,7 +380,7 @@ struct z3_replayer::imp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (k == OBJECT) {
|
else if (k == OBJECT) {
|
||||||
TRACE("z3_replayer_bug",
|
TRACE(z3_replayer_bug,
|
||||||
tout << "args: "; display_args(tout); tout << "\n";
|
tout << "args: "; display_args(tout); tout << "\n";
|
||||||
tout << "push_back, sz: " << sz << ", m_obj_arrays.size(): " << m_obj_arrays.size() << "\n";
|
tout << "push_back, sz: " << sz << ", m_obj_arrays.size(): " << m_obj_arrays.size() << "\n";
|
||||||
for (unsigned i = asz - sz; i < asz; i++) {
|
for (unsigned i = asz - sz; i < asz; i++) {
|
||||||
|
@ -427,13 +427,13 @@ struct z3_replayer::imp {
|
||||||
case 'R':
|
case 'R':
|
||||||
// reset
|
// reset
|
||||||
next();
|
next();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "R\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "R\n";);
|
||||||
reset();
|
reset();
|
||||||
break;
|
break;
|
||||||
case 'P': {
|
case 'P': {
|
||||||
// push pointer
|
// push pointer
|
||||||
next(); skip_blank(); read_ptr();
|
next(); skip_blank(); read_ptr();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "P " << m_ptr << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "P " << m_ptr << "\n";);
|
||||||
if (m_ptr == 0) {
|
if (m_ptr == 0) {
|
||||||
m_args.push_back(nullptr);
|
m_args.push_back(nullptr);
|
||||||
}
|
}
|
||||||
|
@ -442,14 +442,14 @@ struct z3_replayer::imp {
|
||||||
if (!m_heap.find(m_ptr, obj))
|
if (!m_heap.find(m_ptr, obj))
|
||||||
throw z3_replayer_exception("invalid pointer");
|
throw z3_replayer_exception("invalid pointer");
|
||||||
m_args.push_back(value(obj));
|
m_args.push_back(value(obj));
|
||||||
TRACE("z3_replayer_bug", tout << "args after 'P':\n"; display_args(tout); tout << "\n";);
|
TRACE(z3_replayer_bug, tout << "args after 'P':\n"; display_args(tout); tout << "\n";);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'S': {
|
case 'S': {
|
||||||
// push string
|
// push string
|
||||||
next(); skip_blank(); read_string();
|
next(); skip_blank(); read_string();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "S " << m_string.begin() << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "S " << m_string.begin() << "\n";);
|
||||||
symbol sym(m_string.begin()); // save string
|
symbol sym(m_string.begin()); // save string
|
||||||
m_args.push_back(value(STRING, sym.bare_str()));
|
m_args.push_back(value(STRING, sym.bare_str()));
|
||||||
break;
|
break;
|
||||||
|
@ -457,20 +457,20 @@ struct z3_replayer::imp {
|
||||||
case 'N':
|
case 'N':
|
||||||
// push null symbol
|
// push null symbol
|
||||||
next();
|
next();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "N\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "N\n";);
|
||||||
m_args.push_back(value(SYMBOL, symbol::null));
|
m_args.push_back(value(SYMBOL, symbol::null));
|
||||||
break;
|
break;
|
||||||
case '$': {
|
case '$': {
|
||||||
// push symbol
|
// push symbol
|
||||||
next(); skip_blank(); read_quoted_symbol();
|
next(); skip_blank(); read_quoted_symbol();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "$ " << m_id << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "$ " << m_id << "\n";);
|
||||||
m_args.push_back(value(SYMBOL, m_id));
|
m_args.push_back(value(SYMBOL, m_id));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case '#': {
|
case '#': {
|
||||||
// push numeral symbol
|
// push numeral symbol
|
||||||
next(); skip_blank(); read_uint64();
|
next(); skip_blank(); read_uint64();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "# " << m_uint64 << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "# " << m_uint64 << "\n";);
|
||||||
symbol sym(static_cast<unsigned>(m_uint64));
|
symbol sym(static_cast<unsigned>(m_uint64));
|
||||||
m_args.push_back(value(SYMBOL, sym));
|
m_args.push_back(value(SYMBOL, sym));
|
||||||
break;
|
break;
|
||||||
|
@ -478,25 +478,25 @@ struct z3_replayer::imp {
|
||||||
case 'I':
|
case 'I':
|
||||||
// push integer;
|
// push integer;
|
||||||
next(); skip_blank(); read_int64();
|
next(); skip_blank(); read_int64();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "I " << m_int64 << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "I " << m_int64 << "\n";);
|
||||||
m_args.push_back(value(INT64, m_int64));
|
m_args.push_back(value(INT64, m_int64));
|
||||||
break;
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
// push unsigned;
|
// push unsigned;
|
||||||
next(); skip_blank(); read_uint64();
|
next(); skip_blank(); read_uint64();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "U " << m_uint64 << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "U " << m_uint64 << "\n";);
|
||||||
m_args.push_back(value(UINT64, m_uint64));
|
m_args.push_back(value(UINT64, m_uint64));
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
// push float
|
// push float
|
||||||
next(); skip_blank(); read_float();
|
next(); skip_blank(); read_float();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "F " << m_float << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "F " << m_float << "\n";);
|
||||||
m_args.push_back(value(FLOAT, m_float));
|
m_args.push_back(value(FLOAT, m_float));
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
// push double
|
// push double
|
||||||
next(); skip_blank(); read_double();
|
next(); skip_blank(); read_double();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "D " << m_double << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "D " << m_double << "\n";);
|
||||||
m_args.push_back(value(DOUBLE, m_double));
|
m_args.push_back(value(DOUBLE, m_double));
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
|
@ -505,7 +505,7 @@ struct z3_replayer::imp {
|
||||||
case 'i':
|
case 'i':
|
||||||
// push array
|
// push array
|
||||||
next(); skip_blank(); read_uint64();
|
next(); skip_blank(); read_uint64();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "A " << m_uint64 << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "A " << m_uint64 << "\n";);
|
||||||
if (c == 'p')
|
if (c == 'p')
|
||||||
push_array(static_cast<unsigned>(m_uint64), OBJECT);
|
push_array(static_cast<unsigned>(m_uint64), OBJECT);
|
||||||
else if (c == 's')
|
else if (c == 's')
|
||||||
|
@ -518,12 +518,12 @@ struct z3_replayer::imp {
|
||||||
case 'C': {
|
case 'C': {
|
||||||
// call procedure
|
// call procedure
|
||||||
next(); skip_blank(); read_uint64();
|
next(); skip_blank(); read_uint64();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "C " << m_uint64 << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "C " << m_uint64 << "\n";);
|
||||||
unsigned idx = static_cast<unsigned>(m_uint64);
|
unsigned idx = static_cast<unsigned>(m_uint64);
|
||||||
if (idx >= m_cmds.size())
|
if (idx >= m_cmds.size())
|
||||||
throw z3_replayer_exception("invalid command");
|
throw z3_replayer_exception("invalid command");
|
||||||
try {
|
try {
|
||||||
TRACE("z3_replayer_cmd", tout << idx << ":" << m_cmds_names[idx] << "\n";);
|
TRACE(z3_replayer_cmd, tout << idx << ":" << m_cmds_names[idx] << "\n";);
|
||||||
m_cmds[idx](m_owner);
|
m_cmds[idx](m_owner);
|
||||||
}
|
}
|
||||||
catch (z3_error & ex) {
|
catch (z3_error & ex) {
|
||||||
|
@ -541,7 +541,7 @@ struct z3_replayer::imp {
|
||||||
// save result
|
// save result
|
||||||
// = obj_id
|
// = obj_id
|
||||||
next(); skip_blank(); read_ptr();
|
next(); skip_blank(); read_ptr();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "= " << m_ptr << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "= " << m_ptr << "\n";);
|
||||||
m_heap.insert(m_ptr, m_result);
|
m_heap.insert(m_ptr, m_result);
|
||||||
break;
|
break;
|
||||||
case '*': {
|
case '*': {
|
||||||
|
@ -549,7 +549,7 @@ struct z3_replayer::imp {
|
||||||
// @ obj_id pos
|
// @ obj_id pos
|
||||||
next(); skip_blank(); read_ptr(); skip_blank(); read_uint64();
|
next(); skip_blank(); read_ptr(); skip_blank(); read_uint64();
|
||||||
unsigned pos = static_cast<unsigned>(m_uint64);
|
unsigned pos = static_cast<unsigned>(m_uint64);
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "* " << m_ptr << " " << pos << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "* " << m_ptr << " " << pos << "\n";);
|
||||||
check_arg(pos, OBJECT);
|
check_arg(pos, OBJECT);
|
||||||
m_heap.insert(m_ptr, m_args[pos].m_obj);
|
m_heap.insert(m_ptr, m_args[pos].m_obj);
|
||||||
break;
|
break;
|
||||||
|
@ -564,19 +564,19 @@ struct z3_replayer::imp {
|
||||||
ptr_vector<void> & v = m_obj_arrays[aidx];
|
ptr_vector<void> & v = m_obj_arrays[aidx];
|
||||||
skip_blank(); read_uint64();
|
skip_blank(); read_uint64();
|
||||||
unsigned idx = static_cast<unsigned>(m_uint64);
|
unsigned idx = static_cast<unsigned>(m_uint64);
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "@ " << m_ptr << " " << pos << " " << idx << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "@ " << m_ptr << " " << pos << " " << idx << "\n";);
|
||||||
TRACE("z3_replayer_bug", tout << "v[idx]: " << v[idx] << "\n";);
|
TRACE(z3_replayer_bug, tout << "v[idx]: " << v[idx] << "\n";);
|
||||||
m_heap.insert(m_ptr, v[idx]);
|
m_heap.insert(m_ptr, v[idx]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'M':
|
case 'M':
|
||||||
// user message
|
// user message
|
||||||
next(); skip_blank(); read_string();
|
next(); skip_blank(); read_string();
|
||||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "M " << m_string.begin() << "\n";);
|
TRACE(z3_replayer, tout << "[" << m_line << "] " << "M " << m_string.begin() << "\n";);
|
||||||
std::cout << m_string.begin() << "\n"; std::cout.flush();
|
std::cout << m_string.begin() << "\n"; std::cout.flush();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
TRACE("z3_replayer", tout << "unknown command " << c << "\n";);
|
TRACE(z3_replayer, tout << "unknown command " << c << "\n";);
|
||||||
throw z3_replayer_exception("unknown log command");
|
throw z3_replayer_exception("unknown log command");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -657,7 +657,7 @@ struct z3_replayer::imp {
|
||||||
check_arg(pos, OBJECT_ARRAY);
|
check_arg(pos, OBJECT_ARRAY);
|
||||||
unsigned idx = static_cast<unsigned>(m_args[pos].m_uint);
|
unsigned idx = static_cast<unsigned>(m_args[pos].m_uint);
|
||||||
ptr_vector<void> const & v = m_obj_arrays[idx];
|
ptr_vector<void> const & v = m_obj_arrays[idx];
|
||||||
TRACE("z3_replayer_bug", tout << "pos: " << pos << ", idx: " << idx << " size(): " << v.size() << "\n";
|
TRACE(z3_replayer_bug, tout << "pos: " << pos << ", idx: " << idx << " size(): " << v.size() << "\n";
|
||||||
for (unsigned i = 0; i < v.size(); i++) tout << v[i] << " "; tout << "\n";);
|
for (unsigned i = 0; i < v.size(); i++) tout << v[i] << " "; tout << "\n";);
|
||||||
return v.data();
|
return v.data();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,14 +39,14 @@ struct arith_decl_plugin::algebraic_numbers_wrapper {
|
||||||
unsigned idx = m_id_gen.mk();
|
unsigned idx = m_id_gen.mk();
|
||||||
m_nums.reserve(idx+1);
|
m_nums.reserve(idx+1);
|
||||||
m_amanager.set(m_nums[idx], val);
|
m_amanager.set(m_nums[idx], val);
|
||||||
TRACE("algebraic2expr", tout << "mk_id -> " << idx << "\n"; m_amanager.display(tout, val); tout << "\n";);
|
TRACE(algebraic2expr, tout << "mk_id -> " << idx << "\n"; m_amanager.display(tout, val); tout << "\n";);
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void recycle_id(unsigned idx) {
|
void recycle_id(unsigned idx) {
|
||||||
SASSERT(idx < m_nums.size());
|
SASSERT(idx < m_nums.size());
|
||||||
SASSERT(!m_amanager.is_zero(m_nums[idx]));
|
SASSERT(!m_amanager.is_zero(m_nums[idx]));
|
||||||
TRACE("algebraic2expr", tout << "recycling: " << idx << "\n";);
|
TRACE(algebraic2expr, tout << "recycling: " << idx << "\n";);
|
||||||
m_id_gen.recycle(idx);
|
m_id_gen.recycle(idx);
|
||||||
m_amanager.del(m_nums[idx]);
|
m_amanager.del(m_nums[idx]);
|
||||||
}
|
}
|
||||||
|
@ -667,7 +667,7 @@ bool arith_decl_plugin::are_equal(app * a, app * b) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool arith_decl_plugin::are_distinct(app * a, app * b) const {
|
bool arith_decl_plugin::are_distinct(app * a, app * b) const {
|
||||||
TRACE("are_distinct_bug", tout << mk_ismt2_pp(a, *m_manager) << "\n" << mk_ismt2_pp(b, *m_manager) << "\n";);
|
TRACE(are_distinct_bug, tout << mk_ismt2_pp(a, *m_manager) << "\n" << mk_ismt2_pp(b, *m_manager) << "\n";);
|
||||||
if (decl_plugin::are_distinct(a,b)) {
|
if (decl_plugin::are_distinct(a,b)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ sort * array_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, paramete
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort * range = to_sort(parameters[num_parameters - 1].get_ast());
|
sort * range = to_sort(parameters[num_parameters - 1].get_ast());
|
||||||
TRACE("array_decl_plugin_bug", tout << mk_pp(range, *m_manager) << "\n";);
|
TRACE(array_decl_plugin_bug, tout << mk_pp(range, *m_manager) << "\n";);
|
||||||
if (!range->is_infinite() && !range->is_very_big() && (1 == range->get_num_elements().size())) {
|
if (!range->is_infinite() && !range->is_very_big() && (1 == range->get_num_elements().size())) {
|
||||||
return m_manager->mk_sort(symbol(ARRAY_SORT_STR), sort_info(m_family_id, ARRAY_SORT, 1,
|
return m_manager->mk_sort(symbol(ARRAY_SORT_STR), sort_info(m_family_id, ARRAY_SORT, 1,
|
||||||
num_parameters, parameters));
|
num_parameters, parameters));
|
||||||
|
@ -550,7 +550,7 @@ func_decl * array_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
|
||||||
!parameters[0].is_ast() ||
|
!parameters[0].is_ast() ||
|
||||||
!is_func_decl(parameters[0].get_ast()) ||
|
!is_func_decl(parameters[0].get_ast()) ||
|
||||||
to_func_decl(parameters[0].get_ast())->get_arity() == 0) {
|
to_func_decl(parameters[0].get_ast())->get_arity() == 0) {
|
||||||
TRACE("array_bug",
|
TRACE(array_bug,
|
||||||
tout << "num_parameters: " << num_parameters << std::endl;
|
tout << "num_parameters: " << num_parameters << std::endl;
|
||||||
tout << "parameter.kind: " << parameters[0].is_int() << " " << parameters[0].is_ast() << " " << parameters[0].is_symbol() << "\n";
|
tout << "parameter.kind: " << parameters[0].is_int() << " " << parameters[0].is_ast() << " " << parameters[0].is_symbol() << "\n";
|
||||||
tout << "as-array-bug: " << to_func_decl(parameters[0].get_ast())->get_name() << " " << to_func_decl(parameters[0].get_ast())->get_arity() << std::endl;);
|
tout << "as-array-bug: " << to_func_decl(parameters[0].get_ast())->get_name() << " " << to_func_decl(parameters[0].get_ast())->get_arity() << std::endl;);
|
||||||
|
|
|
@ -1506,7 +1506,7 @@ std::ostream& ast_manager::display(std::ostream& out, parameter const& p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ast_manager::copy_families_plugins(ast_manager const & from) {
|
void ast_manager::copy_families_plugins(ast_manager const & from) {
|
||||||
TRACE("copy_families_plugins",
|
TRACE(copy_families_plugins,
|
||||||
tout << "target:\n";
|
tout << "target:\n";
|
||||||
for (family_id fid = 0; m_family_manager.has_family(fid); fid++) {
|
for (family_id fid = 0; m_family_manager.has_family(fid); fid++) {
|
||||||
tout << "fid: " << fid << " fidname: " << get_family_name(fid) << "\n";
|
tout << "fid: " << fid << " fidname: " << get_family_name(fid) << "\n";
|
||||||
|
@ -1520,7 +1520,7 @@ void ast_manager::copy_families_plugins(ast_manager const & from) {
|
||||||
if (!m_family_manager.has_family(fid)) {
|
if (!m_family_manager.has_family(fid)) {
|
||||||
family_id new_fid = mk_family_id(fid_name);
|
family_id new_fid = mk_family_id(fid_name);
|
||||||
(void)new_fid;
|
(void)new_fid;
|
||||||
TRACE("copy_families_plugins", tout << "new target fid created: " << new_fid << " fid_name: " << fid_name << "\n";);
|
TRACE(copy_families_plugins, tout << "new target fid created: " << new_fid << " fid_name: " << fid_name << "\n";);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (family_id fid = 0; from.m_family_manager.has_family(fid); fid++) {
|
for (family_id fid = 0; from.m_family_manager.has_family(fid); fid++) {
|
||||||
|
@ -1528,10 +1528,10 @@ void ast_manager::copy_families_plugins(ast_manager const & from) {
|
||||||
SASSERT(!from.is_builtin_family_id(fid) || m_family_manager.has_family(fid));
|
SASSERT(!from.is_builtin_family_id(fid) || m_family_manager.has_family(fid));
|
||||||
symbol fid_name = from.get_family_name(fid);
|
symbol fid_name = from.get_family_name(fid);
|
||||||
(void)fid_name;
|
(void)fid_name;
|
||||||
TRACE("copy_families_plugins", tout << "copying: " << fid_name << ", src fid: " << fid
|
TRACE(copy_families_plugins, tout << "copying: " << fid_name << ", src fid: " << fid
|
||||||
<< ", target has_family: " << m_family_manager.has_family(fid) << "\n";
|
<< ", target has_family: " << m_family_manager.has_family(fid) << "\n";
|
||||||
if (m_family_manager.has_family(fid)) tout << get_family_id(fid_name) << "\n";);
|
if (m_family_manager.has_family(fid)) tout << get_family_id(fid_name) << "\n";);
|
||||||
TRACE("copy_families_plugins", tout << "target fid: " << get_family_id(fid_name) << "\n";);
|
TRACE(copy_families_plugins, tout << "target fid: " << get_family_id(fid_name) << "\n";);
|
||||||
SASSERT(fid == get_family_id(fid_name));
|
SASSERT(fid == get_family_id(fid_name));
|
||||||
if (from.has_plugin(fid) && !has_plugin(fid)) {
|
if (from.has_plugin(fid) && !has_plugin(fid)) {
|
||||||
decl_plugin * new_p = from.get_plugin(fid)->mk_fresh();
|
decl_plugin * new_p = from.get_plugin(fid)->mk_fresh();
|
||||||
|
@ -1630,7 +1630,7 @@ bool ast_manager::are_distinct(expr* a, expr* b) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ast_manager::add_lambda_def(func_decl* f, quantifier* q) {
|
void ast_manager::add_lambda_def(func_decl* f, quantifier* q) {
|
||||||
TRACE("model", tout << "add lambda def " << mk_pp(q, *this) << "\n");
|
TRACE(model, tout << "add lambda def " << mk_pp(q, *this) << "\n");
|
||||||
m_lambda_defs.insert(f, q);
|
m_lambda_defs.insert(f, q);
|
||||||
f->get_info()->set_lambda(true);
|
f->get_info()->set_lambda(true);
|
||||||
inc_ref(q);
|
inc_ref(q);
|
||||||
|
@ -1658,7 +1658,7 @@ bool ast_manager::slow_not_contains(ast const * n) {
|
||||||
unsigned num = 0;
|
unsigned num = 0;
|
||||||
for (ast * curr : m_ast_table) {
|
for (ast * curr : m_ast_table) {
|
||||||
if (compare_nodes(curr, n)) {
|
if (compare_nodes(curr, n)) {
|
||||||
TRACE("nondet_bug",
|
TRACE(nondet_bug,
|
||||||
tout << "id1: " << curr->get_id() << ", id2: " << n->get_id() << "\n";
|
tout << "id1: " << curr->get_id() << ", id2: " << n->get_id() << "\n";
|
||||||
tout << "hash1: " << get_node_hash(curr) << ", hash2: " << get_node_hash(n) << "\n";);
|
tout << "hash1: " << get_node_hash(curr) << ", hash2: " << get_node_hash(n) << "\n";);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1680,7 +1680,7 @@ static unsigned s_count = 0;
|
||||||
static void track_id(ast_manager& m, ast* n, unsigned id) {
|
static void track_id(ast_manager& m, ast* n, unsigned id) {
|
||||||
if (n->get_id() != id) return;
|
if (n->get_id() != id) return;
|
||||||
++s_count;
|
++s_count;
|
||||||
TRACE("ast", tout << s_count << "\n";);
|
TRACE(ast, tout << s_count << "\n";);
|
||||||
// SASSERT(s_count != 5);
|
// SASSERT(s_count != 5);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1717,8 +1717,8 @@ ast * ast_manager::register_node_core(ast * n) {
|
||||||
|
|
||||||
// track_id(*this, n, 9213);
|
// track_id(*this, n, 9213);
|
||||||
|
|
||||||
// TRACE("ast", tout << (s_count++) << " Object " << n->m_id << " was created.\n";);
|
// TRACE(ast, tout << (s_count++) << " Object " << n->m_id << " was created.\n";);
|
||||||
TRACE("mk_var_bug", tout << "mk_ast: " << n->m_id << "\n";);
|
TRACE(mk_var_bug, tout << "mk_ast: " << n->m_id << "\n";);
|
||||||
// increment reference counters
|
// increment reference counters
|
||||||
switch (n->get_kind()) {
|
switch (n->get_kind()) {
|
||||||
case AST_SORT:
|
case AST_SORT:
|
||||||
|
@ -1804,16 +1804,16 @@ ast * ast_manager::register_node_core(ast * n) {
|
||||||
|
|
||||||
|
|
||||||
void ast_manager::delete_node(ast * n) {
|
void ast_manager::delete_node(ast * n) {
|
||||||
TRACE("delete_node_bug", tout << mk_ll_pp(n, *this) << "\n";);
|
TRACE(delete_node_bug, tout << mk_ll_pp(n, *this) << "\n";);
|
||||||
|
|
||||||
SASSERT(m_ast_table.contains(n));
|
SASSERT(m_ast_table.contains(n));
|
||||||
m_ast_table.push_erase(n);
|
m_ast_table.push_erase(n);
|
||||||
|
|
||||||
while ((n = m_ast_table.pop_erase())) {
|
while ((n = m_ast_table.pop_erase())) {
|
||||||
|
|
||||||
CTRACE("del_quantifier", is_quantifier(n), tout << "deleting quantifier " << n->m_id << " " << n << "\n";);
|
CTRACE(del_quantifier, is_quantifier(n), tout << "deleting quantifier " << n->m_id << " " << n << "\n";);
|
||||||
TRACE("mk_var_bug", tout << "del_ast: " << " " << n->m_ref_count << "\n";);
|
TRACE(mk_var_bug, tout << "del_ast: " << " " << n->m_ref_count << "\n";);
|
||||||
TRACE("ast_delete_node", tout << mk_bounded_pp(n, *this) << "\n";);
|
TRACE(ast_delete_node, tout << mk_bounded_pp(n, *this) << "\n";);
|
||||||
|
|
||||||
SASSERT(!m_debug_ref_count || !m_debug_free_indices.contains(n->m_id));
|
SASSERT(!m_debug_ref_count || !m_debug_free_indices.contains(n->m_id));
|
||||||
|
|
||||||
|
@ -2251,7 +2251,7 @@ app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * ar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (decl->is_chainable()) {
|
else if (decl->is_chainable()) {
|
||||||
TRACE("chainable", tout << "chainable...\n";);
|
TRACE(chainable, tout << "chainable...\n";);
|
||||||
ptr_buffer<expr> new_args;
|
ptr_buffer<expr> new_args;
|
||||||
for (unsigned i = 1; i < num_args; i++) {
|
for (unsigned i = 1; i < num_args; i++) {
|
||||||
new_args.push_back(mk_app_core(decl, args[i-1], args[i]));
|
new_args.push_back(mk_app_core(decl, args[i-1], args[i]));
|
||||||
|
@ -2263,7 +2263,7 @@ app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * ar
|
||||||
r = mk_app_core(decl, num_args, args);
|
r = mk_app_core(decl, num_args, args);
|
||||||
}
|
}
|
||||||
SASSERT(r != 0);
|
SASSERT(r != 0);
|
||||||
TRACE("app_ground", tout << "ground: " << r->is_ground() << " id: " << r->get_id() << "\n" << mk_ll_pp(r, *this) << "\n";);
|
TRACE(app_ground, tout << "ground: " << r->is_ground() << " id: " << r->get_id() << "\n" << mk_ll_pp(r, *this) << "\n";);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2432,7 +2432,7 @@ quantifier * ast_manager::mk_quantifier(quantifier_kind k, unsigned num_decls, s
|
||||||
throw ast_exception("simultaneous patterns and no-patterns not supported");
|
throw ast_exception("simultaneous patterns and no-patterns not supported");
|
||||||
DEBUG_CODE({
|
DEBUG_CODE({
|
||||||
for (unsigned i = 0; i < num_patterns; ++i) {
|
for (unsigned i = 0; i < num_patterns; ++i) {
|
||||||
TRACE("ast", tout << i << " " << mk_pp(patterns[i], *this) << "\n";);
|
TRACE(ast, tout << i << " " << mk_pp(patterns[i], *this) << "\n";);
|
||||||
SASSERT(is_pattern(patterns[i]));
|
SASSERT(is_pattern(patterns[i]));
|
||||||
}});
|
}});
|
||||||
unsigned sz = quantifier::get_obj_size(num_decls, num_patterns, num_no_patterns);
|
unsigned sz = quantifier::get_obj_size(num_decls, num_patterns, num_no_patterns);
|
||||||
|
@ -2553,7 +2553,7 @@ quantifier * ast_manager::update_quantifier(quantifier * q, expr * body) {
|
||||||
quantifier * ast_manager::update_quantifier_weight(quantifier * q, int w) {
|
quantifier * ast_manager::update_quantifier_weight(quantifier * q, int w) {
|
||||||
if (q->get_weight() == w)
|
if (q->get_weight() == w)
|
||||||
return q;
|
return q;
|
||||||
TRACE("update_quantifier_weight", tout << "#" << q->get_id() << " " << q->get_weight() << " -> " << w << "\n";);
|
TRACE(update_quantifier_weight, tout << "#" << q->get_id() << " " << q->get_weight() << " -> " << w << "\n";);
|
||||||
return mk_quantifier(q->get_kind(),
|
return mk_quantifier(q->get_kind(),
|
||||||
q->get_num_decls(),
|
q->get_num_decls(),
|
||||||
q->get_decl_sorts(),
|
q->get_decl_sorts(),
|
||||||
|
@ -2620,7 +2620,7 @@ app * ast_manager::mk_distinct_expanded(unsigned num_args, expr * const * args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app * r = mk_and(new_args.size(), new_args.data());
|
app * r = mk_and(new_args.size(), new_args.data());
|
||||||
TRACE("distinct", tout << "expanded distinct:\n" << mk_pp(r, *this) << "\n";);
|
TRACE(distinct, tout << "expanded distinct:\n" << mk_pp(r, *this) << "\n";);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2769,7 +2769,7 @@ proof * ast_manager::mk_true_proof() {
|
||||||
}
|
}
|
||||||
|
|
||||||
proof * ast_manager::mk_asserted(expr * f) {
|
proof * ast_manager::mk_asserted(expr * f) {
|
||||||
CTRACE("mk_asserted_bug", !is_bool(f), tout << mk_ismt2_pp(f, *this) << "\nsort: " << mk_ismt2_pp(f->get_sort(), *this) << "\n";);
|
CTRACE(mk_asserted_bug, !is_bool(f), tout << mk_ismt2_pp(f, *this) << "\nsort: " << mk_ismt2_pp(f->get_sort(), *this) << "\n";);
|
||||||
SASSERT(is_bool(f));
|
SASSERT(is_bool(f));
|
||||||
return mk_proof(basic_family_id, PR_ASSERTED, f);
|
return mk_proof(basic_family_id, PR_ASSERTED, f);
|
||||||
}
|
}
|
||||||
|
@ -2783,15 +2783,15 @@ proof * ast_manager::mk_modus_ponens(proof * p1, proof * p2) {
|
||||||
if (!p2 || !p1) return p1;
|
if (!p2 || !p1) return p1;
|
||||||
SASSERT(has_fact(p1));
|
SASSERT(has_fact(p1));
|
||||||
SASSERT(has_fact(p2));
|
SASSERT(has_fact(p2));
|
||||||
CTRACE("mk_modus_ponens", !(is_implies(get_fact(p2)) || is_eq(get_fact(p2)) || is_oeq(get_fact(p2))),
|
CTRACE(mk_modus_ponens, !(is_implies(get_fact(p2)) || is_eq(get_fact(p2)) || is_oeq(get_fact(p2))),
|
||||||
tout << mk_ll_pp(p1, *this) << "\n";
|
tout << mk_ll_pp(p1, *this) << "\n";
|
||||||
tout << mk_ll_pp(p2, *this) << "\n";);
|
tout << mk_ll_pp(p2, *this) << "\n";);
|
||||||
SASSERT(is_implies(get_fact(p2)) || is_eq(get_fact(p2)) || is_oeq(get_fact(p2)));
|
SASSERT(is_implies(get_fact(p2)) || is_eq(get_fact(p2)) || is_oeq(get_fact(p2)));
|
||||||
CTRACE("mk_modus_ponens", to_app(get_fact(p2))->get_arg(0) != get_fact(p1),
|
CTRACE(mk_modus_ponens, to_app(get_fact(p2))->get_arg(0) != get_fact(p1),
|
||||||
tout << mk_pp(get_fact(p1), *this) << "\n" << mk_pp(get_fact(p2), *this) << "\n";);
|
tout << mk_pp(get_fact(p1), *this) << "\n" << mk_pp(get_fact(p2), *this) << "\n";);
|
||||||
SASSERT(!proofs_enabled() || to_app(get_fact(p2))->get_arg(0) == get_fact(p1));
|
SASSERT(!proofs_enabled() || to_app(get_fact(p2))->get_arg(0) == get_fact(p1));
|
||||||
CTRACE("mk_modus_ponens", !is_ground(p2) && !has_quantifiers(p2), tout << "Non-ground: " << mk_pp(p2, *this) << "\n";);
|
CTRACE(mk_modus_ponens, !is_ground(p2) && !has_quantifiers(p2), tout << "Non-ground: " << mk_pp(p2, *this) << "\n";);
|
||||||
CTRACE("mk_modus_ponens", !is_ground(p1) && !has_quantifiers(p1), tout << "Non-ground: " << mk_pp(p1, *this) << "\n";);
|
CTRACE(mk_modus_ponens, !is_ground(p1) && !has_quantifiers(p1), tout << "Non-ground: " << mk_pp(p1, *this) << "\n";);
|
||||||
if (is_reflexivity(p2))
|
if (is_reflexivity(p2))
|
||||||
return p1;
|
return p1;
|
||||||
expr * f = to_app(get_fact(p2))->get_arg(1);
|
expr * f = to_app(get_fact(p2))->get_arg(1);
|
||||||
|
@ -2863,14 +2863,14 @@ proof * ast_manager::mk_transitivity(proof * p1, proof * p2) {
|
||||||
app* fact2 = to_app(get_fact(p2));
|
app* fact2 = to_app(get_fact(p2));
|
||||||
SASSERT(fact1->get_num_args() == 2);
|
SASSERT(fact1->get_num_args() == 2);
|
||||||
SASSERT(fact2->get_num_args() == 2);
|
SASSERT(fact2->get_num_args() == 2);
|
||||||
CTRACE("mk_transitivity", fact1->get_decl() != fact2->get_decl(),
|
CTRACE(mk_transitivity, fact1->get_decl() != fact2->get_decl(),
|
||||||
tout << mk_pp(fact1, *this) << "\n\n" << mk_pp(fact2, *this) << "\n";
|
tout << mk_pp(fact1, *this) << "\n\n" << mk_pp(fact2, *this) << "\n";
|
||||||
tout << mk_pp(fact1->get_decl(), *this) << "\n";
|
tout << mk_pp(fact1->get_decl(), *this) << "\n";
|
||||||
tout << mk_pp(fact2->get_decl(), *this) << "\n";);
|
tout << mk_pp(fact2->get_decl(), *this) << "\n";);
|
||||||
SASSERT(fact1->get_decl() == fact2->get_decl() ||
|
SASSERT(fact1->get_decl() == fact2->get_decl() ||
|
||||||
( (is_eq(fact1) || is_oeq(fact1)) &&
|
( (is_eq(fact1) || is_oeq(fact1)) &&
|
||||||
(is_eq(fact2) || is_oeq(fact2))));
|
(is_eq(fact2) || is_oeq(fact2))));
|
||||||
CTRACE("mk_transitivity", fact1->get_arg(1) != fact2->get_arg(0),
|
CTRACE(mk_transitivity, fact1->get_arg(1) != fact2->get_arg(0),
|
||||||
tout << mk_pp(fact1, *this) << "\n\n" << mk_pp(fact2, *this) << "\n";
|
tout << mk_pp(fact1, *this) << "\n\n" << mk_pp(fact2, *this) << "\n";
|
||||||
tout << p1->get_id() << ": " << mk_bounded_pp(p1, *this, 5) << "\n\n";
|
tout << p1->get_id() << ": " << mk_bounded_pp(p1, *this, 5) << "\n\n";
|
||||||
tout << p2->get_id() << ": " << mk_bounded_pp(p2, *this, 5) << "\n\n";
|
tout << p2->get_id() << ": " << mk_bounded_pp(p2, *this, 5) << "\n\n";
|
||||||
|
@ -3086,7 +3086,7 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro
|
||||||
|
|
||||||
if (!found_complement) {
|
if (!found_complement) {
|
||||||
args.append(num_proofs, (expr**)proofs);
|
args.append(num_proofs, (expr**)proofs);
|
||||||
CTRACE("mk_unit_resolution_bug", !is_or(f1), tout << mk_ll_pp(f1, *this) << "\n";
|
CTRACE(mk_unit_resolution_bug, !is_or(f1), tout << mk_ll_pp(f1, *this) << "\n";
|
||||||
for (unsigned i = 1; i < num_proofs; ++i)
|
for (unsigned i = 1; i < num_proofs; ++i)
|
||||||
tout << mk_pp(proofs[i], *this) << "\n";
|
tout << mk_pp(proofs[i], *this) << "\n";
|
||||||
tout << "facts\n";
|
tout << "facts\n";
|
||||||
|
@ -3121,7 +3121,7 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro
|
||||||
}
|
}
|
||||||
DEBUG_CODE({
|
DEBUG_CODE({
|
||||||
for (unsigned i = 1; proofs_enabled() && i < num_proofs; i++) {
|
for (unsigned i = 1; proofs_enabled() && i < num_proofs; i++) {
|
||||||
CTRACE("mk_unit_resolution_bug", !found.get(i, false),
|
CTRACE(mk_unit_resolution_bug, !found.get(i, false),
|
||||||
for (unsigned j = 0; j < num_proofs; j++) {
|
for (unsigned j = 0; j < num_proofs; j++) {
|
||||||
if (j == i) tout << "Index " << i << " was not found:\n";
|
if (j == i) tout << "Index " << i << " was not found:\n";
|
||||||
tout << mk_ll_pp(get_fact(proofs[j]), *this);
|
tout << mk_ll_pp(get_fact(proofs[j]), *this);
|
||||||
|
@ -3144,12 +3144,12 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro
|
||||||
}
|
}
|
||||||
|
|
||||||
proof * pr = mk_app(basic_family_id, PR_UNIT_RESOLUTION, args.size(), args.data());
|
proof * pr = mk_app(basic_family_id, PR_UNIT_RESOLUTION, args.size(), args.data());
|
||||||
TRACE("unit_resolution", tout << "unit_resolution generating fact\n" << mk_ll_pp(pr, *this););
|
TRACE(unit_resolution, tout << "unit_resolution generating fact\n" << mk_ll_pp(pr, *this););
|
||||||
return pr;
|
return pr;
|
||||||
}
|
}
|
||||||
|
|
||||||
proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * proofs, expr * new_fact) {
|
proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * proofs, expr * new_fact) {
|
||||||
TRACE("unit_bug",
|
TRACE(unit_bug,
|
||||||
for (unsigned i = 0; i < num_proofs; i++) tout << mk_pp(get_fact(proofs[i]), *this) << "\n";
|
for (unsigned i = 0; i < num_proofs; i++) tout << mk_pp(get_fact(proofs[i]), *this) << "\n";
|
||||||
tout << "===>\n";
|
tout << "===>\n";
|
||||||
tout << mk_pp(new_fact, *this) << "\n";);
|
tout << mk_pp(new_fact, *this) << "\n";);
|
||||||
|
@ -3167,7 +3167,7 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro
|
||||||
SASSERT(is_or(f1));
|
SASSERT(is_or(f1));
|
||||||
app * cls = to_app(f1);
|
app * cls = to_app(f1);
|
||||||
unsigned cls_sz = cls->get_num_args();
|
unsigned cls_sz = cls->get_num_args();
|
||||||
CTRACE("unit_bug", !(num_proofs == cls_sz || (num_proofs == cls_sz + 1 && is_false(new_fact))),
|
CTRACE(unit_bug, !(num_proofs == cls_sz || (num_proofs == cls_sz + 1 && is_false(new_fact))),
|
||||||
for (unsigned i = 0; i < num_proofs; i++) tout << mk_pp(get_fact(proofs[i]), *this) << "\n";
|
for (unsigned i = 0; i < num_proofs; i++) tout << mk_pp(get_fact(proofs[i]), *this) << "\n";
|
||||||
tout << "===>\n";
|
tout << "===>\n";
|
||||||
tout << mk_pp(new_fact, *this) << "\n";);
|
tout << mk_pp(new_fact, *this) << "\n";);
|
||||||
|
@ -3186,7 +3186,7 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (j == num_proofs) {
|
if (j == num_proofs) {
|
||||||
CTRACE("unit_bug", new_fact != lit, tout << mk_pp(f1, *this) << "\n" << mk_ll_pp(new_fact, *this) << "\n" << mk_ll_pp(lit, *this) << "\n";);
|
CTRACE(unit_bug, new_fact != lit, tout << mk_pp(f1, *this) << "\n" << mk_ll_pp(new_fact, *this) << "\n" << mk_ll_pp(lit, *this) << "\n";);
|
||||||
SASSERT(new_fact == lit);
|
SASSERT(new_fact == lit);
|
||||||
++num_occ;
|
++num_occ;
|
||||||
}
|
}
|
||||||
|
@ -3196,7 +3196,7 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
proof * pr = mk_app(basic_family_id, PR_UNIT_RESOLUTION, args.size(), args.data());
|
proof * pr = mk_app(basic_family_id, PR_UNIT_RESOLUTION, args.size(), args.data());
|
||||||
TRACE("unit_resolution", tout << "unit_resolution using fact\n" << mk_ll_pp(pr, *this););
|
TRACE(unit_resolution, tout << "unit_resolution using fact\n" << mk_ll_pp(pr, *this););
|
||||||
return pr;
|
return pr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3207,7 +3207,7 @@ proof * ast_manager::mk_hypothesis(expr * h) {
|
||||||
proof * ast_manager::mk_lemma(proof * p, expr * lemma) {
|
proof * ast_manager::mk_lemma(proof * p, expr * lemma) {
|
||||||
if (!p) return p;
|
if (!p) return p;
|
||||||
SASSERT(has_fact(p));
|
SASSERT(has_fact(p));
|
||||||
CTRACE("mk_lemma", !is_false(get_fact(p)), tout << mk_ll_pp(p, *this) << "\n";);
|
CTRACE(mk_lemma, !is_false(get_fact(p)), tout << mk_ll_pp(p, *this) << "\n";);
|
||||||
SASSERT(is_false(get_fact(p)));
|
SASSERT(is_false(get_fact(p)));
|
||||||
return mk_app(basic_family_id, PR_LEMMA, p, lemma);
|
return mk_app(basic_family_id, PR_LEMMA, p, lemma);
|
||||||
}
|
}
|
||||||
|
@ -3283,7 +3283,7 @@ proof * ast_manager::mk_and_elim(proof * p, unsigned i) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
SASSERT(has_fact(p));
|
SASSERT(has_fact(p));
|
||||||
SASSERT(is_and(get_fact(p)));
|
SASSERT(is_and(get_fact(p)));
|
||||||
CTRACE("mk_and_elim", i >= to_app(get_fact(p))->get_num_args(), tout << "i: " << i << "\n" << mk_pp(get_fact(p), *this) << "\n";);
|
CTRACE(mk_and_elim, i >= to_app(get_fact(p))->get_num_args(), tout << "i: " << i << "\n" << mk_pp(get_fact(p), *this) << "\n";);
|
||||||
SASSERT(i < to_app(get_fact(p))->get_num_args());
|
SASSERT(i < to_app(get_fact(p))->get_num_args());
|
||||||
expr * f = to_app(get_fact(p))->get_arg(i);
|
expr * f = to_app(get_fact(p))->get_arg(i);
|
||||||
return mk_app(basic_family_id, PR_AND_ELIM, p, f);
|
return mk_app(basic_family_id, PR_AND_ELIM, p, f);
|
||||||
|
@ -3365,7 +3365,7 @@ proof* ast_manager::mk_hyper_resolve(unsigned num_premises, proof* const* premis
|
||||||
ptr_vector<expr> fmls;
|
ptr_vector<expr> fmls;
|
||||||
SASSERT(positions.size() + 1 == substs.size());
|
SASSERT(positions.size() + 1 == substs.size());
|
||||||
for (unsigned i = 0; i < num_premises; ++i) {
|
for (unsigned i = 0; i < num_premises; ++i) {
|
||||||
TRACE("hyper_res", tout << mk_pp(premises[i], *this) << "\n";);
|
TRACE(hyper_res, tout << mk_pp(premises[i], *this) << "\n";);
|
||||||
fmls.push_back(get_fact(premises[i]));
|
fmls.push_back(get_fact(premises[i]));
|
||||||
}
|
}
|
||||||
SASSERT(is_bool(concl));
|
SASSERT(is_bool(concl));
|
||||||
|
@ -3380,7 +3380,7 @@ proof* ast_manager::mk_hyper_resolve(unsigned num_premises, proof* const* premis
|
||||||
params.push_back(parameter(positions[i].second));
|
params.push_back(parameter(positions[i].second));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("hyper_res",
|
TRACE(hyper_res,
|
||||||
for (unsigned i = 0; i < params.size(); ++i) {
|
for (unsigned i = 0; i < params.size(); ++i) {
|
||||||
params[i].display(tout); tout << "\n";
|
params[i].display(tout); tout << "\n";
|
||||||
});
|
});
|
||||||
|
|
|
@ -81,7 +81,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void pp_step(const proof * p) {
|
void pp_step(const proof * p) {
|
||||||
TRACE("pp_ast_dot_step", tout << " :kind " << p->get_kind() << " :num-args " << p->get_num_args() << "\n";);
|
TRACE(pp_ast_dot_step, tout << " :kind " << p->get_kind() << " :num-args " << p->get_num_args() << "\n";);
|
||||||
if (m().has_fact(p)) {
|
if (m().has_fact(p)) {
|
||||||
// print result
|
// print result
|
||||||
expr* p_res = m().get_fact(p); // result of proof step
|
expr* p_res = m().get_fact(p); // result of proof step
|
||||||
|
|
|
@ -702,7 +702,7 @@ class smt2_printer {
|
||||||
((f_info.m_depth >= m_pp_max_depth) ||
|
((f_info.m_depth >= m_pp_max_depth) ||
|
||||||
((f_info.m_weight >= m_pp_min_alias_size || is_quantifier(t)) && m_soccs.is_shared(t)))) {
|
((f_info.m_weight >= m_pp_min_alias_size || is_quantifier(t)) && m_soccs.is_shared(t)))) {
|
||||||
symbol a = next_alias();
|
symbol a = next_alias();
|
||||||
TRACE("smt2_pp", tout << "a: " << a << " depth: " << f_info.m_depth << ", weight: " << f_info.m_weight
|
TRACE(smt2_pp, tout << "a: " << a << " depth: " << f_info.m_depth << ", weight: " << f_info.m_weight
|
||||||
<< ", lvl: " << f_info.m_lvl << " t: #" << t->get_id() << "\n" << mk_ll_pp(t, m())
|
<< ", lvl: " << f_info.m_lvl << " t: #" << t->get_id() << "\n" << mk_ll_pp(t, m())
|
||||||
<< ", is-shared: " << m_soccs.is_shared(t) << "\n";);
|
<< ", is-shared: " << m_soccs.is_shared(t) << "\n";);
|
||||||
register_alias(t, f, f_info.m_lvl, a);
|
register_alias(t, f, f_info.m_lvl, a);
|
||||||
|
@ -800,7 +800,7 @@ class smt2_printer {
|
||||||
unsigned sz = m_aliased_exprs.size();
|
unsigned sz = m_aliased_exprs.size();
|
||||||
SASSERT(old_sz <= sz);
|
SASSERT(old_sz <= sz);
|
||||||
num_lets = sz - old_sz;
|
num_lets = sz - old_sz;
|
||||||
TRACE("pp_let", tout << "old_sz: " << old_sz << ", sz: " << sz << "\n";);
|
TRACE(pp_let, tout << "old_sz: " << old_sz << ", sz: " << sz << "\n";);
|
||||||
if (old_sz == sz)
|
if (old_sz == sz)
|
||||||
return f;
|
return f;
|
||||||
vector<ptr_vector<format> > decls;
|
vector<ptr_vector<format> > decls;
|
||||||
|
@ -812,7 +812,7 @@ class smt2_printer {
|
||||||
ptr_vector<format> & lvl_decls = decls[lvl];
|
ptr_vector<format> & lvl_decls = decls[lvl];
|
||||||
lvl_decls.push_back(mk_seq1<format**, f2f>(m(), f_def, f_def+1, f2f(), f_name.str()));
|
lvl_decls.push_back(mk_seq1<format**, f2f>(m(), f_def, f_def+1, f2f(), f_name.str()));
|
||||||
}
|
}
|
||||||
TRACE("pp_let", tout << "decls.size(): " << decls.size() << "\n";);
|
TRACE(pp_let, tout << "decls.size(): " << decls.size() << "\n";);
|
||||||
ptr_buffer<format> buf;
|
ptr_buffer<format> buf;
|
||||||
unsigned num_op = 0;
|
unsigned num_op = 0;
|
||||||
for (ptr_vector<format> & lvl_decls : decls) {
|
for (ptr_vector<format> & lvl_decls : decls) {
|
||||||
|
@ -824,7 +824,7 @@ class smt2_printer {
|
||||||
buf.push_back(mk_string(m(), "(let "));
|
buf.push_back(mk_string(m(), "(let "));
|
||||||
buf.push_back(mk_indent(m(), 5, mk_seq5(m(), lvl_decls.begin(), lvl_decls.end(), f2f())));
|
buf.push_back(mk_indent(m(), 5, mk_seq5(m(), lvl_decls.begin(), lvl_decls.end(), f2f())));
|
||||||
}
|
}
|
||||||
TRACE("pp_let", tout << "num_op: " << num_op << "\n";);
|
TRACE(pp_let, tout << "num_op: " << num_op << "\n";);
|
||||||
if (num_op == 0)
|
if (num_op == 0)
|
||||||
return f;
|
return f;
|
||||||
buf.push_back(mk_indent(m(), SMALL_INDENT, mk_compose(m(), mk_line_break(m()), f)));
|
buf.push_back(mk_indent(m(), SMALL_INDENT, mk_compose(m(), mk_line_break(m()), f)));
|
||||||
|
@ -841,7 +841,7 @@ class smt2_printer {
|
||||||
void begin_scope() {
|
void begin_scope() {
|
||||||
SASSERT(m_aliased_exprs.size() == m_aliased_pps.size());
|
SASSERT(m_aliased_exprs.size() == m_aliased_pps.size());
|
||||||
SASSERT(m_aliased_exprs.size() == m_aliased_lvls_names.size());
|
SASSERT(m_aliased_exprs.size() == m_aliased_lvls_names.size());
|
||||||
TRACE("pp_scope", tout << "[begin-scope] sz: " << m_aliased_exprs.size() << ", m_root: " << m_root << "\n";);
|
TRACE(pp_scope, tout << "[begin-scope] sz: " << m_aliased_exprs.size() << ", m_root: " << m_root << "\n";);
|
||||||
m_scopes.push_back(scope(m_aliased_exprs.size(), m_next_alias_idx, m_root));
|
m_scopes.push_back(scope(m_aliased_exprs.size(), m_next_alias_idx, m_root));
|
||||||
unsigned lvl = m_scopes.size();
|
unsigned lvl = m_scopes.size();
|
||||||
while (lvl >= m_expr2alias_stack.size())
|
while (lvl >= m_expr2alias_stack.size())
|
||||||
|
@ -851,7 +851,7 @@ class smt2_printer {
|
||||||
}
|
}
|
||||||
|
|
||||||
void end_scope() {
|
void end_scope() {
|
||||||
TRACE("pp_scope", tout << "[end-scope] before sz: " << m_aliased_exprs.size() << ", m_root: " << m_root << "\n";);
|
TRACE(pp_scope, tout << "[end-scope] before sz: " << m_aliased_exprs.size() << ", m_root: " << m_root << "\n";);
|
||||||
m_expr2alias->reset();
|
m_expr2alias->reset();
|
||||||
scope & s = m_scopes.back();
|
scope & s = m_scopes.back();
|
||||||
unsigned old_sz = s.m_aliased_exprs_lim;
|
unsigned old_sz = s.m_aliased_exprs_lim;
|
||||||
|
@ -864,7 +864,7 @@ class smt2_printer {
|
||||||
m_aliased_exprs.shrink(old_sz);
|
m_aliased_exprs.shrink(old_sz);
|
||||||
m_aliased_pps.shrink(old_sz);
|
m_aliased_pps.shrink(old_sz);
|
||||||
m_aliased_lvls_names.shrink(old_sz);
|
m_aliased_lvls_names.shrink(old_sz);
|
||||||
TRACE("pp_scope", tout << "[end-scope] after sz: " << m_aliased_exprs.size() << ", m_root: " << m_root << "\n";);
|
TRACE(pp_scope, tout << "[end-scope] after sz: " << m_aliased_exprs.size() << ", m_root: " << m_root << "\n";);
|
||||||
}
|
}
|
||||||
|
|
||||||
void register_var_names(quantifier * q) {
|
void register_var_names(quantifier * q) {
|
||||||
|
|
|
@ -196,7 +196,7 @@ void ast_translation::mk_func_decl(func_decl * f, frame & fr) {
|
||||||
to().add_lambda_def(new_f, new_q);
|
to().add_lambda_def(new_f, new_q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("ast_translation",
|
TRACE(ast_translation,
|
||||||
tout << f->get_name() << " "; if (fi) tout << *fi; tout << "\n";
|
tout << f->get_name() << " "; if (fi) tout << *fi; tout << "\n";
|
||||||
tout << "---->\n";
|
tout << "---->\n";
|
||||||
tout << new_f->get_name() << " "; if (new_f->get_info()) tout << *(new_f->get_info()); tout << "\n";);
|
tout << new_f->get_name() << " "; if (new_f->get_info()) tout << *(new_f->get_info()); tout << "\n";);
|
||||||
|
@ -226,14 +226,14 @@ ast * ast_translation::process(ast const * _n) {
|
||||||
frame & fr = m_frame_stack.back();
|
frame & fr = m_frame_stack.back();
|
||||||
ast * n = fr.m_n;
|
ast * n = fr.m_n;
|
||||||
ast * r;
|
ast * r;
|
||||||
TRACE("ast_translation", tout << mk_ll_pp(n, m_from_manager, false) << "\n";);
|
TRACE(ast_translation, tout << mk_ll_pp(n, m_from_manager, false) << "\n";);
|
||||||
if (fr.m_idx == 0 && n->get_ref_count() > 1) {
|
if (fr.m_idx == 0 && n->get_ref_count() > 1) {
|
||||||
if (m_cache.find(n, r)) {
|
if (m_cache.find(n, r)) {
|
||||||
SASSERT(m_result_stack.size() == fr.m_rpos);
|
SASSERT(m_result_stack.size() == fr.m_rpos);
|
||||||
m_result_stack.push_back(r);
|
m_result_stack.push_back(r);
|
||||||
m_extra_children_stack.shrink(fr.m_cpos);
|
m_extra_children_stack.shrink(fr.m_cpos);
|
||||||
m_frame_stack.pop_back();
|
m_frame_stack.pop_back();
|
||||||
TRACE("ast_translation", tout << "hit\n";);
|
TRACE(ast_translation, tout << "hit\n";);
|
||||||
m_hit_count++;
|
m_hit_count++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -714,7 +714,7 @@ bool bv_decl_plugin::are_distinct(app * a, app * b) const {
|
||||||
expr * b_term;
|
expr * b_term;
|
||||||
get_offset_term(a, a_term, a_offset);
|
get_offset_term(a, a_term, a_offset);
|
||||||
get_offset_term(b, b_term, b_offset);
|
get_offset_term(b, b_term, b_offset);
|
||||||
TRACE("bv_are_distinct",
|
TRACE(bv_are_distinct,
|
||||||
tout << mk_ismt2_pp(a, *m_manager) << "\n" << mk_ismt2_pp(b, *m_manager) << "\n";
|
tout << mk_ismt2_pp(a, *m_manager) << "\n" << mk_ismt2_pp(b, *m_manager) << "\n";
|
||||||
tout << "---->\n";
|
tout << "---->\n";
|
||||||
tout << "a: " << a_offset << " + " << mk_ismt2_pp(a_term, *m_manager) << "\n";
|
tout << "a: " << a_offset << " + " << mk_ismt2_pp(a_term, *m_manager) << "\n";
|
||||||
|
@ -865,7 +865,7 @@ bool bv_recognizers::is_allone(expr const * e) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool result = (r == rational::power_of_two(bv_size) - rational(1));
|
bool result = (r == rational::power_of_two(bv_size) - rational(1));
|
||||||
TRACE("is_allone", tout << r << " " << result << "\n";);
|
TRACE(is_allone, tout << r << " " << result << "\n";);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ void equiv_proof_converter::insert(expr* fml1, expr* fml2) {
|
||||||
p1 = m.mk_asserted(fml1);
|
p1 = m.mk_asserted(fml1);
|
||||||
p2 = m.mk_rewrite(fml1, fml2);
|
p2 = m.mk_rewrite(fml1, fml2);
|
||||||
p3 = m.mk_modus_ponens(p1, p2);
|
p3 = m.mk_modus_ponens(p1, p2);
|
||||||
TRACE("proof_converter", tout << mk_pp(p3.get(), m) << "\n";);
|
TRACE(proof_converter, tout << mk_pp(p3.get(), m) << "\n";);
|
||||||
SASSERT(m.has_fact(p3));
|
SASSERT(m.has_fact(p3));
|
||||||
m_replace.insert(p3);
|
m_replace.insert(p3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ void generic_model_converter::add(func_decl * d, expr* e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void generic_model_converter::operator()(model_ref & md) {
|
void generic_model_converter::operator()(model_ref & md) {
|
||||||
TRACE("model_converter", tout << "before generic_model_converter\n"; model_v2_pp(tout, *md); display(tout););
|
TRACE(model_converter, tout << "before generic_model_converter\n"; model_v2_pp(tout, *md); display(tout););
|
||||||
|
|
||||||
model_evaluator ev(*(md.get()));
|
model_evaluator ev(*(md.get()));
|
||||||
ev.set_model_completion(m_completion);
|
ev.set_model_completion(m_completion);
|
||||||
|
@ -53,7 +53,7 @@ void generic_model_converter::operator()(model_ref & md) {
|
||||||
break;
|
break;
|
||||||
case instruction::ADD:
|
case instruction::ADD:
|
||||||
ev(e.m_def, val);
|
ev(e.m_def, val);
|
||||||
TRACE("model_converter", tout << e.m_f->get_name() << " ->\n" << e.m_def << "\n==>\n" << val << "\n";);
|
TRACE(model_converter, tout << e.m_f->get_name() << " ->\n" << e.m_def << "\n==>\n" << val << "\n";);
|
||||||
arity = e.m_f->get_arity();
|
arity = e.m_f->get_arity();
|
||||||
reset_ev = false;
|
reset_ev = false;
|
||||||
if (arity == 0) {
|
if (arity == 0) {
|
||||||
|
@ -96,7 +96,7 @@ void generic_model_converter::operator()(model_ref & md) {
|
||||||
for (auto const& [s, u] : uninterpreted) {
|
for (auto const& [s, u] : uninterpreted) {
|
||||||
md->register_usort(s, u.size(), u.data());
|
md->register_usort(s, u.size(), u.data());
|
||||||
}
|
}
|
||||||
TRACE("model_converter", tout << "after generic_model_converter\n"; model_v2_pp(tout, *md););
|
TRACE(model_converter, tout << "after generic_model_converter\n"; model_v2_pp(tout, *md););
|
||||||
}
|
}
|
||||||
|
|
||||||
void generic_model_converter::display(std::ostream & out) {
|
void generic_model_converter::display(std::ostream & out) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ bool horn_subsume_model_converter::mk_horn(
|
||||||
m_rewrite(body_res);
|
m_rewrite(body_res);
|
||||||
|
|
||||||
}
|
}
|
||||||
TRACE("mc",
|
TRACE(mc,
|
||||||
tout << mk_pp(head, m) << " :- " << mk_pp(body, m) << "\n";
|
tout << mk_pp(head, m) << " :- " << mk_pp(body, m) << "\n";
|
||||||
tout << pred->get_name() << " :- " << mk_pp(body_res.get(), m) << "\n";);
|
tout << pred->get_name() << " :- " << mk_pp(body_res.get(), m) << "\n";);
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ void horn_subsume_model_converter::add_default_proc::operator()(app* n) {
|
||||||
if (m.is_bool(n) &&
|
if (m.is_bool(n) &&
|
||||||
!m_md->has_interpretation(n->get_decl()) &&
|
!m_md->has_interpretation(n->get_decl()) &&
|
||||||
(n->get_family_id() == null_family_id)) {
|
(n->get_family_id() == null_family_id)) {
|
||||||
TRACE("mc", tout << "adding: " << n->get_decl()->get_name() << "\n";);
|
TRACE(mc, tout << "adding: " << n->get_decl()->get_name() << "\n";);
|
||||||
if (n->get_decl()->get_arity() == 0) {
|
if (n->get_decl()->get_arity() == 0) {
|
||||||
m_md->register_decl(n->get_decl(), m.mk_false());
|
m_md->register_decl(n->get_decl(), m.mk_false());
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ void horn_subsume_model_converter::operator()(model_ref& mr) {
|
||||||
m_delay_head.reset();
|
m_delay_head.reset();
|
||||||
m_delay_body.reset();
|
m_delay_body.reset();
|
||||||
|
|
||||||
TRACE("mc", tout << m_funcs.size() << "\n"; model_smt2_pp(tout, m, *mr, 0););
|
TRACE(mc, tout << m_funcs.size() << "\n"; model_smt2_pp(tout, m, *mr, 0););
|
||||||
for (unsigned i = m_funcs.size(); i-- > 0; ) {
|
for (unsigned i = m_funcs.size(); i-- > 0; ) {
|
||||||
func_decl* h = m_funcs.get(i);
|
func_decl* h = m_funcs.get(i);
|
||||||
expr_ref body(m_bodies.get(i), m);
|
expr_ref body(m_bodies.get(i), m);
|
||||||
|
@ -188,10 +188,10 @@ void horn_subsume_model_converter::operator()(model_ref& mr) {
|
||||||
add_default_false_interpretation(body, mr);
|
add_default_false_interpretation(body, mr);
|
||||||
SASSERT(m.is_bool(body));
|
SASSERT(m.is_bool(body));
|
||||||
|
|
||||||
TRACE("mc", tout << "eval: " << h->get_name() << "\n" << body << "\n";);
|
TRACE(mc, tout << "eval: " << h->get_name() << "\n" << body << "\n";);
|
||||||
body = (*mr)(body);
|
body = (*mr)(body);
|
||||||
|
|
||||||
TRACE("mc", tout << "to:\n" << body << "\n";);
|
TRACE(mc, tout << "to:\n" << body << "\n";);
|
||||||
|
|
||||||
if (arity == 0) {
|
if (arity == 0) {
|
||||||
expr* e = mr->get_const_interp(h);
|
expr* e = mr->get_const_interp(h);
|
||||||
|
|
|
@ -66,11 +66,11 @@ proof_ref replace_proof_converter::operator()(ast_manager & m, unsigned num_sour
|
||||||
replace.apply(e);
|
replace.apply(e);
|
||||||
f = m.mk_asserted(m.get_fact(p));
|
f = m.mk_asserted(m.get_fact(p));
|
||||||
replace.insert(f, e);
|
replace.insert(f, e);
|
||||||
TRACE("proof_converter", tout << f->get_id() << " " << mk_pp(f, m) <<
|
TRACE(proof_converter, tout << f->get_id() << " " << mk_pp(f, m) <<
|
||||||
"\n|-> " << mk_pp(e, m) << "\n";);
|
"\n|-> " << mk_pp(e, m) << "\n";);
|
||||||
}
|
}
|
||||||
replace.apply(tmp);
|
replace.apply(tmp);
|
||||||
TRACE("proof_converter", tout << mk_pp(source[0], m) << "\n";
|
TRACE(proof_converter, tout << mk_pp(source[0], m) << "\n";
|
||||||
tout << mk_pp(tmp.get(), m) << "\n";);
|
tout << mk_pp(tmp.get(), m) << "\n";);
|
||||||
return proof_ref(to_app(tmp), m);
|
return proof_ref(to_app(tmp), m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace datatype {
|
||||||
|
|
||||||
sort_ref def::instantiate(sort_ref_vector const& sorts) const {
|
sort_ref def::instantiate(sort_ref_vector const& sorts) const {
|
||||||
sort_ref s(m);
|
sort_ref s(m);
|
||||||
TRACE("datatype", tout << "instantiate " << m_name << "\n";);
|
TRACE(datatype, tout << "instantiate " << m_name << "\n";);
|
||||||
if (!m_sort) {
|
if (!m_sort) {
|
||||||
vector<parameter> ps;
|
vector<parameter> ps;
|
||||||
ps.push_back(parameter(m_name));
|
ps.push_back(parameter(m_name));
|
||||||
|
@ -282,22 +282,22 @@ namespace datatype {
|
||||||
sort * plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) {
|
sort * plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) {
|
||||||
try {
|
try {
|
||||||
if (k != DATATYPE_SORT) {
|
if (k != DATATYPE_SORT) {
|
||||||
TRACE("datatype", tout << "invalid kind parameter to datatype\n";);
|
TRACE(datatype, tout << "invalid kind parameter to datatype\n";);
|
||||||
throw invalid_datatype();
|
throw invalid_datatype();
|
||||||
}
|
}
|
||||||
if (num_parameters < 1) {
|
if (num_parameters < 1) {
|
||||||
TRACE("datatype", tout << "at least one parameter expected to datatype declaration\n";);
|
TRACE(datatype, tout << "at least one parameter expected to datatype declaration\n";);
|
||||||
throw invalid_datatype();
|
throw invalid_datatype();
|
||||||
}
|
}
|
||||||
parameter const & name = parameters[0];
|
parameter const & name = parameters[0];
|
||||||
if (!name.is_symbol()) {
|
if (!name.is_symbol()) {
|
||||||
TRACE("datatype", tout << "expected symbol parameter at position " << 0 << " got: " << name << "\n";);
|
TRACE(datatype, tout << "expected symbol parameter at position " << 0 << " got: " << name << "\n";);
|
||||||
throw invalid_datatype();
|
throw invalid_datatype();
|
||||||
}
|
}
|
||||||
for (unsigned i = 1; i < num_parameters; ++i) {
|
for (unsigned i = 1; i < num_parameters; ++i) {
|
||||||
parameter const& s = parameters[i];
|
parameter const& s = parameters[i];
|
||||||
if (!s.is_ast() || !is_sort(s.get_ast())) {
|
if (!s.is_ast() || !is_sort(s.get_ast())) {
|
||||||
TRACE("datatype", tout << "expected sort parameter at position " << i << " got: " << s << "\n";);
|
TRACE(datatype, tout << "expected sort parameter at position " << i << " got: " << s << "\n";);
|
||||||
throw invalid_datatype();
|
throw invalid_datatype();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,15 +309,15 @@ namespace datatype {
|
||||||
obj_map<sort, sort_size> S;
|
obj_map<sort, sort_size> S;
|
||||||
for (unsigned i = 0; i + 1 < num_parameters; ++i) {
|
for (unsigned i = 0; i + 1 < num_parameters; ++i) {
|
||||||
sort* r = to_sort(parameters[i + 1].get_ast());
|
sort* r = to_sort(parameters[i + 1].get_ast());
|
||||||
TRACE("datatype", tout << "inserting " << mk_ismt2_pp(r, *m_manager) << " " << r->get_num_elements() << "\n";);
|
TRACE(datatype, tout << "inserting " << mk_ismt2_pp(r, *m_manager) << " " << r->get_num_elements() << "\n";);
|
||||||
S.insert(d->params()[i], r->get_num_elements());
|
S.insert(d->params()[i], r->get_num_elements());
|
||||||
}
|
}
|
||||||
sort_size ts = d->sort_size()->eval(S);
|
sort_size ts = d->sort_size()->eval(S);
|
||||||
TRACE("datatype", tout << name << " has size " << ts << "\n";);
|
TRACE(datatype, tout << name << " has size " << ts << "\n";);
|
||||||
s->set_num_elements(ts);
|
s->set_num_elements(ts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("datatype", tout << "not setting size for " << name << "\n";);
|
TRACE(datatype, tout << "not setting size for " << name << "\n";);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -564,9 +564,9 @@ namespace datatype {
|
||||||
begin_def_block();
|
begin_def_block();
|
||||||
for (unsigned i = 0; i < num_datatypes; ++i) {
|
for (unsigned i = 0; i < num_datatypes; ++i) {
|
||||||
def* d = nullptr;
|
def* d = nullptr;
|
||||||
TRACE("datatype", tout << "declaring " << datatypes[i]->name() << "\n";);
|
TRACE(datatype, tout << "declaring " << datatypes[i]->name() << "\n";);
|
||||||
if (m_defs.find(datatypes[i]->name(), d)) {
|
if (m_defs.find(datatypes[i]->name(), d)) {
|
||||||
TRACE("datatype", tout << "delete previous version for " << datatypes[i]->name() << "\n";);
|
TRACE(datatype, tout << "delete previous version for " << datatypes[i]->name() << "\n";);
|
||||||
u().reset();
|
u().reset();
|
||||||
dealloc(d);
|
dealloc(d);
|
||||||
}
|
}
|
||||||
|
@ -616,7 +616,7 @@ namespace datatype {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool plugin::is_value_aux(bool unique, app * e) const {
|
bool plugin::is_value_aux(bool unique, app * e) const {
|
||||||
TRACE("dt_is_value", tout << "checking\n" << mk_ismt2_pp(e, *m_manager) << "\n";);
|
TRACE(dt_is_value, tout << "checking\n" << mk_ismt2_pp(e, *m_manager) << "\n";);
|
||||||
if (!u().is_constructor(e))
|
if (!u().is_constructor(e))
|
||||||
return false;
|
return false;
|
||||||
if (e->get_num_args() == 0)
|
if (e->get_num_args() == 0)
|
||||||
|
@ -627,7 +627,7 @@ namespace datatype {
|
||||||
// potentially expensive check for common sub-expressions.
|
// potentially expensive check for common sub-expressions.
|
||||||
for (expr* arg : *e) {
|
for (expr* arg : *e) {
|
||||||
if (!is_value_visit(unique, arg, todo)) {
|
if (!is_value_visit(unique, arg, todo)) {
|
||||||
TRACE("dt_is_value", tout << "not-value:\n" << mk_ismt2_pp(arg, *m_manager) << "\n";);
|
TRACE(dt_is_value, tout << "not-value:\n" << mk_ismt2_pp(arg, *m_manager) << "\n";);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,7 @@ namespace datatype {
|
||||||
todo.pop_back();
|
todo.pop_back();
|
||||||
for (expr* arg : *curr) {
|
for (expr* arg : *curr) {
|
||||||
if (!is_value_visit(unique, arg, todo)) {
|
if (!is_value_visit(unique, arg, todo)) {
|
||||||
TRACE("dt_is_value", tout << "not-value:\n" << mk_ismt2_pp(arg, *m_manager) << "\n";);
|
TRACE(dt_is_value, tout << "not-value:\n" << mk_ismt2_pp(arg, *m_manager) << "\n";);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -858,12 +858,12 @@ namespace datatype {
|
||||||
map<symbol, status, symbol_hash_proc, symbol_eq_proc> already_found;
|
map<symbol, status, symbol_hash_proc, symbol_eq_proc> already_found;
|
||||||
map<symbol, param_size::size*, symbol_hash_proc, symbol_eq_proc> szs;
|
map<symbol, param_size::size*, symbol_hash_proc, symbol_eq_proc> szs;
|
||||||
|
|
||||||
TRACE("datatype", for (auto const& s : names) tout << s << " "; tout << "\n";);
|
TRACE(datatype, for (auto const& s : names) tout << s << " "; tout << "\n";);
|
||||||
svector<symbol> todo(names);
|
svector<symbol> todo(names);
|
||||||
status st;
|
status st;
|
||||||
while (!todo.empty()) {
|
while (!todo.empty()) {
|
||||||
symbol s = todo.back();
|
symbol s = todo.back();
|
||||||
TRACE("datatype", tout << "Sort size for " << s << "\n";);
|
TRACE(datatype, tout << "Sort size for " << s << "\n";);
|
||||||
|
|
||||||
if (already_found.find(s, st) && st == BLACK) {
|
if (already_found.find(s, st) && st == BLACK) {
|
||||||
todo.pop_back();
|
todo.pop_back();
|
||||||
|
@ -897,7 +897,7 @@ namespace datatype {
|
||||||
todo.pop_back();
|
todo.pop_back();
|
||||||
already_found.insert(s, BLACK);
|
already_found.insert(s, BLACK);
|
||||||
if (is_infinite) {
|
if (is_infinite) {
|
||||||
TRACE("datatype", tout << "infinite " << s << "\n";);
|
TRACE(datatype, tout << "infinite " << s << "\n";);
|
||||||
d.set_sort_size(param_size::size::mk_offset(sort_size::mk_infinite()));
|
d.set_sort_size(param_size::size::mk_offset(sort_size::mk_infinite()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -911,7 +911,7 @@ namespace datatype {
|
||||||
}
|
}
|
||||||
s_add.push_back(param_size::size::mk_times(s_mul));
|
s_add.push_back(param_size::size::mk_times(s_mul));
|
||||||
}
|
}
|
||||||
TRACE("datatype", tout << "set sort size " << s << "\n";);
|
TRACE(datatype, tout << "set sort size " << s << "\n";);
|
||||||
d.set_sort_size(param_size::size::mk_plus(s_add));
|
d.set_sort_size(param_size::size::mk_plus(s_add));
|
||||||
plugin().m_refs.reset();
|
plugin().m_refs.reset();
|
||||||
}
|
}
|
||||||
|
@ -1208,7 +1208,7 @@ namespace datatype {
|
||||||
return cd.first;
|
return cd.first;
|
||||||
ptr_vector<sort> forbidden_set;
|
ptr_vector<sort> forbidden_set;
|
||||||
forbidden_set.push_back(ty);
|
forbidden_set.push_back(ty);
|
||||||
TRACE("util_bug", tout << "invoke get-non-rec: " << sort_ref(ty, m) << "\n";);
|
TRACE(util_bug, tout << "invoke get-non-rec: " << sort_ref(ty, m) << "\n";);
|
||||||
cd = get_non_rec_constructor_core(ty, forbidden_set);
|
cd = get_non_rec_constructor_core(ty, forbidden_set);
|
||||||
SASSERT(forbidden_set.back() == ty);
|
SASSERT(forbidden_set.back() == ty);
|
||||||
if (!cd.first) // datatypes are not completed on parse errors
|
if (!cd.first) // datatypes are not completed on parse errors
|
||||||
|
@ -1232,7 +1232,7 @@ namespace datatype {
|
||||||
cnstr_depth result(nullptr, 0);
|
cnstr_depth result(nullptr, 0);
|
||||||
if (plugin().m_datatype2nonrec_constructor.find(ty, result))
|
if (plugin().m_datatype2nonrec_constructor.find(ty, result))
|
||||||
return result;
|
return result;
|
||||||
TRACE("util_bug", tout << "get-non-rec constructor: " << sort_ref(ty, m) << "\n";
|
TRACE(util_bug, tout << "get-non-rec constructor: " << sort_ref(ty, m) << "\n";
|
||||||
tout << "forbidden: ";
|
tout << "forbidden: ";
|
||||||
for (sort* s : forbidden_set) tout << sort_ref(s, m) << " ";
|
for (sort* s : forbidden_set) tout << sort_ref(s, m) << " ";
|
||||||
tout << "\n";
|
tout << "\n";
|
||||||
|
@ -1245,7 +1245,7 @@ namespace datatype {
|
||||||
for (unsigned cj = 0; cj < constructors.size(); ++cj) {
|
for (unsigned cj = 0; cj < constructors.size(); ++cj) {
|
||||||
func_decl* c = constructors[(start + cj) % constructors.size()];
|
func_decl* c = constructors[(start + cj) % constructors.size()];
|
||||||
if (all_of(*c, [&](sort* s) { return !is_datatype(s); })) {
|
if (all_of(*c, [&](sort* s) { return !is_datatype(s); })) {
|
||||||
TRACE("util_bug", tout << "non_rec_constructor c: " << func_decl_ref(c, m) << "\n";);
|
TRACE(util_bug, tout << "non_rec_constructor c: " << func_decl_ref(c, m) << "\n";);
|
||||||
result.first = c;
|
result.first = c;
|
||||||
result.second = 1;
|
result.second = 1;
|
||||||
plugin().add_ast(result.first);
|
plugin().add_ast(result.first);
|
||||||
|
@ -1257,7 +1257,7 @@ namespace datatype {
|
||||||
|
|
||||||
for (unsigned cj = 0; cj < constructors.size(); ++cj) {
|
for (unsigned cj = 0; cj < constructors.size(); ++cj) {
|
||||||
func_decl* c = constructors[(start + cj) % constructors.size()];
|
func_decl* c = constructors[(start + cj) % constructors.size()];
|
||||||
TRACE("util_bug", tout << "non_rec_constructor c: " << func_decl_ref(c, m) << "\n";);
|
TRACE(util_bug, tout << "non_rec_constructor c: " << func_decl_ref(c, m) << "\n";);
|
||||||
unsigned num_args = c->get_arity();
|
unsigned num_args = c->get_arity();
|
||||||
unsigned j = 0;
|
unsigned j = 0;
|
||||||
unsigned max_depth = 0;
|
unsigned max_depth = 0;
|
||||||
|
@ -1265,13 +1265,13 @@ namespace datatype {
|
||||||
for (; j < num_args; j++) {
|
for (; j < num_args; j++) {
|
||||||
unsigned i = (start2 + j) % num_args;
|
unsigned i = (start2 + j) % num_args;
|
||||||
sort * T_i = autil.get_array_range_rec(c->get_domain(i));
|
sort * T_i = autil.get_array_range_rec(c->get_domain(i));
|
||||||
TRACE("util_bug", tout << "c: " << i << " " << sort_ref(T_i, m) << "\n";);
|
TRACE(util_bug, tout << "c: " << i << " " << sort_ref(T_i, m) << "\n";);
|
||||||
if (!is_datatype(T_i)) {
|
if (!is_datatype(T_i)) {
|
||||||
TRACE("util_bug", tout << sort_ref(T_i, m) << " is not a datatype\n";);
|
TRACE(util_bug, tout << sort_ref(T_i, m) << " is not a datatype\n";);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (std::find(forbidden_set.begin(), forbidden_set.end(), T_i) != forbidden_set.end()) {
|
if (std::find(forbidden_set.begin(), forbidden_set.end(), T_i) != forbidden_set.end()) {
|
||||||
TRACE("util_bug", tout << sort_ref(T_i, m) << " is in forbidden_set\n";);
|
TRACE(util_bug, tout << sort_ref(T_i, m) << " is in forbidden_set\n";);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
forbidden_set.push_back(T_i);
|
forbidden_set.push_back(T_i);
|
||||||
|
@ -1280,7 +1280,7 @@ namespace datatype {
|
||||||
forbidden_set.pop_back();
|
forbidden_set.pop_back();
|
||||||
if (nested_c.first == nullptr)
|
if (nested_c.first == nullptr)
|
||||||
break;
|
break;
|
||||||
TRACE("util_bug", tout << "nested_c: " << nested_c.first->get_name() << "\n";);
|
TRACE(util_bug, tout << "nested_c: " << nested_c.first->get_name() << "\n";);
|
||||||
max_depth = std::max(nested_c.second + 1, max_depth);
|
max_depth = std::max(nested_c.second + 1, max_depth);
|
||||||
}
|
}
|
||||||
if (j == num_args && max_depth < min_depth) {
|
if (j == num_args && max_depth < min_depth) {
|
||||||
|
|
|
@ -211,7 +211,7 @@ namespace datalog {
|
||||||
ast_manager& m = *m_manager;
|
ast_manager& m = *m_manager;
|
||||||
ptr_vector<sort> sorts;
|
ptr_vector<sort> sorts;
|
||||||
vector<parameter> ps;
|
vector<parameter> ps;
|
||||||
TRACE("dl_decl_plugin",
|
TRACE(dl_decl_plugin,
|
||||||
tout << mk_pp(r, m) << " ";
|
tout << mk_pp(r, m) << " ";
|
||||||
for (unsigned i = 0; i < num_params; ++i) {
|
for (unsigned i = 0; i < num_params; ++i) {
|
||||||
tout << params[i] << " ";
|
tout << params[i] << " ";
|
||||||
|
@ -624,7 +624,7 @@ namespace datalog {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("dl_decl_plugin", tout << mk_pp(result, *m_manager) << "\n";);
|
TRACE(dl_decl_plugin, tout << mk_pp(result, *m_manager) << "\n";);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -437,10 +437,10 @@ namespace euf {
|
||||||
if (eq_id == UINT_MAX)
|
if (eq_id == UINT_MAX)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
TRACE("plugin", tout << "propagate " << eq_id << ": " << eq_pp(*this, m_eqs[eq_id]) << "\n");
|
TRACE(plugin, tout << "propagate " << eq_id << ": " << eq_pp(*this, m_eqs[eq_id]) << "\n");
|
||||||
|
|
||||||
// simplify eq using processed
|
// simplify eq using processed
|
||||||
TRACE("plugin",
|
TRACE(plugin,
|
||||||
for (auto other_eq : backward_iterator(eq_id))
|
for (auto other_eq : backward_iterator(eq_id))
|
||||||
tout << "backward iterator " << eq_id << " vs " << other_eq << " " << is_processed(other_eq) << "\n");
|
tout << "backward iterator " << eq_id << " vs " << other_eq << " " << is_processed(other_eq) << "\n");
|
||||||
for (auto other_eq : backward_iterator(eq_id))
|
for (auto other_eq : backward_iterator(eq_id))
|
||||||
|
@ -466,7 +466,7 @@ namespace euf {
|
||||||
}
|
}
|
||||||
propagate_shared();
|
propagate_shared();
|
||||||
|
|
||||||
CTRACE("plugin", !m_shared.empty() || !m_eqs.empty(), display(tout));
|
CTRACE(plugin, !m_shared.empty() || !m_eqs.empty(), display(tout));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned ac_plugin::pick_next_eq() {
|
unsigned ac_plugin::pick_next_eq() {
|
||||||
|
@ -637,11 +637,11 @@ namespace euf {
|
||||||
auto& src = m_eqs[src_eq]; // src_r_counts, src_l_counts are initialized
|
auto& src = m_eqs[src_eq]; // src_r_counts, src_l_counts are initialized
|
||||||
auto& dst = m_eqs[dst_eq];
|
auto& dst = m_eqs[dst_eq];
|
||||||
|
|
||||||
TRACE("plugin", tout << "forward simplify " << eq_pp(*this, src) << " " << eq_pp(*this, dst) << "\n");
|
TRACE(plugin, tout << "forward simplify " << eq_pp(*this, src) << " " << eq_pp(*this, dst) << "\n");
|
||||||
|
|
||||||
|
|
||||||
if (forward_subsumes(src_eq, dst_eq)) {
|
if (forward_subsumes(src_eq, dst_eq)) {
|
||||||
TRACE("plugin", tout << "forward subsumed\n");
|
TRACE(plugin, tout << "forward subsumed\n");
|
||||||
set_status(dst_eq, eq_status::is_dead);
|
set_status(dst_eq, eq_status::is_dead);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -691,7 +691,7 @@ namespace euf {
|
||||||
push_undo(is_update_eq);
|
push_undo(is_update_eq);
|
||||||
m_src_r.reset();
|
m_src_r.reset();
|
||||||
m_src_r.append(monomial(src.r).m_nodes);
|
m_src_r.append(monomial(src.r).m_nodes);
|
||||||
TRACE("plugin", tout << "rewritten to " << m_pp(*this, monomial(new_r)) << "\n");
|
TRACE(plugin, tout << "rewritten to " << m_pp(*this, monomial(new_r)) << "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ac_plugin::backward_simplify(unsigned dst_eq, unsigned src_eq) {
|
bool ac_plugin::backward_simplify(unsigned dst_eq, unsigned src_eq) {
|
||||||
|
@ -703,10 +703,10 @@ namespace euf {
|
||||||
//
|
//
|
||||||
// dst_ids, dst_count contain rhs of dst_eq
|
// dst_ids, dst_count contain rhs of dst_eq
|
||||||
//
|
//
|
||||||
TRACE("plugin", tout << "backward simplify " << eq_pp(*this, src) << " " << eq_pp(*this, dst) << " can-be-subset: " << can_be_subset(monomial(src.l), monomial(dst.r)) << "\n");
|
TRACE(plugin, tout << "backward simplify " << eq_pp(*this, src) << " " << eq_pp(*this, dst) << " can-be-subset: " << can_be_subset(monomial(src.l), monomial(dst.r)) << "\n");
|
||||||
|
|
||||||
if (backward_subsumes(src_eq, dst_eq)) {
|
if (backward_subsumes(src_eq, dst_eq)) {
|
||||||
TRACE("plugin", tout << "backward subsumed\n");
|
TRACE(plugin, tout << "backward subsumed\n");
|
||||||
set_status(dst_eq, eq_status::is_dead);
|
set_status(dst_eq, eq_status::is_dead);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -714,7 +714,7 @@ namespace euf {
|
||||||
if (!can_be_subset(monomial(src.l), monomial(dst.r)))
|
if (!can_be_subset(monomial(src.l), monomial(dst.r)))
|
||||||
return false;
|
return false;
|
||||||
if (!is_subset(m_dst_r_counts, m_src_l_counts, monomial(src.l))) {
|
if (!is_subset(m_dst_r_counts, m_src_l_counts, monomial(src.l))) {
|
||||||
TRACE("plugin", tout << "not subset\n");
|
TRACE(plugin, tout << "not subset\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,7 +731,7 @@ namespace euf {
|
||||||
m_update_eq_trail.push_back({ dst_eq, m_eqs[dst_eq] });
|
m_update_eq_trail.push_back({ dst_eq, m_eqs[dst_eq] });
|
||||||
m_eqs[dst_eq].r = new_r;
|
m_eqs[dst_eq].r = new_r;
|
||||||
m_eqs[dst_eq].j = j;
|
m_eqs[dst_eq].j = j;
|
||||||
TRACE("plugin", tout << "rewritten to " << m_pp(*this, monomial(new_r)) << "\n");
|
TRACE(plugin, tout << "rewritten to " << m_pp(*this, monomial(new_r)) << "\n");
|
||||||
push_undo(is_update_eq);
|
push_undo(is_update_eq);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -850,7 +850,7 @@ namespace euf {
|
||||||
continue;
|
continue;
|
||||||
if (!is_subset(m_m_counts, m_eq_counts, monomial(src.l)))
|
if (!is_subset(m_m_counts, m_eq_counts, monomial(src.l)))
|
||||||
continue;
|
continue;
|
||||||
TRACE("plugin", display_equation(tout << "reduce ", src) << "\n");
|
TRACE(plugin, display_equation(tout << "reduce ", src) << "\n");
|
||||||
SASSERT(is_correct_ref_count(monomial(src.l), m_eq_counts));
|
SASSERT(is_correct_ref_count(monomial(src.l), m_eq_counts));
|
||||||
rewrite1(m_eq_counts, monomial(src.r), m_m_counts, m);
|
rewrite1(m_eq_counts, monomial(src.r), m_m_counts, m);
|
||||||
j = join(j, eq);
|
j = join(j, eq);
|
||||||
|
@ -900,7 +900,7 @@ namespace euf {
|
||||||
auto& src = m_eqs[src_eq];
|
auto& src = m_eqs[src_eq];
|
||||||
auto& dst = m_eqs[dst_eq];
|
auto& dst = m_eqs[dst_eq];
|
||||||
|
|
||||||
TRACE("plugin", tout << "superpose: "; display_equation(tout, src); tout << " "; display_equation(tout, dst); tout << "\n";);
|
TRACE(plugin, tout << "superpose: "; display_equation(tout, src); tout << " "; display_equation(tout, dst); tout << "\n";);
|
||||||
// AB -> C, AD -> E => BE ~ CD
|
// AB -> C, AD -> E => BE ~ CD
|
||||||
// m_src_ids, m_src_counts contains information about src (call it AD -> E)
|
// m_src_ids, m_src_counts contains information about src (call it AD -> E)
|
||||||
m_dst_l_counts.reset();
|
m_dst_l_counts.reset();
|
||||||
|
@ -941,7 +941,7 @@ namespace euf {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("plugin", tout << m_pp(*this, m_src_r) << "== " << m_pp(*this, m_dst_r) << "\n";);
|
TRACE(plugin, tout << m_pp(*this, m_src_r) << "== " << m_pp(*this, m_dst_r) << "\n";);
|
||||||
|
|
||||||
justification j = justify_rewrite(src_eq, dst_eq);
|
justification j = justify_rewrite(src_eq, dst_eq);
|
||||||
reduce(m_dst_r, j);
|
reduce(m_dst_r, j);
|
||||||
|
@ -994,11 +994,11 @@ namespace euf {
|
||||||
m_monomial_table.reset();
|
m_monomial_table.reset();
|
||||||
for (auto const& s1 : m_shared) {
|
for (auto const& s1 : m_shared) {
|
||||||
shared s2;
|
shared s2;
|
||||||
TRACE("plugin", tout << "shared " << m_pp(*this, monomial(s1.m)) << "\n");
|
TRACE(plugin, tout << "shared " << m_pp(*this, monomial(s1.m)) << "\n");
|
||||||
if (!m_monomial_table.find(s1.m, s2))
|
if (!m_monomial_table.find(s1.m, s2))
|
||||||
m_monomial_table.insert(s1.m, s1);
|
m_monomial_table.insert(s1.m, s1);
|
||||||
else if (s2.n->get_root() != s1.n->get_root()) {
|
else if (s2.n->get_root() != s1.n->get_root()) {
|
||||||
TRACE("plugin", tout << m_pp(*this, monomial(s1.m)) << " == " << m_pp(*this, monomial(s2.m)) << "\n");
|
TRACE(plugin, tout << m_pp(*this, monomial(s1.m)) << " == " << m_pp(*this, monomial(s2.m)) << "\n");
|
||||||
push_merge(s1.n, s2.n, justification::dependent(m_dep_manager.mk_join(m_dep_manager.mk_leaf(s1.j), m_dep_manager.mk_leaf(s2.j))));
|
push_merge(s1.n, s2.n, justification::dependent(m_dep_manager.mk_join(m_dep_manager.mk_leaf(s1.j), m_dep_manager.mk_leaf(s2.j))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1008,7 +1008,7 @@ namespace euf {
|
||||||
auto j = s.j;
|
auto j = s.j;
|
||||||
auto old_m = s.m;
|
auto old_m = s.m;
|
||||||
ptr_vector<node> m1(monomial(old_m).m_nodes);
|
ptr_vector<node> m1(monomial(old_m).m_nodes);
|
||||||
TRACE("plugin", tout << "simplify " << m_pp(*this, monomial(old_m)) << "\n");
|
TRACE(plugin, tout << "simplify " << m_pp(*this, monomial(old_m)) << "\n");
|
||||||
if (!reduce(m1, j))
|
if (!reduce(m1, j))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace euf {
|
||||||
if (!bv.is_bv(x->get_expr()))
|
if (!bv.is_bv(x->get_expr()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TRACE("bv", tout << "merge_eh " << g.bpp(x) << " == " << g.bpp(y) << "\n");
|
TRACE(bv, tout << "merge_eh " << g.bpp(x) << " == " << g.bpp(y) << "\n");
|
||||||
SASSERT(!m_internal);
|
SASSERT(!m_internal);
|
||||||
flet<bool> _internal(m_internal, true);
|
flet<bool> _internal(m_internal, true);
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ namespace euf {
|
||||||
m_ensure_concat.reset();
|
m_ensure_concat.reset();
|
||||||
auto ensure_concat = [&](unsigned lo, unsigned mid, unsigned hi) {
|
auto ensure_concat = [&](unsigned lo, unsigned mid, unsigned hi) {
|
||||||
// verbose_stream() << lo << " " << mid << " " << hi << "\n";
|
// verbose_stream() << lo << " " << mid << " " << hi << "\n";
|
||||||
TRACE("bv", tout << "ensure-concat " << lo << " " << mid << " " << hi << "\n");
|
TRACE(bv, tout << "ensure-concat " << lo << " " << mid << " " << hi << "\n");
|
||||||
unsigned lo_, hi_;
|
unsigned lo_, hi_;
|
||||||
for (enode* p1 : enode_parents(n))
|
for (enode* p1 : enode_parents(n))
|
||||||
if (is_extract(p1, lo_, hi_) && lo_ == lo && hi_ == hi && p1->get_arg(0)->get_root() == arg_r)
|
if (is_extract(p1, lo_, hi_) && lo_ == lo && hi_ == hi && p1->get_arg(0)->get_root() == arg_r)
|
||||||
|
@ -218,14 +218,14 @@ namespace euf {
|
||||||
};
|
};
|
||||||
|
|
||||||
auto propagate_above = [&](enode* b) {
|
auto propagate_above = [&](enode* b) {
|
||||||
TRACE("bv", tout << "propagate-above " << g.bpp(b) << "\n");
|
TRACE(bv, tout << "propagate-above " << g.bpp(b) << "\n");
|
||||||
for (enode* sib : enode_class(b))
|
for (enode* sib : enode_class(b))
|
||||||
if (is_extract(sib, lo2, hi2) && sib->get_arg(0)->get_root() == arg_r && hi1 + 1 == lo2)
|
if (is_extract(sib, lo2, hi2) && sib->get_arg(0)->get_root() == arg_r && hi1 + 1 == lo2)
|
||||||
m_ensure_concat.push_back({lo1, hi1, hi2});
|
m_ensure_concat.push_back({lo1, hi1, hi2});
|
||||||
};
|
};
|
||||||
|
|
||||||
auto propagate_below = [&](enode* a) {
|
auto propagate_below = [&](enode* a) {
|
||||||
TRACE("bv", tout << "propagate-below " << g.bpp(a) << "\n");
|
TRACE(bv, tout << "propagate-below " << g.bpp(a) << "\n");
|
||||||
for (enode* sib : enode_class(a))
|
for (enode* sib : enode_class(a))
|
||||||
if (is_extract(sib, lo2, hi2) && sib->get_arg(0)->get_root() == arg_r && hi2 + 1 == lo1)
|
if (is_extract(sib, lo2, hi2) && sib->get_arg(0)->get_root() == arg_r && hi2 + 1 == lo1)
|
||||||
m_ensure_concat.push_back({lo2, hi2, hi1});
|
m_ensure_concat.push_back({lo2, hi2, hi1});
|
||||||
|
@ -271,7 +271,7 @@ namespace euf {
|
||||||
|
|
||||||
|
|
||||||
void bv_plugin::propagate_register_node(enode* n) {
|
void bv_plugin::propagate_register_node(enode* n) {
|
||||||
TRACE("bv", tout << "register " << g.bpp(n) << "\n");
|
TRACE(bv, tout << "register " << g.bpp(n) << "\n");
|
||||||
enode* a, * b;
|
enode* a, * b;
|
||||||
unsigned lo, hi;
|
unsigned lo, hi;
|
||||||
if (is_concat(n, a, b)) {
|
if (is_concat(n, a, b)) {
|
||||||
|
@ -296,7 +296,7 @@ namespace euf {
|
||||||
push_merge(mk_extract(arg, 0, w - 1), arg);
|
push_merge(mk_extract(arg, 0, w - 1), arg);
|
||||||
ensure_slice(arg, lo, hi);
|
ensure_slice(arg, lo, hi);
|
||||||
}
|
}
|
||||||
TRACE("bv", tout << "done register " << g.bpp(n) << "\n");
|
TRACE(bv, tout << "done register " << g.bpp(n) << "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -306,7 +306,7 @@ namespace euf {
|
||||||
enode* r = n;
|
enode* r = n;
|
||||||
unsigned lb = 0, ub = width(n) - 1;
|
unsigned lb = 0, ub = width(n) - 1;
|
||||||
while (true) {
|
while (true) {
|
||||||
TRACE("bv", tout << "ensure slice " << g.bpp(n) << " " << lb << " [" << lo << ", " << hi << "] " << ub << "\n");
|
TRACE(bv, tout << "ensure slice " << g.bpp(n) << " " << lb << " [" << lo << ", " << hi << "] " << ub << "\n");
|
||||||
SASSERT(lb <= lo && hi <= ub);
|
SASSERT(lb <= lo && hi <= ub);
|
||||||
SASSERT(ub - lb + 1 == width(r));
|
SASSERT(ub - lb + 1 == width(r));
|
||||||
if (lb == lo && ub == hi)
|
if (lb == lo && ub == hi)
|
||||||
|
@ -370,7 +370,7 @@ namespace euf {
|
||||||
SASSERT(!ys.empty());
|
SASSERT(!ys.empty());
|
||||||
auto x = xs.back();
|
auto x = xs.back();
|
||||||
auto y = ys.back();
|
auto y = ys.back();
|
||||||
TRACE("bv", tout << "merge " << g.bpp(x) << " " << g.bpp(y) << "\n");
|
TRACE(bv, tout << "merge " << g.bpp(x) << " " << g.bpp(y) << "\n");
|
||||||
if (unfold_sub(x, xs))
|
if (unfold_sub(x, xs))
|
||||||
continue;
|
continue;
|
||||||
else if (unfold_sub(y, ys))
|
else if (unfold_sub(y, ys))
|
||||||
|
@ -407,7 +407,7 @@ namespace euf {
|
||||||
}
|
}
|
||||||
|
|
||||||
void bv_plugin::split(enode* n, unsigned cut) {
|
void bv_plugin::split(enode* n, unsigned cut) {
|
||||||
TRACE("bv", tout << "split: " << g.bpp(n) << " " << cut << "\n");
|
TRACE(bv, tout << "split: " << g.bpp(n) << " " << cut << "\n");
|
||||||
unsigned w = width(n);
|
unsigned w = width(n);
|
||||||
SASSERT(!info(n).hi);
|
SASSERT(!info(n).hi);
|
||||||
SASSERT(0 < cut && cut < w);
|
SASSERT(0 < cut && cut < w);
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace euf {
|
||||||
}
|
}
|
||||||
|
|
||||||
enode_bool_pair egraph::insert_table(enode* p) {
|
enode_bool_pair egraph::insert_table(enode* p) {
|
||||||
TRACE("euf_verbose", tout << "insert_table " << bpp(p) << "\n");
|
TRACE(euf_verbose, tout << "insert_table " << bpp(p) << "\n");
|
||||||
//SASSERT(!m_table.contains_ptr(p));
|
//SASSERT(!m_table.contains_ptr(p));
|
||||||
auto rc = m_table.insert(p);
|
auto rc = m_table.insert(p);
|
||||||
p->m_cg = rc.first;
|
p->m_cg = rc.first;
|
||||||
|
@ -163,7 +163,7 @@ namespace euf {
|
||||||
}
|
}
|
||||||
|
|
||||||
void egraph::add_th_eq(theory_id id, theory_var v1, theory_var v2, enode* c, enode* r) {
|
void egraph::add_th_eq(theory_id id, theory_var v1, theory_var v2, enode* c, enode* r) {
|
||||||
TRACE("euf", tout << "eq: " << v1 << " == " << v2 << " - " << bpp(c) << " == " << bpp(r) << "\n";);
|
TRACE(euf, tout << "eq: " << v1 << " == " << v2 << " - " << bpp(c) << " == " << bpp(r) << "\n";);
|
||||||
m_new_th_eqs.push_back(th_eq(id, v1, v2, c, r));
|
m_new_th_eqs.push_back(th_eq(id, v1, v2, c, r));
|
||||||
m_updates.push_back(update_record(update_record::new_th_eq()));
|
m_updates.push_back(update_record(update_record::new_th_eq()));
|
||||||
++m_stats.m_num_th_eqs;
|
++m_stats.m_num_th_eqs;
|
||||||
|
@ -175,7 +175,7 @@ namespace euf {
|
||||||
void egraph::add_th_diseq(theory_id id, theory_var v1, theory_var v2, enode* eq) {
|
void egraph::add_th_diseq(theory_id id, theory_var v1, theory_var v2, enode* eq) {
|
||||||
if (!th_propagates_diseqs(id))
|
if (!th_propagates_diseqs(id))
|
||||||
return;
|
return;
|
||||||
TRACE("euf_verbose", tout << "eq: " << v1 << " != " << v2 << "\n";);
|
TRACE(euf_verbose, tout << "eq: " << v1 << " != " << v2 << "\n";);
|
||||||
m_new_th_eqs.push_back(th_eq(id, v1, v2, eq->get_expr()));
|
m_new_th_eqs.push_back(th_eq(id, v1, v2, eq->get_expr()));
|
||||||
m_updates.push_back(update_record(update_record::new_th_eq()));
|
m_updates.push_back(update_record(update_record::new_th_eq()));
|
||||||
auto* p = get_plugin(id);
|
auto* p = get_plugin(id);
|
||||||
|
@ -185,7 +185,7 @@ namespace euf {
|
||||||
}
|
}
|
||||||
|
|
||||||
void egraph::add_literal(enode* n, enode* ante) {
|
void egraph::add_literal(enode* n, enode* ante) {
|
||||||
TRACE("euf", tout << "propagate " << bpp(n) << " " << bpp(ante) << "\n");
|
TRACE(euf, tout << "propagate " << bpp(n) << " " << bpp(ante) << "\n");
|
||||||
if (!m_on_propagate_literal)
|
if (!m_on_propagate_literal)
|
||||||
return;
|
return;
|
||||||
if (!ante) ++m_stats.m_num_eqs; else ++m_stats.m_num_lits;
|
if (!ante) ++m_stats.m_num_eqs; else ++m_stats.m_num_lits;
|
||||||
|
@ -222,7 +222,7 @@ namespace euf {
|
||||||
enode* arg1 = n->get_arg(0), * arg2 = n->get_arg(1);
|
enode* arg1 = n->get_arg(0), * arg2 = n->get_arg(1);
|
||||||
enode* r1 = arg1->get_root();
|
enode* r1 = arg1->get_root();
|
||||||
enode* r2 = arg2->get_root();
|
enode* r2 = arg2->get_root();
|
||||||
TRACE("euf", tout << "new-diseq: " << bpp(r1) << " " << bpp(r2) << ": " << r1->has_th_vars() << " " << r2->has_th_vars() << "\n";);
|
TRACE(euf, tout << "new-diseq: " << bpp(r1) << " " << bpp(r2) << ": " << r1->has_th_vars() << " " << r2->has_th_vars() << "\n";);
|
||||||
if (r1 == r2) {
|
if (r1 == r2) {
|
||||||
add_literal(n, nullptr);
|
add_literal(n, nullptr);
|
||||||
return;
|
return;
|
||||||
|
@ -323,7 +323,7 @@ namespace euf {
|
||||||
if (!m.is_bool(n->get_sort()))
|
if (!m.is_bool(n->get_sort()))
|
||||||
return;
|
return;
|
||||||
if (enable_merge_tf != n->merge_tf()) {
|
if (enable_merge_tf != n->merge_tf()) {
|
||||||
TRACE("euf", tout << "set tf " << enable_merge_tf << " " << bpp(n) << "\n");
|
TRACE(euf, tout << "set tf " << enable_merge_tf << " " << bpp(n) << "\n");
|
||||||
n->set_merge_tf(enable_merge_tf);
|
n->set_merge_tf(enable_merge_tf);
|
||||||
m_updates.push_back(update_record(n, update_record::toggle_merge_tf()));
|
m_updates.push_back(update_record(n, update_record::toggle_merge_tf()));
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ namespace euf {
|
||||||
void egraph::set_value(enode* n, lbool value, justification j) {
|
void egraph::set_value(enode* n, lbool value, justification j) {
|
||||||
if (n->value() == l_undef) {
|
if (n->value() == l_undef) {
|
||||||
force_push();
|
force_push();
|
||||||
TRACE("euf", tout << bpp(n) << " := " << value << "\n";);
|
TRACE(euf, tout << bpp(n) << " := " << value << "\n";);
|
||||||
n->set_value(value);
|
n->set_value(value);
|
||||||
n->m_lit_justification = j;
|
n->m_lit_justification = j;
|
||||||
m_updates.push_back(update_record(n, update_record::value_assignment()));
|
m_updates.push_back(update_record(n, update_record::value_assignment()));
|
||||||
|
@ -459,7 +459,7 @@ namespace euf {
|
||||||
break;
|
break;
|
||||||
case update_record::tag_t::is_update_children:
|
case update_record::tag_t::is_update_children:
|
||||||
for (unsigned i = 0; i < p.r1->num_args(); ++i) {
|
for (unsigned i = 0; i < p.r1->num_args(); ++i) {
|
||||||
CTRACE("euf", (p.r1->m_args[i]->get_root()->m_parents.back() != p.r1),
|
CTRACE(euf, (p.r1->m_args[i]->get_root()->m_parents.back() != p.r1),
|
||||||
display(tout << bpp(p.r1->m_args[i]) << " " << bpp(p.r1->m_args[i]->get_root()) << " "););
|
display(tout << bpp(p.r1->m_args[i]) << " " << bpp(p.r1->m_args[i]->get_root()) << " "););
|
||||||
SASSERT(p.r1->m_args[i]->get_root()->m_parents.back() == p.r1);
|
SASSERT(p.r1->m_args[i]->get_root()->m_parents.back() == p.r1);
|
||||||
p.r1->m_args[i]->get_root()->m_parents.pop_back();
|
p.r1->m_args[i]->get_root()->m_parents.pop_back();
|
||||||
|
@ -494,7 +494,7 @@ namespace euf {
|
||||||
if (r1 == r2)
|
if (r1 == r2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TRACE("euf", j.display(tout << "merge: " << bpp(n1) << " == " << bpp(n2) << " ", m_display_justification) << "\n" << bpp(r1) << " " << bpp(r2) << "\n";);
|
TRACE(euf, j.display(tout << "merge: " << bpp(n1) << " == " << bpp(n2) << " ", m_display_justification) << "\n" << bpp(r1) << " " << bpp(r2) << "\n";);
|
||||||
IF_VERBOSE(20, j.display(verbose_stream() << "merge: " << bpp(n1) << " == " << bpp(n2) << " ", m_display_justification) << "\n";);
|
IF_VERBOSE(20, j.display(verbose_stream() << "merge: " << bpp(n1) << " == " << bpp(n2) << " ", m_display_justification) << "\n";);
|
||||||
force_push();
|
force_push();
|
||||||
SASSERT(m_num_scopes == 0);
|
SASSERT(m_num_scopes == 0);
|
||||||
|
@ -537,7 +537,7 @@ namespace euf {
|
||||||
}
|
}
|
||||||
|
|
||||||
void egraph::remove_parents(enode* r) {
|
void egraph::remove_parents(enode* r) {
|
||||||
TRACE("euf_verbose", tout << bpp(r) << "\n");
|
TRACE(euf_verbose, tout << bpp(r) << "\n");
|
||||||
SASSERT(all_of(enode_parents(r), [&](enode* p) { return !p->is_marked1(); }));
|
SASSERT(all_of(enode_parents(r), [&](enode* p) { return !p->is_marked1(); }));
|
||||||
for (enode* p : enode_parents(r)) {
|
for (enode* p : enode_parents(r)) {
|
||||||
if (p->is_marked1())
|
if (p->is_marked1())
|
||||||
|
@ -548,7 +548,7 @@ namespace euf {
|
||||||
SASSERT(m_table.contains_ptr(p));
|
SASSERT(m_table.contains_ptr(p));
|
||||||
p->mark1();
|
p->mark1();
|
||||||
erase_from_table(p);
|
erase_from_table(p);
|
||||||
CTRACE("euf_verbose", m_table.contains_ptr(p), tout << bpp(p) << "\n"; display(tout));
|
CTRACE(euf_verbose, m_table.contains_ptr(p), tout << bpp(p) << "\n"; display(tout));
|
||||||
SASSERT(!m_table.contains_ptr(p));
|
SASSERT(!m_table.contains_ptr(p));
|
||||||
}
|
}
|
||||||
else if (p->is_equality())
|
else if (p->is_equality())
|
||||||
|
@ -561,11 +561,11 @@ namespace euf {
|
||||||
if (!p->is_marked1())
|
if (!p->is_marked1())
|
||||||
continue;
|
continue;
|
||||||
p->unmark1();
|
p->unmark1();
|
||||||
TRACE("euf_verbose", tout << "reinsert " << bpp(r1) << " " << bpp(r2) << " " << bpp(p) << " " << p->cgc_enabled() << "\n";);
|
TRACE(euf_verbose, tout << "reinsert " << bpp(r1) << " " << bpp(r2) << " " << bpp(p) << " " << p->cgc_enabled() << "\n";);
|
||||||
if (p->cgc_enabled()) {
|
if (p->cgc_enabled()) {
|
||||||
auto [p_other, comm] = insert_table(p);
|
auto [p_other, comm] = insert_table(p);
|
||||||
SASSERT(m_table.contains_ptr(p) == (p_other == p));
|
SASSERT(m_table.contains_ptr(p) == (p_other == p));
|
||||||
CTRACE("euf_verbose", p_other != p, tout << "reinsert " << bpp(p) << " == " << bpp(p_other) << " " << p->value() << " " << p_other->value() << "\n");
|
CTRACE(euf_verbose, p_other != p, tout << "reinsert " << bpp(p) << " == " << bpp(p_other) << " " << p->value() << " " << p_other->value() << "\n");
|
||||||
if (p_other != p)
|
if (p_other != p)
|
||||||
m_to_merge.push_back(to_merge(p_other, p, comm));
|
m_to_merge.push_back(to_merge(p_other, p, comm));
|
||||||
else
|
else
|
||||||
|
@ -599,14 +599,14 @@ namespace euf {
|
||||||
|
|
||||||
void egraph::undo_eq(enode* r1, enode* n1, unsigned r2_num_parents) {
|
void egraph::undo_eq(enode* r1, enode* n1, unsigned r2_num_parents) {
|
||||||
enode* r2 = r1->get_root();
|
enode* r2 = r1->get_root();
|
||||||
TRACE("euf_verbose", tout << "undo-eq old-root: " << bpp(r1) << " current-root " << bpp(r2) << " node: " << bpp(n1) << "\n";);
|
TRACE(euf_verbose, tout << "undo-eq old-root: " << bpp(r1) << " current-root " << bpp(r2) << " node: " << bpp(n1) << "\n";);
|
||||||
r2->dec_class_size(r1->class_size());
|
r2->dec_class_size(r1->class_size());
|
||||||
r2->set_is_shared(l_undef);
|
r2->set_is_shared(l_undef);
|
||||||
std::swap(r1->m_next, r2->m_next);
|
std::swap(r1->m_next, r2->m_next);
|
||||||
auto begin = r2->begin_parents() + r2_num_parents, end = r2->end_parents();
|
auto begin = r2->begin_parents() + r2_num_parents, end = r2->end_parents();
|
||||||
for (auto it = begin; it != end; ++it) {
|
for (auto it = begin; it != end; ++it) {
|
||||||
enode* p = *it;
|
enode* p = *it;
|
||||||
TRACE("euf_verbose", tout << "erase " << bpp(p) << "\n";);
|
TRACE(euf_verbose, tout << "erase " << bpp(p) << "\n";);
|
||||||
SASSERT(!p->cgc_enabled() || m_table.contains_ptr(p));
|
SASSERT(!p->cgc_enabled() || m_table.contains_ptr(p));
|
||||||
SASSERT(!p->cgc_enabled() || p->is_cgr());
|
SASSERT(!p->cgc_enabled() || p->is_cgr());
|
||||||
if (p->cgc_enabled())
|
if (p->cgc_enabled())
|
||||||
|
@ -661,7 +661,7 @@ namespace euf {
|
||||||
m_updates.push_back(update_record(false, update_record::inconsistent()));
|
m_updates.push_back(update_record(false, update_record::inconsistent()));
|
||||||
m_n1 = n1;
|
m_n1 = n1;
|
||||||
m_n2 = n2;
|
m_n2 = n2;
|
||||||
TRACE("euf", tout << "conflict " << bpp(n1) << " " << bpp(n2) << " " << j << " " << n1->get_root()->value() << " " << n2->get_root()->value() << "\n");
|
TRACE(euf, tout << "conflict " << bpp(n1) << " " << bpp(n2) << " " << j << " " << n1->get_root()->value() << " " << n2->get_root()->value() << "\n");
|
||||||
m_justification = j;
|
m_justification = j;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,11 +678,11 @@ namespace euf {
|
||||||
SASSERT(n2->acyclic());
|
SASSERT(n2->acyclic());
|
||||||
SASSERT(n1->get_root()->reaches(n1));
|
SASSERT(n1->get_root()->reaches(n1));
|
||||||
SASSERT(!n2->get_root()->m_target);
|
SASSERT(!n2->get_root()->m_target);
|
||||||
TRACE("euf_verbose", tout << "merge " << n1->get_expr_id() << " " << n2->get_expr_id() << " updates: " << m_updates.size() << "\n";);
|
TRACE(euf_verbose, tout << "merge " << n1->get_expr_id() << " " << n2->get_expr_id() << " updates: " << m_updates.size() << "\n";);
|
||||||
}
|
}
|
||||||
|
|
||||||
void egraph::unmerge_justification(enode* n1) {
|
void egraph::unmerge_justification(enode* n1) {
|
||||||
TRACE("euf_verbose", tout << "unmerge " << n1->get_expr_id() << " " << n1->m_target->get_expr_id() << "\n";);
|
TRACE(euf_verbose, tout << "unmerge " << n1->get_expr_id() << " " << n1->m_target->get_expr_id() << "\n";);
|
||||||
// r1 -> .. -> n1 -> n2 -> ... -> r2
|
// r1 -> .. -> n1 -> n2 -> ... -> r2
|
||||||
// where n2 = n1->m_target
|
// where n2 = n1->m_target
|
||||||
SASSERT(n1->get_root()->reaches(n1));
|
SASSERT(n1->get_root()->reaches(n1));
|
||||||
|
@ -749,7 +749,7 @@ namespace euf {
|
||||||
push_lca(n1->get_arg(1), n2->get_arg(0));
|
push_lca(n1->get_arg(1), n2->get_arg(0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TRACE("euf_verbose", tout << bpp(n1) << " " << bpp(n2) << "\n");
|
TRACE(euf_verbose, tout << bpp(n1) << " " << bpp(n2) << "\n");
|
||||||
|
|
||||||
for (unsigned i = 0; i < n1->num_args(); ++i)
|
for (unsigned i = 0; i < n1->num_args(); ++i)
|
||||||
push_lca(n1->get_arg(i), n2->get_arg(i));
|
push_lca(n1->get_arg(i), n2->get_arg(i));
|
||||||
|
@ -808,7 +808,7 @@ namespace euf {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void egraph::explain_eq(ptr_vector<T>& justifications, cc_justification* cc, enode* a, enode* b, justification const& j) {
|
void egraph::explain_eq(ptr_vector<T>& justifications, cc_justification* cc, enode* a, enode* b, justification const& j) {
|
||||||
TRACE("euf_verbose", tout << "explain-eq: " << bpp(a) << " == " << bpp(b) << " jst: " << j << "\n";);
|
TRACE(euf_verbose, tout << "explain-eq: " << bpp(a) << " == " << bpp(b) << " jst: " << j << "\n";);
|
||||||
if (j.is_external())
|
if (j.is_external())
|
||||||
justifications.push_back(j.ext<T>());
|
justifications.push_back(j.ext<T>());
|
||||||
else if (j.is_congruence())
|
else if (j.is_congruence())
|
||||||
|
@ -833,7 +833,7 @@ namespace euf {
|
||||||
SASSERT(a->get_root() == b->get_root());
|
SASSERT(a->get_root() == b->get_root());
|
||||||
|
|
||||||
enode* lca = find_lca(a, b);
|
enode* lca = find_lca(a, b);
|
||||||
TRACE("euf_verbose", tout << "explain-eq: " << bpp(a) << " == " << bpp(b) << " lca: " << bpp(lca) << "\n";);
|
TRACE(euf_verbose, tout << "explain-eq: " << bpp(a) << " == " << bpp(b) << " lca: " << bpp(lca) << "\n";);
|
||||||
push_to_lca(a, lca);
|
push_to_lca(a, lca);
|
||||||
push_to_lca(b, lca);
|
push_to_lca(b, lca);
|
||||||
if (m_used_eq)
|
if (m_used_eq)
|
||||||
|
@ -865,7 +865,7 @@ namespace euf {
|
||||||
continue;
|
continue;
|
||||||
if (n->m_target) {
|
if (n->m_target) {
|
||||||
n->mark1();
|
n->mark1();
|
||||||
CTRACE("euf_verbose", m_display_justification, n->m_justification.display(tout << n->get_expr_id() << " = " << n->m_target->get_expr_id() << " ", m_display_justification) << "\n";);
|
CTRACE(euf_verbose, m_display_justification, n->m_justification.display(tout << n->get_expr_id() << " = " << n->m_target->get_expr_id() << " ", m_display_justification) << "\n";);
|
||||||
explain_eq(justifications, cc, n, n->m_target, n->m_justification);
|
explain_eq(justifications, cc, n, n->m_target, n->m_justification);
|
||||||
}
|
}
|
||||||
else if (!n->is_marked1() && n->value() != l_undef) {
|
else if (!n->is_marked1() && n->value() != l_undef) {
|
||||||
|
@ -884,9 +884,9 @@ namespace euf {
|
||||||
n->invariant(*this);
|
n->invariant(*this);
|
||||||
for (enode* n : m_nodes)
|
for (enode* n : m_nodes)
|
||||||
if (n->cgc_enabled() && n->num_args() > 0 && (!m_table.find(n) || n->get_root() != m_table.find(n)->get_root())) {
|
if (n->cgc_enabled() && n->num_args() > 0 && (!m_table.find(n) || n->get_root() != m_table.find(n)->get_root())) {
|
||||||
CTRACE("euf", !m_table.find(n), tout << "node is not in table\n";);
|
CTRACE(euf, !m_table.find(n), tout << "node is not in table\n";);
|
||||||
CTRACE("euf", m_table.find(n), tout << "root " << bpp(n->get_root()) << " table root " << bpp(m_table.find(n)->get_root()) << "\n";);
|
CTRACE(euf, m_table.find(n), tout << "root " << bpp(n->get_root()) << " table root " << bpp(m_table.find(n)->get_root()) << "\n";);
|
||||||
TRACE("euf", display(tout << bpp(n) << " is not closed under congruence\n"););
|
TRACE(euf, display(tout << bpp(n) << " is not closed under congruence\n"););
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace euf {
|
||||||
for (enode* arg : enode_args(p)) {
|
for (enode* arg : enode_args(p)) {
|
||||||
found |= arg->get_root() == this;
|
found |= arg->get_root() == this;
|
||||||
}
|
}
|
||||||
CTRACE("euf", !found, tout << g.bpp(p) << " does not have a child with root: " << g.bpp(this) << "\n";);
|
CTRACE(euf, !found, tout << g.bpp(p) << " does not have a child with root: " << g.bpp(this) << "\n";);
|
||||||
VERIFY(found);
|
VERIFY(found);
|
||||||
}
|
}
|
||||||
for (enode* c : enode_class(this)) {
|
for (enode* c : enode_class(this)) {
|
||||||
|
@ -55,7 +55,7 @@ namespace euf {
|
||||||
for (enode* q : enode_parents(this)) {
|
for (enode* q : enode_parents(this)) {
|
||||||
found |= p->congruent(q);
|
found |= p->congruent(q);
|
||||||
}
|
}
|
||||||
CTRACE("euf", !found, tout << "parent " << g.bpp(p) << " of " << g.bpp(c) << " is not congruent to a parent of " << g.bpp(this) << "\n";);
|
CTRACE(euf, !found, tout << "parent " << g.bpp(p) << " of " << g.bpp(c) << " is not congruent to a parent of " << g.bpp(this) << "\n";);
|
||||||
VERIFY(found);
|
VERIFY(found);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ namespace euf {
|
||||||
UNTAG(table*, t)->erase(n);
|
UNTAG(table*, t)->erase(n);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CTRACE("euf", contains_ptr(n), display(tout));
|
CTRACE(euf, contains_ptr(n), display(tout));
|
||||||
SASSERT(!contains_ptr(n));
|
SASSERT(!contains_ptr(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -951,7 +951,7 @@ namespace euf {
|
||||||
for (unsigned reg : m_todo) {
|
for (unsigned reg : m_todo) {
|
||||||
expr * p = m_registers[reg];
|
expr * p = m_registers[reg];
|
||||||
SASSERT(!is_quantifier(p));
|
SASSERT(!is_quantifier(p));
|
||||||
TRACE("mam", tout << "lin: " << reg << " " << get_check_mark(reg) << " " << is_var(p) << "\n";);
|
TRACE(mam, tout << "lin: " << reg << " " << get_check_mark(reg) << " " << is_var(p) << "\n";);
|
||||||
if (is_var(p)) {
|
if (is_var(p)) {
|
||||||
unsigned var_id = to_var(p)->get_idx();
|
unsigned var_id = to_var(p)->get_idx();
|
||||||
if (m_vars[var_id] != -1)
|
if (m_vars[var_id] != -1)
|
||||||
|
@ -1298,7 +1298,7 @@ namespace euf {
|
||||||
return nullptr; // it is unlikely we will find a compatible node
|
return nullptr; // it is unlikely we will find a compatible node
|
||||||
}
|
}
|
||||||
if (curr_compatibility > max_compatibility) {
|
if (curr_compatibility > max_compatibility) {
|
||||||
TRACE("mam", tout << "better child " << best_child << " -> " << curr_child << "\n";);
|
TRACE(mam, tout << "better child " << best_child << " -> " << curr_child << "\n";);
|
||||||
best_child = curr_child;
|
best_child = curr_child;
|
||||||
max_compatibility = curr_compatibility;
|
max_compatibility = curr_compatibility;
|
||||||
}
|
}
|
||||||
|
@ -1507,16 +1507,16 @@ namespace euf {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
m_compatible.reset();
|
m_compatible.reset();
|
||||||
m_incompatible.reset();
|
m_incompatible.reset();
|
||||||
TRACE("mam_compiler_detail", tout << "processing head: " << *head << "\n";);
|
TRACE(mam_compiler_detail, tout << "processing head: " << *head << "\n";);
|
||||||
instruction * curr = head->m_next;
|
instruction * curr = head->m_next;
|
||||||
instruction * last = head;
|
instruction * last = head;
|
||||||
while (curr != nullptr && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) {
|
while (curr != nullptr && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) {
|
||||||
TRACE("mam_compiler_detail", tout << "processing instr: " << *curr << "\n";);
|
TRACE(mam_compiler_detail, tout << "processing instr: " << *curr << "\n";);
|
||||||
switch (curr->m_opcode) {
|
switch (curr->m_opcode) {
|
||||||
case BIND1: case BIND2: case BIND3: case BIND4: case BIND5: case BIND6: case BINDN: {
|
case BIND1: case BIND2: case BIND3: case BIND4: case BIND5: case BIND6: case BINDN: {
|
||||||
bind* bnd = static_cast<bind*>(curr);
|
bind* bnd = static_cast<bind*>(curr);
|
||||||
if (is_compatible(bnd)) {
|
if (is_compatible(bnd)) {
|
||||||
TRACE("mam_compiler_detail", tout << "compatible\n";);
|
TRACE(mam_compiler_detail, tout << "compatible\n";);
|
||||||
unsigned ireg = bnd->m_ireg;
|
unsigned ireg = bnd->m_ireg;
|
||||||
SASSERT(m_todo.contains(ireg));
|
SASSERT(m_todo.contains(ireg));
|
||||||
m_todo.erase(ireg);
|
m_todo.erase(ireg);
|
||||||
|
@ -1531,7 +1531,7 @@ namespace euf {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("mam_compiler_detail", tout << "incompatible\n";);
|
TRACE(mam_compiler_detail, tout << "incompatible\n";);
|
||||||
m_incompatible.push_back(curr);
|
m_incompatible.push_back(curr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1539,7 +1539,7 @@ namespace euf {
|
||||||
case CHECK: {
|
case CHECK: {
|
||||||
check* chk = static_cast<check*>(curr);
|
check* chk = static_cast<check*>(curr);
|
||||||
if (is_compatible(chk)) {
|
if (is_compatible(chk)) {
|
||||||
TRACE("mam_compiler_detail", tout << "compatible\n";);
|
TRACE(mam_compiler_detail, tout << "compatible\n";);
|
||||||
unsigned reg = chk->m_reg;
|
unsigned reg = chk->m_reg;
|
||||||
SASSERT(m_todo.contains(reg));
|
SASSERT(m_todo.contains(reg));
|
||||||
m_todo.erase(reg);
|
m_todo.erase(reg);
|
||||||
|
@ -1547,7 +1547,7 @@ namespace euf {
|
||||||
m_compatible.push_back(curr);
|
m_compatible.push_back(curr);
|
||||||
}
|
}
|
||||||
else if (m_use_filters && is_semi_compatible(chk)) {
|
else if (m_use_filters && is_semi_compatible(chk)) {
|
||||||
TRACE("mam_compiler_detail", tout << "semi compatible\n";);
|
TRACE(mam_compiler_detail, tout << "semi compatible\n";);
|
||||||
unsigned reg = chk->m_reg;
|
unsigned reg = chk->m_reg;
|
||||||
enode * n1 = chk->m_enode;
|
enode * n1 = chk->m_enode;
|
||||||
// n1->has_lbl_hash may be false, even
|
// n1->has_lbl_hash may be false, even
|
||||||
|
@ -1575,14 +1575,14 @@ namespace euf {
|
||||||
m_incompatible.push_back(curr);
|
m_incompatible.push_back(curr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("mam_compiler_detail", tout << "incompatible " << chk->m_reg << "\n";);
|
TRACE(mam_compiler_detail, tout << "incompatible " << chk->m_reg << "\n";);
|
||||||
m_incompatible.push_back(curr);
|
m_incompatible.push_back(curr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case COMPARE:
|
case COMPARE:
|
||||||
if (is_compatible(static_cast<compare*>(curr))) {
|
if (is_compatible(static_cast<compare*>(curr))) {
|
||||||
TRACE("mam_compiler_detail", tout << "compatible\n";);
|
TRACE(mam_compiler_detail, tout << "compatible\n";);
|
||||||
unsigned reg1 = static_cast<compare*>(curr)->m_reg1;
|
unsigned reg1 = static_cast<compare*>(curr)->m_reg1;
|
||||||
unsigned reg2 = static_cast<compare*>(curr)->m_reg2;
|
unsigned reg2 = static_cast<compare*>(curr)->m_reg2;
|
||||||
SASSERT(m_todo.contains(reg2));
|
SASSERT(m_todo.contains(reg2));
|
||||||
|
@ -1598,7 +1598,7 @@ namespace euf {
|
||||||
m_compatible.push_back(curr);
|
m_compatible.push_back(curr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("mam_compiler_detail", tout << "incompatible\n";);
|
TRACE(mam_compiler_detail, tout << "incompatible\n";);
|
||||||
m_incompatible.push_back(curr);
|
m_incompatible.push_back(curr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1619,8 +1619,8 @@ namespace euf {
|
||||||
SASSERT(m_use_filters);
|
SASSERT(m_use_filters);
|
||||||
if (is_compatible(flt)) {
|
if (is_compatible(flt)) {
|
||||||
unsigned reg = flt->m_reg;
|
unsigned reg = flt->m_reg;
|
||||||
TRACE("mam_compiler_detail", tout << "compatible " << reg << "\n";);
|
TRACE(mam_compiler_detail, tout << "compatible " << reg << "\n";);
|
||||||
CTRACE("mam_compiler_bug", !m_todo.contains(reg), {
|
CTRACE(mam_compiler_bug, !m_todo.contains(reg), {
|
||||||
for (unsigned t : m_todo) { tout << t << " "; }
|
for (unsigned t : m_todo) { tout << t << " "; }
|
||||||
tout << "\nregisters:\n";
|
tout << "\nregisters:\n";
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
|
@ -1637,8 +1637,8 @@ namespace euf {
|
||||||
}
|
}
|
||||||
else if (is_semi_compatible(flt)) {
|
else if (is_semi_compatible(flt)) {
|
||||||
unsigned reg = flt->m_reg;
|
unsigned reg = flt->m_reg;
|
||||||
TRACE("mam_compiler_detail", tout << "semi compatible " << reg << "\n";);
|
TRACE(mam_compiler_detail, tout << "semi compatible " << reg << "\n";);
|
||||||
CTRACE("mam_compiler_bug", !m_todo.contains(reg), {
|
CTRACE(mam_compiler_bug, !m_todo.contains(reg), {
|
||||||
for (unsigned t : m_todo) { tout << t << " "; }
|
for (unsigned t : m_todo) { tout << t << " "; }
|
||||||
tout << "\nregisters:\n";
|
tout << "\nregisters:\n";
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
|
@ -1648,7 +1648,7 @@ namespace euf {
|
||||||
});
|
});
|
||||||
SASSERT(m_todo.contains(reg));
|
SASSERT(m_todo.contains(reg));
|
||||||
unsigned h = get_pat_lbl_hash(reg);
|
unsigned h = get_pat_lbl_hash(reg);
|
||||||
TRACE("mam_lbl_bug",
|
TRACE(mam_lbl_bug,
|
||||||
tout << "curr_set: " << flt->m_lbl_set << "\n";
|
tout << "curr_set: " << flt->m_lbl_set << "\n";
|
||||||
tout << "new hash: " << h << "\n";);
|
tout << "new hash: " << h << "\n";);
|
||||||
set_check_mark(reg, CHECK_SET);
|
set_check_mark(reg, CHECK_SET);
|
||||||
|
@ -1667,13 +1667,13 @@ namespace euf {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("mam_compiler_detail", tout << "incompatible\n";);
|
TRACE(mam_compiler_detail, tout << "incompatible\n";);
|
||||||
m_incompatible.push_back(curr);
|
m_incompatible.push_back(curr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
TRACE("mam_compiler_detail", tout << "incompatible\n";);
|
TRACE(mam_compiler_detail, tout << "incompatible\n";);
|
||||||
m_incompatible.push_back(curr);
|
m_incompatible.push_back(curr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1681,7 +1681,7 @@ namespace euf {
|
||||||
curr = curr->m_next;
|
curr = curr->m_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("mam_compiler", tout << *head << " " << head << "\n";
|
TRACE(mam_compiler, tout << *head << " " << head << "\n";
|
||||||
tout << "m_compatible.size(): " << m_compatible.size() << "\n";
|
tout << "m_compatible.size(): " << m_compatible.size() << "\n";
|
||||||
tout << "m_incompatible.size(): " << m_incompatible.size() << "\n";);
|
tout << "m_incompatible.size(): " << m_incompatible.size() << "\n";);
|
||||||
|
|
||||||
|
@ -1691,7 +1691,7 @@ namespace euf {
|
||||||
SASSERT(curr->m_opcode == CHOOSE);
|
SASSERT(curr->m_opcode == CHOOSE);
|
||||||
choose * first_child = static_cast<choose *>(curr);
|
choose * first_child = static_cast<choose *>(curr);
|
||||||
choose * best_child = find_best_child(first_child);
|
choose * best_child = find_best_child(first_child);
|
||||||
TRACE("mam", tout << "best child " << best_child << "\n";);
|
TRACE(mam, tout << "best child " << best_child << "\n";);
|
||||||
if (best_child == nullptr) {
|
if (best_child == nullptr) {
|
||||||
// There is no compatible child
|
// There is no compatible child
|
||||||
// Suppose the sequence is:
|
// Suppose the sequence is:
|
||||||
|
@ -1776,7 +1776,7 @@ namespace euf {
|
||||||
init(r, qa, mp, first_idx);
|
init(r, qa, mp, first_idx);
|
||||||
linearise(r->m_root, first_idx);
|
linearise(r->m_root, first_idx);
|
||||||
r->m_num_choices = m_num_choices;
|
r->m_num_choices = m_num_choices;
|
||||||
TRACE("mam_compiler", tout << "new tree for:\n" << mk_pp(mp, m) << "\n" << *r;);
|
TRACE(mam_compiler, tout << "new tree for:\n" << mk_pp(mp, m) << "\n" << *r;);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1794,21 +1794,21 @@ namespace euf {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_is_tmp_tree = is_tmp_tree;
|
m_is_tmp_tree = is_tmp_tree;
|
||||||
TRACE("mam_compiler", tout << "updating tree with:\n" << mk_pp(mp, m) << "\n";);
|
TRACE(mam_compiler, tout << "updating tree with:\n" << mk_pp(mp, m) << "\n";);
|
||||||
TRACE("mam_bug", tout << "before insertion\n" << *tree << "\n";);
|
TRACE(mam_bug, tout << "before insertion\n" << *tree << "\n";);
|
||||||
if (!is_tmp_tree)
|
if (!is_tmp_tree)
|
||||||
m_ct_manager.save_num_regs(tree);
|
m_ct_manager.save_num_regs(tree);
|
||||||
init(tree, qa, mp, first_idx);
|
init(tree, qa, mp, first_idx);
|
||||||
m_num_choices = tree->m_num_choices;
|
m_num_choices = tree->m_num_choices;
|
||||||
insert(tree->m_root, first_idx);
|
insert(tree->m_root, first_idx);
|
||||||
TRACE("mam_bug",
|
TRACE(mam_bug,
|
||||||
tout << "m_num_choices: " << m_num_choices << "\n";);
|
tout << "m_num_choices: " << m_num_choices << "\n";);
|
||||||
if (m_num_choices > tree->m_num_choices) {
|
if (m_num_choices > tree->m_num_choices) {
|
||||||
if (!is_tmp_tree)
|
if (!is_tmp_tree)
|
||||||
m_ct_manager.save_num_choices(tree);
|
m_ct_manager.save_num_choices(tree);
|
||||||
tree->m_num_choices = m_num_choices;
|
tree->m_num_choices = m_num_choices;
|
||||||
}
|
}
|
||||||
TRACE("mam_bug",
|
TRACE(mam_bug,
|
||||||
tout << "m_num_choices: " << m_num_choices << "\n";
|
tout << "m_num_choices: " << m_num_choices << "\n";
|
||||||
tout << "new tree:\n" << *tree;
|
tout << "new tree:\n" << *tree;
|
||||||
tout << "todo ";
|
tout << "todo ";
|
||||||
|
@ -1999,7 +1999,7 @@ namespace euf {
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(code_tree * t) {
|
void init(code_tree * t) {
|
||||||
TRACE("mam_bug", tout << "preparing to match tree:\n" << *t << "\n";);
|
TRACE(mam_bug, tout << "preparing to match tree:\n" << *t << "\n";);
|
||||||
m_registers.reserve(t->get_num_regs(), nullptr);
|
m_registers.reserve(t->get_num_regs(), nullptr);
|
||||||
m_bindings.reserve(t->get_num_regs(), nullptr);
|
m_bindings.reserve(t->get_num_regs(), nullptr);
|
||||||
if (m_backtrack_stack.size() < t->get_num_choices())
|
if (m_backtrack_stack.size() < t->get_num_choices())
|
||||||
|
@ -2010,14 +2010,14 @@ namespace euf {
|
||||||
void execute(code_tree * t) {
|
void execute(code_tree * t) {
|
||||||
if (!t->has_candidates())
|
if (!t->has_candidates())
|
||||||
return;
|
return;
|
||||||
TRACE("trigger_bug", tout << "execute for code tree:\n"; t->display(tout););
|
TRACE(trigger_bug, tout << "execute for code tree:\n"; t->display(tout););
|
||||||
init(t);
|
init(t);
|
||||||
t->save_qhead(ctx);
|
t->save_qhead(ctx);
|
||||||
enode* app;
|
enode* app;
|
||||||
if (t->filter_candidates()) {
|
if (t->filter_candidates()) {
|
||||||
code_tree::scoped_unmark _unmark(t);
|
code_tree::scoped_unmark _unmark(t);
|
||||||
while ((app = t->next_candidate()) && !ctx.resource_limits_exceeded()) {
|
while ((app = t->next_candidate()) && !ctx.resource_limits_exceeded()) {
|
||||||
TRACE("trigger_bug", tout << "candidate\n" << ctx.get_egraph().bpp(app) << "\n";);
|
TRACE(trigger_bug, tout << "candidate\n" << ctx.get_egraph().bpp(app) << "\n";);
|
||||||
if (!app->is_marked3() && app->is_cgr()) {
|
if (!app->is_marked3() && app->is_cgr()) {
|
||||||
execute_core(t, app);
|
execute_core(t, app);
|
||||||
app->mark3();
|
app->mark3();
|
||||||
|
@ -2026,7 +2026,7 @@ namespace euf {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
while ((app = t->next_candidate()) && !ctx.resource_limits_exceeded()) {
|
while ((app = t->next_candidate()) && !ctx.resource_limits_exceeded()) {
|
||||||
TRACE("trigger_bug", tout << "candidate\n" << ctx.get_egraph().bpp(app) << "\n";);
|
TRACE(trigger_bug, tout << "candidate\n" << ctx.get_egraph().bpp(app) << "\n";);
|
||||||
if (app->is_cgr())
|
if (app->is_cgr())
|
||||||
execute_core(t, app);
|
execute_core(t, app);
|
||||||
}
|
}
|
||||||
|
@ -2175,7 +2175,7 @@ namespace euf {
|
||||||
bp.m_instr = c;
|
bp.m_instr = c;
|
||||||
bp.m_old_max_generation = m_max_generation;
|
bp.m_old_max_generation = m_max_generation;
|
||||||
if (best_v == nullptr) {
|
if (best_v == nullptr) {
|
||||||
TRACE("mam_bug", tout << "m_top: " << m_top << ", m_backtrack_stack.size(): " << m_backtrack_stack.size() << "\n";
|
TRACE(mam_bug, tout << "m_top: " << m_top << ", m_backtrack_stack.size(): " << m_backtrack_stack.size() << "\n";
|
||||||
tout << *c << "\n";);
|
tout << *c << "\n";);
|
||||||
bp.m_to_recycle = nullptr;
|
bp.m_to_recycle = nullptr;
|
||||||
bp.m_it = ctx.get_egraph().enodes_of(lbl).begin();
|
bp.m_it = ctx.get_egraph().enodes_of(lbl).begin();
|
||||||
|
@ -2255,7 +2255,7 @@ namespace euf {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool interpreter::execute_core(code_tree * t, enode * n) {
|
bool interpreter::execute_core(code_tree * t, enode * n) {
|
||||||
TRACE("trigger_bug", tout << "interpreter::execute_core\n"; t->display(tout); tout << "\nenode\n" << mk_ismt2_pp(n->get_expr(), m) << "\n";);
|
TRACE(trigger_bug, tout << "interpreter::execute_core\n"; t->display(tout); tout << "\nenode\n" << mk_ismt2_pp(n->get_expr(), m) << "\n";);
|
||||||
unsigned since_last_check = 0;
|
unsigned since_last_check = 0;
|
||||||
|
|
||||||
#ifdef _PROFILE_MAM
|
#ifdef _PROFILE_MAM
|
||||||
|
@ -2269,7 +2269,7 @@ namespace euf {
|
||||||
t->inc_counter();
|
t->inc_counter();
|
||||||
#endif
|
#endif
|
||||||
// It doesn't make sense to process an irrelevant enode.
|
// It doesn't make sense to process an irrelevant enode.
|
||||||
TRACE("mam_execute_core", tout << "EXEC " << t->get_root_lbl()->get_name() << "\n";);
|
TRACE(mam_execute_core, tout << "EXEC " << t->get_root_lbl()->get_name() << "\n";);
|
||||||
if (!ctx.is_relevant(n))
|
if (!ctx.is_relevant(n))
|
||||||
return false;
|
return false;
|
||||||
SASSERT(ctx.is_relevant(n));
|
SASSERT(ctx.is_relevant(n));
|
||||||
|
@ -2286,7 +2286,7 @@ namespace euf {
|
||||||
|
|
||||||
main_loop:
|
main_loop:
|
||||||
|
|
||||||
TRACE("mam_int", display_pc_info(tout););
|
TRACE(mam_int, display_pc_info(tout););
|
||||||
#ifdef _PROFILE_MAM
|
#ifdef _PROFILE_MAM
|
||||||
const_cast<instruction*>(m_pc)->m_counter++;
|
const_cast<instruction*>(m_pc)->m_counter++;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2425,7 +2425,7 @@ namespace euf {
|
||||||
m_app = get_first_f_app(static_cast<const bind *>(m_pc)->m_label, static_cast<const bind *>(m_pc)->m_num_args, m_n1); \
|
m_app = get_first_f_app(static_cast<const bind *>(m_pc)->m_label, static_cast<const bind *>(m_pc)->m_num_args, m_n1); \
|
||||||
if (!m_app) \
|
if (!m_app) \
|
||||||
goto backtrack; \
|
goto backtrack; \
|
||||||
TRACE("mam_int", tout << "bind candidate: " << mk_pp(m_app->get_expr(), m) << "\n";); \
|
TRACE(mam_int, tout << "bind candidate: " << mk_pp(m_app->get_expr(), m) << "\n";); \
|
||||||
m_backtrack_stack[m_top].m_instr = m_pc; \
|
m_backtrack_stack[m_top].m_instr = m_pc; \
|
||||||
m_backtrack_stack[m_top].m_old_max_generation = m_curr_max_generation; \
|
m_backtrack_stack[m_top].m_old_max_generation = m_curr_max_generation; \
|
||||||
m_backtrack_stack[m_top].m_curr = m_app; \
|
m_backtrack_stack[m_top].m_curr = m_app; \
|
||||||
|
@ -2624,7 +2624,7 @@ namespace euf {
|
||||||
if (m_app == nullptr)
|
if (m_app == nullptr)
|
||||||
goto backtrack;
|
goto backtrack;
|
||||||
m_pattern_instances.push_back(m_app);
|
m_pattern_instances.push_back(m_app);
|
||||||
TRACE("mam_int", tout << "continue candidate:\n" << mk_ll_pp(m_app->get_expr(), m););
|
TRACE(mam_int, tout << "continue candidate:\n" << mk_ll_pp(m_app->get_expr(), m););
|
||||||
for (unsigned i = 0; i < m_num_args; i++)
|
for (unsigned i = 0; i < m_num_args; i++)
|
||||||
m_registers[m_oreg+i] = m_app->get_arg(i);
|
m_registers[m_oreg+i] = m_app->get_arg(i);
|
||||||
m_pc = m_pc->m_next;
|
m_pc = m_pc->m_next;
|
||||||
|
@ -2643,9 +2643,9 @@ namespace euf {
|
||||||
goto main_loop;
|
goto main_loop;
|
||||||
|
|
||||||
backtrack:
|
backtrack:
|
||||||
TRACE("mam_int", tout << "backtracking.\n";);
|
TRACE(mam_int, tout << "backtracking.\n";);
|
||||||
if (m_top == 0) {
|
if (m_top == 0) {
|
||||||
TRACE("mam_int", tout << "no more alternatives.\n";);
|
TRACE(mam_int, tout << "no more alternatives.\n";);
|
||||||
#ifdef _PROFILE_MAM
|
#ifdef _PROFILE_MAM
|
||||||
t->get_watch().stop();
|
t->get_watch().stop();
|
||||||
#endif
|
#endif
|
||||||
|
@ -2655,7 +2655,7 @@ namespace euf {
|
||||||
m_max_generation = bp.m_old_max_generation;
|
m_max_generation = bp.m_old_max_generation;
|
||||||
|
|
||||||
|
|
||||||
TRACE("mam_int", tout << "backtrack top: " << bp.m_instr << " " << *(bp.m_instr) << "\n";);
|
TRACE(mam_int, tout << "backtrack top: " << bp.m_instr << " " << *(bp.m_instr) << "\n";);
|
||||||
#ifdef _PROFILE_MAM
|
#ifdef _PROFILE_MAM
|
||||||
if (bp.m_instr->m_opcode != CHOOSE) // CHOOSE has a different status. It is a control flow backtracking.
|
if (bp.m_instr->m_opcode != CHOOSE) // CHOOSE has a different status. It is a control flow backtracking.
|
||||||
const_cast<instruction*>(bp.m_instr)->m_counter++;
|
const_cast<instruction*>(bp.m_instr)->m_counter++;
|
||||||
|
@ -2682,7 +2682,7 @@ namespace euf {
|
||||||
switch (bp.m_instr->m_opcode) {
|
switch (bp.m_instr->m_opcode) {
|
||||||
case CHOOSE:
|
case CHOOSE:
|
||||||
m_pc = static_cast<const choose*>(bp.m_instr)->m_alt;
|
m_pc = static_cast<const choose*>(bp.m_instr)->m_alt;
|
||||||
TRACE("mam_int", tout << "alt: " << m_pc << "\n";);
|
TRACE(mam_int, tout << "alt: " << m_pc << "\n";);
|
||||||
SASSERT(m_pc != 0);
|
SASSERT(m_pc != 0);
|
||||||
m_top--;
|
m_top--;
|
||||||
goto main_loop;
|
goto main_loop;
|
||||||
|
@ -2695,7 +2695,7 @@ namespace euf {
|
||||||
goto backtrack; \
|
goto backtrack; \
|
||||||
} \
|
} \
|
||||||
bp.m_curr = m_app; \
|
bp.m_curr = m_app; \
|
||||||
TRACE("mam_int", tout << "bind next candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); \
|
TRACE(mam_int, tout << "bind next candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); \
|
||||||
m_oreg = m_b->m_oreg
|
m_oreg = m_b->m_oreg
|
||||||
|
|
||||||
BBIND_COMMON();
|
BBIND_COMMON();
|
||||||
|
@ -2775,7 +2775,7 @@ namespace euf {
|
||||||
m_pattern_instances.push_back(m_app);
|
m_pattern_instances.push_back(m_app);
|
||||||
// continue succeeded
|
// continue succeeded
|
||||||
update_max_generation(m_app, nullptr); // null indicates a top-level match
|
update_max_generation(m_app, nullptr); // null indicates a top-level match
|
||||||
TRACE("mam_int", tout << "continue next candidate:\n" << mk_ll_pp(m_app->get_expr(), m););
|
TRACE(mam_int, tout << "continue next candidate:\n" << mk_ll_pp(m_app->get_expr(), m););
|
||||||
m_num_args = c->m_num_args;
|
m_num_args = c->m_num_args;
|
||||||
m_oreg = c->m_oreg;
|
m_oreg = c->m_oreg;
|
||||||
for (unsigned i = 0; i < m_num_args; i++)
|
for (unsigned i = 0; i < m_num_args; i++)
|
||||||
|
@ -2884,7 +2884,7 @@ namespace euf {
|
||||||
m_trees[lbl_id]->get_patterns().push_back(std::make_pair(qa, mp));
|
m_trees[lbl_id]->get_patterns().push_back(std::make_pair(qa, mp));
|
||||||
ctx.get_trail().push(push_back_trail<std::pair<quantifier*, app*>, false>(m_trees[lbl_id]->get_patterns()));
|
ctx.get_trail().push(push_back_trail<std::pair<quantifier*, app*>, false>(m_trees[lbl_id]->get_patterns()));
|
||||||
});
|
});
|
||||||
TRACE("trigger_bug", tout << "after add_pattern, first_idx: " << first_idx << "\n"; m_trees[lbl_id]->display(tout););
|
TRACE(trigger_bug, tout << "after add_pattern, first_idx: " << first_idx << "\n"; m_trees[lbl_id]->display(tout););
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
@ -3093,7 +3093,7 @@ namespace euf {
|
||||||
void add_candidate(code_tree * t, enode * app) {
|
void add_candidate(code_tree * t, enode * app) {
|
||||||
if (!t)
|
if (!t)
|
||||||
return;
|
return;
|
||||||
TRACE("q", tout << "candidate " << ctx.get_egraph().bpp(app) << "\n";);
|
TRACE(q, tout << "candidate " << ctx.get_egraph().bpp(app) << "\n";);
|
||||||
if (!t->has_candidates()) {
|
if (!t->has_candidates()) {
|
||||||
ctx.get_trail().push(push_back_trail<code_tree*, false>(m_to_match));
|
ctx.get_trail().push(push_back_trail<code_tree*, false>(m_to_match));
|
||||||
m_to_match.push_back(t);
|
m_to_match.push_back(t);
|
||||||
|
@ -3126,8 +3126,8 @@ namespace euf {
|
||||||
void update_clbls(func_decl * lbl) {
|
void update_clbls(func_decl * lbl) {
|
||||||
unsigned lbl_id = lbl->get_small_id();
|
unsigned lbl_id = lbl->get_small_id();
|
||||||
m_is_clbl.reserve(lbl_id+1, false);
|
m_is_clbl.reserve(lbl_id+1, false);
|
||||||
TRACE("trigger_bug", tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";);
|
TRACE(trigger_bug, tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";);
|
||||||
TRACE("mam_bug", tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";);
|
TRACE(mam_bug, tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";);
|
||||||
if (m_is_clbl[lbl_id])
|
if (m_is_clbl[lbl_id])
|
||||||
return;
|
return;
|
||||||
ctx.get_trail().push(set_bitvector_trail(m_is_clbl, lbl_id));
|
ctx.get_trail().push(set_bitvector_trail(m_is_clbl, lbl_id));
|
||||||
|
@ -3136,7 +3136,7 @@ namespace euf {
|
||||||
for (enode* app : m_egraph.enodes_of(lbl)) {
|
for (enode* app : m_egraph.enodes_of(lbl)) {
|
||||||
if (ctx.is_relevant(app)) {
|
if (ctx.is_relevant(app)) {
|
||||||
update_lbls(app, h);
|
update_lbls(app, h);
|
||||||
TRACE("mam_bug", tout << "updating labels of: #" << app->get_expr_id() << "\n";
|
TRACE(mam_bug, tout << "updating labels of: #" << app->get_expr_id() << "\n";
|
||||||
tout << "new_elem: " << h << "\n";
|
tout << "new_elem: " << h << "\n";
|
||||||
tout << "lbls: " << app->get_lbls() << "\n";
|
tout << "lbls: " << app->get_lbls() << "\n";
|
||||||
tout << "r.lbls: " << app->get_root()->get_lbls() << "\n";);
|
tout << "r.lbls: " << app->get_root()->get_lbls() << "\n";);
|
||||||
|
@ -3152,10 +3152,10 @@ namespace euf {
|
||||||
if (!r_plbls.may_contain(elem)) {
|
if (!r_plbls.may_contain(elem)) {
|
||||||
ctx.get_trail().push(mam_value_trail<approx_set>(r_plbls));
|
ctx.get_trail().push(mam_value_trail<approx_set>(r_plbls));
|
||||||
r_plbls.insert(elem);
|
r_plbls.insert(elem);
|
||||||
TRACE("trigger_bug", tout << "updating plabels of:\n" << mk_ismt2_pp(c->get_root()->get_expr(), m) << "\n";
|
TRACE(trigger_bug, tout << "updating plabels of:\n" << mk_ismt2_pp(c->get_root()->get_expr(), m) << "\n";
|
||||||
tout << "new_elem: " << static_cast<unsigned>(elem) << "\n";
|
tout << "new_elem: " << static_cast<unsigned>(elem) << "\n";
|
||||||
tout << "plbls: " << c->get_root()->get_plbls() << "\n";);
|
tout << "plbls: " << c->get_root()->get_plbls() << "\n";);
|
||||||
TRACE("mam_bug", tout << "updating plabels of: #" << c->get_root()->get_expr_id() << "\n";
|
TRACE(mam_bug, tout << "updating plabels of: #" << c->get_root()->get_expr_id() << "\n";
|
||||||
tout << "new_elem: " << static_cast<unsigned>(elem) << "\n";
|
tout << "new_elem: " << static_cast<unsigned>(elem) << "\n";
|
||||||
tout << "plbls: " << c->get_root()->get_plbls() << "\n";);
|
tout << "plbls: " << c->get_root()->get_plbls() << "\n";);
|
||||||
|
|
||||||
|
@ -3166,9 +3166,9 @@ namespace euf {
|
||||||
void update_plbls(func_decl * lbl) {
|
void update_plbls(func_decl * lbl) {
|
||||||
unsigned lbl_id = lbl->get_small_id();
|
unsigned lbl_id = lbl->get_small_id();
|
||||||
m_is_plbl.reserve(lbl_id+1, false);
|
m_is_plbl.reserve(lbl_id+1, false);
|
||||||
TRACE("trigger_bug", tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << ", lbl_id: " << lbl_id << "\n";
|
TRACE(trigger_bug, tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << ", lbl_id: " << lbl_id << "\n";
|
||||||
tout << "mam: " << this << "\n";);
|
tout << "mam: " << this << "\n";);
|
||||||
TRACE("mam_bug", tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << "\n";);
|
TRACE(mam_bug, tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << "\n";);
|
||||||
if (m_is_plbl[lbl_id])
|
if (m_is_plbl[lbl_id])
|
||||||
return;
|
return;
|
||||||
ctx.get_trail().push(set_bitvector_trail(m_is_plbl, lbl_id));
|
ctx.get_trail().push(set_bitvector_trail(m_is_plbl, lbl_id));
|
||||||
|
@ -3282,7 +3282,7 @@ namespace euf {
|
||||||
ctx.get_trail().push(set_ptr_trail<path_tree>(m_pc[h1][h2]));
|
ctx.get_trail().push(set_ptr_trail<path_tree>(m_pc[h1][h2]));
|
||||||
m_pc[h1][h2] = mk_path_tree(p, qa, mp);
|
m_pc[h1][h2] = mk_path_tree(p, qa, mp);
|
||||||
}
|
}
|
||||||
TRACE("mam_path_tree_updt",
|
TRACE(mam_path_tree_updt,
|
||||||
tout << "updated path tree:\n";
|
tout << "updated path tree:\n";
|
||||||
m_pc[h1][h2]->display(tout, 2););
|
m_pc[h1][h2]->display(tout, 2););
|
||||||
}
|
}
|
||||||
|
@ -3320,7 +3320,7 @@ namespace euf {
|
||||||
m_pp[h1][h2].second = mk_path_tree(p2, qa, mp);
|
m_pp[h1][h2].second = mk_path_tree(p2, qa, mp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("mam_path_tree_updt",
|
TRACE(mam_path_tree_updt,
|
||||||
tout << "updated path tree:\n";
|
tout << "updated path tree:\n";
|
||||||
SASSERT(h1 <= h2);
|
SASSERT(h1 <= h2);
|
||||||
m_pp[h1][h2].first->display(tout, 2);
|
m_pp[h1][h2].first->display(tout, 2);
|
||||||
|
@ -3386,7 +3386,7 @@ namespace euf {
|
||||||
update_plbls(plbl);
|
update_plbls(plbl);
|
||||||
if (!n->has_lbl_hash())
|
if (!n->has_lbl_hash())
|
||||||
m_egraph.set_lbl_hash(n);
|
m_egraph.set_lbl_hash(n);
|
||||||
TRACE("mam_bug",
|
TRACE(mam_bug,
|
||||||
tout << "updating pc labels " << plbl->get_name() << " " <<
|
tout << "updating pc labels " << plbl->get_name() << " " <<
|
||||||
static_cast<unsigned>(n->get_lbl_hash()) << "\n";
|
static_cast<unsigned>(n->get_lbl_hash()) << "\n";
|
||||||
tout << "#" << n->get_expr_id() << " " << n->get_root()->get_lbls() << "\n";
|
tout << "#" << n->get_expr_id() << " " << n->get_root()->get_lbls() << "\n";
|
||||||
|
@ -3396,7 +3396,7 @@ namespace euf {
|
||||||
}
|
}
|
||||||
|
|
||||||
func_decl * clbl = to_app(child)->get_decl();
|
func_decl * clbl = to_app(child)->get_decl();
|
||||||
TRACE("mam_bug", tout << "updating pc labels " << plbl->get_name() << " " << clbl->get_name() << "\n";);
|
TRACE(mam_bug, tout << "updating pc labels " << plbl->get_name() << " " << clbl->get_name() << "\n";);
|
||||||
update_plbls(plbl);
|
update_plbls(plbl);
|
||||||
update_clbls(clbl);
|
update_clbls(clbl);
|
||||||
update_pc(m_lbl_hasher(plbl), m_lbl_hasher(clbl), new_path, qa, mp);
|
update_pc(m_lbl_hasher(plbl), m_lbl_hasher(clbl), new_path, qa, mp);
|
||||||
|
@ -3408,7 +3408,7 @@ namespace euf {
|
||||||
\brief Update inverted path index.
|
\brief Update inverted path index.
|
||||||
*/
|
*/
|
||||||
void update_filters(quantifier * qa, app * mp) {
|
void update_filters(quantifier * qa, app * mp) {
|
||||||
TRACE("mam_bug", tout << "updating filters using:\n" << mk_pp(mp, m) << "\n";);
|
TRACE(mam_bug, tout << "updating filters using:\n" << mk_pp(mp, m) << "\n";);
|
||||||
unsigned num_vars = qa->get_num_decls();
|
unsigned num_vars = qa->get_num_decls();
|
||||||
if (num_vars >= m_var_paths.size())
|
if (num_vars >= m_var_paths.size())
|
||||||
m_var_paths.resize(num_vars+1);
|
m_var_paths.resize(num_vars+1);
|
||||||
|
@ -3460,7 +3460,7 @@ namespace euf {
|
||||||
\brief Collect new E-matching candidates using the inverted path index t.
|
\brief Collect new E-matching candidates using the inverted path index t.
|
||||||
*/
|
*/
|
||||||
void collect_parents(enode * r, path_tree * t) {
|
void collect_parents(enode * r, path_tree * t) {
|
||||||
TRACE("mam", tout << ctx.get_egraph().bpp(r) << " " << t << "\n";);
|
TRACE(mam, tout << ctx.get_egraph().bpp(r) << " " << t << "\n";);
|
||||||
if (t == nullptr)
|
if (t == nullptr)
|
||||||
return;
|
return;
|
||||||
#ifdef _PROFILE_PATH_TREE
|
#ifdef _PROFILE_PATH_TREE
|
||||||
|
@ -3481,7 +3481,7 @@ namespace euf {
|
||||||
#ifdef _PROFILE_PATH_TREE
|
#ifdef _PROFILE_PATH_TREE
|
||||||
t->m_counter++;
|
t->m_counter++;
|
||||||
#endif
|
#endif
|
||||||
TRACE("mam_path_tree",
|
TRACE(mam_path_tree,
|
||||||
tout << "processing:\n";
|
tout << "processing:\n";
|
||||||
t->display(tout, 2););
|
t->display(tout, 2););
|
||||||
enode_vector * v = t->m_todo;
|
enode_vector * v = t->m_todo;
|
||||||
|
@ -3526,7 +3526,7 @@ namespace euf {
|
||||||
std::cout << "Avg2. " << static_cast<double>(total_sz2)/static_cast<double>(counter2) << ", Max2. " << max_sz2 << "\n";
|
std::cout << "Avg2. " << static_cast<double>(total_sz2)/static_cast<double>(counter2) << ", Max2. " << max_sz2 << "\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACE("mam_path_tree", tout << "processing: #" << curr_child->get_expr_id() << "\n";);
|
TRACE(mam_path_tree, tout << "processing: #" << curr_child->get_expr_id() << "\n";);
|
||||||
for (enode* curr_parent : euf::enode_parents(curr_child)) {
|
for (enode* curr_parent : euf::enode_parents(curr_child)) {
|
||||||
#ifdef _PROFILE_PATH_TREE
|
#ifdef _PROFILE_PATH_TREE
|
||||||
if (curr_parent->is_equality())
|
if (curr_parent->is_equality())
|
||||||
|
@ -3541,8 +3541,8 @@ namespace euf {
|
||||||
bool is_flat_assoc = lbl->is_flat_associative();
|
bool is_flat_assoc = lbl->is_flat_associative();
|
||||||
enode * curr_parent_root = curr_parent->get_root();
|
enode * curr_parent_root = curr_parent->get_root();
|
||||||
enode * curr_parent_cg = curr_parent->get_cg();
|
enode * curr_parent_cg = curr_parent->get_cg();
|
||||||
TRACE("mam_path_tree", tout << "processing parent:\n" << mk_pp(curr_parent->get_expr(), m) << "\n";);
|
TRACE(mam_path_tree, tout << "processing parent:\n" << mk_pp(curr_parent->get_expr(), m) << "\n";);
|
||||||
TRACE("mam_path_tree", tout << "parent is marked: " << curr_parent->is_marked1() << "\n";);
|
TRACE(mam_path_tree, tout << "parent is marked: " << curr_parent->is_marked1() << "\n";);
|
||||||
if (filter.may_contain(m_lbl_hasher(lbl)) &&
|
if (filter.may_contain(m_lbl_hasher(lbl)) &&
|
||||||
!curr_parent->is_marked1() &&
|
!curr_parent->is_marked1() &&
|
||||||
(curr_parent_cg == curr_parent || !is_eq(curr_parent_cg, curr_parent_root)) &&
|
(curr_parent_cg == curr_parent || !is_eq(curr_parent_cg, curr_parent_root)) &&
|
||||||
|
@ -3572,7 +3572,7 @@ namespace euf {
|
||||||
is_eq(curr_tree->m_ground_arg, curr_parent->get_arg(curr_tree->m_ground_arg_idx))
|
is_eq(curr_tree->m_ground_arg, curr_parent->get_arg(curr_tree->m_ground_arg_idx))
|
||||||
)) {
|
)) {
|
||||||
if (curr_tree->m_code) {
|
if (curr_tree->m_code) {
|
||||||
TRACE("mam_path_tree", tout << "found candidate " << expr_ref(curr_parent->get_expr(), m) << "\n";);
|
TRACE(mam_path_tree, tout << "found candidate " << expr_ref(curr_parent->get_expr(), m) << "\n";);
|
||||||
add_candidate(curr_tree->m_code, curr_parent);
|
add_candidate(curr_tree->m_code, curr_parent);
|
||||||
}
|
}
|
||||||
if (curr_tree->m_first_child) {
|
if (curr_tree->m_first_child) {
|
||||||
|
@ -3621,8 +3621,8 @@ namespace euf {
|
||||||
void process_pp(enode * r1, enode * r2) {
|
void process_pp(enode * r1, enode * r2) {
|
||||||
approx_set & plbls1 = r1->get_plbls();
|
approx_set & plbls1 = r1->get_plbls();
|
||||||
approx_set & plbls2 = r2->get_plbls();
|
approx_set & plbls2 = r2->get_plbls();
|
||||||
TRACE("incremental_matcher", tout << "pp: plbls1: " << plbls1 << ", plbls2: " << plbls2 << "\n";);
|
TRACE(incremental_matcher, tout << "pp: plbls1: " << plbls1 << ", plbls2: " << plbls2 << "\n";);
|
||||||
TRACE("mam_info", tout << "pp: " << plbls1.size() * plbls2.size() << "\n";);
|
TRACE(mam_info, tout << "pp: " << plbls1.size() * plbls2.size() << "\n";);
|
||||||
if (!plbls1.empty() && !plbls2.empty()) {
|
if (!plbls1.empty() && !plbls2.empty()) {
|
||||||
for (unsigned plbl1 : plbls1) {
|
for (unsigned plbl1 : plbls1) {
|
||||||
if (!m.inc()) {
|
if (!m.inc()) {
|
||||||
|
@ -3682,7 +3682,7 @@ namespace euf {
|
||||||
return;
|
return;
|
||||||
ctx.get_trail().push(value_trail<unsigned>(m_new_patterns_qhead));
|
ctx.get_trail().push(value_trail<unsigned>(m_new_patterns_qhead));
|
||||||
|
|
||||||
TRACE("mam_new_pat", tout << "matching new patterns:\n";);
|
TRACE(mam_new_pat, tout << "matching new patterns:\n";);
|
||||||
m_tmp_trees_to_delete.reset();
|
m_tmp_trees_to_delete.reset();
|
||||||
for (; m_new_patterns_qhead < m_new_patterns.size(); ++m_new_patterns_qhead) {
|
for (; m_new_patterns_qhead < m_new_patterns.size(); ++m_new_patterns_qhead) {
|
||||||
if (!m.inc())
|
if (!m.inc())
|
||||||
|
@ -3741,8 +3741,8 @@ namespace euf {
|
||||||
|
|
||||||
void add_pattern(quantifier * qa, app * mp) override {
|
void add_pattern(quantifier * qa, app * mp) override {
|
||||||
SASSERT(m.is_pattern(mp));
|
SASSERT(m.is_pattern(mp));
|
||||||
TRACE("trigger_bug", tout << "adding pattern\n" << mk_ismt2_pp(qa, m) << "\n" << mk_ismt2_pp(mp, m) << "\n";);
|
TRACE(trigger_bug, tout << "adding pattern\n" << mk_ismt2_pp(qa, m) << "\n" << mk_ismt2_pp(mp, m) << "\n";);
|
||||||
TRACE("mam_bug", tout << "adding pattern\n" << mk_pp(qa, m) << "\n" << mk_pp(mp, m) << "\n";);
|
TRACE(mam_bug, tout << "adding pattern\n" << mk_pp(qa, m) << "\n" << mk_pp(mp, m) << "\n";);
|
||||||
// Z3 checks if a pattern is ground or not before solving.
|
// Z3 checks if a pattern is ground or not before solving.
|
||||||
// Ground patterns are discarded.
|
// Ground patterns are discarded.
|
||||||
// However, the simplifier may turn a non-ground pattern into a ground one.
|
// However, the simplifier may turn a non-ground pattern into a ground one.
|
||||||
|
@ -3786,7 +3786,7 @@ namespace euf {
|
||||||
}
|
}
|
||||||
|
|
||||||
void propagate() override {
|
void propagate() override {
|
||||||
TRACE("trigger_bug", tout << "match\n"; display(tout););
|
TRACE(trigger_bug, tout << "match\n"; display(tout););
|
||||||
propagate_to_match();
|
propagate_to_match();
|
||||||
propagate_new_patterns();
|
propagate_new_patterns();
|
||||||
}
|
}
|
||||||
|
@ -3805,14 +3805,14 @@ namespace euf {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_missing_instances() override {
|
bool check_missing_instances() override {
|
||||||
TRACE("missing_instance", tout << "checking for missing instances...\n";);
|
TRACE(missing_instance, tout << "checking for missing instances...\n";);
|
||||||
flet<bool> l(m_check_missing_instances, true);
|
flet<bool> l(m_check_missing_instances, true);
|
||||||
rematch(false);
|
rematch(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_match(quantifier * qa, app * pat, unsigned num_bindings, enode * const * bindings, unsigned max_generation) override {
|
void on_match(quantifier * qa, app * pat, unsigned num_bindings, enode * const * bindings, unsigned max_generation) override {
|
||||||
TRACE("trigger_bug", tout << "found match " << mk_pp(qa, m) << "\n";);
|
TRACE(trigger_bug, tout << "found match " << mk_pp(qa, m) << "\n";);
|
||||||
unsigned min_gen = 0, max_gen = 0;
|
unsigned min_gen = 0, max_gen = 0;
|
||||||
m_interpreter.get_min_max_top_generation(min_gen, max_gen);
|
m_interpreter.get_min_max_top_generation(min_gen, max_gen);
|
||||||
m_ematch.on_binding(qa, pat, bindings, max_generation, min_gen, max_gen);
|
m_ematch.on_binding(qa, pat, bindings, max_generation, min_gen, max_gen);
|
||||||
|
@ -3822,23 +3822,23 @@ namespace euf {
|
||||||
// If lazy == true, then n is not added to the list of
|
// If lazy == true, then n is not added to the list of
|
||||||
// candidate enodes for matching. That is, the method just updates the lbls.
|
// candidate enodes for matching. That is, the method just updates the lbls.
|
||||||
void add_node(enode * n, bool lazy) override {
|
void add_node(enode * n, bool lazy) override {
|
||||||
TRACE("trigger_bug", tout << "relevant_eh:\n" << mk_ismt2_pp(n->get_expr(), m) << "\n";
|
TRACE(trigger_bug, tout << "relevant_eh:\n" << mk_ismt2_pp(n->get_expr(), m) << "\n";
|
||||||
tout << "mam: " << this << "\n";);
|
tout << "mam: " << this << "\n";);
|
||||||
TRACE("mam", tout << "relevant_eh: #" << n->get_expr_id() << "\n";);
|
TRACE(mam, tout << "relevant_eh: #" << n->get_expr_id() << "\n";);
|
||||||
if (n->has_lbl_hash())
|
if (n->has_lbl_hash())
|
||||||
update_lbls(n, n->get_lbl_hash());
|
update_lbls(n, n->get_lbl_hash());
|
||||||
|
|
||||||
if (n->num_args() > 0) {
|
if (n->num_args() > 0) {
|
||||||
func_decl * lbl = n->get_decl();
|
func_decl * lbl = n->get_decl();
|
||||||
unsigned h = m_lbl_hasher(lbl);
|
unsigned h = m_lbl_hasher(lbl);
|
||||||
TRACE("trigger_bug", tout << "lbl: " << lbl->get_name() << " is_clbl(lbl): " << is_clbl(lbl)
|
TRACE(trigger_bug, tout << "lbl: " << lbl->get_name() << " is_clbl(lbl): " << is_clbl(lbl)
|
||||||
<< ", is_plbl(lbl): " << is_plbl(lbl) << ", h: " << h << "\n";
|
<< ", is_plbl(lbl): " << is_plbl(lbl) << ", h: " << h << "\n";
|
||||||
tout << "lbl_id: " << lbl->get_small_id() << "\n";);
|
tout << "lbl_id: " << lbl->get_small_id() << "\n";);
|
||||||
if (is_clbl(lbl))
|
if (is_clbl(lbl))
|
||||||
update_lbls(n, h);
|
update_lbls(n, h);
|
||||||
if (is_plbl(lbl))
|
if (is_plbl(lbl))
|
||||||
update_children_plbls(n, h);
|
update_children_plbls(n, h);
|
||||||
TRACE("mam_bug", tout << "adding relevant candidate:\n" << mk_ll_pp(n->get_expr(), m) << "\n";);
|
TRACE(mam_bug, tout << "adding relevant candidate:\n" << mk_ll_pp(n->get_expr(), m) << "\n";);
|
||||||
if (!lazy)
|
if (!lazy)
|
||||||
add_candidate(n);
|
add_candidate(n);
|
||||||
}
|
}
|
||||||
|
@ -3852,9 +3852,9 @@ namespace euf {
|
||||||
flet<enode *> l1(m_other, other);
|
flet<enode *> l1(m_other, other);
|
||||||
flet<enode *> l2(m_root, root);
|
flet<enode *> l2(m_root, root);
|
||||||
|
|
||||||
TRACE("mam", tout << "on_merge: #" << other->get_expr_id() << " #" << root->get_expr_id() << "\n";);
|
TRACE(mam, tout << "on_merge: #" << other->get_expr_id() << " #" << root->get_expr_id() << "\n";);
|
||||||
TRACE("mam_inc_bug_detail", m_egraph.display(tout););
|
TRACE(mam_inc_bug_detail, m_egraph.display(tout););
|
||||||
TRACE("mam_inc_bug",
|
TRACE(mam_inc_bug,
|
||||||
tout << "before:\n#" << other->get_expr_id() << " #" << root->get_expr_id() << "\n";
|
tout << "before:\n#" << other->get_expr_id() << " #" << root->get_expr_id() << "\n";
|
||||||
tout << "other.lbls: " << other->get_lbls() << "\n";
|
tout << "other.lbls: " << other->get_lbls() << "\n";
|
||||||
tout << "root.lbls: " << root->get_lbls() << "\n";
|
tout << "root.lbls: " << root->get_lbls() << "\n";
|
||||||
|
@ -3874,7 +3874,7 @@ namespace euf {
|
||||||
ctx.get_trail().push(mam_value_trail<approx_set>(root_plbls));
|
ctx.get_trail().push(mam_value_trail<approx_set>(root_plbls));
|
||||||
root_lbls |= other_lbls;
|
root_lbls |= other_lbls;
|
||||||
root_plbls |= other_plbls;
|
root_plbls |= other_plbls;
|
||||||
TRACE("mam_inc_bug",
|
TRACE(mam_inc_bug,
|
||||||
tout << "after:\n";
|
tout << "after:\n";
|
||||||
tout << "other.lbls: " << other->get_lbls() << "\n";
|
tout << "other.lbls: " << other->get_lbls() << "\n";
|
||||||
tout << "root.lbls: " << root->get_lbls() << "\n";
|
tout << "root.lbls: " << root->get_lbls() << "\n";
|
||||||
|
|
|
@ -26,12 +26,12 @@ namespace euf {
|
||||||
}
|
}
|
||||||
|
|
||||||
void plugin::push_merge(enode* a, enode* b, justification j) {
|
void plugin::push_merge(enode* a, enode* b, justification j) {
|
||||||
TRACE("euf", tout << "push-merge " << g.bpp(a) << " == " << g.bpp(b) << " " << j << "\n");
|
TRACE(euf, tout << "push-merge " << g.bpp(a) << " == " << g.bpp(b) << " " << j << "\n");
|
||||||
g.push_merge(a, b, j);
|
g.push_merge(a, b, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
void plugin::push_merge(enode* a, enode* b) {
|
void plugin::push_merge(enode* a, enode* b) {
|
||||||
TRACE("plugin", tout << g.bpp(a) << " == " << g.bpp(b) << "\n");
|
TRACE(plugin, tout << g.bpp(a) << " == " << g.bpp(b) << "\n");
|
||||||
g.push_merge(a, b, justification::axiom(get_id()));
|
g.push_merge(a, b, justification::axiom(get_id()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -368,7 +368,7 @@ struct expr2polynomial::imp {
|
||||||
checkpoint();
|
checkpoint();
|
||||||
frame & fr = m_frame_stack.back();
|
frame & fr = m_frame_stack.back();
|
||||||
app * a = fr.m_curr;
|
app * a = fr.m_curr;
|
||||||
TRACE("expr2polynomial", tout << "processing: " << fr.m_idx << "\n" << mk_ismt2_pp(a, m()) << "\n";);
|
TRACE(expr2polynomial, tout << "processing: " << fr.m_idx << "\n" << mk_ismt2_pp(a, m()) << "\n";);
|
||||||
unsigned num_args = a->get_num_args();
|
unsigned num_args = a->get_num_args();
|
||||||
while (fr.m_idx < num_args) {
|
while (fr.m_idx < num_args) {
|
||||||
expr * arg = a->get_arg(fr.m_idx);
|
expr * arg = a->get_arg(fr.m_idx);
|
||||||
|
|
|
@ -26,7 +26,7 @@ Notes:
|
||||||
|
|
||||||
void expr2var::insert(expr * n, var v) {
|
void expr2var::insert(expr * n, var v) {
|
||||||
if (!is_uninterp_const(n)) {
|
if (!is_uninterp_const(n)) {
|
||||||
TRACE("expr2var", tout << "interpreted:\n" << mk_ismt2_pp(n, m()) << "\n";);
|
TRACE(expr2var, tout << "interpreted:\n" << mk_ismt2_pp(n, m()) << "\n";);
|
||||||
m_interpreted_vars = true;
|
m_interpreted_vars = true;
|
||||||
}
|
}
|
||||||
unsigned idx = m_id2map.get(n->get_id(), UINT_MAX);
|
unsigned idx = m_id2map.get(n->get_id(), UINT_MAX);
|
||||||
|
|
|
@ -111,7 +111,7 @@ void expr_abstractor::operator()(unsigned base, unsigned num_bound, expr* const*
|
||||||
void expr_abstract(ast_manager& m, unsigned base, unsigned num_bound, expr* const* bound, expr* n, expr_ref& result) {
|
void expr_abstract(ast_manager& m, unsigned base, unsigned num_bound, expr* const* bound, expr* n, expr_ref& result) {
|
||||||
expr_abstractor abs(m);
|
expr_abstractor abs(m);
|
||||||
abs(base, num_bound, bound, n, result);
|
abs(base, num_bound, bound, n, result);
|
||||||
TRACE("expr_abstract",
|
TRACE(expr_abstract,
|
||||||
tout << expr_ref(n, m) << "\n";
|
tout << expr_ref(n, m) << "\n";
|
||||||
tout << result << "\n";);
|
tout << result << "\n";);
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ static expr_ref mk_quantifier(quantifier_kind k, ast_manager& m, unsigned num_bo
|
||||||
}
|
}
|
||||||
result = m.mk_quantifier(k, num_bound, sorts.data(), names.data(), result);
|
result = m.mk_quantifier(k, num_bound, sorts.data(), names.data(), result);
|
||||||
}
|
}
|
||||||
TRACE("expr_abstract",
|
TRACE(expr_abstract,
|
||||||
tout << expr_ref(n, m) << "\n";
|
tout << expr_ref(n, m) << "\n";
|
||||||
for (unsigned i = 0; i < num_bound; ++i) tout << expr_ref(bound[i], m) << " ";
|
for (unsigned i = 0; i < num_bound; ++i) tout << expr_ref(bound[i], m) << " ";
|
||||||
tout << "\n";
|
tout << "\n";
|
||||||
|
|
|
@ -46,7 +46,7 @@ void for_each_ast(ForEachProc & proc, ast_mark & visited, ast * n, bool visit_pa
|
||||||
|
|
||||||
while (!stack.empty()) {
|
while (!stack.empty()) {
|
||||||
curr = stack.back();
|
curr = stack.back();
|
||||||
TRACE("for_each_ast", tout << "visiting node: " << curr->get_id() << ", kind: " << get_ast_kind_name(curr->get_kind())
|
TRACE(for_each_ast, tout << "visiting node: " << curr->get_id() << ", kind: " << get_ast_kind_name(curr->get_kind())
|
||||||
<< ", stack size: " << stack.size() << "\n";);
|
<< ", stack size: " << stack.size() << "\n";);
|
||||||
|
|
||||||
if (visited.is_marked(curr)) {
|
if (visited.is_marked(curr)) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ expr_ref bv2fpa_converter::convert_bv2fp(sort * s, expr * sgn, expr * exp, expr
|
||||||
|
|
||||||
res = m_fpa_util.mk_value(fp_val);
|
res = m_fpa_util.mk_value(fp_val);
|
||||||
|
|
||||||
TRACE("bv2fpa", tout << "[" << mk_ismt2_pp(sgn, m) <<
|
TRACE(bv2fpa, tout << "[" << mk_ismt2_pp(sgn, m) <<
|
||||||
" " << mk_ismt2_pp(exp, m) <<
|
" " << mk_ismt2_pp(exp, m) <<
|
||||||
" " << mk_ismt2_pp(sig, m) << "] == " <<
|
" " << mk_ismt2_pp(sig, m) << "] == " <<
|
||||||
mk_ismt2_pp(res, m) << std::endl;);
|
mk_ismt2_pp(res, m) << std::endl;);
|
||||||
|
@ -189,7 +189,7 @@ expr_ref bv2fpa_converter::convert_bv2rm(model_core * mc, expr * val) {
|
||||||
|
|
||||||
expr_ref bv2fpa_converter::rebuild_floats(model_core * mc, sort * s, expr * e) {
|
expr_ref bv2fpa_converter::rebuild_floats(model_core * mc, sort * s, expr * e) {
|
||||||
expr_ref result(m);
|
expr_ref result(m);
|
||||||
TRACE("bv2fpa_rebuild", tout << "rebuild floats in " << mk_ismt2_pp(s, m) << " for ";
|
TRACE(bv2fpa_rebuild, tout << "rebuild floats in " << mk_ismt2_pp(s, m) << " for ";
|
||||||
if (e) tout << mk_ismt2_pp(e, m);
|
if (e) tout << mk_ismt2_pp(e, m);
|
||||||
else tout << "nil";
|
else tout << "nil";
|
||||||
tout << std::endl; );
|
tout << std::endl; );
|
||||||
|
@ -240,7 +240,7 @@ bv2fpa_converter::array_model bv2fpa_converter::convert_array_func_interp(model_
|
||||||
expr_ref as_arr_mdl(m);
|
expr_ref as_arr_mdl(m);
|
||||||
as_arr_mdl = mc->get_const_interp(bv_f);
|
as_arr_mdl = mc->get_const_interp(bv_f);
|
||||||
if (as_arr_mdl == 0) return am;
|
if (as_arr_mdl == 0) return am;
|
||||||
TRACE("bv2fpa", tout << "arity=0 func_interp for " << mk_ismt2_pp(f, m) << " := " << mk_ismt2_pp(as_arr_mdl, m) << std::endl;);
|
TRACE(bv2fpa, tout << "arity=0 func_interp for " << mk_ismt2_pp(f, m) << " := " << mk_ismt2_pp(as_arr_mdl, m) << std::endl;);
|
||||||
SASSERT(arr_util.is_as_array(as_arr_mdl));
|
SASSERT(arr_util.is_as_array(as_arr_mdl));
|
||||||
for (unsigned i = 0; i < arity; i++)
|
for (unsigned i = 0; i < arity; i++)
|
||||||
array_domain.push_back(to_sort(f->get_range()->get_parameter(i).get_ast()));
|
array_domain.push_back(to_sort(f->get_range()->get_parameter(i).get_ast()));
|
||||||
|
@ -285,7 +285,7 @@ func_interp * bv2fpa_converter::convert_func_interp(model_core * mc, func_decl *
|
||||||
bv_fres = bv_fe->get_result();
|
bv_fres = bv_fe->get_result();
|
||||||
expr_ref ft_fres = rebuild_floats(mc, rng, to_app(bv_fres));
|
expr_ref ft_fres = rebuild_floats(mc, rng, to_app(bv_fres));
|
||||||
m_th_rw(ft_fres);
|
m_th_rw(ft_fres);
|
||||||
TRACE("bv2fpa",
|
TRACE(bv2fpa,
|
||||||
tout << "func_interp entry #" << i << ":" << std::endl;
|
tout << "func_interp entry #" << i << ":" << std::endl;
|
||||||
tout << "(" << bv_f->get_name();
|
tout << "(" << bv_f->get_name();
|
||||||
for (unsigned i = 0; i < bv_f->get_arity(); i++)
|
for (unsigned i = 0; i < bv_f->get_arity(); i++)
|
||||||
|
@ -338,7 +338,7 @@ func_interp * bv2fpa_converter::convert_func_interp(model_core * mc, func_decl *
|
||||||
else if (bv_fi->get_else()) {
|
else if (bv_fi->get_else()) {
|
||||||
expr_ref ft_els = rebuild_floats(mc, rng, bv_fi->get_else());
|
expr_ref ft_els = rebuild_floats(mc, rng, bv_fi->get_else());
|
||||||
m_th_rw(ft_els);
|
m_th_rw(ft_els);
|
||||||
TRACE("bv2fpa", tout << "else=" << mk_ismt2_pp(ft_els, m) << std::endl;);
|
TRACE(bv2fpa, tout << "else=" << mk_ismt2_pp(ft_els, m) << std::endl;);
|
||||||
result->set_else(ft_els);
|
result->set_else(ft_els);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,7 +410,7 @@ void bv2fpa_converter::convert_consts(model_core * mc, model_core * target_model
|
||||||
expr_ref cv = convert_bv2fp(var->get_range(), sgn, exp, sig);
|
expr_ref cv = convert_bv2fp(var->get_range(), sgn, exp, sig);
|
||||||
target_model->register_decl(var, cv);
|
target_model->register_decl(var, cv);
|
||||||
|
|
||||||
TRACE("bv2fpa", tout << var->get_name() << " == " << mk_ismt2_pp(cv, m) << std::endl;);
|
TRACE(bv2fpa, tout << var->get_name() << " == " << mk_ismt2_pp(cv, m) << std::endl;);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ void bv2fpa_converter::convert_rm_consts(model_core * mc, model_core * target_mo
|
||||||
SASSERT(m_fpa_util.is_bv2rm(val));
|
SASSERT(m_fpa_util.is_bv2rm(val));
|
||||||
expr * bvval = to_app(val)->get_arg(0);
|
expr * bvval = to_app(val)->get_arg(0);
|
||||||
expr_ref fv = convert_bv2rm(mc, to_app(bvval));
|
expr_ref fv = convert_bv2rm(mc, to_app(bvval));
|
||||||
TRACE("bv2fpa", tout << var->get_name() << " == " << mk_ismt2_pp(fv, m) << std::endl;);
|
TRACE(bv2fpa, tout << var->get_name() << " == " << mk_ismt2_pp(fv, m) << std::endl;);
|
||||||
target_model->register_decl(var, fv);
|
target_model->register_decl(var, fv);
|
||||||
seen.insert(to_app(bvval)->get_decl());
|
seen.insert(to_app(bvval)->get_decl());
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ void bv2fpa_converter::convert_min_max_specials(model_core * mc, model_core * ta
|
||||||
flt_fi->set_else(else_value);
|
flt_fi->set_else(else_value);
|
||||||
|
|
||||||
target_model->register_decl(f, flt_fi);
|
target_model->register_decl(f, flt_fi);
|
||||||
TRACE("bv2fpa", tout << "fp.min/fp.max special: " << std::endl <<
|
TRACE(bv2fpa, tout << "fp.min/fp.max special: " << std::endl <<
|
||||||
mk_ismt2_pp(f, m) << " == " << mk_ismt2_pp(flt_fi->get_interp(), m) << std::endl;);
|
mk_ismt2_pp(f, m) << " == " << mk_ismt2_pp(flt_fi->get_interp(), m) << std::endl;);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -508,7 +508,7 @@ void bv2fpa_converter::convert_uf2bvuf(model_core * mc, model_core * target_mode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("bv2fpa", tout << "Target model: " << *target_model << std::endl; );
|
TRACE(bv2fpa, tout << "Target model: " << *target_model << std::endl; );
|
||||||
}
|
}
|
||||||
|
|
||||||
void bv2fpa_converter::display(std::ostream & out) {
|
void bv2fpa_converter::display(std::ostream & out) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ fpa2bv_converter::~fpa2bv_converter() {
|
||||||
void fpa2bv_converter::mk_eq(expr * a, expr * b, expr_ref & result) {
|
void fpa2bv_converter::mk_eq(expr * a, expr * b, expr_ref & result) {
|
||||||
if (is_float(a) && is_float(b)) {
|
if (is_float(a) && is_float(b)) {
|
||||||
|
|
||||||
TRACE("fpa2bv", tout << "mk_eq a=" << mk_ismt2_pp(a, m) << std::endl;
|
TRACE(fpa2bv, tout << "mk_eq a=" << mk_ismt2_pp(a, m) << std::endl;
|
||||||
tout << "mk_eq b=" << mk_ismt2_pp(b, m) << std::endl;);
|
tout << "mk_eq b=" << mk_ismt2_pp(b, m) << std::endl;);
|
||||||
|
|
||||||
SASSERT(m_util.is_fp(a) && m_util.is_fp(b));
|
SASSERT(m_util.is_fp(a) && m_util.is_fp(b));
|
||||||
|
@ -84,7 +84,7 @@ void fpa2bv_converter::mk_eq(expr * a, expr * b, expr_ref & result) {
|
||||||
else if (is_rm(a) && is_rm(b)) {
|
else if (is_rm(a) && is_rm(b)) {
|
||||||
SASSERT(m_util.is_bv2rm(b) && m_util.is_bv2rm(a));
|
SASSERT(m_util.is_bv2rm(b) && m_util.is_bv2rm(a));
|
||||||
|
|
||||||
TRACE("fpa2bv", tout << "mk_eq_rm a=" << mk_ismt2_pp(a, m) << std::endl;
|
TRACE(fpa2bv, tout << "mk_eq_rm a=" << mk_ismt2_pp(a, m) << std::endl;
|
||||||
tout << "mk_eq_rm b=" << mk_ismt2_pp(b, m) << std::endl;);
|
tout << "mk_eq_rm b=" << mk_ismt2_pp(b, m) << std::endl;);
|
||||||
|
|
||||||
m_simp.mk_eq(to_app(a)->get_arg(0), to_app(b)->get_arg(0), result);
|
m_simp.mk_eq(to_app(a)->get_arg(0), to_app(b)->get_arg(0), result);
|
||||||
|
@ -119,7 +119,7 @@ void fpa2bv_converter::mk_ite(expr * c, expr * t, expr * f, expr_ref & result) {
|
||||||
else if (m_util.is_rm(t) && m_util.is_rm(f))
|
else if (m_util.is_rm(t) && m_util.is_rm(f))
|
||||||
{
|
{
|
||||||
SASSERT(m_util.is_bv2rm(t) && m_util.is_bv2rm(f));
|
SASSERT(m_util.is_bv2rm(t) && m_util.is_bv2rm(f));
|
||||||
TRACE("fpa2bv", tout << "ite rm: t=" << mk_ismt2_pp(t, m) << " f=" << mk_ismt2_pp(f, m) << std::endl; );
|
TRACE(fpa2bv, tout << "ite rm: t=" << mk_ismt2_pp(t, m) << " f=" << mk_ismt2_pp(f, m) << std::endl; );
|
||||||
m_simp.mk_ite(c, to_app(t)->get_arg(0), to_app(f)->get_arg(0), result);
|
m_simp.mk_ite(c, to_app(t)->get_arg(0), to_app(f)->get_arg(0), result);
|
||||||
result = m_util.mk_bv2rm(result);
|
result = m_util.mk_bv2rm(result);
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ void fpa2bv_converter::mk_numeral(sort * s, mpf const & v, expr_ref & result) {
|
||||||
mk_bias(e, biased_exp);
|
mk_bias(e, biased_exp);
|
||||||
|
|
||||||
result = m_util.mk_fp(bv_sgn, biased_exp, bv_sig);
|
result = m_util.mk_fp(bv_sgn, biased_exp, bv_sig);
|
||||||
TRACE("fpa2bv_dbg", tout << "value of [" << sign << " " << m_mpz_manager.to_string(sig) << " " << exp << "] is "
|
TRACE(fpa2bv_dbg, tout << "value of [" << sign << " " << m_mpz_manager.to_string(sig) << " " << exp << "] is "
|
||||||
<< mk_ismt2_pp(result, m) << std::endl;);
|
<< mk_ismt2_pp(result, m) << std::endl;);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ expr_ref fpa2bv_converter::extra_quantify(expr * e)
|
||||||
for (unsigned i = 0; i < nv; i++)
|
for (unsigned i = 0; i < nv; i++)
|
||||||
{
|
{
|
||||||
if (uv.contains(i)) {
|
if (uv.contains(i)) {
|
||||||
TRACE("fpa2bv", tout << "uv[" << i << "] = " << mk_ismt2_pp(uv.get(i), m) << std::endl; );
|
TRACE(fpa2bv, tout << "uv[" << i << "] = " << mk_ismt2_pp(uv.get(i), m) << std::endl; );
|
||||||
sort * s = uv.get(i);
|
sort * s = uv.get(i);
|
||||||
var * v = m.mk_var(i, s);
|
var * v = m.mk_var(i, s);
|
||||||
new_decl_sorts.push_back(s);
|
new_decl_sorts.push_back(s);
|
||||||
|
@ -277,14 +277,14 @@ expr_ref fpa2bv_converter::extra_quantify(expr * e)
|
||||||
expr_ref res(m);
|
expr_ref res(m);
|
||||||
var_subst vsubst(m);
|
var_subst vsubst(m);
|
||||||
res = vsubst.operator()(e, nv, subst_map.data());
|
res = vsubst.operator()(e, nv, subst_map.data());
|
||||||
TRACE("fpa2bv", tout << "subst'd = " << mk_ismt2_pp(res, m) << std::endl; );
|
TRACE(fpa2bv, tout << "subst'd = " << mk_ismt2_pp(res, m) << std::endl; );
|
||||||
res = m.mk_forall(nv, new_decl_sorts.data(), new_decl_names.data(), res);
|
res = m.mk_forall(nv, new_decl_sorts.data(), new_decl_names.data(), res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_uf(func_decl * f, unsigned num, expr * const * args, expr_ref & result)
|
void fpa2bv_converter::mk_uf(func_decl * f, unsigned num, expr * const * args, expr_ref & result)
|
||||||
{
|
{
|
||||||
TRACE("fpa2bv", tout << "UF: " << mk_ismt2_pp(f, m) << std::endl; );
|
TRACE(fpa2bv, tout << "UF: " << mk_ismt2_pp(f, m) << std::endl; );
|
||||||
|
|
||||||
expr_ref fapp(m);
|
expr_ref fapp(m);
|
||||||
sort_ref rng(m);
|
sort_ref rng(m);
|
||||||
|
@ -321,7 +321,7 @@ void fpa2bv_converter::mk_uf(func_decl * f, unsigned num, expr * const * args, e
|
||||||
else
|
else
|
||||||
result = fapp;
|
result = fapp;
|
||||||
|
|
||||||
TRACE("fpa2bv", tout << "UF result: " << mk_ismt2_pp(result, m) << std::endl; );
|
TRACE(fpa2bv, tout << "UF result: " << mk_ismt2_pp(result, m) << std::endl; );
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ void fpa2bv_converter::add_core(unsigned sbits, unsigned ebits,
|
||||||
m_simp.mk_eq(c_sgn, d_sgn, eq_sgn);
|
m_simp.mk_eq(c_sgn, d_sgn, eq_sgn);
|
||||||
|
|
||||||
dbg_decouple("fpa2bv_add_eq_sgn", eq_sgn);
|
dbg_decouple("fpa2bv_add_eq_sgn", eq_sgn);
|
||||||
TRACE("fpa2bv_add_core", tout << "EQ_SGN = " << mk_ismt2_pp(eq_sgn, m) << std::endl; );
|
TRACE(fpa2bv_add_core, tout << "EQ_SGN = " << mk_ismt2_pp(eq_sgn, m) << std::endl; );
|
||||||
|
|
||||||
// two extra bits for catching the overflow.
|
// two extra bits for catching the overflow.
|
||||||
c_sig = m_bv_util.mk_zero_extend(2, c_sig);
|
c_sig = m_bv_util.mk_zero_extend(2, c_sig);
|
||||||
|
@ -693,7 +693,7 @@ void fpa2bv_converter::mk_add(sort * s, expr_ref & rm, expr_ref & x, expr_ref &
|
||||||
|
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
|
|
||||||
TRACE("fpa2bv_add", tout << "ADD = " << mk_ismt2_pp(result, m) << std::endl; );
|
TRACE(fpa2bv_add, tout << "ADD = " << mk_ismt2_pp(result, m) << std::endl; );
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_sub(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_sub(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
|
@ -875,7 +875,7 @@ void fpa2bv_converter::mk_mul(sort * s, expr_ref & rm, expr_ref & x, expr_ref &
|
||||||
|
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
|
|
||||||
TRACE("fpa2bv_mul", tout << "MUL = " << mk_ismt2_pp(result, m) << std::endl; );
|
TRACE(fpa2bv_mul, tout << "MUL = " << mk_ismt2_pp(result, m) << std::endl; );
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_div(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_div(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
|
@ -1044,7 +1044,7 @@ void fpa2bv_converter::mk_div(sort * s, expr_ref & rm, expr_ref & x, expr_ref &
|
||||||
|
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
|
|
||||||
TRACE("fpa2bv_div", tout << "DIV = " << mk_ismt2_pp(result, m) << std::endl; );
|
TRACE(fpa2bv_div, tout << "DIV = " << mk_ismt2_pp(result, m) << std::endl; );
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_rem(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_rem(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
|
@ -1056,7 +1056,7 @@ void fpa2bv_converter::mk_rem(func_decl * f, unsigned num, expr * const * args,
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_rem(sort * s, expr_ref & x, expr_ref & y, expr_ref & result) {
|
void fpa2bv_converter::mk_rem(sort * s, expr_ref & x, expr_ref & y, expr_ref & result) {
|
||||||
TRACE("fpa2bv_rem", tout << "X = " << mk_ismt2_pp(x, m) << std::endl;
|
TRACE(fpa2bv_rem, tout << "X = " << mk_ismt2_pp(x, m) << std::endl;
|
||||||
tout << "Y = " << mk_ismt2_pp(y, m) << std::endl;);
|
tout << "Y = " << mk_ismt2_pp(y, m) << std::endl;);
|
||||||
|
|
||||||
expr_ref nan(m), nzero(m), pzero(m), ninf(m), pinf(m);
|
expr_ref nan(m), nzero(m), pzero(m), ninf(m), pinf(m);
|
||||||
|
@ -1276,7 +1276,7 @@ void fpa2bv_converter::mk_rem(sort * s, expr_ref & x, expr_ref & y, expr_ref & r
|
||||||
|
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
|
|
||||||
TRACE("fpa2bv_rem", tout << "REM = " << mk_ismt2_pp(result, m) << std::endl; );
|
TRACE(fpa2bv_rem, tout << "REM = " << mk_ismt2_pp(result, m) << std::endl; );
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_abs(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_abs(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
|
@ -1811,7 +1811,7 @@ void fpa2bv_converter::mk_fma(func_decl * f, unsigned num, expr * const * args,
|
||||||
|
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
|
|
||||||
TRACE("fpa2bv_fma_", tout << "FMA = " << mk_ismt2_pp(result, m) << std::endl; );
|
TRACE(fpa2bv_fma_, tout << "FMA = " << mk_ismt2_pp(result, m) << std::endl; );
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_sqrt(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_sqrt(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
|
@ -2225,7 +2225,7 @@ void fpa2bv_converter::mk_round_to_integral(sort * s, expr_ref & rm, expr_ref &
|
||||||
|
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
|
|
||||||
TRACE("fpa2bv_round_to_integral", tout << "ROUND2INTEGRAL = " << mk_ismt2_pp(result, m) << std::endl; );
|
TRACE(fpa2bv_round_to_integral, tout << "ROUND2INTEGRAL = " << mk_ismt2_pp(result, m) << std::endl; );
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_float_eq(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_float_eq(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
|
@ -2237,7 +2237,7 @@ void fpa2bv_converter::mk_float_eq(func_decl * f, unsigned num, expr * const * a
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_float_eq(sort * s, expr_ref & x, expr_ref & y, expr_ref & result) {
|
void fpa2bv_converter::mk_float_eq(sort * s, expr_ref & x, expr_ref & y, expr_ref & result) {
|
||||||
TRACE("fpa2bv_float_eq", tout << "X = " << mk_ismt2_pp(x, m) << std::endl;
|
TRACE(fpa2bv_float_eq, tout << "X = " << mk_ismt2_pp(x, m) << std::endl;
|
||||||
tout << "Y = " << mk_ismt2_pp(y, m) << std::endl;);
|
tout << "Y = " << mk_ismt2_pp(y, m) << std::endl;);
|
||||||
|
|
||||||
expr_ref c1(m), c2(m), x_is_nan(m), y_is_nan(m), x_is_zero(m), y_is_zero(m);
|
expr_ref c1(m), c2(m), x_is_nan(m), y_is_nan(m), x_is_zero(m), y_is_zero(m);
|
||||||
|
@ -2267,7 +2267,7 @@ void fpa2bv_converter::mk_float_eq(sort * s, expr_ref & x, expr_ref & y, expr_re
|
||||||
m_simp.mk_ite(c2, m.mk_true(), c3t4, c2else);
|
m_simp.mk_ite(c2, m.mk_true(), c3t4, c2else);
|
||||||
m_simp.mk_ite(c1, m.mk_false(), c2else, result);
|
m_simp.mk_ite(c1, m.mk_false(), c2else, result);
|
||||||
|
|
||||||
TRACE("fpa2bv_float_eq", tout << "FLOAT_EQ = " << mk_ismt2_pp(result, m) << std::endl; );
|
TRACE(fpa2bv_float_eq, tout << "FLOAT_EQ = " << mk_ismt2_pp(result, m) << std::endl; );
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_float_lt(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_float_lt(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
|
@ -2424,7 +2424,7 @@ void fpa2bv_converter::mk_is_negative(func_decl * f, unsigned num, expr * const
|
||||||
mk_is_neg(args[0], t2);
|
mk_is_neg(args[0], t2);
|
||||||
nt1 = m.mk_not(t1);
|
nt1 = m.mk_not(t1);
|
||||||
result = m.mk_and(nt1, t2);
|
result = m.mk_and(nt1, t2);
|
||||||
TRACE("fpa2bv_is_negative", tout << "result = " << mk_ismt2_pp(result, m) << std::endl;);
|
TRACE(fpa2bv_is_negative, tout << "result = " << mk_ismt2_pp(result, m) << std::endl;);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_is_positive(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_is_positive(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
|
@ -2437,7 +2437,7 @@ void fpa2bv_converter::mk_is_positive(func_decl * f, unsigned num, expr * const
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_to_fp(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_to_fp(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
TRACE("fpa2bv_to_fp", for (unsigned i=0; i < num; i++)
|
TRACE(fpa2bv_to_fp, for (unsigned i=0; i < num; i++)
|
||||||
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl; );
|
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl; );
|
||||||
|
|
||||||
if (num == 1 &&
|
if (num == 1 &&
|
||||||
|
@ -2675,7 +2675,7 @@ void fpa2bv_converter::mk_to_fp_float(sort * to_srt, expr * rm, expr * x, expr_r
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_to_fp_real(func_decl * f, sort * s, expr * rm, expr * x, expr_ref & result) {
|
void fpa2bv_converter::mk_to_fp_real(func_decl * f, sort * s, expr * rm, expr * x, expr_ref & result) {
|
||||||
TRACE("fpa2bv_to_fp_real", tout << "rm: " << mk_ismt2_pp(rm, m) << std::endl <<
|
TRACE(fpa2bv_to_fp_real, tout << "rm: " << mk_ismt2_pp(rm, m) << std::endl <<
|
||||||
"x: " << mk_ismt2_pp(x, m) << std::endl;);
|
"x: " << mk_ismt2_pp(x, m) << std::endl;);
|
||||||
SASSERT(m_util.is_float(s));
|
SASSERT(m_util.is_float(s));
|
||||||
SASSERT(au().is_real(x) || au().is_int(x));
|
SASSERT(au().is_real(x) || au().is_int(x));
|
||||||
|
@ -2815,7 +2815,7 @@ void fpa2bv_converter::mk_to_fp_real(func_decl * f, sort * s, expr * rm, expr *
|
||||||
unsigned max_exp = m_mpz_manager.get_uint(max_exp_z);
|
unsigned max_exp = m_mpz_manager.get_uint(max_exp_z);
|
||||||
rational max_sig = m_mpf_manager.m_powers2.m1(sbits) / m_mpf_manager.m_powers2(sbits-1);
|
rational max_sig = m_mpf_manager.m_powers2.m1(sbits) / m_mpf_manager.m_powers2(sbits-1);
|
||||||
max_real = max_sig * rational(m_mpf_manager.m_powers2(max_exp));
|
max_real = max_sig * rational(m_mpf_manager.m_powers2(max_exp));
|
||||||
TRACE("fpa2bv_to_real", tout << "max exp: " << max_exp << " max real: " << max_real << std::endl;);
|
TRACE(fpa2bv_to_real, tout << "max exp: " << max_exp << " max real: " << max_real << std::endl;);
|
||||||
|
|
||||||
expr_ref r_is_pinf(m), r_is_ninf(m);
|
expr_ref r_is_pinf(m), r_is_ninf(m);
|
||||||
mk_is_pinf(result, r_is_pinf);
|
mk_is_pinf(result, r_is_pinf);
|
||||||
|
@ -2909,7 +2909,7 @@ void fpa2bv_converter::mk_to_fp_real_int(func_decl * f, unsigned num, expr * con
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_to_real(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_to_real(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
TRACE("fpa2bv_to_real", for (unsigned i = 0; i < num; i++)
|
TRACE(fpa2bv_to_real, for (unsigned i = 0; i < num; i++)
|
||||||
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;);
|
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;);
|
||||||
SASSERT(num == 1);
|
SASSERT(num == 1);
|
||||||
SASSERT(f->get_num_parameters() == 0);
|
SASSERT(f->get_num_parameters() == 0);
|
||||||
|
@ -2989,7 +2989,7 @@ void fpa2bv_converter::mk_to_real(func_decl * f, unsigned num, expr * const * ar
|
||||||
res = m.mk_ite(sgn_is_1, minus_res, res);
|
res = m.mk_ite(sgn_is_1, minus_res, res);
|
||||||
dbg_decouple("fpa2bv_to_real_sig_times_exp2", res);
|
dbg_decouple("fpa2bv_to_real_sig_times_exp2", res);
|
||||||
|
|
||||||
TRACE("fpa2bv_to_real", tout << "rsig = " << mk_ismt2_pp(rsig, m) << std::endl;
|
TRACE(fpa2bv_to_real, tout << "rsig = " << mk_ismt2_pp(rsig, m) << std::endl;
|
||||||
tout << "exp2 = " << mk_ismt2_pp(exp2, m) << std::endl;);
|
tout << "exp2 = " << mk_ismt2_pp(exp2, m) << std::endl;);
|
||||||
|
|
||||||
expr_ref unspec(m);
|
expr_ref unspec(m);
|
||||||
|
@ -3002,7 +3002,7 @@ void fpa2bv_converter::mk_to_real(func_decl * f, unsigned num, expr * const * ar
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_to_fp_signed(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_to_fp_signed(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
TRACE("fpa2bv_to_fp_signed", for (unsigned i = 0; i < num; i++)
|
TRACE(fpa2bv_to_fp_signed, for (unsigned i = 0; i < num; i++)
|
||||||
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;);
|
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;);
|
||||||
|
|
||||||
// This is a conversion from signed bitvector to float:
|
// This is a conversion from signed bitvector to float:
|
||||||
|
@ -3107,7 +3107,7 @@ void fpa2bv_converter::mk_to_fp_signed(func_decl * f, unsigned num, expr * const
|
||||||
// exp < bv_sz (+sign bit which is [0])
|
// exp < bv_sz (+sign bit which is [0])
|
||||||
unsigned exp_worst_case_sz = (unsigned)((log((double)bv_sz) / log((double)2)) + 1.0);
|
unsigned exp_worst_case_sz = (unsigned)((log((double)bv_sz) / log((double)2)) + 1.0);
|
||||||
|
|
||||||
TRACE("fpa2bv_to_fp_signed", tout << "exp worst case sz: " << exp_worst_case_sz << std::endl;);
|
TRACE(fpa2bv_to_fp_signed, tout << "exp worst case sz: " << exp_worst_case_sz << std::endl;);
|
||||||
|
|
||||||
if (exp_sz <= exp_worst_case_sz) {
|
if (exp_sz <= exp_worst_case_sz) {
|
||||||
// exp_sz < exp_worst_case_sz and exp >= 0.
|
// exp_sz < exp_worst_case_sz and exp >= 0.
|
||||||
|
@ -3145,7 +3145,7 @@ void fpa2bv_converter::mk_to_fp_signed(func_decl * f, unsigned num, expr * const
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_to_fp_unsigned(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_to_fp_unsigned(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
TRACE("fpa2bv_to_fp_unsigned", for (unsigned i = 0; i < num; i++)
|
TRACE(fpa2bv_to_fp_unsigned, for (unsigned i = 0; i < num; i++)
|
||||||
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;);
|
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;);
|
||||||
|
|
||||||
// This is a conversion from unsigned bitvector to float:
|
// This is a conversion from unsigned bitvector to float:
|
||||||
|
@ -3289,7 +3289,7 @@ void fpa2bv_converter::mk_to_ieee_bv(func_decl * f, unsigned num, expr * const *
|
||||||
join_fp(x, sgn_e_s);
|
join_fp(x, sgn_e_s);
|
||||||
m_simp.mk_ite(x_is_nan, unspec, sgn_e_s, result);
|
m_simp.mk_ite(x_is_nan, unspec, sgn_e_s, result);
|
||||||
|
|
||||||
TRACE("fpa2bv_to_ieee_bv", tout << "result=" << mk_ismt2_pp(result, m) << std::endl;);
|
TRACE(fpa2bv_to_ieee_bv, tout << "result=" << mk_ismt2_pp(result, m) << std::endl;);
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3321,7 +3321,7 @@ void fpa2bv_converter::mk_to_ieee_bv_unspecified(func_decl * f, unsigned num, ex
|
||||||
m_extra_assertions.push_back(std::move(sig_is_non_zero));
|
m_extra_assertions.push_back(std::move(sig_is_non_zero));
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("fpa2bv_to_ieee_bv_unspecified", tout << "result=" << mk_ismt2_pp(result, m) << std::endl;);
|
TRACE(fpa2bv_to_ieee_bv_unspecified, tout << "result=" << mk_ismt2_pp(result, m) << std::endl;);
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3332,7 +3332,7 @@ void fpa2bv_converter::mk_to_ieee_bv_i(func_decl * f, unsigned num, expr * const
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_to_bv(func_decl * f, unsigned num, expr * const * args, bool is_signed, expr_ref & result) {
|
void fpa2bv_converter::mk_to_bv(func_decl * f, unsigned num, expr * const * args, bool is_signed, expr_ref & result) {
|
||||||
TRACE("fpa2bv_to_bv", for (unsigned i = 0; i < num; i++)
|
TRACE(fpa2bv_to_bv, for (unsigned i = 0; i < num; i++)
|
||||||
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;);
|
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;);
|
||||||
|
|
||||||
SASSERT(num == 2);
|
SASSERT(num == 2);
|
||||||
|
@ -3502,13 +3502,13 @@ void fpa2bv_converter::mk_to_bv(func_decl * f, unsigned num, expr * const * args
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_to_ubv(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_to_ubv(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
TRACE("fpa2bv_to_ubv", for (unsigned i = 0; i < num; i++)
|
TRACE(fpa2bv_to_ubv, for (unsigned i = 0; i < num; i++)
|
||||||
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;);
|
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;);
|
||||||
mk_to_bv(f, num, args, false, result);
|
mk_to_bv(f, num, args, false, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_to_sbv(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
void fpa2bv_converter::mk_to_sbv(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
|
||||||
TRACE("fpa2bv_to_sbv", for (unsigned i = 0; i < num; i++)
|
TRACE(fpa2bv_to_sbv, for (unsigned i = 0; i < num; i++)
|
||||||
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;);
|
tout << "arg" << i << " = " << mk_ismt2_pp(args[i], m) << std::endl;);
|
||||||
mk_to_bv(f, num, args, true, result);
|
mk_to_bv(f, num, args, true, result);
|
||||||
}
|
}
|
||||||
|
@ -3549,7 +3549,7 @@ void fpa2bv_converter::mk_to_bv_unspecified(func_decl * f, unsigned num, expr *
|
||||||
result = m.mk_app(f_bv, rm_bv, nw);
|
result = m.mk_app(f_bv, rm_bv, nw);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("fpa2bv_to_bv_unspecified", tout << "result=" << mk_ismt2_pp(result, m) << std::endl;);
|
TRACE(fpa2bv_to_bv_unspecified, tout << "result=" << mk_ismt2_pp(result, m) << std::endl;);
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3578,7 +3578,7 @@ void fpa2bv_converter::mk_fp(func_decl * f, unsigned num, expr * const * args, e
|
||||||
SASSERT(m_util.get_sbits(f->get_range()) == m_bv_util.get_bv_size(args[2]) + 1);
|
SASSERT(m_util.get_sbits(f->get_range()) == m_bv_util.get_bv_size(args[2]) + 1);
|
||||||
SASSERT(m_util.get_ebits(f->get_range()) == m_bv_util.get_bv_size(args[1]));
|
SASSERT(m_util.get_ebits(f->get_range()) == m_bv_util.get_bv_size(args[1]));
|
||||||
result = m_util.mk_fp(args[0], args[1], args[2]);
|
result = m_util.mk_fp(args[0], args[1], args[2]);
|
||||||
TRACE("fpa2bv_mk_fp", tout << "mk_fp result = " << mk_ismt2_pp(result, m) << std::endl;);
|
TRACE(fpa2bv_mk_fp, tout << "mk_fp result = " << mk_ismt2_pp(result, m) << std::endl;);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::split_fp(expr * e, expr_ref & sgn, expr_ref & exp, expr_ref & sig) const {
|
void fpa2bv_converter::split_fp(expr * e, expr_ref & sgn, expr_ref & exp, expr_ref & sig) const {
|
||||||
|
@ -3906,9 +3906,9 @@ void fpa2bv_converter::unpack(expr * e, expr_ref & sgn, expr_ref & sig, expr_ref
|
||||||
SASSERT(m_bv_util.get_bv_size(sig) == sbits);
|
SASSERT(m_bv_util.get_bv_size(sig) == sbits);
|
||||||
SASSERT(m_bv_util.get_bv_size(exp) == ebits);
|
SASSERT(m_bv_util.get_bv_size(exp) == ebits);
|
||||||
|
|
||||||
TRACE("fpa2bv_unpack", tout << "UNPACK SGN = " << mk_ismt2_pp(sgn, m) << std::endl; );
|
TRACE(fpa2bv_unpack, tout << "UNPACK SGN = " << mk_ismt2_pp(sgn, m) << std::endl; );
|
||||||
TRACE("fpa2bv_unpack", tout << "UNPACK SIG = " << mk_ismt2_pp(sig, m) << std::endl; );
|
TRACE(fpa2bv_unpack, tout << "UNPACK SIG = " << mk_ismt2_pp(sig, m) << std::endl; );
|
||||||
TRACE("fpa2bv_unpack", tout << "UNPACK EXP = " << mk_ismt2_pp(exp, m) << std::endl; );
|
TRACE(fpa2bv_unpack, tout << "UNPACK EXP = " << mk_ismt2_pp(exp, m) << std::endl; );
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::mk_rounding_mode(decl_kind k, expr_ref & result)
|
void fpa2bv_converter::mk_rounding_mode(decl_kind k, expr_ref & result)
|
||||||
|
@ -4025,7 +4025,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref &
|
||||||
SASSERT(is_well_sorted(m, sig));
|
SASSERT(is_well_sorted(m, sig));
|
||||||
SASSERT(is_well_sorted(m, exp));
|
SASSERT(is_well_sorted(m, exp));
|
||||||
|
|
||||||
TRACE("fpa2bv_dbg", tout << "RND: " << std::endl <<
|
TRACE(fpa2bv_dbg, tout << "RND: " << std::endl <<
|
||||||
"ebits = " << ebits << std::endl <<
|
"ebits = " << ebits << std::endl <<
|
||||||
"sbits = " << sbits << std::endl <<
|
"sbits = " << sbits << std::endl <<
|
||||||
"sgn = " << mk_ismt2_pp(sgn, m) << std::endl <<
|
"sgn = " << mk_ismt2_pp(sgn, m) << std::endl <<
|
||||||
|
@ -4048,7 +4048,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref &
|
||||||
mk_min_exp(ebits, e_min);
|
mk_min_exp(ebits, e_min);
|
||||||
mk_max_exp(ebits, e_max);
|
mk_max_exp(ebits, e_max);
|
||||||
|
|
||||||
TRACE("fpa2bv_dbg", tout << "e_min = " << mk_ismt2_pp(e_min, m) << std::endl;
|
TRACE(fpa2bv_dbg, tout << "e_min = " << mk_ismt2_pp(e_min, m) << std::endl;
|
||||||
tout << "e_max = " << mk_ismt2_pp(e_max, m) << std::endl;);
|
tout << "e_max = " << mk_ismt2_pp(e_max, m) << std::endl;);
|
||||||
|
|
||||||
expr_ref OVF1(m), e_top_three(m), sigm1(m), e_eq_emax_and_sigm1(m), e_eq_emax(m);
|
expr_ref OVF1(m), e_top_three(m), sigm1(m), e_eq_emax_and_sigm1(m), e_eq_emax(m);
|
||||||
|
@ -4074,7 +4074,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref &
|
||||||
|
|
||||||
dbg_decouple("fpa2bv_rnd_OVF1", OVF1);
|
dbg_decouple("fpa2bv_rnd_OVF1", OVF1);
|
||||||
|
|
||||||
TRACE("fpa2bv_dbg", tout << "OVF1 = " << mk_ismt2_pp(OVF1, m) << std::endl;);
|
TRACE(fpa2bv_dbg, tout << "OVF1 = " << mk_ismt2_pp(OVF1, m) << std::endl;);
|
||||||
SASSERT(is_well_sorted(m, OVF1));
|
SASSERT(is_well_sorted(m, OVF1));
|
||||||
|
|
||||||
expr_ref lz(m);
|
expr_ref lz(m);
|
||||||
|
@ -4082,7 +4082,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref &
|
||||||
|
|
||||||
dbg_decouple("fpa2bv_rnd_lz", lz);
|
dbg_decouple("fpa2bv_rnd_lz", lz);
|
||||||
|
|
||||||
TRACE("fpa2bv_dbg", tout << "LZ = " << mk_ismt2_pp(lz, m) << std::endl;);
|
TRACE(fpa2bv_dbg, tout << "LZ = " << mk_ismt2_pp(lz, m) << std::endl;);
|
||||||
|
|
||||||
expr_ref t(m);
|
expr_ref t(m);
|
||||||
t = m_bv_util.mk_bv_add(exp, m_bv_util.mk_numeral(1, ebits+2));
|
t = m_bv_util.mk_bv_add(exp, m_bv_util.mk_numeral(1, ebits+2));
|
||||||
|
@ -4092,13 +4092,13 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref &
|
||||||
expr_ref TINY(m);
|
expr_ref TINY(m);
|
||||||
TINY = m_bv_util.mk_sle(t, m_bv_util.mk_numeral(rational(-1), ebits+2));
|
TINY = m_bv_util.mk_sle(t, m_bv_util.mk_numeral(rational(-1), ebits+2));
|
||||||
dbg_decouple("fpa2bv_rnd_TINY", TINY);
|
dbg_decouple("fpa2bv_rnd_TINY", TINY);
|
||||||
TRACE("fpa2bv_dbg", tout << "TINY = " << mk_ismt2_pp(TINY, m) << std::endl;);
|
TRACE(fpa2bv_dbg, tout << "TINY = " << mk_ismt2_pp(TINY, m) << std::endl;);
|
||||||
SASSERT(is_well_sorted(m, TINY));
|
SASSERT(is_well_sorted(m, TINY));
|
||||||
|
|
||||||
expr_ref beta(m);
|
expr_ref beta(m);
|
||||||
beta = m_bv_util.mk_bv_add(m_bv_util.mk_bv_sub(exp, lz), m_bv_util.mk_numeral(1, ebits+2));
|
beta = m_bv_util.mk_bv_add(m_bv_util.mk_bv_sub(exp, lz), m_bv_util.mk_numeral(1, ebits+2));
|
||||||
|
|
||||||
TRACE("fpa2bv_dbg", tout << "beta = " << mk_ismt2_pp(beta, m) << std::endl; );
|
TRACE(fpa2bv_dbg, tout << "beta = " << mk_ismt2_pp(beta, m) << std::endl; );
|
||||||
SASSERT(is_well_sorted(m, beta));
|
SASSERT(is_well_sorted(m, beta));
|
||||||
|
|
||||||
dbg_decouple("fpa2bv_rnd_beta", beta);
|
dbg_decouple("fpa2bv_rnd_beta", beta);
|
||||||
|
@ -4112,7 +4112,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref &
|
||||||
|
|
||||||
dbg_decouple("fpa2bv_rnd_sigma", sigma);
|
dbg_decouple("fpa2bv_rnd_sigma", sigma);
|
||||||
|
|
||||||
TRACE("fpa2bv_dbg", tout << "Shift distance: " << mk_ismt2_pp(sigma, m) << std::endl;);
|
TRACE(fpa2bv_dbg, tout << "Shift distance: " << mk_ismt2_pp(sigma, m) << std::endl;);
|
||||||
SASSERT(is_well_sorted(m, sigma));
|
SASSERT(is_well_sorted(m, sigma));
|
||||||
|
|
||||||
// Normalization shift
|
// Normalization shift
|
||||||
|
@ -4173,7 +4173,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref &
|
||||||
round = m_bv_util.mk_extract(1, 1, sig);
|
round = m_bv_util.mk_extract(1, 1, sig);
|
||||||
last = m_bv_util.mk_extract(2, 2, sig);
|
last = m_bv_util.mk_extract(2, 2, sig);
|
||||||
|
|
||||||
TRACE("fpa2bv_dbg", tout << "sticky = " << mk_ismt2_pp(sticky, m) << std::endl;);
|
TRACE(fpa2bv_dbg, tout << "sticky = " << mk_ismt2_pp(sticky, m) << std::endl;);
|
||||||
|
|
||||||
dbg_decouple("fpa2bv_rnd_sticky", sticky);
|
dbg_decouple("fpa2bv_rnd_sticky", sticky);
|
||||||
dbg_decouple("fpa2bv_rnd_round", round);
|
dbg_decouple("fpa2bv_rnd_round", round);
|
||||||
|
@ -4320,7 +4320,7 @@ void fpa2bv_converter::round(sort * s, expr_ref & rm, expr_ref & sgn, expr_ref &
|
||||||
|
|
||||||
result = m_util.mk_fp(res_sgn, res_exp, res_sig);
|
result = m_util.mk_fp(res_sgn, res_exp, res_sig);
|
||||||
|
|
||||||
TRACE("fpa2bv_round", tout << "ROUND = " << mk_ismt2_pp(result, m) << std::endl; );
|
TRACE(fpa2bv_round, tout << "ROUND = " << mk_ismt2_pp(result, m) << std::endl; );
|
||||||
}
|
}
|
||||||
|
|
||||||
void fpa2bv_converter::reset() {
|
void fpa2bv_converter::reset() {
|
||||||
|
@ -4347,7 +4347,7 @@ func_decl * fpa2bv_converter::mk_bv_uf(func_decl * f, sort * const * domain, sor
|
||||||
m.inc_ref(f);
|
m.inc_ref(f);
|
||||||
m.inc_ref(res);
|
m.inc_ref(res);
|
||||||
m_uf2bvuf.insert(f, res);
|
m_uf2bvuf.insert(f, res);
|
||||||
TRACE("fpa2bv", tout << "New UF func_decl: " << res->get_id() << std::endl << mk_ismt2_pp(res, m) << std::endl;);
|
TRACE(fpa2bv, tout << "New UF func_decl: " << res->get_id() << std::endl << mk_ismt2_pp(res, m) << std::endl;);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -4472,7 +4472,7 @@ expr* fpa2bv_converter_wrapped::bv2rm_value(expr* b) {
|
||||||
default: result = m_util.mk_round_toward_zero();
|
default: result = m_util.mk_round_toward_zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("t_fpa", tout << "result: " << mk_ismt2_pp(result, m) << std::endl;);
|
TRACE(t_fpa, tout << "result: " << mk_ismt2_pp(result, m) << std::endl;);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4539,7 +4539,7 @@ expr* fpa2bv_converter_wrapped::bv2fpa_value(sort* s, expr* a, expr* b, expr* c)
|
||||||
mpfm.set(f, ebits, sbits, mpzm.is_one(sgn_z), mpzm.get_int64(exp_u), sig_z);
|
mpfm.set(f, ebits, sbits, mpzm.is_one(sgn_z), mpzm.get_int64(exp_u), sig_z);
|
||||||
result = m_util.mk_value(f);
|
result = m_util.mk_value(f);
|
||||||
|
|
||||||
TRACE("t_fpa", tout << mk_pp(a, m) << " " << mk_pp(b, m) << " " << mk_pp(c, m) << " result: [" <<
|
TRACE(t_fpa, tout << mk_pp(a, m) << " " << mk_pp(b, m) << " " << mk_pp(c, m) << " result: [" <<
|
||||||
mpzm.to_string(sgn_z) << "," <<
|
mpzm.to_string(sgn_z) << "," <<
|
||||||
mpzm.to_string(exp_z) << "," <<
|
mpzm.to_string(exp_z) << "," <<
|
||||||
mpzm.to_string(sig_z) << "] --> " <<
|
mpzm.to_string(sig_z) << "] --> " <<
|
||||||
|
|
|
@ -54,7 +54,7 @@ bool fpa2bv_rewriter_cfg::max_steps_exceeded(unsigned num_steps) const {
|
||||||
|
|
||||||
|
|
||||||
br_status fpa2bv_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
br_status fpa2bv_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||||
TRACE("fpa2bv_rw", tout << "func: " << f->get_name() << std::endl;
|
TRACE(fpa2bv_rw, tout << "func: " << f->get_name() << std::endl;
|
||||||
tout << "args: " << std::endl;
|
tout << "args: " << std::endl;
|
||||||
for (unsigned i = 0; i < num; i++)
|
for (unsigned i = 0; i < num; i++)
|
||||||
tout << mk_ismt2_pp(args[i], m()) << std::endl;);
|
tout << mk_ismt2_pp(args[i], m()) << std::endl;);
|
||||||
|
@ -71,7 +71,7 @@ br_status fpa2bv_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr * co
|
||||||
|
|
||||||
if (m().is_eq(f)) {
|
if (m().is_eq(f)) {
|
||||||
SASSERT(num == 2);
|
SASSERT(num == 2);
|
||||||
TRACE("fpa2bv_rw", tout << "(= " << mk_ismt2_pp(args[0], m()) << " " <<
|
TRACE(fpa2bv_rw, tout << "(= " << mk_ismt2_pp(args[0], m()) << " " <<
|
||||||
mk_ismt2_pp(args[1], m()) << ")" << std::endl;);
|
mk_ismt2_pp(args[1], m()) << ")" << std::endl;);
|
||||||
SASSERT(args[0]->get_sort() == args[1]->get_sort());
|
SASSERT(args[0]->get_sort() == args[1]->get_sort());
|
||||||
sort * ds = f->get_domain()[0];
|
sort * ds = f->get_domain()[0];
|
||||||
|
@ -158,7 +158,7 @@ br_status fpa2bv_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr * co
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
TRACE("fpa2bv", tout << "unsupported operator: " << f->get_name() << "\n";
|
TRACE(fpa2bv, tout << "unsupported operator: " << f->get_name() << "\n";
|
||||||
for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << std::endl;);
|
for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << std::endl;);
|
||||||
NOT_IMPLEMENTED_YET();
|
NOT_IMPLEMENTED_YET();
|
||||||
}
|
}
|
||||||
|
@ -177,11 +177,11 @@ br_status fpa2bv_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr * co
|
||||||
|
|
||||||
bool fpa2bv_rewriter_cfg::pre_visit(expr * t)
|
bool fpa2bv_rewriter_cfg::pre_visit(expr * t)
|
||||||
{
|
{
|
||||||
TRACE("fpa2bv", tout << "pre_visit: " << mk_ismt2_pp(t, m()) << std::endl;);
|
TRACE(fpa2bv, tout << "pre_visit: " << mk_ismt2_pp(t, m()) << std::endl;);
|
||||||
|
|
||||||
if (is_quantifier(t)) {
|
if (is_quantifier(t)) {
|
||||||
quantifier * q = to_quantifier(t);
|
quantifier * q = to_quantifier(t);
|
||||||
TRACE("fpa2bv", tout << "pre_visit quantifier [" << q->get_id() << "]: " << mk_ismt2_pp(q->get_expr(), m()) << std::endl;);
|
TRACE(fpa2bv, tout << "pre_visit quantifier [" << q->get_id() << "]: " << mk_ismt2_pp(q->get_expr(), m()) << std::endl;);
|
||||||
sort_ref_vector new_bindings(m_manager);
|
sort_ref_vector new_bindings(m_manager);
|
||||||
for (unsigned i = 0 ; i < q->get_num_decls(); i++)
|
for (unsigned i = 0 ; i < q->get_num_decls(); i++)
|
||||||
new_bindings.push_back(q->get_decl_sort(i));
|
new_bindings.push_back(q->get_decl_sort(i));
|
||||||
|
@ -239,7 +239,7 @@ bool fpa2bv_rewriter_cfg::reduce_quantifier(
|
||||||
result_pr = m().mk_rewrite(old_q, result);
|
result_pr = m().mk_rewrite(old_q, result);
|
||||||
}
|
}
|
||||||
m_bindings.shrink(old_sz);
|
m_bindings.shrink(old_sz);
|
||||||
TRACE("fpa2bv", tout << "reduce_quantifier[" << old_q->get_depth() << "]: " <<
|
TRACE(fpa2bv, tout << "reduce_quantifier[" << old_q->get_depth() << "]: " <<
|
||||||
mk_ismt2_pp(old_q->get_expr(), m()) << std::endl <<
|
mk_ismt2_pp(old_q->get_expr(), m()) << std::endl <<
|
||||||
" new body: " << mk_ismt2_pp(new_body, m()) << std::endl;
|
" new body: " << mk_ismt2_pp(new_body, m()) << std::endl;
|
||||||
tout << "result = " << mk_ismt2_pp(result, m()) << std::endl;);
|
tout << "result = " << mk_ismt2_pp(result, m()) << std::endl;);
|
||||||
|
@ -272,14 +272,14 @@ bool fpa2bv_rewriter_cfg::reduce_var(var * t, expr_ref & result, proof_ref & res
|
||||||
|
|
||||||
result = new_exp;
|
result = new_exp;
|
||||||
result_pr = nullptr;
|
result_pr = nullptr;
|
||||||
TRACE("fpa2bv", tout << "reduce_var: " << mk_ismt2_pp(t, m()) << " -> " << mk_ismt2_pp(result, m()) << std::endl;);
|
TRACE(fpa2bv, tout << "reduce_var: " << mk_ismt2_pp(t, m()) << " -> " << mk_ismt2_pp(result, m()) << std::endl;);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template class rewriter_tpl<fpa2bv_rewriter_cfg>;
|
template class rewriter_tpl<fpa2bv_rewriter_cfg>;
|
||||||
|
|
||||||
expr_ref fpa2bv_rewriter::convert_atom(th_rewriter& rw, expr * e) {
|
expr_ref fpa2bv_rewriter::convert_atom(th_rewriter& rw, expr * e) {
|
||||||
TRACE("t_fpa_detail", tout << "converting atom: " << mk_ismt2_pp(e, m_cfg.m()) << std::endl;);
|
TRACE(t_fpa_detail, tout << "converting atom: " << mk_ismt2_pp(e, m_cfg.m()) << std::endl;);
|
||||||
expr_ref res(m_cfg.m());
|
expr_ref res(m_cfg.m());
|
||||||
proof_ref pr(m_cfg.m());
|
proof_ref pr(m_cfg.m());
|
||||||
(*this)(e, res);
|
(*this)(e, res);
|
||||||
|
@ -298,7 +298,7 @@ expr_ref fpa2bv_rewriter::convert_term(th_rewriter& rw, expr * e) {
|
||||||
|
|
||||||
(*this)(e, e_conv);
|
(*this)(e, e_conv);
|
||||||
|
|
||||||
TRACE("t_fpa_detail", tout << "term: " << mk_ismt2_pp(e, m) << std::endl;
|
TRACE(t_fpa_detail, tout << "term: " << mk_ismt2_pp(e, m) << std::endl;
|
||||||
tout << "converted term: " << mk_ismt2_pp(e_conv, m) << std::endl;);
|
tout << "converted term: " << mk_ismt2_pp(e_conv, m) << std::endl;);
|
||||||
|
|
||||||
if (fu().is_rm(e)) {
|
if (fu().is_rm(e)) {
|
||||||
|
@ -334,7 +334,7 @@ expr_ref fpa2bv_rewriter::convert_conversion_term(th_rewriter& rw, expr * e) {
|
||||||
expr_ref fpa2bv_rewriter::convert(th_rewriter& rw, expr * e) {
|
expr_ref fpa2bv_rewriter::convert(th_rewriter& rw, expr * e) {
|
||||||
ast_manager& m = m_cfg.m();
|
ast_manager& m = m_cfg.m();
|
||||||
expr_ref res(m);
|
expr_ref res(m);
|
||||||
TRACE("t_fpa", tout << "converting " << mk_ismt2_pp(e, m) << std::endl;);
|
TRACE(t_fpa, tout << "converting " << mk_ismt2_pp(e, m) << std::endl;);
|
||||||
|
|
||||||
if (fu().is_fp(e))
|
if (fu().is_fp(e))
|
||||||
res = e;
|
res = e;
|
||||||
|
@ -345,7 +345,7 @@ expr_ref fpa2bv_rewriter::convert(th_rewriter& rw, expr * e) {
|
||||||
else
|
else
|
||||||
res = convert_conversion_term(rw, e);
|
res = convert_conversion_term(rw, e);
|
||||||
|
|
||||||
TRACE("t_fpa_detail", tout << "converted; caching:" << std::endl;
|
TRACE(t_fpa_detail, tout << "converted; caching:" << std::endl;
|
||||||
tout << mk_ismt2_pp(e, m) << std::endl << " -> " << std::endl <<
|
tout << mk_ismt2_pp(e, m) << std::endl << " -> " << std::endl <<
|
||||||
mk_ismt2_pp(res, m) << std::endl;);
|
mk_ismt2_pp(res, m) << std::endl;);
|
||||||
|
|
||||||
|
|
|
@ -1065,7 +1065,7 @@ bool fpa_util::contains_floats(ast * a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fpa_util::is_considered_uninterpreted(func_decl * f, unsigned n, expr* const* args) {
|
bool fpa_util::is_considered_uninterpreted(func_decl * f, unsigned n, expr* const* args) {
|
||||||
TRACE("fpa_util", expr_ref t(m().mk_app(f, n, args), m()); tout << mk_ismt2_pp(t, m()) << std::endl; );
|
TRACE(fpa_util, expr_ref t(m().mk_app(f, n, args), m()); tout << mk_ismt2_pp(t, m()) << std::endl; );
|
||||||
|
|
||||||
family_id ffid = plugin().get_family_id();
|
family_id ffid = plugin().get_family_id();
|
||||||
if (f->get_family_id() != ffid)
|
if (f->get_family_id() != ffid)
|
||||||
|
|
|
@ -25,7 +25,7 @@ Revision History:
|
||||||
bool macro_finder::is_macro(expr * n, app_ref & head, expr_ref & def) {
|
bool macro_finder::is_macro(expr * n, app_ref & head, expr_ref & def) {
|
||||||
if (!is_forall(n))
|
if (!is_forall(n))
|
||||||
return false;
|
return false;
|
||||||
TRACE("macro_finder", tout << "processing: " << mk_pp(n, m) << "\n";);
|
TRACE(macro_finder, tout << "processing: " << mk_pp(n, m) << "\n";);
|
||||||
expr * body = to_quantifier(n)->get_expr();
|
expr * body = to_quantifier(n)->get_expr();
|
||||||
unsigned num_decls = to_quantifier(n)->get_num_decls();
|
unsigned num_decls = to_quantifier(n)->get_num_decls();
|
||||||
return m_util.is_simple_macro(body, num_decls, head, def);
|
return m_util.is_simple_macro(body, num_decls, head, def);
|
||||||
|
@ -89,7 +89,7 @@ bool macro_finder::is_arith_macro(expr * n, proof * pr, bool deps_valid, expr_de
|
||||||
}
|
}
|
||||||
// is ge or le
|
// is ge or le
|
||||||
//
|
//
|
||||||
TRACE("macro_finder", tout << "is_arith_macro: is_ge or is_le " << f->get_name() << "\n";);
|
TRACE(macro_finder, tout << "is_arith_macro: is_ge or is_le " << f->get_name() << "\n";);
|
||||||
func_decl * k = m.mk_fresh_func_decl(f->get_name(), symbol::null, f->get_arity(), f->get_domain(), f->get_range());
|
func_decl * k = m.mk_fresh_func_decl(f->get_name(), symbol::null, f->get_arity(), f->get_domain(), f->get_range());
|
||||||
app * k_app = m.mk_app(k, head->get_num_args(), head->get_args());
|
app * k_app = m.mk_app(k, head->get_num_args(), head->get_args());
|
||||||
expr_ref_buffer new_rhs_args(m);
|
expr_ref_buffer new_rhs_args(m);
|
||||||
|
@ -161,7 +161,7 @@ bool macro_finder::is_arith_macro(expr * n, proof * pr, vector<justified_expr>&
|
||||||
}
|
}
|
||||||
// is ge or le
|
// is ge or le
|
||||||
//
|
//
|
||||||
TRACE("macro_finder", tout << "is_arith_macro: is_ge or is_le\n";);
|
TRACE(macro_finder, tout << "is_arith_macro: is_ge or is_le\n";);
|
||||||
func_decl * k = m.mk_fresh_func_decl(f->get_name(), symbol::null, f->get_arity(), f->get_domain(), f->get_range());
|
func_decl * k = m.mk_fresh_func_decl(f->get_name(), symbol::null, f->get_arity(), f->get_domain(), f->get_range());
|
||||||
app * k_app = m.mk_app(k, head->get_num_args(), head->get_args());
|
app * k_app = m.mk_app(k, head->get_num_args(), head->get_args());
|
||||||
expr_ref_buffer new_rhs_args(m);
|
expr_ref_buffer new_rhs_args(m);
|
||||||
|
@ -270,7 +270,7 @@ macro_finder::macro_finder(ast_manager & m, macro_manager & mm):
|
||||||
}
|
}
|
||||||
|
|
||||||
bool macro_finder::expand_macros(expr_ref_vector const& exprs, proof_ref_vector const& prs, expr_dependency_ref_vector const& deps, expr_ref_vector & new_exprs, proof_ref_vector & new_prs, expr_dependency_ref_vector & new_deps) {
|
bool macro_finder::expand_macros(expr_ref_vector const& exprs, proof_ref_vector const& prs, expr_dependency_ref_vector const& deps, expr_ref_vector & new_exprs, proof_ref_vector & new_prs, expr_dependency_ref_vector & new_deps) {
|
||||||
TRACE("macro_finder", tout << "starting expand_macros:\n";
|
TRACE(macro_finder, tout << "starting expand_macros:\n";
|
||||||
m_macro_manager.display(tout););
|
m_macro_manager.display(tout););
|
||||||
bool found_new_macro = false;
|
bool found_new_macro = false;
|
||||||
unsigned num = exprs.size();
|
unsigned num = exprs.size();
|
||||||
|
@ -286,15 +286,15 @@ bool macro_finder::expand_macros(expr_ref_vector const& exprs, proof_ref_vector
|
||||||
m_macro_manager.expand_macros(n, pr, dep, new_n, new_pr, new_dep);
|
m_macro_manager.expand_macros(n, pr, dep, new_n, new_pr, new_dep);
|
||||||
app_ref head(m), t(m);
|
app_ref head(m), t(m);
|
||||||
if (is_macro(new_n, head, def) && m_macro_manager.insert(head->get_decl(), to_quantifier(new_n.get()), new_pr, new_dep)) {
|
if (is_macro(new_n, head, def) && m_macro_manager.insert(head->get_decl(), to_quantifier(new_n.get()), new_pr, new_dep)) {
|
||||||
TRACE("macro_finder", tout << "found new macro: " << head->get_decl()->get_name() << "\n" << new_n << "\n";);
|
TRACE(macro_finder, tout << "found new macro: " << head->get_decl()->get_name() << "\n" << new_n << "\n";);
|
||||||
found_new_macro = true;
|
found_new_macro = true;
|
||||||
}
|
}
|
||||||
else if (is_arith_macro(new_n, new_pr, deps_valid, new_dep, new_exprs, new_prs, new_deps)) {
|
else if (is_arith_macro(new_n, new_pr, deps_valid, new_dep, new_exprs, new_prs, new_deps)) {
|
||||||
TRACE("macro_finder", tout << "found new arith macro:\n" << new_n << "\n";);
|
TRACE(macro_finder, tout << "found new arith macro:\n" << new_n << "\n";);
|
||||||
found_new_macro = true;
|
found_new_macro = true;
|
||||||
}
|
}
|
||||||
else if (m_util.is_pseudo_predicate_macro(new_n, head, t, def)) {
|
else if (m_util.is_pseudo_predicate_macro(new_n, head, t, def)) {
|
||||||
TRACE("macro_finder", tout << "found new pseudo macro:\n" << head->get_decl()->get_name() << "\n" << t << "\n" << def << "\n";);
|
TRACE(macro_finder, tout << "found new pseudo macro:\n" << head->get_decl()->get_name() << "\n" << t << "\n" << def << "\n";);
|
||||||
pseudo_predicate_macro2macro(m, head, t, def, to_quantifier(new_n), new_pr, deps_valid, new_dep, new_exprs, new_prs, new_deps);
|
pseudo_predicate_macro2macro(m, head, t, def, to_quantifier(new_n), new_pr, deps_valid, new_dep, new_exprs, new_prs, new_deps);
|
||||||
found_new_macro = true;
|
found_new_macro = true;
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ bool macro_finder::expand_macros(expr_ref_vector const& exprs, proof_ref_vector
|
||||||
}
|
}
|
||||||
|
|
||||||
void macro_finder::operator()(expr_ref_vector const& exprs, proof_ref_vector const & prs, expr_dependency_ref_vector const & deps, expr_ref_vector & new_exprs, proof_ref_vector & new_prs, expr_dependency_ref_vector & new_deps) {
|
void macro_finder::operator()(expr_ref_vector const& exprs, proof_ref_vector const & prs, expr_dependency_ref_vector const & deps, expr_ref_vector & new_exprs, proof_ref_vector & new_prs, expr_dependency_ref_vector & new_deps) {
|
||||||
TRACE("macro_finder", tout << "processing macros...\n";);
|
TRACE(macro_finder, tout << "processing macros...\n";);
|
||||||
expr_ref_vector _new_exprs(m);
|
expr_ref_vector _new_exprs(m);
|
||||||
proof_ref_vector _new_prs(m);
|
proof_ref_vector _new_prs(m);
|
||||||
expr_dependency_ref_vector _new_deps(m);
|
expr_dependency_ref_vector _new_deps(m);
|
||||||
|
@ -342,7 +342,7 @@ void macro_finder::operator()(expr_ref_vector const& exprs, proof_ref_vector con
|
||||||
|
|
||||||
|
|
||||||
bool macro_finder::expand_macros(unsigned num, justified_expr const * fmls, vector<justified_expr>& new_fmls) {
|
bool macro_finder::expand_macros(unsigned num, justified_expr const * fmls, vector<justified_expr>& new_fmls) {
|
||||||
TRACE("macro_finder", tout << "starting expand_macros:\n";
|
TRACE(macro_finder, tout << "starting expand_macros:\n";
|
||||||
m_macro_manager.display(tout););
|
m_macro_manager.display(tout););
|
||||||
bool found_new_macro = false;
|
bool found_new_macro = false;
|
||||||
for (unsigned i = 0; i < num; i++) {
|
for (unsigned i = 0; i < num; i++) {
|
||||||
|
@ -354,15 +354,15 @@ bool macro_finder::expand_macros(unsigned num, justified_expr const * fmls, vect
|
||||||
m_macro_manager.expand_macros(n, pr, nullptr, new_n, new_pr, new_dep);
|
m_macro_manager.expand_macros(n, pr, nullptr, new_n, new_pr, new_dep);
|
||||||
app_ref head(m), t(m);
|
app_ref head(m), t(m);
|
||||||
if (is_macro(new_n, head, def) && m_macro_manager.insert(head->get_decl(), to_quantifier(new_n.get()), new_pr)) {
|
if (is_macro(new_n, head, def) && m_macro_manager.insert(head->get_decl(), to_quantifier(new_n.get()), new_pr)) {
|
||||||
TRACE("macro_finder", tout << "found new macro: " << head->get_decl()->get_name() << "\n" << new_n << "\n";);
|
TRACE(macro_finder, tout << "found new macro: " << head->get_decl()->get_name() << "\n" << new_n << "\n";);
|
||||||
found_new_macro = true;
|
found_new_macro = true;
|
||||||
}
|
}
|
||||||
else if (is_arith_macro(new_n, new_pr, new_fmls)) {
|
else if (is_arith_macro(new_n, new_pr, new_fmls)) {
|
||||||
TRACE("macro_finder", tout << "found new arith macro:\n" << new_n << "\n";);
|
TRACE(macro_finder, tout << "found new arith macro:\n" << new_n << "\n";);
|
||||||
found_new_macro = true;
|
found_new_macro = true;
|
||||||
}
|
}
|
||||||
else if (m_util.is_pseudo_predicate_macro(new_n, head, t, def)) {
|
else if (m_util.is_pseudo_predicate_macro(new_n, head, t, def)) {
|
||||||
TRACE("macro_finder", tout << "found new pseudo macro:\n" << head << "\n" << t << "\n" << def << "\n";);
|
TRACE(macro_finder, tout << "found new pseudo macro:\n" << head << "\n" << t << "\n" << def << "\n";);
|
||||||
pseudo_predicate_macro2macro(m, head, t, def, to_quantifier(new_n), new_pr, new_fmls);
|
pseudo_predicate_macro2macro(m, head, t, def, to_quantifier(new_n), new_pr, new_fmls);
|
||||||
found_new_macro = true;
|
found_new_macro = true;
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,7 @@ void macro_finder::revert_unsafe_macros(vector<justified_expr>& new_fmls) {
|
||||||
|
|
||||||
void macro_finder::operator()(unsigned n, justified_expr const* fmls, vector<justified_expr>& new_fmls) {
|
void macro_finder::operator()(unsigned n, justified_expr const* fmls, vector<justified_expr>& new_fmls) {
|
||||||
m_macro_manager.unsafe_macros().reset();
|
m_macro_manager.unsafe_macros().reset();
|
||||||
TRACE("macro_finder", tout << "processing macros...\n";);
|
TRACE(macro_finder, tout << "processing macros...\n";);
|
||||||
vector<justified_expr> _new_fmls;
|
vector<justified_expr> _new_fmls;
|
||||||
if (expand_macros(n, fmls, _new_fmls)) {
|
if (expand_macros(n, fmls, _new_fmls)) {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
|
@ -114,11 +114,11 @@ void macro_manager::copy_to(macro_manager& dst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool macro_manager::insert(func_decl * f, quantifier * q, proof * pr, expr_dependency* dep) {
|
bool macro_manager::insert(func_decl * f, quantifier * q, proof * pr, expr_dependency* dep) {
|
||||||
TRACE("macro_insert", tout << "trying to create macro: " << f->get_name() << "\n" << mk_pp(q, m) << "\n";);
|
TRACE(macro_insert, tout << "trying to create macro: " << f->get_name() << "\n" << mk_pp(q, m) << "\n";);
|
||||||
|
|
||||||
// if we already have a macro for f then return false;
|
// if we already have a macro for f then return false;
|
||||||
if (m_decls.contains(f)) {
|
if (m_decls.contains(f)) {
|
||||||
TRACE("macro_insert", tout << "we already have a macro for: " << f->get_name() << "\n";);
|
TRACE(macro_insert, tout << "we already have a macro for: " << f->get_name() << "\n";);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ bool macro_manager::insert(func_decl * f, quantifier * q, proof * pr, expr_depen
|
||||||
m_macro_deps.push_back(dep);
|
m_macro_deps.push_back(dep);
|
||||||
m_decl2macro_dep.insert(f, dep);
|
m_decl2macro_dep.insert(f, dep);
|
||||||
|
|
||||||
TRACE("macro_insert", tout << "A macro was successfully created for: " << f->get_name() << "\n";);
|
TRACE(macro_insert, tout << "A macro was successfully created for: " << f->get_name() << "\n";);
|
||||||
|
|
||||||
// Nothing's forbidden anymore; if something's bad, we detected it earlier.
|
// Nothing's forbidden anymore; if something's bad, we detected it earlier.
|
||||||
// mark_forbidden(m->get_expr());
|
// mark_forbidden(m->get_expr());
|
||||||
|
@ -223,7 +223,7 @@ func_decl * macro_manager::get_macro_interpretation(unsigned i, expr_ref & inter
|
||||||
expr_ref def(m);
|
expr_ref def(m);
|
||||||
bool r;
|
bool r;
|
||||||
get_head_def(q, f, head, def, r);
|
get_head_def(q, f, head, def, r);
|
||||||
TRACE("macro_bug",
|
TRACE(macro_bug,
|
||||||
tout << f->get_name() << "\n" << mk_pp(head, m) << "\n" << mk_pp(q, m) << "\n";);
|
tout << f->get_name() << "\n" << mk_pp(head, m) << "\n" << mk_pp(q, m) << "\n";);
|
||||||
m_util.mk_macro_interpretation(head, q->get_num_decls(), def, interp);
|
m_util.mk_macro_interpretation(head, q->get_num_decls(), def, interp);
|
||||||
return f;
|
return f;
|
||||||
|
@ -290,7 +290,7 @@ struct macro_manager::macro_expander_cfg : public default_rewriter_cfg {
|
||||||
app * n = to_app(_n);
|
app * n = to_app(_n);
|
||||||
quantifier * q = nullptr;
|
quantifier * q = nullptr;
|
||||||
func_decl * d = n->get_decl(), *d2 = nullptr;
|
func_decl * d = n->get_decl(), *d2 = nullptr;
|
||||||
TRACE("macro_manager", tout << "trying to expand:\n" << mk_pp(n, m) << "\nd:\n" << d->get_name() << "\n";);
|
TRACE(macro_manager, tout << "trying to expand:\n" << mk_pp(n, m) << "\nd:\n" << d->get_name() << "\n";);
|
||||||
if (mm.m_decl2macro.find(d, q)) {
|
if (mm.m_decl2macro.find(d, q)) {
|
||||||
app * head = nullptr;
|
app * head = nullptr;
|
||||||
expr_ref def(m);
|
expr_ref def(m);
|
||||||
|
@ -298,7 +298,7 @@ struct macro_manager::macro_expander_cfg : public default_rewriter_cfg {
|
||||||
mm.get_head_def(q, d, head, def, revert);
|
mm.get_head_def(q, d, head, def, revert);
|
||||||
unsigned num = n->get_num_args();
|
unsigned num = n->get_num_args();
|
||||||
SASSERT(head && def);
|
SASSERT(head && def);
|
||||||
TRACE("macro_manager", tout << "expanding: " << mk_pp(n, m) << "\n" << mk_pp(head, m) << " " << mk_pp(def, m) << "\n";);
|
TRACE(macro_manager, tout << "expanding: " << mk_pp(n, m) << "\n" << mk_pp(head, m) << " " << mk_pp(def, m) << "\n";);
|
||||||
ptr_buffer<expr> subst_args;
|
ptr_buffer<expr> subst_args;
|
||||||
subst_args.resize(num, 0);
|
subst_args.resize(num, 0);
|
||||||
for (unsigned i = 0; i < num; i++) {
|
for (unsigned i = 0; i < num; i++) {
|
||||||
|
@ -377,7 +377,7 @@ void macro_manager::expand_macros(expr * n, proof * pr, expr_dependency * dep, e
|
||||||
macro_expander_rw proc(m, *this);
|
macro_expander_rw proc(m, *this);
|
||||||
proof_ref n_eq_r_pr(m);
|
proof_ref n_eq_r_pr(m);
|
||||||
SASSERT(!old_pr || m.get_fact(old_pr) == old_n);
|
SASSERT(!old_pr || m.get_fact(old_pr) == old_n);
|
||||||
TRACE("macro_manager_bug", tout << "expand_macros:\n" << mk_pp(n, m) << "\n";);
|
TRACE(macro_manager_bug, tout << "expand_macros:\n" << mk_pp(n, m) << "\n";);
|
||||||
proc(old_n, r, n_eq_r_pr);
|
proc(old_n, r, n_eq_r_pr);
|
||||||
new_pr = m.mk_modus_ponens(old_pr, n_eq_r_pr);
|
new_pr = m.mk_modus_ponens(old_pr, n_eq_r_pr);
|
||||||
new_dep = m.mk_join(old_dep, proc.m_cfg.m_used_macro_dependencies);
|
new_dep = m.mk_join(old_dep, proc.m_cfg.m_used_macro_dependencies);
|
||||||
|
|
|
@ -312,7 +312,7 @@ bool macro_util::is_arith_macro(expr * n, unsigned num_decls, app_ref & head, ex
|
||||||
mk_sub(tmp, rhs, def);
|
mk_sub(tmp, rhs, def);
|
||||||
else
|
else
|
||||||
mk_sub(rhs, tmp, def);
|
mk_sub(rhs, tmp, def);
|
||||||
TRACE("macro_util", tout << def << "\n";);
|
TRACE(macro_util, tout << def << "\n";);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ bool macro_util::is_pseudo_head(expr * n, unsigned num_decls, app_ref & head, ap
|
||||||
bool macro_util::is_pseudo_predicate_macro(expr * n, app_ref & head, app_ref & t, expr_ref & def) {
|
bool macro_util::is_pseudo_predicate_macro(expr * n, app_ref & head, app_ref & t, expr_ref & def) {
|
||||||
if (!is_forall(n))
|
if (!is_forall(n))
|
||||||
return false;
|
return false;
|
||||||
TRACE("macro_util", tout << "processing: " << mk_pp(n, m) << "\n";);
|
TRACE(macro_util, tout << "processing: " << mk_pp(n, m) << "\n";);
|
||||||
expr * body = to_quantifier(n)->get_expr();
|
expr * body = to_quantifier(n)->get_expr();
|
||||||
unsigned num_decls = to_quantifier(n)->get_num_decls();
|
unsigned num_decls = to_quantifier(n)->get_num_decls();
|
||||||
expr * lhs, *rhs;
|
expr * lhs, *rhs;
|
||||||
|
@ -483,7 +483,7 @@ void macro_util::quasi_macro_head_to_macro_head(app * qhead, unsigned & num_decl
|
||||||
See normalize_expr
|
See normalize_expr
|
||||||
*/
|
*/
|
||||||
void macro_util::mk_macro_interpretation(app * head, unsigned num_decls, expr * def, expr_ref & interp) const {
|
void macro_util::mk_macro_interpretation(app * head, unsigned num_decls, expr * def, expr_ref & interp) const {
|
||||||
TRACE("macro_util", tout << mk_pp(head, m) << "\n" << mk_pp(def, m) << "\n";);
|
TRACE(macro_util, tout << mk_pp(head, m) << "\n" << mk_pp(def, m) << "\n";);
|
||||||
SASSERT(is_macro_head(head, head->get_num_args()) ||
|
SASSERT(is_macro_head(head, head->get_num_args()) ||
|
||||||
is_quasi_macro_ok(head, head->get_num_args(), def));
|
is_quasi_macro_ok(head, head->get_num_args(), def));
|
||||||
SASSERT(!occurs(head->get_decl(), def));
|
SASSERT(!occurs(head->get_decl(), def));
|
||||||
|
@ -505,7 +505,7 @@ void macro_util::normalize_expr(app * head, unsigned num_decls, expr * t, expr_r
|
||||||
var_mapping.resize(num_decls);
|
var_mapping.resize(num_decls);
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
unsigned num_args = head->get_num_args();
|
unsigned num_args = head->get_num_args();
|
||||||
TRACE("macro_util",
|
TRACE(macro_util,
|
||||||
tout << "head: " << mk_pp(head, m) << "\n";
|
tout << "head: " << mk_pp(head, m) << "\n";
|
||||||
tout << "applying substitution to:\n" << mk_bounded_pp(t, m) << "\n";);
|
tout << "applying substitution to:\n" << mk_bounded_pp(t, m) << "\n";);
|
||||||
for (unsigned i = 0; i < num_args; i++) {
|
for (unsigned i = 0; i < num_args; i++) {
|
||||||
|
@ -524,7 +524,7 @@ void macro_util::normalize_expr(app * head, unsigned num_decls, expr * t, expr_r
|
||||||
if (changed) {
|
if (changed) {
|
||||||
// REMARK: t may have nested quantifiers... So, I must use the std order for variable substitution.
|
// REMARK: t may have nested quantifiers... So, I must use the std order for variable substitution.
|
||||||
var_subst subst(m, true);
|
var_subst subst(m, true);
|
||||||
TRACE("macro_util",
|
TRACE(macro_util,
|
||||||
tout << "head: " << mk_pp(head, m) << "\n";
|
tout << "head: " << mk_pp(head, m) << "\n";
|
||||||
tout << "applying substitution to:\n" << mk_ll_pp(t, m) << "\nsubstitution:\n";
|
tout << "applying substitution to:\n" << mk_ll_pp(t, m) << "\nsubstitution:\n";
|
||||||
for (unsigned i = 0; i < var_mapping.size(); i++) {
|
for (unsigned i = 0; i < var_mapping.size(); i++) {
|
||||||
|
@ -633,12 +633,12 @@ void hint_to_macro_head(ast_manager & m, app * head, unsigned & num_decls, app_r
|
||||||
is_hint_head(head, vars) must also return true
|
is_hint_head(head, vars) must also return true
|
||||||
*/
|
*/
|
||||||
bool macro_util::is_poly_hint(expr * n, app * head, expr * exception) {
|
bool macro_util::is_poly_hint(expr * n, app * head, expr * exception) {
|
||||||
TRACE("macro_util", tout << "is_poly_hint n:\n" << mk_pp(n, m) << "\nhead:\n" << mk_pp(head, m) << "\nexception:\n";
|
TRACE(macro_util, tout << "is_poly_hint n:\n" << mk_pp(n, m) << "\nhead:\n" << mk_pp(head, m) << "\nexception:\n";
|
||||||
if (exception) tout << mk_pp(exception, m); else tout << "<null>";
|
if (exception) tout << mk_pp(exception, m); else tout << "<null>";
|
||||||
tout << "\n";);
|
tout << "\n";);
|
||||||
ptr_buffer<var> vars;
|
ptr_buffer<var> vars;
|
||||||
if (!is_hint_head(head, vars)) {
|
if (!is_hint_head(head, vars)) {
|
||||||
TRACE("macro_util", tout << "failed because head is not hint head\n";);
|
TRACE(macro_util, tout << "failed because head is not hint head\n";);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
func_decl * f = head->get_decl();
|
func_decl * f = head->get_decl();
|
||||||
|
@ -655,11 +655,11 @@ bool macro_util::is_poly_hint(expr * n, app * head, expr * exception) {
|
||||||
for (unsigned i = 0; i < num_args; i++) {
|
for (unsigned i = 0; i < num_args; i++) {
|
||||||
expr * arg = args[i];
|
expr * arg = args[i];
|
||||||
if (arg != exception && (occurs(f, arg) || !vars_of_is_subset(arg, vars))) {
|
if (arg != exception && (occurs(f, arg) || !vars_of_is_subset(arg, vars))) {
|
||||||
TRACE("macro_util", tout << "failed because of:\n" << mk_pp(arg, m) << "\n";);
|
TRACE(macro_util, tout << "failed because of:\n" << mk_pp(arg, m) << "\n";);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("macro_util", tout << "succeeded\n";);
|
TRACE(macro_util, tout << "succeeded\n";);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -714,7 +714,7 @@ void macro_util::insert_macro(app * head, unsigned num_decls, expr * def, expr *
|
||||||
|
|
||||||
void macro_util::insert_quasi_macro(app * head, unsigned num_decls, expr * def, expr * cond, bool ineq, bool satisfy_atom,
|
void macro_util::insert_quasi_macro(app * head, unsigned num_decls, expr * def, expr * cond, bool ineq, bool satisfy_atom,
|
||||||
bool hint, macro_candidates & r) {
|
bool hint, macro_candidates & r) {
|
||||||
TRACE("macro_util", tout << expr_ref(head, m) << "\n";);
|
TRACE(macro_util, tout << expr_ref(head, m) << "\n";);
|
||||||
if (!is_macro_head(head, head->get_num_args())) {
|
if (!is_macro_head(head, head->get_num_args())) {
|
||||||
app_ref new_head(m);
|
app_ref new_head(m);
|
||||||
expr_ref extra_cond(m);
|
expr_ref extra_cond(m);
|
||||||
|
@ -728,7 +728,7 @@ void macro_util::insert_quasi_macro(app * head, unsigned num_decls, expr * def,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hint_to_macro_head(m, head, num_decls, new_head);
|
hint_to_macro_head(m, head, num_decls, new_head);
|
||||||
TRACE("macro_util",
|
TRACE(macro_util,
|
||||||
tout << "hint macro head: " << mk_ismt2_pp(new_head, m) << std::endl;
|
tout << "hint macro head: " << mk_ismt2_pp(new_head, m) << std::endl;
|
||||||
tout << "hint macro def: " << mk_ismt2_pp(def, m) << std::endl; );
|
tout << "hint macro def: " << mk_ismt2_pp(def, m) << std::endl; );
|
||||||
}
|
}
|
||||||
|
@ -863,7 +863,7 @@ void macro_util::collect_arith_macro_candidates(expr * lhs, expr * rhs, expr * a
|
||||||
}
|
}
|
||||||
|
|
||||||
void macro_util::collect_arith_macro_candidates(expr * atom, unsigned num_decls, macro_candidates & r) {
|
void macro_util::collect_arith_macro_candidates(expr * atom, unsigned num_decls, macro_candidates & r) {
|
||||||
TRACE("macro_util", tout << "collect_arith_macro_candidates:\n" << mk_pp(atom, m) << "\n";);
|
TRACE(macro_util, tout << "collect_arith_macro_candidates:\n" << mk_pp(atom, m) << "\n";);
|
||||||
if (!m.is_eq(atom) && !is_le_ge(atom))
|
if (!m.is_eq(atom) && !is_le_ge(atom))
|
||||||
return;
|
return;
|
||||||
expr * lhs = to_app(atom)->get_arg(0);
|
expr * lhs = to_app(atom)->get_arg(0);
|
||||||
|
@ -912,7 +912,7 @@ void macro_util::collect_arith_macro_candidates(expr * atom, unsigned num_decls,
|
||||||
void macro_util::collect_macro_candidates_core(expr * atom, unsigned num_decls, macro_candidates & r) {
|
void macro_util::collect_macro_candidates_core(expr * atom, unsigned num_decls, macro_candidates & r) {
|
||||||
expr* lhs, *rhs;
|
expr* lhs, *rhs;
|
||||||
|
|
||||||
TRACE("macro_util", tout << "Candidate check for: " << mk_ismt2_pp(atom, m) << std::endl;);
|
TRACE(macro_util, tout << "Candidate check for: " << mk_ismt2_pp(atom, m) << std::endl;);
|
||||||
|
|
||||||
auto insert_quasi = [&](expr* lhs, expr* rhs) {
|
auto insert_quasi = [&](expr* lhs, expr* rhs) {
|
||||||
if (is_quasi_macro_head(lhs, num_decls) &&
|
if (is_quasi_macro_head(lhs, num_decls) &&
|
||||||
|
|
|
@ -157,7 +157,7 @@ bool quasi_macros::is_quasi_macro(expr * e, app_ref & a, expr_ref & t) const {
|
||||||
// Our definition of a quasi-macro:
|
// Our definition of a quasi-macro:
|
||||||
// Forall X. f[X] = T[X], where f[X] is a term starting with symbol f, f is uninterpreted,
|
// Forall X. f[X] = T[X], where f[X] is a term starting with symbol f, f is uninterpreted,
|
||||||
// f[X] contains all universally quantified variables, and f does not occur in T[X].
|
// f[X] contains all universally quantified variables, and f does not occur in T[X].
|
||||||
TRACE("quasi_macros", tout << "Checking for quasi macro: " << mk_pp(e, m) << std::endl;);
|
TRACE(quasi_macros, tout << "Checking for quasi macro: " << mk_pp(e, m) << std::endl;);
|
||||||
|
|
||||||
if (is_forall(e)) {
|
if (is_forall(e)) {
|
||||||
quantifier * q = to_quantifier(e);
|
quantifier * q = to_quantifier(e);
|
||||||
|
@ -273,7 +273,7 @@ bool quasi_macros::quasi_macro_to_macro(quantifier * q, app * a, expr * t, quant
|
||||||
}
|
}
|
||||||
|
|
||||||
bool quasi_macros::find_macros(unsigned n, expr * const * exprs) {
|
bool quasi_macros::find_macros(unsigned n, expr * const * exprs) {
|
||||||
TRACE("quasi_macros", tout << "Finding quasi-macros in: " << std::endl;
|
TRACE(quasi_macros, tout << "Finding quasi-macros in: " << std::endl;
|
||||||
for (unsigned i = 0 ; i < n ; i++)
|
for (unsigned i = 0 ; i < n ; i++)
|
||||||
tout << i << ": " << mk_pp(exprs[i], m) << std::endl; );
|
tout << i << ": " << mk_pp(exprs[i], m) << std::endl; );
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
@ -284,7 +284,7 @@ bool quasi_macros::find_macros(unsigned n, expr * const * exprs) {
|
||||||
for (unsigned i = 0 ; i < n ; i++)
|
for (unsigned i = 0 ; i < n ; i++)
|
||||||
find_occurrences(exprs[i]);
|
find_occurrences(exprs[i]);
|
||||||
|
|
||||||
TRACE("quasi_macros",
|
TRACE(quasi_macros,
|
||||||
tout << "Occurrences: " << std::endl;
|
tout << "Occurrences: " << std::endl;
|
||||||
for (auto & kd : m_occurrences)
|
for (auto & kd : m_occurrences)
|
||||||
tout << kd.m_key->get_name() << ": " << kd.m_value << std::endl; );
|
tout << kd.m_key->get_name() << ": " << kd.m_value << std::endl; );
|
||||||
|
@ -296,7 +296,7 @@ bool quasi_macros::find_macros(unsigned n, expr * const * exprs) {
|
||||||
quantifier_ref macro(m);
|
quantifier_ref macro(m);
|
||||||
if (is_quasi_macro(exprs[i], a, t) &&
|
if (is_quasi_macro(exprs[i], a, t) &&
|
||||||
quasi_macro_to_macro(to_quantifier(exprs[i]), a, t, macro)) {
|
quasi_macro_to_macro(to_quantifier(exprs[i]), a, t, macro)) {
|
||||||
TRACE("quasi_macros", tout << "Found quasi macro: " << mk_pp(exprs[i], m) << std::endl;
|
TRACE(quasi_macros, tout << "Found quasi macro: " << mk_pp(exprs[i], m) << std::endl;
|
||||||
tout << "Macro: " << mk_pp(macro, m) << std::endl; );
|
tout << "Macro: " << mk_pp(macro, m) << std::endl; );
|
||||||
proof * pr = nullptr;
|
proof * pr = nullptr;
|
||||||
if (m.proofs_enabled())
|
if (m.proofs_enabled())
|
||||||
|
@ -311,7 +311,7 @@ bool quasi_macros::find_macros(unsigned n, expr * const * exprs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool quasi_macros::find_macros(unsigned n, justified_expr const * exprs) {
|
bool quasi_macros::find_macros(unsigned n, justified_expr const * exprs) {
|
||||||
TRACE("quasi_macros", tout << "Finding quasi-macros in: " << std::endl;
|
TRACE(quasi_macros, tout << "Finding quasi-macros in: " << std::endl;
|
||||||
for (unsigned i = 0; i < n; i++)
|
for (unsigned i = 0; i < n; i++)
|
||||||
tout << i << ": " << mk_pp(exprs[i].fml(), m) << std::endl; );
|
tout << i << ": " << mk_pp(exprs[i].fml(), m) << std::endl; );
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
@ -322,7 +322,7 @@ bool quasi_macros::find_macros(unsigned n, justified_expr const * exprs) {
|
||||||
for (unsigned i = 0 ; i < n ; i++)
|
for (unsigned i = 0 ; i < n ; i++)
|
||||||
find_occurrences(exprs[i].fml());
|
find_occurrences(exprs[i].fml());
|
||||||
|
|
||||||
TRACE("quasi_macros", tout << "Occurrences: " << std::endl;
|
TRACE(quasi_macros, tout << "Occurrences: " << std::endl;
|
||||||
for (auto kv : m_occurrences)
|
for (auto kv : m_occurrences)
|
||||||
tout << kv.m_key->get_name() << ": " << kv.m_value << std::endl; );
|
tout << kv.m_key->get_name() << ": " << kv.m_value << std::endl; );
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ bool quasi_macros::find_macros(unsigned n, justified_expr const * exprs) {
|
||||||
quantifier_ref macro(m);
|
quantifier_ref macro(m);
|
||||||
if (is_quasi_macro(exprs[i].fml(), a, t) &&
|
if (is_quasi_macro(exprs[i].fml(), a, t) &&
|
||||||
quasi_macro_to_macro(to_quantifier(exprs[i].fml()), a, t, macro)) {
|
quasi_macro_to_macro(to_quantifier(exprs[i].fml()), a, t, macro)) {
|
||||||
TRACE("quasi_macros", tout << "Found quasi macro: " << mk_pp(exprs[i].fml(), m) << std::endl;
|
TRACE(quasi_macros, tout << "Found quasi macro: " << mk_pp(exprs[i].fml(), m) << std::endl;
|
||||||
tout << "Macro: " << mk_pp(macro, m) << std::endl; );
|
tout << "Macro: " << mk_pp(macro, m) << std::endl; );
|
||||||
proof * pr = nullptr;
|
proof * pr = nullptr;
|
||||||
if (m.proofs_enabled())
|
if (m.proofs_enabled())
|
||||||
|
@ -387,7 +387,7 @@ void quasi_macros::apply_macros(unsigned n, justified_expr const* fmls, vector<j
|
||||||
}
|
}
|
||||||
|
|
||||||
bool quasi_macros::operator()(unsigned n, justified_expr const* fmls, vector<justified_expr>& new_fmls) {
|
bool quasi_macros::operator()(unsigned n, justified_expr const* fmls, vector<justified_expr>& new_fmls) {
|
||||||
TRACE("quasi_macros", m_macro_manager.display(tout););
|
TRACE(quasi_macros, m_macro_manager.display(tout););
|
||||||
if (find_macros(n, fmls)) {
|
if (find_macros(n, fmls)) {
|
||||||
apply_macros(n, fmls, new_fmls);
|
apply_macros(n, fmls, new_fmls);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -163,9 +163,9 @@ void defined_names::impl::bound_vars(sort_ref_buffer const & sorts, buffer<symbo
|
||||||
def_conjunct,
|
def_conjunct,
|
||||||
1, qid, symbol::null,
|
1, qid, symbol::null,
|
||||||
1, patterns);
|
1, patterns);
|
||||||
TRACE("mk_definition_bug", tout << "before elim_unused_vars:\n" << mk_ismt2_pp(q, m) << "\n";);
|
TRACE(mk_definition_bug, tout << "before elim_unused_vars:\n" << mk_ismt2_pp(q, m) << "\n";);
|
||||||
result = elim_unused_vars(m, q, params_ref());
|
result = elim_unused_vars(m, q, params_ref());
|
||||||
TRACE("mk_definition_bug", tout << "after elim_unused_vars:\n" << result << "\n";);
|
TRACE(mk_definition_bug, tout << "after elim_unused_vars:\n" << result << "\n";);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,11 +242,11 @@ void defined_names::pos_impl::mk_definition(expr * e, app * n, sort_ref_buffer &
|
||||||
}
|
}
|
||||||
|
|
||||||
bool defined_names::impl::mk_name(expr * e, expr_ref & new_def, proof_ref & new_def_pr, app_ref & n, proof_ref & pr) {
|
bool defined_names::impl::mk_name(expr * e, expr_ref & new_def, proof_ref & new_def_pr, app_ref & n, proof_ref & pr) {
|
||||||
TRACE("mk_definition_bug", tout << "making name for:\n" << mk_ismt2_pp(e, m) << "\n";);
|
TRACE(mk_definition_bug, tout << "making name for:\n" << mk_ismt2_pp(e, m) << "\n";);
|
||||||
|
|
||||||
app * n_ptr;
|
app * n_ptr;
|
||||||
if (m_expr2name.find(e, n_ptr)) {
|
if (m_expr2name.find(e, n_ptr)) {
|
||||||
TRACE("mk_definition_bug", tout << "name for expression is already cached..., returning false...\n";);
|
TRACE(mk_definition_bug, tout << "name for expression is already cached..., returning false...\n";);
|
||||||
n = n_ptr;
|
n = n_ptr;
|
||||||
if (m.proofs_enabled()) {
|
if (m.proofs_enabled()) {
|
||||||
proof * pr_ptr = nullptr;
|
proof * pr_ptr = nullptr;
|
||||||
|
@ -263,14 +263,14 @@ bool defined_names::impl::mk_name(expr * e, expr_ref & new_def, proof_ref & new_
|
||||||
n = gen_name(e, var_sorts, var_names);
|
n = gen_name(e, var_sorts, var_names);
|
||||||
cache_new_name(e, n);
|
cache_new_name(e, n);
|
||||||
|
|
||||||
TRACE("mk_definition_bug", tout << "name: " << mk_ismt2_pp(n, m) << "\n";);
|
TRACE(mk_definition_bug, tout << "name: " << mk_ismt2_pp(n, m) << "\n";);
|
||||||
// variables are in reverse order in quantifiers
|
// variables are in reverse order in quantifiers
|
||||||
std::reverse(var_sorts.data(), var_sorts.data() + var_sorts.size());
|
std::reverse(var_sorts.data(), var_sorts.data() + var_sorts.size());
|
||||||
std::reverse(var_names.data(), var_names.data() + var_names.size());
|
std::reverse(var_names.data(), var_names.data() + var_names.size());
|
||||||
|
|
||||||
mk_definition(e, n, var_sorts, var_names, new_def);
|
mk_definition(e, n, var_sorts, var_names, new_def);
|
||||||
|
|
||||||
TRACE("mk_definition_bug", tout << "new_def:\n" << mk_ismt2_pp(new_def, m) << "\n";);
|
TRACE(mk_definition_bug, tout << "new_def:\n" << mk_ismt2_pp(new_def, m) << "\n";);
|
||||||
|
|
||||||
if (m.proofs_enabled()) {
|
if (m.proofs_enabled()) {
|
||||||
new_def_pr = m.mk_def_intro(new_def);
|
new_def_pr = m.mk_def_intro(new_def);
|
||||||
|
|
|
@ -34,7 +34,7 @@ br_status elim_term_ite_cfg::reduce_app(func_decl* f, unsigned n, expr * const*
|
||||||
}
|
}
|
||||||
result = new_r;
|
result = new_r;
|
||||||
|
|
||||||
CTRACE("elim_term_ite_bug", new_def.get() == 0, tout << mk_ismt2_pp(r, m) << "\n";);
|
CTRACE(elim_term_ite_bug, new_def.get() == 0, tout << mk_ismt2_pp(r, m) << "\n";);
|
||||||
m_new_defs.push_back(justified_expr(m, new_def, new_def_pr));
|
m_new_defs.push_back(justified_expr(m, new_def, new_def_pr));
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ class name_exprs_core : public name_exprs {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_subst(expr * s, expr * & t, proof * & t_pr) {
|
bool get_subst(expr * s, expr * & t, proof * & t_pr) {
|
||||||
TRACE("name_exprs", tout << "get_subst:\n" << mk_ismt2_pp(s, m) << "\n";);
|
TRACE(name_exprs, tout << "get_subst:\n" << mk_ismt2_pp(s, m) << "\n";);
|
||||||
if (m_pred(s)) {
|
if (m_pred(s)) {
|
||||||
gen_name_for_expr(s, t, t_pr);
|
gen_name_for_expr(s, t, t_pr);
|
||||||
return true;
|
return true;
|
||||||
|
@ -81,7 +81,7 @@ public:
|
||||||
m_cfg.m_def_exprs = &new_defs;
|
m_cfg.m_def_exprs = &new_defs;
|
||||||
m_cfg.m_def_proofs = &new_def_proofs;
|
m_cfg.m_def_proofs = &new_def_proofs;
|
||||||
m_rw(n, r, p);
|
m_rw(n, r, p);
|
||||||
TRACE("name_exprs", tout << mk_ismt2_pp(n, m_rw.m()) << "\n---->\n" << r << "\n";);
|
TRACE(name_exprs, tout << mk_ismt2_pp(n, m_rw.m()) << "\n---->\n" << r << "\n";);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ class name_nested_formulas : public name_exprs_core {
|
||||||
pred(ast_manager & m):m(m), m_root(nullptr) {}
|
pred(ast_manager & m):m(m), m_root(nullptr) {}
|
||||||
|
|
||||||
bool operator()(expr * t) override {
|
bool operator()(expr * t) override {
|
||||||
TRACE("name_exprs", tout << "name_nested_formulas::pred:\n" << mk_ismt2_pp(t, m) << "\n";);
|
TRACE(name_exprs, tout << "name_nested_formulas::pred:\n" << mk_ismt2_pp(t, m) << "\n";);
|
||||||
if (is_app(t))
|
if (is_app(t))
|
||||||
return to_app(t)->get_family_id() == m.get_basic_family_id() && to_app(t)->get_num_args() > 0 && t != m_root;
|
return to_app(t)->get_family_id() == m.get_basic_family_id() && to_app(t)->get_num_args() > 0 && t != m_root;
|
||||||
return m.is_label(t) || is_quantifier(t);
|
return m.is_label(t) || is_quantifier(t);
|
||||||
|
@ -141,7 +141,7 @@ public:
|
||||||
|
|
||||||
void operator()(expr * n, expr_ref_vector & new_defs, proof_ref_vector & new_def_proofs, expr_ref & r, proof_ref & p) override {
|
void operator()(expr * n, expr_ref_vector & new_defs, proof_ref_vector & new_def_proofs, expr_ref & r, proof_ref & p) override {
|
||||||
m_pred.m_root = n;
|
m_pred.m_root = n;
|
||||||
TRACE("name_exprs", tout << "operator()\n";);
|
TRACE(name_exprs, tout << "operator()\n";);
|
||||||
name_exprs_core::operator()(n, new_defs, new_def_proofs, r, p);
|
name_exprs_core::operator()(n, new_defs, new_def_proofs, r, p);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,7 +80,7 @@ class skolemizer {
|
||||||
|
|
||||||
void process(quantifier * q, expr_ref & r, proof_ref & p) {
|
void process(quantifier * q, expr_ref & r, proof_ref & p) {
|
||||||
if (q->get_kind() == lambda_k) {
|
if (q->get_kind() == lambda_k) {
|
||||||
TRACE("nnf", tout << expr_ref(q, m) << "\n";);
|
TRACE(nnf, tout << expr_ref(q, m) << "\n";);
|
||||||
r = q;
|
r = q;
|
||||||
p = nullptr;
|
p = nullptr;
|
||||||
return;
|
return;
|
||||||
|
@ -99,7 +99,7 @@ class skolemizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("skolemizer", tout << "skid: " << q->get_skid() << "\n";);
|
TRACE(skolemizer, tout << "skid: " << q->get_skid() << "\n";);
|
||||||
|
|
||||||
expr_ref_vector substitution(m);
|
expr_ref_vector substitution(m);
|
||||||
unsigned num_decls = q->get_num_decls();
|
unsigned num_decls = q->get_num_decls();
|
||||||
|
@ -301,7 +301,7 @@ struct nnf::imp {
|
||||||
else
|
else
|
||||||
throw nnf_params_exception("invalid NNF mode");
|
throw nnf_params_exception("invalid NNF mode");
|
||||||
|
|
||||||
TRACE("nnf", tout << "nnf-mode: " << m_mode << " " << mode_sym << "\n" << _p << "\n";);
|
TRACE(nnf, tout << "nnf-mode: " << m_mode << " " << mode_sym << "\n" << _p << "\n";);
|
||||||
|
|
||||||
m_ignore_labels = p.ignore_labels();
|
m_ignore_labels = p.ignore_labels();
|
||||||
m_max_memory = megabytes_to_bytes(p.max_memory());
|
m_max_memory = megabytes_to_bytes(p.max_memory());
|
||||||
|
@ -706,7 +706,7 @@ struct nnf::imp {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_app(app * t, frame & fr) {
|
bool process_app(app * t, frame & fr) {
|
||||||
TRACE("nnf", tout << mk_ismt2_pp(t, m) << "\n";);
|
TRACE(nnf, tout << mk_ismt2_pp(t, m) << "\n";);
|
||||||
SASSERT(m.is_bool(t));
|
SASSERT(m.is_bool(t));
|
||||||
if (t->get_family_id() == m.get_basic_family_id()) {
|
if (t->get_family_id() == m.get_basic_family_id()) {
|
||||||
switch (static_cast<basic_op_kind>(t->get_decl_kind())) {
|
switch (static_cast<basic_op_kind>(t->get_decl_kind())) {
|
||||||
|
@ -740,7 +740,7 @@ struct nnf::imp {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_quantifier(quantifier * q, frame & fr) {
|
bool process_quantifier(quantifier * q, frame & fr) {
|
||||||
TRACE("nnf", tout << expr_ref(q, m) << "\n";);
|
TRACE(nnf, tout << expr_ref(q, m) << "\n";);
|
||||||
expr_ref r(m);
|
expr_ref r(m);
|
||||||
proof_ref pr(m);
|
proof_ref pr(m);
|
||||||
if (fr.m_i == 0) {
|
if (fr.m_i == 0) {
|
||||||
|
@ -843,7 +843,7 @@ struct nnf::imp {
|
||||||
}
|
}
|
||||||
|
|
||||||
void process(expr * t, expr_ref & result, proof_ref & result_pr) {
|
void process(expr * t, expr_ref & result, proof_ref & result_pr) {
|
||||||
TRACE("nnf", tout << "processing:\n" << mk_ismt2_pp(t, m) << "\n";);
|
TRACE(nnf, tout << "processing:\n" << mk_ismt2_pp(t, m) << "\n";);
|
||||||
SASSERT(m.is_bool(t));
|
SASSERT(m.is_bool(t));
|
||||||
|
|
||||||
if (visit(t, true /* positive polarity */, false /* not nested in quantifier */)) {
|
if (visit(t, true /* positive polarity */, false /* not nested in quantifier */)) {
|
||||||
|
@ -909,7 +909,7 @@ struct nnf::imp {
|
||||||
|
|
||||||
|
|
||||||
nnf::nnf(ast_manager & m, defined_names & n, params_ref const & p) {
|
nnf::nnf(ast_manager & m, defined_names & n, params_ref const & p) {
|
||||||
TRACE("nnf", tout << "nnf constructor: " << p << "\n";);
|
TRACE(nnf, tout << "nnf constructor: " << p << "\n";);
|
||||||
m_imp = alloc(imp, m, n, p);
|
m_imp = alloc(imp, m, n, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,7 +919,7 @@ nnf::~nnf() {
|
||||||
|
|
||||||
void nnf::operator()(expr * n, expr_ref_vector & new_defs, proof_ref_vector & new_def_proofs, expr_ref & r, proof_ref & p) {
|
void nnf::operator()(expr * n, expr_ref_vector & new_defs, proof_ref_vector & new_def_proofs, expr_ref & r, proof_ref & p) {
|
||||||
m_imp->operator()(n, new_defs, new_def_proofs, r, p);
|
m_imp->operator()(n, new_defs, new_def_proofs, r, p);
|
||||||
TRACE("nnf_result", tout << expr_ref(n, r.get_manager()) << "\nNNF result:\n" << new_defs << "\n" << r << "\n";);
|
TRACE(nnf_result, tout << expr_ref(n, r.get_manager()) << "\nNNF result:\n" << new_defs << "\n" << r << "\n";);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nnf::updt_params(params_ref const & p) {
|
void nnf::updt_params(params_ref const & p) {
|
||||||
|
|
|
@ -98,14 +98,14 @@ struct pull_quant::imp {
|
||||||
expr_ref adjusted_child(m);
|
expr_ref adjusted_child(m);
|
||||||
unsigned num_decls = var_sorts.size();
|
unsigned num_decls = var_sorts.size();
|
||||||
unsigned shift_amount = 0;
|
unsigned shift_amount = 0;
|
||||||
TRACE("pull_quant", tout << "Result num decls:" << num_decls << "\n";);
|
TRACE(pull_quant, tout << "Result num decls:" << num_decls << "\n";);
|
||||||
for (unsigned i = 0; i < num_children; i++) {
|
for (unsigned i = 0; i < num_children; i++) {
|
||||||
expr * child = children[i];
|
expr * child = children[i];
|
||||||
if (!is_quantifier(child)) {
|
if (!is_quantifier(child)) {
|
||||||
// increment the free variables in child by num_decls because
|
// increment the free variables in child by num_decls because
|
||||||
// child will be in the scope of num_decls bound variables.
|
// child will be in the scope of num_decls bound variables.
|
||||||
m_shift(child, num_decls, adjusted_child);
|
m_shift(child, num_decls, adjusted_child);
|
||||||
TRACE("pull_quant", tout << "shifted by: " << num_decls << "\n" <<
|
TRACE(pull_quant, tout << "shifted by: " << num_decls << "\n" <<
|
||||||
mk_pp(child, m) << "\n---->\n" << mk_pp(adjusted_child, m) << "\n";);
|
mk_pp(child, m) << "\n---->\n" << mk_pp(adjusted_child, m) << "\n";);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -127,7 +127,7 @@ struct pull_quant::imp {
|
||||||
num_decls - nested_q->get_num_decls(), // shift1 (shift by this amount if var idx >= bound)
|
num_decls - nested_q->get_num_decls(), // shift1 (shift by this amount if var idx >= bound)
|
||||||
shift_amount, // shift2 (shift by this amount if var idx < bound)
|
shift_amount, // shift2 (shift by this amount if var idx < bound)
|
||||||
adjusted_child);
|
adjusted_child);
|
||||||
TRACE("pull_quant", tout << "shifted bound: " << nested_q->get_num_decls() << " shift1: " << shift_amount <<
|
TRACE(pull_quant, tout << "shifted bound: " << nested_q->get_num_decls() << " shift1: " << shift_amount <<
|
||||||
" shift2: " << (num_decls - nested_q->get_num_decls()) << "\n" << mk_pp(nested_q->get_expr(), m) <<
|
" shift2: " << (num_decls - nested_q->get_num_decls()) << "\n" << mk_pp(nested_q->get_expr(), m) <<
|
||||||
"\n---->\n" << mk_pp(adjusted_child, m) << "\n";);
|
"\n---->\n" << mk_pp(adjusted_child, m) << "\n";);
|
||||||
shift_amount += nested_q->get_num_decls();
|
shift_amount += nested_q->get_num_decls();
|
||||||
|
|
|
@ -99,7 +99,7 @@ expr_pattern_match::instantiate(expr* a, unsigned num_bound, subst& s, expr_ref&
|
||||||
for (unsigned i = 0; i < num_bound; ++i) {
|
for (unsigned i = 0; i < num_bound; ++i) {
|
||||||
b.insert(m_bound_dom[i], m_bound_rng[i]);
|
b.insert(m_bound_dom[i], m_bound_rng[i]);
|
||||||
}
|
}
|
||||||
TRACE("expr_pattern_match", tout << mk_pp(a, m_manager) << " " << num_bound << "\n";);
|
TRACE(expr_pattern_match, tout << mk_pp(a, m_manager) << " " << num_bound << "\n";);
|
||||||
inst_proc proc(m_manager, s, b, m_regs);
|
inst_proc proc(m_manager, s, b, m_regs);
|
||||||
for_each_ast(proc, a);
|
for_each_ast(proc, a);
|
||||||
expr* v = nullptr;
|
expr* v = nullptr;
|
||||||
|
@ -270,13 +270,13 @@ expr_pattern_match::match(expr* a, unsigned init, subst& s)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CHECK_BOUND:
|
case CHECK_BOUND:
|
||||||
TRACE("expr_pattern_match", tout << "check bound " << pc.m_num_bound << " " << pc.m_reg << "\n";);
|
TRACE(expr_pattern_match, tout << "check bound " << pc.m_num_bound << " " << pc.m_reg << "\n";);
|
||||||
ok = m_bound_rng[pc.m_num_bound] == m_regs[pc.m_reg];
|
ok = m_bound_rng[pc.m_num_bound] == m_regs[pc.m_reg];
|
||||||
break;
|
break;
|
||||||
case BIND:
|
case BIND:
|
||||||
case BIND_AC:
|
case BIND_AC:
|
||||||
case BIND_C: {
|
case BIND_C: {
|
||||||
TRACE("expr_pattern_match", display(tout, pc);
|
TRACE(expr_pattern_match, display(tout, pc);
|
||||||
tout << mk_pp(m_regs[pc.m_reg],m_manager) << "\n";);
|
tout << mk_pp(m_regs[pc.m_reg],m_manager) << "\n";);
|
||||||
app* app1 = to_app(pc.m_pat);
|
app* app1 = to_app(pc.m_pat);
|
||||||
a = m_regs[pc.m_reg];
|
a = m_regs[pc.m_reg];
|
||||||
|
@ -352,7 +352,7 @@ expr_pattern_match::match(expr* a, unsigned init, subst& s)
|
||||||
pc = m_instrs[pc.m_next];
|
pc = m_instrs[pc.m_next];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("expr_pattern_match", tout << "backtrack\n";);
|
TRACE(expr_pattern_match, tout << "backtrack\n";);
|
||||||
pc = m_instrs[0];
|
pc = m_instrs[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ Revision History:
|
||||||
void smaller_pattern::save(expr * p1, expr * p2) {
|
void smaller_pattern::save(expr * p1, expr * p2) {
|
||||||
expr_pair e(p1, p2);
|
expr_pair e(p1, p2);
|
||||||
if (!m_cache.contains(e)) {
|
if (!m_cache.contains(e)) {
|
||||||
TRACE("smaller_pattern_proc", tout << "saving: " << p1->get_id() << " " << p2->get_id() << "\n";);
|
TRACE(smaller_pattern_proc, tout << "saving: " << p1->get_id() << " " << p2->get_id() << "\n";);
|
||||||
m_cache.insert(e);
|
m_cache.insert(e);
|
||||||
m_todo.push_back(e);
|
m_todo.push_back(e);
|
||||||
}
|
}
|
||||||
|
@ -129,8 +129,8 @@ void pattern_inference_cfg::collect::operator()(expr * n, unsigned num_bindings)
|
||||||
entry & e = m_todo.back();
|
entry & e = m_todo.back();
|
||||||
n = e.m_node;
|
n = e.m_node;
|
||||||
unsigned delta = e.m_delta;
|
unsigned delta = e.m_delta;
|
||||||
TRACE("collect", tout << "processing: " << n->get_id() << " " << delta << " kind: " << n->get_kind() << "\n";);
|
TRACE(collect, tout << "processing: " << n->get_id() << " " << delta << " kind: " << n->get_kind() << "\n";);
|
||||||
TRACE("collect_info", tout << mk_pp(n, m) << "\n";);
|
TRACE(collect_info, tout << mk_pp(n, m) << "\n";);
|
||||||
if (visit_children(n, delta)) {
|
if (visit_children(n, delta)) {
|
||||||
m_todo.pop_back();
|
m_todo.pop_back();
|
||||||
save_candidate(n, delta);
|
save_candidate(n, delta);
|
||||||
|
@ -249,7 +249,7 @@ void pattern_inference_cfg::collect::save_candidate(expr * n, unsigned delta) {
|
||||||
decl_kind k = c->get_decl_kind();
|
decl_kind k = c->get_decl_kind();
|
||||||
if (!free_vars.empty() &&
|
if (!free_vars.empty() &&
|
||||||
(fid != m_afid || (fid == m_afid && !m_owner.m_nested_arith_only && (k == OP_DIV || k == OP_IDIV || k == OP_MOD || k == OP_REM || k == OP_MUL)))) {
|
(fid != m_afid || (fid == m_afid && !m_owner.m_nested_arith_only && (k == OP_DIV || k == OP_IDIV || k == OP_MOD || k == OP_REM || k == OP_MUL)))) {
|
||||||
TRACE("pattern_inference", tout << "potential candidate: \n" << mk_pp(new_node, m) << "\n";);
|
TRACE(pattern_inference, tout << "potential candidate: \n" << mk_pp(new_node, m) << "\n";);
|
||||||
m_owner.add_candidate(new_node, free_vars, size);
|
m_owner.add_candidate(new_node, free_vars, size);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -352,7 +352,7 @@ bool pattern_inference_cfg::contains_subpattern::operator()(expr * n) {
|
||||||
uint_set const & s2 = e->get_data().m_value.m_free_vars;
|
uint_set const & s2 = e->get_data().m_value.m_free_vars;
|
||||||
SASSERT(s2.subset_of(s1));
|
SASSERT(s2.subset_of(s1));
|
||||||
if (s1 == s2) {
|
if (s1 == s2) {
|
||||||
TRACE("pattern_inference", tout << mk_pp(n, m_owner.m) << "\nis bigger than\n" << mk_pp(to_app(curr), m_owner.m) << "\n";);
|
TRACE(pattern_inference, tout << mk_pp(n, m_owner.m) << "\nis bigger than\n" << mk_pp(to_app(curr), m_owner.m) << "\n";);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -513,7 +513,7 @@ void pattern_inference_cfg::candidates2multi_patterns(unsigned max_num_patterns,
|
||||||
m_pre_patterns.push_back(curr);
|
m_pre_patterns.push_back(curr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("pattern_inference", tout << "m_pre_patterns.size(): " << m_pre_patterns.size() <<
|
TRACE(pattern_inference, tout << "m_pre_patterns.size(): " << m_pre_patterns.size() <<
|
||||||
"\nnum_splits: " << num_splits << "\n";);
|
"\nnum_splits: " << num_splits << "\n";);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -532,7 +532,7 @@ bool pattern_inference_cfg::is_forbidden(app * n) const {
|
||||||
// occur outside of the quantifier. That is, Z3 will never match this kind of
|
// occur outside of the quantifier. That is, Z3 will never match this kind of
|
||||||
// pattern.
|
// pattern.
|
||||||
if (m_params.m_pi_avoid_skolems && decl->is_skolem()) {
|
if (m_params.m_pi_avoid_skolems && decl->is_skolem()) {
|
||||||
CTRACE("pattern_inference_skolem", decl->is_skolem(), tout << "ignoring: " << mk_pp(n, m) << "\n";);
|
CTRACE(pattern_inference_skolem, decl->is_skolem(), tout << "ignoring: " << mk_pp(n, m) << "\n";);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (is_forbidden(decl))
|
if (is_forbidden(decl))
|
||||||
|
@ -549,7 +549,7 @@ bool pattern_inference_cfg::has_preferred_patterns(ptr_vector<app> & candidate_p
|
||||||
expr2info::obj_map_entry * e = m_candidates_info.find_core(candidate);
|
expr2info::obj_map_entry * e = m_candidates_info.find_core(candidate);
|
||||||
info const & i = e->get_data().m_value;
|
info const & i = e->get_data().m_value;
|
||||||
if (i.m_free_vars.num_elems() == m_num_bindings) {
|
if (i.m_free_vars.num_elems() == m_num_bindings) {
|
||||||
TRACE("pattern_inference", tout << "found preferred pattern:\n" << mk_pp(candidate, m) << "\n";);
|
TRACE(pattern_inference, tout << "found preferred pattern:\n" << mk_pp(candidate, m) << "\n";);
|
||||||
app * p = m.mk_pattern(candidate);
|
app * p = m.mk_pattern(candidate);
|
||||||
result.push_back(p);
|
result.push_back(p);
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -570,7 +570,7 @@ void pattern_inference_cfg::mk_patterns(unsigned num_bindings,
|
||||||
|
|
||||||
m_collect(n, num_bindings);
|
m_collect(n, num_bindings);
|
||||||
|
|
||||||
TRACE("pattern_inference",
|
TRACE(pattern_inference,
|
||||||
tout << mk_pp(n, m);
|
tout << mk_pp(n, m);
|
||||||
tout << "\ncandidates:\n";
|
tout << "\ncandidates:\n";
|
||||||
unsigned num = m_candidates.size();
|
unsigned num = m_candidates.size();
|
||||||
|
@ -581,7 +581,7 @@ void pattern_inference_cfg::mk_patterns(unsigned num_bindings,
|
||||||
if (!m_candidates.empty()) {
|
if (!m_candidates.empty()) {
|
||||||
m_tmp1.reset();
|
m_tmp1.reset();
|
||||||
filter_looping_patterns(m_tmp1);
|
filter_looping_patterns(m_tmp1);
|
||||||
TRACE("pattern_inference",
|
TRACE(pattern_inference,
|
||||||
tout << "candidates after removing looping-patterns:\n";
|
tout << "candidates after removing looping-patterns:\n";
|
||||||
dump_app_vector(tout, m_tmp1, m););
|
dump_app_vector(tout, m_tmp1, m););
|
||||||
SASSERT(!m_tmp1.empty());
|
SASSERT(!m_tmp1.empty());
|
||||||
|
@ -590,7 +590,7 @@ void pattern_inference_cfg::mk_patterns(unsigned num_bindings,
|
||||||
m_tmp2.reset();
|
m_tmp2.reset();
|
||||||
filter_bigger_patterns(m_tmp1, m_tmp2);
|
filter_bigger_patterns(m_tmp1, m_tmp2);
|
||||||
SASSERT(!m_tmp2.empty());
|
SASSERT(!m_tmp2.empty());
|
||||||
TRACE("pattern_inference",
|
TRACE(pattern_inference,
|
||||||
tout << "candidates after removing bigger patterns:\n";
|
tout << "candidates after removing bigger patterns:\n";
|
||||||
dump_app_vector(tout, m_tmp2, m););
|
dump_app_vector(tout, m_tmp2, m););
|
||||||
m_tmp1.reset();
|
m_tmp1.reset();
|
||||||
|
@ -601,7 +601,7 @@ void pattern_inference_cfg::mk_patterns(unsigned num_bindings,
|
||||||
if (num_extra_multi_patterns > 0 && !m_tmp1.empty()) {
|
if (num_extra_multi_patterns > 0 && !m_tmp1.empty()) {
|
||||||
// m_pattern_weight_lt is not a total order
|
// m_pattern_weight_lt is not a total order
|
||||||
std::stable_sort(m_tmp1.begin(), m_tmp1.end(), m_pattern_weight_lt);
|
std::stable_sort(m_tmp1.begin(), m_tmp1.end(), m_pattern_weight_lt);
|
||||||
TRACE("pattern_inference",
|
TRACE(pattern_inference,
|
||||||
tout << "candidates after sorting:\n";
|
tout << "candidates after sorting:\n";
|
||||||
dump_app_vector(tout, m_tmp1, m););
|
dump_app_vector(tout, m_tmp1, m););
|
||||||
candidates2multi_patterns(num_extra_multi_patterns, m_tmp1, result);
|
candidates2multi_patterns(num_extra_multi_patterns, m_tmp1, result);
|
||||||
|
@ -623,7 +623,7 @@ bool pattern_inference_cfg::reduce_quantifier(
|
||||||
expr_ref & result,
|
expr_ref & result,
|
||||||
proof_ref & result_pr) {
|
proof_ref & result_pr) {
|
||||||
|
|
||||||
TRACE("pattern_inference", tout << "processing:\n" << mk_pp(q, m) << "\n";);
|
TRACE(pattern_inference, tout << "processing:\n" << mk_pp(q, m) << "\n";);
|
||||||
if (!m_params.m_pi_enabled)
|
if (!m_params.m_pi_enabled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -640,14 +640,14 @@ bool pattern_inference_cfg::reduce_quantifier(
|
||||||
DEBUG_CODE(for (unsigned i = 0; i < new_patterns.size(); i++) { SASSERT(is_well_sorted(m, new_patterns.get(i))); });
|
DEBUG_CODE(for (unsigned i = 0; i < new_patterns.size(); i++) { SASSERT(is_well_sorted(m, new_patterns.get(i))); });
|
||||||
if (q->get_num_patterns() > 0) {
|
if (q->get_num_patterns() > 0) {
|
||||||
// just update the weight...
|
// just update the weight...
|
||||||
TRACE("pattern_inference", tout << "updating weight to: " << new_weight << "\n" << mk_pp(q, m) << "\n";);
|
TRACE(pattern_inference, tout << "updating weight to: " << new_weight << "\n" << mk_pp(q, m) << "\n";);
|
||||||
result = m.update_quantifier_weight(q, new_weight);
|
result = m.update_quantifier_weight(q, new_weight);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
quantifier_ref tmp(m);
|
quantifier_ref tmp(m);
|
||||||
tmp = m.update_quantifier(q, new_patterns.size(), (expr**) new_patterns.data(), q->get_expr());
|
tmp = m.update_quantifier(q, new_patterns.size(), (expr**) new_patterns.data(), q->get_expr());
|
||||||
result = m.update_quantifier_weight(tmp, new_weight);
|
result = m.update_quantifier_weight(tmp, new_weight);
|
||||||
TRACE("pattern_inference", tout << "found patterns in database, weight: " << new_weight << "\n" << mk_pp(result, m) << "\n";);
|
TRACE(pattern_inference, tout << "found patterns in database, weight: " << new_weight << "\n" << mk_pp(result, m) << "\n";);
|
||||||
}
|
}
|
||||||
if (m.proofs_enabled())
|
if (m.proofs_enabled())
|
||||||
result_pr = m.mk_rewrite(q, result);
|
result_pr = m.mk_rewrite(q, result);
|
||||||
|
@ -739,7 +739,7 @@ bool pattern_inference_cfg::reduce_quantifier(
|
||||||
if (m.proofs_enabled()) {
|
if (m.proofs_enabled()) {
|
||||||
result_pr = m.mk_transitivity(new_pr, m.mk_quant_intro(result2, new_q, m.mk_bind_proof(new_q, m.mk_reflexivity(new_q->get_expr()))));
|
result_pr = m.mk_transitivity(new_pr, m.mk_quant_intro(result2, new_q, m.mk_bind_proof(new_q, m.mk_reflexivity(new_q->get_expr()))));
|
||||||
}
|
}
|
||||||
TRACE("pattern_inference", tout << "pulled quantifier:\n" << mk_pp(new_q, m) << "\n";);
|
TRACE(pattern_inference, tout << "pulled quantifier:\n" << mk_pp(new_q, m) << "\n";);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -749,7 +749,7 @@ bool pattern_inference_cfg::reduce_quantifier(
|
||||||
auto str = q->get_qid().str();
|
auto str = q->get_qid().str();
|
||||||
warning_msg("failed to find a pattern for quantifier (quantifier id: %s)", str.c_str());
|
warning_msg("failed to find a pattern for quantifier (quantifier id: %s)", str.c_str());
|
||||||
}
|
}
|
||||||
TRACE("pi_failed", tout << mk_pp(q, m) << "\n";);
|
TRACE(pi_failed, tout << mk_pp(q, m) << "\n";);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_patterns.empty() && new_body == q->get_expr()) {
|
if (new_patterns.empty() && new_body == q->get_expr()) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ static std::pair<unsigned, bool> space_upto_line_break(ast_manager & m, format *
|
||||||
|
|
||||||
inline bool fits(ast_manager & m, format * f, unsigned space_left) {
|
inline bool fits(ast_manager & m, format * f, unsigned space_left) {
|
||||||
unsigned s = space_upto_line_break(m, f).first;
|
unsigned s = space_upto_line_break(m, f).first;
|
||||||
TRACE("fits", tout << "s: " << s << " space_left " << space_left << "\n";);
|
TRACE(fits, tout << "s: " << s << " space_left " << space_left << "\n";);
|
||||||
return s <= space_left;
|
return s <= space_left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -301,7 +301,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case PR_MONOTONICITY: {
|
case PR_MONOTONICITY: {
|
||||||
TRACE("proof_checker", tout << mk_bounded_pp(p, m, 3) << "\n";);
|
TRACE(proof_checker, tout << mk_bounded_pp(p, m, 3) << "\n";);
|
||||||
if (match_fact(p, fact) &&
|
if (match_fact(p, fact) &&
|
||||||
match_binary(fact, d1, t1, t2) &&
|
match_binary(fact, d1, t1, t2) &&
|
||||||
match_app(t1, f1, terms1) &&
|
match_app(t1, f1, terms1) &&
|
||||||
|
@ -530,7 +530,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) {
|
||||||
found = match_negated(ors[j].get(), hypotheses[i].get());
|
found = match_negated(ors[j].get(), hypotheses[i].get());
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
TRACE("pr_lemma_bug",
|
TRACE(pr_lemma_bug,
|
||||||
tout << "i: " << i << "\n";
|
tout << "i: " << i << "\n";
|
||||||
tout << "ORs:\n" << ors << "\n";
|
tout << "ORs:\n" << ors << "\n";
|
||||||
tout << "HYPOTHESIS:\n" << hypotheses << "\n";
|
tout << "HYPOTHESIS:\n" << hypotheses << "\n";
|
||||||
|
@ -538,7 +538,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TRACE("proof_checker", tout << "Matched:\n";
|
TRACE(proof_checker, tout << "Matched:\n";
|
||||||
ast_ll_pp(tout, m, hypotheses[i].get());
|
ast_ll_pp(tout, m, hypotheses[i].get());
|
||||||
ast_ll_pp(tout, m, ors[j-1].get()););
|
ast_ll_pp(tout, m, ors[j-1].get()););
|
||||||
}
|
}
|
||||||
|
@ -575,7 +575,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
TRACE("pr_unit_bug",
|
TRACE(pr_unit_bug,
|
||||||
tout << "Parents:\n";
|
tout << "Parents:\n";
|
||||||
for (unsigned i = 0; i < proofs.size(); i++) {
|
for (unsigned i = 0; i < proofs.size(); i++) {
|
||||||
expr* p = nullptr;
|
expr* p = nullptr;
|
||||||
|
@ -791,7 +791,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) {
|
||||||
premise = vs(premise, sub.size(), sub.data());
|
premise = vs(premise, sub.size(), sub.data());
|
||||||
}
|
}
|
||||||
fmls.push_back(premise.get());
|
fmls.push_back(premise.get());
|
||||||
TRACE("proof_checker",
|
TRACE(proof_checker,
|
||||||
tout << mk_pp(premise.get(), m) << "\n";
|
tout << mk_pp(premise.get(), m) << "\n";
|
||||||
for (unsigned j = 0; j < sub.size(); ++j) {
|
for (unsigned j = 0; j < sub.size(); ++j) {
|
||||||
tout << mk_pp(sub[j], m) << " ";
|
tout << mk_pp(sub[j], m) << " ";
|
||||||
|
@ -1151,7 +1151,7 @@ void proof_checker::get_hypotheses(proof* p, expr_ref_vector& ante) {
|
||||||
SASSERT(match_nil(h));
|
SASSERT(match_nil(h));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("proof_checker",
|
TRACE(proof_checker,
|
||||||
{
|
{
|
||||||
ast_ll_pp(tout << "Getting hypotheses from: ", m, p);
|
ast_ll_pp(tout << "Getting hypotheses from: ", m, p);
|
||||||
tout << "Found hypotheses:\n";
|
tout << "Found hypotheses:\n";
|
||||||
|
@ -1396,7 +1396,7 @@ bool proof_checker::check_arith_proof(proof* p) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("proof_checker",
|
TRACE(proof_checker,
|
||||||
for (unsigned i = 0; i < num_parents; i++)
|
for (unsigned i = 0; i < num_parents; i++)
|
||||||
tout << coeffs[i] << " * " << mk_bounded_pp(m.get_fact(m.get_parent(p, i)), m) << "\n";
|
tout << coeffs[i] << " * " << mk_bounded_pp(m.get_fact(m.get_parent(p, i)), m) << "\n";
|
||||||
tout << "fact:" << mk_bounded_pp(fact, m) << "\n";);
|
tout << "fact:" << mk_bounded_pp(fact, m) << "\n";);
|
||||||
|
|
|
@ -469,7 +469,7 @@ public:
|
||||||
tmp = pr;
|
tmp = pr;
|
||||||
elim(pr);
|
elim(pr);
|
||||||
reset();
|
reset();
|
||||||
CTRACE("proof_utils", contains_hypothesis(pr),
|
CTRACE(proof_utils, contains_hypothesis(pr),
|
||||||
tout << "Contains hypothesis:\n";
|
tout << "Contains hypothesis:\n";
|
||||||
tout << mk_ismt2_pp(tmp, m) << "\n====>\n";
|
tout << mk_ismt2_pp(tmp, m) << "\n====>\n";
|
||||||
tout << mk_ismt2_pp(pr, m) << "\n";);
|
tout << mk_ismt2_pp(pr, m) << "\n";);
|
||||||
|
@ -569,7 +569,7 @@ public:
|
||||||
m_hypmap.insert(result, new_hyps);
|
m_hypmap.insert(result, new_hyps);
|
||||||
// might push 0 into m_hyprefs. No reason for that
|
// might push 0 into m_hyprefs. No reason for that
|
||||||
m_hyprefs.push_back(new_hyps);
|
m_hyprefs.push_back(new_hyps);
|
||||||
TRACE("proof_utils",
|
TRACE(proof_utils,
|
||||||
tout << "New lemma: " << mk_pp(m.get_fact(p), m)
|
tout << "New lemma: " << mk_pp(m.get_fact(p), m)
|
||||||
<< "\n==>\n"
|
<< "\n==>\n"
|
||||||
<< mk_pp(m.get_fact(result), m) << "\n";
|
<< mk_pp(m.get_fact(result), m) << "\n";
|
||||||
|
@ -743,7 +743,7 @@ void proof_utils::reduce_hypotheses(proof_ref& pr) {
|
||||||
ast_manager& m = pr.get_manager();
|
ast_manager& m = pr.get_manager();
|
||||||
class reduce_hypotheses0 reduce(m);
|
class reduce_hypotheses0 reduce(m);
|
||||||
reduce(pr);
|
reduce(pr);
|
||||||
CTRACE("proof_utils", !is_closed(m, pr), tout << mk_pp(pr, m) << "\n";);
|
CTRACE(proof_utils, !is_closed(m, pr), tout << mk_pp(pr, m) << "\n";);
|
||||||
}
|
}
|
||||||
|
|
||||||
class proof_is_closed {
|
class proof_is_closed {
|
||||||
|
@ -985,7 +985,7 @@ private:
|
||||||
}
|
}
|
||||||
quantifier* q = to_quantifier(fml);
|
quantifier* q = to_quantifier(fml);
|
||||||
if (q->get_num_decls() != sub.size()) {
|
if (q->get_num_decls() != sub.size()) {
|
||||||
TRACE("proof_utils", tout << "quantifier has different number of variables than substitution";
|
TRACE(proof_utils, tout << "quantifier has different number of variables than substitution";
|
||||||
tout << mk_pp(q, m) << "\n";
|
tout << mk_pp(q, m) << "\n";
|
||||||
tout << sub.size() << "\n";);
|
tout << sub.size() << "\n";);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -221,7 +221,7 @@ public:
|
||||||
}
|
}
|
||||||
cache.insert(p, newp);
|
cache.insert(p, newp);
|
||||||
todo.pop_back();
|
todo.pop_back();
|
||||||
CTRACE("virtual",
|
CTRACE(proof_virtual,
|
||||||
p->get_decl_kind() == PR_TH_LEMMA &&
|
p->get_decl_kind() == PR_TH_LEMMA &&
|
||||||
p->get_decl()->get_parameter(0).get_symbol() == "arith" &&
|
p->get_decl()->get_parameter(0).get_symbol() == "arith" &&
|
||||||
p->get_decl()->get_num_parameters() > 1 &&
|
p->get_decl()->get_num_parameters() > 1 &&
|
||||||
|
|
|
@ -26,7 +26,7 @@ Revision History:
|
||||||
#include "ast/for_each_expr.h"
|
#include "ast/for_each_expr.h"
|
||||||
#include "util/scoped_ptr_vector.h"
|
#include "util/scoped_ptr_vector.h"
|
||||||
|
|
||||||
#define TRACEFN(x) TRACE("recfun", tout << x << '\n';)
|
#define TRACEFN(x) TRACE(recfun, tout << x << '\n';)
|
||||||
#define VALIDATE_PARAM(m, _pred_) if (!(_pred_)) m.raise_exception("invalid parameter to recfun " #_pred_);
|
#define VALIDATE_PARAM(m, _pred_) if (!(_pred_)) m.raise_exception("invalid parameter to recfun " #_pred_);
|
||||||
|
|
||||||
namespace recfun {
|
namespace recfun {
|
||||||
|
|
|
@ -97,7 +97,7 @@ br_status arith_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * c
|
||||||
case OP_ARITH_LSHR: SASSERT(num_args == 2); st = mk_lshr_core(f->get_parameter(0).get_int(), args[0], args[1], result); break;
|
case OP_ARITH_LSHR: SASSERT(num_args == 2); st = mk_lshr_core(f->get_parameter(0).get_int(), args[0], args[1], result); break;
|
||||||
default: st = BR_FAILED; break;
|
default: st = BR_FAILED; break;
|
||||||
}
|
}
|
||||||
CTRACE("arith_rewriter", st != BR_FAILED, tout << st << ": " << mk_pp(f, m);
|
CTRACE(arith_rewriter, st != BR_FAILED, tout << st << ": " << mk_pp(f, m);
|
||||||
for (unsigned i = 0; i < num_args; ++i) tout << mk_pp(args[i], m) << " ";
|
for (unsigned i = 0; i < num_args; ++i) tout << mk_pp(args[i], m) << " ";
|
||||||
tout << "\n==>\n" << mk_pp(result.get(), m) << "\n";
|
tout << "\n==>\n" << mk_pp(result.get(), m) << "\n";
|
||||||
if (is_app(result)) tout << "args: " << to_app(result)->get_num_args() << "\n";
|
if (is_app(result)) tout << "args: " << to_app(result)->get_num_args() << "\n";
|
||||||
|
@ -646,7 +646,7 @@ br_status arith_rewriter::mk_le_ge_eq_core(expr * arg1, expr * arg2, op_kind kin
|
||||||
(is_zero(arg2) && is_reduce_power_target(arg1, kind == EQ)))
|
(is_zero(arg2) && is_reduce_power_target(arg1, kind == EQ)))
|
||||||
return reduce_power(arg1, arg2, kind, result);
|
return reduce_power(arg1, arg2, kind, result);
|
||||||
br_status st = cancel_monomials(arg1, arg2, m_arith_ineq_lhs || m_arith_lhs, new_arg1, new_arg2);
|
br_status st = cancel_monomials(arg1, arg2, m_arith_ineq_lhs || m_arith_lhs, new_arg1, new_arg2);
|
||||||
TRACE("mk_le_bug", tout << "st: " << st << " " << new_arg1 << " " << new_arg2 << "\n";);
|
TRACE(mk_le_bug, tout << "st: " << st << " " << new_arg1 << " " << new_arg2 << "\n";);
|
||||||
if (st != BR_FAILED) {
|
if (st != BR_FAILED) {
|
||||||
arg1 = new_arg1;
|
arg1 = new_arg1;
|
||||||
arg2 = new_arg2;
|
arg2 = new_arg2;
|
||||||
|
@ -656,7 +656,7 @@ br_status arith_rewriter::mk_le_ge_eq_core(expr * arg1, expr * arg2, op_kind kin
|
||||||
if (m_elim_to_real && elim_to_real(arg1, arg2, new_new_arg1, new_new_arg2)) {
|
if (m_elim_to_real && elim_to_real(arg1, arg2, new_new_arg1, new_new_arg2)) {
|
||||||
arg1 = new_new_arg1;
|
arg1 = new_new_arg1;
|
||||||
arg2 = new_new_arg2;
|
arg2 = new_new_arg2;
|
||||||
CTRACE("elim_to_real", m_elim_to_real, tout << "after_elim_to_real\n" << mk_ismt2_pp(arg1, m) << "\n" << mk_ismt2_pp(arg2, m) << "\n";);
|
CTRACE(elim_to_real, m_elim_to_real, tout << "after_elim_to_real\n" << mk_ismt2_pp(arg1, m) << "\n" << mk_ismt2_pp(arg2, m) << "\n";);
|
||||||
if (st == BR_FAILED)
|
if (st == BR_FAILED)
|
||||||
st = BR_DONE;
|
st = BR_DONE;
|
||||||
}
|
}
|
||||||
|
@ -697,10 +697,10 @@ br_status arith_rewriter::mk_le_ge_eq_core(expr * arg1, expr * arg2, op_kind kin
|
||||||
numeral g;
|
numeral g;
|
||||||
unsigned num_consts = 0;
|
unsigned num_consts = 0;
|
||||||
get_coeffs_gcd(arg1, g, first, num_consts);
|
get_coeffs_gcd(arg1, g, first, num_consts);
|
||||||
TRACE("arith_rewriter_gcd", tout << "[step1] g: " << g << ", num_consts: " << num_consts << "\n";);
|
TRACE(arith_rewriter_gcd, tout << "[step1] g: " << g << ", num_consts: " << num_consts << "\n";);
|
||||||
if ((first || !g.is_one()) && num_consts <= 1)
|
if ((first || !g.is_one()) && num_consts <= 1)
|
||||||
get_coeffs_gcd(arg2, g, first, num_consts);
|
get_coeffs_gcd(arg2, g, first, num_consts);
|
||||||
TRACE("arith_rewriter_gcd", tout << "[step2] g: " << g << ", num_consts: " << num_consts << "\n";);
|
TRACE(arith_rewriter_gcd, tout << "[step2] g: " << g << ", num_consts: " << num_consts << "\n";);
|
||||||
g = abs(g);
|
g = abs(g);
|
||||||
if (!first && !g.is_one() && num_consts <= 1) {
|
if (!first && !g.is_one() && num_consts <= 1) {
|
||||||
bool is_sat = div_polynomial(arg1, g, (kind == LE ? CT_CEIL : (kind == GE ? CT_FLOOR : CT_FALSE)), new_arg1);
|
bool is_sat = div_polynomial(arg1, g, (kind == LE ? CT_CEIL : (kind == GE ? CT_FLOOR : CT_FALSE)), new_arg1);
|
||||||
|
@ -1174,7 +1174,7 @@ br_status arith_rewriter::mk_div_core(expr * arg1, expr * arg2, expr_ref & resul
|
||||||
v2 = rational(1);
|
v2 = rational(1);
|
||||||
d = arg2;
|
d = arg2;
|
||||||
}
|
}
|
||||||
TRACE("div_bug", tout << "v1: " << v1 << ", v2: " << v2 << "\n";);
|
TRACE(div_bug, tout << "v1: " << v1 << ", v2: " << v2 << "\n";);
|
||||||
if (!v1.is_one() || !v2.is_one()) {
|
if (!v1.is_one() || !v2.is_one()) {
|
||||||
v1 /= v2;
|
v1 /= v2;
|
||||||
result = m_util.mk_mul(m_util.mk_numeral(v1, false),
|
result = m_util.mk_mul(m_util.mk_numeral(v1, false),
|
||||||
|
@ -1238,7 +1238,7 @@ br_status arith_rewriter::mk_idiv_core(expr * arg1, expr * arg2, expr_ref & resu
|
||||||
if (change) {
|
if (change) {
|
||||||
result = m_util.mk_idiv(m.mk_app(to_app(arg1)->get_decl(), args.size(), args.data()), arg2);
|
result = m_util.mk_idiv(m.mk_app(to_app(arg1)->get_decl(), args.size(), args.data()), arg2);
|
||||||
result = m_util.mk_add(m_util.mk_numeral(add, true), result);
|
result = m_util.mk_add(m_util.mk_numeral(add, true), result);
|
||||||
TRACE("div_bug", tout << "mk_div result: " << result << "\n";);
|
TRACE(div_bug, tout << "mk_div result: " << result << "\n";);
|
||||||
return BR_REWRITE3;
|
return BR_REWRITE3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1385,7 +1385,7 @@ br_status arith_rewriter::mk_mod_core(expr * arg1, expr * arg2, expr_ref & resul
|
||||||
|
|
||||||
// propagate mod inside only if there is something to reduce.
|
// propagate mod inside only if there is something to reduce.
|
||||||
if (is_num2 && is_int && v2.is_pos() && (is_add(arg1) || is_mul(arg1))) {
|
if (is_num2 && is_int && v2.is_pos() && (is_add(arg1) || is_mul(arg1))) {
|
||||||
TRACE("mod_bug", tout << "mk_mod:\n" << mk_ismt2_pp(arg1, m) << "\n" << mk_ismt2_pp(arg2, m) << "\n";);
|
TRACE(mod_bug, tout << "mk_mod:\n" << mk_ismt2_pp(arg1, m) << "\n" << mk_ismt2_pp(arg2, m) << "\n";);
|
||||||
expr_ref_buffer args(m);
|
expr_ref_buffer args(m);
|
||||||
bool change = false;
|
bool change = false;
|
||||||
for (expr* arg : *to_app(arg1)) {
|
for (expr* arg : *to_app(arg1)) {
|
||||||
|
@ -1408,7 +1408,7 @@ br_status arith_rewriter::mk_mod_core(expr * arg1, expr * arg2, expr_ref & resul
|
||||||
}
|
}
|
||||||
if (change) {
|
if (change) {
|
||||||
result = m_util.mk_mod(m.mk_app(to_app(arg1)->get_decl(), args.size(), args.data()), arg2);
|
result = m_util.mk_mod(m.mk_app(to_app(arg1)->get_decl(), args.size(), args.data()), arg2);
|
||||||
TRACE("mod_bug", tout << "mk_mod result: " << mk_ismt2_pp(result, m) << "\n";);
|
TRACE(mod_bug, tout << "mk_mod result: " << mk_ismt2_pp(result, m) << "\n";);
|
||||||
return BR_REWRITE3;
|
return BR_REWRITE3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1482,7 +1482,7 @@ br_status arith_rewriter::mk_rem_core(expr * arg1, expr * arg2, expr_ref & resul
|
||||||
result = m.mk_ite(m_util.mk_ge(arg2, m_util.mk_numeral(rational(0), true)),
|
result = m.mk_ite(m_util.mk_ge(arg2, m_util.mk_numeral(rational(0), true)),
|
||||||
mod,
|
mod,
|
||||||
m_util.mk_uminus(mod));
|
m_util.mk_uminus(mod));
|
||||||
TRACE("elim_rem", tout << "result: " << mk_ismt2_pp(result, m) << "\n";);
|
TRACE(elim_rem, tout << "result: " << mk_ismt2_pp(result, m) << "\n";);
|
||||||
return BR_REWRITE3;
|
return BR_REWRITE3;
|
||||||
}
|
}
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
|
@ -1639,7 +1639,7 @@ br_status arith_rewriter::mk_power_core(expr * arg1, expr * arg2, expr_ref & res
|
||||||
bool is_num_y = m_util.is_numeral(arg2, y);
|
bool is_num_y = m_util.is_numeral(arg2, y);
|
||||||
auto ensure_real = [&](expr* e) { return m_util.is_int(e) ? m_util.mk_to_real(e) : e; };
|
auto ensure_real = [&](expr* e) { return m_util.is_int(e) ? m_util.mk_to_real(e) : e; };
|
||||||
|
|
||||||
TRACE("arith", tout << mk_bounded_pp(arg1, m) << " " << mk_bounded_pp(arg2, m) << "\n";);
|
TRACE(arith, tout << mk_bounded_pp(arg1, m) << " " << mk_bounded_pp(arg2, m) << "\n";);
|
||||||
if (is_num_x && x.is_one()) {
|
if (is_num_x && x.is_one()) {
|
||||||
result = m_util.mk_numeral(x, false);
|
result = m_util.mk_numeral(x, false);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
|
@ -1991,7 +1991,7 @@ bool arith_rewriter::is_pi_integer(expr * t) {
|
||||||
a = c;
|
a = c;
|
||||||
b = d;
|
b = d;
|
||||||
}
|
}
|
||||||
TRACE("tan", tout << "is_pi_integer " << mk_ismt2_pp(t, m) << "\n";
|
TRACE(tan, tout << "is_pi_integer " << mk_ismt2_pp(t, m) << "\n";
|
||||||
tout << "a: " << mk_ismt2_pp(a, m) << "\n";
|
tout << "a: " << mk_ismt2_pp(a, m) << "\n";
|
||||||
tout << "b: " << mk_ismt2_pp(b, m) << "\n";);
|
tout << "b: " << mk_ismt2_pp(b, m) << "\n";);
|
||||||
return
|
return
|
||||||
|
@ -2022,7 +2022,7 @@ app * arith_rewriter::mk_sqrt(rational const & k) {
|
||||||
// Return 0 if failed.
|
// Return 0 if failed.
|
||||||
expr * arith_rewriter::mk_sin_value(rational const & k) {
|
expr * arith_rewriter::mk_sin_value(rational const & k) {
|
||||||
rational k_prime = mod(floor(k), rational(2)) + k - floor(k);
|
rational k_prime = mod(floor(k), rational(2)) + k - floor(k);
|
||||||
TRACE("sine", tout << "k: " << k << ", k_prime: " << k_prime << "\n";);
|
TRACE(sine, tout << "k: " << k << ", k_prime: " << k_prime << "\n";);
|
||||||
SASSERT(k_prime >= rational(0) && k_prime < rational(2));
|
SASSERT(k_prime >= rational(0) && k_prime < rational(2));
|
||||||
bool neg = false;
|
bool neg = false;
|
||||||
if (k_prime >= rational(1)) {
|
if (k_prime >= rational(1)) {
|
||||||
|
|
|
@ -115,7 +115,7 @@ br_status array_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * c
|
||||||
st = BR_FAILED;
|
st = BR_FAILED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CTRACE("array_rewriter", st != BR_FAILED,
|
CTRACE(array_rewriter, st != BR_FAILED,
|
||||||
tout << mk_pp(f, m()) << "\n";
|
tout << mk_pp(f, m()) << "\n";
|
||||||
for (unsigned i = 0; i < num_args; ++i) {
|
for (unsigned i = 0; i < num_args; ++i) {
|
||||||
tout << mk_bounded_pp(args[i], m(), 2) << "\n";
|
tout << mk_bounded_pp(args[i], m(), 2) << "\n";
|
||||||
|
@ -459,7 +459,7 @@ br_status array_rewriter::mk_map_core(func_decl * f, unsigned num_args, expr * c
|
||||||
sort_ref s = get_map_array_sort(f, num_args, args);
|
sort_ref s = get_map_array_sort(f, num_args, args);
|
||||||
result = m_util.mk_const_array(s, value);
|
result = m_util.mk_const_array(s, value);
|
||||||
}
|
}
|
||||||
TRACE("array", tout << result << "\n";);
|
TRACE(array, tout << result << "\n";);
|
||||||
return BR_REWRITE2;
|
return BR_REWRITE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -819,7 +819,7 @@ expr_ref array_rewriter::expand_store(expr* s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
br_status array_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
|
br_status array_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
|
||||||
TRACE("array_rewriter", tout << mk_bounded_pp(lhs, m(), 2) << " " << mk_bounded_pp(rhs, m(), 2) << "\n";);
|
TRACE(array_rewriter, tout << mk_bounded_pp(lhs, m(), 2) << " " << mk_bounded_pp(rhs, m(), 2) << "\n";);
|
||||||
expr* v = nullptr, *w = nullptr;
|
expr* v = nullptr, *w = nullptr;
|
||||||
if (m_util.is_const(rhs) && is_lambda(lhs)) {
|
if (m_util.is_const(rhs) && is_lambda(lhs)) {
|
||||||
std::swap(lhs, rhs);
|
std::swap(lhs, rhs);
|
||||||
|
|
|
@ -38,7 +38,7 @@ void bit2int::operator()(expr * n, expr_ref & result, proof_ref& p) {
|
||||||
// TBD: rough
|
// TBD: rough
|
||||||
p = m.mk_rewrite(n, result);
|
p = m.mk_rewrite(n, result);
|
||||||
}
|
}
|
||||||
TRACE("bit2int",
|
TRACE(bit2int,
|
||||||
tout << mk_pp(n, m) << "======>\n" << result << "\n";);
|
tout << mk_pp(n, m) << "======>\n" << result << "\n";);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ bool bit2int::is_bv_poly(expr* n, expr_ref& pos, expr_ref& neg) {
|
||||||
VERIFY(mk_add(arg1, neg, neg));
|
VERIFY(mk_add(arg1, neg, neg));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("bit2int", tout << "Not a poly: " << mk_pp(n, m) << "\n";);
|
TRACE(bit2int, tout << "Not a poly: " << mk_pp(n, m) << "\n";);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,12 +407,12 @@ expr * bit2int::get_cached(expr * n) const {
|
||||||
expr* r = nullptr;
|
expr* r = nullptr;
|
||||||
proof* p = nullptr;
|
proof* p = nullptr;
|
||||||
const_cast<bit2int*>(this)->m_cache.get(n, r, p);
|
const_cast<bit2int*>(this)->m_cache.get(n, r, p);
|
||||||
CTRACE("bit2int", !r, tout << mk_pp(n, m) << "\n";);
|
CTRACE(bit2int, !r, tout << mk_pp(n, m) << "\n";);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bit2int::cache_result(expr * n, expr * r) {
|
void bit2int::cache_result(expr * n, expr * r) {
|
||||||
TRACE("bit2int_verbose", tout << "caching:\n" << mk_pp(n, m) <<
|
TRACE(bit2int_verbose, tout << "caching:\n" << mk_pp(n, m) <<
|
||||||
"======>\n" << mk_ll_pp(r, m) << "\n";);
|
"======>\n" << mk_ll_pp(r, m) << "\n";);
|
||||||
m_cache.insert(n, r, nullptr);
|
m_cache.insert(n, r, nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ static void sort_args(expr * & l1, expr * & l2, expr * & l3) {
|
||||||
|
|
||||||
|
|
||||||
void bit_blaster_cfg::mk_xor3(expr * l1, expr * l2, expr * l3, expr_ref & r) {
|
void bit_blaster_cfg::mk_xor3(expr * l1, expr * l2, expr * l3, expr_ref & r) {
|
||||||
TRACE("xor3", tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id(););
|
TRACE(xor3, tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id(););
|
||||||
sort_args(l1, l2, l3);
|
sort_args(l1, l2, l3);
|
||||||
TRACE("xor3_sorted", tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id(););
|
TRACE(xor3_sorted, tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id(););
|
||||||
if (m_params.m_bb_ext_gates) {
|
if (m_params.m_bb_ext_gates) {
|
||||||
if (l1 == l2)
|
if (l1 == l2)
|
||||||
r = l3;
|
r = l3;
|
||||||
|
@ -77,9 +77,9 @@ void bit_blaster_cfg::mk_xor3(expr * l1, expr * l2, expr * l3, expr_ref & r) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void bit_blaster_cfg::mk_carry(expr * l1, expr * l2, expr * l3, expr_ref & r) {
|
void bit_blaster_cfg::mk_carry(expr * l1, expr * l2, expr * l3, expr_ref & r) {
|
||||||
TRACE("carry", tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id(););
|
TRACE(carry, tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id(););
|
||||||
sort_args(l1, l2, l3);
|
sort_args(l1, l2, l3);
|
||||||
TRACE("carry_sorted", tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id(););
|
TRACE(carry_sorted, tout << "#" << l1->get_id() << " #" << l2->get_id() << " #" << l3->get_id(););
|
||||||
if (m_params.m_bb_ext_gates) {
|
if (m_params.m_bb_ext_gates) {
|
||||||
if ((m().is_false(l1) && m().is_false(l2)) ||
|
if ((m().is_false(l1) && m().is_false(l2)) ||
|
||||||
(m().is_false(l1) && m().is_false(l3)) ||
|
(m().is_false(l1) && m().is_false(l3)) ||
|
||||||
|
|
|
@ -379,7 +379,7 @@ MK_PARAMETRIC_UNARY_REDUCE(reduce_sign_extend, mk_sign_extend);
|
||||||
|
|
||||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||||
result_pr = nullptr;
|
result_pr = nullptr;
|
||||||
TRACE("bit_blaster", tout << f->get_name() << " ";
|
TRACE(bit_blaster, tout << f->get_name() << " ";
|
||||||
for (unsigned i = 0; i < num; ++i) tout << mk_pp(args[i], m()) << " ";
|
for (unsigned i = 0; i < num; ++i) tout << mk_pp(args[i], m()) << " ";
|
||||||
tout << "\n";);
|
tout << "\n";);
|
||||||
if (num == 0 && f->get_family_id() == null_family_id && butil().is_bv_sort(f->get_range())) {
|
if (num == 0 && f->get_family_id() == null_family_id && butil().is_bv_sort(f->get_range())) {
|
||||||
|
@ -552,7 +552,7 @@ MK_PARAMETRIC_UNARY_REDUCE(reduce_sign_extend, mk_sign_extend);
|
||||||
case OP_SBV2INT:
|
case OP_SBV2INT:
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
default:
|
default:
|
||||||
TRACE("bit_blaster", tout << "non-supported operator: " << f->get_name() << "\n";
|
TRACE(bit_blaster, tout << "non-supported operator: " << f->get_name() << "\n";
|
||||||
for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << std::endl;);
|
for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << std::endl;);
|
||||||
{
|
{
|
||||||
expr_ref r(m().mk_app(f, num, args), m());
|
expr_ref r(m().mk_app(f, num, args), m());
|
||||||
|
|
|
@ -425,7 +425,7 @@ void bit_blaster_tpl<Cfg>::mk_udiv_urem(unsigned sz, expr * const * a_bits, expr
|
||||||
for (unsigned i = 0; i < sz; i++) {
|
for (unsigned i = 0; i < sz; i++) {
|
||||||
SASSERT(q_bits.get(i) != 0);
|
SASSERT(q_bits.get(i) != 0);
|
||||||
}});
|
}});
|
||||||
TRACE("bit_blaster",
|
TRACE(bit_blaster,
|
||||||
tout << "a: ";
|
tout << "a: ";
|
||||||
for (unsigned i = 0; i < sz; ++i) tout << mk_pp(a_bits[i], m()) << " ";
|
for (unsigned i = 0; i < sz; ++i) tout << mk_pp(a_bits[i], m()) << " ";
|
||||||
tout << "\nb: ";
|
tout << "\nb: ";
|
||||||
|
@ -777,7 +777,7 @@ void bit_blaster_tpl<Cfg>::mk_eq(unsigned sz, expr * const * a_bits, expr * cons
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void bit_blaster_tpl<Cfg>::mk_rotate_left(unsigned sz, expr * const * a_bits, unsigned n, expr_ref_vector & out_bits) {
|
void bit_blaster_tpl<Cfg>::mk_rotate_left(unsigned sz, expr * const * a_bits, unsigned n, expr_ref_vector & out_bits) {
|
||||||
TRACE("bit_blaster", tout << n << ": " << sz << " ";
|
TRACE(bit_blaster, tout << n << ": " << sz << " ";
|
||||||
for (unsigned i = 0; i < sz; ++i) {
|
for (unsigned i = 0; i < sz; ++i) {
|
||||||
tout << mk_pp(a_bits[i], m()) << " ";
|
tout << mk_pp(a_bits[i], m()) << " ";
|
||||||
}
|
}
|
||||||
|
|
|
@ -769,12 +769,12 @@ br_status bool_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
|
||||||
expr* c2, * t2, * e2;
|
expr* c2, * t2, * e2;
|
||||||
if (m().is_ite(lhs) && m().is_value(rhs)) {
|
if (m().is_ite(lhs) && m().is_value(rhs)) {
|
||||||
r = try_ite_value(to_app(lhs), to_app(rhs), result);
|
r = try_ite_value(to_app(lhs), to_app(rhs), result);
|
||||||
CTRACE("try_ite_value", r != BR_FAILED,
|
CTRACE(try_ite_value, r != BR_FAILED,
|
||||||
tout << mk_bounded_pp(lhs, m()) << "\n" << mk_bounded_pp(rhs, m()) << "\n--->\n" << mk_bounded_pp(result, m()) << "\n";);
|
tout << mk_bounded_pp(lhs, m()) << "\n" << mk_bounded_pp(rhs, m()) << "\n--->\n" << mk_bounded_pp(result, m()) << "\n";);
|
||||||
}
|
}
|
||||||
else if (m().is_ite(rhs) && m().is_value(lhs)) {
|
else if (m().is_ite(rhs) && m().is_value(lhs)) {
|
||||||
r = try_ite_value(to_app(rhs), to_app(lhs), result);
|
r = try_ite_value(to_app(rhs), to_app(lhs), result);
|
||||||
CTRACE("try_ite_value", r != BR_FAILED,
|
CTRACE(try_ite_value, r != BR_FAILED,
|
||||||
tout << mk_bounded_pp(lhs, m()) << "\n" << mk_bounded_pp(rhs, m()) << "\n--->\n" << mk_bounded_pp(result, m()) << "\n";);
|
tout << mk_bounded_pp(lhs, m()) << "\n" << mk_bounded_pp(rhs, m()) << "\n--->\n" << mk_bounded_pp(result, m()) << "\n";);
|
||||||
}
|
}
|
||||||
else if (m().is_ite(lhs, c1, t1, e1) && m().is_ite(rhs, c2, t2, e2) &&
|
else if (m().is_ite(lhs, c1, t1, e1) && m().is_ite(rhs, c2, t2, e2) &&
|
||||||
|
|
|
@ -687,7 +687,7 @@ void bv2int_translator::translate_eq(expr* e) {
|
||||||
set_translated(e, m.mk_eq(umod(x, 0), a.mk_int(0)));
|
set_translated(e, m.mk_eq(umod(x, 0), a.mk_int(0)));
|
||||||
}
|
}
|
||||||
m_preds.push_back(e);
|
m_preds.push_back(e);
|
||||||
TRACE("bv", tout << mk_pp(e, m) << " " << mk_pp(translated(e), m) << "\n");
|
TRACE(bv, tout << mk_pp(e, m) << " " << mk_pp(translated(e), m) << "\n");
|
||||||
ctx.push(push_back_vector(m_preds));
|
ctx.push(push_back_vector(m_preds));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ bv_bounds::~bv_bounds() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bv_bounds::conv_res bv_bounds::record(app * v, numeral lo, numeral hi, bool negated, vector<ninterval>& nis) {
|
bv_bounds::conv_res bv_bounds::record(app * v, numeral lo, numeral hi, bool negated, vector<ninterval>& nis) {
|
||||||
TRACE("bv_bounds", tout << "record0 " << mk_ismt2_pp(v, m_m) << ":" << (negated ? "~[" : "[") << lo << ";" << hi << "]" << std::endl;);
|
TRACE(bv_bounds, tout << "record0 " << mk_ismt2_pp(v, m_m) << ":" << (negated ? "~[" : "[") << lo << ";" << hi << "]" << std::endl;);
|
||||||
const unsigned bv_sz = m_bv_util.get_bv_size(v);
|
const unsigned bv_sz = m_bv_util.get_bv_size(v);
|
||||||
const numeral& one = numeral::one();
|
const numeral& one = numeral::one();
|
||||||
SASSERT(numeral::zero() <= lo);
|
SASSERT(numeral::zero() <= lo);
|
||||||
|
@ -54,7 +54,7 @@ bv_bounds::conv_res bv_bounds::record(app * v, numeral lo, numeral hi, bool nega
|
||||||
}
|
}
|
||||||
if (lo_min) lo = vmin;
|
if (lo_min) lo = vmin;
|
||||||
if (hi_max) hi = vmax;
|
if (hi_max) hi = vmax;
|
||||||
TRACE("bv_bounds", tout << "record1 " << mk_ismt2_pp(v, m_m) << ":" << (negated ? "~[" : "[") << lo << ";" << hi << "]" << std::endl;);
|
TRACE(bv_bounds, tout << "record1 " << mk_ismt2_pp(v, m_m) << ":" << (negated ? "~[" : "[") << lo << ";" << hi << "]" << std::endl;);
|
||||||
if (lo > hi) return negated ? CONVERTED : UNSAT;
|
if (lo > hi) return negated ? CONVERTED : UNSAT;
|
||||||
if (lo_min && hi_max) return negated ? UNSAT : CONVERTED;
|
if (lo_min && hi_max) return negated ? UNSAT : CONVERTED;
|
||||||
nis.resize(nis.size() + 1);
|
nis.resize(nis.size() + 1);
|
||||||
|
@ -100,7 +100,7 @@ bool bv_bounds::is_uleq(expr * e, expr * & v, numeral & c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bv_bounds::conv_res bv_bounds::convert(expr * e, vector<ninterval>& nis, bool negated) {
|
bv_bounds::conv_res bv_bounds::convert(expr * e, vector<ninterval>& nis, bool negated) {
|
||||||
TRACE("bv_bounds", tout << "new constraint: " << (negated ? "~" : "" ) << mk_ismt2_pp(e, m_m) << std::endl;);
|
TRACE(bv_bounds, tout << "new constraint: " << (negated ? "~" : "" ) << mk_ismt2_pp(e, m_m) << std::endl;);
|
||||||
|
|
||||||
if (m_m.is_not(e)) {
|
if (m_m.is_not(e)) {
|
||||||
negated = !negated;
|
negated = !negated;
|
||||||
|
@ -281,9 +281,9 @@ br_status bv_bounds::rewrite(unsigned limit, func_decl * f, unsigned num, expr *
|
||||||
expr_ref_vector nargs(m_m);
|
expr_ref_vector nargs(m_m);
|
||||||
bool has_singls = false;
|
bool has_singls = false;
|
||||||
for (unsigned i = 0; i < num && m_okay; ++i) {
|
for (unsigned i = 0; i < num && m_okay; ++i) {
|
||||||
TRACE("bv_bounds", tout << "check red: " << mk_ismt2_pp(args[i], m_m) << std::endl;);
|
TRACE(bv_bounds, tout << "check red: " << mk_ismt2_pp(args[i], m_m) << std::endl;);
|
||||||
if (ignore[i]) {
|
if (ignore[i]) {
|
||||||
TRACE("bv_bounds", tout << "unprocessed" << std::endl;);
|
TRACE(bv_bounds, tout << "unprocessed" << std::endl;);
|
||||||
nargs.push_back(args[i]);
|
nargs.push_back(args[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -299,13 +299,13 @@ br_status bv_bounds::rewrite(unsigned limit, func_decl * f, unsigned num, expr *
|
||||||
const numeral& one = numeral::one();
|
const numeral& one = numeral::one();
|
||||||
if (!has_lower) tl = numeral::zero();
|
if (!has_lower) tl = numeral::zero();
|
||||||
if (!has_upper) th = (numeral::power_of_two(bv_sz) - one);
|
if (!has_upper) th = (numeral::power_of_two(bv_sz) - one);
|
||||||
TRACE("bv_bounds", tout << "bounds: " << mk_ismt2_pp(v, m_m) << "[" << tl << "-" << th << "]" << std::endl;);
|
TRACE(bv_bounds, tout << "bounds: " << mk_ismt2_pp(v, m_m) << "[" << tl << "-" << th << "]" << std::endl;);
|
||||||
is_singl = tl == th;
|
is_singl = tl == th;
|
||||||
nis_head = lengths[count];
|
nis_head = lengths[count];
|
||||||
}
|
}
|
||||||
if (!redundant && !is_singl) nargs.push_back(args[i]);
|
if (!redundant && !is_singl) nargs.push_back(args[i]);
|
||||||
has_singls |= is_singl;
|
has_singls |= is_singl;
|
||||||
CTRACE("bv_bounds", redundant, tout << "redundant: " << mk_ismt2_pp(args[i], m_m) << std::endl;);
|
CTRACE(bv_bounds, redundant, tout << "redundant: " << mk_ismt2_pp(args[i], m_m) << std::endl;);
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ br_status bv_bounds::rewrite(unsigned limit, func_decl * f, unsigned num, expr *
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bv_bounds::add_constraint(expr* e) {
|
bool bv_bounds::add_constraint(expr* e) {
|
||||||
TRACE("bv_bounds", tout << "new constraint" << mk_ismt2_pp(e, m_m) << std::endl;);
|
TRACE(bv_bounds, tout << "new constraint" << mk_ismt2_pp(e, m_m) << std::endl;);
|
||||||
if (!m_okay) return false;
|
if (!m_okay) return false;
|
||||||
|
|
||||||
bool negated = false;
|
bool negated = false;
|
||||||
|
@ -450,7 +450,7 @@ bool bv_bounds::add_constraint(expr* e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bv_bounds::add_bound_unsigned(app * v, const numeral& a, const numeral& b, bool negate) {
|
bool bv_bounds::add_bound_unsigned(app * v, const numeral& a, const numeral& b, bool negate) {
|
||||||
TRACE("bv_bounds", tout << "bound_unsigned " << mk_ismt2_pp(v, m_m) << ": " << (negate ? "~[" : "[") << a << ";" << b << "]" << std::endl;);
|
TRACE(bv_bounds, tout << "bound_unsigned " << mk_ismt2_pp(v, m_m) << ": " << (negate ? "~[" : "[") << a << ";" << b << "]" << std::endl;);
|
||||||
const unsigned bv_sz = m_bv_util.get_bv_size(v);
|
const unsigned bv_sz = m_bv_util.get_bv_size(v);
|
||||||
const numeral& zero = numeral::zero();
|
const numeral& zero = numeral::zero();
|
||||||
const numeral& one = numeral::one();
|
const numeral& one = numeral::one();
|
||||||
|
@ -473,7 +473,7 @@ bool bv_bounds::add_bound_unsigned(app * v, const numeral& a, const numeral& b,
|
||||||
}
|
}
|
||||||
|
|
||||||
bv_bounds::conv_res bv_bounds::convert_signed(app * v, const numeral& a, const numeral& b, bool negate, vector<ninterval>& nis) {
|
bv_bounds::conv_res bv_bounds::convert_signed(app * v, const numeral& a, const numeral& b, bool negate, vector<ninterval>& nis) {
|
||||||
TRACE("bv_bounds", tout << "convert_signed " << mk_ismt2_pp(v, m_m) << ":" << (negate ? "~[" : "[") << a << ";" << b << "]" << std::endl;);
|
TRACE(bv_bounds, tout << "convert_signed " << mk_ismt2_pp(v, m_m) << ":" << (negate ? "~[" : "[") << a << ";" << b << "]" << std::endl;);
|
||||||
const unsigned bv_sz = m_bv_util.get_bv_size(v);
|
const unsigned bv_sz = m_bv_util.get_bv_size(v);
|
||||||
SASSERT(a <= b);
|
SASSERT(a <= b);
|
||||||
const numeral& zero = numeral::zero();
|
const numeral& zero = numeral::zero();
|
||||||
|
@ -497,7 +497,7 @@ bv_bounds::conv_res bv_bounds::convert_signed(app * v, const numeral& a, const n
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bv_bounds::add_bound_signed(app * v, const numeral& a, const numeral& b, bool negate) {
|
bool bv_bounds::add_bound_signed(app * v, const numeral& a, const numeral& b, bool negate) {
|
||||||
TRACE("bv_bounds", tout << "bound_signed " << mk_ismt2_pp(v, m_m) << ":" << (negate ? "~" : " ") << a << ";" << b << std::endl;);
|
TRACE(bv_bounds, tout << "bound_signed " << mk_ismt2_pp(v, m_m) << ":" << (negate ? "~" : " ") << a << ";" << b << std::endl;);
|
||||||
const unsigned bv_sz = m_bv_util.get_bv_size(v);
|
const unsigned bv_sz = m_bv_util.get_bv_size(v);
|
||||||
SASSERT(a <= b);
|
SASSERT(a <= b);
|
||||||
const numeral& zero = numeral::zero();
|
const numeral& zero = numeral::zero();
|
||||||
|
@ -521,7 +521,7 @@ bool bv_bounds::add_bound_signed(app * v, const numeral& a, const numeral& b, bo
|
||||||
|
|
||||||
bool bv_bounds::bound_lo(app * v, const numeral& l) {
|
bool bv_bounds::bound_lo(app * v, const numeral& l) {
|
||||||
SASSERT(in_range(v, l));
|
SASSERT(in_range(v, l));
|
||||||
TRACE("bv_bounds", tout << "lower " << mk_ismt2_pp(v, m_m) << ":" << l << std::endl;);
|
TRACE(bv_bounds, tout << "lower " << mk_ismt2_pp(v, m_m) << ":" << l << std::endl;);
|
||||||
// l <= v
|
// l <= v
|
||||||
auto& value = m_unsigned_lowers.insert_if_not_there(v, l);
|
auto& value = m_unsigned_lowers.insert_if_not_there(v, l);
|
||||||
if (!(value < l)) return m_okay;
|
if (!(value < l)) return m_okay;
|
||||||
|
@ -532,7 +532,7 @@ bool bv_bounds::bound_lo(app * v, const numeral& l) {
|
||||||
|
|
||||||
bool bv_bounds::bound_up(app * v, const numeral& u) {
|
bool bv_bounds::bound_up(app * v, const numeral& u) {
|
||||||
SASSERT(in_range(v, u));
|
SASSERT(in_range(v, u));
|
||||||
TRACE("bv_bounds", tout << "upper " << mk_ismt2_pp(v, m_m) << ":" << u << std::endl;);
|
TRACE(bv_bounds, tout << "upper " << mk_ismt2_pp(v, m_m) << ":" << u << std::endl;);
|
||||||
// v <= u
|
// v <= u
|
||||||
auto& value = m_unsigned_uppers.insert_if_not_there(v, u);
|
auto& value = m_unsigned_uppers.insert_if_not_there(v, u);
|
||||||
if (!(u < value)) return m_okay;
|
if (!(u < value)) return m_okay;
|
||||||
|
@ -542,7 +542,7 @@ bool bv_bounds::bound_up(app * v, const numeral& u) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bv_bounds::add_neg_bound(app * v, const numeral& a, const numeral& b) {
|
bool bv_bounds::add_neg_bound(app * v, const numeral& a, const numeral& b) {
|
||||||
TRACE("bv_bounds", tout << "negative bound " << mk_ismt2_pp(v, m_m) << ":" << a << ";" << b << std::endl;);
|
TRACE(bv_bounds, tout << "negative bound " << mk_ismt2_pp(v, m_m) << ":" << a << ";" << b << std::endl;);
|
||||||
bv_bounds::interval negative_interval(a, b);
|
bv_bounds::interval negative_interval(a, b);
|
||||||
SASSERT(m_bv_util.is_bv(v));
|
SASSERT(m_bv_util.is_bv(v));
|
||||||
SASSERT(a >= numeral::zero());
|
SASSERT(a >= numeral::zero());
|
||||||
|
@ -597,15 +597,15 @@ struct interval_comp_t {
|
||||||
|
|
||||||
|
|
||||||
void bv_bounds::record_singleton(app * v, numeral& singleton_value) {
|
void bv_bounds::record_singleton(app * v, numeral& singleton_value) {
|
||||||
TRACE("bv_bounds", tout << "singleton:" << mk_ismt2_pp(v, m_m) << ":" << singleton_value << std::endl;);
|
TRACE(bv_bounds, tout << "singleton:" << mk_ismt2_pp(v, m_m) << ":" << singleton_value << std::endl;);
|
||||||
SASSERT(!m_singletons.find(v, singleton_value));
|
SASSERT(!m_singletons.find(v, singleton_value));
|
||||||
m_singletons.insert(v, singleton_value);
|
m_singletons.insert(v, singleton_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bv_bounds::is_sat(app * v) {
|
bool bv_bounds::is_sat(app * v) {
|
||||||
TRACE("bv_bounds", tout << "is_sat " << mk_ismt2_pp(v, m_m) << std::endl;);
|
TRACE(bv_bounds, tout << "is_sat " << mk_ismt2_pp(v, m_m) << std::endl;);
|
||||||
const bool rv = is_sat_core(v);
|
const bool rv = is_sat_core(v);
|
||||||
TRACE("bv_bounds", tout << "is_sat " << mk_ismt2_pp(v, m_m) << "\nres: " << rv << std::endl;);
|
TRACE(bv_bounds, tout << "is_sat " << mk_ismt2_pp(v, m_m) << "\nres: " << rv << std::endl;);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,7 +620,7 @@ bool bv_bounds::is_sat_core(app * v) {
|
||||||
const numeral& one = numeral::one();
|
const numeral& one = numeral::one();
|
||||||
if (!has_lower) lower = numeral::zero();
|
if (!has_lower) lower = numeral::zero();
|
||||||
if (!has_upper) upper = (numeral::power_of_two(bv_sz) - one);
|
if (!has_upper) upper = (numeral::power_of_two(bv_sz) - one);
|
||||||
TRACE("bv_bounds", tout << "is_sat bound:" << lower << "-" << upper << std::endl;);
|
TRACE(bv_bounds, tout << "is_sat bound:" << lower << "-" << upper << std::endl;);
|
||||||
intervals * negative_intervals(nullptr);
|
intervals * negative_intervals(nullptr);
|
||||||
const bool has_neg_intervals = m_negative_intervals.find(v, negative_intervals);
|
const bool has_neg_intervals = m_negative_intervals.find(v, negative_intervals);
|
||||||
bool is_sat(false);
|
bool is_sat(false);
|
||||||
|
@ -641,9 +641,9 @@ bool bv_bounds::is_sat_core(app * v) {
|
||||||
if (new_hi > upper) new_hi = upper;
|
if (new_hi > upper) new_hi = upper;
|
||||||
is_sat = true;
|
is_sat = true;
|
||||||
}
|
}
|
||||||
TRACE("bv_bounds", tout << "is_sat new_lo, new_hi:" << new_lo << "-" << new_hi << std::endl;);
|
TRACE(bv_bounds, tout << "is_sat new_lo, new_hi:" << new_lo << "-" << new_hi << std::endl;);
|
||||||
ptr = negative_upper + one;
|
ptr = negative_upper + one;
|
||||||
TRACE("bv_bounds", tout << "is_sat ptr, new_hi:" << ptr << "-" << new_hi << std::endl;);
|
TRACE(bv_bounds, tout << "is_sat ptr, new_hi:" << ptr << "-" << new_hi << std::endl;);
|
||||||
if (ptr > upper) break;
|
if (ptr > upper) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -655,7 +655,7 @@ bool bv_bounds::is_sat_core(app * v) {
|
||||||
}
|
}
|
||||||
if (new_hi < upper) bound_up(v, new_hi);
|
if (new_hi < upper) bound_up(v, new_hi);
|
||||||
if (new_lo > lower) bound_lo(v, new_lo);
|
if (new_lo > lower) bound_lo(v, new_lo);
|
||||||
TRACE("bv_bounds", tout << "is_sat new_lo, new_hi:" << new_lo << "-" << new_hi << std::endl;);
|
TRACE(bv_bounds, tout << "is_sat new_lo, new_hi:" << new_lo << "-" << new_hi << std::endl;);
|
||||||
|
|
||||||
const bool is_singleton = is_sat && new_hi == new_lo;
|
const bool is_singleton = is_sat && new_hi == new_lo;
|
||||||
if (is_singleton) record_singleton(v, new_lo);
|
if (is_singleton) record_singleton(v, new_lo);
|
||||||
|
|
|
@ -125,7 +125,7 @@ namespace bv {
|
||||||
if (sign && !b.negate(b))
|
if (sign && !b.negate(b))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TRACE("bv", tout << (sign?"(not ":"") << mk_pp(t, m) << (sign ? ")" : "") << ": " << mk_pp(t1, m) << " in " << b << "\n";);
|
TRACE(bv, tout << (sign?"(not ":"") << mk_pp(t, m) << (sign ? ")" : "") << ": " << mk_pp(t1, m) << " in " << b << "\n";);
|
||||||
map::obj_map_entry* e = m_bound.find_core(t1);
|
map::obj_map_entry* e = m_bound.find_core(t1);
|
||||||
if (e) {
|
if (e) {
|
||||||
interval& old = e->get_data().m_value;
|
interval& old = e->get_data().m_value;
|
||||||
|
@ -202,7 +202,7 @@ namespace bv {
|
||||||
|
|
||||||
if (simplified) {
|
if (simplified) {
|
||||||
result = m.mk_app(to_app(t)->get_decl(), m_args);
|
result = m.mk_app(to_app(t)->get_decl(), m_args);
|
||||||
TRACE("bv", tout << mk_pp(t, m) << " -> " << result << "\n");
|
TRACE(bv, tout << mk_pp(t, m) << " -> " << result << "\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,10 +255,10 @@ namespace bv {
|
||||||
else if (false && intr != b)
|
else if (false && intr != b)
|
||||||
result = mk_bound(t1, intr.lo(), intr.hi());
|
result = mk_bound(t1, intr.lo(), intr.hi());
|
||||||
else {
|
else {
|
||||||
TRACE("bv", tout << mk_pp(t, m) << " b: " << b << " ctx: " << ctx << " intr " << intr << "\n");
|
TRACE(bv, tout << mk_pp(t, m) << " b: " << b << " ctx: " << ctx << " intr " << intr << "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
CTRACE("bv", result, tout << mk_pp(t, m) << " " << b << " (ctx: " << ctx << ") (intr: " << intr << "): " << result << "\n";);
|
CTRACE(bv, result, tout << mk_pp(t, m) << " " << b << " (ctx: " << ctx << ") (intr: " << intr << "): " << result << "\n";);
|
||||||
if (sign && result)
|
if (sign && result)
|
||||||
result = m.mk_not(result);
|
result = m.mk_not(result);
|
||||||
return result != nullptr;
|
return result != nullptr;
|
||||||
|
@ -325,7 +325,7 @@ namespace bv {
|
||||||
}
|
}
|
||||||
|
|
||||||
void pop_core(unsigned num_scopes) {
|
void pop_core(unsigned num_scopes) {
|
||||||
TRACE("bv", tout << "pop: " << num_scopes << "\n";);
|
TRACE(bv, tout << "pop: " << num_scopes << "\n";);
|
||||||
if (m_scopes.empty())
|
if (m_scopes.empty())
|
||||||
return;
|
return;
|
||||||
unsigned target = m_scopes.size() - num_scopes;
|
unsigned target = m_scopes.size() - num_scopes;
|
||||||
|
|
|
@ -244,7 +244,7 @@ br_status bv_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * cons
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
CTRACE("bv_verbose", st != BR_FAILED, tout << mk_pp(f, m) << "\n";
|
CTRACE(bv_verbose, st != BR_FAILED, tout << mk_pp(f, m) << "\n";
|
||||||
for (unsigned i = 0; i < num_args; ++i)
|
for (unsigned i = 0; i < num_args; ++i)
|
||||||
tout << " " << mk_bounded_pp(args[i], m) << "\n";
|
tout << " " << mk_bounded_pp(args[i], m) << "\n";
|
||||||
tout << mk_bounded_pp(result, m, 3) << "\n");
|
tout << mk_bounded_pp(result, m, 3) << "\n");
|
||||||
|
@ -570,7 +570,7 @@ br_status bv_rewriter::mk_leq_core(bool is_signed, expr * a, expr * b, expr_ref
|
||||||
if (m_le_extra) {
|
if (m_le_extra) {
|
||||||
const br_status cst = rw_leq_concats(is_signed, a, b, result);
|
const br_status cst = rw_leq_concats(is_signed, a, b, result);
|
||||||
if (cst != BR_FAILED) {
|
if (cst != BR_FAILED) {
|
||||||
TRACE("le_extra", tout << (is_signed ? "bv_sle\n" : "bv_ule\n")
|
TRACE(le_extra, tout << (is_signed ? "bv_sle\n" : "bv_ule\n")
|
||||||
<< mk_pp(a, m, 2) << "\n" << mk_pp(b, m, 2) << "\n--->\n"<< mk_pp(result, m, 2) << "\n";);
|
<< mk_pp(a, m, 2) << "\n" << mk_pp(b, m, 2) << "\n--->\n"<< mk_pp(result, m, 2) << "\n";);
|
||||||
return cst;
|
return cst;
|
||||||
}
|
}
|
||||||
|
@ -579,7 +579,7 @@ br_status bv_rewriter::mk_leq_core(bool is_signed, expr * a, expr * b, expr_ref
|
||||||
if (m_le_extra) {
|
if (m_le_extra) {
|
||||||
const br_status cst = rw_leq_overflow(is_signed, a, b, result);
|
const br_status cst = rw_leq_overflow(is_signed, a, b, result);
|
||||||
if (cst != BR_FAILED) {
|
if (cst != BR_FAILED) {
|
||||||
TRACE("le_extra", tout << (is_signed ? "bv_sle\n" : "bv_ule\n")
|
TRACE(le_extra, tout << (is_signed ? "bv_sle\n" : "bv_ule\n")
|
||||||
<< mk_pp(a, m, 2) << "\n" << mk_pp(b, m, 2) << "\n--->\n"<< mk_pp(result, m, 2) << "\n";);
|
<< mk_pp(a, m, 2) << "\n" << mk_pp(b, m, 2) << "\n--->\n"<< mk_pp(result, m, 2) << "\n";);
|
||||||
return cst;
|
return cst;
|
||||||
}
|
}
|
||||||
|
@ -857,7 +857,7 @@ br_status bv_rewriter::mk_extract(unsigned high, unsigned low, expr * arg, expr_
|
||||||
const unsigned ep_rm = propagate_extract(high, arg, ep_res);
|
const unsigned ep_rm = propagate_extract(high, arg, ep_res);
|
||||||
if (ep_rm != 0) {
|
if (ep_rm != 0) {
|
||||||
result = m_mk_extract(high, low, ep_res);
|
result = m_mk_extract(high, low, ep_res);
|
||||||
TRACE("extract_prop", tout << mk_pp(arg, m) << "\n[" << high <<"," << low << "]\n" << ep_rm << "---->\n"
|
TRACE(extract_prop, tout << mk_pp(arg, m) << "\n[" << high <<"," << low << "]\n" << ep_rm << "---->\n"
|
||||||
<< mk_pp(result.get(), m) << "\n";);
|
<< mk_pp(result.get(), m) << "\n";);
|
||||||
return BR_REWRITE2;
|
return BR_REWRITE2;
|
||||||
}
|
}
|
||||||
|
@ -1158,7 +1158,7 @@ br_status bv_rewriter::mk_bv_udiv_core(expr * arg1, expr * arg2, bool hi_div0, e
|
||||||
numeral r1, r2;
|
numeral r1, r2;
|
||||||
unsigned bv_size;
|
unsigned bv_size;
|
||||||
|
|
||||||
TRACE("bv_udiv", tout << "hi_div0: " << hi_div0 << "\n";);
|
TRACE(bv_udiv, tout << "hi_div0: " << hi_div0 << "\n";);
|
||||||
|
|
||||||
if (is_numeral(arg2, r2, bv_size)) {
|
if (is_numeral(arg2, r2, bv_size)) {
|
||||||
r2 = m_util.norm(r2, bv_size);
|
r2 = m_util.norm(r2, bv_size);
|
||||||
|
@ -1207,7 +1207,7 @@ br_status bv_rewriter::mk_bv_udiv_core(expr * arg1, expr * arg2, bool hi_div0, e
|
||||||
m_util.mk_bv_udiv0(arg1),
|
m_util.mk_bv_udiv0(arg1),
|
||||||
m_util.mk_bv_udiv_i(arg1, arg2));
|
m_util.mk_bv_udiv_i(arg1, arg2));
|
||||||
|
|
||||||
TRACE("bv_udiv", tout << mk_pp(arg1, m) << "\n" << mk_pp(arg2, m) << "\n---->\n" << mk_pp(result, m) << "\n";);
|
TRACE(bv_udiv, tout << mk_pp(arg1, m) << "\n" << mk_pp(arg2, m) << "\n---->\n" << mk_pp(result, m) << "\n";);
|
||||||
return BR_REWRITE2;
|
return BR_REWRITE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1903,7 +1903,7 @@ br_status bv_rewriter::mk_bv_or(unsigned num, expr * const * args, expr_ref & re
|
||||||
}
|
}
|
||||||
std::reverse(exs.begin(), exs.end());
|
std::reverse(exs.begin(), exs.end());
|
||||||
result = m_util.mk_concat(exs.size(), exs.data());
|
result = m_util.mk_concat(exs.size(), exs.data());
|
||||||
TRACE("mask_bug",
|
TRACE(mask_bug,
|
||||||
tout << "(assert (distinct (bvor (_ bv" << old_v1 << " " << sz << ")\n" << mk_pp(t, m) << ")\n";
|
tout << "(assert (distinct (bvor (_ bv" << old_v1 << " " << sz << ")\n" << mk_pp(t, m) << ")\n";
|
||||||
tout << mk_pp(result, m) << "))\n";);
|
tout << mk_pp(result, m) << "))\n";);
|
||||||
return BR_REWRITE2;
|
return BR_REWRITE2;
|
||||||
|
@ -2317,7 +2317,7 @@ br_status bv_rewriter::mk_bv_comp(expr * arg1, expr * arg2, expr_ref & result) {
|
||||||
br_status bv_rewriter::mk_bv_add(unsigned num_args, expr * const * args, expr_ref & result) {
|
br_status bv_rewriter::mk_bv_add(unsigned num_args, expr * const * args, expr_ref & result) {
|
||||||
br_status st = mk_add_core(num_args, args, result);
|
br_status st = mk_add_core(num_args, args, result);
|
||||||
if (st != BR_FAILED && st != BR_DONE) {
|
if (st != BR_FAILED && st != BR_DONE) {
|
||||||
TRACE("bv", tout << result << "\n";);
|
TRACE(bv, tout << result << "\n";);
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -2575,7 +2575,7 @@ br_status bv_rewriter::mk_blast_eq_value(expr * lhs, expr * rhs, expr_ref & resu
|
||||||
unsigned sz = get_bv_size(lhs);
|
unsigned sz = get_bv_size(lhs);
|
||||||
if (sz == 1)
|
if (sz == 1)
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
TRACE("blast_eq_value", tout << "sz: " << sz << "\n" << mk_pp(lhs, m) << "\n";);
|
TRACE(blast_eq_value, tout << "sz: " << sz << "\n" << mk_pp(lhs, m) << "\n";);
|
||||||
if (is_numeral(lhs))
|
if (is_numeral(lhs))
|
||||||
std::swap(lhs, rhs);
|
std::swap(lhs, rhs);
|
||||||
|
|
||||||
|
@ -2869,13 +2869,13 @@ br_status bv_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
|
||||||
|
|
||||||
st = mk_mul_eq(lhs, rhs, result);
|
st = mk_mul_eq(lhs, rhs, result);
|
||||||
if (st != BR_FAILED) {
|
if (st != BR_FAILED) {
|
||||||
TRACE("mk_mul_eq", tout << mk_pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n----->\n" << mk_pp(result,m) << "\n";);
|
TRACE(mk_mul_eq, tout << mk_pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n----->\n" << mk_pp(result,m) << "\n";);
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
st = mk_mul_eq(rhs, lhs, result);
|
st = mk_mul_eq(rhs, lhs, result);
|
||||||
if (st != BR_FAILED) {
|
if (st != BR_FAILED) {
|
||||||
TRACE("mk_mul_eq", tout << mk_pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n----->\n" << mk_pp(result,m) << "\n";);
|
TRACE(mk_mul_eq, tout << mk_pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n----->\n" << mk_pp(result,m) << "\n";);
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2992,7 +2992,7 @@ bool bv_rewriter::is_eq_bit(expr * t, expr * & x, unsigned & val) {
|
||||||
|
|
||||||
|
|
||||||
br_status bv_rewriter::mk_ite_core(expr * c, expr * t, expr * e, expr_ref & result) {
|
br_status bv_rewriter::mk_ite_core(expr * c, expr * t, expr * e, expr_ref & result) {
|
||||||
TRACE("bv_ite", tout << "mk_ite_core:\n" << mk_pp(c, m) << "?\n"
|
TRACE(bv_ite, tout << "mk_ite_core:\n" << mk_pp(c, m) << "?\n"
|
||||||
<< mk_pp(t, m) << "\n:" << mk_pp(e, m) << "\n";);
|
<< mk_pp(t, m) << "\n:" << mk_pp(e, m) << "\n";);
|
||||||
if (m.are_equal(t, e)) {
|
if (m.are_equal(t, e)) {
|
||||||
result = e;
|
result = e;
|
||||||
|
|
|
@ -65,7 +65,7 @@ expr_ref cached_var_subst::operator()() {
|
||||||
// entry was already there
|
// entry was already there
|
||||||
m_new_keys[num_bindings] = m_key; // recycle key
|
m_new_keys[num_bindings] = m_key; // recycle key
|
||||||
result = entry->get_data().m_value;
|
result = entry->get_data().m_value;
|
||||||
SCTRACE("bindings", is_trace_enabled("coming_from_quant"), tout << "(cache)\n";
|
SCTRACE(bindings, is_trace_enabled(TraceTag::coming_from_quant), tout << "(cache)\n";
|
||||||
for (unsigned i = 0; i < num_bindings; i++)
|
for (unsigned i = 0; i < num_bindings; i++)
|
||||||
if (m_key->m_bindings[i])
|
if (m_key->m_bindings[i])
|
||||||
tout << i << ": " << mk_ismt2_pp(m_key->m_bindings[i], result.m()) << ";\n";
|
tout << i << ": " << mk_ismt2_pp(m_key->m_bindings[i], result.m()) << ";\n";
|
||||||
|
|
|
@ -48,7 +48,7 @@ bool der::is_var_diseq(expr * e, unsigned num_decls, var * & v, expr_ref & t) {
|
||||||
auto set_result = [&](var *w, expr* s) {
|
auto set_result = [&](var *w, expr* s) {
|
||||||
v = w;
|
v = w;
|
||||||
t = s;
|
t = s;
|
||||||
TRACE("der", tout << mk_pp(e, m) << "\n";);
|
TRACE(der, tout << mk_pp(e, m) << "\n";);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ bool der::is_var_eq(expr* e, unsigned num_decls, var*& v, expr_ref& t) {
|
||||||
auto set_result = [&](var* w, expr* s) {
|
auto set_result = [&](var* w, expr* s) {
|
||||||
v = w;
|
v = w;
|
||||||
t = s;
|
t = s;
|
||||||
TRACE("der", tout << mk_pp(e, m) << "\n";);
|
TRACE(der, tout << mk_pp(e, m) << "\n";);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ void der::operator()(quantifier * q, expr_ref & r, proof_ref & pr) {
|
||||||
pr = nullptr;
|
pr = nullptr;
|
||||||
r = q;
|
r = q;
|
||||||
|
|
||||||
TRACE("der", tout << mk_pp(q, m) << "\n";);
|
TRACE(der, tout << mk_pp(q, m) << "\n";);
|
||||||
|
|
||||||
auto k = q->get_kind();
|
auto k = q->get_kind();
|
||||||
// Keep applying it until r doesn't change anymore
|
// Keep applying it until r doesn't change anymore
|
||||||
|
@ -226,7 +226,7 @@ void der::reduce1(quantifier * q, expr_ref & r, proof_ref & pr) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("der_bug", tout << "Did not find any diseq\n" << mk_pp(q, m) << "\n";);
|
TRACE(der_bug, tout << "Did not find any diseq\n" << mk_pp(q, m) << "\n";);
|
||||||
r = q;
|
r = q;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ static void der_sort_vars(ptr_vector<var> & vars, expr_ref_vector & definitions,
|
||||||
case AST_VAR:
|
case AST_VAR:
|
||||||
vidx = to_var(t)->get_idx();
|
vidx = to_var(t)->get_idx();
|
||||||
if (fr.second == 0) {
|
if (fr.second == 0) {
|
||||||
CTRACE("der_bug", vidx >= definitions.size(), tout << "vidx: " << vidx << "\n";);
|
CTRACE(der_bug, vidx >= definitions.size(), tout << "vidx: " << vidx << "\n";);
|
||||||
// Remark: The size of definitions may be smaller than the number of variables occurring in the quantified formula.
|
// Remark: The size of definitions may be smaller than the number of variables occurring in the quantified formula.
|
||||||
if (definitions.get(vidx, nullptr) != nullptr) {
|
if (definitions.get(vidx, nullptr) != nullptr) {
|
||||||
if (visiting.is_marked(t)) {
|
if (visiting.is_marked(t)) {
|
||||||
|
@ -341,7 +341,7 @@ static void der_sort_vars(ptr_vector<var> & vars, expr_ref_vector & definitions,
|
||||||
void der::get_elimination_order() {
|
void der::get_elimination_order() {
|
||||||
m_order.reset();
|
m_order.reset();
|
||||||
|
|
||||||
TRACE("top_sort",
|
TRACE(top_sort,
|
||||||
tout << "DEFINITIONS: " << std::endl;
|
tout << "DEFINITIONS: " << std::endl;
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
for (expr* e : m_map) {
|
for (expr* e : m_map) {
|
||||||
|
@ -353,7 +353,7 @@ void der::get_elimination_order() {
|
||||||
// der::top_sort ts(m);
|
// der::top_sort ts(m);
|
||||||
der_sort_vars(m_inx2var, m_map, m_order);
|
der_sort_vars(m_inx2var, m_map, m_order);
|
||||||
|
|
||||||
TRACE("der",
|
TRACE(der,
|
||||||
tout << "Elimination m_order:" << "\n";
|
tout << "Elimination m_order:" << "\n";
|
||||||
tout << m_order << "\n";);
|
tout << m_order << "\n";);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ void distribute_forall::operator()(expr * f, expr_ref & result) {
|
||||||
|
|
||||||
result = get_cached(f);
|
result = get_cached(f);
|
||||||
SASSERT(result!=0);
|
SASSERT(result!=0);
|
||||||
TRACE("distribute_forall", tout << mk_ll_pp(f, m_manager) << "======>\n"
|
TRACE(distribute_forall, tout << mk_ll_pp(f, m_manager) << "======>\n"
|
||||||
<< mk_ll_pp(result, m_manager););
|
<< mk_ll_pp(result, m_manager););
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ bool expr_dominators::compute_dominators() {
|
||||||
unsigned iterations = 1;
|
unsigned iterations = 1;
|
||||||
while (change) {
|
while (change) {
|
||||||
change = false;
|
change = false;
|
||||||
TRACE("simplify",
|
TRACE(simplify,
|
||||||
for (auto & kv : m_doms) {
|
for (auto & kv : m_doms) {
|
||||||
tout << mk_bounded_pp(kv.m_key, m) << " |-> " << mk_bounded_pp(kv.m_value, m) << "\n";
|
tout << mk_bounded_pp(kv.m_key, m) << " |-> " << mk_bounded_pp(kv.m_value, m) << "\n";
|
||||||
});
|
});
|
||||||
|
@ -135,7 +135,7 @@ bool expr_dominators::compile(expr * e) {
|
||||||
compute_post_order();
|
compute_post_order();
|
||||||
if (!compute_dominators()) return false;
|
if (!compute_dominators()) return false;
|
||||||
extract_tree();
|
extract_tree();
|
||||||
TRACE("simplify", display(tout););
|
TRACE(simplify, display(tout););
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ public:
|
||||||
if (m.is_true(t))
|
if (m.is_true(t))
|
||||||
return !sign;
|
return !sign;
|
||||||
|
|
||||||
TRACE("simplify", tout << t->get_id() << ": " << mk_bounded_pp(t, m) << " " << (sign?" - neg":" - pos") << "\n";);
|
TRACE(simplify, tout << t->get_id() << ": " << mk_bounded_pp(t, m) << " " << (sign?" - neg":" - pos") << "\n";);
|
||||||
|
|
||||||
m_scoped_substitution.push();
|
m_scoped_substitution.push();
|
||||||
if (!sign) {
|
if (!sign) {
|
||||||
|
@ -284,16 +284,16 @@ public:
|
||||||
m_trail.push_back(lhs);
|
m_trail.push_back(lhs);
|
||||||
m_trail.push_back(rhs);
|
m_trail.push_back(rhs);
|
||||||
if (is_gt(lhs, rhs)) {
|
if (is_gt(lhs, rhs)) {
|
||||||
TRACE("propagate_values", tout << "insert " << mk_pp(lhs, m) << " -> " << mk_pp(rhs, m) << "\n";);
|
TRACE(propagate_values, tout << "insert " << mk_pp(lhs, m) << " -> " << mk_pp(rhs, m) << "\n";);
|
||||||
m_scoped_substitution.insert(lhs, rhs, pr);
|
m_scoped_substitution.insert(lhs, rhs, pr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is_gt(rhs, lhs)) {
|
if (is_gt(rhs, lhs)) {
|
||||||
TRACE("propagate_values", tout << "insert " << mk_pp(rhs, m) << " -> " << mk_pp(lhs, m) << "\n";);
|
TRACE(propagate_values, tout << "insert " << mk_pp(rhs, m) << " -> " << mk_pp(lhs, m) << "\n";);
|
||||||
m_scoped_substitution.insert(rhs, lhs, m.mk_symmetry(pr));
|
m_scoped_substitution.insert(rhs, lhs, m.mk_symmetry(pr));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TRACE("propagate_values", tout << "incompatible " << mk_pp(n, m) << "\n";);
|
TRACE(propagate_values, tout << "incompatible " << mk_pp(n, m) << "\n";);
|
||||||
}
|
}
|
||||||
if (m.is_not(n, n1)) {
|
if (m.is_not(n, n1)) {
|
||||||
m_scoped_substitution.insert(n1, m.mk_false(), m.mk_iff_false(pr));
|
m_scoped_substitution.insert(n1, m.mk_false(), m.mk_iff_false(pr));
|
||||||
|
|
|
@ -151,14 +151,14 @@ bool elim_bounds_cfg::reduce_quantifier(quantifier * q,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("elim_bounds", tout << "candidates:\n"; for (unsigned i = 0; i < candidates.size(); i++) tout << mk_pp(candidates[i], m) << "\n";);
|
TRACE(elim_bounds, tout << "candidates:\n"; for (unsigned i = 0; i < candidates.size(); i++) tout << mk_pp(candidates[i], m) << "\n";);
|
||||||
// remove candidates that have lower and upper bounds
|
// remove candidates that have lower and upper bounds
|
||||||
|
|
||||||
for (var * v : candidates) {
|
for (var * v : candidates) {
|
||||||
if (lowers.contains(v) && uppers.contains(v))
|
if (lowers.contains(v) && uppers.contains(v))
|
||||||
candidate_set.erase(v);
|
candidate_set.erase(v);
|
||||||
}
|
}
|
||||||
TRACE("elim_bounds", tout << "candidates after filter:\n"; for (unsigned i = 0; i < candidates.size(); i++) tout << mk_pp(candidates[i], m) << "\n";);
|
TRACE(elim_bounds, tout << "candidates after filter:\n"; for (unsigned i = 0; i < candidates.size(); i++) tout << mk_pp(candidates[i], m) << "\n";);
|
||||||
if (candidate_set.empty()) {
|
if (candidate_set.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ bool elim_bounds_cfg::reduce_quantifier(quantifier * q,
|
||||||
case 0:
|
case 0:
|
||||||
result = m.mk_false();
|
result = m.mk_false();
|
||||||
result_pr = m.mk_rewrite(q, result);
|
result_pr = m.mk_rewrite(q, result);
|
||||||
TRACE("elim_bounds", tout << mk_pp(q, m) << "\n" << result << "\n";);
|
TRACE(elim_bounds, tout << mk_pp(q, m) << "\n" << result << "\n";);
|
||||||
return true;
|
return true;
|
||||||
case 1:
|
case 1:
|
||||||
new_body = atoms[0];
|
new_body = atoms[0];
|
||||||
|
@ -195,7 +195,7 @@ bool elim_bounds_cfg::reduce_quantifier(quantifier * q,
|
||||||
new_q = m.update_quantifier(q, new_body);
|
new_q = m.update_quantifier(q, new_body);
|
||||||
result = elim_unused_vars(m, new_q, params_ref());
|
result = elim_unused_vars(m, new_q, params_ref());
|
||||||
result_pr = m.mk_rewrite(q, result);
|
result_pr = m.mk_rewrite(q, result);
|
||||||
TRACE("elim_bounds", tout << mk_pp(q, m) << "\n" << result << "\n";);
|
TRACE(elim_bounds, tout << mk_pp(q, m) << "\n" << result << "\n";);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ expr *choose_rep(expr_equiv_class::eq_class &clazz, ast_manager &m) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("equiv",
|
TRACE(equiv,
|
||||||
tout << "Rep: " << mk_pp(rep, m) << "\n";
|
tout << "Rep: " << mk_pp(rep, m) << "\n";
|
||||||
for (expr *el : clazz)
|
for (expr *el : clazz)
|
||||||
tout << mk_pp(el, m) << "\n";
|
tout << mk_pp(el, m) << "\n";
|
||||||
|
|
|
@ -53,7 +53,7 @@ br_status factor_rewriter::mk_eq(expr * arg1, expr * arg2, expr_ref & result) {
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
if (!extract_factors()) {
|
if (!extract_factors()) {
|
||||||
TRACE("factor_rewriter", tout << mk_pp(arg1, m()) << " = " << mk_pp(arg2, m()) << "\n";);
|
TRACE(factor_rewriter, tout << mk_pp(arg1, m()) << " = " << mk_pp(arg2, m()) << "\n";);
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
}
|
}
|
||||||
powers_t::iterator it = m_powers.begin(), end = m_powers.end();
|
powers_t::iterator it = m_powers.begin(), end = m_powers.end();
|
||||||
|
@ -74,7 +74,7 @@ br_status factor_rewriter::mk_le(expr * arg1, expr * arg2, expr_ref & result) {
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
if (!extract_factors()) {
|
if (!extract_factors()) {
|
||||||
TRACE("factor_rewriter", tout << mk_pp(arg1, m()) << " <= " << mk_pp(arg2, m()) << "\n";);
|
TRACE(factor_rewriter, tout << mk_pp(arg1, m()) << " <= " << mk_pp(arg2, m()) << "\n";);
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ br_status factor_rewriter::mk_le(expr * arg1, expr * arg2, expr_ref & result) {
|
||||||
mk_is_negative(neg, eqs);
|
mk_is_negative(neg, eqs);
|
||||||
eqs.push_back(neg);
|
eqs.push_back(neg);
|
||||||
result = m().mk_or(eqs.size(), eqs.data());
|
result = m().mk_or(eqs.size(), eqs.data());
|
||||||
TRACE("factor_rewriter",
|
TRACE(factor_rewriter,
|
||||||
tout << mk_pp(arg1, m()) << " <= " << mk_pp(arg2, m()) << "\n";
|
tout << mk_pp(arg1, m()) << " <= " << mk_pp(arg2, m()) << "\n";
|
||||||
tout << mk_pp(result.get(), m()) << "\n";);
|
tout << mk_pp(result.get(), m()) << "\n";);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
|
@ -101,7 +101,7 @@ br_status factor_rewriter::mk_lt(expr * arg1, expr * arg2, expr_ref & result) {
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
if (!extract_factors()) {
|
if (!extract_factors()) {
|
||||||
TRACE("factor_rewriter", tout << mk_pp(arg1, m()) << " < " << mk_pp(arg2, m()) << "\n";);
|
TRACE(factor_rewriter, tout << mk_pp(arg1, m()) << " < " << mk_pp(arg2, m()) << "\n";);
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
}
|
}
|
||||||
// a^2 * b^3 * c < 0 ->
|
// a^2 * b^3 * c < 0 ->
|
||||||
|
@ -116,7 +116,7 @@ br_status factor_rewriter::mk_lt(expr * arg1, expr * arg2, expr_ref & result) {
|
||||||
}
|
}
|
||||||
eqs.push_back(neg);
|
eqs.push_back(neg);
|
||||||
result = m().mk_and(eqs.size(), eqs.data());
|
result = m().mk_and(eqs.size(), eqs.data());
|
||||||
TRACE("factor_rewriter", tout << mk_pp(result.get(), m()) << "\n";);
|
TRACE(factor_rewriter, tout << mk_pp(result.get(), m()) << "\n";);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ void factor_rewriter::mk_adds(expr* arg1, expr* arg2) {
|
||||||
bool sign = m_adds[i].second;
|
bool sign = m_adds[i].second;
|
||||||
expr* _e = m_adds[i].first;
|
expr* _e = m_adds[i].first;
|
||||||
|
|
||||||
TRACE("factor_rewriter", tout << i << " " << mk_pp(_e, m_manager) << "\n";);
|
TRACE(factor_rewriter, tout << i << " " << mk_pp(_e, m_manager) << "\n";);
|
||||||
|
|
||||||
if (!is_app(_e)) {
|
if (!is_app(_e)) {
|
||||||
++i;
|
++i;
|
||||||
|
@ -195,7 +195,7 @@ void factor_rewriter::mk_adds(expr* arg1, expr* arg2) {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("factor_rewriter",
|
TRACE(factor_rewriter,
|
||||||
for (unsigned i = 0; i < m_adds.size(); ++i) {
|
for (unsigned i = 0; i < m_adds.size(); ++i) {
|
||||||
if (!m_adds[i].second) tout << "-"; else tout << "+";
|
if (!m_adds[i].second) tout << "-"; else tout << "+";
|
||||||
tout << mk_pp(m_adds[i].first, m()) << " ";
|
tout << mk_pp(m_adds[i].first, m()) << " ";
|
||||||
|
@ -216,7 +216,7 @@ void factor_rewriter::mk_muls() {
|
||||||
--i;
|
--i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("factor_rewriter",
|
TRACE(factor_rewriter,
|
||||||
for (unsigned i = 0; i < m_muls.size(); ++i) {
|
for (unsigned i = 0; i < m_muls.size(); ++i) {
|
||||||
for (unsigned j = 0; j < m_muls[i].size(); ++j) {
|
for (unsigned j = 0; j < m_muls[i].size(); ++j) {
|
||||||
tout << mk_pp(m_muls[i][j], m()) << " ";
|
tout << mk_pp(m_muls[i][j], m()) << " ";
|
||||||
|
@ -329,7 +329,7 @@ bool factor_rewriter::extract_factors() {
|
||||||
m_factors.push_back(a().mk_add(trail.size(), trail.data()));
|
m_factors.push_back(a().mk_add(trail.size(), trail.data()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TRACE("factor_rewriter",
|
TRACE(factor_rewriter,
|
||||||
for (unsigned i = 0; i < m_factors.size(); ++i) {
|
for (unsigned i = 0; i < m_factors.size(); ++i) {
|
||||||
tout << mk_pp(m_factors[i].get(), m()) << " ";
|
tout << mk_pp(m_factors[i].get(), m()) << " ";
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const
|
||||||
mpf_exp = m_fm.unbias_exp(ebits, mpf_exp);
|
mpf_exp = m_fm.unbias_exp(ebits, mpf_exp);
|
||||||
|
|
||||||
m_fm.set(v, ebits, sbits, !mpzm.is_zero(z), mpf_exp, sig);
|
m_fm.set(v, ebits, sbits, !mpzm.is_zero(z), mpf_exp, sig);
|
||||||
TRACE("fp_rewriter",
|
TRACE(fp_rewriter,
|
||||||
tout << "sgn: " << !mpzm.is_zero(z) << std::endl;
|
tout << "sgn: " << !mpzm.is_zero(z) << std::endl;
|
||||||
tout << "sig: " << mpzm.to_string(sig) << std::endl;
|
tout << "sig: " << mpzm.to_string(sig) << std::endl;
|
||||||
tout << "exp: " << mpf_exp << std::endl;
|
tout << "exp: " << mpf_exp << std::endl;
|
||||||
|
@ -159,27 +159,27 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const
|
||||||
|
|
||||||
if (m_util.au().is_numeral(args[1], r1)) {
|
if (m_util.au().is_numeral(args[1], r1)) {
|
||||||
// rm + real -> float
|
// rm + real -> float
|
||||||
TRACE("fp_rewriter", tout << "r: " << r1 << std::endl;);
|
TRACE(fp_rewriter, tout << "r: " << r1 << std::endl;);
|
||||||
scoped_mpf v(m_fm);
|
scoped_mpf v(m_fm);
|
||||||
m_fm.set(v, ebits, sbits, rmv, r1.to_mpq());
|
m_fm.set(v, ebits, sbits, rmv, r1.to_mpq());
|
||||||
result = m_util.mk_value(v);
|
result = m_util.mk_value(v);
|
||||||
// TRACE("fp_rewriter", tout << "result: " << result << std::endl; );
|
// TRACE(fp_rewriter, tout << "result: " << result << std::endl; );
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
else if (m_util.is_numeral(args[1], v)) {
|
else if (m_util.is_numeral(args[1], v)) {
|
||||||
// rm + float -> float
|
// rm + float -> float
|
||||||
TRACE("fp_rewriter", tout << "v: " << m_fm.to_string(v) << std::endl; );
|
TRACE(fp_rewriter, tout << "v: " << m_fm.to_string(v) << std::endl; );
|
||||||
scoped_mpf vf(m_fm);
|
scoped_mpf vf(m_fm);
|
||||||
m_fm.set(vf, ebits, sbits, rmv, v);
|
m_fm.set(vf, ebits, sbits, rmv, v);
|
||||||
result = m_util.mk_value(vf);
|
result = m_util.mk_value(vf);
|
||||||
// TRACE("fp_rewriter", tout << "result: " << result << std::endl; );
|
// TRACE(fp_rewriter, tout << "result: " << result << std::endl; );
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
else if (m_util.bu().is_numeral(args[1], r1, bvs1)) {
|
else if (m_util.bu().is_numeral(args[1], r1, bvs1)) {
|
||||||
// rm + signed bv -> float
|
// rm + signed bv -> float
|
||||||
TRACE("fp_rewriter", tout << "r1: " << r1 << std::endl;);
|
TRACE(fp_rewriter, tout << "r1: " << r1 << std::endl;);
|
||||||
r1 = m_util.bu().norm(r1, bvs1, true);
|
r1 = m_util.bu().norm(r1, bvs1, true);
|
||||||
TRACE("fp_rewriter", tout << "r1 norm: " << r1 << std::endl;);
|
TRACE(fp_rewriter, tout << "r1 norm: " << r1 << std::endl;);
|
||||||
m_fm.set(v, ebits, sbits, rmv, r1.to_mpq());
|
m_fm.set(v, ebits, sbits, rmv, r1.to_mpq());
|
||||||
result = m_util.mk_value(v);
|
result = m_util.mk_value(v);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
|
@ -195,7 +195,7 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const
|
||||||
!m_util.au().is_numeral(args[2], r2))
|
!m_util.au().is_numeral(args[2], r2))
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
|
|
||||||
TRACE("fp_rewriter", tout << "r1: " << r1 << ", r2: " << r2 << "\n";);
|
TRACE(fp_rewriter, tout << "r1: " << r1 << ", r2: " << r2 << "\n";);
|
||||||
m_fm.set(v, ebits, sbits, rmv, r2.to_mpq().numerator(), r1.to_mpq());
|
m_fm.set(v, ebits, sbits, rmv, r2.to_mpq().numerator(), r1.to_mpq());
|
||||||
result = m_util.mk_value(v);
|
result = m_util.mk_value(v);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
|
@ -209,7 +209,7 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const
|
||||||
!m_util.au().is_numeral(args[2], r2))
|
!m_util.au().is_numeral(args[2], r2))
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
|
|
||||||
TRACE("fp_rewriter", tout << "r1: " << r1 << ", r2: " << r2 << "\n";);
|
TRACE(fp_rewriter, tout << "r1: " << r1 << ", r2: " << r2 << "\n";);
|
||||||
m_fm.set(v, ebits, sbits, rmv, r1.to_mpq().numerator(), r2.to_mpq());
|
m_fm.set(v, ebits, sbits, rmv, r1.to_mpq().numerator(), r2.to_mpq());
|
||||||
result = m_util.mk_value(v);
|
result = m_util.mk_value(v);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
|
@ -226,7 +226,7 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const
|
||||||
r1.is_one(),
|
r1.is_one(),
|
||||||
m_fm.unbias_exp(bvs2, biased_exp),
|
m_fm.unbias_exp(bvs2, biased_exp),
|
||||||
r3.to_mpq().numerator());
|
r3.to_mpq().numerator());
|
||||||
TRACE("fp_rewriter", tout << "v = " << m_fm.to_string(v) << std::endl;);
|
TRACE(fp_rewriter, tout << "v = " << m_fm.to_string(v) << std::endl;);
|
||||||
result = m_util.mk_value(v);
|
result = m_util.mk_value(v);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
|
@ -700,7 +700,7 @@ br_status fpa_rewriter::mk_fp(expr * sgn, expr * exp, expr * sig, expr_ref & res
|
||||||
rsgn.is_one(),
|
rsgn.is_one(),
|
||||||
m_fm.unbias_exp(bvsz_exp, biased_exp),
|
m_fm.unbias_exp(bvsz_exp, biased_exp),
|
||||||
rsig.to_mpq().numerator());
|
rsig.to_mpq().numerator());
|
||||||
TRACE("fp_rewriter", tout << "simplified (fp ...) to " << m_fm.to_string(v) << std::endl;);
|
TRACE(fp_rewriter, tout << "simplified (fp ...) to " << m_fm.to_string(v) << std::endl;);
|
||||||
result = m_util.mk_value(v);
|
result = m_util.mk_value(v);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
|
@ -765,11 +765,11 @@ br_status fpa_rewriter::mk_to_sbv(func_decl * f, expr * arg1, expr * arg2, expr_
|
||||||
}
|
}
|
||||||
|
|
||||||
br_status fpa_rewriter::mk_to_ieee_bv(func_decl * f, expr * arg, expr_ref & result) {
|
br_status fpa_rewriter::mk_to_ieee_bv(func_decl * f, expr * arg, expr_ref & result) {
|
||||||
TRACE("fp_rewriter", tout << "to_ieee_bv of " << mk_ismt2_pp(arg, m()) << std::endl;);
|
TRACE(fp_rewriter, tout << "to_ieee_bv of " << mk_ismt2_pp(arg, m()) << std::endl;);
|
||||||
scoped_mpf v(m_fm);
|
scoped_mpf v(m_fm);
|
||||||
|
|
||||||
if (m_util.is_numeral(arg, v)) {
|
if (m_util.is_numeral(arg, v)) {
|
||||||
TRACE("fp_rewriter", tout << "to_ieee_bv numeral: " << m_fm.to_string(v) << std::endl;);
|
TRACE(fp_rewriter, tout << "to_ieee_bv numeral: " << m_fm.to_string(v) << std::endl;);
|
||||||
bv_util bu(m());
|
bv_util bu(m());
|
||||||
const mpf & x = v.get();
|
const mpf & x = v.get();
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ bool simplify_inj_axiom(ast_manager & m, quantifier * q, expr_ref & result) {
|
||||||
}
|
}
|
||||||
if (found_vars && !has_free_vars(q)) {
|
if (found_vars && !has_free_vars(q)) {
|
||||||
(void)num_vars;
|
(void)num_vars;
|
||||||
TRACE("inj_axiom",
|
TRACE(inj_axiom,
|
||||||
tout << "Cadidate for simplification:\n" << mk_ll_pp(q, m) << mk_pp(app1, m) << "\n" << mk_pp(app2, m) << "\n" <<
|
tout << "Cadidate for simplification:\n" << mk_ll_pp(q, m) << mk_pp(app1, m) << "\n" << mk_pp(app2, m) << "\n" <<
|
||||||
mk_pp(var1, m) << "\n" << mk_pp(var2, m) << "\nnum_vars: " << num_vars << "\n";);
|
mk_pp(var1, m) << "\n" << mk_pp(var2, m) << "\nnum_vars: " << num_vars << "\n";);
|
||||||
// Building new (optimized) axiom
|
// Building new (optimized) axiom
|
||||||
|
@ -128,7 +128,7 @@ bool simplify_inj_axiom(ast_manager & m, quantifier * q, expr_ref & result) {
|
||||||
|
|
||||||
result = m.mk_forall(decls.size(), decls.data(), names.data(), eq,
|
result = m.mk_forall(decls.size(), decls.data(), names.data(), eq,
|
||||||
0, symbol(), symbol(), 1, &p);
|
0, symbol(), symbol(), 1, &p);
|
||||||
TRACE("inj_axiom", tout << "new axiom:\n" << mk_pp(result, m) << "\n";);
|
TRACE(inj_axiom, tout << "new axiom:\n" << mk_pp(result, m) << "\n";);
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,18 +46,18 @@ br_status maximize_ac_sharing::reduce_app(func_decl * f, unsigned num_args, expr
|
||||||
_args.append(num_args, args);
|
_args.append(num_args, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("ac_sharing_detail", tout << "before-reuse: num_args: " << num_args << "\n";);
|
TRACE(ac_sharing_detail, tout << "before-reuse: num_args: " << num_args << "\n";);
|
||||||
|
|
||||||
#define MAX_NUM_ARGS_FOR_OPT 128
|
#define MAX_NUM_ARGS_FOR_OPT 128
|
||||||
|
|
||||||
// Try to reuse already created circuits.
|
// Try to reuse already created circuits.
|
||||||
TRACE("ac_sharing_detail", tout << "args: "; for (unsigned i = 0; i < num_args; i++) tout << mk_pp(_args[i], m) << "\n";);
|
TRACE(ac_sharing_detail, tout << "args: "; for (unsigned i = 0; i < num_args; i++) tout << mk_pp(_args[i], m) << "\n";);
|
||||||
try_to_reuse:
|
try_to_reuse:
|
||||||
if (num_args > 1 && num_args < MAX_NUM_ARGS_FOR_OPT) {
|
if (num_args > 1 && num_args < MAX_NUM_ARGS_FOR_OPT) {
|
||||||
for (unsigned i = 0; i + 1 < num_args; i++) {
|
for (unsigned i = 0; i + 1 < num_args; i++) {
|
||||||
for (unsigned j = i + 1; j < num_args; j++) {
|
for (unsigned j = i + 1; j < num_args; j++) {
|
||||||
if (contains(f, _args[i], _args[j])) {
|
if (contains(f, _args[i], _args[j])) {
|
||||||
TRACE("ac_sharing_detail", tout << "reusing args: " << i << " " << j << "\n";);
|
TRACE(ac_sharing_detail, tout << "reusing args: " << i << " " << j << "\n";);
|
||||||
_args[i] = m.mk_app(f, _args[i], _args[j]);
|
_args[i] = m.mk_app(f, _args[i], _args[j]);
|
||||||
SASSERT(num_args > 1);
|
SASSERT(num_args > 1);
|
||||||
for (unsigned w = j; w + 1 < num_args; w++) {
|
for (unsigned w = j; w + 1 < num_args; w++) {
|
||||||
|
@ -73,7 +73,7 @@ br_status maximize_ac_sharing::reduce_app(func_decl * f, unsigned num_args, expr
|
||||||
|
|
||||||
// Create "tree-like circuit"
|
// Create "tree-like circuit"
|
||||||
while (true) {
|
while (true) {
|
||||||
TRACE("ac_sharing_detail", tout << "tree-loop: num_args: " << num_args << "\n";);
|
TRACE(ac_sharing_detail, tout << "tree-loop: num_args: " << num_args << "\n";);
|
||||||
unsigned j = 0;
|
unsigned j = 0;
|
||||||
for (unsigned i = 0; i < num_args; i += 2, j++) {
|
for (unsigned i = 0; i < num_args; i += 2, j++) {
|
||||||
if (i == num_args - 1) {
|
if (i == num_args - 1) {
|
||||||
|
@ -92,7 +92,7 @@ br_status maximize_ac_sharing::reduce_app(func_decl * f, unsigned num_args, expr
|
||||||
else {
|
else {
|
||||||
result = m.mk_app(f, numeral, _args[0]);
|
result = m.mk_app(f, numeral, _args[0]);
|
||||||
}
|
}
|
||||||
TRACE("ac_sharing_detail", tout << "result: " << result << "\n";);
|
TRACE(ac_sharing_detail, tout << "result: " << result << "\n";);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ struct pb2bv_rewriter::imp {
|
||||||
gcd_reduce<is_le>(m_coeffs, k);
|
gcd_reduce<is_le>(m_coeffs, k);
|
||||||
unsigned sz = m_args.size();
|
unsigned sz = m_args.size();
|
||||||
expr * const* args = m_args.data();
|
expr * const* args = m_args.data();
|
||||||
TRACE("pb",
|
TRACE(pb,
|
||||||
for (unsigned i = 0; i < sz; ++i) {
|
for (unsigned i = 0; i < sz; ++i) {
|
||||||
tout << m_coeffs[i] << "*" << mk_pp(args[i], m) << " ";
|
tout << m_coeffs[i] << "*" << mk_pp(args[i], m) << " ";
|
||||||
if (i + 1 < sz && !m_coeffs[i+1].is_neg()) tout << "+ ";
|
if (i + 1 < sz && !m_coeffs[i+1].is_neg()) tout << "+ ";
|
||||||
|
@ -283,7 +283,7 @@ struct pb2bv_rewriter::imp {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
result = m.mk_not(bounded_addition(sz, args, k + 1));
|
result = m.mk_not(bounded_addition(sz, args, k + 1));
|
||||||
TRACE("pb", tout << result << "\n";);
|
TRACE(pb, tout << result << "\n";);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ struct pb2bv_rewriter::imp {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
result = bounded_addition(sz, args, k);
|
result = bounded_addition(sz, args, k);
|
||||||
TRACE("pb", tout << result << "\n";);
|
TRACE(pb, tout << result << "\n";);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ struct pb2bv_rewriter::imp {
|
||||||
rational cost(0);
|
rational cost(0);
|
||||||
create_basis(m_coeffs, rational::zero(), cost);
|
create_basis(m_coeffs, rational::zero(), cost);
|
||||||
m_base = m_min_base;
|
m_base = m_min_base;
|
||||||
TRACE("pb",
|
TRACE(pb,
|
||||||
tout << "Base: ";
|
tout << "Base: ";
|
||||||
for (unsigned i = 0; i < m_base.size(); ++i) {
|
for (unsigned i = 0; i < m_base.size(); ++i) {
|
||||||
tout << m_base[i] << " ";
|
tout << m_base[i] << " ";
|
||||||
|
@ -465,7 +465,7 @@ struct pb2bv_rewriter::imp {
|
||||||
\brief Check if 'out mod n >= lim'.
|
\brief Check if 'out mod n >= lim'.
|
||||||
*/
|
*/
|
||||||
expr_ref mod_ge(ptr_vector<expr> const& out, unsigned n, unsigned lim) {
|
expr_ref mod_ge(ptr_vector<expr> const& out, unsigned n, unsigned lim) {
|
||||||
TRACE("pb", for (unsigned i = 0; i < out.size(); ++i) tout << mk_pp(out[i], m) << " "; tout << "\n";
|
TRACE(pb, for (unsigned i = 0; i < out.size(); ++i) tout << mk_pp(out[i], m) << " "; tout << "\n";
|
||||||
tout << "n:" << n << " lim: " << lim << "\n";);
|
tout << "n:" << n << " lim: " << lim << "\n";);
|
||||||
if (lim == n) {
|
if (lim == n) {
|
||||||
return expr_ref(m.mk_false(), m);
|
return expr_ref(m.mk_false(), m);
|
||||||
|
@ -514,7 +514,7 @@ struct pb2bv_rewriter::imp {
|
||||||
}
|
}
|
||||||
coeffs[j] = div(coeffs[j], b_i);
|
coeffs[j] = div(coeffs[j], b_i);
|
||||||
}
|
}
|
||||||
TRACE("pb", tout << "Carry: " << carry << "\n";
|
TRACE(pb, tout << "Carry: " << carry << "\n";
|
||||||
for (auto c : coeffs) tout << c << " ";
|
for (auto c : coeffs) tout << c << " ";
|
||||||
tout << "\n";
|
tout << "\n";
|
||||||
);
|
);
|
||||||
|
@ -525,7 +525,7 @@ struct pb2bv_rewriter::imp {
|
||||||
expr_ref ge = mod_ge(out, B, d_i);
|
expr_ref ge = mod_ge(out, B, d_i);
|
||||||
result = mk_and(ge, result);
|
result = mk_and(ge, result);
|
||||||
result = mk_or(gt, result);
|
result = mk_or(gt, result);
|
||||||
TRACE("pb", tout << "b: " << b_i << " d: " << d_i << " gt: " << gt << " ge: " << ge << " " << result << "\n";);
|
TRACE(pb, tout << "b: " << b_i << " d: " << d_i << " gt: " << gt << " ge: " << ge << " " << result << "\n";);
|
||||||
|
|
||||||
new_carry.reset();
|
new_carry.reset();
|
||||||
for (unsigned j = B - 1; j < out.size(); j += B) {
|
for (unsigned j = B - 1; j < out.size(); j += B) {
|
||||||
|
@ -534,7 +534,7 @@ struct pb2bv_rewriter::imp {
|
||||||
carry.reset();
|
carry.reset();
|
||||||
carry.append(new_carry);
|
carry.append(new_carry);
|
||||||
}
|
}
|
||||||
TRACE("pb", tout << "bound: " << bound << " Carry: " << carry << " result: " << result << "\n";);
|
TRACE(pb, tout << "bound: " << bound << " Carry: " << carry << " result: " << result << "\n";);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ struct pb2bv_rewriter::imp {
|
||||||
m_coeffs.push_back(pb.get_coeff(f, i));
|
m_coeffs.push_back(pb.get_coeff(f, i));
|
||||||
m_args.push_back(args[i]);
|
m_args.push_back(args[i]);
|
||||||
}
|
}
|
||||||
CTRACE("pb", k.is_neg(), tout << expr_ref(m.mk_app(f, sz, args), m) << "\n";);
|
CTRACE(pb, k.is_neg(), tout << expr_ref(m.mk_app(f, sz, args), m) << "\n";);
|
||||||
SASSERT(!k.is_neg());
|
SASSERT(!k.is_neg());
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case OP_PB_GE:
|
case OP_PB_GE:
|
||||||
|
@ -923,7 +923,7 @@ struct pb2bv_rewriter::imp {
|
||||||
else {
|
else {
|
||||||
result = mk_bv(f, sz, args);
|
result = mk_bv(f, sz, args);
|
||||||
}
|
}
|
||||||
TRACE("pb", tout << "full: " << full << " " << expr_ref(m.mk_app(f, sz, args), m) << " " << result << "\n";
|
TRACE(pb, tout << "full: " << full << " " << expr_ref(m.mk_app(f, sz, args), m) << " " << result << "\n";
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,14 +319,14 @@ br_status pb_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * cons
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("pb_verbose",
|
TRACE(pb_verbose,
|
||||||
expr_ref tmp(m);
|
expr_ref tmp(m);
|
||||||
tmp = m.mk_app(f, num_args, args);
|
tmp = m.mk_app(f, num_args, args);
|
||||||
tout << tmp << "\n";
|
tout << tmp << "\n";
|
||||||
tout << result << "\n";
|
tout << result << "\n";
|
||||||
);
|
);
|
||||||
|
|
||||||
TRACE("pb_validate",
|
TRACE(pb_validate,
|
||||||
validate_rewrite(f, num_args, args, result););
|
validate_rewrite(f, num_args, args, result););
|
||||||
|
|
||||||
return st;
|
return st;
|
||||||
|
|
|
@ -35,7 +35,7 @@ void pb_rewriter_util<PBU>::display(std::ostream& out, typename PBU::args_t& arg
|
||||||
template<typename PBU>
|
template<typename PBU>
|
||||||
void pb_rewriter_util<PBU>::unique(typename PBU::args_t& args, typename PBU::numeral& k, bool is_eq) {
|
void pb_rewriter_util<PBU>::unique(typename PBU::args_t& args, typename PBU::numeral& k, bool is_eq) {
|
||||||
|
|
||||||
TRACE("pb_verbose", display(tout << "pre-unique:", args, k, is_eq););
|
TRACE(pb_verbose, display(tout << "pre-unique:", args, k, is_eq););
|
||||||
for (unsigned i = 0; i < args.size(); ++i) {
|
for (unsigned i = 0; i < args.size(); ++i) {
|
||||||
if (m_util.is_negated(args[i].first)) {
|
if (m_util.is_negated(args[i].first)) {
|
||||||
args[i].first = m_util.negate(args[i].first);
|
args[i].first = m_util.negate(args[i].first);
|
||||||
|
@ -84,12 +84,12 @@ void pb_rewriter_util<PBU>::unique(typename PBU::args_t& args, typename PBU::num
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args.resize(i);
|
args.resize(i);
|
||||||
TRACE("pb_verbose", display(tout << "post-unique:", args, k, is_eq););
|
TRACE(pb_verbose, display(tout << "post-unique:", args, k, is_eq););
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename PBU>
|
template<typename PBU>
|
||||||
lbool pb_rewriter_util<PBU>::normalize(typename PBU::args_t& args, typename PBU::numeral& k, bool is_eq) {
|
lbool pb_rewriter_util<PBU>::normalize(typename PBU::args_t& args, typename PBU::numeral& k, bool is_eq) {
|
||||||
TRACE("pb_verbose", display(tout << "pre-normalize:", args, k, is_eq););
|
TRACE(pb_verbose, display(tout << "pre-normalize:", args, k, is_eq););
|
||||||
|
|
||||||
DEBUG_CODE(
|
DEBUG_CODE(
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
@ -167,7 +167,7 @@ lbool pb_rewriter_util<PBU>::normalize(typename PBU::args_t& args, typename PBU:
|
||||||
return l_false;
|
return l_false;
|
||||||
}
|
}
|
||||||
if (is_eq) {
|
if (is_eq) {
|
||||||
TRACE("pb_verbose", display(tout << "post-normalize:", args, k, is_eq););
|
TRACE(pb_verbose, display(tout << "post-normalize:", args, k, is_eq););
|
||||||
return l_undef;
|
return l_undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ lbool pb_rewriter_util<PBU>::normalize(typename PBU::args_t& args, typename PBU:
|
||||||
k = n1 + PBU::numeral::one();
|
k = n1 + PBU::numeral::one();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("pb_verbose", display(tout << "post-normalize:", args, k, is_eq););
|
TRACE(pb_verbose, display(tout << "post-normalize:", args, k, is_eq););
|
||||||
return l_undef;
|
return l_undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ br_status poly_rewriter<Config>::mk_flat_mul_core(unsigned num_args, expr * cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
br_status st = mk_nflat_mul_core(flat_args.size(), flat_args.data(), result);
|
br_status st = mk_nflat_mul_core(flat_args.size(), flat_args.data(), result);
|
||||||
TRACE("poly_rewriter",
|
TRACE(poly_rewriter,
|
||||||
tout << "flat mul:\n";
|
tout << "flat mul:\n";
|
||||||
for (unsigned i = 0; i < num_args; i++) tout << mk_bounded_pp(args[i], M()) << "\n";
|
for (unsigned i = 0; i < num_args; i++) tout << mk_bounded_pp(args[i], M()) << "\n";
|
||||||
tout << "---->\n";
|
tout << "---->\n";
|
||||||
|
@ -292,7 +292,7 @@ br_status poly_rewriter<Config>::mk_nflat_mul_core(unsigned num_args, expr * con
|
||||||
new_add_args.push_back(mk_mul_app(c, to_app(var)->get_arg(i)));
|
new_add_args.push_back(mk_mul_app(c, to_app(var)->get_arg(i)));
|
||||||
}
|
}
|
||||||
result = mk_add_app(new_add_args.size(), new_add_args.data());
|
result = mk_add_app(new_add_args.size(), new_add_args.data());
|
||||||
TRACE("mul_bug", tout << "result: " << mk_bounded_pp(result, M(), 5) << "\n";);
|
TRACE(mul_bug, tout << "result: " << mk_bounded_pp(result, M(), 5) << "\n";);
|
||||||
return BR_REWRITE2;
|
return BR_REWRITE2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ br_status poly_rewriter<Config>::mk_nflat_mul_core(unsigned num_args, expr * con
|
||||||
new_args.push_back(curr);
|
new_args.push_back(curr);
|
||||||
prev = curr;
|
prev = curr;
|
||||||
}
|
}
|
||||||
TRACE("poly_rewriter",
|
TRACE(poly_rewriter,
|
||||||
for (unsigned i = 0; i < new_args.size(); i++) {
|
for (unsigned i = 0; i < new_args.size(); i++) {
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
tout << (lt(new_args[i-1], new_args[i]) ? " < " : " !< ");
|
tout << (lt(new_args[i-1], new_args[i]) ? " < " : " !< ");
|
||||||
|
@ -335,7 +335,7 @@ br_status poly_rewriter<Config>::mk_nflat_mul_core(unsigned num_args, expr * con
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
if (!ordered) {
|
if (!ordered) {
|
||||||
std::sort(new_args.begin(), new_args.end(), lt);
|
std::sort(new_args.begin(), new_args.end(), lt);
|
||||||
TRACE("poly_rewriter",
|
TRACE(poly_rewriter,
|
||||||
tout << "after sorting:\n";
|
tout << "after sorting:\n";
|
||||||
for (unsigned i = 0; i < new_args.size(); i++) {
|
for (unsigned i = 0; i < new_args.size(); i++) {
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
|
@ -347,7 +347,7 @@ br_status poly_rewriter<Config>::mk_nflat_mul_core(unsigned num_args, expr * con
|
||||||
SASSERT(new_args.size() >= 2);
|
SASSERT(new_args.size() >= 2);
|
||||||
result = mk_mul_app(new_args.size(), new_args.data());
|
result = mk_mul_app(new_args.size(), new_args.data());
|
||||||
result = mk_mul_app(c, result);
|
result = mk_mul_app(c, result);
|
||||||
TRACE("poly_rewriter",
|
TRACE(poly_rewriter,
|
||||||
for (unsigned i = 0; i < num_args; ++i)
|
for (unsigned i = 0; i < num_args; ++i)
|
||||||
tout << mk_ismt2_pp(args[i], M()) << " ";
|
tout << mk_ismt2_pp(args[i], M()) << " ";
|
||||||
tout << "\nmk_nflat_mul_core result:\n" << mk_ismt2_pp(result, M()) << "\n";);
|
tout << "\nmk_nflat_mul_core result:\n" << mk_ismt2_pp(result, M()) << "\n";);
|
||||||
|
@ -375,9 +375,9 @@ br_status poly_rewriter<Config>::mk_nflat_mul_core(unsigned num_args, expr * con
|
||||||
unsigned orig_size = sums.size();
|
unsigned orig_size = sums.size();
|
||||||
expr_ref_buffer sum(M()); // must be ref_buffer because we may throw an exception
|
expr_ref_buffer sum(M()); // must be ref_buffer because we may throw an exception
|
||||||
ptr_buffer<expr> m_args;
|
ptr_buffer<expr> m_args;
|
||||||
TRACE("som", tout << "starting soM()...\n";);
|
TRACE(som, tout << "starting soM()...\n";);
|
||||||
do {
|
do {
|
||||||
TRACE("som", for (unsigned i = 0; i < it.size(); i++) tout << it[i] << " ";
|
TRACE(som, for (unsigned i = 0; i < it.size(); i++) tout << it[i] << " ";
|
||||||
tout << "\n";);
|
tout << "\n";);
|
||||||
if (sum.size() > m_som_blowup * orig_size) {
|
if (sum.size() > m_som_blowup * orig_size) {
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
|
@ -564,7 +564,7 @@ br_status poly_rewriter<Config>::mk_nflat_add_core(unsigned num_args, expr * con
|
||||||
}
|
}
|
||||||
normalize(c);
|
normalize(c);
|
||||||
SASSERT(m_sort_sums || ordered);
|
SASSERT(m_sort_sums || ordered);
|
||||||
TRACE("rewriter",
|
TRACE(rewriter,
|
||||||
tout << "ordered: " << ordered << " sort sums: " << m_sort_sums << "\n";
|
tout << "ordered: " << ordered << " sort sums: " << m_sort_sums << "\n";
|
||||||
for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(args[i], M()) << "\n";);
|
for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(args[i], M()) << "\n";);
|
||||||
|
|
||||||
|
@ -615,14 +615,14 @@ br_status poly_rewriter<Config>::mk_nflat_add_core(unsigned num_args, expr * con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_sort_sums) {
|
if (m_sort_sums) {
|
||||||
TRACE("rewriter_bug", tout << "new_args.size(): " << new_args.size() << "\n";);
|
TRACE(rewriter_bug, tout << "new_args.size(): " << new_args.size() << "\n";);
|
||||||
if (c.is_zero())
|
if (c.is_zero())
|
||||||
std::sort(new_args.data(), new_args.data() + new_args.size(), mon_lt(*this));
|
std::sort(new_args.data(), new_args.data() + new_args.size(), mon_lt(*this));
|
||||||
else
|
else
|
||||||
std::sort(new_args.data() + 1, new_args.data() + new_args.size(), mon_lt(*this));
|
std::sort(new_args.data() + 1, new_args.data() + new_args.size(), mon_lt(*this));
|
||||||
}
|
}
|
||||||
result = mk_add_app(new_args.size(), new_args.data());
|
result = mk_add_app(new_args.size(), new_args.data());
|
||||||
TRACE("rewriter", tout << result << "\n";);
|
TRACE(rewriter, tout << result << "\n";);
|
||||||
if (hoist_multiplication(result)) {
|
if (hoist_multiplication(result)) {
|
||||||
return BR_REWRITE_FULL;
|
return BR_REWRITE_FULL;
|
||||||
}
|
}
|
||||||
|
@ -881,7 +881,7 @@ br_status poly_rewriter<Config>::cancel_monomials(expr * lhs, expr * rhs, bool m
|
||||||
new_lhs_monomials[0] = insert_c_lhs ? mk_numeral(c) : nullptr;
|
new_lhs_monomials[0] = insert_c_lhs ? mk_numeral(c) : nullptr;
|
||||||
lhs_result = mk_add_app(new_lhs_monomials.size() - lhs_offset, new_lhs_monomials.data() + lhs_offset);
|
lhs_result = mk_add_app(new_lhs_monomials.size() - lhs_offset, new_lhs_monomials.data() + lhs_offset);
|
||||||
rhs_result = mk_add_app(new_rhs_monomials.size() - rhs_offset, new_rhs_monomials.data() + rhs_offset);
|
rhs_result = mk_add_app(new_rhs_monomials.size() - rhs_offset, new_rhs_monomials.data() + rhs_offset);
|
||||||
TRACE("le_bug", tout << lhs_result << " " << rhs_result << "\n";);
|
TRACE(le_bug, tout << lhs_result << " " << rhs_result << "\n";);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ bool push_app_ite_cfg::is_target(func_decl * decl, unsigned num_args, expr * con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CTRACE("push_app_ite", found_ite, tout << "found target for push app ite:\n";
|
CTRACE(push_app_ite, found_ite, tout << "found target for push app ite:\n";
|
||||||
tout << "conservative " << m_conservative << "\n";
|
tout << "conservative " << m_conservative << "\n";
|
||||||
tout << decl->get_name();
|
tout << decl->get_name();
|
||||||
for (unsigned i = 0; i < num_args; i++) tout << " " << mk_pp(args[i], m);
|
for (unsigned i = 0; i < num_args; i++) tout << " " << mk_pp(args[i], m);
|
||||||
|
@ -75,7 +75,7 @@ br_status push_app_ite_cfg::reduce_app(func_decl * f, unsigned num, expr * const
|
||||||
expr_ref e_new(m.mk_app(f, num, args_prime), m);
|
expr_ref e_new(m.mk_app(f, num, args_prime), m);
|
||||||
args_prime[ite_arg_idx] = old;
|
args_prime[ite_arg_idx] = old;
|
||||||
result = m.mk_ite(c, t_new, e_new);
|
result = m.mk_ite(c, t_new, e_new);
|
||||||
TRACE("push_app_ite", tout << result << "\n";);
|
TRACE(push_app_ite, tout << result << "\n";);
|
||||||
if (m.proofs_enabled()) {
|
if (m.proofs_enabled()) {
|
||||||
result_pr = m.mk_rewrite(m.mk_app(f, num, args), result);
|
result_pr = m.mk_rewrite(m.mk_app(f, num, args), result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
void operator()(expr* fml, app_ref_vector& vars, bool& is_fa, expr_ref& result, bool use_fresh, bool rewrite_ok) {
|
void operator()(expr* fml, app_ref_vector& vars, bool& is_fa, expr_ref& result, bool use_fresh, bool rewrite_ok) {
|
||||||
quantifier_type qt = Q_none_pos;
|
quantifier_type qt = Q_none_pos;
|
||||||
pull_quantifier(fml, qt, vars, result, use_fresh, rewrite_ok);
|
pull_quantifier(fml, qt, vars, result, use_fresh, rewrite_ok);
|
||||||
TRACE("qe_verbose",
|
TRACE(qe_verbose,
|
||||||
tout << mk_pp(fml, m) << "\n";
|
tout << mk_pp(fml, m) << "\n";
|
||||||
tout << mk_pp(result, m) << "\n";);
|
tout << mk_pp(result, m) << "\n";);
|
||||||
SASSERT(is_positive(qt));
|
SASSERT(is_positive(qt));
|
||||||
|
@ -54,7 +54,7 @@ public:
|
||||||
void pull_exists(expr* fml, app_ref_vector& vars, expr_ref& result, bool use_fresh, bool rewrite_ok) {
|
void pull_exists(expr* fml, app_ref_vector& vars, expr_ref& result, bool use_fresh, bool rewrite_ok) {
|
||||||
quantifier_type qt = Q_exists_pos;
|
quantifier_type qt = Q_exists_pos;
|
||||||
pull_quantifier(fml, qt, vars, result, use_fresh, rewrite_ok);
|
pull_quantifier(fml, qt, vars, result, use_fresh, rewrite_ok);
|
||||||
TRACE("qe_verbose",
|
TRACE(qe_verbose,
|
||||||
tout << mk_pp(fml, m) << "\n";
|
tout << mk_pp(fml, m) << "\n";
|
||||||
tout << mk_pp(result, m) << "\n";);
|
tout << mk_pp(result, m) << "\n";);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public:
|
||||||
quantifier_type qt = is_forall?Q_forall_pos:Q_exists_pos;
|
quantifier_type qt = is_forall?Q_forall_pos:Q_exists_pos;
|
||||||
expr_ref result(m);
|
expr_ref result(m);
|
||||||
pull_quantifier(fml, qt, vars, result, use_fresh, rewrite_ok);
|
pull_quantifier(fml, qt, vars, result, use_fresh, rewrite_ok);
|
||||||
TRACE("qe_verbose",
|
TRACE(qe_verbose,
|
||||||
tout << mk_pp(fml, m) << "\n";
|
tout << mk_pp(fml, m) << "\n";
|
||||||
tout << mk_pp(result, m) << "\n";);
|
tout << mk_pp(result, m) << "\n";);
|
||||||
fml = std::move(result);
|
fml = std::move(result);
|
||||||
|
|
|
@ -50,7 +50,7 @@ bool rewriter_core::rewrites_from(expr* t, proof* p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rewriter_core::rewrites_to(expr* t, proof* p) {
|
bool rewriter_core::rewrites_to(expr* t, proof* p) {
|
||||||
CTRACE("rewriter", p && !m().proofs_disabled() && to_app(m().get_fact(p))->get_arg(1) != t,
|
CTRACE(rewriter, p && !m().proofs_disabled() && to_app(m().get_fact(p))->get_arg(1) != t,
|
||||||
tout << mk_pp(p, m()) << "\n";
|
tout << mk_pp(p, m()) << "\n";
|
||||||
tout << mk_pp(t, m()) << "\n";);
|
tout << mk_pp(t, m()) << "\n";);
|
||||||
return !p || m().proofs_disabled() || (to_app(m().get_fact(p))->get_arg(1) == t);
|
return !p || m().proofs_disabled() || (to_app(m().get_fact(p))->get_arg(1) == t);
|
||||||
|
@ -65,7 +65,7 @@ void rewriter_core::cache_shifted_result(expr * k, unsigned offset, expr * v) {
|
||||||
#endif
|
#endif
|
||||||
SASSERT(!m_proof_gen);
|
SASSERT(!m_proof_gen);
|
||||||
|
|
||||||
TRACE("rewriter_cache_result", tout << mk_ismt2_pp(k, m()) << "\n--->\n" << mk_ismt2_pp(v, m()) << "\n";);
|
TRACE(rewriter_cache_result, tout << mk_ismt2_pp(k, m()) << "\n--->\n" << mk_ismt2_pp(v, m()) << "\n";);
|
||||||
|
|
||||||
SASSERT(k->get_sort() == v->get_sort());
|
SASSERT(k->get_sort() == v->get_sort());
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ protected:
|
||||||
void end_scope();
|
void end_scope();
|
||||||
bool is_child_of_top_frame(expr * t) const;
|
bool is_child_of_top_frame(expr * t) const;
|
||||||
void set_new_child_flag(expr * old_t) {
|
void set_new_child_flag(expr * old_t) {
|
||||||
CTRACE("rewriter_bug", !is_child_of_top_frame(old_t), display_stack(tout, 3););
|
CTRACE(rewriter_bug, !is_child_of_top_frame(old_t), display_stack(tout, 3););
|
||||||
SASSERT(is_child_of_top_frame(old_t));
|
SASSERT(is_child_of_top_frame(old_t));
|
||||||
if (!m_frame_stack.empty())
|
if (!m_frame_stack.empty())
|
||||||
m_frame_stack.back().m_new_child = true;
|
m_frame_stack.back().m_new_child = true;
|
||||||
|
|
|
@ -34,7 +34,7 @@ void rewriter_tpl<Config>::process_var(var * v) {
|
||||||
m_pr = nullptr;
|
m_pr = nullptr;
|
||||||
}
|
}
|
||||||
set_new_child_flag(v);
|
set_new_child_flag(v);
|
||||||
TRACE("rewriter", tout << mk_ismt2_pp(v, m()) << " -> " << m_r << "\n";);
|
TRACE(rewriter, tout << mk_ismt2_pp(v, m()) << " -> " << m_r << "\n";);
|
||||||
m_r = nullptr;
|
m_r = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ void rewriter_tpl<Config>::process_var(var * v) {
|
||||||
unsigned index = 0;
|
unsigned index = 0;
|
||||||
expr * r;
|
expr * r;
|
||||||
if (idx < m_bindings.size() && (index = m_bindings.size() - idx - 1, r = m_bindings[index])) {
|
if (idx < m_bindings.size() && (index = m_bindings.size() - idx - 1, r = m_bindings[index])) {
|
||||||
CTRACE("rewriter", v->get_sort() != r->get_sort(),
|
CTRACE(rewriter, v->get_sort() != r->get_sort(),
|
||||||
tout << expr_ref(v, m()) << ":" << sort_ref(v->get_sort(), m()) << " != " << expr_ref(r, m()) << ":" << sort_ref(r->get_sort(), m());
|
tout << expr_ref(v, m()) << ":" << sort_ref(v->get_sort(), m()) << " != " << expr_ref(r, m()) << ":" << sort_ref(r->get_sort(), m());
|
||||||
tout << "index " << index << " bindings " << m_bindings.size() << "\n";
|
tout << "index " << index << " bindings " << m_bindings.size() << "\n";
|
||||||
display_bindings(tout););
|
display_bindings(tout););
|
||||||
|
@ -60,13 +60,13 @@ void rewriter_tpl<Config>::process_var(var * v) {
|
||||||
expr_ref tmp(m());
|
expr_ref tmp(m());
|
||||||
m_shifter(r, shift_amount, tmp);
|
m_shifter(r, shift_amount, tmp);
|
||||||
result_stack().push_back(tmp);
|
result_stack().push_back(tmp);
|
||||||
TRACE("rewriter", display_bindings(tout << "shift: " << shift_amount << " idx: " << idx << " --> " << tmp << "\n"););
|
TRACE(rewriter, display_bindings(tout << "shift: " << shift_amount << " idx: " << idx << " --> " << tmp << "\n"););
|
||||||
cache_shifted_result(r, shift_amount, tmp);
|
cache_shifted_result(r, shift_amount, tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result_stack().push_back(r);
|
result_stack().push_back(r);
|
||||||
TRACE("rewriter", tout << idx << " " << mk_ismt2_pp(r, m()) << "\n";);
|
TRACE(rewriter, tout << idx << " " << mk_ismt2_pp(r, m()) << "\n";);
|
||||||
}
|
}
|
||||||
set_new_child_flag(v);
|
set_new_child_flag(v);
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ bool rewriter_tpl<Config>::process_const(app * t0) {
|
||||||
retry:
|
retry:
|
||||||
SASSERT(t->get_num_args() == 0);
|
SASSERT(t->get_num_args() == 0);
|
||||||
br_status st = m_cfg.reduce_app(t->get_decl(), 0, nullptr, m_r, m_pr);
|
br_status st = m_cfg.reduce_app(t->get_decl(), 0, nullptr, m_r, m_pr);
|
||||||
TRACE("reduce_app",
|
TRACE(reduce_app,
|
||||||
tout << "t0:" << mk_bounded_pp(t0, m()) << "\n";
|
tout << "t0:" << mk_bounded_pp(t0, m()) << "\n";
|
||||||
if (t != t0) tout << "t: " << mk_bounded_pp(t, m()) << "\n";
|
if (t != t0) tout << "t: " << mk_bounded_pp(t, m()) << "\n";
|
||||||
tout << "st: " << st;
|
tout << "st: " << st;
|
||||||
|
@ -91,7 +91,7 @@ bool rewriter_tpl<Config>::process_const(app * t0) {
|
||||||
tout << "\n";
|
tout << "\n";
|
||||||
if (m_pr) tout << mk_bounded_pp(m_pr, m()) << "\n";
|
if (m_pr) tout << mk_bounded_pp(m_pr, m()) << "\n";
|
||||||
);
|
);
|
||||||
CTRACE("reduce_app",
|
CTRACE(reduce_app,
|
||||||
st != BR_FAILED && m_r->get_sort() != t->get_sort(),
|
st != BR_FAILED && m_r->get_sort() != t->get_sort(),
|
||||||
tout << mk_pp(t->get_sort(), m()) << ": " << mk_pp(t, m()) << "\n";
|
tout << mk_pp(t->get_sort(), m()) << ": " << mk_pp(t, m()) << "\n";
|
||||||
tout << m_r->get_id() << " " << mk_pp(m_r->get_sort(), m()) << ": " << m_r << "\n";);
|
tout << m_r->get_id() << " " << mk_pp(m_r->get_sort(), m()) << ": " << m_r << "\n";);
|
||||||
|
@ -141,11 +141,11 @@ bool rewriter_tpl<Config>::process_const(app * t0) {
|
||||||
template<typename Config>
|
template<typename Config>
|
||||||
template<bool ProofGen>
|
template<bool ProofGen>
|
||||||
bool rewriter_tpl<Config>::visit(expr * t, unsigned max_depth) {
|
bool rewriter_tpl<Config>::visit(expr * t, unsigned max_depth) {
|
||||||
TRACE("rewriter_visit", tout << "visiting\n" << mk_ismt2_pp(t, m()) << "\n";);
|
TRACE(rewriter_visit, tout << "visiting\n" << mk_ismt2_pp(t, m()) << "\n";);
|
||||||
expr * new_t = nullptr;
|
expr * new_t = nullptr;
|
||||||
proof * new_t_pr = nullptr;
|
proof * new_t_pr = nullptr;
|
||||||
if (m_cfg.get_subst(t, new_t, new_t_pr)) {
|
if (m_cfg.get_subst(t, new_t, new_t_pr)) {
|
||||||
TRACE("rewriter_subst", tout << "subst\n" << mk_ismt2_pp(t, m()) << "\n---->\n" << mk_ismt2_pp(new_t, m()) << "\n";);
|
TRACE(rewriter_subst, tout << "subst\n" << mk_ismt2_pp(t, m()) << "\n---->\n" << mk_ismt2_pp(new_t, m()) << "\n";);
|
||||||
SASSERT(t->get_sort() == new_t->get_sort());
|
SASSERT(t->get_sort() == new_t->get_sort());
|
||||||
result_stack().push_back(new_t);
|
result_stack().push_back(new_t);
|
||||||
set_new_child_flag(t, new_t);
|
set_new_child_flag(t, new_t);
|
||||||
|
@ -196,7 +196,7 @@ bool rewriter_tpl<Config>::visit(expr * t, unsigned max_depth) {
|
||||||
if (to_app(t)->get_num_args() == 0) {
|
if (to_app(t)->get_num_args() == 0) {
|
||||||
if (process_const<ProofGen>(to_app(t)))
|
if (process_const<ProofGen>(to_app(t)))
|
||||||
return true;
|
return true;
|
||||||
TRACE("rewriter_const", tout << "process const: " << mk_bounded_pp(t, m()) << " -> " << mk_bounded_pp(m_r, m()) << "\n";);
|
TRACE(rewriter_const, tout << "process const: " << mk_bounded_pp(t, m()) << " -> " << mk_bounded_pp(m_r, m()) << "\n";);
|
||||||
if (!is_blocked(t)) {
|
if (!is_blocked(t)) {
|
||||||
rewriter_tpl rw(m(), false, m_cfg);
|
rewriter_tpl rw(m(), false, m_cfg);
|
||||||
for (auto* s : m_blocked)
|
for (auto* s : m_blocked)
|
||||||
|
@ -243,14 +243,14 @@ bool rewriter_tpl<Config>::constant_fold(app * t, frame & fr) {
|
||||||
result_stack().shrink(fr.m_spos);
|
result_stack().shrink(fr.m_spos);
|
||||||
result_stack().push_back(arg);
|
result_stack().push_back(arg);
|
||||||
fr.m_state = REWRITE_BUILTIN;
|
fr.m_state = REWRITE_BUILTIN;
|
||||||
TRACE("rewriter_step", tout << "step\n" << mk_ismt2_pp(t, m()) << "\n";);
|
TRACE(rewriter_step, tout << "step\n" << mk_ismt2_pp(t, m()) << "\n";);
|
||||||
if (visit<false>(arg, fr.m_max_depth)) {
|
if (visit<false>(arg, fr.m_max_depth)) {
|
||||||
m_r = result_stack().back();
|
m_r = result_stack().back();
|
||||||
result_stack().pop_back();
|
result_stack().pop_back();
|
||||||
result_stack().pop_back();
|
result_stack().pop_back();
|
||||||
result_stack().push_back(m_r);
|
result_stack().push_back(m_r);
|
||||||
cache_result<false>(t, m_r, m_pr, fr.m_cache_result);
|
cache_result<false>(t, m_r, m_pr, fr.m_cache_result);
|
||||||
TRACE("rewriter_step", tout << "step 1\n" << mk_ismt2_pp(m_r, m()) << "\n";);
|
TRACE(rewriter_step, tout << "step 1\n" << mk_ismt2_pp(m_r, m()) << "\n";);
|
||||||
frame_stack().pop_back();
|
frame_stack().pop_back();
|
||||||
set_new_child_flag(t);
|
set_new_child_flag(t);
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ void rewriter_tpl<Config>::process_app(app * t, frame & fr) {
|
||||||
}
|
}
|
||||||
br_status st = m_cfg.reduce_app(f, new_num_args, new_args, m_r, m_pr2);
|
br_status st = m_cfg.reduce_app(f, new_num_args, new_args, m_r, m_pr2);
|
||||||
|
|
||||||
CTRACE("reduce_app", true || st != BR_FAILED || new_t,
|
CTRACE(reduce_app, true || st != BR_FAILED || new_t,
|
||||||
tout << mk_bounded_pp(t, m()) << "\n";
|
tout << mk_bounded_pp(t, m()) << "\n";
|
||||||
tout << "st: " << st;
|
tout << "st: " << st;
|
||||||
if (m_r) tout << " --->\n" << mk_bounded_pp(m_r, m());
|
if (m_r) tout << " --->\n" << mk_bounded_pp(m_r, m());
|
||||||
|
@ -425,7 +425,7 @@ void rewriter_tpl<Config>::process_app(app * t, frame & fr) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fr.m_state = EXPAND_DEF;
|
fr.m_state = EXPAND_DEF;
|
||||||
TRACE("get_macro", tout << "f: " << f->get_name() << ", def: \n" << mk_ismt2_pp(def, m()) << "\n";
|
TRACE(get_macro, tout << "f: " << f->get_name() << ", def: \n" << mk_ismt2_pp(def, m()) << "\n";
|
||||||
tout << "Args num: " << num_args << "\n";
|
tout << "Args num: " << num_args << "\n";
|
||||||
for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(new_args[i], m()) << "\n";);
|
for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(new_args[i], m()) << "\n";);
|
||||||
unsigned sz = m_bindings.size();
|
unsigned sz = m_bindings.size();
|
||||||
|
@ -436,7 +436,7 @@ void rewriter_tpl<Config>::process_app(app * t, frame & fr) {
|
||||||
m_shifts.push_back(sz);
|
m_shifts.push_back(sz);
|
||||||
}
|
}
|
||||||
result_stack().push_back(def);
|
result_stack().push_back(def);
|
||||||
TRACE("get_macro", display_bindings(tout););
|
TRACE(get_macro, display_bindings(tout););
|
||||||
begin_scope();
|
begin_scope();
|
||||||
m_num_qvars += num_args;
|
m_num_qvars += num_args;
|
||||||
m_root = def;
|
m_root = def;
|
||||||
|
@ -453,7 +453,7 @@ void rewriter_tpl<Config>::process_app(app * t, frame & fr) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("rewriter_reuse", tout << "reusing:\n" << mk_ismt2_pp(t, m()) << "\n";);
|
TRACE(rewriter_reuse, tout << "reusing:\n" << mk_ismt2_pp(t, m()) << "\n";);
|
||||||
m_r = t;
|
m_r = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -557,7 +557,7 @@ void rewriter_tpl<Config>::process_quantifier(quantifier * q, frame & fr) {
|
||||||
expr_ref_vector new_pats(m_manager, num_pats, q->get_patterns());
|
expr_ref_vector new_pats(m_manager, num_pats, q->get_patterns());
|
||||||
expr_ref_vector new_no_pats(m_manager, num_no_pats, q->get_no_patterns());
|
expr_ref_vector new_no_pats(m_manager, num_no_pats, q->get_no_patterns());
|
||||||
if (rewrite_patterns()) {
|
if (rewrite_patterns()) {
|
||||||
TRACE("reduce_quantifier_bug", tout << "rewrite patterns\n";);
|
TRACE(reduce_quantifier_bug, tout << "rewrite patterns\n";);
|
||||||
expr * const * np = it + 1;
|
expr * const * np = it + 1;
|
||||||
expr * const * nnp = np + num_pats;
|
expr * const * nnp = np + num_pats;
|
||||||
unsigned j = 0;
|
unsigned j = 0;
|
||||||
|
@ -591,18 +591,18 @@ void rewriter_tpl<Config>::process_quantifier(quantifier * q, frame & fr) {
|
||||||
if (m_cfg.reduce_quantifier(new_q, new_body, new_pats.data(), new_no_pats.data(), m_r, pr2)) {
|
if (m_cfg.reduce_quantifier(new_q, new_body, new_pats.data(), new_no_pats.data(), m_r, pr2)) {
|
||||||
m_pr = m().mk_transitivity(m_pr, pr2);
|
m_pr = m().mk_transitivity(m_pr, pr2);
|
||||||
}
|
}
|
||||||
TRACE("reduce_quantifier_bug",if (m_pr) tout << mk_ismt2_pp(m_pr, m()) << "\n"; else tout << "m_pr is_null\n";);
|
TRACE(reduce_quantifier_bug,if (m_pr) tout << mk_ismt2_pp(m_pr, m()) << "\n"; else tout << "m_pr is_null\n";);
|
||||||
result_pr_stack().shrink(fr.m_spos);
|
result_pr_stack().shrink(fr.m_spos);
|
||||||
result_pr_stack().push_back(m_pr);
|
result_pr_stack().push_back(m_pr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("reduce_quantifier_bug", tout << mk_ismt2_pp(q, m()) << " " << mk_ismt2_pp(new_body, m()) << "\n";);
|
TRACE(reduce_quantifier_bug, tout << mk_ismt2_pp(q, m()) << " " << mk_ismt2_pp(new_body, m()) << "\n";);
|
||||||
if (!m_cfg.reduce_quantifier(q, new_body, new_pats.data(), new_no_pats.data(), m_r, m_pr)) {
|
if (!m_cfg.reduce_quantifier(q, new_body, new_pats.data(), new_no_pats.data(), m_r, m_pr)) {
|
||||||
if (fr.m_new_child) {
|
if (fr.m_new_child) {
|
||||||
m_r = m().update_quantifier(q, num_pats, new_pats.data(), num_no_pats, new_no_pats.data(), new_body);
|
m_r = m().update_quantifier(q, num_pats, new_pats.data(), num_no_pats, new_no_pats.data(), new_body);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("rewriter_reuse", tout << "reusing:\n" << mk_ismt2_pp(q, m()) << "\n";);
|
TRACE(rewriter_reuse, tout << "reusing:\n" << mk_ismt2_pp(q, m()) << "\n";);
|
||||||
m_r = q;
|
m_r = q;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -680,8 +680,8 @@ void rewriter_tpl<Config>::set_bindings(unsigned num_bindings, expr * const * bi
|
||||||
m_bindings.push_back(bindings[i]);
|
m_bindings.push_back(bindings[i]);
|
||||||
m_shifts.push_back(num_bindings);
|
m_shifts.push_back(num_bindings);
|
||||||
}
|
}
|
||||||
TRACE("rewriter", display_bindings(tout););
|
TRACE(rewriter, display_bindings(tout););
|
||||||
SCTRACE("bindings", is_trace_enabled("coming_from_quant"), display_bindings(tout););
|
SCTRACE(bindings, is_trace_enabled(TraceTag::coming_from_quant), display_bindings(tout););
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Config>
|
template<typename Config>
|
||||||
|
@ -694,8 +694,8 @@ void rewriter_tpl<Config>::set_inv_bindings(unsigned num_bindings, expr * const
|
||||||
m_bindings.push_back(bindings[i]);
|
m_bindings.push_back(bindings[i]);
|
||||||
m_shifts.push_back(num_bindings);
|
m_shifts.push_back(num_bindings);
|
||||||
}
|
}
|
||||||
TRACE("rewriter", display_bindings(tout););
|
TRACE(rewriter, display_bindings(tout););
|
||||||
SCTRACE("bindings", is_trace_enabled("coming_from_quant"), display_bindings(tout););
|
SCTRACE(bindings, is_trace_enabled(TraceTag::coming_from_quant), display_bindings(tout););
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Config>
|
template<typename Config>
|
||||||
|
@ -741,7 +741,7 @@ void rewriter_tpl<Config>::main_loop(expr * t, expr_ref & result, proof_ref & re
|
||||||
else {
|
else {
|
||||||
resume_core<ProofGen>(result, result_pr);
|
resume_core<ProofGen>(result, result_pr);
|
||||||
}
|
}
|
||||||
TRACE("rewriter", tout << mk_ismt2_pp(t, m()) << "\n=>\n" << result << "\n";;);
|
TRACE(rewriter, tout << mk_ismt2_pp(t, m()) << "\n=>\n" << result << "\n";;);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -761,7 +761,7 @@ void rewriter_tpl<Config>::resume_core(expr_ref & result, proof_ref & result_pr)
|
||||||
SASSERT(!ProofGen || result_stack().size() == result_pr_stack().size());
|
SASSERT(!ProofGen || result_stack().size() == result_pr_stack().size());
|
||||||
frame & fr = frame_stack().back();
|
frame & fr = frame_stack().back();
|
||||||
expr * t = fr.m_curr;
|
expr * t = fr.m_curr;
|
||||||
TRACE("rewriter_step", tout << "step\n" << mk_ismt2_pp(t, m()) << "\n";);
|
TRACE(rewriter_step, tout << "step\n" << mk_ismt2_pp(t, m()) << "\n";);
|
||||||
m_num_steps++;
|
m_num_steps++;
|
||||||
check_max_steps();
|
check_max_steps();
|
||||||
if (first_visit(fr) && fr.m_cache_result) {
|
if (first_visit(fr) && fr.m_cache_result) {
|
||||||
|
|
|
@ -191,7 +191,7 @@ namespace seq {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void axioms::extract_axiom(expr* e) {
|
void axioms::extract_axiom(expr* e) {
|
||||||
TRACE("seq", tout << mk_pp(e, m) << "\n";);
|
TRACE(seq, tout << mk_pp(e, m) << "\n";);
|
||||||
expr* _s = nullptr, *_i = nullptr, *_l = nullptr;
|
expr* _s = nullptr, *_i = nullptr, *_l = nullptr;
|
||||||
VERIFY(seq.str.is_extract(e, _s, _i, _l));
|
VERIFY(seq.str.is_extract(e, _s, _i, _l));
|
||||||
auto s = purify(_s);
|
auto s = purify(_s);
|
||||||
|
@ -218,7 +218,7 @@ namespace seq {
|
||||||
extract_suffix_axiom(e, s, i);
|
extract_suffix_axiom(e, s, i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TRACE("seq", tout << s << " " << i << " " << l << "\n";);
|
TRACE(seq, tout << s << " " << i << " " << l << "\n";);
|
||||||
expr_ref x = m_sk.mk_pre(s, i);
|
expr_ref x = m_sk.mk_pre(s, i);
|
||||||
expr_ref ls = mk_len(_s);
|
expr_ref ls = mk_len(_s);
|
||||||
expr_ref lx = mk_len(x);
|
expr_ref lx = mk_len(x);
|
||||||
|
@ -262,14 +262,14 @@ namespace seq {
|
||||||
void axioms::tail_axiom(expr* e, expr* s) {
|
void axioms::tail_axiom(expr* e, expr* s) {
|
||||||
expr_ref head(m), tail(m);
|
expr_ref head(m), tail(m);
|
||||||
m_sk.decompose(s, head, tail);
|
m_sk.decompose(s, head, tail);
|
||||||
TRACE("seq", tout << "tail " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << "\n";);
|
TRACE(seq, tout << "tail " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << "\n";);
|
||||||
expr_ref emp = mk_eq_empty(s);
|
expr_ref emp = mk_eq_empty(s);
|
||||||
add_clause(emp, mk_seq_eq(s, mk_concat(head, e)));
|
add_clause(emp, mk_seq_eq(s, mk_concat(head, e)));
|
||||||
add_clause(~emp, mk_eq_empty(e));
|
add_clause(~emp, mk_eq_empty(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
void axioms::drop_last_axiom(expr* e, expr* s) {
|
void axioms::drop_last_axiom(expr* e, expr* s) {
|
||||||
TRACE("seq", tout << "drop last " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << "\n";);
|
TRACE(seq, tout << "drop last " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << "\n";);
|
||||||
expr_ref emp = mk_eq_empty(s);
|
expr_ref emp = mk_eq_empty(s);
|
||||||
add_clause(emp, mk_seq_eq(s, mk_concat(e, seq.str.mk_unit(m_sk.mk_last(s)))));
|
add_clause(emp, mk_seq_eq(s, mk_concat(e, seq.str.mk_unit(m_sk.mk_last(s)))));
|
||||||
add_clause(~emp, mk_eq_empty(e));
|
add_clause(~emp, mk_eq_empty(e));
|
||||||
|
@ -331,7 +331,7 @@ namespace seq {
|
||||||
len(s) < l => e = s
|
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";);
|
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 le = mk_len(e);
|
||||||
expr_ref ls = mk_len(s);
|
expr_ref ls = mk_len(s);
|
||||||
expr_ref ls_minus_l(mk_sub(ls, l), m);
|
expr_ref ls_minus_l(mk_sub(ls, l), m);
|
||||||
|
@ -351,7 +351,7 @@ namespace seq {
|
||||||
i > len(s) => e = empty
|
i > len(s) => e = empty
|
||||||
*/
|
*/
|
||||||
void axioms::extract_suffix_axiom(expr* e, expr* s, expr* i) {
|
void axioms::extract_suffix_axiom(expr* e, expr* s, expr* i) {
|
||||||
TRACE("seq", tout << "suffix " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << "\n";);
|
TRACE(seq, tout << "suffix " << mk_bounded_pp(e, m, 2) << " " << mk_bounded_pp(s, m, 2) << "\n";);
|
||||||
expr_ref x = m_sk.mk_pre(s, i);
|
expr_ref x = m_sk.mk_pre(s, i);
|
||||||
expr_ref lx = mk_len(x);
|
expr_ref lx = mk_len(x);
|
||||||
expr_ref ls = mk_len(s);
|
expr_ref ls = mk_len(s);
|
||||||
|
@ -594,7 +594,7 @@ namespace seq {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
void axioms::at_axiom(expr* e) {
|
void axioms::at_axiom(expr* e) {
|
||||||
TRACE("seq", tout << "at-axiom: " << mk_bounded_pp(e, m) << "\n";);
|
TRACE(seq, tout << "at-axiom: " << mk_bounded_pp(e, m) << "\n";);
|
||||||
expr* _s = nullptr, *_i = nullptr;
|
expr* _s = nullptr, *_i = nullptr;
|
||||||
VERIFY(seq.str.is_at(e, _s, _i));
|
VERIFY(seq.str.is_at(e, _s, _i));
|
||||||
auto s = purify(_s);
|
auto s = purify(_s);
|
||||||
|
@ -667,7 +667,7 @@ namespace seq {
|
||||||
|
|
||||||
void axioms::itos_axiom(expr* e) {
|
void axioms::itos_axiom(expr* e) {
|
||||||
expr* n = nullptr;
|
expr* n = nullptr;
|
||||||
TRACE("seq", tout << mk_pp(e, m) << "\n";);
|
TRACE(seq, tout << mk_pp(e, m) << "\n";);
|
||||||
VERIFY(seq.str.is_itos(e, n));
|
VERIFY(seq.str.is_itos(e, n));
|
||||||
|
|
||||||
// itos(n) = "" <=> n < 0
|
// itos(n) = "" <=> n < 0
|
||||||
|
@ -704,7 +704,7 @@ namespace seq {
|
||||||
stoi(s) >= 0 => len(s) >= 1
|
stoi(s) >= 0 => len(s) >= 1
|
||||||
*/
|
*/
|
||||||
void axioms::stoi_axiom(expr* e) {
|
void axioms::stoi_axiom(expr* e) {
|
||||||
TRACE("seq", tout << mk_pp(e, m) << "\n";);
|
TRACE(seq, tout << mk_pp(e, m) << "\n";);
|
||||||
expr_ref ge0 = mk_ge(e, 0);
|
expr_ref ge0 = mk_ge(e, 0);
|
||||||
expr* s = nullptr;
|
expr* s = nullptr;
|
||||||
VERIFY (seq.str.is_stoi(e, s));
|
VERIFY (seq.str.is_stoi(e, s));
|
||||||
|
|
|
@ -251,7 +251,7 @@ eautomaton* re2automaton::operator()(expr* e) {
|
||||||
if (r) {
|
if (r) {
|
||||||
r->compress();
|
r->compress();
|
||||||
bool_rewriter br(m);
|
bool_rewriter br(m);
|
||||||
TRACE("seq", display_expr1 disp(m); r->display(tout << mk_pp(e, m) << " -->\n", disp););
|
TRACE(seq, display_expr1 disp(m); r->display(tout << mk_pp(e, m) << " -->\n", disp););
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ eautomaton* re2automaton::re2aut(expr* e) {
|
||||||
expr_ref _start(m), _stop(m);
|
expr_ref _start(m), _stop(m);
|
||||||
if (is_unit_char(e1, _start) &&
|
if (is_unit_char(e1, _start) &&
|
||||||
is_unit_char(e2, _stop)) {
|
is_unit_char(e2, _stop)) {
|
||||||
TRACE("seq", tout << "Range: " << _start << " " << _stop << "\n";);
|
TRACE(seq, tout << "Range: " << _start << " " << _stop << "\n";);
|
||||||
a = alloc(eautomaton, sm, sym_expr::mk_range(_start, _stop));
|
a = alloc(eautomaton, sm, sym_expr::mk_range(_start, _stop));
|
||||||
return a.detach();
|
return a.detach();
|
||||||
}
|
}
|
||||||
|
@ -360,11 +360,11 @@ eautomaton* re2automaton::re2aut(expr* e) {
|
||||||
}
|
}
|
||||||
else if (u.re.is_intersection(e, e1, e2) && m_sa && (a = re2aut(e1)) && (b = re2aut(e2))) {
|
else if (u.re.is_intersection(e, e1, e2) && m_sa && (a = re2aut(e1)) && (b = re2aut(e2))) {
|
||||||
eautomaton* r = m_sa->mk_product(*a, *b);
|
eautomaton* r = m_sa->mk_product(*a, *b);
|
||||||
TRACE("seq", display_expr1 disp(m); a->display(tout << "a:", disp); b->display(tout << "b:", disp); r->display(tout << "intersection:", disp););
|
TRACE(seq, display_expr1 disp(m); a->display(tout << "a:", disp); b->display(tout << "b:", disp); r->display(tout << "intersection:", disp););
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("seq", tout << "not handled " << mk_pp(e, m) << "\n";);
|
TRACE(seq, tout << "not handled " << mk_pp(e, m) << "\n";);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -763,7 +763,7 @@ br_status seq_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * con
|
||||||
if (st == BR_FAILED) {
|
if (st == BR_FAILED) {
|
||||||
st = lift_ites_throttled(f, num_args, args, result);
|
st = lift_ites_throttled(f, num_args, args, result);
|
||||||
}
|
}
|
||||||
CTRACE("seq_verbose", st != BR_FAILED, tout << expr_ref(m().mk_app(f, num_args, args), m()) << " -> " << result << "\n";);
|
CTRACE(seq_verbose, st != BR_FAILED, tout << expr_ref(m().mk_app(f, num_args, args), m()) << " -> " << result << "\n";);
|
||||||
SASSERT(st == BR_FAILED || result->get_sort() == f->get_range());
|
SASSERT(st == BR_FAILED || result->get_sort() == f->get_range());
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
@ -777,7 +777,7 @@ br_status seq_rewriter::mk_seq_unit(expr* e, expr_ref& result) {
|
||||||
if (m_util.is_const_char(e, ch) && m_coalesce_chars) {
|
if (m_util.is_const_char(e, ch) && m_coalesce_chars) {
|
||||||
// convert to string constant
|
// convert to string constant
|
||||||
zstring s(ch);
|
zstring s(ch);
|
||||||
TRACE("seq_verbose", tout << "rewrite seq.unit of 8-bit value " << ch << " to string constant \"" << s<< "\"" << std::endl;);
|
TRACE(seq_verbose, tout << "rewrite seq.unit of 8-bit value " << ch << " to string constant \"" << s<< "\"" << std::endl;);
|
||||||
result = str().mk_string(s);
|
result = str().mk_string(s);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
|
@ -994,7 +994,7 @@ br_status seq_rewriter::lift_ites_throttled(func_decl* f, unsigned n, expr* cons
|
||||||
new_args[i] = e;
|
new_args[i] = e;
|
||||||
expr_ref arg2(m().mk_app(f, new_args), m());
|
expr_ref arg2(m().mk_app(f, new_args), m());
|
||||||
result = m().mk_ite(c, arg1, arg2);
|
result = m().mk_ite(c, arg1, arg2);
|
||||||
TRACE("seq_verbose", tout << "lifting ite: " << mk_pp(result, m()) << std::endl;);
|
TRACE(seq_verbose, tout << "lifting ite: " << mk_pp(result, m()) << std::endl;);
|
||||||
return BR_REWRITE2;
|
return BR_REWRITE2;
|
||||||
}
|
}
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
|
@ -1137,7 +1137,7 @@ bool seq_rewriter::extract_push_offset(expr_ref_vector const& as, expr* b, expr*
|
||||||
t1 = str().mk_concat(as.size() - i, as.data() + i, as[0]->get_sort());
|
t1 = str().mk_concat(as.size() - i, as.data() + i, as[0]->get_sort());
|
||||||
expr_ref t2 = mk_len(pos1, lens);
|
expr_ref t2 = mk_len(pos1, lens);
|
||||||
result = str().mk_substr(t1, t2, c);
|
result = str().mk_substr(t1, t2, c);
|
||||||
TRACE("seq", tout << result << "\n";);
|
TRACE(seq, tout << result << "\n";);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1174,7 +1174,7 @@ bool seq_rewriter::extract_push_length(expr_ref_vector& as, expr* b, expr* c, ex
|
||||||
result = str().mk_substr(t1, b, t2);
|
result = str().mk_substr(t1, b, t2);
|
||||||
as[i] = result;
|
as[i] = result;
|
||||||
result = str().mk_concat(i + 1, as.data(), as[0]->get_sort());
|
result = str().mk_concat(i + 1, as.data(), as[0]->get_sort());
|
||||||
TRACE("seq", tout << result << "\n";);
|
TRACE(seq, tout << result << "\n";);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1186,7 +1186,7 @@ br_status seq_rewriter::mk_seq_extract(expr* a, expr* b, expr* c, expr_ref& resu
|
||||||
zstring s;
|
zstring s;
|
||||||
rational pos, len;
|
rational pos, len;
|
||||||
|
|
||||||
TRACE("seq_verbose", tout << mk_pp(a, m()) << " " << mk_pp(b, m()) << " " << mk_pp(c, m()) << "\n";);
|
TRACE(seq_verbose, tout << mk_pp(a, m()) << " " << mk_pp(b, m()) << " " << mk_pp(c, m()) << "\n";);
|
||||||
bool constantBase = str().is_string(a, s);
|
bool constantBase = str().is_string(a, s);
|
||||||
bool constantPos = m_autil.is_numeral(b, pos);
|
bool constantPos = m_autil.is_numeral(b, pos);
|
||||||
bool constantLen = m_autil.is_numeral(c, len);
|
bool constantLen = m_autil.is_numeral(c, len);
|
||||||
|
@ -1453,7 +1453,7 @@ br_status seq_rewriter::mk_seq_contains(expr* a, expr* b, expr_ref& result) {
|
||||||
str().get_concat_units(a, as);
|
str().get_concat_units(a, as);
|
||||||
str().get_concat_units(b, bs);
|
str().get_concat_units(b, bs);
|
||||||
|
|
||||||
TRACE("seq", tout << mk_pp(a, m()) << " contains " << mk_pp(b, m()) << "\n";);
|
TRACE(seq, tout << mk_pp(a, m()) << " contains " << mk_pp(b, m()) << "\n";);
|
||||||
|
|
||||||
if (bs.empty()) {
|
if (bs.empty()) {
|
||||||
result = m().mk_true();
|
result = m().mk_true();
|
||||||
|
@ -2253,14 +2253,14 @@ br_status seq_rewriter::mk_seq_replace_re(expr* a, expr* b, expr* c, expr_ref& r
|
||||||
}
|
}
|
||||||
|
|
||||||
br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) {
|
br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) {
|
||||||
TRACE("seq", tout << mk_pp(a, m()) << " " << mk_pp(b, m()) << "\n";);
|
TRACE(seq, tout << mk_pp(a, m()) << " " << mk_pp(b, m()) << "\n";);
|
||||||
zstring s1, s2;
|
zstring s1, s2;
|
||||||
bool isc1 = str().is_string(a, s1);
|
bool isc1 = str().is_string(a, s1);
|
||||||
bool isc2 = str().is_string(b, s2);
|
bool isc2 = str().is_string(b, s2);
|
||||||
sort* sort_a = a->get_sort();
|
sort* sort_a = a->get_sort();
|
||||||
if (isc1 && isc2) {
|
if (isc1 && isc2) {
|
||||||
result = m().mk_bool_val(s1.prefixof(s2));
|
result = m().mk_bool_val(s1.prefixof(s2));
|
||||||
TRACE("seq", tout << result << "\n";);
|
TRACE(seq, tout << result << "\n";);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
if (str().is_empty(a)) {
|
if (str().is_empty(a)) {
|
||||||
|
@ -2278,7 +2278,7 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) {
|
||||||
if (s1.prefixof(s2)) {
|
if (s1.prefixof(s2)) {
|
||||||
if (a == a1) {
|
if (a == a1) {
|
||||||
result = m().mk_true();
|
result = m().mk_true();
|
||||||
TRACE("seq", tout << s1 << " " << s2 << " " << result << "\n";);
|
TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
str().get_concat(a, as);
|
str().get_concat(a, as);
|
||||||
|
@ -2288,12 +2288,12 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) {
|
||||||
bs[0] = str().mk_string(s2);
|
bs[0] = str().mk_string(s2);
|
||||||
result = str().mk_prefix(str().mk_concat(as.size()-1, as.data()+1, sort_a),
|
result = str().mk_prefix(str().mk_concat(as.size()-1, as.data()+1, sort_a),
|
||||||
str().mk_concat(bs.size(), bs.data(), sort_a));
|
str().mk_concat(bs.size(), bs.data(), sort_a));
|
||||||
TRACE("seq", tout << s1 << " " << s2 << " " << result << "\n";);
|
TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";);
|
||||||
return BR_REWRITE_FULL;
|
return BR_REWRITE_FULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = m().mk_false();
|
result = m().mk_false();
|
||||||
TRACE("seq", tout << s1 << " " << s2 << " " << result << "\n";);
|
TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2301,7 +2301,7 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) {
|
||||||
if (s2.prefixof(s1)) {
|
if (s2.prefixof(s1)) {
|
||||||
if (b == b1) {
|
if (b == b1) {
|
||||||
result = m().mk_false();
|
result = m().mk_false();
|
||||||
TRACE("seq", tout << s1 << " " << s2 << " " << result << "\n";);
|
TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
str().get_concat(a, as);
|
str().get_concat(a, as);
|
||||||
|
@ -2311,12 +2311,12 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) {
|
||||||
as[0] = str().mk_string(s1);
|
as[0] = str().mk_string(s1);
|
||||||
result = str().mk_prefix(str().mk_concat(as.size(), as.data(), sort_a),
|
result = str().mk_prefix(str().mk_concat(as.size(), as.data(), sort_a),
|
||||||
str().mk_concat(bs.size()-1, bs.data()+1, sort_a));
|
str().mk_concat(bs.size()-1, bs.data()+1, sort_a));
|
||||||
TRACE("seq", tout << s1 << " " << s2 << " " << result << "\n";);
|
TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";);
|
||||||
return BR_REWRITE_FULL;
|
return BR_REWRITE_FULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = m().mk_false();
|
result = m().mk_false();
|
||||||
TRACE("seq", tout << s1 << " " << s2 << " " << result << "\n";);
|
TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2342,7 +2342,7 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) {
|
||||||
}
|
}
|
||||||
if (i == as.size()) {
|
if (i == as.size()) {
|
||||||
result = mk_and(eqs);
|
result = mk_and(eqs);
|
||||||
TRACE("seq", tout << result << "\n";);
|
TRACE(seq, tout << result << "\n";);
|
||||||
return BR_REWRITE3;
|
return BR_REWRITE3;
|
||||||
}
|
}
|
||||||
SASSERT(i < as.size());
|
SASSERT(i < as.size());
|
||||||
|
@ -2351,7 +2351,7 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) {
|
||||||
eqs.push_back(str().mk_is_empty(as.get(j)));
|
eqs.push_back(str().mk_is_empty(as.get(j)));
|
||||||
}
|
}
|
||||||
result = mk_and(eqs);
|
result = mk_and(eqs);
|
||||||
TRACE("seq", tout << result << "\n";);
|
TRACE(seq, tout << result << "\n";);
|
||||||
return BR_REWRITE3;
|
return BR_REWRITE3;
|
||||||
}
|
}
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
|
@ -2360,7 +2360,7 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) {
|
||||||
b = str().mk_concat(bs.size() - i, bs.data() + i, sort_a);
|
b = str().mk_concat(bs.size() - i, bs.data() + i, sort_a);
|
||||||
eqs.push_back(str().mk_prefix(a, b));
|
eqs.push_back(str().mk_prefix(a, b));
|
||||||
result = mk_and(eqs);
|
result = mk_and(eqs);
|
||||||
TRACE("seq", tout << result << "\n";);
|
TRACE(seq, tout << result << "\n";);
|
||||||
return BR_REWRITE3;
|
return BR_REWRITE3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2420,7 +2420,7 @@ br_status seq_rewriter::mk_seq_suffix(expr* a, expr* b, expr_ref& result) {
|
||||||
}
|
}
|
||||||
if (i > sza) {
|
if (i > sza) {
|
||||||
result = mk_and(eqs);
|
result = mk_and(eqs);
|
||||||
TRACE("seq", tout << result << "\n";);
|
TRACE(seq, tout << result << "\n";);
|
||||||
return BR_REWRITE3;
|
return BR_REWRITE3;
|
||||||
}
|
}
|
||||||
if (i > szb) {
|
if (i > szb) {
|
||||||
|
@ -2429,7 +2429,7 @@ br_status seq_rewriter::mk_seq_suffix(expr* a, expr* b, expr_ref& result) {
|
||||||
eqs.push_back(str().mk_is_empty(aj));
|
eqs.push_back(str().mk_is_empty(aj));
|
||||||
}
|
}
|
||||||
result = mk_and(eqs);
|
result = mk_and(eqs);
|
||||||
TRACE("seq", tout << result << "\n";);
|
TRACE(seq, tout << result << "\n";);
|
||||||
return BR_REWRITE3;
|
return BR_REWRITE3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2439,7 +2439,7 @@ br_status seq_rewriter::mk_seq_suffix(expr* a, expr* b, expr_ref& result) {
|
||||||
b = str().mk_concat(szb - i + 1, bs.data(), sort_a);
|
b = str().mk_concat(szb - i + 1, bs.data(), sort_a);
|
||||||
eqs.push_back(str().mk_suffix(a, b));
|
eqs.push_back(str().mk_suffix(a, b));
|
||||||
result = mk_and(eqs);
|
result = mk_and(eqs);
|
||||||
TRACE("seq", tout << result << "\n";);
|
TRACE(seq, tout << result << "\n";);
|
||||||
return BR_REWRITE3;
|
return BR_REWRITE3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2889,14 +2889,14 @@ expr_ref seq_rewriter::re_predicate(expr* cond, sort* seq_sort) {
|
||||||
}
|
}
|
||||||
|
|
||||||
expr_ref seq_rewriter::is_nullable(expr* r) {
|
expr_ref seq_rewriter::is_nullable(expr* r) {
|
||||||
STRACE("seq_verbose", tout << "is_nullable: "
|
STRACE(seq_verbose, tout << "is_nullable: "
|
||||||
<< mk_pp(r, m()) << std::endl;);
|
<< mk_pp(r, m()) << std::endl;);
|
||||||
expr_ref result(m_op_cache.find(_OP_RE_IS_NULLABLE, r, nullptr, nullptr), m());
|
expr_ref result(m_op_cache.find(_OP_RE_IS_NULLABLE, r, nullptr, nullptr), m());
|
||||||
if (!result) {
|
if (!result) {
|
||||||
result = is_nullable_rec(r);
|
result = is_nullable_rec(r);
|
||||||
m_op_cache.insert(_OP_RE_IS_NULLABLE, r, nullptr, nullptr, result);
|
m_op_cache.insert(_OP_RE_IS_NULLABLE, r, nullptr, nullptr, result);
|
||||||
}
|
}
|
||||||
STRACE("seq_verbose", tout << "is_nullable result: "
|
STRACE(seq_verbose, tout << "is_nullable result: "
|
||||||
<< result << std::endl;);
|
<< result << std::endl;);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3144,12 +3144,12 @@ br_status seq_rewriter::mk_re_derivative(expr* ele, expr* r, expr_ref& result) {
|
||||||
*/
|
*/
|
||||||
bool seq_rewriter::check_deriv_normal_form(expr* r, int level) {
|
bool seq_rewriter::check_deriv_normal_form(expr* r, int level) {
|
||||||
if (level == 3) { // top level
|
if (level == 3) { // top level
|
||||||
STRACE("seq_verbose", tout
|
STRACE(seq_verbose, tout
|
||||||
<< "Checking derivative normal form invariant...";);
|
<< "Checking derivative normal form invariant...";);
|
||||||
}
|
}
|
||||||
expr *r1 = nullptr, *r2 = nullptr, *p = nullptr, *s = nullptr;
|
expr *r1 = nullptr, *r2 = nullptr, *p = nullptr, *s = nullptr;
|
||||||
unsigned lo = 0, hi = 0;
|
unsigned lo = 0, hi = 0;
|
||||||
STRACE("seq_verbose", tout << " (level " << level << ")";);
|
STRACE(seq_verbose, tout << " (level " << level << ")";);
|
||||||
int new_level = 0;
|
int new_level = 0;
|
||||||
if (re().is_antimirov_union(r)) {
|
if (re().is_antimirov_union(r)) {
|
||||||
SASSERT(level >= 2);
|
SASSERT(level >= 2);
|
||||||
|
@ -3193,7 +3193,7 @@ bool seq_rewriter::check_deriv_normal_form(expr* r, int level) {
|
||||||
SASSERT(false);
|
SASSERT(false);
|
||||||
}
|
}
|
||||||
if (level == 3) {
|
if (level == 3) {
|
||||||
STRACE("seq_verbose", tout << " passed!" << std::endl;);
|
STRACE(seq_verbose, tout << " passed!" << std::endl;);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3218,8 +3218,8 @@ expr_ref seq_rewriter::mk_antimirov_deriv(expr* e, expr* r, expr* path) {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
mk_antimirov_deriv_rec(e, r, path, result);
|
mk_antimirov_deriv_rec(e, r, path, result);
|
||||||
m_op_cache.insert(OP_RE_DERIVATIVE, e, r, path, result);
|
m_op_cache.insert(OP_RE_DERIVATIVE, e, r, path, result);
|
||||||
STRACE("seq_regex", tout << "D(" << mk_pp(e, m()) << "," << mk_pp(r, m()) << "," << mk_pp(path, m()) << ")" << std::endl;);
|
STRACE(seq_regex, tout << "D(" << mk_pp(e, m()) << "," << mk_pp(r, m()) << "," << mk_pp(path, m()) << ")" << std::endl;);
|
||||||
STRACE("seq_regex", tout << "= " << mk_pp(result, m()) << std::endl;);
|
STRACE(seq_regex, tout << "= " << mk_pp(result, m()) << std::endl;);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3851,7 +3851,7 @@ bool seq_rewriter::le_char(expr* ch1, expr* ch2) {
|
||||||
- a and b are char <= constraints, or negations of char <= constraints
|
- a and b are char <= constraints, or negations of char <= constraints
|
||||||
*/
|
*/
|
||||||
bool seq_rewriter::pred_implies(expr* a, expr* b) {
|
bool seq_rewriter::pred_implies(expr* a, expr* b) {
|
||||||
STRACE("seq_verbose", tout << "pred_implies: "
|
STRACE(seq_verbose, tout << "pred_implies: "
|
||||||
<< "," << mk_pp(a, m())
|
<< "," << mk_pp(a, m())
|
||||||
<< "," << mk_pp(b, m()) << std::endl;);
|
<< "," << mk_pp(b, m()) << std::endl;);
|
||||||
expr *cha1 = nullptr, *cha2 = nullptr, *nota = nullptr,
|
expr *cha1 = nullptr, *cha2 = nullptr, *nota = nullptr,
|
||||||
|
@ -3912,7 +3912,7 @@ bool seq_rewriter::ite_bdds_compatible(expr* a, expr* b) {
|
||||||
- result is in normal form (check_deriv_normal_form)
|
- result is in normal form (check_deriv_normal_form)
|
||||||
*/
|
*/
|
||||||
expr_ref seq_rewriter::mk_der_op_rec(decl_kind k, expr* a, expr* b) {
|
expr_ref seq_rewriter::mk_der_op_rec(decl_kind k, expr* a, expr* b) {
|
||||||
STRACE("seq_verbose", tout << "mk_der_op_rec: " << k
|
STRACE(seq_verbose, tout << "mk_der_op_rec: " << k
|
||||||
<< "," << mk_pp(a, m())
|
<< "," << mk_pp(a, m())
|
||||||
<< "," << mk_pp(b, m()) << std::endl;);
|
<< "," << mk_pp(b, m()) << std::endl;);
|
||||||
expr* ca = nullptr, *a1 = nullptr, *a2 = nullptr;
|
expr* ca = nullptr, *a1 = nullptr, *a2 = nullptr;
|
||||||
|
@ -4076,7 +4076,7 @@ expr_ref seq_rewriter::mk_der_op(decl_kind k, expr* a, expr* b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
expr_ref seq_rewriter::mk_der_compl(expr* r) {
|
expr_ref seq_rewriter::mk_der_compl(expr* r) {
|
||||||
STRACE("seq_verbose", tout << "mk_der_compl: " << mk_pp(r, m())
|
STRACE(seq_verbose, tout << "mk_der_compl: " << mk_pp(r, m())
|
||||||
<< std::endl;);
|
<< std::endl;);
|
||||||
expr_ref result(m_op_cache.find(OP_RE_COMPLEMENT, r, nullptr, nullptr), m());
|
expr_ref result(m_op_cache.find(OP_RE_COMPLEMENT, r, nullptr, nullptr), m());
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
@ -4115,7 +4115,7 @@ expr_ref seq_rewriter::mk_der_compl(expr* r) {
|
||||||
Postcondition: result is in BDD form
|
Postcondition: result is in BDD form
|
||||||
*/
|
*/
|
||||||
expr_ref seq_rewriter::mk_der_cond(expr* cond, expr* ele, sort* seq_sort) {
|
expr_ref seq_rewriter::mk_der_cond(expr* cond, expr* ele, sort* seq_sort) {
|
||||||
STRACE("seq_verbose", tout << "mk_der_cond: "
|
STRACE(seq_verbose, tout << "mk_der_cond: "
|
||||||
<< mk_pp(cond, m()) << ", " << mk_pp(ele, m()) << std::endl;);
|
<< mk_pp(cond, m()) << ", " << mk_pp(ele, m()) << std::endl;);
|
||||||
sort *ele_sort = nullptr;
|
sort *ele_sort = nullptr;
|
||||||
VERIFY(u().is_seq(seq_sort, ele_sort));
|
VERIFY(u().is_seq(seq_sort, ele_sort));
|
||||||
|
@ -4160,7 +4160,7 @@ expr_ref seq_rewriter::mk_der_cond(expr* cond, expr* ele, sort* seq_sort) {
|
||||||
else {
|
else {
|
||||||
result = re_predicate(cond, seq_sort);
|
result = re_predicate(cond, seq_sort);
|
||||||
}
|
}
|
||||||
STRACE("seq_verbose", tout << "mk_der_cond result: "
|
STRACE(seq_verbose, tout << "mk_der_cond result: "
|
||||||
<< mk_pp(result, m()) << std::endl;);
|
<< mk_pp(result, m()) << std::endl;);
|
||||||
CASSERT("seq_regex", check_deriv_normal_form(result));
|
CASSERT("seq_regex", check_deriv_normal_form(result));
|
||||||
return result;
|
return result;
|
||||||
|
@ -4264,7 +4264,7 @@ expr_ref seq_rewriter::mk_derivative_rec(expr* ele, expr* r) {
|
||||||
if (get_head_tail(r1, hd, tl)) {
|
if (get_head_tail(r1, hd, tl)) {
|
||||||
// head must be equal; if so, derivative is tail
|
// head must be equal; if so, derivative is tail
|
||||||
// Use mk_der_cond to normalize
|
// Use mk_der_cond to normalize
|
||||||
STRACE("seq_verbose", tout << "deriv to_re" << std::endl;);
|
STRACE(seq_verbose, tout << "deriv to_re" << std::endl;);
|
||||||
result = m().mk_eq(ele, hd);
|
result = m().mk_eq(ele, hd);
|
||||||
result = mk_der_cond(result, ele, seq_sort);
|
result = mk_der_cond(result, ele, seq_sort);
|
||||||
expr_ref r1(re().mk_to_re(tl), m());
|
expr_ref r1(re().mk_to_re(tl), m());
|
||||||
|
@ -4305,7 +4305,7 @@ expr_ref seq_rewriter::mk_derivative_rec(expr* ele, expr* r) {
|
||||||
expr_ref hd(m()), tl(m());
|
expr_ref hd(m()), tl(m());
|
||||||
if (get_head_tail_reversed(r2, hd, tl)) {
|
if (get_head_tail_reversed(r2, hd, tl)) {
|
||||||
// Use mk_der_cond to normalize
|
// Use mk_der_cond to normalize
|
||||||
STRACE("seq_verbose", tout << "deriv reverse to_re" << std::endl;);
|
STRACE(seq_verbose, tout << "deriv reverse to_re" << std::endl;);
|
||||||
result = m().mk_eq(ele, tl);
|
result = m().mk_eq(ele, tl);
|
||||||
result = mk_der_cond(result, ele, seq_sort);
|
result = mk_der_cond(result, ele, seq_sort);
|
||||||
result = mk_der_concat(result, re().mk_reverse(re().mk_to_re(hd)));
|
result = mk_der_concat(result, re().mk_reverse(re().mk_to_re(hd)));
|
||||||
|
@ -4334,7 +4334,7 @@ expr_ref seq_rewriter::mk_derivative_rec(expr* ele, expr* r) {
|
||||||
expr_ref ch1(m_util.mk_char(s1[0]), m());
|
expr_ref ch1(m_util.mk_char(s1[0]), m());
|
||||||
expr_ref ch2(m_util.mk_char(s2[0]), m());
|
expr_ref ch2(m_util.mk_char(s2[0]), m());
|
||||||
// Use mk_der_cond to normalize
|
// Use mk_der_cond to normalize
|
||||||
STRACE("seq_verbose", tout << "deriv range zstring" << std::endl;);
|
STRACE(seq_verbose, tout << "deriv range zstring" << std::endl;);
|
||||||
expr_ref p1(u().mk_le(ch1, ele), m());
|
expr_ref p1(u().mk_le(ch1, ele), m());
|
||||||
p1 = mk_der_cond(p1, ele, seq_sort);
|
p1 = mk_der_cond(p1, ele, seq_sort);
|
||||||
expr_ref p2(u().mk_le(ele, ch2), m());
|
expr_ref p2(u().mk_le(ele, ch2), m());
|
||||||
|
@ -4350,7 +4350,7 @@ expr_ref seq_rewriter::mk_derivative_rec(expr* ele, expr* r) {
|
||||||
if (str().is_unit(r1, e1) && str().is_unit(r2, e2)) {
|
if (str().is_unit(r1, e1) && str().is_unit(r2, e2)) {
|
||||||
SASSERT(u().is_char(e1));
|
SASSERT(u().is_char(e1));
|
||||||
// Use mk_der_cond to normalize
|
// Use mk_der_cond to normalize
|
||||||
STRACE("seq_verbose", tout << "deriv range str" << std::endl;);
|
STRACE(seq_verbose, tout << "deriv range str" << std::endl;);
|
||||||
expr_ref p1(u().mk_le(e1, ele), m());
|
expr_ref p1(u().mk_le(e1, ele), m());
|
||||||
p1 = mk_der_cond(p1, ele, seq_sort);
|
p1 = mk_der_cond(p1, ele, seq_sort);
|
||||||
expr_ref p2(u().mk_le(ele, e2), m());
|
expr_ref p2(u().mk_le(ele, e2), m());
|
||||||
|
@ -4367,7 +4367,7 @@ expr_ref seq_rewriter::mk_derivative_rec(expr* ele, expr* r) {
|
||||||
expr* args[2] = { p, ele };
|
expr* args[2] = { p, ele };
|
||||||
result = array.mk_select(2, args);
|
result = array.mk_select(2, args);
|
||||||
// Use mk_der_cond to normalize
|
// Use mk_der_cond to normalize
|
||||||
STRACE("seq_verbose", tout << "deriv of_pred" << std::endl;);
|
STRACE(seq_verbose, tout << "deriv of_pred" << std::endl;);
|
||||||
return mk_der_cond(result, ele, seq_sort);
|
return mk_der_cond(result, ele, seq_sort);
|
||||||
}
|
}
|
||||||
// stuck cases: re.derivative, re variable,
|
// stuck cases: re.derivative, re variable,
|
||||||
|
@ -4547,7 +4547,7 @@ This will help propagate cases like "abc"X in opt(to_re(X)) to equalities.
|
||||||
*/
|
*/
|
||||||
br_status seq_rewriter::mk_str_in_regexp(expr* a, expr* b, expr_ref& result) {
|
br_status seq_rewriter::mk_str_in_regexp(expr* a, expr* b, expr_ref& result) {
|
||||||
|
|
||||||
STRACE("seq_verbose", tout << "mk_str_in_regexp: " << mk_pp(a, m())
|
STRACE(seq_verbose, tout << "mk_str_in_regexp: " << mk_pp(a, m())
|
||||||
<< ", " << mk_pp(b, m()) << std::endl;);
|
<< ", " << mk_pp(b, m()) << std::endl;);
|
||||||
|
|
||||||
if (re().is_empty(b)) {
|
if (re().is_empty(b)) {
|
||||||
|
@ -5423,7 +5423,7 @@ br_status seq_rewriter::mk_le_core(expr * l, expr * r, expr_ref & result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
br_status seq_rewriter::mk_eq_core(expr * l, expr * r, expr_ref & result) {
|
br_status seq_rewriter::mk_eq_core(expr * l, expr * r, expr_ref & result) {
|
||||||
TRACE("seq", tout << mk_pp(l, m()) << " == " << mk_pp(r, m()) << "\n");
|
TRACE(seq, tout << mk_pp(l, m()) << " == " << mk_pp(r, m()) << "\n");
|
||||||
expr_ref_vector res(m());
|
expr_ref_vector res(m());
|
||||||
expr_ref_pair_vector new_eqs(m());
|
expr_ref_pair_vector new_eqs(m());
|
||||||
if (m_util.is_re(l)) {
|
if (m_util.is_re(l)) {
|
||||||
|
@ -5436,20 +5436,20 @@ br_status seq_rewriter::mk_eq_core(expr * l, expr * r, expr_ref & result) {
|
||||||
#if 0
|
#if 0
|
||||||
if (reduce_arith_eq(l, r, res) || reduce_arith_eq(r, l, res)) {
|
if (reduce_arith_eq(l, r, res) || reduce_arith_eq(r, l, res)) {
|
||||||
result = mk_and(res);
|
result = mk_and(res);
|
||||||
TRACE("seq_verbose", tout << result << "\n";);
|
TRACE(seq_verbose, tout << result << "\n";);
|
||||||
return BR_REWRITE3;
|
return BR_REWRITE3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reduce_extract(l, r, res)) {
|
if (reduce_extract(l, r, res)) {
|
||||||
result = mk_and(res);
|
result = mk_and(res);
|
||||||
TRACE("seq_verbose", tout << result << "\n";);
|
TRACE(seq_verbose, tout << result << "\n";);
|
||||||
return BR_REWRITE3;
|
return BR_REWRITE3;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!reduce_eq(l, r, new_eqs, changed)) {
|
if (!reduce_eq(l, r, new_eqs, changed)) {
|
||||||
result = m().mk_false();
|
result = m().mk_false();
|
||||||
TRACE("seq_verbose", tout << result << "\n";);
|
TRACE(seq_verbose, tout << result << "\n";);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
if (!changed) {
|
if (!changed) {
|
||||||
|
@ -5459,7 +5459,7 @@ br_status seq_rewriter::mk_eq_core(expr * l, expr * r, expr_ref & result) {
|
||||||
res.push_back(m().mk_eq(p.first, p.second));
|
res.push_back(m().mk_eq(p.first, p.second));
|
||||||
}
|
}
|
||||||
result = mk_and(res);
|
result = mk_and(res);
|
||||||
TRACE("seq_verbose", tout << result << "\n";);
|
TRACE(seq_verbose, tout << result << "\n";);
|
||||||
return BR_REWRITE3;
|
return BR_REWRITE3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5600,11 +5600,11 @@ bool seq_rewriter::reduce_front(expr_ref_vector& ls, expr_ref_vector& rs, expr_r
|
||||||
}
|
}
|
||||||
else if (str().is_string(l, s1) &&
|
else if (str().is_string(l, s1) &&
|
||||||
str().is_string(r, s2)) {
|
str().is_string(r, s2)) {
|
||||||
TRACE("seq", tout << s1 << " - " << s2 << " " << s1.length() << " " << s2.length() << "\n";);
|
TRACE(seq, tout << s1 << " - " << s2 << " " << s1.length() << " " << s2.length() << "\n";);
|
||||||
unsigned min_l = std::min(s1.length(), s2.length());
|
unsigned min_l = std::min(s1.length(), s2.length());
|
||||||
for (unsigned i = 0; i < min_l; ++i) {
|
for (unsigned i = 0; i < min_l; ++i) {
|
||||||
if (s1[i] != s2[i]) {
|
if (s1[i] != s2[i]) {
|
||||||
TRACE("seq", tout << "different at position " << i << " " << s1[i] << " " << s2[i] << "\n";);
|
TRACE(seq, tout << "different at position " << i << " " << s1[i] << " " << s2[i] << "\n";);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5638,7 +5638,7 @@ bool seq_rewriter::reduce_front(expr_ref_vector& ls, expr_ref_vector& rs, expr_r
|
||||||
- sets change to true if some simplification occurred
|
- sets change to true if some simplification occurred
|
||||||
*/
|
*/
|
||||||
bool seq_rewriter::reduce_eq(expr_ref_vector& ls, expr_ref_vector& rs, expr_ref_pair_vector& eqs, bool& change) {
|
bool seq_rewriter::reduce_eq(expr_ref_vector& ls, expr_ref_vector& rs, expr_ref_pair_vector& eqs, bool& change) {
|
||||||
TRACE("seq_verbose", tout << ls << "\n"; tout << rs << "\n";);
|
TRACE(seq_verbose, tout << ls << "\n"; tout << rs << "\n";);
|
||||||
unsigned hash_l = ls.hash();
|
unsigned hash_l = ls.hash();
|
||||||
unsigned hash_r = rs.hash();
|
unsigned hash_r = rs.hash();
|
||||||
unsigned sz_eqs = eqs.size();
|
unsigned sz_eqs = eqs.size();
|
||||||
|
@ -5675,7 +5675,7 @@ bool seq_rewriter::reduce_eq(expr* l, expr* r, expr_ref_pair_vector& new_eqs, bo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("seq", tout << mk_bounded_pp(l, m()) << " != " << mk_bounded_pp(r, m()) << "\n";);
|
TRACE(seq, tout << mk_bounded_pp(l, m()) << " != " << mk_bounded_pp(r, m()) << "\n";);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5703,7 +5703,7 @@ void seq_rewriter::add_seqs(expr_ref_vector const& ls, expr_ref_vector const& rs
|
||||||
bool seq_rewriter::reduce_contains(expr* a, expr* b, expr_ref_vector& disj) {
|
bool seq_rewriter::reduce_contains(expr* a, expr* b, expr_ref_vector& disj) {
|
||||||
m_lhs.reset();
|
m_lhs.reset();
|
||||||
str().get_concat(a, m_lhs);
|
str().get_concat(a, m_lhs);
|
||||||
TRACE("seq", tout << expr_ref(a, m()) << " " << expr_ref(b, m()) << "\n";);
|
TRACE(seq, tout << expr_ref(a, m()) << " " << expr_ref(b, m()) << "\n";);
|
||||||
sort* sort_a = a->get_sort();
|
sort* sort_a = a->get_sort();
|
||||||
zstring s;
|
zstring s;
|
||||||
for (unsigned i = 0; i < m_lhs.size(); ++i) {
|
for (unsigned i = 0; i < m_lhs.size(); ++i) {
|
||||||
|
@ -6201,7 +6201,7 @@ bool seq_rewriter::reduce_subsequence(expr_ref_vector& ls, expr_ref_vector& rs,
|
||||||
str().mk_concat(rs, srt));
|
str().mk_concat(rs, srt));
|
||||||
ls.reset();
|
ls.reset();
|
||||||
rs.reset();
|
rs.reset();
|
||||||
TRACE("seq", tout << "subsequence " << eqs << "\n";);
|
TRACE(seq, tout << "subsequence " << eqs << "\n";);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -6230,9 +6230,9 @@ void seq_rewriter::op_cache::cleanup() {
|
||||||
if (m_table.size() >= m_max_cache_size) {
|
if (m_table.size() >= m_max_cache_size) {
|
||||||
m_trail.reset();
|
m_trail.reset();
|
||||||
m_table.reset();
|
m_table.reset();
|
||||||
STRACE("seq_regex", tout << "Op cache reset!" << std::endl;);
|
STRACE(seq_regex, tout << "Op cache reset!" << std::endl;);
|
||||||
STRACE("seq_regex_brief", tout << "(OP CACHE RESET) ";);
|
STRACE(seq_regex_brief, tout << "(OP CACHE RESET) ";);
|
||||||
STRACE("seq_verbose", tout << "Derivative op cache reset" << std::endl;);
|
STRACE(seq_verbose, tout << "Derivative op cache reset" << std::endl;);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -548,7 +548,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg {
|
||||||
func_decl * f_prime = nullptr;
|
func_decl * f_prime = nullptr;
|
||||||
expr_ref new_t(m()), new_e(m()), common(m());
|
expr_ref new_t(m()), new_e(m()), common(m());
|
||||||
bool first;
|
bool first;
|
||||||
TRACE("push_ite", tout << "unifying:\n" << mk_ismt2_pp(t, m()) << "\n" << mk_ismt2_pp(e, m()) << "\n";);
|
TRACE(push_ite, tout << "unifying:\n" << mk_ismt2_pp(t, m()) << "\n" << mk_ismt2_pp(e, m()) << "\n";);
|
||||||
if (unify(t, e, f_prime, new_t, new_e, common, first)) {
|
if (unify(t, e, f_prime, new_t, new_e, common, first)) {
|
||||||
if (first)
|
if (first)
|
||||||
result = m().mk_app(f_prime, common, m().mk_ite(c, new_t, new_e));
|
result = m().mk_app(f_prime, common, m().mk_ite(c, new_t, new_e));
|
||||||
|
@ -556,7 +556,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg {
|
||||||
result = m().mk_app(f_prime, m().mk_ite(c, new_t, new_e), common);
|
result = m().mk_app(f_prime, m().mk_ite(c, new_t, new_e), common);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
TRACE("push_ite", tout << "failed\n";);
|
TRACE(push_ite, tout << "failed\n";);
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st != BR_DONE && st != BR_FAILED) {
|
if (st != BR_DONE && st != BR_FAILED) {
|
||||||
CTRACE("th_rewriter_step", st != BR_FAILED,
|
CTRACE(th_rewriter_step, st != BR_FAILED,
|
||||||
tout << f->get_name() << "\n";
|
tout << f->get_name() << "\n";
|
||||||
for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << "\n";
|
for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << "\n";
|
||||||
tout << "---------->\n" << mk_ismt2_pp(result, m()) << "\n";);
|
tout << "---------->\n" << mk_ismt2_pp(result, m()) << "\n";);
|
||||||
|
@ -654,7 +654,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg {
|
||||||
st = m_ar_rw.mk_app_core(f, num, args, result);
|
st = m_ar_rw.mk_app_core(f, num, args, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTRACE("th_rewriter_step", st != BR_FAILED,
|
CTRACE(th_rewriter_step, st != BR_FAILED,
|
||||||
tout << f->get_name() << "\n";
|
tout << f->get_name() << "\n";
|
||||||
for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << "\n";
|
for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m()) << "\n";
|
||||||
tout << "---------->\n" << mk_ismt2_pp(result, m()) << "\n";);
|
tout << "---------->\n" << mk_ismt2_pp(result, m()) << "\n";);
|
||||||
|
@ -823,7 +823,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg {
|
||||||
new_patterns_buf.size(), new_patterns_buf.data(), new_no_patterns_buf.size(), new_no_patterns_buf.data(),
|
new_patterns_buf.size(), new_patterns_buf.data(), new_no_patterns_buf.size(), new_no_patterns_buf.data(),
|
||||||
new_body);
|
new_body);
|
||||||
m_pinned.reset();
|
m_pinned.reset();
|
||||||
TRACE("reduce_quantifier", tout << mk_ismt2_pp(old_q, m()) << "\n----->\n" << mk_ismt2_pp(q1, m()) << "\n";);
|
TRACE(reduce_quantifier, tout << mk_ismt2_pp(old_q, m()) << "\n----->\n" << mk_ismt2_pp(q1, m()) << "\n";);
|
||||||
SASSERT(is_well_sorted(m(), q1));
|
SASSERT(is_well_sorted(m(), q1));
|
||||||
if (m().proofs_enabled() && q1 != old_q) {
|
if (m().proofs_enabled() && q1 != old_q) {
|
||||||
p1 = m().mk_rewrite(old_q, q1);
|
p1 = m().mk_rewrite(old_q, q1);
|
||||||
|
@ -841,7 +841,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg {
|
||||||
result_pr = m().mk_transitivity(p1, p2);
|
result_pr = m().mk_transitivity(p1, p2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("reduce_quantifier", tout << "after elim_unused_vars:\n" << result << " " << result_pr << "\n" ;);
|
TRACE(reduce_quantifier, tout << "after elim_unused_vars:\n" << result << " " << result_pr << "\n" ;);
|
||||||
|
|
||||||
proof_ref p2(m());
|
proof_ref p2(m());
|
||||||
expr_ref r(m());
|
expr_ref r(m());
|
||||||
|
|
|
@ -111,7 +111,7 @@ void value_sweep::propagate_values() {
|
||||||
m_args.push_back(get_value(arg));
|
m_args.push_back(get_value(arg));
|
||||||
expr_ref new_value(m.mk_app(p->get_decl(), m_args), m);
|
expr_ref new_value(m.mk_app(p->get_decl(), m_args), m);
|
||||||
m_rewrite(new_value);
|
m_rewrite(new_value);
|
||||||
TRACE("value_sweep", tout << "propagate " << mk_pp(p, m) << " " << new_value << "\n";);
|
TRACE(value_sweep, tout << "propagate " << mk_pp(p, m) << " " << new_value << "\n";);
|
||||||
set_value_core(p, new_value);
|
set_value_core(p, new_value);
|
||||||
m_queue.push_back(p);
|
m_queue.push_back(p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ expr_ref var_subst::operator()(expr * n, unsigned num_args, expr * const * args)
|
||||||
result = n;
|
result = n;
|
||||||
//application does not have free variables or nested quantifiers.
|
//application does not have free variables or nested quantifiers.
|
||||||
//There is no need to print the bindings here?
|
//There is no need to print the bindings here?
|
||||||
SCTRACE("bindings", is_trace_enabled("coming_from_quant"),
|
SCTRACE(bindings, is_trace_enabled(TraceTag::coming_from_quant),
|
||||||
tout << "(ground)\n";
|
tout << "(ground)\n";
|
||||||
for (unsigned i = 0; i < num_args; i++) {
|
for (unsigned i = 0; i < num_args; i++) {
|
||||||
if (args[i]) {
|
if (args[i]) {
|
||||||
|
@ -78,7 +78,7 @@ expr_ref var_subst::operator()(expr * n, unsigned num_args, expr * const * args)
|
||||||
m_reducer.set_bindings(num_args, args);
|
m_reducer.set_bindings(num_args, args);
|
||||||
m_reducer(n, result);
|
m_reducer(n, result);
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
TRACE("var_subst_bug",
|
TRACE(var_subst_bug,
|
||||||
tout << "m_std_order: " << m_std_order << "\n" << mk_ismt2_pp(n, m) << "\nusing\n";
|
tout << "m_std_order: " << m_std_order << "\n" << mk_ismt2_pp(n, m) << "\nusing\n";
|
||||||
for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(args[i], m) << "\n";
|
for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(args[i], m) << "\n";
|
||||||
tout << "\n------>\n";
|
tout << "\n------>\n";
|
||||||
|
@ -95,7 +95,7 @@ unused_vars_eliminator::unused_vars_eliminator(ast_manager & m, params_ref const
|
||||||
expr_ref unused_vars_eliminator::operator()(quantifier* q) {
|
expr_ref unused_vars_eliminator::operator()(quantifier* q) {
|
||||||
expr_ref result(m);
|
expr_ref result(m);
|
||||||
SASSERT(is_well_sorted(m, q));
|
SASSERT(is_well_sorted(m, q));
|
||||||
TRACE("elim_unused_vars", tout << expr_ref(q, m) << "\n";);
|
TRACE(elim_unused_vars, tout << expr_ref(q, m) << "\n";);
|
||||||
if (is_lambda(q)) {
|
if (is_lambda(q)) {
|
||||||
result = q;
|
result = q;
|
||||||
return result;
|
return result;
|
||||||
|
@ -207,7 +207,7 @@ expr_ref unused_vars_eliminator::operator()(quantifier* q) {
|
||||||
expr_ref elim_unused_vars(ast_manager & m, quantifier * q, params_ref const & params) {
|
expr_ref elim_unused_vars(ast_manager & m, quantifier * q, params_ref const & params) {
|
||||||
unused_vars_eliminator el(m, params);
|
unused_vars_eliminator el(m, params);
|
||||||
expr_ref result = el(q);
|
expr_ref result = el(q);
|
||||||
TRACE("elim_unused_vars", tout << expr_ref(q, m) << " -> " << result << "\n";);
|
TRACE(elim_unused_vars, tout << expr_ref(q, m) << " -> " << result << "\n";);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,11 +215,11 @@ expr_ref instantiate(ast_manager & m, quantifier * q, expr * const * exprs) {
|
||||||
var_subst subst(m);
|
var_subst subst(m);
|
||||||
expr_ref new_expr(m), result(m);
|
expr_ref new_expr(m), result(m);
|
||||||
new_expr = subst(q->get_expr(), q->get_num_decls(), exprs);
|
new_expr = subst(q->get_expr(), q->get_num_decls(), exprs);
|
||||||
TRACE("var_subst", tout << mk_pp(q, m) << "\n" << new_expr << "\n";);
|
TRACE(var_subst, tout << mk_pp(q, m) << "\n" << new_expr << "\n";);
|
||||||
inv_var_shifter shift(m);
|
inv_var_shifter shift(m);
|
||||||
shift(new_expr, q->get_num_decls(), result);
|
shift(new_expr, q->get_num_decls(), result);
|
||||||
SASSERT(is_well_sorted(m, result));
|
SASSERT(is_well_sorted(m, result));
|
||||||
TRACE("instantiate_bug", tout << mk_ismt2_pp(q, m) << "\nusing\n";
|
TRACE(instantiate_bug, tout << mk_ismt2_pp(q, m) << "\nusing\n";
|
||||||
for (unsigned i = 0; i < q->get_num_decls(); i++) tout << mk_ismt2_pp(exprs[i], m) << "\n";
|
for (unsigned i = 0; i < q->get_num_decls(); i++) tout << mk_ismt2_pp(exprs[i], m) << "\n";
|
||||||
tout << "\n----->\n" << mk_ismt2_pp(result, m) << "\n";);
|
tout << "\n----->\n" << mk_ismt2_pp(result, m) << "\n";);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -70,7 +70,7 @@ bool seq_decl_plugin::match(ptr_vector<sort>& binding, sort* s, sort* sP) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("seq", tout << "Could not match " << mk_pp(s, *m_manager) << " and " << mk_pp(sP, *m_manager) << "\n";);
|
TRACE(seq, tout << "Could not match " << mk_pp(s, *m_manager) << " and " << mk_pp(sP, *m_manager) << "\n";);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1643,7 +1643,7 @@ seq_util::rex::info seq_util::rex::get_info_rec(expr* e) const {
|
||||||
else
|
else
|
||||||
result = mk_info_rec(to_app(e));
|
result = mk_info_rec(to_app(e));
|
||||||
m_infos.setx(e->get_id(), result, invalid_info);
|
m_infos.setx(e->get_id(), result, invalid_info);
|
||||||
STRACE("re_info", tout << "compute_info(" << pp(u.re, e, false) << ")=" << result << std::endl;);
|
STRACE(re_info, tout << "compute_info(" << pp(u.re, e, false) << ")=" << result << std::endl;);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ void bit_blaster_simplifier::reduce() {
|
||||||
if (curr != new_curr) {
|
if (curr != new_curr) {
|
||||||
m_num_steps += m_rewriter.get_num_steps();
|
m_num_steps += m_rewriter.get_num_steps();
|
||||||
change = true;
|
change = true;
|
||||||
TRACE("bit_blaster", tout << mk_pp(curr, m) << " -> " << new_curr << "\n";);
|
TRACE(bit_blaster, tout << mk_pp(curr, m) << " -> " << new_curr << "\n";);
|
||||||
m_fmls.update(idx, dependent_expr(m, new_curr, mp(p, new_pr), d));
|
m_fmls.update(idx, dependent_expr(m, new_curr, mp(p, new_pr), d));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ bool bound_manager::is_numeral(expr* v, numeral& n, bool& is_int) {
|
||||||
void bound_manager::operator()(expr * f, expr_dependency * d, proof* p) {
|
void bound_manager::operator()(expr * f, expr_dependency * d, proof* p) {
|
||||||
if (p)
|
if (p)
|
||||||
return;
|
return;
|
||||||
TRACE("bound_manager", tout << "processing:\n" << mk_ismt2_pp(f, m()) << "\n";);
|
TRACE(bound_manager, tout << "processing:\n" << mk_ismt2_pp(f, m()) << "\n";);
|
||||||
expr * v;
|
expr * v;
|
||||||
numeral n;
|
numeral n;
|
||||||
if (is_disjunctive_bound(f, d))
|
if (is_disjunctive_bound(f, d))
|
||||||
|
@ -142,7 +142,7 @@ void bound_manager::operator()(expr * f, expr_dependency * d, proof* p) {
|
||||||
k = neg(k);
|
k = neg(k);
|
||||||
if (is_int)
|
if (is_int)
|
||||||
norm(n, k);
|
norm(n, k);
|
||||||
TRACE("bound_manager", tout << "found bound for:\n" << mk_ismt2_pp(v, m()) << "\n";);
|
TRACE(bound_manager, tout << "found bound for:\n" << mk_ismt2_pp(v, m()) << "\n";);
|
||||||
bool strict = is_strict(k);
|
bool strict = is_strict(k);
|
||||||
if (is_lower(k)) {
|
if (is_lower(k)) {
|
||||||
insert_lower(v, strict, n, d);
|
insert_lower(v, strict, n, d);
|
||||||
|
@ -244,7 +244,7 @@ bool bound_manager::is_disjunctive_bound(expr * f, expr_dependency * d) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("bound_manager", tout << "bounds: " << lo << " " << hi << "\n";);
|
TRACE(bound_manager, tout << "bounds: " << lo << " " << hi << "\n";);
|
||||||
insert_lower(v, false, lo, d);
|
insert_lower(v, false, lo, d);
|
||||||
insert_upper(v, false, hi, d);
|
insert_upper(v, false, hi, d);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -271,14 +271,14 @@ bool bound_propagator::assert_lower_core(var x, mpq & k, bool strict, bkind bk,
|
||||||
SASSERT(m.is_int(k));
|
SASSERT(m.is_int(k));
|
||||||
strict = false;
|
strict = false;
|
||||||
}
|
}
|
||||||
TRACE("bound_propagator_detail", tout << "new lower x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";);
|
TRACE(bound_propagator_detail, tout << "new lower x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";);
|
||||||
|
|
||||||
bound * old_lower = m_lowers[x];
|
bound * old_lower = m_lowers[x];
|
||||||
if (old_lower) {
|
if (old_lower) {
|
||||||
bool improves = m.gt(k, old_lower->m_k) || (!old_lower->m_strict && strict && m.eq(k, old_lower->m_k));
|
bool improves = m.gt(k, old_lower->m_k) || (!old_lower->m_strict && strict && m.eq(k, old_lower->m_k));
|
||||||
if (!improves) {
|
if (!improves) {
|
||||||
if (bk == DERIVED) {
|
if (bk == DERIVED) {
|
||||||
TRACE("bound_propagator_detail", tout << "false alarm\n";);
|
TRACE(bound_propagator_detail, tout << "false alarm\n";);
|
||||||
m_false_alarms++;
|
m_false_alarms++;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -286,7 +286,7 @@ bool bound_propagator::assert_lower_core(var x, mpq & k, bool strict, bkind bk,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bk == DERIVED) {
|
if (bk == DERIVED) {
|
||||||
TRACE("bound_propagator_derived", tout << "new lower x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";);
|
TRACE(bound_propagator_derived, tout << "new lower x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";);
|
||||||
m_propagations++;
|
m_propagations++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,10 +294,10 @@ bool bound_propagator::assert_lower_core(var x, mpq & k, bool strict, bkind bk,
|
||||||
bk = AXIOM; // don't need justification at level 0
|
bk = AXIOM; // don't need justification at level 0
|
||||||
|
|
||||||
double approx_k = m.get_double(k);
|
double approx_k = m.get_double(k);
|
||||||
TRACE("new_bound", tout << "x" << x << " lower: " << m.to_string(k) << " approx: " << approx_k << "\n";);
|
TRACE(new_bound, tout << "x" << x << " lower: " << m.to_string(k) << " approx: " << approx_k << "\n";);
|
||||||
#ifdef RELAX_BOUNDS
|
#ifdef RELAX_BOUNDS
|
||||||
approx_k = PRECISION*floor(approx_k*INV_PRECISION + TOLERANCE);
|
approx_k = PRECISION*floor(approx_k*INV_PRECISION + TOLERANCE);
|
||||||
TRACE("new_bound", tout << "x" << x << " lower: " << m.to_string(k) << " relaxed approx: " << approx_k << "\n";);
|
TRACE(new_bound, tout << "x" << x << " lower: " << m.to_string(k) << " relaxed approx: " << approx_k << "\n";);
|
||||||
#endif
|
#endif
|
||||||
void * mem = m_allocator.allocate(sizeof(bound));
|
void * mem = m_allocator.allocate(sizeof(bound));
|
||||||
bound * new_lower = new (mem) bound(m, k, approx_k, true, strict, scope_lvl(), m_timestamp, bk, c_idx, a, old_lower);
|
bound * new_lower = new (mem) bound(m, k, approx_k, true, strict, scope_lvl(), m_timestamp, bk, c_idx, a, old_lower);
|
||||||
|
@ -323,14 +323,14 @@ bool bound_propagator::assert_upper_core(var x, mpq & k, bool strict, bkind bk,
|
||||||
strict = false;
|
strict = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("bound_propagator_detail", tout << "new upper x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";);
|
TRACE(bound_propagator_detail, tout << "new upper x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";);
|
||||||
|
|
||||||
bound * old_upper = m_uppers[x];
|
bound * old_upper = m_uppers[x];
|
||||||
if (old_upper) {
|
if (old_upper) {
|
||||||
bool improves = m.lt(k, old_upper->m_k) || (!old_upper->m_strict && strict && m.eq(k, old_upper->m_k));
|
bool improves = m.lt(k, old_upper->m_k) || (!old_upper->m_strict && strict && m.eq(k, old_upper->m_k));
|
||||||
if (!improves) {
|
if (!improves) {
|
||||||
if (bk == DERIVED) {
|
if (bk == DERIVED) {
|
||||||
TRACE("bound_propagator_detail", tout << "false alarm\n";);
|
TRACE(bound_propagator_detail, tout << "false alarm\n";);
|
||||||
m_false_alarms++;
|
m_false_alarms++;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -339,17 +339,17 @@ bool bound_propagator::assert_upper_core(var x, mpq & k, bool strict, bkind bk,
|
||||||
|
|
||||||
if (bk == DERIVED) {
|
if (bk == DERIVED) {
|
||||||
m_propagations++;
|
m_propagations++;
|
||||||
TRACE("bound_propagator_derived", tout << "new upper x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";);
|
TRACE(bound_propagator_derived, tout << "new upper x" << x << " " << m.to_string(k) << " strict: " << strict << "\n";);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scope_lvl() == 0 && bk == DERIVED)
|
if (scope_lvl() == 0 && bk == DERIVED)
|
||||||
bk = AXIOM; // don't need justification at level 0
|
bk = AXIOM; // don't need justification at level 0
|
||||||
|
|
||||||
double approx_k = m.get_double(k);
|
double approx_k = m.get_double(k);
|
||||||
TRACE("new_bound", tout << "x" << x << " upper: " << m.to_string(k) << " approx: " << approx_k << "\n";);
|
TRACE(new_bound, tout << "x" << x << " upper: " << m.to_string(k) << " approx: " << approx_k << "\n";);
|
||||||
#ifdef RELAX_BOUNDS
|
#ifdef RELAX_BOUNDS
|
||||||
approx_k = PRECISION*ceil(approx_k*INV_PRECISION - TOLERANCE);
|
approx_k = PRECISION*ceil(approx_k*INV_PRECISION - TOLERANCE);
|
||||||
TRACE("new_bound", tout << "x" << x << " upper: " << m.to_string(k) << " relaxed approx: " << approx_k << "\n";);
|
TRACE(new_bound, tout << "x" << x << " upper: " << m.to_string(k) << " relaxed approx: " << approx_k << "\n";);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void * mem = m_allocator.allocate(sizeof(bound));
|
void * mem = m_allocator.allocate(sizeof(bound));
|
||||||
|
@ -374,7 +374,7 @@ bool bound_propagator::get_interval_size(var x, double & r) const {
|
||||||
|
|
||||||
template<bool LOWER>
|
template<bool LOWER>
|
||||||
bool bound_propagator::relevant_bound(var x, double new_k) const {
|
bool bound_propagator::relevant_bound(var x, double new_k) const {
|
||||||
TRACE("bound_propagator_detail", tout << "relevant_bound x" << x << " " << new_k << " LOWER: " << LOWER << "\n";
|
TRACE(bound_propagator_detail, tout << "relevant_bound x" << x << " " << new_k << " LOWER: " << LOWER << "\n";
|
||||||
if (LOWER && has_lower(x)) tout << "old: " << m.to_string(m_lowers[x]->m_k) << " | " << m_lowers[x]->m_approx_k << "\n";
|
if (LOWER && has_lower(x)) tout << "old: " << m.to_string(m_lowers[x]->m_k) << " | " << m_lowers[x]->m_approx_k << "\n";
|
||||||
if (!LOWER && has_upper(x)) tout << "old: " << m.to_string(m_uppers[x]->m_k) << " | " << m_uppers[x]->m_approx_k << "\n";);
|
if (!LOWER && has_upper(x)) tout << "old: " << m.to_string(m_uppers[x]->m_k) << " | " << m_uppers[x]->m_approx_k << "\n";);
|
||||||
bound * b = LOWER ? m_lowers[x] : m_uppers[x];
|
bound * b = LOWER ? m_lowers[x] : m_uppers[x];
|
||||||
|
@ -397,13 +397,13 @@ bool bound_propagator::relevant_bound(var x, double new_k) const {
|
||||||
|
|
||||||
if (LOWER) {
|
if (LOWER) {
|
||||||
if (new_k <= b->m_approx_k + improvement) {
|
if (new_k <= b->m_approx_k + improvement) {
|
||||||
TRACE("bound_propagator", tout << "LOWER new: " << new_k << " old: " << b->m_approx_k << " improvement is too small\n";);
|
TRACE(bound_propagator, tout << "LOWER new: " << new_k << " old: " << b->m_approx_k << " improvement is too small\n";);
|
||||||
return false; // improvement is too small
|
return false; // improvement is too small
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (new_k >= b->m_approx_k - improvement) {
|
if (new_k >= b->m_approx_k - improvement) {
|
||||||
TRACE("bound_propagator", tout << "UPPER new: " << new_k << " old: " << b->m_approx_k << " improvement is too small\n";);
|
TRACE(bound_propagator, tout << "UPPER new: " << new_k << " old: " << b->m_approx_k << " improvement is too small\n";);
|
||||||
return false; // improvement is too small
|
return false; // improvement is too small
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ void bound_propagator::check_feasibility(var x) {
|
||||||
m_conflict = x;
|
m_conflict = x;
|
||||||
m_conflicts++;
|
m_conflicts++;
|
||||||
SASSERT(inconsistent());
|
SASSERT(inconsistent());
|
||||||
TRACE("bound_propagator", tout << "inconsistency detected: x" << x << "\n"; display(tout););
|
TRACE(bound_propagator, tout << "inconsistency detected: x" << x << "\n"; display(tout););
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ void bound_propagator::propagate() {
|
||||||
bound * b = is_lower ? m_lowers[x] : m_uppers[x];
|
bound * b = is_lower ? m_lowers[x] : m_uppers[x];
|
||||||
SASSERT(b);
|
SASSERT(b);
|
||||||
unsigned ts = b->m_timestamp;
|
unsigned ts = b->m_timestamp;
|
||||||
TRACE("bound_propagator_detail", tout << "propagating x" << x << "\n";);
|
TRACE(bound_propagator_detail, tout << "propagating x" << x << "\n";);
|
||||||
m_qhead++;
|
m_qhead++;
|
||||||
wlist const & wl = m_watches[x];
|
wlist const & wl = m_watches[x];
|
||||||
for (unsigned c_idx : wl) {
|
for (unsigned c_idx : wl) {
|
||||||
|
@ -510,7 +510,7 @@ bool bound_propagator::propagate_eq(unsigned c_idx) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACE("bound_propagator_detail", tout << "propagating using eq: "; m_eq_manager.display(tout, *eq); tout << "\n";);
|
TRACE(bound_propagator_detail, tout << "propagating using eq: "; m_eq_manager.display(tout, *eq); tout << "\n";);
|
||||||
// ll = (Sum_{a_i < 0} -a_i*lower(x_i)) + (Sum_{a_i > 0} -a_i * upper(x_i))
|
// ll = (Sum_{a_i < 0} -a_i*lower(x_i)) + (Sum_{a_i > 0} -a_i * upper(x_i))
|
||||||
// uu = (Sum_{a_i > 0} -a_i*lower(x_i)) + (Sum_{a_i < 0} -a_i * upper(x_i))
|
// uu = (Sum_{a_i > 0} -a_i*lower(x_i)) + (Sum_{a_i < 0} -a_i * upper(x_i))
|
||||||
unsigned ll_i = UINT_MAX; // position of the variable that couldn't contribute to ll
|
unsigned ll_i = UINT_MAX; // position of the variable that couldn't contribute to ll
|
||||||
|
@ -678,17 +678,17 @@ bool bound_propagator::propagate_lower(unsigned c_idx, unsigned i) {
|
||||||
var x_j = eq->x(j);
|
var x_j = eq->x(j);
|
||||||
mpz const & a_j = eq->a(j);
|
mpz const & a_j = eq->a(j);
|
||||||
bound * b_j = (m.is_neg(a_j) == neg_a_i) ? m_uppers[x_j] : m_lowers[x_j];
|
bound * b_j = (m.is_neg(a_j) == neg_a_i) ? m_uppers[x_j] : m_lowers[x_j];
|
||||||
TRACE("bound_propagator_step_detail", tout << "k: " << m.to_string(k) << " b_j->m_k: " << m.to_string(b_j->m_k) <<
|
TRACE(bound_propagator_step_detail, tout << "k: " << m.to_string(k) << " b_j->m_k: " << m.to_string(b_j->m_k) <<
|
||||||
" a_j: " << m.to_string(a_j) << "\n";);
|
" a_j: " << m.to_string(a_j) << "\n";);
|
||||||
SASSERT(b_j);
|
SASSERT(b_j);
|
||||||
if (b_j->m_strict)
|
if (b_j->m_strict)
|
||||||
strict = true;
|
strict = true;
|
||||||
m.addmul(k, a_j, b_j->m_k, k);
|
m.addmul(k, a_j, b_j->m_k, k);
|
||||||
}
|
}
|
||||||
TRACE("bound_propagator_step_detail", tout << "k: " << m.to_string(k) << "\n";);
|
TRACE(bound_propagator_step_detail, tout << "k: " << m.to_string(k) << "\n";);
|
||||||
m.neg(k);
|
m.neg(k);
|
||||||
m.div(k, a_i, k);
|
m.div(k, a_i, k);
|
||||||
TRACE("bound_propagator_step", tout << "propagating lower x" << x_i << " " << m.to_string(k) << " strict: " << strict << " using\n";
|
TRACE(bound_propagator_step, tout << "propagating lower x" << x_i << " " << m.to_string(k) << " strict: " << strict << " using\n";
|
||||||
m_eq_manager.display(tout, *eq); tout << "\n"; display_bounds_of(tout, *eq););
|
m_eq_manager.display(tout, *eq); tout << "\n"; display_bounds_of(tout, *eq););
|
||||||
bool r = assert_lower_core(x_i, k, strict, DERIVED, c_idx, null_assumption);
|
bool r = assert_lower_core(x_i, k, strict, DERIVED, c_idx, null_assumption);
|
||||||
m.del(k);
|
m.del(k);
|
||||||
|
@ -722,7 +722,7 @@ bool bound_propagator::propagate_upper(unsigned c_idx, unsigned i) {
|
||||||
}
|
}
|
||||||
m.neg(k);
|
m.neg(k);
|
||||||
m.div(k, a_i, k);
|
m.div(k, a_i, k);
|
||||||
TRACE("bound_propagator_step", tout << "propagating upper x" << x_i << " " << m.to_string(k) << " strict: " << strict << " using\n";
|
TRACE(bound_propagator_step, tout << "propagating upper x" << x_i << " " << m.to_string(k) << " strict: " << strict << " using\n";
|
||||||
m_eq_manager.display(tout, *eq); tout << "\n"; display_bounds_of(tout, *eq););
|
m_eq_manager.display(tout, *eq); tout << "\n"; display_bounds_of(tout, *eq););
|
||||||
bool r = assert_upper_core(x_i, k, strict, DERIVED, c_idx, null_assumption);
|
bool r = assert_upper_core(x_i, k, strict, DERIVED, c_idx, null_assumption);
|
||||||
m.del(k);
|
m.del(k);
|
||||||
|
|
|
@ -72,13 +72,13 @@ br_status bound_simplifier::reduce_app(func_decl* f, unsigned num_args, expr* co
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
if (N > hi && lo >= 0) {
|
if (N > hi && lo >= 0) {
|
||||||
result = x;
|
result = x;
|
||||||
TRACE("propagate-ineqs", tout << expr_ref(m.mk_app(f, num_args, args), m) << " -> " << result << "\n");
|
TRACE(propagate_ineqs, tout << expr_ref(m.mk_app(f, num_args, args), m) << " -> " << result << "\n");
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
if (2 * N > hi && lo >= N) {
|
if (2 * N > hi && lo >= N) {
|
||||||
result = a.mk_sub(x, a.mk_int(N));
|
result = a.mk_sub(x, a.mk_int(N));
|
||||||
m_rewriter(result);
|
m_rewriter(result);
|
||||||
TRACE("propagate-ineqs", tout << expr_ref(m.mk_app(f, num_args, args), m) << " -> " << result << "\n");
|
TRACE(propagate_ineqs, tout << expr_ref(m.mk_app(f, num_args, args), m) << " -> " << result << "\n");
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
IF_VERBOSE(2, verbose_stream() << "potentially missed simplification: " << mk_pp(x, m) << " " << lo << " " << hi << " not reduced\n");
|
IF_VERBOSE(2, verbose_stream() << "potentially missed simplification: " << mk_pp(x, m) << " " << lo << " " << hi << " not reduced\n");
|
||||||
|
@ -289,7 +289,7 @@ void bound_simplifier::tighten_bound(dependent_expr const& de) {
|
||||||
void bound_simplifier::assert_upper(expr* x, rational const& n, bool strict) {
|
void bound_simplifier::assert_upper(expr* x, rational const& n, bool strict) {
|
||||||
scoped_mpq c(nm);
|
scoped_mpq c(nm);
|
||||||
nm.set(c, n.to_mpq());
|
nm.set(c, n.to_mpq());
|
||||||
TRACE("propagate-ineqs", tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " < " : " <= ") << n << "\n");
|
TRACE(propagate_ineqs, tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " < " : " <= ") << n << "\n");
|
||||||
bp.assert_upper(to_var(x), c, strict);
|
bp.assert_upper(to_var(x), c, strict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ void bound_simplifier::assert_upper(expr* x, rational const& n, bool strict) {
|
||||||
void bound_simplifier::assert_lower(expr* x, rational const& n, bool strict) {
|
void bound_simplifier::assert_lower(expr* x, rational const& n, bool strict) {
|
||||||
scoped_mpq c(nm);
|
scoped_mpq c(nm);
|
||||||
nm.set(c, n.to_mpq());
|
nm.set(c, n.to_mpq());
|
||||||
TRACE("propagate-ineqs", tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " > " : " >= ") << n << "\n");
|
TRACE(propagate_ineqs, tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " > " : " >= ") << n << "\n");
|
||||||
bp.assert_lower(to_var(x), c, strict);
|
bp.assert_lower(to_var(x), c, strict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ bool bound_simplifier::has_lower(expr* x, rational& n, bool& strict) {
|
||||||
return false;
|
return false;
|
||||||
strict = m_interval.lower_is_open(i);
|
strict = m_interval.lower_is_open(i);
|
||||||
n = m_interval.lower(i);
|
n = m_interval.lower(i);
|
||||||
TRACE("propagate-ineqs", tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " > " : " >= ") << n << "\n");
|
TRACE(propagate_ineqs, tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " > " : " >= ") << n << "\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ bool bound_simplifier::has_upper(expr* x, rational& n, bool& strict) {
|
||||||
return false;
|
return false;
|
||||||
strict = m_interval.upper_is_open(i);
|
strict = m_interval.upper_is_open(i);
|
||||||
n = m_interval.upper(i);
|
n = m_interval.upper(i);
|
||||||
TRACE("propagate-ineqs", tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " < " : " <= ") << n << "\n");
|
TRACE(propagate_ineqs, tout << to_var(x) << ": " << mk_pp(x, m) << (strict ? " < " : " <= ") << n << "\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@ void bound_simplifier::reset() {
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void find_ite_bounds(expr* root) {
|
void find_ite_bounds(expr* root) {
|
||||||
TRACE("find_ite_bounds_bug", display_bounds(tout););
|
TRACE(find_ite_bounds_bug, display_bounds(tout););
|
||||||
expr* n = root;
|
expr* n = root;
|
||||||
expr* target = nullptr;
|
expr* target = nullptr;
|
||||||
expr* c, * t, * e;
|
expr* c, * t, * e;
|
||||||
|
@ -531,7 +531,7 @@ void find_ite_bounds(expr* root) {
|
||||||
mpq curr;
|
mpq curr;
|
||||||
bool curr_strict;
|
bool curr_strict;
|
||||||
while (true) {
|
while (true) {
|
||||||
TRACE("find_ite_bounds_bug", tout << mk_ismt2_pp(n, m) << "\n";);
|
TRACE(find_ite_bounds_bug, tout << mk_ismt2_pp(n, m) << "\n";);
|
||||||
|
|
||||||
if (m.is_ite(n, c, t, e)) {
|
if (m.is_ite(n, c, t, e)) {
|
||||||
if (is_x_minus_y_eq_0(t, x, y))
|
if (is_x_minus_y_eq_0(t, x, y))
|
||||||
|
@ -548,7 +548,7 @@ void find_ite_bounds(expr* root) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("find_ite_bounds_bug", tout << "x: " << mk_ismt2_pp(x, m) << ", y: " << mk_ismt2_pp(y, m) << "\n";
|
TRACE(find_ite_bounds_bug, tout << "x: " << mk_ismt2_pp(x, m) << ", y: " << mk_ismt2_pp(y, m) << "\n";
|
||||||
if (target) {
|
if (target) {
|
||||||
tout << "target: " << mk_ismt2_pp(target, m) << "\n";
|
tout << "target: " << mk_ismt2_pp(target, m) << "\n";
|
||||||
tout << "has_l: " << has_l << " " << nm.to_string(l_min) << " has_u: " << has_u << " " << nm.to_string(u_max) << "\n";
|
tout << "has_l: " << has_l << " " << nm.to_string(l_min) << " has_u: " << has_u << " " << nm.to_string(u_max) << "\n";
|
||||||
|
@ -558,7 +558,7 @@ void find_ite_bounds(expr* root) {
|
||||||
std::swap(x, y);
|
std::swap(x, y);
|
||||||
|
|
||||||
if (!is_unbounded(x)) {
|
if (!is_unbounded(x)) {
|
||||||
TRACE("find_ite_bounds_bug", tout << "x is already bounded\n";);
|
TRACE(find_ite_bounds_bug, tout << "x is already bounded\n";);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ void find_ite_bounds(expr* root) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
has_l = false;
|
has_l = false;
|
||||||
TRACE("find_ite_bounds_bug", tout << "y does not have lower\n";);
|
TRACE(find_ite_bounds_bug, tout << "y does not have lower\n";);
|
||||||
}
|
}
|
||||||
if (upper(y, curr, curr_strict)) {
|
if (upper(y, curr, curr_strict)) {
|
||||||
has_u = true;
|
has_u = true;
|
||||||
|
@ -580,7 +580,7 @@ void find_ite_bounds(expr* root) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
has_u = false;
|
has_u = false;
|
||||||
TRACE("find_ite_bounds_bug", tout << "y does not have upper\n";);
|
TRACE(find_ite_bounds_bug, tout << "y does not have upper\n";);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (target == x) {
|
else if (target == x) {
|
||||||
|
@ -593,7 +593,7 @@ void find_ite_bounds(expr* root) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
has_l = false;
|
has_l = false;
|
||||||
TRACE("find_ite_bounds_bug", tout << "y does not have lower\n";);
|
TRACE(find_ite_bounds_bug, tout << "y does not have lower\n";);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (has_u) {
|
if (has_u) {
|
||||||
|
@ -605,7 +605,7 @@ void find_ite_bounds(expr* root) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
has_u = false;
|
has_u = false;
|
||||||
TRACE("find_ite_bounds_bug", tout << "y does not have upper\n";);
|
TRACE(find_ite_bounds_bug, tout << "y does not have upper\n";);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -617,7 +617,7 @@ void find_ite_bounds(expr* root) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (n == nullptr) {
|
if (n == nullptr) {
|
||||||
TRACE("find_ite_bounds", tout << "found bounds for: " << mk_ismt2_pp(target, m) << "\n";
|
TRACE(find_ite_bounds, tout << "found bounds for: " << mk_ismt2_pp(target, m) << "\n";
|
||||||
tout << "has_l: " << has_l << " " << nm.to_string(l_min) << " l_strict: " << l_strict << "\n";
|
tout << "has_l: " << has_l << " " << nm.to_string(l_min) << " l_strict: " << l_strict << "\n";
|
||||||
tout << "has_u: " << has_u << " " << nm.to_string(u_max) << " u_strict: " << u_strict << "\n";
|
tout << "has_u: " << has_u << " " << nm.to_string(u_max) << " u_strict: " << u_strict << "\n";
|
||||||
tout << "root:\n" << mk_ismt2_pp(root, m) << "\n";);
|
tout << "root:\n" << mk_ismt2_pp(root, m) << "\n";);
|
||||||
|
@ -642,7 +642,7 @@ void find_ite_bounds() {
|
||||||
find_ite_bounds(to_app(f));
|
find_ite_bounds(to_app(f));
|
||||||
}
|
}
|
||||||
bp.propagate();
|
bp.propagate();
|
||||||
TRACE("find_ite_bounds", display_bounds(tout););
|
TRACE(find_ite_bounds, display_bounds(tout););
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,7 +34,7 @@ void card2bv::reduce() {
|
||||||
rw1(f, new_f1);
|
rw1(f, new_f1);
|
||||||
rw2(false, new_f1, new_f2, new_pr);
|
rw2(false, new_f1, new_f2, new_pr);
|
||||||
if (new_f2 != f) {
|
if (new_f2 != f) {
|
||||||
TRACE("card2bv", tout << "Rewriting " << new_f1 << "\n" << new_f2 << "\n");
|
TRACE(card2bv, tout << "Rewriting " << new_f1 << "\n" << new_f2 << "\n");
|
||||||
m_fmls.update(idx, dependent_expr(m, new_f2, mp(p, new_pr), d));
|
m_fmls.update(idx, dependent_expr(m, new_f2, mp(p, new_pr), d));
|
||||||
++m_stats.m_num_rewrites;
|
++m_stats.m_num_rewrites;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,13 +116,13 @@ bool demodulator_simplifier::rewrite1(func_decl* f, expr_ref_vector const& args,
|
||||||
if (!m_index.find_fwd(f, set))
|
if (!m_index.find_fwd(f, set))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TRACE("demodulator", tout << "trying to rewrite: " << f->get_name() << " args:" << args << "\n"; m_index.display(tout));
|
TRACE(demodulator, tout << "trying to rewrite: " << f->get_name() << " args:" << args << "\n"; m_index.display(tout));
|
||||||
|
|
||||||
for (unsigned i : *set) {
|
for (unsigned i : *set) {
|
||||||
|
|
||||||
auto const& [lhs, rhs] = m_rewrites[i];
|
auto const& [lhs, rhs] = m_rewrites[i];
|
||||||
|
|
||||||
TRACE("demodulator", tout << "Matching with demodulator: " << i << " " << mk_pp(lhs, m) << "\n");
|
TRACE(demodulator, tout << "Matching with demodulator: " << i << " " << mk_pp(lhs, m) << "\n");
|
||||||
|
|
||||||
if (lhs->get_num_args() != args.size())
|
if (lhs->get_num_args() != args.size())
|
||||||
continue;
|
continue;
|
||||||
|
@ -131,7 +131,7 @@ bool demodulator_simplifier::rewrite1(func_decl* f, expr_ref_vector const& args,
|
||||||
|
|
||||||
|
|
||||||
if (m_match_subst(lhs, rhs, args.data(), np)) {
|
if (m_match_subst(lhs, rhs, args.data(), np)) {
|
||||||
TRACE("demodulator_bug", tout << "succeeded...\n" << mk_pp(rhs, m) << "\n===>\n" << np << "\n");
|
TRACE(demodulator_bug, tout << "succeeded...\n" << mk_pp(rhs, m) << "\n===>\n" << np << "\n");
|
||||||
if (dep(i))
|
if (dep(i))
|
||||||
m_dependencies.insert(i);
|
m_dependencies.insert(i);
|
||||||
return true;
|
return true;
|
||||||
|
@ -199,7 +199,7 @@ void demodulator_simplifier::reduce() {
|
||||||
rewrite(i);
|
rewrite(i);
|
||||||
if (m_util.is_demodulator(fml(i), large, small)) {
|
if (m_util.is_demodulator(fml(i), large, small)) {
|
||||||
func_decl* f = large->get_decl();
|
func_decl* f = large->get_decl();
|
||||||
TRACE("demodulator", tout << i << " " << mk_pp(fml(i), m) << ": " << large << " ==> " << small << "\n");
|
TRACE(demodulator, tout << i << " " << mk_pp(fml(i), m) << ": " << large << " ==> " << small << "\n");
|
||||||
reschedule_processed(f);
|
reschedule_processed(f);
|
||||||
reschedule_demodulators(f, large);
|
reschedule_demodulators(f, large);
|
||||||
m_index.insert_fwd(f, i);
|
m_index.insert_fwd(f, i);
|
||||||
|
|
|
@ -60,7 +60,7 @@ expr_ref dominator_simplifier::simplify_ite(app * ite) {
|
||||||
r = new_t;
|
r = new_t;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRACE("simplify", tout << new_c << "\n" << new_t << "\n" << new_e << "\n";);
|
TRACE(simplify, tout << new_c << "\n" << new_t << "\n" << new_e << "\n";);
|
||||||
r = m.mk_ite(new_c, new_t, new_e);
|
r = m.mk_ite(new_c, new_t, new_e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ expr_ref dominator_simplifier::simplify_arg(expr * e) {
|
||||||
expr_ref r(m);
|
expr_ref r(m);
|
||||||
r = get_cached(e);
|
r = get_cached(e);
|
||||||
(*m_simplifier)(r);
|
(*m_simplifier)(r);
|
||||||
CTRACE("simplify", e != r, tout << "depth: " << m_depth << " " << mk_pp(e, m) << " -> " << r << "\n";);
|
CTRACE(simplify, e != r, tout << "depth: " << m_depth << " " << mk_pp(e, m) << " -> " << r << "\n";);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,10 +125,10 @@ expr_ref dominator_simplifier::simplify_rec(expr * e0) {
|
||||||
r = e;
|
r = e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CTRACE("simplify", e0 != r, tout << "depth before: " << m_depth << " " << mk_pp(e0, m) << " -> " << r << "\n";);
|
CTRACE(simplify, e0 != r, tout << "depth before: " << m_depth << " " << mk_pp(e0, m) << " -> " << r << "\n";);
|
||||||
(*m_simplifier)(r);
|
(*m_simplifier)(r);
|
||||||
cache(e0, r);
|
cache(e0, r);
|
||||||
CTRACE("simplify", e0 != r, tout << "depth: " << m_depth << " " << mk_pp(e0, m) << " -> " << r << "\n";);
|
CTRACE(simplify, e0 != r, tout << "depth: " << m_depth << " " << mk_pp(e0, m) << " -> " << r << "\n";);
|
||||||
--m_depth;
|
--m_depth;
|
||||||
m_subexpr_cache.reset();
|
m_subexpr_cache.reset();
|
||||||
return r;
|
return r;
|
||||||
|
@ -237,7 +237,7 @@ void dominator_simplifier::reduce() {
|
||||||
if (!m.is_true(r) && !m.is_false(r) && !p && !assert_expr(r, false))
|
if (!m.is_true(r) && !m.is_false(r) && !p && !assert_expr(r, false))
|
||||||
r = m.mk_false();
|
r = m.mk_false();
|
||||||
|
|
||||||
CTRACE("simplify", r != f, tout << r << " " << mk_pp(f, m) << "\n";);
|
CTRACE(simplify, r != f, tout << r << " " << mk_pp(f, m) << "\n";);
|
||||||
change |= r != f;
|
change |= r != f;
|
||||||
proof_ref new_pr(m);
|
proof_ref new_pr(m);
|
||||||
if (p) {
|
if (p) {
|
||||||
|
@ -260,7 +260,7 @@ void dominator_simplifier::reduce() {
|
||||||
r = m.mk_false();
|
r = m.mk_false();
|
||||||
|
|
||||||
change |= r != f;
|
change |= r != f;
|
||||||
CTRACE("simplify", r != f, tout << r << " " << mk_pp(f, m) << "\n";);
|
CTRACE(simplify, r != f, tout << r << " " << mk_pp(f, m) << "\n";);
|
||||||
proof_ref new_pr(m);
|
proof_ref new_pr(m);
|
||||||
if (r) {
|
if (r) {
|
||||||
new_pr = m.mk_rewrite(f, r);
|
new_pr = m.mk_rewrite(f, r);
|
||||||
|
|
|
@ -159,7 +159,7 @@ void elim_unconstrained::eliminate() {
|
||||||
SASSERT(!m_heap.contains(p.term()->get_id()));
|
SASSERT(!m_heap.contains(p.term()->get_id()));
|
||||||
|
|
||||||
app* t = to_app(e);
|
app* t = to_app(e);
|
||||||
TRACE("elim_unconstrained", tout << "eliminating " << mk_bounded_pp(t, m) << "\n";);
|
TRACE(elim_unconstrained, tout << "eliminating " << mk_bounded_pp(t, m) << "\n";);
|
||||||
unsigned sz = m_args.size();
|
unsigned sz = m_args.size();
|
||||||
for (expr* arg : *to_app(t))
|
for (expr* arg : *to_app(t))
|
||||||
m_args.push_back(reconstruct_term(root(arg)));
|
m_args.push_back(reconstruct_term(root(arg)));
|
||||||
|
@ -180,7 +180,7 @@ void elim_unconstrained::eliminate() {
|
||||||
IF_VERBOSE(4, verbose_stream() << "replace " << mk_bounded_pp(t, m) << " / " << mk_bounded_pp(rr, m) << " -> " << mk_bounded_pp(r, m) << "\n");
|
IF_VERBOSE(4, verbose_stream() << "replace " << mk_bounded_pp(t, m) << " / " << mk_bounded_pp(rr, m) << " -> " << mk_bounded_pp(r, m) << "\n");
|
||||||
|
|
||||||
|
|
||||||
TRACE("elim_unconstrained", tout << mk_bounded_pp(t, m) << " / " << mk_bounded_pp(rr, m) << " -> " << mk_bounded_pp(r, m) << "\n");
|
TRACE(elim_unconstrained, tout << mk_bounded_pp(t, m) << " / " << mk_bounded_pp(rr, m) << " -> " << mk_bounded_pp(r, m) << "\n");
|
||||||
SASSERT(r->get_sort() == t->get_sort());
|
SASSERT(r->get_sort() == t->get_sort());
|
||||||
m_stats.m_num_eliminated++;
|
m_stats.m_num_eliminated++;
|
||||||
node& rn = root(r);
|
node& rn = root(r);
|
||||||
|
@ -382,7 +382,7 @@ void elim_unconstrained::assert_normalized(vector<dependent_expr>& old_fmls) {
|
||||||
if (f == g)
|
if (f == g)
|
||||||
continue;
|
continue;
|
||||||
old_fmls.push_back(m_fmls[i]);
|
old_fmls.push_back(m_fmls[i]);
|
||||||
TRACE("elim_unconstrained", tout << mk_bounded_pp(f, m) << " -> " << mk_bounded_pp(g, m) << "\n");
|
TRACE(elim_unconstrained, tout << mk_bounded_pp(f, m) << " -> " << mk_bounded_pp(g, m) << "\n");
|
||||||
m_fmls.update(i, dependent_expr(m, g, nullptr, d));
|
m_fmls.update(i, dependent_expr(m, g, nullptr, d));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,7 +313,7 @@ bool eliminate_predicates::is_macro_safe(expr* e) {
|
||||||
|
|
||||||
void eliminate_predicates::insert_macro(app* head, expr* def, clause& cl) {
|
void eliminate_predicates::insert_macro(app* head, expr* def, clause& cl) {
|
||||||
insert_macro(head, def, cl.m_dep);
|
insert_macro(head, def, cl.m_dep);
|
||||||
TRACE("elim_predicates", tout << "remove " << cl << "\n");
|
TRACE(elim_predicates, tout << "remove " << cl << "\n");
|
||||||
cl.m_alive = false;
|
cl.m_alive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ void eliminate_predicates::insert_macro(app* head, expr* def, expr_dependency* d
|
||||||
m_macros.insert(head->get_decl(), info);
|
m_macros.insert(head->get_decl(), info);
|
||||||
m_fmls.model_trail().push(head->get_decl(), _def, _dep, {}); // augment with definition for head
|
m_fmls.model_trail().push(head->get_decl(), _def, _dep, {}); // augment with definition for head
|
||||||
m_is_macro.mark(head->get_decl(), true);
|
m_is_macro.mark(head->get_decl(), true);
|
||||||
TRACE("elim_predicates", tout << "insert " << _head << " " << _def << "\n");
|
TRACE(elim_predicates, tout << "insert " << _head << " " << _def << "\n");
|
||||||
++m_stats.m_num_macros;
|
++m_stats.m_num_macros;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@ void eliminate_predicates::try_resolve(func_decl* p) {
|
||||||
if (cl->m_alive)
|
if (cl->m_alive)
|
||||||
++num_neg;
|
++num_neg;
|
||||||
|
|
||||||
TRACE("elim_predicates", tout << "try resolve " << p->get_name() << " " << num_pos << " " << num_neg << "\n");
|
TRACE(elim_predicates, tout << "try resolve " << p->get_name() << " " << num_pos << " " << num_neg << "\n");
|
||||||
|
|
||||||
if (num_pos >= 4 && num_neg >= 2)
|
if (num_pos >= 4 && num_neg >= 2)
|
||||||
return;
|
return;
|
||||||
|
@ -737,7 +737,7 @@ void eliminate_predicates::update_model(func_decl* p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
rewrite(def);
|
rewrite(def);
|
||||||
TRACE("elim_predicates", tout << "insert " << p->get_name() << " " << def << "\n");
|
TRACE(elim_predicates, tout << "insert " << p->get_name() << " " << def << "\n");
|
||||||
m_fmls.model_trail().push(p, def, dep, deleted);
|
m_fmls.model_trail().push(p, def, dep, deleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ namespace euf {
|
||||||
IF_VERBOSE(11, verbose_stream() << mk_bounded_pp(f, m, 3) << " -> " << mk_bounded_pp(g, m, 3) << "\n");
|
IF_VERBOSE(11, verbose_stream() << mk_bounded_pp(f, m, 3) << " -> " << mk_bounded_pp(g, m, 3) << "\n");
|
||||||
update_has_new_eq(g);
|
update_has_new_eq(g);
|
||||||
}
|
}
|
||||||
CTRACE("euf_completion", g != f, tout << mk_bounded_pp(f, m) << " -> " << mk_bounded_pp(g, m) << "\n");
|
CTRACE(euf_completion, g != f, tout << mk_bounded_pp(f, m) << " -> " << mk_bounded_pp(g, m) << "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ namespace euf {
|
||||||
rep = k;
|
rep = k;
|
||||||
m_reps.setx(n->get_id(), rep, nullptr);
|
m_reps.setx(n->get_id(), rep, nullptr);
|
||||||
|
|
||||||
TRACE("euf_completion", tout << "rep " << m_egraph.bpp(n) << " -> " << m_egraph.bpp(rep) << "\n";
|
TRACE(euf_completion, tout << "rep " << m_egraph.bpp(n) << " -> " << m_egraph.bpp(rep) << "\n";
|
||||||
for (enode* k : enode_class(n)) tout << m_egraph.bpp(k) << "\n";);
|
for (enode* k : enode_class(n)) tout << m_egraph.bpp(k) << "\n";);
|
||||||
m_todo.push_back(n->get_expr());
|
m_todo.push_back(n->get_expr());
|
||||||
for (enode* arg : enode_args(n)) {
|
for (enode* arg : enode_args(n)) {
|
||||||
|
|
|
@ -68,14 +68,14 @@ linear_equation * linear_equation_manager::mk(unsigned sz, mpq * as, var * xs, b
|
||||||
m.lcm(r, l, l);
|
m.lcm(r, l, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("linear_equation_mk", tout << "lcm: " << m.to_string(l) << "\n";);
|
TRACE(linear_equation_mk, tout << "lcm: " << m.to_string(l) << "\n";);
|
||||||
|
|
||||||
// copy l * as to m_int_buffer.
|
// copy l * as to m_int_buffer.
|
||||||
m_int_buffer.reset();
|
m_int_buffer.reset();
|
||||||
for (unsigned i = 0; i < sz; i++) {
|
for (unsigned i = 0; i < sz; i++) {
|
||||||
TRACE("linear_equation_mk", tout << "before as[" << i << "]: " << m.to_string(as[i]) << "\n";);
|
TRACE(linear_equation_mk, tout << "before as[" << i << "]: " << m.to_string(as[i]) << "\n";);
|
||||||
m.mul(l, as[i], as[i]);
|
m.mul(l, as[i], as[i]);
|
||||||
TRACE("linear_equation_mk", tout << "after as[" << i << "]: " << m.to_string(as[i]) << "\n";);
|
TRACE(linear_equation_mk, tout << "after as[" << i << "]: " << m.to_string(as[i]) << "\n";);
|
||||||
SASSERT(m.is_int(as[i]));
|
SASSERT(m.is_int(as[i]));
|
||||||
m_int_buffer.push_back(as[i].numerator());
|
m_int_buffer.push_back(as[i].numerator());
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ linear_equation * linear_equation_manager::mk_core(unsigned sz, mpz * as, var *
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
TRACE("linear_equation_bug", for (unsigned i = 0; i < sz; i++) tout << m.to_string(as[i]) << "*x" << xs[i] << " "; tout << "\n";);
|
TRACE(linear_equation_bug, for (unsigned i = 0; i < sz; i++) tout << m.to_string(as[i]) << "*x" << xs[i] << " "; tout << "\n";);
|
||||||
|
|
||||||
mpz g;
|
mpz g;
|
||||||
m.set(g, as[0]);
|
m.set(g, as[0]);
|
||||||
|
@ -118,7 +118,7 @@ linear_equation * linear_equation_manager::mk_core(unsigned sz, mpz * as, var *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("linear_equation_bug",
|
TRACE(linear_equation_bug,
|
||||||
tout << "g: " << m.to_string(g) << "\n";
|
tout << "g: " << m.to_string(g) << "\n";
|
||||||
for (unsigned i = 0; i < sz; i++) tout << m.to_string(as[i]) << "*x" << xs[i] << " "; tout << "\n";);
|
for (unsigned i = 0; i < sz; i++) tout << m.to_string(as[i]) << "*x" << xs[i] << " "; tout << "\n";);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ void model_reconstruction_trail::add_vars(expr* e, ast_mark& free_vars) {
|
||||||
for (expr* t : subterms::all(expr_ref(e, m))) {
|
for (expr* t : subterms::all(expr_ref(e, m))) {
|
||||||
if (is_app(t) && is_uninterp(t)) {
|
if (is_app(t) && is_uninterp(t)) {
|
||||||
func_decl* f = to_app(t)->get_decl();
|
func_decl* f = to_app(t)->get_decl();
|
||||||
TRACE("simplifier", tout << "add var " << f->get_name() << "\n");
|
TRACE(simplifier, tout << "add var " << f->get_name() << "\n");
|
||||||
free_vars.mark(f, true);
|
free_vars.mark(f, true);
|
||||||
if (m_model_vars.is_marked(f))
|
if (m_model_vars.is_marked(f))
|
||||||
m_intersects_with_model = true;
|
m_intersects_with_model = true;
|
||||||
|
@ -51,7 +51,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt
|
||||||
for (expr* a : assumptions)
|
for (expr* a : assumptions)
|
||||||
add_vars(a, free_vars);
|
add_vars(a, free_vars);
|
||||||
|
|
||||||
TRACE("simplifier",
|
TRACE(simplifier,
|
||||||
tout << "intersects " << m_intersects_with_model << "\n";
|
tout << "intersects " << m_intersects_with_model << "\n";
|
||||||
for (unsigned i = qhead; i < st.qtail(); ++i)
|
for (unsigned i = qhead; i < st.qtail(); ++i)
|
||||||
tout << mk_bounded_pp(st[i].fml(), m) << "\n";
|
tout << mk_bounded_pp(st[i].fml(), m) << "\n";
|
||||||
|
@ -61,7 +61,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto& t : m_trail) {
|
for (auto& t : m_trail) {
|
||||||
TRACE("simplifier", tout << " active " << t->m_active << " hide " << t->is_hide() << " intersects " << t->intersects(free_vars) << " loose " << t->is_loose() << "\n");
|
TRACE(simplifier, tout << " active " << t->m_active << " hide " << t->is_hide() << " intersects " << t->intersects(free_vars) << " loose " << t->is_loose() << "\n");
|
||||||
if (!t->m_active)
|
if (!t->m_active)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt
|
||||||
if (t->is_loose_constraint()) {
|
if (t->is_loose_constraint()) {
|
||||||
for (auto r : t->m_removed) {
|
for (auto r : t->m_removed) {
|
||||||
add_vars(r, free_vars);
|
add_vars(r, free_vars);
|
||||||
TRACE("simplifier", tout << "replay removed " << r << "\n");
|
TRACE(simplifier, tout << "replay removed " << r << "\n");
|
||||||
st.add(r);
|
st.add(r);
|
||||||
}
|
}
|
||||||
t->m_active = false;
|
t->m_active = false;
|
||||||
|
@ -102,7 +102,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt
|
||||||
if (t->is_loose() && (!t->is_def() || !all_const || t->is_subst())) {
|
if (t->is_loose() && (!t->is_def() || !all_const || t->is_subst())) {
|
||||||
for (auto r : t->m_removed) {
|
for (auto r : t->m_removed) {
|
||||||
add_vars(r, free_vars);
|
add_vars(r, free_vars);
|
||||||
TRACE("simplifier", tout << "replay removed " << r << "\n");
|
TRACE(simplifier, tout << "replay removed " << r << "\n");
|
||||||
st.add(r);
|
st.add(r);
|
||||||
}
|
}
|
||||||
m_trail_stack.push(value_trail(t->m_active));
|
m_trail_stack.push(value_trail(t->m_active));
|
||||||
|
@ -119,7 +119,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt
|
||||||
args.push_back(m.mk_var(i, d->get_domain(i)));
|
args.push_back(m.mk_var(i, d->get_domain(i)));
|
||||||
head = m.mk_app(d, args);
|
head = m.mk_app(d, args);
|
||||||
mrp.insert(head, def, dep);
|
mrp.insert(head, def, dep);
|
||||||
TRACE("simplifier", tout << mk_pp(d, m) << " " << mk_pp(def,m) << " " << "\n");
|
TRACE(simplifier, tout << mk_pp(d, m) << " " << mk_pp(def,m) << " " << "\n");
|
||||||
dependent_expr de(m, def, nullptr, dep);
|
dependent_expr de(m, def, nullptr, dep);
|
||||||
add_vars(de, free_vars);
|
add_vars(de, free_vars);
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt
|
||||||
expr_ref g(m);
|
expr_ref g(m);
|
||||||
expr_dependency_ref dep2(m);
|
expr_dependency_ref dep2(m);
|
||||||
mrp(f, dep1, g, dep2);
|
mrp(f, dep1, g, dep2);
|
||||||
CTRACE("simplifier", f != g, tout << "updated " << mk_pp(g, m) << "\n");
|
CTRACE(simplifier, f != g, tout << "updated " << mk_pp(g, m) << "\n");
|
||||||
if (f != g)
|
if (f != g)
|
||||||
st.update(i, dependent_expr(m, g, nullptr, dep2));
|
st.update(i, dependent_expr(m, g, nullptr, dep2));
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt
|
||||||
dep1 = m.mk_join(dep_exprs.size(), dep_exprs.data());
|
dep1 = m.mk_join(dep_exprs.size(), dep_exprs.data());
|
||||||
}
|
}
|
||||||
dependent_expr d(m, g, nullptr, m.mk_join(dep1, dep2));
|
dependent_expr d(m, g, nullptr, m.mk_join(dep1, dep2));
|
||||||
CTRACE("simplifier", f != g, tout << "updated " << mk_pp(g, m) << "\n");
|
CTRACE(simplifier, f != g, tout << "updated " << mk_pp(g, m) << "\n");
|
||||||
add_vars(d, free_vars);
|
add_vars(d, free_vars);
|
||||||
st.update(i, d);
|
st.update(i, d);
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ void model_reconstruction_trail::replay(unsigned qhead, expr_ref_vector& assumpt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("simplifier", st.display(tout));
|
TRACE(simplifier, st.display(tout));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -218,7 +218,7 @@ void model_reconstruction_trail::append(generic_model_converter& mc) {
|
||||||
mc.add(v, def);
|
mc.add(v, def);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("simplifier", display(tout); mc.display(tout));
|
TRACE(simplifier, display(tout); mc.display(tout));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ class reduce_args_simplifier : public dependent_expr_simplifier {
|
||||||
for (auto i : indices())
|
for (auto i : indices())
|
||||||
quick_for_each_expr(proc, visited, m_fmls[i].fml());
|
quick_for_each_expr(proc, visited, m_fmls[i].fml());
|
||||||
|
|
||||||
TRACE("reduce_args", tout << "non_candidates:\n"; for (func_decl* d : non_candidates) tout << d->get_name() << "\n";);
|
TRACE(reduce_args, tout << "non_candidates:\n"; for (func_decl* d : non_candidates) tout << d->get_name() << "\n";);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct populate_decl2args_proc {
|
struct populate_decl2args_proc {
|
||||||
|
@ -196,7 +196,7 @@ class reduce_args_simplifier : public dependent_expr_simplifier {
|
||||||
for (func_decl* a : bad_decls)
|
for (func_decl* a : bad_decls)
|
||||||
decl2args.erase(a);
|
decl2args.erase(a);
|
||||||
|
|
||||||
TRACE("reduce_args", tout << "decl2args:" << std::endl;
|
TRACE(reduce_args, tout << "decl2args:" << std::endl;
|
||||||
for (auto const& [k, v] : decl2args) {
|
for (auto const& [k, v] : decl2args) {
|
||||||
tout << k->get_name() << ": ";
|
tout << k->get_name() << ": ";
|
||||||
for (unsigned i = 0; i < v.size(); ++i)
|
for (unsigned i = 0; i < v.size(); ++i)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue