3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-28 00:48:45 +00:00

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

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

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

* Refactor TRACE_NEW to prepend TraceTag and pass enum to is_trace_enabled

* trace: improve trace tag handling system with hierarchical tagging

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

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

* trace : add cstring header

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

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

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

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

View file

@ -44,7 +44,7 @@ namespace smt {
void undo() override {
m_already_processed.erase(m_n1, m_n2);
TRACE("arith_eq_adapter_profile", tout << "del #" << m_n1->get_owner_id() << " #" << m_n2->get_owner_id() << "\n";);
TRACE(arith_eq_adapter_profile, tout << "del #" << m_n1->get_owner_id() << " #" << m_n2->get_owner_id() << "\n";);
}
};
@ -83,7 +83,7 @@ namespace smt {
if (n1 == n2)
return;
ast_manager & m = get_manager();
TRACE("arith_eq_adapter_mk_axioms", tout << "#" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n";
TRACE(arith_eq_adapter_mk_axioms, tout << "#" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n";
tout << mk_ismt2_pp(n1->get_expr(), m) << "\n" << mk_ismt2_pp(n2->get_expr(), m) << "\n";);
if (n1->get_owner_id() > n2->get_owner_id())
std::swap(n1, n2);
@ -105,7 +105,7 @@ namespace smt {
return;
}
CTRACE("arith_eq_adapter_relevancy", !(ctx.is_relevant(n1) && ctx.is_relevant(n2)),
CTRACE(arith_eq_adapter_relevancy, !(ctx.is_relevant(n1) && ctx.is_relevant(n2)),
tout << "is_relevant(n1): #" << n1->get_owner_id() << " " << ctx.is_relevant(n1) << "\n";
tout << "is_relevant(n2): #" << n2->get_owner_id() << " " << ctx.is_relevant(n2) << "\n";
tout << pp(n1, get_manager()) << "\n";
@ -119,12 +119,12 @@ namespace smt {
if (m_already_processed.find(n1, n2, d))
return;
TRACE("arith_eq_adapter_profile", tout << "mk #" << n1->get_owner_id() << " #" << n2->get_owner_id() << " " <<
TRACE(arith_eq_adapter_profile, tout << "mk #" << n1->get_owner_id() << " #" << n2->get_owner_id() << " " <<
m_already_processed.size() << " " << ctx.get_scope_level() << "\n";);
m_stats.m_num_eq_axioms++;
TRACE("arith_eq_adapter_profile_detail",
TRACE(arith_eq_adapter_profile_detail,
tout << "mk_detail " << mk_bounded_pp(n1->get_expr(), m, 5) << " " <<
mk_bounded_pp(n2->get_expr(), m, 5) << "\n";);
@ -132,7 +132,7 @@ namespace smt {
t1_eq_t2 = ctx.mk_eq_atom(t1, t2);
SASSERT(!m.is_false(t1_eq_t2));
TRACE("arith_eq_adapter_bug", tout << mk_bounded_pp(t1_eq_t2, m) << "\n"
TRACE(arith_eq_adapter_bug, tout << mk_bounded_pp(t1_eq_t2, m) << "\n"
<< mk_bounded_pp(t1, m) << "\n"
<< mk_bounded_pp(t2, m) << "\n";);
@ -176,19 +176,19 @@ namespace smt {
le = m_util.mk_le(s, zero);
ge = m_util.mk_ge(s, zero);
}
TRACE("arith_eq_adapter_perf",
TRACE(arith_eq_adapter_perf,
tout << mk_ismt2_pp(t1_eq_t2, m) << "\n" << mk_ismt2_pp(le, m) << "\n" << mk_ismt2_pp(ge, m) << "\n";);
ctx.push_trail(already_processed_trail(m_already_processed, n1, n2));
m_already_processed.insert(n1, n2, data(t1_eq_t2, le, ge));
TRACE("arith_eq_adapter_profile", tout << "insert #" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n";);
TRACE(arith_eq_adapter_profile, tout << "insert #" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n";);
ctx.internalize(t1_eq_t2, true);
literal t1_eq_t2_lit(ctx.get_bool_var(t1_eq_t2));
TRACE("interface_eq",
TRACE(interface_eq,
tout << "core should try true phase first for the equality: " << t1_eq_t2_lit << "\n";
tout << "#" << n1->get_owner_id() << " == #" << n2->get_owner_id() << "\n";
tout << "try_true_first: " << ctx.try_true_first(t1_eq_t2_lit.var()) << "\n";);
TRACE("arith_eq_adapter_bug",
TRACE(arith_eq_adapter_bug,
tout << "le: " << mk_ismt2_pp(le, m) << "\nge: " << mk_ismt2_pp(ge, m) << "\n";);
ctx.internalize(le, true);
ctx.internalize(ge, true);
@ -210,13 +210,13 @@ namespace smt {
ctx.mk_th_axiom(tid, ~t1_eq_t2_lit, le_lit, m_proof_hint.size(), m_proof_hint.data());
ctx.mk_th_axiom(tid, ~t1_eq_t2_lit, ge_lit, m_proof_hint.size(), m_proof_hint.data());
ctx.mk_th_axiom(tid, t1_eq_t2_lit, ~le_lit, ~ge_lit, m_proof_hint.size(), m_proof_hint.data());
TRACE("arith_eq_adapter", tout << "internalizing: "
TRACE(arith_eq_adapter, tout << "internalizing: "
<< " " << mk_pp(le, m) << ": " << le_lit
<< " " << mk_pp(ge, m) << ": " << ge_lit
<< " " << mk_pp(t1_eq_t2, m) << ": " << t1_eq_t2_lit << "\n";);
if (m_owner.get_fparams().m_arith_add_binary_bounds) {
TRACE("arith_eq_adapter", tout << "adding binary bounds...\n";);
TRACE(arith_eq_adapter, tout << "adding binary bounds...\n";);
ctx.mk_th_axiom(tid, le_lit, ge_lit, m_proof_hint.size(), m_proof_hint.data());
}
if (ctx.relevancy()) {
@ -228,17 +228,17 @@ namespace smt {
n1->get_iscope_lvl() <= ctx.get_base_level() && n2->get_iscope_lvl() <= ctx.get_base_level()) {
m_restart_pairs.push_back(enode_pair(n1, n2));
}
TRACE("arith_eq_adapter_detail", ctx.display(tout););
TRACE(arith_eq_adapter_detail, ctx.display(tout););
}
void arith_eq_adapter::new_eq_eh(theory_var v1, theory_var v2) {
TRACE("arith_eq_adapter", tout << "v" << v1 << " = v" << v2 << " #" << get_enode(v1)->get_owner_id() << " = #" << get_enode(v2)->get_owner_id() << "\n";);
TRACE("arith_eq_adapter_bug", tout << mk_bounded_pp(get_enode(v1)->get_expr(), get_manager()) << "\n" << mk_bounded_pp(get_enode(v2)->get_expr(), get_manager()) << "\n";);
TRACE(arith_eq_adapter, tout << "v" << v1 << " = v" << v2 << " #" << get_enode(v1)->get_owner_id() << " = #" << get_enode(v2)->get_owner_id() << "\n";);
TRACE(arith_eq_adapter_bug, tout << mk_bounded_pp(get_enode(v1)->get_expr(), get_manager()) << "\n" << mk_bounded_pp(get_enode(v2)->get_expr(), get_manager()) << "\n";);
mk_axioms(get_enode(v1), get_enode(v2));
}
void arith_eq_adapter::new_diseq_eh(theory_var v1, theory_var v2) {
TRACE("arith_eq_adapter", tout << "v" << v1 << " != v" << v2 << " #" << get_enode(v1)->get_owner_id() << " != #" << get_enode(v2)->get_owner_id() << "\n";);
TRACE(arith_eq_adapter, tout << "v" << v1 << " != v" << v2 << " #" << get_enode(v1)->get_owner_id() << " != #" << get_enode(v2)->get_owner_id() << "\n";);
mk_axioms(get_enode(v1), get_enode(v2));
}
@ -247,7 +247,7 @@ namespace smt {
}
void arith_eq_adapter::reset_eh() {
TRACE("arith_eq_adapter", tout << "reset\n";);
TRACE(arith_eq_adapter, tout << "reset\n";);
m_already_processed .reset();
m_restart_pairs .reset();
m_stats .reset();
@ -255,13 +255,13 @@ namespace smt {
void arith_eq_adapter::restart_eh() {
context & ctx = get_context();
TRACE("arith_eq_adapter", tout << "restart\n";);
TRACE(arith_eq_adapter, tout << "restart\n";);
enode_pair_vector tmp(m_restart_pairs);
m_restart_pairs.reset();
for (auto const& p : tmp) {
if (ctx.inconsistent())
break;
TRACE("arith_eq_adapter", tout << "creating arith_eq_adapter axioms at the base level #" << p.first->get_owner_id() << " #" <<
TRACE(arith_eq_adapter, tout << "creating arith_eq_adapter axioms at the base level #" << p.first->get_owner_id() << " #" <<
p.second->get_owner_id() << "\n";);
mk_axioms(p.first, p.second);
}

View file

@ -161,7 +161,7 @@ bool arith_eq_solver::solve_integer_equation(
bool& is_fresh
)
{
TRACE("arith_eq_solver", print_row(tout << "solving: ", values); );
TRACE(arith_eq_solver, print_row(tout << "solving: ", values); );
//
// perform one step of the omega test equality elimination.
//
@ -198,7 +198,7 @@ bool arith_eq_solver::solve_integer_equation(
return false;
gcd_normalize(values);
if (!gcd_test(values)) {
TRACE("arith_eq_solver", print_row(tout << "not sat\n", values););
TRACE(arith_eq_solver, print_row(tout << "not sat\n", values););
return false;
}
index = find_abs_min(values);
@ -232,7 +232,7 @@ bool arith_eq_solver::solve_integer_equation(
values[index] = m;
}
TRACE("arith_eq_solver",
TRACE(arith_eq_solver,
tout << "solved at index " << index << ": ";
print_row(tout, values);
);
@ -248,7 +248,7 @@ void arith_eq_solver::substitute(
)
{
SASSERT(1 <= index && index < s.size());
TRACE("arith_eq_solver",
TRACE(arith_eq_solver,
tout << "substitute " << index << ":\n";
print_row(tout, r);
print_row(tout, s);
@ -318,7 +318,7 @@ void arith_eq_solver::substitute(
}
TRACE("arith_eq_solver",
TRACE(arith_eq_solver,
tout << "result: ";
print_row(tout, r);
);
@ -343,7 +343,7 @@ bool arith_eq_solver::solve_integer_equations_units(
)
{
TRACE("arith_eq_solver", print_rows(tout << "solving:\n", rows););
TRACE(arith_eq_solver, print_rows(tout << "solving:\n", rows););
unsigned_vector todo, done;
@ -353,7 +353,7 @@ bool arith_eq_solver::solve_integer_equations_units(
gcd_normalize(r);
if (!gcd_test(r)) {
unsat_row = r;
TRACE("arith_eq_solver", print_row(tout << "input is unsat: ", unsat_row); );
TRACE(arith_eq_solver, print_row(tout << "input is unsat: ", unsat_row); );
return false;
}
}
@ -362,7 +362,7 @@ bool arith_eq_solver::solve_integer_equations_units(
gcd_normalize(r);
if (!gcd_test(r)) {
unsat_row = r;
TRACE("arith_eq_solver", print_row(tout << "unsat: ", unsat_row); );
TRACE(arith_eq_solver, print_row(tout << "unsat: ", unsat_row); );
return false;
}
unsigned index = find_abs_min(r);
@ -391,7 +391,7 @@ bool arith_eq_solver::solve_integer_equations_units(
}
}
TRACE("arith_eq_solver",
TRACE(arith_eq_solver,
tout << ((done.size()<=1)?"solved ":"incomplete check ") << done.size() << "\n";
for (unsigned i = 0; i < done.size(); ++i) {
print_row(tout, rows[done[i]]);
@ -433,7 +433,7 @@ bool arith_eq_solver::solve_integer_equations_omega(
gcd_normalize(unsat_row);
// invert the substitution for every index that is fresh.
TRACE("arith_eq_solver",
TRACE(arith_eq_solver,
tout << "unsat:\n";
print_row(tout, unsat_row);
for (unsigned l = 0; l + 1< rows_solved.size(); ++l) {
@ -474,7 +474,7 @@ bool arith_eq_solver::solve_integer_equations_omega(
}
gcd_normalize(unsat_row);
TRACE("arith_eq_solver",
TRACE(arith_eq_solver,
tout << "gcd: ";
print_row(tout, solved_row);
print_row(tout, unsat_row);
@ -482,7 +482,7 @@ bool arith_eq_solver::solve_integer_equations_omega(
}
if (gcd_test(unsat_row)) {
TRACE("arith_eq_solver", tout << "missed pure explanation\n";);
TRACE(arith_eq_solver, tout << "missed pure explanation\n";);
return true;
}
SASSERT(!gcd_test(unsat_row));
@ -541,7 +541,7 @@ bool arith_eq_solver::solve_integer_equations_gcd(
gcd_normalize(r);
if (!gcd_test(r)) {
unsat_row = r;
TRACE("arith_eq_solver", print_row(tout << "input is unsat: ", unsat_row); );
TRACE(arith_eq_solver, print_row(tout << "input is unsat: ", unsat_row); );
return false;
}
}
@ -613,7 +613,7 @@ bool arith_eq_solver::solve_integer_equations_gcd(
gcd_normalize(r);
if (!gcd_test(r)) {
unsat_row = r;
TRACE("arith_eq_solver", print_row(tout << "unsat: ", unsat_row); );
TRACE(arith_eq_solver, print_row(tout << "unsat: ", unsat_row); );
return false;
}
}
@ -621,7 +621,7 @@ bool arith_eq_solver::solve_integer_equations_gcd(
}
}
TRACE("arith_eq_solver",
TRACE(arith_eq_solver,
tout << ((live.size()<=1)?"solved ":"incomplete check ") << live.size() << "\n";
for (unsigned l : live) print_row(tout, rows[l]); );

View file

@ -312,7 +312,7 @@ private:
typename assignment_stack::iterator begin = m_assignment_stack.begin();
while (it != begin) {
--it;
TRACE("dl_bug", tout << "undo assignment: " << it->get_var() << " " << it->get_old_value() << "\n";);
TRACE(dl_bug, tout << "undo assignment: " << it->get_var() << " " << it->get_old_value() << "\n";);
m_assignment[it->get_var()] = it->get_old_value();
}
m_assignment_stack.reset();
@ -368,7 +368,7 @@ private:
SASSERT(m_gamma[target].is_neg());
acc_assignment(target, gamma);
TRACE("arith", display(tout << id << " " << gamma << "\n");
TRACE(arith, display(tout << id << " " << gamma << "\n");
display_edge(tout, last_e);
);
@ -411,7 +411,7 @@ private:
}
break;
case DL_PROCESSED:
TRACE("arith", display_edge(tout << "processed twice: ", e););
TRACE(arith, display_edge(tout << "processed twice: ", e););
// if two edges with the same source/target occur in the graph.
break;
default:
@ -469,7 +469,7 @@ public:
// The graph does not have control over the ids assigned by the theory.
// That is init_var receives the id as an argument.
void init_var(dl_var v) {
TRACE("dl_bug", tout << "init_var " << v << "\n";);
TRACE(dl_bug, tout << "init_var " << v << "\n";);
if (static_cast<unsigned>(v) < m_out_edges.size() && (!m_out_edges[v].empty() || !m_in_edges[v].empty())) {
return;
}
@ -487,7 +487,7 @@ public:
}
m_assignment[v].reset();
SASSERT(static_cast<unsigned>(v) < m_heap.get_bounds());
TRACE("dl_bug", tout << "init_var " << v << ", m_assignment[v]: " << m_assignment[v] << "\n";);
TRACE(dl_bug, tout << "init_var " << v << ", m_assignment[v]: " << m_assignment[v] << "\n";);
SASSERT(m_assignment[v].is_zero());
SASSERT(m_out_edges[v].empty());
SASSERT(m_in_edges[v].empty());
@ -501,7 +501,7 @@ public:
edge_id new_id = m_edges.size();
m_edges.push_back(edge(source, target, weight, m_timestamp, ex));
m_activity.push_back(0);
TRACE("dl_bug", tout << "creating edge:\n"; display_edge(tout, m_edges.back()););
TRACE(dl_bug, tout << "creating edge:\n"; display_edge(tout, m_edges.back()););
m_out_edges[source].push_back(new_id);
m_in_edges[target].push_back(new_id);
return new_id;
@ -604,7 +604,7 @@ public:
numeral const& weight = e2.get_weight();
numeral delta = weight - potential + potentials[j];
if (delta.is_nonneg() && (gamma + delta).is_neg()) {
TRACE("diff_logic_traverse", tout << "Reducing path by ";
TRACE(diff_logic_traverse, tout << "Reducing path by ";
display_edge(tout, e2);
tout << "gamma: " << gamma << " weight: " << weight << "\n";
tout << "enabled: " << e2.is_enabled() << "\n";
@ -620,7 +620,7 @@ public:
break;
}
else {
TRACE("diff_logic_traverse", display_edge(tout << "skipping: ", e2););
TRACE(diff_logic_traverse, display_edge(tout << "skipping: ", e2););
}
}
}
@ -632,7 +632,7 @@ public:
}
while (e_id != last_id);
TRACE("diff_logic_traverse", {
TRACE(diff_logic_traverse, {
tout << "Num conflicts: " << num_conflicts << "\n";
tout << "Resulting path:\n";
for (unsigned i = 0; i < edges.size(); ++i) {
@ -886,7 +886,7 @@ public:
unsigned to_delete = num_edges - old_num_edges;
for (unsigned i = 0; i < to_delete; i++) {
const edge & e = m_edges.back();
TRACE("dl_bug", tout << "deleting edge:\n"; display_edge(tout, e););
TRACE(dl_bug, tout << "deleting edge:\n"; display_edge(tout, e););
dl_var source = e.get_source();
dl_var target = e.get_target();
SASSERT(static_cast<int>(m_edges.size()) - 1 == m_out_edges[source].back());
@ -957,7 +957,7 @@ private:
// m_assignment[v] += inc
// This method also stores the old value of v in the assignment stack.
void acc_assignment(dl_var v, const numeral & inc) {
TRACE("dl_bug", tout << "update v: " << v << " += " << inc << " m_assignment[v] " << m_assignment[v] << "\n";);
TRACE(dl_bug, tout << "update v: " << v << " += " << inc << " m_assignment[v] " << m_assignment[v] << "\n";);
m_assignment_stack.push_back(assignment_trail(v, m_assignment[v]));
m_assignment[v] += inc;
}
@ -1109,7 +1109,7 @@ public:
edge_id id;
SASSERT(get_edge_id(current, next, id) || get_edge_id(next, current, id)););
if (!discovered.contains(next) && !explored.contains(next)) {
TRACE("diff_logic", tout << "thread[" << prev << "] --> " << next << std::endl;);
TRACE(diff_logic, tout << "thread[" << prev << "] --> " << next << std::endl;);
threads[prev] = next;
prev = next;
discovered.insert(next);
@ -1150,7 +1150,7 @@ public:
edge_id id;
SASSERT(get_edge_id(current, next, id) || get_edge_id(next, current, id)););
if (!visited.contains(next)) {
TRACE("diff_logic", tout << "parents[" << next << "] --> " << current << std::endl;);
TRACE(diff_logic, tout << "parents[" << next << "] --> " << current << std::endl;);
parents[next] = current;
depths[next] = depths[current] + 1;
visited.insert(next);
@ -1206,7 +1206,7 @@ public:
dfs(v, scc_id);
}
}
TRACE("eq_scc",
TRACE(eq_scc,
for (dl_var v = 0; v < n; v++) {
tout << "$" << v << " -> " << scc_id[v] << "\n";
});
@ -1311,13 +1311,13 @@ private:
unsigned pred = (i>0)?(i-1):(num_edges-1);
edge const& e1 = m_edges[edges[pred]];
if (e.get_target() != e1.get_source()) {
TRACE("check_explanation", display_edge(tout, e); display_edge(tout, e1); );
TRACE(check_explanation, display_edge(tout, e); display_edge(tout, e1); );
return false;
}
w += e.get_weight();
}
if (w.is_nonneg()) {
TRACE("check_explanation", tout << "weight: " << w << "\n";);
TRACE(check_explanation, tout << "weight: " << w << "\n";);
return false;
}
return true;
@ -1331,7 +1331,7 @@ private:
potential0 += m_edges[edges[i]].get_weight();
if (potential0 != potentials[i] ||
nodes[i] != m_edges[edges[i]].get_source()) {
TRACE("diff_logic_traverse", tout << "checking index " << i << " ";
TRACE(diff_logic_traverse, tout << "checking index " << i << " ";
tout << "potential: " << potentials[i] << " ";
display_edge(tout, m_edges[edges[i]]);
);
@ -1397,7 +1397,7 @@ public:
bfs_elem & curr = bfs_todo[head];
int parent_idx = head;
dl_var v = curr.m_var;
TRACE("dl_bfs", tout << "processing: " << v << "\n";);
TRACE(dl_bfs, tout << "processing: " << v << "\n";);
edge_id_vector & edges = m_out_edges[v];
for (edge_id e_id : edges) {
edge & e = m_edges[e_id];
@ -1406,13 +1406,13 @@ public:
continue;
}
set_gamma(e, gamma);
TRACE("dl_bfs", display_edge(tout << "processing edge: ", e) << " gamma: " << gamma << "\n";);
TRACE(dl_bfs, display_edge(tout << "processing edge: ", e) << " gamma: " << gamma << "\n";);
if (is_connected(gamma, zero_edge, e, timestamp)) {
dl_var curr_target = e.get_target();
TRACE("dl_bfs", tout << "curr_target: " << curr_target << ", mark: " << bfs_mark[curr_target] << "\n";);
TRACE(dl_bfs, tout << "curr_target: " << curr_target << ", mark: " << bfs_mark[curr_target] << "\n";);
if (curr_target == target) {
TRACE("dl_bfs", tout << "found path\n";);
TRACE("dl_eq_bug", tout << "path: " << source << " --> " << target << "\n";
TRACE(dl_bfs, tout << "found path\n";);
TRACE(dl_eq_bug, tout << "path: " << source << " --> " << target << "\n";
display_edge(tout, e);
int tmp_parent_idx = parent_idx;
while (true) {
@ -1426,7 +1426,7 @@ public:
tmp_parent_idx = curr.m_parent_idx;
}
});
TRACE("dl_eq_bug", display_edge(tout, e););
TRACE(dl_eq_bug, display_edge(tout, e););
f(e.get_explanation());
while (true) {
SASSERT(parent_idx >= 0);
@ -1436,7 +1436,7 @@ public:
}
else {
edge & e = m_edges[curr.m_edge_id];
TRACE("dl_eq_bug", display_edge(tout, e););
TRACE(dl_eq_bug, display_edge(tout, e););
f(e.get_explanation());
parent_idx = curr.m_parent_idx;
}
@ -1556,7 +1556,7 @@ private:
state.m_heap.insert(source);
state.m_heap.insert(target);
unsigned num_relevant = 1;
TRACE("diff_logic", display(tout); );
TRACE(diff_logic, display(tout); );
while (!state.m_heap.empty() && num_relevant > 0) {
@ -1574,7 +1574,7 @@ private:
else {
m_mark[source] = DL_PROP_PROCESSED_IRRELEVANT;
}
TRACE("diff_logic", tout << "source: " << source << "\n";);
TRACE(diff_logic, tout << "source: " << source << "\n";);
for (edge_id e_id : edges[source]) {
edge const& e = m_edges[e_id];
@ -1587,7 +1587,7 @@ private:
if (!e.is_enabled()) {
continue;
}
TRACE("diff_logic", display_edge(tout, e););
TRACE(diff_logic, display_edge(tout, e););
target = is_fw?e.get_target():e.get_source();
delta = get_reduced_weight(state, source, e);
SASSERT(delta >= state.m_delta[source]);
@ -1624,12 +1624,12 @@ private:
break;
}
case DL_PROP_PROCESSED_RELEVANT:
TRACE("diff_logic", tout << delta << " ?> " << state.m_delta[target] << "\n";);
TRACE(diff_logic, tout << delta << " ?> " << state.m_delta[target] << "\n";);
SASSERT(delta >= state.m_delta[target]);
SASSERT(!(delta == state.m_delta[target] && source_mark == DL_PROP_IRRELEVANT));
break;
case DL_PROP_PROCESSED_IRRELEVANT:
TRACE("diff_logic", tout << delta << " ?> " << state.m_delta[target] << "\n";);
TRACE(diff_logic, tout << delta << " ?> " << state.m_delta[target] << "\n";);
SASSERT(delta >= state.m_delta[target]);
break;
default:
@ -1656,7 +1656,7 @@ private:
}
}
TRACE("diff_logic", {
TRACE(diff_logic, {
tout << (is_fw?"is_fw":"is_bw") << ": ";
for (unsigned i = 0; i < state.m_visited.size(); ++i) {
tout << state.m_visited[i] << " ";
@ -1678,7 +1678,7 @@ private:
dl_var b = e0.get_target();
numeral n0 = m_assignment[b] - m_assignment[a] - e0.get_weight();
vector<edge_id_vector> const& edges = m_out_edges;
TRACE("diff_logic", tout << "$" << a << " a:" << m_assignment[a] << " $" << b << " b: " << m_assignment[b]
TRACE(diff_logic, tout << "$" << a << " a:" << m_assignment[a] << " $" << b << " b: " << m_assignment[b]
<< " e0: " << e0.get_weight() << " n0: " << n0 << "\n";
display_edge(tout, e0);
);
@ -1696,7 +1696,7 @@ private:
numeral n2 = n1 + tgt.m_delta[d] + m_assignment[d];
if (tgt.contains(d) && n2 <= e1.get_weight()) {
TRACE("diff_logic",
TRACE(diff_logic,
tout << "$" << c << " delta_c: " << src.m_delta[c] << " c: " << m_assignment[c] << "\n";
tout << "$" << d << " delta_d: " << src.m_delta[d] << " d: " << m_assignment[d]
<< " n2: " << n2 << " e1: " << e1.get_weight() << "\n";
@ -1717,7 +1717,7 @@ public:
m_fw.m_visited.reset();
m_bw.m_visited.reset();
if (!subsumed.empty()) {
TRACE("diff_logic",
TRACE(diff_logic,
display(tout);
tout << "subsumed\n";
for (unsigned i = 0; i < subsumed.size(); ++i) {
@ -1844,7 +1844,7 @@ public:
m_heap.insert(src2);
m_visited.push_back(src2);
TRACE("diff_logic",
TRACE(diff_logic,
display_edge(tout << "bridge: ", e1);
display_edge(tout << "subsumed: ", e2);
display(tout); );
@ -1853,7 +1853,7 @@ public:
SASSERT(!m_heap.empty());
dl_var v = m_heap.erase_min();
m_mark[v] = DL_PROCESSED;
TRACE("diff_logic", tout << v << "\n";);
TRACE(diff_logic, tout << v << "\n";);
for (edge_id e_id : m_out_edges[v]) {
edge const& e = m_edges[e_id];
@ -1867,7 +1867,7 @@ public:
}
m_gamma[w] = gamma;
m_parent[w] = e_id;
TRACE("diff_logic", tout << w << " : " << gamma << " " << e2.get_weight() << "\n";);
TRACE(diff_logic, tout << w << " : " << gamma << " " << e2.get_weight() << "\n";);
if (w == dst2 && gamma <= e2.get_weight()) {
// found path.
reset_marks();

View file

@ -94,8 +94,8 @@ namespace smt {
lits.push_back(eq);
SASSERT(lits.size() >= 2);
app_ref lemma(m.mk_or(lits), m);
TRACE("dyn_ack", tout << lemma << "\n";);
TRACE("dyn_ack", tout << false_pr << "\n";);
TRACE(dyn_ack, tout << lemma << "\n";);
TRACE(dyn_ack, tout << false_pr << "\n";);
return m.mk_lemma(false_pr, lemma);
}
@ -211,7 +211,7 @@ namespace smt {
}
unsigned num_occs = 0;
if (m_app_pair2num_occs.find(n1, n2, num_occs)) {
TRACE("dyn_ack", tout << "used_cg_eh:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\nnum_occs: " << num_occs << "\n";);
TRACE(dyn_ack, tout << "used_cg_eh:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\nnum_occs: " << num_occs << "\n";);
num_occs++;
}
else {
@ -227,7 +227,7 @@ namespace smt {
SASSERT(m_app_pair2num_occs.find(n1, n2, num_occs2) && num_occs == num_occs2);
#endif
if (num_occs == m_params.m_dack_threshold) {
TRACE("dyn_ack", tout << "found candidate:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\nnum_occs: " << num_occs << "\n";);
TRACE(dyn_ack, tout << "found candidate:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\nnum_occs: " << num_occs << "\n";);
m_to_instantiate.push_back(p);
}
}
@ -238,7 +238,7 @@ namespace smt {
}
if (n1->get_id() > n2->get_id())
std::swap(n1,n2);
TRACE("dyn_ack",
TRACE(dyn_ack,
tout << mk_pp(n1, m) << " = " << mk_pp(n2, m) << " = " << mk_pp(r, m) << "\n";);
app_triple tr(n1, n2, r);
if (m_triple.m_instantiated.contains(tr)) {
@ -246,7 +246,7 @@ namespace smt {
}
unsigned num_occs = 0;
if (m_triple.m_app2num_occs.find(n1, n2, r, num_occs)) {
TRACE("dyn_ack", tout << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\n"
TRACE(dyn_ack, tout << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\n"
<< mk_pp(r, m) << "\n" << "\nnum_occs: " << num_occs << "\n";);
num_occs++;
}
@ -264,7 +264,7 @@ namespace smt {
SASSERT(m_triple.m_app2num_occs.find(n1, n2, r, num_occs2) && num_occs == num_occs2);
#endif
if (num_occs == m_params.m_dack_threshold) {
TRACE("dyn_ack", tout << "found candidate:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m)
TRACE(dyn_ack, tout << "found candidate:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m)
<< "\n" << mk_pp(r, m)
<< "\nnum_occs: " << num_occs << "\n";);
m_triple.m_to_instantiate.push_back(tr);
@ -293,7 +293,7 @@ namespace smt {
};
void dyn_ack_manager::gc() {
TRACE("dyn_ack", tout << "dyn_ack GC\n";);
TRACE(dyn_ack, tout << "dyn_ack GC\n";);
m_to_instantiate.reset();
m_qhead = 0;
svector<app_pair>::iterator it = m_app_pairs.begin();
@ -302,7 +302,7 @@ namespace smt {
for (; it != end; ++it) {
app_pair & p = *it;
if (m_instantiated.contains(p)) {
TRACE("dyn_ack", tout << "1) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";);
TRACE(dyn_ack, tout << "1) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";);
m.dec_ref(p.first);
m.dec_ref(p.second);
SASSERT(!m_app_pair2num_occs.contains(p.first, p.second));
@ -317,7 +317,7 @@ namespace smt {
// SASSERT(num_occs > 0);
num_occs = static_cast<unsigned>(num_occs * m_params.m_dack_gc_inv_decay);
if (num_occs <= 1) {
TRACE("dyn_ack", tout << "2) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";);
TRACE(dyn_ack, tout << "2) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";);
m_app_pair2num_occs.erase(p.first, p.second);
m.dec_ref(p.first);
m.dec_ref(p.second);
@ -396,7 +396,7 @@ namespace smt {
app_ref eq(m.mk_eq(n1, n2), m);
m_context.internalize(eq, true);
literal l = m_context.get_literal(eq);
TRACE("dyn_ack", tout << "eq:\n" << mk_pp(eq, m) << "\nliteral: ";
TRACE(dyn_ack, tout << "eq:\n" << mk_pp(eq, m) << "\nliteral: ";
m_context.display_literal(tout, l); tout << "\n";);
return l;
}
@ -407,8 +407,8 @@ namespace smt {
SASSERT(n1->get_num_args() == n2->get_num_args());
SASSERT(n1 != n2);
m_context.m_stats.m_num_dyn_ack++;
TRACE("dyn_ack_inst", tout << "dyn_ack: " << n1->get_id() << " " << n2->get_id() << "\n";);
TRACE("dyn_ack", tout << "expanding Ackermann's rule for:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\n";);
TRACE(dyn_ack_inst, tout << "dyn_ack: " << n1->get_id() << " " << n2->get_id() << "\n";);
TRACE(dyn_ack, tout << "expanding Ackermann's rule for:\n" << mk_pp(n1, m) << "\n" << mk_pp(n2, m) << "\n";);
unsigned num_args = n1->get_num_args();
literal_buffer lits;
for (unsigned i = 0; i < num_args; i++) {
@ -436,7 +436,7 @@ namespace smt {
dealloc(del_eh);
return;
}
TRACE("dyn_ack_clause", tout << "new clause:\n"; m_context.display_clause_detail(tout, cls); tout << "\n";);
TRACE(dyn_ack_clause, tout << "new clause:\n"; m_context.display_clause_detail(tout, cls); tout << "\n";);
m_clause2app_pair.insert(cls, p);
}
@ -462,8 +462,8 @@ namespace smt {
SASSERT(m_params.m_dack != dyn_ack_strategy::DACK_DISABLED);
SASSERT(n1 != n2 && n1 != r && n2 != r);
ctx.m_stats.m_num_dyn_ack++;
TRACE("dyn_ack_inst", tout << "dyn_ack: " << n1->get_id() << " " << n2->get_id() << " " << r->get_id() << "\n";);
TRACE("dyn_ack", tout << "expanding Ackermann's rule for:\n" << mk_pp(n1, m) << "\n"
TRACE(dyn_ack_inst, tout << "dyn_ack: " << n1->get_id() << " " << n2->get_id() << " " << r->get_id() << "\n";);
TRACE(dyn_ack, tout << "expanding Ackermann's rule for:\n" << mk_pp(n1, m) << "\n"
<< mk_pp(n2, m) << "\n"
<< mk_pp(r, m) << "\n";
);
@ -495,7 +495,7 @@ namespace smt {
dealloc(del_eh);
return;
}
TRACE("dyn_ack_clause", ctx.display_clause_detail(tout << "new clause:\n", cls); tout << "\n";);
TRACE(dyn_ack_clause, ctx.display_clause_detail(tout << "new clause:\n", cls); tout << "\n";);
m_triple.m_clause2apps.insert(cls, tr);
}
@ -521,7 +521,7 @@ namespace smt {
};
void dyn_ack_manager::gc_triples() {
TRACE("dyn_ack", tout << "dyn_ack GC\n";);
TRACE(dyn_ack, tout << "dyn_ack GC\n";);
m_triple.m_to_instantiate.reset();
m_triple.m_qhead = 0;
svector<app_triple>::iterator it = m_triple.m_apps.begin();
@ -530,7 +530,7 @@ namespace smt {
for (; it != end; ++it) {
app_triple & p = *it;
if (m_triple.m_instantiated.contains(p)) {
TRACE("dyn_ack", tout << "1) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";);
TRACE(dyn_ack, tout << "1) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";);
m.dec_ref(p.first);
m.dec_ref(p.second);
m.dec_ref(p.third);
@ -546,7 +546,7 @@ namespace smt {
// SASSERT(num_occs > 0);
num_occs = static_cast<unsigned>(num_occs * m_params.m_dack_gc_inv_decay);
if (num_occs <= 1) {
TRACE("dyn_ack", tout << "2) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";);
TRACE(dyn_ack, tout << "2) erasing:\n" << mk_pp(p.first, m) << "\n" << mk_pp(p.second, m) << "\n";);
m_triple.m_app2num_occs.erase(p.first, p.second, p.third);
m.dec_ref(p.first);
m.dec_ref(p.second);

View file

@ -167,7 +167,7 @@ void expr_context_simplifier::clean_trail(unsigned old_lim) {
}
void expr_context_simplifier::insert_context(expr* e, bool polarity) {
TRACE("expr_context_simplifier", tout << mk_pp(e, m_manager) << "\n";);
TRACE(expr_context_simplifier, tout << mk_pp(e, m_manager) << "\n";);
if (m_manager.is_not(e)) {
e = to_app(e)->get_arg(0);
polarity = !polarity;
@ -181,7 +181,7 @@ void expr_context_simplifier::insert_context(expr* e, bool polarity) {
bool expr_context_simplifier::insert_arg(bool is_and, expr* arg, expr_ref_vector& args) {
expr_ref tmp(m_manager);
reduce_rec(arg, tmp);
TRACE("expr_context_simplifier", tout << mk_pp(arg, m_manager) << " -> " << mk_pp(tmp.get(), m_manager) << "\n";);
TRACE(expr_context_simplifier, tout << mk_pp(arg, m_manager) << " -> " << mk_pp(tmp.get(), m_manager) << "\n";);
if (is_true(tmp.get()) && is_and) {
// skip.
}
@ -431,7 +431,7 @@ void expr_strong_context_simplifier::simplify_basic(expr* fml, expr_ref& result)
cache.insert(e, std::make_pair(pos, r));
}
TRACE("expr_context_simplifier",
TRACE(expr_context_simplifier,
tout << mk_pp(e, m_manager)
<< " checked: " << checked
<< " cached: "
@ -707,7 +707,7 @@ void expr_strong_context_simplifier::simplify_model_based(expr* fml, expr_ref& r
cache.insert(e, std::make_pair(pos, r));
}
TRACE("expr_context_simplifier",
TRACE(expr_context_simplifier,
tout << mk_pp(e, m_manager)
<< " checked: " << checked
<< " cached: "

View file

@ -89,10 +89,10 @@ namespace smt {
for (unsigned i = 0; i < num_args; i++)
d->m_args[i] = d->m_args[i]->get_root();
if (m_set.contains(d)) {
TRACE("fingerprint_bug", tout << "failed: " << *d;);
TRACE(fingerprint_bug, tout << "failed: " << *d;);
return nullptr;
}
TRACE("fingerprint_bug", tout << "inserting @" << m_scopes.size() << " " << *d;);
TRACE(fingerprint_bug, tout << "inserting @" << m_scopes.size() << " " << *d;);
fingerprint * f = new (m_region) fingerprint(m_region, data, data_hash, def, num_args, d->m_args);
m_fingerprints.push_back(f);
m_defs.push_back(def);
@ -136,7 +136,7 @@ namespace smt {
m_fingerprints.shrink(old_size);
m_defs.shrink(old_size);
m_scopes.shrink(new_lvl);
TRACE("fingerprint_bug", tout << "pop @" << m_scopes.size() << "\n";);
TRACE(fingerprint_bug, tout << "pop @" << m_scopes.size() << "\n";);
}
void fingerprint_set::display(std::ostream & out) const {
@ -162,7 +162,7 @@ namespace smt {
if (f->get_arg(i)->get_root() != args[i]->get_root())
break;
if (i == num_args) {
TRACE("missing_instance_detail", tout << "found instance data: " << data << "=" << *f;);
TRACE(missing_instance_detail, tout << "found instance data: " << data << "=" << *f;);
return true;
}
}

View file

@ -913,7 +913,7 @@ namespace {
for (unsigned reg : m_todo) {
expr * p = m_registers[reg];
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)) {
unsigned var_id = to_var(p)->get_idx();
if (m_vars[var_id] != -1)
@ -1273,7 +1273,7 @@ namespace {
return nullptr; // it is unlikely we will find a compatible node
}
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;
max_compatibility = curr_compatibility;
}
@ -1482,16 +1482,16 @@ namespace {
for (;;) {
m_compatible.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 * last = head;
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) {
case BIND1: case BIND2: case BIND3: case BIND4: case BIND5: case BIND6: case BINDN: {
bind* bnd = static_cast<bind*>(curr);
if (is_compatible(bnd)) {
TRACE("mam_compiler_detail", tout << "compatible\n";);
TRACE(mam_compiler_detail, tout << "compatible\n";);
unsigned ireg = bnd->m_ireg;
SASSERT(m_todo.contains(ireg));
m_todo.erase(ireg);
@ -1506,7 +1506,7 @@ namespace {
}
}
else {
TRACE("mam_compiler_detail", tout << "incompatible\n";);
TRACE(mam_compiler_detail, tout << "incompatible\n";);
m_incompatible.push_back(curr);
}
break;
@ -1514,7 +1514,7 @@ namespace {
case CHECK: {
check* chk = static_cast<check*>(curr);
if (is_compatible(chk)) {
TRACE("mam_compiler_detail", tout << "compatible\n";);
TRACE(mam_compiler_detail, tout << "compatible\n";);
unsigned reg = chk->m_reg;
SASSERT(m_todo.contains(reg));
m_todo.erase(reg);
@ -1522,7 +1522,7 @@ namespace {
m_compatible.push_back(curr);
}
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;
enode * n1 = chk->m_enode;
// n1->has_lbl_hash may be false, even
@ -1550,14 +1550,14 @@ namespace {
m_incompatible.push_back(curr);
}
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);
}
break;
}
case COMPARE:
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 reg2 = static_cast<compare*>(curr)->m_reg2;
SASSERT(m_todo.contains(reg2));
@ -1573,7 +1573,7 @@ namespace {
m_compatible.push_back(curr);
}
else {
TRACE("mam_compiler_detail", tout << "incompatible\n";);
TRACE(mam_compiler_detail, tout << "incompatible\n";);
m_incompatible.push_back(curr);
}
break;
@ -1594,8 +1594,8 @@ namespace {
SASSERT(m_use_filters);
if (is_compatible(flt)) {
unsigned reg = flt->m_reg;
TRACE("mam_compiler_detail", tout << "compatible " << reg << "\n";);
CTRACE("mam_compiler_bug", !m_todo.contains(reg), {
TRACE(mam_compiler_detail, tout << "compatible " << reg << "\n";);
CTRACE(mam_compiler_bug, !m_todo.contains(reg), {
for (unsigned t : m_todo) { tout << t << " "; }
tout << "\nregisters:\n";
unsigned i = 0;
@ -1612,8 +1612,8 @@ namespace {
}
else if (is_semi_compatible(flt)) {
unsigned reg = flt->m_reg;
TRACE("mam_compiler_detail", tout << "semi compatible " << reg << "\n";);
CTRACE("mam_compiler_bug", !m_todo.contains(reg), {
TRACE(mam_compiler_detail, tout << "semi compatible " << reg << "\n";);
CTRACE(mam_compiler_bug, !m_todo.contains(reg), {
for (unsigned t : m_todo) { tout << t << " "; }
tout << "\nregisters:\n";
unsigned i = 0;
@ -1623,7 +1623,7 @@ namespace {
});
SASSERT(m_todo.contains(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 << "new hash: " << h << "\n";);
set_check_mark(reg, CHECK_SET);
@ -1642,13 +1642,13 @@ namespace {
}
}
else {
TRACE("mam_compiler_detail", tout << "incompatible\n";);
TRACE(mam_compiler_detail, tout << "incompatible\n";);
m_incompatible.push_back(curr);
}
break;
}
default:
TRACE("mam_compiler_detail", tout << "incompatible\n";);
TRACE(mam_compiler_detail, tout << "incompatible\n";);
m_incompatible.push_back(curr);
break;
}
@ -1656,7 +1656,7 @@ namespace {
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_incompatible.size(): " << m_incompatible.size() << "\n";);
@ -1668,7 +1668,7 @@ namespace {
SASSERT(curr->m_opcode == CHOOSE);
choose * first_child = static_cast<choose *>(curr);
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) {
// There is no compatible child
// Suppose the sequence is:
@ -1753,7 +1753,7 @@ namespace {
init(r, qa, mp, first_idx);
linearise(r->m_root, first_idx);
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;
}
@ -1771,21 +1771,21 @@ namespace {
return;
}
m_is_tmp_tree = is_tmp_tree;
TRACE("mam_compiler", tout << "updating tree with:\n" << mk_pp(mp, m) << "\n";);
TRACE("mam_bug", tout << "before insertion\n" << *tree << "\n";);
TRACE(mam_compiler, tout << "updating tree with:\n" << mk_pp(mp, m) << "\n";);
TRACE(mam_bug, tout << "before insertion\n" << *tree << "\n";);
if (!is_tmp_tree)
m_ct_manager.save_num_regs(tree);
init(tree, qa, mp, first_idx);
m_num_choices = tree->m_num_choices;
insert(tree->m_root, first_idx);
TRACE("mam_bug",
TRACE(mam_bug,
tout << "m_num_choices: " << m_num_choices << "\n";);
if (m_num_choices > tree->m_num_choices) {
if (!is_tmp_tree)
m_ct_manager.save_num_choices(tree);
tree->m_num_choices = m_num_choices;
}
TRACE("mam_bug",
TRACE(mam_bug,
tout << "m_num_choices: " << m_num_choices << "\n";
tout << "new tree:\n" << *tree;
tout << "todo ";
@ -1877,7 +1877,7 @@ namespace {
void update_max_generation(enode * n, enode * prev) {
m_max_generation = std::max(m_max_generation, n->get_generation());
if (m.has_trace_stream() || is_trace_enabled("causality"))
if (m.has_trace_stream() || is_trace_enabled(TraceTag::causality))
m_used_enodes.push_back(std::make_tuple(prev, n));
}
@ -1996,7 +1996,7 @@ namespace {
}
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_bindings.reserve(t->get_num_regs(), nullptr);
if (m_backtrack_stack.size() < t->get_num_choices())
@ -2004,12 +2004,12 @@ namespace {
}
bool execute(code_tree * t) {
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);
#define CLEANUP for (enode* app : t->get_candidates()) if (app->is_marked()) app->unset_mark();
if (t->filter_candidates()) {
for (enode* app : t->get_candidates()) {
TRACE("trigger_bug", tout << "candidate\n" << mk_ismt2_pp(app->get_expr(), m) << "\n";);
TRACE(trigger_bug, tout << "candidate\n" << mk_ismt2_pp(app->get_expr(), m) << "\n";);
if (!app->is_marked() && app->is_cgr()) {
if (m_context.resource_limits_exceeded() || !execute_core(t, app)) {
CLEANUP;
@ -2023,9 +2023,9 @@ namespace {
}
else {
for (enode* app : t->get_candidates()) {
TRACE("trigger_bug", tout << "candidate\n" << mk_ismt2_pp(app->get_expr(), m) << "\n";);
TRACE(trigger_bug, tout << "candidate\n" << mk_ismt2_pp(app->get_expr(), m) << "\n";);
if (app->is_cgr()) {
TRACE("trigger_bug", tout << "is_cgr\n";);
TRACE(trigger_bug, tout << "is_cgr\n";);
// scoped_suspend_rlimit susp(m.limit(), false);
if (m_context.resource_limits_exceeded() || !execute_core(t, app))
return false;
@ -2188,7 +2188,7 @@ namespace {
bp.m_old_max_generation = m_max_generation;
bp.m_old_used_enodes_size = m_used_enodes.size();
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";);
bp.m_to_recycle = nullptr;
bp.m_it = m_context.begin_enodes_of(lbl);
@ -2273,7 +2273,7 @@ namespace {
#endif
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;
#ifdef _PROFILE_MAM
@ -2287,7 +2287,7 @@ namespace {
t->inc_counter();
#endif
// 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";);
SASSERT(m_context.is_relevant(n));
m_pattern_instances.reset();
m_min_top_generation.reset();
@ -2295,7 +2295,7 @@ namespace {
m_pattern_instances.push_back(n);
m_max_generation = n->get_generation();
if (m.has_trace_stream() || is_trace_enabled("causality")) {
if (m.has_trace_stream() || is_trace_enabled(TraceTag::causality)) {
m_used_enodes.reset();
m_used_enodes.push_back(std::make_tuple(nullptr, n)); // null indicates that n was matched against the trigger at the top-level
}
@ -2309,7 +2309,7 @@ namespace {
if (!m_pc)
goto backtrack;
TRACE("mam_int", display_pc_info(tout););
TRACE(mam_int, display_pc_info(tout););
#ifdef _PROFILE_MAM
const_cast<instruction*>(m_pc)->m_counter++;
@ -2397,7 +2397,7 @@ namespace {
goto backtrack;
// We will use the common root when instantiating the quantifier => log the necessary equalities
if (m.has_trace_stream() || is_trace_enabled("causality")) {
if (m.has_trace_stream() || is_trace_enabled(TraceTag::causality)) {
m_used_enodes.push_back(std::make_tuple(m_n1, m_n1->get_root()));
m_used_enodes.push_back(std::make_tuple(m_n2, m_n2->get_root()));
}
@ -2417,7 +2417,7 @@ namespace {
goto backtrack;
// we used the equality m_n1 = m_n2 for the match and need to make sure it ends up in the log
if (m.has_trace_stream() || is_trace_enabled("causality")) {
if (m.has_trace_stream() || is_trace_enabled(TraceTag::causality)) {
m_used_enodes.push_back(std::make_tuple(m_n1, m_n2));
}
@ -2465,7 +2465,7 @@ namespace {
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) \
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_old_max_generation = m_curr_max_generation; \
m_backtrack_stack[m_top].m_old_used_enodes_size = m_curr_used_enodes_size; \
@ -2603,7 +2603,7 @@ namespace {
if (m_n1 == 0 || !m_context.is_relevant(m_n1)) \
goto backtrack; \
update_max_generation(m_n1, nullptr); \
if (m.has_trace_stream() || is_trace_enabled("causality")) { \
if (m.has_trace_stream() || is_trace_enabled(TraceTag::causality)) { \
for (unsigned i = 0; i < static_cast<const get_cgr *>(m_pc)->m_num_args; ++i) { \
m_used_enodes.push_back(std::make_tuple(m_n1->get_arg(i), m_n1->get_arg(i)->get_root())); \
} \
@ -2615,7 +2615,7 @@ namespace {
#define SET_VAR(IDX) \
m_args[IDX] = m_registers[static_cast<const get_cgr *>(m_pc)->m_iregs[IDX]]; \
if (m_use_filters && static_cast<const get_cgr *>(m_pc)->m_lbl_set.empty_intersection(m_args[IDX]->get_root()->get_plbls())) { \
TRACE("trigger_bug", tout << "m_args[IDX]->get_root():\n" << mk_ismt2_pp(m_args[IDX]->get_root()->get_expr(), m) << "\n"; \
TRACE(trigger_bug, tout << "m_args[IDX]->get_root():\n" << mk_ismt2_pp(m_args[IDX]->get_root()->get_expr(), m) << "\n"; \
tout << "cgr set: "; static_cast<const get_cgr *>(m_pc)->m_lbl_set.display(tout); tout << "\n"; \
tout << "node set: "; m_args[IDX]->get_root()->get_plbls().display(tout); tout << "\n";); \
goto backtrack; \
@ -2679,7 +2679,7 @@ namespace {
if (m_app == nullptr)
goto backtrack;
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++)
m_registers[m_oreg+i] = m_app->get_arg(i);
m_pc = m_pc->m_next;
@ -2688,9 +2688,9 @@ namespace {
}
backtrack:
TRACE("mam_int", tout << "backtracking.\n";);
TRACE(mam_int, tout << "backtracking.\n";);
if (m_top == 0) {
TRACE("mam_int", tout << "no more alternatives.\n";);
TRACE(mam_int, tout << "no more alternatives.\n";);
#ifdef _PROFILE_MAM
t->get_watch().stop();
#endif
@ -2699,10 +2699,10 @@ namespace {
backtrack_point & bp = m_backtrack_stack[m_top - 1];
m_max_generation = bp.m_old_max_generation;
if (m.has_trace_stream() || is_trace_enabled("causality"))
if (m.has_trace_stream() || is_trace_enabled(TraceTag::causality))
m_used_enodes.shrink(bp.m_old_used_enodes_size);
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
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++;
@ -2729,7 +2729,7 @@ namespace {
switch (bp.m_instr->m_opcode) {
case CHOOSE:
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);
m_top--;
goto main_loop;
@ -2742,7 +2742,7 @@ namespace {
goto backtrack; \
} \
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
BBIND_COMMON();
@ -2822,7 +2822,7 @@ namespace {
m_pattern_instances.push_back(m_app);
// continue succeeded
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_oreg = c->m_oreg;
for (unsigned i = 0; i < m_num_args; i++)
@ -2929,7 +2929,7 @@ namespace {
}
DEBUG_CODE(m_trees[lbl_id]->get_patterns().push_back(mp);
m_trail_stack.push(push_back_trail<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() {
@ -3155,7 +3155,7 @@ namespace {
void add_candidate(code_tree * t, enode * app) {
if (t != nullptr) {
TRACE("mam_candidate", tout << "adding candidate:\n" << mk_ll_pp(app->get_expr(), m););
TRACE(mam_candidate, tout << "adding candidate:\n" << mk_ll_pp(app->get_expr(), m););
if (!t->has_candidates())
m_to_match.push_back(t);
t->add_candidate(app);
@ -3187,8 +3187,8 @@ namespace {
void update_clbls(func_decl * lbl) {
unsigned lbl_id = lbl->get_small_id();
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("mam_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";);
if (m_is_clbl[lbl_id])
return;
m_trail_stack.push(set_bitvector_trail(m_is_clbl, lbl_id));
@ -3197,7 +3197,7 @@ namespace {
for (enode* app : m_context.enodes_of(lbl)) {
if (m_context.is_relevant(app)) {
update_lbls(app, h);
TRACE("mam_bug", tout << "updating labels of: #" << app->get_owner_id() << "\n";
TRACE(mam_bug, tout << "updating labels of: #" << app->get_owner_id() << "\n";
tout << "new_elem: " << h << "\n";
tout << "lbls: " << app->get_lbls() << "\n";
tout << "r.lbls: " << app->get_root()->get_lbls() << "\n";);
@ -3213,10 +3213,10 @@ namespace {
if (!r_plbls.may_contain(elem)) {
m_trail_stack.push(value_trail<approx_set>(r_plbls));
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 << "plbls: " << c->get_root()->get_plbls() << "\n";);
TRACE("mam_bug", tout << "updating plabels of: #" << c->get_root()->get_owner_id() << "\n";
TRACE(mam_bug, tout << "updating plabels of: #" << c->get_root()->get_owner_id() << "\n";
tout << "new_elem: " << static_cast<unsigned>(elem) << "\n";
tout << "plbls: " << c->get_root()->get_plbls() << "\n";);
@ -3227,9 +3227,9 @@ namespace {
void update_plbls(func_decl * lbl) {
unsigned lbl_id = lbl->get_small_id();
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";);
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])
return;
m_trail_stack.push(set_bitvector_trail(m_is_plbl, lbl_id));
@ -3343,7 +3343,7 @@ namespace {
m_trail_stack.push(set_ptr_trail<path_tree>(m_pc[h1][h2]));
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";
m_pc[h1][h2]->display(tout, 2););
}
@ -3381,7 +3381,7 @@ namespace {
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";
SASSERT(h1 <= h2);
m_pp[h1][h2].first->display(tout, 2);
@ -3445,7 +3445,7 @@ namespace {
update_plbls(plbl);
if (!n->has_lbl_hash())
n->set_lbl_hash(m_context);
TRACE("mam_bug",
TRACE(mam_bug,
tout << "updating pc labels " << plbl->get_name() << " " <<
static_cast<unsigned>(n->get_lbl_hash()) << "\n";
tout << "#" << n->get_owner_id() << " " << n->get_root()->get_lbls() << "\n";
@ -3455,7 +3455,7 @@ namespace {
}
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_clbls(clbl);
update_pc(m_lbl_hasher(plbl), m_lbl_hasher(clbl), new_path, qa, mp);
@ -3467,7 +3467,7 @@ namespace {
\brief Update inverted path index.
*/
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();
if (num_vars >= m_var_paths.size())
m_var_paths.resize(num_vars+1);
@ -3539,7 +3539,7 @@ namespace {
#ifdef _PROFILE_PATH_TREE
t->m_counter++;
#endif
TRACE("mam_path_tree",
TRACE(mam_path_tree,
tout << "processing:\n";
t->display(tout, 2););
enode_vector * v = t->m_todo;
@ -3584,7 +3584,7 @@ namespace {
std::cout << "Avg2. " << static_cast<double>(total_sz2)/static_cast<double>(counter2) << ", Max2. " << max_sz2 << "\n";
#endif
TRACE("mam_path_tree", tout << "processing: #" << curr_child->get_owner_id() << "\n";);
TRACE(mam_path_tree, tout << "processing: #" << curr_child->get_owner_id() << "\n";);
enode_vector::const_iterator it2 = curr_child->begin_parents();
enode_vector::const_iterator end2 = curr_child->end_parents();
for (; it2 != end2; ++it2) {
@ -3602,8 +3602,8 @@ namespace {
bool is_flat_assoc = lbl->is_flat_associative();
enode * curr_parent_root = curr_parent->get_root();
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 << "parent is marked: " << curr_parent->is_marked() << "\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_marked() << "\n";);
if (filter.may_contain(m_lbl_hasher(lbl)) &&
!curr_parent->is_marked() &&
(curr_parent_cg == curr_parent || !is_eq(curr_parent_cg, curr_parent_root)) &&
@ -3631,7 +3631,7 @@ namespace {
is_eq(curr_tree->m_ground_arg, curr_parent->get_arg(curr_tree->m_ground_arg_idx))
)) {
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);
}
if (curr_tree->m_first_child) {
@ -3680,8 +3680,8 @@ namespace {
void process_pp(enode * r1, enode * r2) {
approx_set & plbls1 = r1->get_plbls();
approx_set & plbls2 = r2->get_plbls();
TRACE("incremental_matcher", tout << "pp: plbls1: " << plbls1 << ", plbls2: " << plbls2 << "\n";);
TRACE("mam_info", tout << "pp: " << plbls1.size() * plbls2.size() << "\n";);
TRACE(incremental_matcher, tout << "pp: plbls1: " << plbls1 << ", plbls2: " << plbls2 << "\n";);
TRACE(mam_info, tout << "pp: " << plbls1.size() * plbls2.size() << "\n";);
if (!plbls1.empty() && !plbls2.empty()) {
for (unsigned plbl1 : plbls1) {
if (m_context.get_cancel_flag()) {
@ -3735,7 +3735,7 @@ namespace {
}
void match_new_patterns() {
TRACE("mam_new_pat", tout << "matching new patterns:\n";);
TRACE(mam_new_pat, tout << "matching new patterns:\n";);
m_tmp_trees_to_delete.reset();
for (auto const& kv : m_new_patterns) {
if (m_context.get_cancel_flag()) {
@ -3780,7 +3780,7 @@ namespace {
unsigned num_patterns = mp->get_num_args();
for (unsigned i = 0; i < num_patterns; i++) {
app * pat = to_app(mp->get_arg(i));
TRACE("mam_pat", tout << mk_ismt2_pp(qa, m) << "\npat:\n" << mk_ismt2_pp(pat, m) << "\n";);
TRACE(mam_pat, tout << mk_ismt2_pp(qa, m) << "\npat:\n" << mk_ismt2_pp(pat, m) << "\n";);
SASSERT(!pat->is_ground());
todo.push_back(pat);
}
@ -3827,8 +3827,8 @@ namespace {
void add_pattern(quantifier * qa, app * mp) override {
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("mam_bug", tout << "adding pattern\n" << mk_pp(qa, m) << "\n" << mk_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";);
// Z3 checks if a pattern is ground or not before solving.
// Ground patterns are discarded.
// However, the simplifier may turn a non-ground pattern into a ground one.
@ -3886,7 +3886,7 @@ namespace {
}
void match() override {
TRACE("trigger_bug", tout << "match\n"; display(tout););
TRACE(trigger_bug, tout << "match\n"; display(tout););
for (code_tree* t : m_to_match) {
SASSERT(t->has_candidates());
if (!m_interpreter.execute(t))
@ -3919,7 +3919,7 @@ namespace {
#ifdef Z3DEBUG
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);
rematch(false);
return true;
@ -3927,11 +3927,11 @@ namespace {
#endif
void on_match(quantifier * qa, app * pat, unsigned num_bindings, enode * const * bindings, unsigned max_generation, vector<std::tuple<enode *, enode *>> & used_enodes) override {
TRACE("trigger_bug", tout << "found match " << mk_pp(qa, m) << "\n";);
TRACE(trigger_bug, tout << "found match " << mk_pp(qa, m) << "\n";);
#ifdef Z3DEBUG
if (m_check_missing_instances) {
if (!m_context.slow_contains_instance(qa, num_bindings, bindings)) {
TRACE("missing_instance",
TRACE(missing_instance,
tout << "qa:\n" << mk_ll_pp(qa, m) << "\npat:\n" << mk_ll_pp(pat, m);
for (unsigned i = 0; i < num_bindings; i++)
tout << "#" << bindings[i]->get_expr_id() << "\n" << mk_ll_pp(bindings[i]->get_expr(), m) << "\n";
@ -3958,23 +3958,23 @@ namespace {
// This method is invoked when n becomes relevant.
// If lazy == true, then n is not added to the list of candidate enodes for matching. That is, the method just updates the lbls.
void relevant_eh(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";);
TRACE("mam", tout << "relevant_eh: #" << enode_pp(n, m_context) << "\n";);
TRACE(mam, tout << "relevant_eh: #" << enode_pp(n, m_context) << "\n";);
if (n->has_lbl_hash())
update_lbls(n, n->get_lbl_hash());
if (n->get_num_args() > 0) {
func_decl * lbl = n->get_decl();
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";
tout << "lbl_id: " << lbl->get_small_id() << "\n";);
if (is_clbl(lbl))
update_lbls(n, h);
if (is_plbl(lbl))
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)
add_candidate(n);
}
@ -3988,9 +3988,9 @@ namespace {
flet<enode *> l1(m_r1, r1);
flet<enode *> l2(m_r2, r2);
TRACE("mam", tout << "add_eq_eh: #" << r1->get_owner_id() << " #" << r2->get_owner_id() << "\n";);
TRACE("mam_inc_bug_detail", m_context.display(tout););
TRACE("mam_inc_bug",
TRACE(mam, tout << "add_eq_eh: #" << r1->get_owner_id() << " #" << r2->get_owner_id() << "\n";);
TRACE(mam_inc_bug_detail, m_context.display(tout););
TRACE(mam_inc_bug,
tout << "before:\n#" << r1->get_owner_id() << " #" << r2->get_owner_id() << "\n";
tout << "r1.lbls: " << r1->get_lbls() << "\n";
tout << "r2.lbls: " << r2->get_lbls() << "\n";
@ -4010,7 +4010,7 @@ namespace {
m_trail_stack.push(value_trail<approx_set>(r2_plbls));
r2_lbls |= r1_lbls;
r2_plbls |= r1_plbls;
TRACE("mam_inc_bug",
TRACE(mam_inc_bug,
tout << "after:\n";
tout << "r1.lbls: " << r1->get_lbls() << "\n";
tout << "r2.lbls: " << r2->get_lbls() << "\n";

View file

@ -319,13 +319,13 @@ interval & interval::operator*=(interval const & other) {
v_dependency * c_d = other.m_lower_dep;
v_dependency * d_d = other.m_upper_dep;
TRACE("interval_bug", tout << "operator*= " << *this << " " << other << "\n";);
TRACE(interval_bug, tout << "operator*= " << *this << " " << other << "\n";);
if (is_N()) {
if (other.is_N()) {
// x <= b <= 0, y <= d <= 0 --> b*d <= x*y
// a <= x <= b <= 0, c <= y <= d <= 0 --> x*y <= a*c (we can use the fact that x or y is always negative (i.e., b is neg or d is neg))
TRACE("interval_bug", tout << "(N, N)\n";);
TRACE(interval_bug, tout << "(N, N)\n";);
ext_numeral new_lower = b * d;
ext_numeral new_upper = a * c;
// if b = 0 (and the interval is closed), then the lower bound is closed
@ -339,7 +339,7 @@ interval & interval::operator*=(interval const & other) {
else if (other.is_M()) {
// a <= x <= b <= 0, y <= d, d > 0 --> a*d <= x*y (uses the fact that b is not positive)
// a <= x <= b <= 0, c <= y, c < 0 --> x*y <= a*c (uses the fact that b is not positive)
TRACE("interval_bug", tout << "(N, M)\n";);
TRACE(interval_bug, tout << "(N, M)\n";);
ext_numeral new_lower = a * d; SASSERT(new_lower.is_neg());
ext_numeral new_upper = a * c; SASSERT(new_upper.is_pos());
m_lower_open = a_o || d_o;
@ -352,7 +352,7 @@ interval & interval::operator*=(interval const & other) {
else {
// a <= x <= b <= 0, 0 <= c <= y <= d --> a*d <= x*y (uses the fact that x is neg (b is not positive) or y is pos (c is not negative))
// x <= b <= 0, 0 <= c <= y --> x*y <= b*c
TRACE("interval_bug", tout << "(N, P)\n";);
TRACE(interval_bug, tout << "(N, P)\n";);
SASSERT(other.is_P());
ext_numeral new_lower = a * d;
ext_numeral new_upper = b * c;
@ -369,7 +369,7 @@ interval & interval::operator*=(interval const & other) {
if (other.is_N()) {
// b > 0, x <= b, c <= y <= d <= 0 --> b*c <= x*y (uses the fact that d is not positive)
// a < 0, a <= x, c <= y <= d <= 0 --> x*y <= a*c (uses the fact that d is not positive)
TRACE("interval_bug", tout << "(M, N)\n";);
TRACE(interval_bug, tout << "(M, N)\n";);
ext_numeral new_lower = b * c; SASSERT(new_lower.is_neg());
ext_numeral new_upper = a * c; SASSERT(new_upper.is_pos());
m_lower_open = b_o || c_o; SASSERT(b.is_pos() && c.is_neg());
@ -380,7 +380,7 @@ interval & interval::operator*=(interval const & other) {
m_upper_dep = m_upper.is_infinite() ? nullptr : join(a_d, c_d, d_d);
}
else if (other.is_M()) {
TRACE("interval_bug", tout << "(M, M)\n";);
TRACE(interval_bug, tout << "(M, M)\n";);
SASSERT(!a.is_zero() && !b.is_zero() && !c.is_zero() && !d.is_zero());
ext_numeral ad = a*d; SASSERT(!ad.is_zero());
ext_numeral bc = b*c; SASSERT(!bc.is_zero());
@ -412,7 +412,7 @@ interval & interval::operator*=(interval const & other) {
else {
// a < 0, a <= x, 0 <= c <= y <= d --> a*d <= x*y (uses the fact that c is not negative)
// b > 0, x <= b, 0 <= c <= y <= d --> x*y <= b*d (uses the fact that c is not negative)
TRACE("interval_bug", tout << "(M, P)\n";);
TRACE(interval_bug, tout << "(M, P)\n";);
SASSERT(other.is_P());
ext_numeral new_lower = a * d; SASSERT(new_lower.is_neg());
ext_numeral new_upper = b * d; SASSERT(new_upper.is_pos());
@ -429,7 +429,7 @@ interval & interval::operator*=(interval const & other) {
if (other.is_N()) {
// 0 <= a <= x <= b, c <= y <= d <= 0 --> x*y <= b*c (uses the fact that x is pos (a is not neg) or y is neg (d is not pos))
// 0 <= a <= x, y <= d <= 0 --> a*d <= x*y
TRACE("interval_bug", tout << "(P, N)\n";);
TRACE(interval_bug, tout << "(P, N)\n";);
ext_numeral new_lower = b * c;
ext_numeral new_upper = a * d;
bool is_P0_old = is_P0(); // cache the value of is_P0(), since it may be affected by the next update.
@ -443,7 +443,7 @@ interval & interval::operator*=(interval const & other) {
else if (other.is_M()) {
// 0 <= a <= x <= b, c <= y --> b*c <= x*y (uses the fact that a is not negative)
// 0 <= a <= x <= b, y <= d --> x*y <= b*d (uses the fact that a is not negative)
TRACE("interval_bug", tout << "(P, M)\n";);
TRACE(interval_bug, tout << "(P, M)\n";);
ext_numeral new_lower = b * c; SASSERT(new_lower.is_neg());
ext_numeral new_upper = b * d; SASSERT(new_upper.is_pos());
m_lower_open = b_o || c_o;
@ -456,7 +456,7 @@ interval & interval::operator*=(interval const & other) {
else {
// 0 <= a <= x, 0 <= c <= y --> a*c <= x*y
// x <= b, y <= d --> x*y <= b*d (uses the fact that x is pos (a is not negative) or y is pos (c is not negative))
TRACE("interval_bug", tout << "(P, P)\n";);
TRACE(interval_bug, tout << "(P, P)\n";);
SASSERT(other.is_P());
ext_numeral new_lower = a * c;
ext_numeral new_upper = b * d;
@ -468,8 +468,8 @@ interval & interval::operator*=(interval const & other) {
m_upper_dep = m_upper.is_infinite() ? nullptr : join_opt(b_d, d_d, a_d, c_d);
}
}
TRACE("interval_bug", tout << "operator*= result: " << *this << "\n";);
CTRACE("interval", !(!(contains_zero1 || contains_zero2) || contains_zero()),
TRACE(interval_bug, tout << "operator*= result: " << *this << "\n";);
CTRACE(interval, !(!(contains_zero1 || contains_zero2) || contains_zero()),
tout << "contains_zero1: " << contains_zero1 << ", contains_zero2: " << contains_zero2 << ", contains_zero(): " << contains_zero() << "\n";);
SASSERT(!(contains_zero1 || contains_zero2) || contains_zero());
return *this;
@ -484,7 +484,7 @@ bool interval::empty() const {
}
bool interval::contains_zero() const {
TRACE("interval_zero_bug", tout << "contains_zero info: " << *this << "\n";
TRACE(interval_zero_bug, tout << "contains_zero info: " << *this << "\n";
tout << "m_lower.is_neg(): " << m_lower.is_neg() << "\n";
tout << "m_lower.is_zero: " << m_lower.is_zero() << "\n";
tout << "m_lower_open: " << m_lower_open << "\n";
@ -568,7 +568,7 @@ interval & interval::operator/=(interval const & other) {
SASSERT(!other.contains_zero());
if (is_zero()) {
// 0/other = 0 if other != 0
TRACE("interval", other.display_with_dependencies(tout););
TRACE(interval, other.display_with_dependencies(tout););
if (other.m_lower.is_pos() || (other.m_lower.is_zero() && other.m_lower_open)) {
// other.lower > 0
// x in ([0, 0] / [other.lo, other.up]), for other.lo > 0
@ -625,10 +625,10 @@ void interval::expt(unsigned n) {
else {
// [l, u]^n = [0, max{l^n, u^n}] otherwise
// we need both bounds to justify upper bound
TRACE("interval", tout << "before: " << m_lower << " " << m_upper << " " << n << "\n";);
TRACE(interval, tout << "before: " << m_lower << " " << m_upper << " " << n << "\n";);
m_lower.expt(n);
m_upper.expt(n);
TRACE("interval", tout << "after: " << m_lower << " " << m_upper << "\n";);
TRACE(interval, tout << "after: " << m_lower << " " << m_upper << "\n";);
if (m_lower > m_upper || (m_lower == m_upper && !m_lower_open && m_upper_open)) {
m_upper = m_lower;
m_upper_open = m_lower_open;

View file

@ -370,7 +370,7 @@ void smt_params::setup_QF_AUFLIA(static_features const& st) {
throw default_exception("Benchmark has real variables but it is marked as QF_AUFLIA (arrays, uninterpreted functions and linear integer arithmetic).");
m_nnf_cnf = false;
if (st.m_num_clauses == st.m_num_units) {
TRACE("QF_AUFLIA", tout << "using relevancy: 0\n";);
TRACE(QF_AUFLIA, tout << "using relevancy: 0\n";);
m_relevancy_lvl = 0;
m_phase_selection = PS_ALWAYS_FALSE;
}

View file

@ -89,14 +89,14 @@ expr * proto_model::mk_some_interp_for(func_decl * d) {
bool proto_model::eval(expr * e, expr_ref & result, bool model_completion) {
m_eval.set_model_completion(model_completion);
m_eval.set_expand_array_equalities(false);
TRACE("model_evaluator", model_v2_pp(tout, *this, true););
TRACE(model_evaluator, model_v2_pp(tout, *this, true););
try {
m_eval(e, result);
return true;
}
catch (model_evaluator_exception & ex) {
(void)ex;
TRACE("model_evaluator", tout << ex.what() << "\n";);
TRACE(model_evaluator, tout << ex.what() << "\n";);
return false;
}
}
@ -128,7 +128,7 @@ void proto_model::cleanup_func_interp(expr_ref_vector& trail, func_interp * fi,
}
expr* proto_model::cleanup_expr(expr_ref_vector& trail, expr* fi_else, func_decl_set& found_aux_fs) {
TRACE("model_bug", tout << "cleaning up:\n" << mk_pp(fi_else, m) << "\n";);
TRACE(model_bug, tout << "cleaning up:\n" << mk_pp(fi_else, m) << "\n";);
trail.reset();
obj_map<expr, expr*> cache;
ptr_buffer<expr, 128> todo;
@ -170,7 +170,7 @@ expr* proto_model::cleanup_expr(expr_ref_vector& trail, expr* fi_else, func_decl
}
func_decl * f = t->get_decl();
if (m_aux_decls.contains(f)) {
TRACE("model_bug", tout << f->get_name() << "\n";);
TRACE(model_bug, tout << f->get_name() << "\n";);
found_aux_fs.insert(f);
}
new_t = m_rewrite.mk_app(f, args.size(), args.data());
@ -210,7 +210,7 @@ void proto_model::remove_aux_decls_not_in_set(ptr_vector<func_decl> & decls, fun
by their interpretations.
*/
void proto_model::cleanup() {
TRACE("model_bug", model_v2_pp(tout, *this););
TRACE(model_bug, model_v2_pp(tout, *this););
func_decl_set found_aux_fs;
expr_ref_vector trail(m);
ptr_buffer<func_interp> finterps;
@ -227,7 +227,7 @@ void proto_model::cleanup() {
register_decl(d, r);
}
}
// TRACE("model_bug", model_v2_pp(tout, *this););
// TRACE(model_bug, model_v2_pp(tout, *this););
// remove auxiliary declarations that are not used.
if (found_aux_fs.size() != m_aux_decls.size()) {
remove_aux_decls_not_in_set(m_decls, found_aux_fs);
@ -235,13 +235,13 @@ void proto_model::cleanup() {
for (func_decl* faux : m_aux_decls) {
if (!found_aux_fs.contains(faux)) {
TRACE("cleanup_bug", tout << "eliminating " << faux->get_name() << " " << faux->get_ref_count() << "\n";);
TRACE(cleanup_bug, tout << "eliminating " << faux->get_name() << " " << faux->get_ref_count() << "\n";);
unregister_decl(faux);
}
}
m_aux_decls.swap(found_aux_fs);
}
TRACE("model_bug", model_v2_pp(tout, *this););
TRACE(model_bug, model_v2_pp(tout, *this););
}
value_factory * proto_model::get_factory(family_id fid) {
@ -371,7 +371,7 @@ void proto_model::complete_partial_funcs(bool use_fresh) {
}
model * proto_model::mk_model() {
TRACE("proto_model", model_v2_pp(tout << "mk_model\n", *this););
TRACE(proto_model, model_v2_pp(tout << "mk_model\n", *this););
model * mdl = alloc(model, m);
for (auto const& kv : m_interp) {
@ -388,7 +388,7 @@ model * proto_model::mk_model() {
unsigned sz = get_num_uninterpreted_sorts();
for (unsigned i = 0; i < sz; i++) {
sort * s = get_uninterpreted_sort(i);
TRACE("proto_model", tout << "copying uninterpreted sorts...\n" << mk_pp(s, m) << "\n";);
TRACE(proto_model, tout << "copying uninterpreted sorts...\n" << mk_pp(s, m) << "\n";);
ptr_vector<expr> const& buf = get_universe(s);
mdl->register_usort(s, buf.size(), buf.data());
}

View file

@ -44,7 +44,7 @@ namespace smt {
}
void qi_queue::setup() {
TRACE("qi_cost", tout << "qi_cost: " << m_params.m_qi_cost << "\n";);
TRACE(qi_cost, tout << "qi_cost: " << m_params.m_qi_cost << "\n";);
if (!m_parser.parse_string(m_params.m_qi_cost.c_str(), m_cost_function)) {
// it is not reasonable to abort here during the creation of smt::context just because an invalid option was provided.
// throw default_exception("invalid cost function %s", m_params.m_qi_cost.c_str());
@ -113,7 +113,7 @@ namespace smt {
m_vals[SCOPE] = static_cast<float>(m_context.get_scope_level());
m_vals[NESTED_QUANTIFIERS] = static_cast<float>(stat->get_num_nested_quantifiers());
m_vals[CS_FACTOR] = static_cast<float>(stat->get_case_split_factor());
TRACE("qi_queue_detail", for (unsigned i = 0; i < m_vals.size(); i++) { tout << m_vals[i] << " "; } tout << "\n";);
TRACE(qi_queue_detail, for (unsigned i = 0; i < m_vals.size(); i++) { tout << m_vals[i] << " "; } tout << "\n";);
return stat;
}
@ -136,14 +136,14 @@ namespace smt {
void qi_queue::insert(fingerprint * f, app * pat, unsigned generation, unsigned min_top_generation, unsigned max_top_generation) {
quantifier * q = static_cast<quantifier*>(f->get_data());
float cost = get_cost(q, pat, generation, min_top_generation, max_top_generation);
TRACE("qi_queue_detail",
TRACE(qi_queue_detail,
tout << "new instance of " << q->get_qid() << ", weight " << q->get_weight()
<< ", generation: " << generation << ", scope_level: " << m_context.get_scope_level() << ", cost: " << cost << "\n";
for (unsigned i = 0; i < f->get_num_args(); i++) {
tout << "#" << f->get_arg(i)->get_expr_id() << " d:" << f->get_arg(i)->get_expr()->get_depth() << " ";
}
tout << "\n";);
TRACE("new_entries_bug", tout << "[qi:insert]\n";);
TRACE(new_entries_bug, tout << "[qi:insert]\n";);
m_new_entries.push_back(entry(f, cost, generation));
}
@ -166,11 +166,11 @@ namespace smt {
}
else if (m_params.m_qi_promote_unsat && m_checker.is_unsat(qa->get_expr(), f->get_num_args(), f->get_args())) {
// do not delay instances that produce a conflict.
TRACE("qi_unsat", tout << "promoting instance that produces a conflict\n" << mk_pp(qa, m) << "\n";);
TRACE(qi_unsat, tout << "promoting instance that produces a conflict\n" << mk_pp(qa, m) << "\n";);
instantiate(curr);
}
else {
TRACE("qi_queue", tout << "delaying quantifier instantiation... " << f << "\n" << mk_pp(qa, m) << "\ncost: " << curr.m_cost << "\n";);
TRACE(qi_queue, tout << "delaying quantifier instantiation... " << f << "\n" << mk_pp(qa, m) << "\ncost: " << curr.m_cost << "\n";);
m_delayed_entries.push_back(curr);
}
@ -183,7 +183,7 @@ namespace smt {
}
}
m_new_entries.reset();
TRACE("new_entries_bug", tout << "[qi:instantiate]\n";);
TRACE(new_entries_bug, tout << "[qi:instantiate]\n";);
}
void qi_queue::display_instance_profile(fingerprint * f, quantifier * q, unsigned num_bindings, enode * const * bindings, unsigned proof_id, unsigned generation) {
@ -208,22 +208,22 @@ namespace smt {
ent.m_instantiated = true;
TRACE("qi_queue_profile", tout << q->get_qid() << ", gen: " << generation << " " << *f << " cost: " << ent.m_cost << "\n";);
TRACE(qi_queue_profile, tout << q->get_qid() << ", gen: " << generation << " " << *f << " cost: " << ent.m_cost << "\n";);
q::quantifier_stat * stat = m_qm.get_stat(q);
if (m_checker.is_sat(q->get_expr(), num_bindings, bindings)) {
TRACE("checker", tout << "instance already satisfied\n";);
TRACE(checker, tout << "instance already satisfied\n";);
// we log the "dummy" instantiations separately from "instance"
STRACE("dummy", tout << "### " << static_cast<void*>(f) <<", " << q->get_qid() << "\n";);
STRACE("dummy", tout << "Instance already satisfied (dummy)\n";);
STRACE(dummy, tout << "### " << static_cast<void*>(f) <<", " << q->get_qid() << "\n";);
STRACE(dummy, tout << "Instance already satisfied (dummy)\n";);
// a dummy instantiation is still an instantiation.
// in this way smt.qi.profile=true coincides with the axiom profiler
stat->inc_num_instances_checker_sat();
return;
}
STRACE("instance", tout << "### " << static_cast<void*>(f) <<", " << q->get_qid() << "\n";);
STRACE(instance, tout << "### " << static_cast<void*>(f) <<", " << q->get_qid() << "\n";);
auto* ebindings = m_subst(q, num_bindings);
for (unsigned i = 0; i < num_bindings; ++i)
@ -231,14 +231,14 @@ namespace smt {
expr_ref instance = m_subst();
TRACE("qi_queue", tout << "new instance:\n" << mk_pp(instance, m) << "\n";);
TRACE(qi_queue, tout << "new instance:\n" << mk_pp(instance, m) << "\n";);
expr_ref s_instance(m);
proof_ref pr(m);
m_context.get_rewriter()(instance, s_instance, pr);
TRACE("qi_queue_bug", tout << "new instance after simplification:\n" << s_instance << "\n";);
TRACE(qi_queue_bug, tout << "new instance after simplification:\n" << s_instance << "\n";);
if (m.is_true(s_instance)) {
STRACE("instance", tout << "Instance reduced to true\n";);
STRACE(instance, tout << "Instance reduced to true\n";);
stat -> inc_num_instances_simplify_true();
if (m.has_trace_stream()) {
display_instance_profile(f, q, num_bindings, bindings, pr ? pr->get_id() : 0, generation);
@ -258,7 +258,7 @@ namespace smt {
std::cout << instance << "\n";
#endif
TRACE("qi_queue", tout << "simplified instance:\n" << s_instance << "\n";);
TRACE(qi_queue, tout << "simplified instance:\n" << s_instance << "\n";);
stat->inc_num_instances();
if (stat->get_num_instances() % m_params.m_qi_profile_freq == 0) {
m_qm.display_stats(verbose_stream(), q);
@ -321,7 +321,7 @@ namespace smt {
pr1 = m.mk_app(symbol("inst"), args.size(), args.data(), m.mk_proof_sort());
m_instances.push_back(pr1);
}
TRACE("qi_queue", tout << mk_pp(lemma, m) << "\n#" << lemma->get_id() << ":=\n" << mk_ll_pp(lemma, m););
TRACE(qi_queue, tout << mk_pp(lemma, m) << "\n#" << lemma->get_id() << ":=\n" << mk_ll_pp(lemma, m););
m_stats.m_num_instances++;
unsigned gen = get_new_gen(q, generation, ent.m_cost);
display_instance_profile(f, q, num_bindings, bindings, proof_id, gen);
@ -345,10 +345,10 @@ namespace smt {
}
}
if (true_child && has_unassigned) {
TRACE("qi_queue_profile_detail", tout << "missed:\n" << mk_ll_pp(s_instance, m) << "\n#" << true_child->get_id() << "\n";);
TRACE(qi_queue_profile_detail, tout << "missed:\n" << mk_ll_pp(s_instance, m) << "\n#" << true_child->get_id() << "\n";);
num_useless++;
if (num_useless % 10 == 0) {
TRACE("qi_queue_profile", tout << "num useless: " << num_useless << "\n";);
TRACE(qi_queue_profile, tout << "num useless: " << num_useless << "\n";);
}
}
}
@ -360,7 +360,7 @@ namespace smt {
}
void qi_queue::push_scope() {
TRACE("new_entries_bug", tout << "[qi:push-scope]\n";);
TRACE(new_entries_bug, tout << "[qi:push-scope]\n";);
m_scopes.push_back(scope());
SASSERT(m_context.inconsistent() || m_new_entries.empty());
scope & s = m_scopes.back();
@ -381,7 +381,7 @@ namespace smt {
m_instances.shrink(s.m_instances_lim);
m_new_entries.reset();
m_scopes.shrink(new_lvl);
TRACE("new_entries_bug", tout << "[qi:pop-scope]\n";);
TRACE(new_entries_bug, tout << "[qi:pop-scope]\n";);
}
void qi_queue::reset() {
@ -397,7 +397,7 @@ namespace smt {
}
bool qi_queue::final_check_eh() {
TRACE("qi_queue", display_delayed_instances_stats(tout); tout << "lazy threshold: " << m_params.m_qi_lazy_threshold
TRACE(qi_queue, display_delayed_instances_stats(tout); tout << "lazy threshold: " << m_params.m_qi_lazy_threshold
<< ", scope_level: " << m_context.get_scope_level() << "\n";);
if (m_params.m_qi_conservative_final_check) {
@ -406,19 +406,19 @@ namespace smt {
unsigned sz = m_delayed_entries.size();
for (unsigned i = 0; i < sz; i++) {
entry & e = m_delayed_entries[i];
TRACE("qi_queue", tout << e.m_qb << ", cost: " << e.m_cost << ", instantiated: " << e.m_instantiated << "\n";);
TRACE(qi_queue, tout << e.m_qb << ", cost: " << e.m_cost << ", instantiated: " << e.m_instantiated << "\n";);
if (!e.m_instantiated && e.m_cost <= m_params.m_qi_lazy_threshold && (!init || e.m_cost < min_cost)) {
init = true;
min_cost = e.m_cost;
}
}
TRACE("qi_queue_min_cost", tout << "min_cost: " << min_cost << ", scope_level: " << m_context.get_scope_level() << "\n";);
TRACE(qi_queue_min_cost, tout << "min_cost: " << min_cost << ", scope_level: " << m_context.get_scope_level() << "\n";);
bool result = true;
for (unsigned i = 0; i < sz; i++) {
entry & e = m_delayed_entries[i];
TRACE("qi_queue", tout << e.m_qb << ", cost: " << e.m_cost << " min-cost: " << min_cost << ", instantiated: " << e.m_instantiated << "\n";);
TRACE(qi_queue, tout << e.m_qb << ", cost: " << e.m_cost << " min-cost: " << min_cost << ", instantiated: " << e.m_instantiated << "\n";);
if (!e.m_instantiated && e.m_cost <= min_cost) {
TRACE("qi_queue",
TRACE(qi_queue,
tout << "lazy quantifier instantiation...\n" << mk_pp(static_cast<quantifier*>(e.m_qb->get_data()), m) << "\ncost: " << e.m_cost << "\n";);
result = false;
m_instantiated_trail.push_back(i);
@ -432,9 +432,9 @@ namespace smt {
bool result = true;
for (unsigned i = 0; i < m_delayed_entries.size(); i++) {
entry & e = m_delayed_entries[i];
TRACE("qi_queue", tout << e.m_qb << ", cost: " << e.m_cost << ", instantiated: " << e.m_instantiated << "\n";);
TRACE(qi_queue, tout << e.m_qb << ", cost: " << e.m_cost << ", instantiated: " << e.m_instantiated << "\n";);
if (!e.m_instantiated && e.m_cost <= m_params.m_qi_lazy_threshold) {
TRACE("qi_queue",
TRACE(qi_queue,
tout << "lazy quantifier instantiation...\n" << mk_pp(static_cast<quantifier*>(e.m_qb->get_data()), m) << "\ncost: " << e.m_cost << "\n";);
result = false;
m_instantiated_trail.push_back(i);

View file

@ -35,7 +35,7 @@ bool theory_seq::solve_eqs(unsigned i) {
++m_stats.m_num_reductions;
change = true;
}
TRACE("seq_verbose", display_equations(tout););
TRACE(seq_verbose, display_equations(tout););
}
return change || m_new_propagation || ctx.inconsistent();
}
@ -51,13 +51,13 @@ bool theory_seq::solve_eq(unsigned idx) {
if (!canonize(e.ls, ls, dep2, change)) return false;
if (!canonize(e.rs, rs, dep2, change)) return false;
dependency* deps = m_dm.mk_join(dep2, e.dep());
TRACE("seq_verbose",
TRACE(seq_verbose,
tout << e.ls << " = " << e.rs << " ==> ";
tout << ls << " = " << rs << "\n";
display_deps(tout, deps););
if (!ctx.inconsistent() && simplify_eq(ls, rs, deps)) {
TRACE("seq", tout << "simplified\n";);
TRACE(seq, tout << "simplified\n";);
return true;
}
@ -74,7 +74,7 @@ bool theory_seq::solve_eq(unsigned idx) {
return false;
}
TRACE("seq_verbose", tout << ls << " = " << rs << "\n";);
TRACE(seq_verbose, tout << ls << " = " << rs << "\n";);
if (!ctx.inconsistent() && solve_nth_eq(ls, rs, deps)) {
return true;
}
@ -83,7 +83,7 @@ bool theory_seq::solve_eq(unsigned idx) {
}
if (!ctx.inconsistent() && change) {
// The propagation step from arithmetic state (e.g. length offset) to length constraints
TRACE("seq", tout << "inserting equality\n";);
TRACE(seq, tout << "inserting equality\n";);
m_eqs.set(idx, depeq(m_eq_id++, ls, rs, deps));
}
return false;
@ -145,13 +145,13 @@ bool theory_seq::has_len_offset(expr_ref_vector const& ls, expr_ref_vector const
enode* root2 = get_root(len_r_fst);
if (root1 == root2) {
TRACE("seq", tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst,m) << ")\n";);
TRACE(seq, tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst,m) << ")\n";);
offset = 0;
return true;
}
if (m_offset_eq.find(root1, root2, offset)) {
TRACE("seq", tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst,m) << " " << offset << ")\n";);
TRACE(seq, tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst,m) << " " << offset << ")\n";);
return true;
}
return false;
@ -191,8 +191,8 @@ bool theory_seq::len_based_split(depeq const& e) {
if (!has_len_offset(ls, rs, offset))
return false;
TRACE("seq", tout << "split based on length\n";);
TRACE("seq", display_equation(tout, e););
TRACE(seq, tout << "split based on length\n";);
TRACE(seq, display_equation(tout, e););
sort* srt = ls[0]->get_sort();
expr_ref x11 = expr_ref(ls[0], m);
expr_ref x12 = mk_concat(ls.size()-1, ls.data()+1, srt);
@ -242,22 +242,22 @@ bool theory_seq::len_based_split(depeq const& e) {
*/
bool theory_seq::branch_variable() {
if (branch_ternary_variable()) {
TRACE("seq", tout << "branch_ternary_variable\n";);
TRACE(seq, tout << "branch_ternary_variable\n";);
return true;
}
if (branch_quat_variable()) {
TRACE("seq", tout << "branch_quat_variable\n";);
TRACE(seq, tout << "branch_quat_variable\n";);
return true;
}
bool turn = ctx.get_random_value() % 2 == 0;
for (unsigned i = 0; i < 2; ++i, turn = !turn) {
if (turn && branch_variable_mb()) {
TRACE("seq", tout << "branch_variable_mb\n";);
TRACE(seq, tout << "branch_variable_mb\n";);
return true;
}
if (!turn && branch_variable_eq()) {
TRACE("seq", tout << "branch_variable_eq\n";);
TRACE(seq, tout << "branch_variable_eq\n";);
return true;
}
}
@ -288,7 +288,7 @@ bool theory_seq::branch_variable_mb() {
for (const auto& elem : len1) l1 += elem;
for (const auto& elem : len2) l2 += elem;
if (l1 == l2 && split_lengths(e.dep(), e.ls, e.rs, len1, len2)) {
TRACE("seq", tout << "split lengths\n";);
TRACE(seq, tout << "split lengths\n";);
change = true;
break;
}
@ -360,11 +360,11 @@ bool theory_seq::split_lengths(dependency* dep,
Y = bs.back();
bs.pop_back();
if (!is_var(Y) && !m_util.str.is_unit(Y)) {
TRACE("seq", tout << "TBD: non variable or unit split: " << Y << "\n";);
TRACE(seq, tout << "TBD: non variable or unit split: " << Y << "\n";);
return false;
}
if (X == Y) {
TRACE("seq", tout << "Cycle: " << X << "\n";);
TRACE(seq, tout << "Cycle: " << X << "\n";);
return false;
}
if (lenY.is_zero()) {
@ -408,7 +408,7 @@ bool theory_seq::split_lengths(dependency* dep,
SASSERT(is_var(Y));
expr_ref Y1 = m_sk.mk_left(X, b, Y);
expr_ref Y2 = m_sk.mk_right(X, b, Y);
TRACE("seq", tout << Y1 << "\n" << Y2 << "\n" << ls << "\n" << rs << "\n";);
TRACE(seq, tout << Y1 << "\n" << Y2 << "\n" << ls << "\n" << rs << "\n";);
expr_ref bY1 = mk_concat(b, Y1);
expr_ref Y1Y2 = mk_concat(Y1, Y2);
propagate_eq(dep, lits, X, bY1, true);
@ -421,7 +421,7 @@ bool theory_seq::split_lengths(dependency* dep,
bool theory_seq::branch_binary_variable() {
for (auto const& e : m_eqs) {
if (branch_binary_variable(e)) {
TRACE("seq", display_equation(tout, e););
TRACE(seq, display_equation(tout, e););
return true;
}
}
@ -477,7 +477,7 @@ bool theory_seq::branch_binary_variable(depeq const& e) {
// |x| > |ys| => x = ys ++ y1, y = y1 ++ y2, y2 = xs
expr_ref Y1 = m_sk.mk_left(x, y);
expr_ref Y2 = m_sk.mk_right(x, y);
TRACE("seq", tout << Y1 << "\n" << Y2 << "\n";);
TRACE(seq, tout << Y1 << "\n" << Y2 << "\n";);
ys.push_back(Y1);
expr_ref ysY1 = mk_concat(ys);
expr_ref xsE = mk_concat(xs);
@ -503,7 +503,7 @@ bool theory_seq::branch_unit_variable() {
break;
}
}
CTRACE("seq", result, tout << "branch unit variable\n";);
CTRACE(seq, result, tout << "branch unit variable\n";);
return result;
}
@ -704,17 +704,17 @@ bool theory_seq::branch_quat_variable(depeq const& e) {
if (xs == ys) {
literal lit = mk_eq(mk_len(x1), mk_len(y1), false);
if (ctx.get_assignment(lit) == l_undef) {
TRACE("seq", tout << mk_pp(x1, m) << " = " << mk_pp(y1, m) << "?\n";);
TRACE(seq, tout << mk_pp(x1, m) << " = " << mk_pp(y1, m) << "?\n";);
ctx.mark_as_relevant(lit);
return true;
}
else if (ctx.get_assignment(lit) == l_true) {
TRACE("seq", tout << mk_pp(x1, m) << " = " << mk_pp(y1, m) << "\n";);
TRACE(seq, tout << mk_pp(x1, m) << " = " << mk_pp(y1, m) << "\n";);
propagate_eq(dep, lit, x1, y1, true);
propagate_eq(dep, lit, x2, y2, true);
return true;
}
TRACE("seq", tout << mk_pp(x1, m) << " != " << mk_pp(y1, m) << "\n";);
TRACE(seq, tout << mk_pp(x1, m) << " != " << mk_pp(y1, m) << "\n";);
lits.push_back(~lit);
}
@ -722,19 +722,19 @@ bool theory_seq::branch_quat_variable(depeq const& e) {
literal lit2 = m_ax.mk_ge(mk_sub(mk_len(y1), mk_len(x1)), xs.size());
literal lit3 = m_ax.mk_ge(mk_sub(mk_len(x1), mk_len(y1)), ys.size());
if (ctx.get_assignment(lit1) == l_undef) {
TRACE("seq", tout << mk_pp(x1, m) << " <= " << mk_pp(y1, m) << "?\n";);
TRACE(seq, tout << mk_pp(x1, m) << " <= " << mk_pp(y1, m) << "?\n";);
ctx.mark_as_relevant(lit1);
return true;
}
if (ctx.get_assignment(lit1) == l_true) {
TRACE("seq", tout << mk_pp(x1, m) << " <= " << mk_pp(y1, m) << "\n";);
TRACE(seq, tout << mk_pp(x1, m) << " <= " << mk_pp(y1, m) << "\n";);
if (ctx.get_assignment(lit2) == l_undef) {
ctx.mark_as_relevant(lit2);
return true;
}
}
else {
TRACE("seq", tout << mk_pp(x1, m) << " >\n" << mk_pp(y1, m) << "\n";);
TRACE(seq, tout << mk_pp(x1, m) << " >\n" << mk_pp(y1, m) << "\n";);
if (ctx.get_assignment(lit3) == l_undef) {
ctx.mark_as_relevant(lit3);
return true;
@ -800,7 +800,7 @@ bool theory_seq::branch_variable_eq() {
depeq const& e = m_eqs[k];
if (branch_variable_eq(e)) {
TRACE("seq", tout << "branch variable\n";);
TRACE(seq, tout << "branch variable\n";);
return true;
}
}
@ -810,7 +810,7 @@ bool theory_seq::branch_variable_eq() {
bool theory_seq::branch_variable_eq(depeq const& e) {
unsigned id = e.id();
unsigned s = find_branch_start(2*id);
TRACE("seq", tout << s << " " << id << ": " << e.ls << " = " << e.rs << "\n";);
TRACE(seq, tout << s << " " << id << ": " << e.ls << " = " << e.rs << "\n";);
bool found = find_branch_candidate(s, e.dep(), e.ls, e.rs);
insert_branch_start(2*id, s);
if (!found) {
@ -844,13 +844,13 @@ bool theory_seq::find_branch_candidate(unsigned& start, dependency* dep, expr_re
return false;
}
TRACE("seq", tout << mk_pp(l, m) << ": " << ctx.get_scope_level() << " - start:" << start << "\n";);
TRACE(seq, tout << mk_pp(l, m) << ": " << ctx.get_scope_level() << " - start:" << start << "\n";);
expr_ref v0(m);
v0 = m_util.str.mk_empty(l->get_sort());
if (can_be_equal(ls.size() - 1, ls.data() + 1, rs.size(), rs.data())) {
if (assume_equality(l, v0)) {
TRACE("seq", tout << mk_pp(l, m) << " " << v0 << "\n";);
TRACE(seq, tout << mk_pp(l, m) << " " << v0 << "\n";);
return true;
}
}
@ -866,7 +866,7 @@ bool theory_seq::find_branch_candidate(unsigned& start, dependency* dep, expr_re
}
v0 = mk_concat(j + 1, rs.data());
if (assume_equality(l, v0)) {
TRACE("seq", tout << mk_pp(l, m) << " " << v0 << "\n";);
TRACE(seq, tout << mk_pp(l, m) << " " << v0 << "\n";);
++start;
return true;
}
@ -893,7 +893,7 @@ bool theory_seq::find_branch_candidate(unsigned& start, dependency* dep, expr_re
}
}
set_conflict(dep, lits);
TRACE("seq",
TRACE(seq,
tout << "start: " << start << "\n";
for (literal lit : lits) {
ctx.display_literal_verbose(tout << lit << ": ", lit) << "\n";
@ -946,21 +946,21 @@ bool theory_seq::assume_equality(expr* l, expr* r) {
enode* n1 = ensure_enode(l);
enode* n2 = ensure_enode(r);
if (n1->get_root() == n2->get_root()) {
TRACE("seq", tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " roots eq\n";);
TRACE(seq, tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " roots eq\n";);
return false;
}
if (ctx.is_diseq(n1, n2)) {
TRACE("seq", tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " is_diseq\n";);
TRACE(seq, tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " is_diseq\n";);
return false;
}
ctx.mark_as_relevant(n1);
ctx.mark_as_relevant(n2);
if (!ctx.assume_eq(n1, n2)) {
TRACE("seq", tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " can't assume\n";);
TRACE(seq, tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " can't assume\n";);
return false;
}
lbool res = ctx.get_assignment(mk_eq(l, r, false));
TRACE("seq", tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " literal assigned " << res << "\n";);
TRACE(seq, tout << mk_pp(l, m) << " = " << mk_pp(r, m) << " literal assigned " << res << "\n";);
return res != l_false;
}
@ -975,7 +975,7 @@ bool theory_seq::propagate_length_coherence(expr* e) {
if (!lower_bound2(e, lo) || !lo.is_pos() || lo >= rational(2048)) {
return false;
}
TRACE("seq", tout << "Unsolved " << mk_pp(e, m);
TRACE(seq, tout << "Unsolved " << mk_pp(e, m);
if (!lower_bound2(e, lo)) lo = -rational::one();
if (!upper_bound(mk_len(e), hi)) hi = -rational::one();
tout << " lo: " << lo << " hi: " << hi << "\n";
@ -1097,7 +1097,7 @@ bool theory_seq::reduce_length_eq() {
for (unsigned i = 0; !ctx.inconsistent() && i < m_eqs.size(); ++i) {
depeq const& e = m_eqs[(i + start) % m_eqs.size()];
if (reduce_length_eq(e.ls, e.rs, e.dep())) {
TRACE("seq", tout << "reduce length eq\n";);
TRACE(seq, tout << "reduce length eq\n";);
return true;
}
}
@ -1159,7 +1159,7 @@ bool theory_seq::solve_nth_eq(expr_ref_vector const& ls, expr_ref_vector const&
if (!idx_is_zero) rs1.push_back(m_sk.mk_pre(s, idx));
rs1.push_back(m_util.str.mk_unit(rhs));
rs1.push_back(m_sk.mk_post(s, idx1));
TRACE("seq", tout << ls1 << "\n"; tout << rs1 << "\n";);
TRACE(seq, tout << ls1 << "\n"; tout << rs1 << "\n";);
m_eqs.push_back(depeq(m_eq_id++, ls1, rs1, deps));
return true;
}
@ -1229,7 +1229,7 @@ bool theory_seq::find_better_rep(expr_ref_vector const& ls, expr_ref_vector cons
// Offset = 0, No change
if (l_fst && get_root(len_l_fst) == root2) {
TRACE("seq", tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst, m) << ")\n";);
TRACE(seq, tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst, m) << ")\n";);
return false;
}
@ -1252,7 +1252,7 @@ bool theory_seq::find_better_rep(expr_ref_vector const& ls, expr_ref_vector cons
if (l_fst && ctx.e_internalized(len_l_fst)) {
enode * root1 = get_root(len_l_fst);
if (m_offset_eq.contains(root1, root2)) {
TRACE("seq", tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst,m) << ")\n";);
TRACE(seq, tout << "(" << mk_pp(l_fst, m) << ", " << mk_pp(r_fst,m) << ")\n";);
return false;
}
}

View file

@ -36,7 +36,7 @@ bool theory_seq::solve_nqs(unsigned i) {
bool theory_seq::solve_ne(unsigned idx) {
TRACE("seq", display_disequation(tout << "solve: ", m_nqs[idx]););
TRACE(seq, display_disequation(tout << "solve: ", m_nqs[idx]););
unsigned num_undef_lits = 0;
return
(!check_ne_literals(idx, num_undef_lits))
@ -50,7 +50,7 @@ bool theory_seq::check_ne_literals(unsigned idx, unsigned& num_undef_lits) {
for (literal lit : n.lits()) {
switch (ctx.get_assignment(lit)) {
case l_false:
TRACE("seq", display_disequation(tout << "has false literal\n", n);
TRACE(seq, display_disequation(tout << "has false literal\n", n);
ctx.display_literal_verbose(tout, lit);
tout << "\n" << lit << " " << ctx.is_relevant(lit) << "\n";
display(tout);
@ -101,13 +101,13 @@ bool theory_seq::propagate_ne2lit(unsigned idx) {
lits.reset();
lits.push_back(~diseq);
dep = dep1;
TRACE("seq", tout << "conflict explained\n";);
TRACE(seq, tout << "conflict explained\n";);
}
}
set_conflict(dep, lits);
}
else {
TRACE("seq", tout << "propagate: " << undef_lit << "\n";);
TRACE(seq, tout << "propagate: " << undef_lit << "\n";);
propagate_lit(n.dep(), lits.size(), lits.data(), ~undef_lit);
}
return true;
@ -167,7 +167,7 @@ bool theory_seq::reduce_ne(unsigned idx) {
new_deps = m_dm.mk_join(deps, new_deps);
bool is_sat = m_seq_rewrite.reduce_eq(ls, rs, eqs, change);
TRACE("seq", display_disequation(tout << "reduced\n", n);
TRACE(seq, display_disequation(tout << "reduced\n", n);
tout << p.first << " -> " << ls << "\n";
tout << p.second << " -> " << rs << "\n";
tout << eqs << "\n";
@ -178,7 +178,7 @@ bool theory_seq::reduce_ne(unsigned idx) {
}
if (!change) {
TRACE("seq", tout << "no change " << p.first << " " << p.second << "\n";);
TRACE(seq, tout << "no change " << p.first << " " << p.second << "\n";);
if (updated) {
new_eqs.push_back(p);
}
@ -194,7 +194,7 @@ bool theory_seq::reduce_ne(unsigned idx) {
if (!ls.empty() || !rs.empty()) {
new_eqs.push_back(decomposed_eq(ls, rs));
}
TRACE("seq",
TRACE(seq,
tout << "num eqs: " << eqs.size() << "\n";
tout << "num new eqs: " << new_eqs.size() << "\n";
tout << eqs << "\n";
@ -229,9 +229,9 @@ bool theory_seq::reduce_ne(unsigned idx) {
}
if (updated) {
TRACE("seq", display_disequation(tout, n););
TRACE(seq, display_disequation(tout, n););
m_nqs.set(idx, ne(n.l(), n.r(), new_eqs, new_lits, new_deps));
TRACE("seq", display_disequation(tout << "updated:\n", m_nqs[idx]););
TRACE(seq, display_disequation(tout << "updated:\n", m_nqs[idx]););
}
return false;
}
@ -275,7 +275,7 @@ lbool theory_seq::branch_nq(ne const& n) {
ctx.mark_as_relevant(eq_len);
switch (ctx.get_assignment(eq_len)) {
case l_false:
TRACE("seq",
TRACE(seq,
display_disequation(tout, n);
ctx.display_literal_smt2(tout << "lengths are different: ", eq_len) << "\n";);
return l_true;
@ -304,7 +304,7 @@ lbool theory_seq::branch_nq(ne const& n) {
ctx.mark_as_relevant(eq_head);
switch (ctx.get_assignment(eq_head)) {
case l_false:
TRACE("seq", ctx.display_literal_smt2(tout << "heads are different: ", eq_head) << "\n";);
TRACE(seq, ctx.display_literal_smt2(tout << "heads are different: ", eq_head) << "\n";);
return l_true;
case l_undef:
return l_undef;

View file

@ -55,7 +55,7 @@ void seq_offset_eq::len_offset(expr* e, int val) {
if (match_x_minus_y(e, x, y) &&
ctx.e_internalized(x) &&
ctx.e_internalized(y)) {
TRACE("seq", tout << "eqc: " << mk_pp(e, m) << "\n";);
TRACE(seq, tout << "eqc: " << mk_pp(e, m) << "\n";);
enode* r1 = th.get_root(x);
enode* r2 = th.get_root(y);
for (enode* n1 : *r1) {
@ -71,7 +71,7 @@ void seq_offset_eq::len_offset(expr* e, int val) {
m_offset_equalities.insert(r1, r2, val);
m_has_offset_equality.insert(r1);
m_has_offset_equality.insert(r2);
TRACE("seq", tout << "a length pair: " << mk_pp(e1, m) << ", " << mk_pp(e2, m) << "\n";);
TRACE(seq, tout << "a length pair: " << mk_pp(e1, m) << ", " << mk_pp(e2, m) << "\n";);
return;
}
return;
@ -84,7 +84,7 @@ void seq_offset_eq::prop_arith_to_len_offset() {
rational val;
for (enode* n : th.get_context().enodes()) {
if (a.is_numeral(n->get_expr(), val) && val.is_int32() && INT_MIN < val.get_int32()) {
TRACE("seq", tout << "offset: " << mk_pp(n->get_expr(), m) << "\n";);
TRACE(seq, tout << "offset: " << mk_pp(n->get_expr(), m) << "\n";);
enode *next = n->get_next();
while (next != n) {
len_offset(next->get_expr(), val.get_int32());

View file

@ -95,8 +95,8 @@ namespace smt {
expr* e = ctx.bool_var2expr(lit.var());
VERIFY(str().is_in_re(e, s, r));
TRACE("seq_regex", tout << "propagate in RE: " << lit.sign() << " " << mk_pp(e, m) << std::endl;);
STRACE("seq_regex_brief", tout << "PIR(" << mk_pp(s, m) << ","
TRACE(seq_regex, tout << "propagate in RE: " << lit.sign() << " " << mk_pp(e, m) << std::endl;);
STRACE(seq_regex_brief, tout << "PIR(" << mk_pp(s, m) << ","
<< state_str(r) << ") ";);
// convert negative negative membership literals to positive
@ -114,16 +114,16 @@ namespace smt {
}
if (coallesce_in_re(lit)) {
TRACE("seq_regex", tout
TRACE(seq_regex, tout
<< "simplified conjunctions to an intersection" << std::endl;);
STRACE("seq_regex_brief", tout << "coallesce_in_re ";);
STRACE(seq_regex_brief, tout << "coallesce_in_re ";);
return;
}
if (is_string_equality(lit)) {
TRACE("seq_regex", tout
TRACE(seq_regex, tout
<< "simplified regex using string equality" << std::endl;);
STRACE("seq_regex_brief", tout << "string_eq ";);
STRACE(seq_regex_brief, tout << "string_eq ";);
return;
}
@ -139,10 +139,10 @@ namespace smt {
if (!re().is_full_seq(s_approx)) {
r = re().mk_inter(r, s_approx);
_r_temp_owner = r;
TRACE("seq_regex", tout
TRACE(seq_regex, tout
<< "get_overapprox_regex(" << mk_pp(s, m)
<< ") = " << mk_pp(s_approx, m) << std::endl;);
STRACE("seq_regex_brief", tout
STRACE(seq_regex_brief, tout
<< "overapprox=" << state_str(r) << " ";);
}
}
@ -151,7 +151,7 @@ namespace smt {
expr_ref acc(sk().mk_accept(s, zero, r), m);
literal acc_lit = th.mk_literal(acc);
TRACE("seq", tout << "propagate " << acc << "\n";);
TRACE(seq, tout << "propagate " << acc << "\n";);
//th.propagate_lit(nullptr, 1, &lit, acc_lit);
th.add_axiom(~lit, acc_lit);
@ -211,7 +211,7 @@ namespace smt {
//if the minlength of the regex is UINT_MAX then the regex is a deadend
if (re().is_empty(r) || info.min_length == UINT_MAX) {
STRACE("seq_regex_brief", tout << "(empty) ";);
STRACE(seq_regex_brief, tout << "(empty) ";);
th.add_axiom(~lit);
return true;
}
@ -219,7 +219,7 @@ namespace smt {
if (info.interpreted) {
update_state_graph(r);
if (m_state_graph.is_dead(get_state_id(r))) {
STRACE("seq_regex_brief", tout << "(dead) ";);
STRACE(seq_regex_brief, tout << "(dead) ";);
th.add_axiom(~lit);
return true;
}
@ -258,9 +258,9 @@ namespace smt {
unsigned idx = 0;
VERIFY(sk().is_accept(e, s, i, idx, r));
TRACE("seq_regex", tout << "propagate accept: "
TRACE(seq_regex, tout << "propagate accept: "
<< mk_pp(e, m) << std::endl;);
STRACE("seq_regex_brief", tout << std::endl
STRACE(seq_regex_brief, tout << std::endl
<< "PA(" << mk_pp(s, m) << "@" << idx
<< "," << state_str(r) << ") ";);
@ -268,11 +268,11 @@ namespace smt {
return;
if (block_unfolding(lit, idx)) {
STRACE("seq_regex_brief", tout << "(blocked) ";);
STRACE(seq_regex_brief, tout << "(blocked) ";);
return;
}
STRACE("seq_regex_brief", tout << "(unfold) ";);
STRACE(seq_regex_brief, tout << "(unfold) ";);
// Rule 1: use min_length to prune search
unsigned min_len = re().min_length(r);
@ -287,10 +287,10 @@ namespace smt {
if (min_len == 0) {
expr_ref is_nullable = is_nullable_wrapper(r);
if (m.is_false(is_nullable)) {
STRACE("seq_regex", tout
STRACE(seq_regex, tout
<< "Warning: min_length returned 0 for non-nullable regex"
<< std::endl;);
STRACE("seq_regex_brief", tout
STRACE(seq_regex_brief, tout
<< " (Warning: min_length returned 0 for"
<< " non-nullable regex)";);
// since nullable(r) = false:
@ -299,10 +299,10 @@ namespace smt {
}
else if (!m.is_true(is_nullable)) {
// is_nullable did not simplify
STRACE("seq_regex", tout
STRACE(seq_regex, tout
<< "Warning: is_nullable did not simplify to true or false"
<< std::endl;);
STRACE("seq_regex_brief", tout
STRACE(seq_regex_brief, tout
<< " (Warning: is_nullable did not simplify)";);
literal is_nullable_lit = th.mk_literal(is_nullable);
ctx.mark_as_relevant(is_nullable_lit);
@ -319,7 +319,7 @@ namespace smt {
expr_ref s_i = th.mk_nth(s, i);
expr_ref deriv(m);
deriv = mk_derivative_wrapper(s_i, r);
STRACE("seq_regex", tout
STRACE(seq_regex, tout
<< "mk_derivative_wrapper: " << re().to_str(deriv) << std::endl;);
expr_ref accept_deriv(m);
accept_deriv = mk_deriv_accept(s, idx + 1, deriv);
@ -415,14 +415,14 @@ namespace smt {
and derivative calls.
*/
expr_ref seq_regex::is_nullable_wrapper(expr* r) {
STRACE("seq_regex", tout << "nullable: " << mk_pp(r, m) << std::endl;);
STRACE(seq_regex, tout << "nullable: " << mk_pp(r, m) << std::endl;);
expr_ref result = seq_rw().is_nullable(r);
//TODO: rewrite seems unnecessary here
rewrite(result);
STRACE("seq_regex", tout << "nullable result: " << mk_pp(result, m) << std::endl;);
STRACE("seq_regex_brief", tout << "n(" << state_str(r) << ")="
STRACE(seq_regex, tout << "nullable result: " << mk_pp(result, m) << std::endl;);
STRACE(seq_regex_brief, tout << "n(" << state_str(r) << ")="
<< mk_pp(result, m) << " ";);
return result;
@ -433,7 +433,7 @@ namespace smt {
This will create a cached entry for the generic derivative of r that is independent of ele.
*/
expr_ref seq_regex::mk_derivative_wrapper(expr* ele, expr* r) {
STRACE("seq_regex", tout << "derivative(" << mk_pp(ele, m) << "): " << mk_pp(r, m) << std::endl;);
STRACE(seq_regex, tout << "derivative(" << mk_pp(ele, m) << "): " << mk_pp(r, m) << std::endl;);
// Uses canonical variable (:var 0) for the derivative element
// Substitute (:var 0) with the actual element
@ -441,8 +441,8 @@ namespace smt {
var_subst subst(m);
der = subst(der, ele);
STRACE("seq_regex", tout << "derivative result: " << mk_pp(der, m) << std::endl;);
STRACE("seq_regex_brief", tout << "d(" << state_str(r) << ")="
STRACE(seq_regex, tout << "derivative result: " << mk_pp(der, m) << std::endl;);
STRACE(seq_regex_brief, tout << "d(" << state_str(r) << ")="
<< state_str(der) << " ";);
//TODO: simplify der further, if ele implies further simplifications
@ -451,8 +451,8 @@ namespace smt {
}
void seq_regex::propagate_eq(expr* r1, expr* r2) {
TRACE("seq_regex", tout << "propagate EQ: " << mk_pp(r1, m) << ", " << mk_pp(r2, m) << std::endl;);
STRACE("seq_regex_brief", tout << "PEQ ";);
TRACE(seq_regex, tout << "propagate EQ: " << mk_pp(r1, m) << ", " << mk_pp(r2, m) << std::endl;);
STRACE(seq_regex_brief, tout << "PEQ ";);
sort* seq_sort = nullptr;
VERIFY(u().is_re(r1, seq_sort));
@ -473,8 +473,8 @@ namespace smt {
}
void seq_regex::propagate_ne(expr* r1, expr* r2) {
TRACE("seq_regex", tout << "propagate NEQ: " << mk_pp(r1, m) << ", " << mk_pp(r2, m) << std::endl;);
STRACE("seq_regex_brief", tout << "PNEQ ";);
TRACE(seq_regex, tout << "propagate NEQ: " << mk_pp(r1, m) << ", " << mk_pp(r2, m) << std::endl;);
STRACE(seq_regex_brief, tout << "PNEQ ";);
sort* seq_sort = nullptr;
VERIFY(u().is_re(r1, seq_sort));
expr_ref r = symmetric_diff(r1, r2);
@ -509,8 +509,8 @@ namespace smt {
return;
TRACE("seq_regex", tout << "propagate nonempty: " << mk_pp(e, m) << std::endl;);
STRACE("seq_regex_brief", tout
TRACE(seq_regex, tout << "propagate nonempty: " << mk_pp(e, m) << std::endl;);
STRACE(seq_regex_brief, tout
<< std::endl << "PNE(" << expr_id_str(e) << "," << state_str(r)
<< "," << expr_id_str(u) << "," << expr_id_str(n) << ") ";);
@ -577,7 +577,7 @@ namespace smt {
expr* econd = nullptr, *e1 = nullptr, *e2 = nullptr;
if (!re_to_accept.contains(e)) {
// First visit: add children
STRACE("seq_regex_verbose", tout << "1";);
STRACE(seq_regex_verbose, tout << "1";);
if (m.is_ite(e, econd, e1, e2) ||
re().is_union(e, e1, e2)) {
to_visit.push_back(e1);
@ -588,7 +588,7 @@ namespace smt {
}
else if (re_to_accept.find(e) == nullptr) {
// Second visit: set value
STRACE("seq_regex_verbose", tout << "2";);
STRACE(seq_regex_verbose, tout << "2";);
to_visit.pop_back();
if (m.is_ite(e, econd, e1, e2)) {
expr* b1 = re_to_accept.find(e1);
@ -619,13 +619,13 @@ namespace smt {
_temp_bool_owner.push_back(acc_leaf);
re_to_accept.find(e) = acc_leaf;
STRACE("seq_regex_verbose", tout
STRACE(seq_regex_verbose, tout
<< "mk_deriv_accept: added accept leaf: "
<< mk_pp(acc_leaf, m) << std::endl;);
}
}
else {
STRACE("seq_regex_verbose", tout << "3";);
STRACE(seq_regex_verbose, tout << "3";);
// Remaining visits: skip
to_visit.pop_back();
}
@ -734,8 +734,8 @@ namespace smt {
VERIFY(sk().is_is_empty(e, r, u, n));
expr_ref is_nullable = is_nullable_wrapper(r);
TRACE("seq_regex", tout << "propagate empty: " << mk_pp(e, m) << std::endl;);
STRACE("seq_regex_brief", tout
TRACE(seq_regex, tout << "propagate empty: " << mk_pp(e, m) << std::endl;);
STRACE(seq_regex_brief, tout
<< std::endl << "PE(" << expr_id_str(e) << "," << state_str(r)
<< "," << expr_id_str(u) << "," << expr_id_str(n) << ") ";);
@ -787,9 +787,9 @@ namespace smt {
m_state_to_expr.push_back(e);
unsigned new_id = m_state_to_expr.size();
m_expr_to_state.insert(e, new_id);
STRACE("seq_regex_brief", tout << "new(" << expr_id_str(e)
STRACE(seq_regex_brief, tout << "new(" << expr_id_str(e)
<< ")=" << state_str(e) << " ";);
STRACE("seq_regex", tout
STRACE(seq_regex, tout
<< "New state ID: " << new_id
<< " = " << mk_pp(e, m) << std::endl;);
SASSERT(get_expr_from_id(new_id) == e);
@ -820,21 +820,21 @@ namespace smt {
unsigned r_id = get_state_id(r);
if (m_state_graph.is_done(r_id)) return false;
if (m_state_graph.get_size() >= m_max_state_graph_size) {
STRACE("seq_regex", tout << "Warning: ignored state graph update -- max size of seen states reached!" << std::endl;);
STRACE("seq_regex_brief", tout << "(MAX SIZE REACHED) ";);
STRACE(seq_regex, tout << "Warning: ignored state graph update -- max size of seen states reached!" << std::endl;);
STRACE(seq_regex_brief, tout << "(MAX SIZE REACHED) ";);
return false;
}
STRACE("seq_regex", tout << "Updating state graph for regex "
STRACE(seq_regex, tout << "Updating state graph for regex "
<< mk_pp(r, m) << ") ";);
STRACE("state_graph",
STRACE(state_graph,
if (!m_state_graph.is_seen(r_id))
tout << std::endl << "state(" << r_id << ") = " << re().to_str(r) << std::endl << "info(" << r_id << ") = " << re().get_info(r) << std::endl;);
// Add state
m_state_graph.add_state(r_id);
STRACE("seq_regex", tout << "Updating state graph for regex "
STRACE(seq_regex, tout << "Updating state graph for regex "
<< mk_pp(r, m) << ") " << std::endl;);
STRACE("seq_regex_brief", tout << std::endl << "USG("
STRACE(seq_regex_brief, tout << std::endl << "USG("
<< state_str(r) << ") ";);
expr_ref r_nullable = is_nullable_wrapper(r);
if (m.is_true(r_nullable)) {
@ -843,14 +843,14 @@ namespace smt {
else {
// Add edges to all derivatives
expr_ref_vector derivatives(m);
STRACE("seq_regex_verbose", tout
STRACE(seq_regex_verbose, tout
<< "getting all derivs: " << r_id << " " << std::endl;);
get_derivative_targets(r, derivatives);
for (auto const& dr: derivatives) {
unsigned dr_id = get_state_id(dr);
STRACE("seq_regex_verbose", tout
STRACE(seq_regex_verbose, tout
<< std::endl << " traversing deriv: " << dr_id << " ";);
STRACE("state_graph",
STRACE(state_graph,
if (!m_state_graph.is_seen(dr_id))
tout << "state(" << dr_id << ") = " << re().to_str(dr) << std::endl << "info(" << dr_id << ") = " << re().get_info(dr) << std::endl;);
// Add state
@ -861,9 +861,9 @@ namespace smt {
m_state_graph.mark_done(r_id);
}
STRACE("seq_regex", m_state_graph.display(tout););
STRACE("seq_regex_brief", tout << std::endl;);
STRACE("seq_regex_brief", m_state_graph.display(tout););
STRACE(seq_regex, m_state_graph.display(tout););
STRACE(seq_regex_brief, tout << std::endl;);
STRACE(seq_regex_brief, m_state_graph.display(tout););
return true;
}

View file

@ -53,7 +53,7 @@ namespace smt {
next = next->get_next();
}
while (n != next);
CTRACE("arith_value", !found, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";);
CTRACE(arith_value, !found, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";);
return found;
}
@ -73,7 +73,7 @@ namespace smt {
next = next->get_next();
}
while (n != next);
CTRACE("arith_value", !found, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";);
CTRACE(arith_value, !found, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";);
return found;
}
@ -85,7 +85,7 @@ namespace smt {
if (m_tha) return m_tha->get_upper(n, up, is_strict);
if (m_thi) return m_thi->get_upper(n, up, is_strict);
if (m_thr) return m_thr->get_upper(n, up, is_strict);
TRACE("arith_value", tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";);
TRACE(arith_value, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";);
return false;
}
@ -97,7 +97,7 @@ namespace smt {
if (m_tha) return m_tha->get_lower(n, up, is_strict);
if (m_thi) return m_thi->get_lower(n, up, is_strict);
if (m_thr) return m_thr->get_lower(n, up, is_strict);
TRACE("arith_value", tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";);
TRACE(arith_value, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";);
return false;
}
@ -109,7 +109,7 @@ namespace smt {
if (m_tha && m_tha->get_value(n, _val) && a.is_numeral(_val, val)) return true;
if (m_thi && m_thi->get_value(n, _val) && a.is_numeral(_val, val)) return true;
if (m_thr && m_thr->get_value(n, val)) return true;
TRACE("arith_value", tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";);
TRACE(arith_value, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";);
return false;
}
@ -126,7 +126,7 @@ namespace smt {
next = next->get_next();
}
while (next != n);
TRACE("arith_value", tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";);
TRACE(arith_value, tout << "value not found for " << mk_pp(e, m_ctx->get_manager()) << "\n";);
return false;
}

View file

@ -122,7 +122,7 @@ namespace {
if (m_context.get_random_value() < static_cast<int>(m_params.m_random_var_freq * random_gen::max_value())) {
next = m_context.get_random_value() % m_context.get_num_b_internalized();
TRACE("random_split", tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
TRACE(random_split, tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
if (m_context.get_assignment(next) == l_undef)
return;
}
@ -401,7 +401,7 @@ namespace {
s.m_head_old = m_head;
s.m_queue2_trail = m_queue2.size();
s.m_head2_old = m_head2;
TRACE("case_split", tout << "head: " << m_head << "\n";);
TRACE(case_split, tout << "head: " << m_head << "\n";);
}
void pop_scope(unsigned num_scopes) override {
@ -414,7 +414,7 @@ namespace {
m_head2 = s.m_head2_old;
m_scopes.shrink(new_lvl);
SASSERT(m_head <= m_queue.size());
TRACE("case_split", display(tout); tout << "head: " << m_head << "\n";);
TRACE(case_split, display(tout); tout << "head: " << m_head << "\n";);
}
void next_case_split_core(ptr_vector<expr> & queue, unsigned & head, bool_var & next, lbool & phase) {
@ -441,19 +441,19 @@ namespace {
if (m_manager.has_trace_stream()) {
m_manager.trace_stream() << "[decide-and-or] #" << curr->get_id() << " #" << undef_child->get_id() << "\n";
}
TRACE("case_split", tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
TRACE(case_split, tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
literal l = m_context.get_literal(undef_child);
next = l.var();
phase = l.sign() ? l_false : l_true;
TRACE("case_split", display(tout););
TRACE(case_split, display(tout););
return;
}
}
else if (val == l_undef) {
SASSERT(intern && m_context.get_bool_var(curr) == next);
TRACE("case_split", tout << "found candidate: #" << curr->get_id() << "\n";);
TRACE(case_split, tout << "found candidate: #" << curr->get_id() << "\n";);
phase = l_undef;
TRACE("case_split", display(tout););
TRACE(case_split, display(tout););
return;
}
}
@ -597,7 +597,7 @@ namespace {
scope & s = m_scopes.back();
s.m_queue_trail = m_queue.size();
s.m_head_old = m_head;
TRACE("case_split", tout << "head: " << m_head << "\n";);
TRACE(case_split, tout << "head: " << m_head << "\n";);
}
void pop_scope(unsigned num_scopes) override {
@ -608,7 +608,7 @@ namespace {
m_head = s.m_head_old;
m_scopes.shrink(new_lvl);
SASSERT(m_head <= m_queue.size());
TRACE("case_split", display(tout); tout << "head: " << m_head << "\n";);
TRACE(case_split, display(tout); tout << "head: " << m_head << "\n";);
}
void next_case_split_core(bool_var & next, lbool & phase) {
@ -632,19 +632,19 @@ namespace {
if ((is_or && val == l_true) || (is_and && val == l_false)) {
expr * undef_child = nullptr;
if (!has_child_assigned_to(m_context, to_app(curr), val, undef_child, m_params.m_rel_case_split_order)) {
TRACE("case_split", tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
TRACE(case_split, tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
literal l = m_context.get_literal(undef_child);
next = l.var();
phase = l.sign() ? l_false : l_true;
TRACE("case_split", display(tout););
TRACE(case_split, display(tout););
return;
}
}
else if (val == l_undef) {
SASSERT(intern && m_context.get_bool_var(curr) == next);
TRACE("case_split", tout << "found candidate: #" << curr->get_id() << "\n";);
TRACE(case_split, tout << "found candidate: #" << curr->get_id() << "\n";);
phase = l_undef;
TRACE("case_split", display(tout););
TRACE(case_split, display(tout););
return;
}
}
@ -654,7 +654,7 @@ namespace {
void next_case_split(bool_var & next, lbool & phase) override {
if (m_context.get_random_value() < static_cast<int>(0.02 * random_gen::max_value())) {
next = m_context.get_random_value() % m_context.get_num_b_internalized();
TRACE("random_split", tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
TRACE(random_split, tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
if (m_context.get_assignment(next) == l_undef)
return;
}
@ -844,7 +844,7 @@ namespace {
s.m_queue2_trail = m_queue2.size();
s.m_generation = m_current_generation;
s.m_goal = m_current_goal;
TRACE("case_split", tout << "head: " << m_head << "\n";);
TRACE(case_split, tout << "head: " << m_head << "\n";);
}
void pop_scope(unsigned num_scopes) override {
@ -857,7 +857,7 @@ namespace {
m_current_goal = s.m_goal;
for (unsigned i = s.m_queue2_trail; i < m_queue2.size(); i++) {
//TRACE("case_split", tout << "ld[" << i << "] = " << m_queue2[i].m_last_decided << " cont " <<
//TRACE(case_split, tout << "ld[" << i << "] = " << m_queue2[i].m_last_decided << " cont " <<
SASSERT((m_queue2[i].m_last_decided == -1) == m_priority_queue2.contains(i));
if (m_priority_queue2.contains(i))
m_priority_queue2.erase(i);
@ -877,7 +877,7 @@ namespace {
m_queue2.shrink(s.m_queue2_trail);
m_scopes.shrink(new_lvl);
SASSERT(m_head <= m_queue.size());
TRACE("case_split", display(tout); tout << "head: " << m_head << "\n";);
TRACE(case_split, display(tout); tout << "head: " << m_head << "\n";);
}
void next_case_split_core(expr * curr, bool_var & next, lbool & phase) {
@ -900,19 +900,19 @@ namespace {
if (m_manager.has_trace_stream()) {
m_manager.trace_stream() << "[decide-and-or] #" << curr->get_id() << " #" << undef_child->get_id() << "\n";
}
TRACE("case_split", tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
TRACE(case_split, tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
literal l = m_context.get_literal(undef_child);
next = l.var();
phase = l.sign() ? l_false : l_true;
TRACE("case_split", display(tout););
TRACE(case_split, display(tout););
return;
}
}
else if (val == l_undef) {
SASSERT(intern && m_context.get_bool_var(curr) == next);
TRACE("case_split", tout << "found candidate: #" << curr->get_id() << "\n";);
TRACE(case_split, tout << "found candidate: #" << curr->get_id() << "\n";);
phase = l_undef;
TRACE("case_split", display(tout););
TRACE(case_split, display(tout););
return;
}
next = null_bool_var;
@ -932,7 +932,7 @@ namespace {
while (!m_priority_queue2.empty()) {
unsigned idx = static_cast<unsigned>(m_priority_queue2.erase_min());
TRACE("case_split", tout << "q " << m_queue2.size() << " idx " << idx << "\n"; );
TRACE(case_split, tout << "q " << m_queue2.size() << " idx " << idx << "\n"; );
SASSERT(idx < m_queue2.size());
queue_entry & e = m_queue2[idx];
SASSERT(e.m_last_decided == -1);
@ -989,7 +989,7 @@ namespace {
if (!m_manager.is_label_lit(lablit))
return;
TRACE("case_split", tout << "Found goal\n" << mk_pp(e, m_manager) << "\n"; );
TRACE(case_split, tout << "Found goal\n" << mk_pp(e, m_manager) << "\n"; );
set_goal(e);
}
@ -1189,7 +1189,7 @@ namespace {
if (m_context.get_random_value() < threshold) {
SASSERT(m_context.get_num_b_internalized() > 0);
next = m_context.get_random_value() % m_context.get_num_b_internalized();
TRACE("random_split", tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
TRACE(random_split, tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
if (m_context.get_assignment(next) == l_undef)
return;
}
@ -1209,7 +1209,7 @@ namespace {
}
void add_theory_aware_branching_info(bool_var v, double priority, lbool phase) override {
TRACE("theory_aware_branching", tout << "Add theory-aware branching information for l#" << v << ": priority=" << priority << std::endl;);
TRACE(theory_aware_branching, tout << "Add theory-aware branching information for l#" << v << ": priority=" << priority << std::endl;);
m_theory_vars.insert(v);
m_theory_var_phase.insert(v, phase);
m_theory_var_priority.insert(v, priority);

View file

@ -217,7 +217,7 @@ namespace smt {
return enode_bool_pair(n_prime, false);
case BINARY:
n_prime = UNTAG(binary_table*, t)->insert_if_not_there(n);
TRACE("cg_table", tout << "insert: " << n->get_owner_id() << " " << cg_binary_hash()(n) << " inserted: " << (n == n_prime) << " " << n_prime->get_owner_id() << "\n";
TRACE(cg_table, tout << "insert: " << n->get_owner_id() << " " << cg_binary_hash()(n) << " inserted: " << (n == n_prime) << " " << n_prime->get_owner_id() << "\n";
display_binary(tout, t); tout << "contains_ptr: " << contains_ptr(n) << "\n";);
return enode_bool_pair(n_prime, false);
case BINARY_COMM:
@ -238,7 +238,7 @@ namespace smt {
UNTAG(unary_table*, t)->erase(n);
break;
case BINARY:
TRACE("cg_table", tout << "erase: " << n->get_owner_id() << " " << cg_binary_hash()(n) << " contains: " << contains_ptr(n) << "\n";);
TRACE(cg_table, tout << "erase: " << n->get_owner_id() << " " << cg_binary_hash()(n) << " contains: " << contains_ptr(n) << "\n";);
UNTAG(binary_table*, t)->erase(n);
break;
case BINARY_COMM:

View file

@ -96,7 +96,7 @@ namespace smt {
justification* j = c.get_justification();
auto st = kind2st(c.get_kind());
auto pr = justification2proof(st, j);
CTRACE("mk_clause", pr.get(), tout << mk_bounded_pp(pr, m, 4) << "\n";);
CTRACE(mk_clause, pr.get(), tout << mk_bounded_pp(pr, m, 4) << "\n";);
update(c, st, pr, simp_lits);
}
@ -105,7 +105,7 @@ namespace smt {
return;
auto st = kind2st(k);
auto pr = justification2proof(st, j);
CTRACE("mk_clause", pr.get(), tout << mk_bounded_pp(pr, m, 4) << "\n";);
CTRACE(mk_clause, pr.get(), tout << mk_bounded_pp(pr, m, 4) << "\n";);
m_lits.reset();
for (unsigned i = 0; i < n; ++i)
m_lits.push_back(ctx.literal2expr(lits[i]));
@ -189,7 +189,7 @@ namespace smt {
}
void clause_proof::update(status st, expr_ref_vector& v, proof* p) {
TRACE("clause_proof", tout << m_trail.size() << " " << st << " " << v << "\n";);
TRACE(clause_proof, tout << m_trail.size() << " " << st << " " << v << "\n";);
if (ctx.get_fparams().m_clause_proof)
m_trail.push_back(info(st, v, p));
if (m_on_clause_eh)
@ -237,7 +237,7 @@ namespace smt {
}
proof_ref clause_proof::get_proof(bool inconsistent) {
TRACE("context", tout << "get-proof " << ctx.get_fparams().m_clause_proof << "\n";);
TRACE(context, tout << "get-proof " << ctx.get_fparams().m_clause_proof << "\n";);
if (!ctx.get_fparams().m_clause_proof)
return proof_ref(m);
expr_ref_vector ps(m);

View file

@ -102,7 +102,7 @@ namespace smt {
*/
void conflict_resolution::eq_justification2literals(enode * lhs, enode * rhs, eq_justification js) {
SASSERT(m_antecedents);
TRACE("conflict_",
TRACE(conflict_,
ast_manager& m = get_manager();
tout << mk_pp(lhs->get_expr(), m) << " = " << mk_pp(rhs->get_expr(), m);
switch (js.get_kind()) {
@ -125,7 +125,7 @@ namespace smt {
mark_justification(js.get_justification());
break;
case eq_justification::CONGRUENCE: {
CTRACE("dyn_ack_target", !lhs->is_eq(), tout << "dyn_ack_target2: " << lhs->get_owner_id() << " " << rhs->get_owner_id() << "\n";);
CTRACE(dyn_ack_target, !lhs->is_eq(), tout << "dyn_ack_target2: " << lhs->get_owner_id() << " " << rhs->get_owner_id() << "\n";);
m_dyn_ack_manager.used_cg_eh(lhs->get_expr(), rhs->get_expr());
unsigned num_args = lhs->get_num_args();
SASSERT(num_args == rhs->get_num_args());
@ -313,7 +313,7 @@ namespace smt {
bool_var var = antecedent.var();
unsigned lvl = m_ctx.get_assign_level(var);
SASSERT(var < m_ctx.get_num_bool_vars());
TRACE("conflict_", tout << "processing antecedent (level " << lvl << "):";
TRACE(conflict_, tout << "processing antecedent (level " << lvl << "):";
m_ctx.display_literal(tout, antecedent);
m_ctx.display_detailed_literal(tout << " ", antecedent) << "\n";);
@ -351,7 +351,7 @@ namespace smt {
for (literal l : antecedents)
process_antecedent(l, num_marks);
(void)consequent;
TRACE("conflict_smt2",
TRACE(conflict_smt2,
for (literal& l : antecedents) {
l.neg();
SASSERT(m_ctx.get_assignment(l) == l_false);
@ -384,7 +384,7 @@ namespace smt {
Return false if the conflict cannot be resolved (it is at the search level).
*/
bool conflict_resolution::initialize_resolve(b_justification conflict, literal not_l, b_justification & js, literal & consequent) {
TRACE("conflict_detail", m_ctx.display(tout););
TRACE(conflict_detail, m_ctx.display(tout););
m_lemma.reset();
m_lemma_atoms.reset();
SASSERT(m_ctx.get_search_level() >= m_ctx.get_base_level());
@ -395,7 +395,7 @@ namespace smt {
m_conflict_lvl = get_max_lvl(consequent, js);
TRACE("conflict_bug",
TRACE(conflict_bug,
tout << "conflict_lvl: " << m_conflict_lvl << " scope_lvl: " << m_ctx.get_scope_level() << " base_lvl: " << m_ctx.get_base_level()
<< " search_lvl: " << m_ctx.get_search_level() << "\n";
tout << "js.kind: " << js.get_kind() << "\n";
@ -410,8 +410,8 @@ namespace smt {
// triggered by an axiom or justification proof wrapper, this two kinds
// of justification are considered level zero.
if (m_conflict_lvl <= m_ctx.get_search_level()) {
TRACE("conflict", tout << "problem is unsat\n";);
TRACE("conflict", m_ctx.display(tout););
TRACE(conflict, tout << "problem is unsat\n";);
TRACE(conflict, m_ctx.display(tout););
if (m.proofs_enabled())
mk_conflict_proof(conflict, not_l);
if (m_ctx.tracking_assumptions())
@ -419,7 +419,7 @@ namespace smt {
return false;
}
TRACE("conflict", tout << "conflict_lvl: " << m_conflict_lvl << "\n";);
TRACE(conflict, tout << "conflict_lvl: " << m_conflict_lvl << "\n";);
SASSERT(!m_assigned_literals.empty());
@ -440,16 +440,16 @@ namespace smt {
void conflict_resolution::finalize_resolve(b_justification conflict, literal not_l) {
unmark_justifications(0);
TRACE("conflict", m_ctx.display_literals(tout << "before minimization:\n", m_lemma) << "\n" << m_lemma << "\n";);
TRACE(conflict, m_ctx.display_literals(tout << "before minimization:\n", m_lemma) << "\n" << m_lemma << "\n";);
TRACE("conflict_verbose",m_ctx.display_literals_verbose(tout << "before minimization:\n", m_lemma) << "\n";);
TRACE(conflict_verbose,m_ctx.display_literals_verbose(tout << "before minimization:\n", m_lemma) << "\n";);
if (m_params.m_minimize_lemmas)
minimize_lemma();
TRACE("conflict", m_ctx.display_literals(tout << "after minimization:\n", m_lemma) << "\n";);
TRACE("conflict_verbose", m_ctx.display_literals_verbose(tout << "after minimization:\n", m_lemma) << "\n";);
TRACE("conflict_bug", m_ctx.display_literals_verbose(tout, m_lemma) << "\n";);
TRACE(conflict, m_ctx.display_literals(tout << "after minimization:\n", m_lemma) << "\n";);
TRACE(conflict_verbose, m_ctx.display_literals_verbose(tout << "after minimization:\n", m_lemma) << "\n";);
TRACE(conflict_bug, m_ctx.display_literals_verbose(tout, m_lemma) << "\n";);
literal_vector::iterator it = m_lemma.begin();
literal_vector::iterator end = m_lemma.end();
@ -470,7 +470,7 @@ namespace smt {
}
}
TRACE("conflict",
TRACE(conflict,
tout << "new scope level: " << m_new_scope_lvl << "\n";
tout << "intern. scope level: " << m_lemma_iscope_lvl << "\n";
tout << "lemma: " << m_lemma << "\n";);
@ -489,7 +489,7 @@ namespace smt {
unsigned idx = skip_literals_above_conflict_level();
TRACE("conflict", m_ctx.display_literal_verbose(tout, not_l); m_ctx.display(tout << " ", conflict););
TRACE(conflict, m_ctx.display_literal_verbose(tout, not_l); m_ctx.display(tout << " ", conflict););
// save space for first uip
m_lemma.push_back(null_literal);
@ -497,7 +497,7 @@ namespace smt {
unsigned num_marks = 0;
if (not_l != null_literal) {
TRACE("conflict", tout << "not_l: "; m_ctx.display_literal_verbose(tout, not_l) << "\n";);
TRACE(conflict, tout << "not_l: "; m_ctx.display_literal_verbose(tout, not_l) << "\n";);
process_antecedent(not_l, num_marks);
}
@ -509,7 +509,7 @@ namespace smt {
get_manager().trace_stream() << "\n";
}
TRACE("conflict", tout << "processing consequent id: " << idx << " lit: " << consequent << " "; m_ctx.display_literal(tout, consequent);
TRACE(conflict, tout << "processing consequent id: " << idx << " lit: " << consequent << " "; m_ctx.display_literal(tout, consequent);
m_ctx.display_literal_verbose(tout << " ", consequent) << "\n";
tout << "num_marks: " << num_marks << ", js kind: " << js.get_kind() << " level: " << m_ctx.get_assign_level(consequent) << "\n";
);
@ -517,7 +517,7 @@ namespace smt {
switch (js.get_kind()) {
case b_justification::CLAUSE: {
clause * cls = js.get_clause();
TRACE("conflict_smt2", m_ctx.display_clause_smt2(tout, *cls););
TRACE(conflict_smt2, m_ctx.display_clause_smt2(tout, *cls););
if (cls->is_lemma())
cls->inc_clause_activity();
unsigned num_lits = cls->get_num_literals();
@ -545,7 +545,7 @@ namespace smt {
break;
}
case b_justification::BIN_CLAUSE:
TRACE("conflict_smt2", m_ctx.display_literals_smt2(tout, consequent, ~js.get_literal()) << "\n";);
TRACE(conflict_smt2, m_ctx.display_literals_smt2(tout, consequent, ~js.get_literal()) << "\n";);
SASSERT(consequent.var() != js.get_literal().var());
process_antecedent(js.get_literal(), num_marks);
break;
@ -562,7 +562,7 @@ namespace smt {
literal l = m_assigned_literals[idx];
if (m_ctx.is_marked(l.var()))
break;
CTRACE("conflict", m_ctx.get_assign_level(l) != m_conflict_lvl && m_ctx.get_assign_level(l) != m_ctx.get_base_level(),
CTRACE(conflict, m_ctx.get_assign_level(l) != m_conflict_lvl && m_ctx.get_assign_level(l) != m_ctx.get_base_level(),
tout << "assign_level(l): " << m_ctx.get_assign_level(l) << ", conflict_lvl: ";
tout << m_conflict_lvl << ", l: "; m_ctx.display_literal_verbose(tout, l);
tout << "\n";
@ -584,12 +584,12 @@ namespace smt {
}
while (num_marks > 0);
TRACE("conflict", tout << "FUIP: "; m_ctx.display_literal(tout, consequent)<< "\n";);
TRACE(conflict, tout << "FUIP: "; m_ctx.display_literal(tout, consequent)<< "\n";);
m_lemma[0] = ~consequent;
m_lemma_atoms.set(0, m_ctx.bool_var2expr(consequent.var()));
TRACE("conflict_smt2", m_ctx.display_literals_smt2(tout << "lemma:", m_lemma) << "\n";);
TRACE(conflict_smt2, m_ctx.display_literals_smt2(tout << "lemma:", m_lemma) << "\n";);
// TODO:
//
@ -761,7 +761,7 @@ namespace smt {
m_lemma .shrink(j);
m_lemma_atoms.shrink(j);
m_ctx.m_stats.m_num_minimized_lits += sz - j;
TRACE("conflict", tout << "lemma: " << m_lemma << "\n";);
TRACE(conflict, tout << "lemma: " << m_lemma << "\n";);
}
/**
@ -771,7 +771,7 @@ namespace smt {
proof * conflict_resolution::get_proof(enode * n1, enode * n2) {
proof * pr;
if (m_eq2proof.find(n1, n2, pr)) {
TRACE("proof_gen_bug", tout << "eq2_pr_cached: #" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n";);
TRACE(proof_gen_bug, tout << "eq2_pr_cached: #" << n1->get_owner_id() << " #" << n2->get_owner_id() << "\n";);
return pr;
}
m_todo_pr.push_back(tp_elem(n1, n2));
@ -802,7 +802,7 @@ namespace smt {
return pr;
}
if (!is_eq || (f1 != n2_owner && f2 != n2_owner)) {
CTRACE("norm_eq_proof_bug", !m_ctx.is_true(n2) && !m_ctx.is_false(n2),
CTRACE(norm_eq_proof_bug, !m_ctx.is_true(n2) && !m_ctx.is_false(n2),
tout << "n1: #" << n1->get_owner_id() << ", n2: #" << n2->get_owner_id() << "\n";
if (fact->get_num_args() == 2) {
tout << "fact(0): #" << f1->get_id() << ", fact(1): #" << f2->get_id() << "\n";
@ -820,7 +820,7 @@ namespace smt {
m_new_proofs.push_back(pr);
return pr;
}
TRACE("norm_eq_proof",
TRACE(norm_eq_proof,
tout << mk_bounded_pp(pr, m, 4) << "\n";
tout << mk_bounded_pp(n1_owner, m) << "\n";
tout << mk_bounded_pp(n2_owner, m) << "\n";
@ -848,7 +848,7 @@ namespace smt {
case eq_justification::AXIOM:
return m.mk_hypothesis(m.mk_eq(n1->get_expr(), n2->get_expr()));
case eq_justification::EQUATION:
TRACE("proof_gen_bug", tout << js.get_literal() << "\n"; m_ctx.display_literal_info(tout, js.get_literal()););
TRACE(proof_gen_bug, tout << js.get_literal() << "\n"; m_ctx.display_literal_info(tout, js.get_literal()););
return norm_eq_proof(n1, n2, get_proof(js.get_literal()));
case eq_justification::JUSTIFICATION:
return norm_eq_proof(n1, n2, get_proof(js.get_justification()));
@ -887,7 +887,7 @@ namespace smt {
m_new_proofs.push_back(pr1);
}
else {
TRACE("comm_proof_bug", tout << "e1: #" << e1->get_id() << " e2: #" << e2->get_id() << "\n" << mk_bounded_pp(e1, m, 10) <<
TRACE(comm_proof_bug, tout << "e1: #" << e1->get_id() << " e2: #" << e2->get_id() << "\n" << mk_bounded_pp(e1, m, 10) <<
"\n" << mk_bounded_pp(e2, m, 10) << "\n";);
// SASSERT(e1 == e2);
}
@ -927,7 +927,7 @@ namespace smt {
proof * conflict_resolution::get_proof(literal l) {
proof * pr;
if (m_lit2proof.find(l, pr)) {
TRACE("proof_gen_bug", tout << "lit2pr_cached: #" << l << " " << pr << " " << pr->get_id() << "\n";);
TRACE(proof_gen_bug, tout << "lit2pr_cached: #" << l << " " << pr << " " << pr->get_id() << "\n";);
return pr;
}
m_todo_pr.push_back(tp_elem(l));
@ -944,7 +944,7 @@ namespace smt {
static unsigned invocation_counter = 0;
invocation_counter++;
#define DUMP_AFTER_NUM_INVOCATIONS 213473
CTRACE("get_proof_bug_after", invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, tout << "START get_proof\n";);
CTRACE(get_proof_bug_after, invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, tout << "START get_proof\n";);
#endif
// l is a hypothesis: if it is marked, and the justification for the variable l.var() is js.
// we need the second condition, because the core builds proofs as:
@ -978,9 +978,9 @@ namespace smt {
proof * pr = get_proof(js);
ptr_buffer<proof> prs;
bool visited = pr != nullptr;
TRACE("get_proof_bug", if (pr != 0) tout << js->get_name() << "\n";);
CTRACE("get_proof_bug_after", invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, if (pr != 0) tout << js->get_name() << "\n";);
CTRACE("get_proof_bug_after", invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, if (pr != 0) js->display_debug_info(*this, tout););
TRACE(get_proof_bug, if (pr != 0) tout << js->get_name() << "\n";);
CTRACE(get_proof_bug_after, invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, if (pr != 0) tout << js->get_name() << "\n";);
CTRACE(get_proof_bug_after, invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, if (pr != 0) js->display_debug_info(*this, tout););
prs.push_back(pr);
unsigned num_lits = cls->get_num_literals();
unsigned i = 0;
@ -1008,7 +1008,7 @@ namespace smt {
return nullptr;
expr_ref l_exr(m);
m_ctx.literal2expr(l, l_exr);
TRACE("get_proof_bug",
TRACE(get_proof_bug,
tout << "clause:\n";
for (unsigned i = 0; i < num_lits; i++) {
tout << cls->get_literal(i).index() << "\n";
@ -1021,7 +1021,7 @@ namespace smt {
tout << mk_pp(m.get_fact(prs[i]), m) << "\n";
}
tout << "consequent:\n" << mk_pp(l_exr, m) << "\n";);
CTRACE("get_proof_bug_after",
CTRACE(get_proof_bug_after,
invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS,
tout << "clause, num_lits: " << num_lits << ":\n";
for (unsigned i = 0; i < num_lits; i++) {
@ -1035,11 +1035,11 @@ namespace smt {
tout << mk_pp(m.get_fact(prs[i]), m) << "\n";
}
tout << "consequent:\n" << mk_pp(l_exr, m) << "\n";);
TRACE("get_proof",
TRACE(get_proof,
tout << l.index() << " " << true_literal.index() << " " << false_literal.index() << " ";
m_ctx.display_literal(tout, l); tout << " --->\n";
tout << mk_ll_pp(l_exr, m););
CTRACE("get_proof_bug_after",
CTRACE(get_proof_bug_after,
invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS,
tout << l.index() << " " << true_literal.index() << " " << false_literal.index() << " ";
m_ctx.display_literal(tout, l); tout << " --->\n";
@ -1061,17 +1061,17 @@ namespace smt {
proof * conflict_resolution::get_proof(justification * js) {
proof * pr;
if (m_js2proof.find(js, pr)) {
TRACE("proof_gen_bug", tout << "js2pr_cached: #" << js << " " << pr << " " << pr->get_id() << "\n";);
TRACE(proof_gen_bug, tout << "js2pr_cached: #" << js << " " << pr << " " << pr->get_id() << "\n";);
return pr;
}
SASSERT(js != nullptr);
TRACE("proof_gen_bug", tout << js << "\n";);
TRACE(proof_gen_bug, tout << js << "\n";);
m_todo_pr.push_back(tp_elem(js));
return nullptr;
}
void conflict_resolution::reset() {
TRACE("proof_gen_bug", tout << "reset_caches\n";);
TRACE(proof_gen_bug, tout << "reset_caches\n";);
m_new_proofs.reset();
m_todo_pr.reset();
m_eq2proof.reset();
@ -1086,7 +1086,7 @@ namespace smt {
if (m_ctx.is_marked(l.var()) && m_ctx.get_justification(l.var()) == js)
return true;
SASSERT(js.get_kind() != b_justification::BIN_CLAUSE);
CTRACE("visit_b_justification_bug", js.get_kind() == b_justification::AXIOM, tout << "l: " << l << "\n"; m_ctx.display(tout););
CTRACE(visit_b_justification_bug, js.get_kind() == b_justification::AXIOM, tout << "l: " << l << "\n"; m_ctx.display(tout););
if (js.get_kind() == b_justification::AXIOM)
return true;
@ -1122,10 +1122,10 @@ namespace smt {
SASSERT(!m_lit2proof.contains(l));
proof * pr = get_proof(l, js);
SASSERT(pr);
TRACE("proof_gen_bug", tout << "lit2pr_saved: #" << l << " " << pr << " " << pr->get_id() << "\n";);
TRACE(proof_gen_bug, tout << "lit2pr_saved: #" << l << " " << pr << " " << pr->get_id() << "\n";);
m_lit2proof.insert(l, pr);
m_trail.push_back(pr);
TRACE("mk_proof",
TRACE(mk_proof,
tout << mk_bounded_pp(m_ctx.bool_var2expr(l.var()), m, 10) << "\n";
tout << "storing proof for: "; m_ctx.display_literal(tout, l); tout << "\n";
tout << mk_ll_pp(pr, m););
@ -1247,7 +1247,7 @@ namespace smt {
if (prs1.size() == 1)
pr = prs1[0];
else {
TRACE("mk_transitivity",
TRACE(mk_transitivity,
unsigned sz = prs1.size();
for (unsigned i = 0; i < sz; i++) {
tout << mk_ll_pp(prs1[i], m) << "\n";
@ -1255,14 +1255,14 @@ namespace smt {
pr = m.mk_transitivity(prs1.size(), prs1.data(), lhs->get_expr(), rhs->get_expr());
}
m_new_proofs.push_back(pr);
TRACE("proof_gen_bug", tout << "eq2pr_saved: #" << lhs->get_owner_id() << " #" << rhs->get_owner_id() << "\n";);
TRACE(proof_gen_bug, tout << "eq2pr_saved: #" << lhs->get_owner_id() << " #" << rhs->get_owner_id() << "\n";);
m_eq2proof.insert(lhs, rhs, pr);
}
void conflict_resolution::mk_conflict_proof(b_justification conflict, literal not_l) {
SASSERT(conflict.get_kind() != b_justification::BIN_CLAUSE);
SASSERT(not_l == null_literal || conflict.get_kind() == b_justification::AXIOM || conflict.get_kind() == b_justification::JUSTIFICATION);
TRACE("mk_conflict_proof", m_ctx.display_literals(tout << "lemma literals:", m_lemma) << "\n";);
TRACE(mk_conflict_proof, m_ctx.display_literals(tout << "lemma literals:", m_lemma) << "\n";);
reset();
for (literal lit : m_lemma) m_ctx.set_mark(lit.var());
@ -1300,7 +1300,7 @@ namespace smt {
if (pr) {
m_todo_pr.pop_back();
m_new_proofs.push_back(pr);
TRACE("proof_gen_bug", tout << "js2pr_saved: #" << js << "\n";);
TRACE(proof_gen_bug, tout << "js2pr_saved: #" << js << "\n";);
m_trail.push_back(pr);
m_js2proof.insert(js, pr);
}
@ -1354,14 +1354,14 @@ namespace smt {
m_lemma_proof = pr;
else
m_lemma_proof = m.mk_lemma(pr, fact);
TRACE("mk_conflict_proof", tout << mk_pp(m_lemma_proof, m) << "\n";);
TRACE(mk_conflict_proof, tout << mk_pp(m_lemma_proof, m) << "\n";);
m_new_proofs.reset();
reset();
}
void conflict_resolution::process_antecedent_for_unsat_core(literal antecedent) {
bool_var var = antecedent.var();
CTRACE("conflict", !m_ctx.is_marked(var), tout << "processing antecedent: ";
CTRACE(conflict, !m_ctx.is_marked(var), tout << "processing antecedent: ";
m_ctx.display_literal_info(tout << antecedent << " ", antecedent);
tout << "\n";);
@ -1406,13 +1406,13 @@ namespace smt {
}
while (true) {
TRACE("unsat_core_trail", tout << consequent << ", idx: " << idx << " " << js.get_kind() << "\n";
TRACE(unsat_core_trail, tout << consequent << ", idx: " << idx << " " << js.get_kind() << "\n";
m_ctx.display_literal_smt2(tout, consequent) << "\n";
);
switch (js.get_kind()) {
case b_justification::CLAUSE: {
clause * cls = js.get_clause();
TRACE("unsat_core_bug", m_ctx.display_clause_detail(tout, cls););
TRACE(unsat_core_bug, m_ctx.display_clause_detail(tout, cls););
unsigned num_lits = cls->get_num_literals();
unsigned i = 0;
if (consequent != false_literal) {
@ -1453,7 +1453,7 @@ namespace smt {
}
while (idx >= 0) {
literal l = m_assigned_literals[idx];
CTRACE("unsat_core_bug", m_ctx.is_marked(l.var()), tout << "l: " << l << ", get_assign_level(l): " << m_ctx.get_assign_level(l) << "\n";);
CTRACE(unsat_core_bug, m_ctx.is_marked(l.var()), tout << "l: " << l << ", get_assign_level(l): " << m_ctx.get_assign_level(l) << "\n";);
if (m_ctx.get_assign_level(l) < search_lvl)
goto end_unsat_core;
if (m_ctx.is_marked(l.var()))
@ -1473,7 +1473,7 @@ namespace smt {
}
end_unsat_core:
TRACE("unsat_core", tout << "assumptions:\n"; m_ctx.display_literals(tout, m_assumptions); tout << "\n";);
TRACE(unsat_core, tout << "assumptions:\n"; m_ctx.display_literals(tout, m_assumptions); tout << "\n";);
reset_unmark_and_justifications(0, 0);
}

View file

@ -125,7 +125,7 @@ namespace smt {
std::swap(n1, n2);
enode_pair p(n1, n2);
if (m_already_processed_eqs.insert_if_not_there(p)) {
TRACE("conflict_detail_verbose", tout << "marking eq #" << p.first->get_owner_id() << " = #" <<
TRACE(conflict_detail_verbose, tout << "marking eq #" << p.first->get_owner_id() << " = #" <<
p.second->get_owner_id() << "\n";);
m_todo_eqs.push_back(p);
SASSERT(m_already_processed_eqs.contains(p));

View file

@ -52,7 +52,7 @@ namespace smt {
expr_ref fml(m);
if (lit == true_literal) return;
expr* e = bool_var2expr(lit.var());
TRACE("context", tout << mk_pp(e, m) << "\n";);
TRACE(context, tout << mk_pp(e, m) << "\n";);
index_set s;
if (assumptions.contains(lit.var())) {
s.insert(lit.var());
@ -99,7 +99,7 @@ namespace smt {
void context::justify(literal lit, index_set& s) {
(void)m;
auto add_antecedent = [&](literal l) {
CTRACE("context", !m_antecedents.contains(l.var()),
CTRACE(context, !m_antecedents.contains(l.var()),
tout << "untracked literal: " << l << " "
<< mk_pp(bool_var2expr(l.var()), m) << "\n";);
if (m_antecedents.contains(l.var())) {
@ -167,7 +167,7 @@ namespace smt {
expr* v = kv.m_value;
if (m.is_bool(k)) {
literal lit = get_literal(k);
TRACE("context",
TRACE(context,
tout << "checking " << mk_pp(k, m) << " "
<< mk_pp(v, m) << " " << get_assignment(lit) << "\n";
display(tout);
@ -214,7 +214,7 @@ namespace smt {
// next rounds.
//
unsigned context::extract_fixed_eqs(expr_ref_vector& conseq) {
TRACE("context", tout << "extract fixed consequences\n";);
TRACE(context, tout << "extract fixed consequences\n";);
auto are_equal = [&](expr* k, expr* v) {
return e_internalized(k) &&
e_internalized(v) &&
@ -245,7 +245,7 @@ namespace smt {
literal lit = mk_diseq(k, v);
literals.push_back(~lit);
mk_clause(literals.size(), literals.data(), nullptr);
TRACE("context", display_literals_verbose(tout, literals.size(), literals.data()););
TRACE(context, display_literals_verbose(tout, literals.size(), literals.data()););
}
}
for (expr* e : to_delete) {
@ -339,7 +339,7 @@ namespace smt {
lbool is_sat = check(assumptions.size(), assumptions.data());
if (is_sat != l_true) {
TRACE("context", tout << is_sat << "\n";);
TRACE(context, tout << is_sat << "\n";);
return is_sat;
}
if (m_qmanager->has_quantifiers()) {
@ -347,14 +347,14 @@ namespace smt {
return l_undef;
}
TRACE("context", display(tout););
TRACE(context, display(tout););
model_ref mdl;
get_model(mdl);
expr_ref_vector trail(m);
model_evaluator eval(*mdl.get());
expr_ref val(m);
TRACE("context", model_pp(tout, *mdl););
TRACE(context, model_pp(tout, *mdl););
for (expr* v : vars) {
eval(v, val);
if (m.is_value(val)) {
@ -368,7 +368,7 @@ namespace smt {
unsigned num_units = 0;
extract_fixed_consequences(num_units, _assumptions, conseq);
app_ref eq(m);
TRACE("context",
TRACE(context,
tout << "vars: " << vars.size() << "\n";
tout << "lits: " << num_units << "\n";);
pop_to_base_lvl();
@ -432,14 +432,14 @@ namespace smt {
m_not_l = null_literal;
}
if (is_sat == l_true) {
TRACE("context", display(tout););
TRACE(context, display(tout););
delete_unfixed(unfixed);
}
extract_fixed_consequences(num_units, _assumptions, conseq);
num_fixed_eqs += extract_fixed_eqs(conseq);
IF_VERBOSE(1, display_consequence_progress(verbose_stream(), num_iterations, m_var2val.size(), conseq.size(),
unfixed.size(), num_fixed_eqs););
TRACE("context", display_consequence_progress(tout, num_iterations, m_var2val.size(), conseq.size(),
TRACE(context, display_consequence_progress(tout, num_iterations, m_var2val.size(), conseq.size(),
unfixed.size(), num_fixed_eqs););
}
@ -644,7 +644,7 @@ namespace smt {
for (expr* a : assumptions) {
assert_expr(a);
}
TRACE("context", tout << "checking fixed: " << mk_pp(c, m) << "\n";);
TRACE(context, tout << "checking fixed: " << mk_pp(c, m) << "\n";);
tmp = m.mk_not(c);
assert_expr(tmp);
VERIFY(check() != l_true);
@ -655,7 +655,7 @@ namespace smt {
push();
for (expr* a : assumptions)
assert_expr(a);
TRACE("context", tout << "checking unfixed: " << mk_pp(uf, m) << "\n";);
TRACE(context, tout << "checking unfixed: " << mk_pp(uf, m) << "\n";);
lbool is_sat = check();
SASSERT(is_sat != l_false);
if (is_sat == l_true) {

File diff suppressed because it is too large Load diff

View file

@ -1201,7 +1201,7 @@ namespace smt {
if (act > ACTIVITY_LIMIT)
rescale_bool_var_activity();
m_case_split_queue->activity_increased_eh(v);
TRACE("case_split", tout << "v" << v << " " << m_bvar_inc << " -> " << act << "\n";);
TRACE(case_split, tout << "v" << v << " " << m_bvar_inc << " -> " << act << "\n";);
}
protected:

View file

@ -55,7 +55,7 @@ namespace smt {
watch_list::clause_iterator end = wl.end_clause();
for (; it != end; ++it) {
clause * cls = *it;
TRACE("watch_list", tout << "l: "; display_literal(tout, l); tout << "\n";
TRACE(watch_list, tout << "l: "; display_literal(tout, l); tout << "\n";
display_clause(tout, cls); tout << "\n";);
SASSERT(l == cls->get_literal(0) || l == cls->get_literal(1));
}
@ -92,7 +92,7 @@ namespace smt {
n->get_num_args() == 0 ||
(!is_true_eq && (!n->is_cgc_enabled() || n->is_cgr() == (m_cg_table.contains_ptr(n)))) ||
(is_true_eq && !m_cg_table.contains_ptr(n));
CTRACE("check_enode", !cg_inv,
CTRACE(check_enode, !cg_inv,
tout << "n: #" << n->get_expr_id() << ", m_cg: #" << n->m_cg->get_expr_id() << ", contains: " << m_cg_table.contains(n) << "\n"; display(tout););
SASSERT(cg_inv);
return true;
@ -116,7 +116,7 @@ namespace smt {
bool context::check_missing_clause_propagation(clause_vector const & v) const {
for (clause * cls : v) {
CTRACE("missing_propagation", is_unit_clause(cls), display_clause_detail(tout, cls); tout << "\n";);
CTRACE(missing_propagation, is_unit_clause(cls), display_clause_detail(tout, cls); tout << "\n";);
SASSERT(!is_unit_clause(cls));
}
return true;
@ -159,7 +159,7 @@ namespace smt {
if (n->get_root() != n2->get_root()) {
if (n->is_true_eq() && n2->is_true_eq())
continue;
CTRACE("missing_propagation", congruent(n, n2),
CTRACE(missing_propagation, congruent(n, n2),
tout << mk_pp(n->get_expr(), m) << "\n" << mk_pp(n2->get_expr(), m) << "\n";
display(tout););
SASSERT(!congruent(n, n2));
@ -174,7 +174,7 @@ namespace smt {
if (m.is_bool(n->get_expr()) && get_assignment(n) == l_undef) {
enode * first = n;
do {
CTRACE("missing_propagation", get_assignment(n) != l_undef,
CTRACE(missing_propagation, get_assignment(n) != l_undef,
tout << mk_pp(first->get_expr(), m) << "\nassignment: " << get_assignment(first) << "\n"
<< mk_pp(n->get_expr(), m) << "\nassignment: " << get_assignment(n) << "\n";);
SASSERT(get_assignment(n) == l_undef);
@ -209,17 +209,17 @@ namespace smt {
for (unsigned i = 0; i < sz; i++) {
expr * n = m_asserted_formulas.get_formula(i);
if (m.is_or(n)) {
CTRACE("relevancy_bug", !is_relevant(n), tout << "n: " << mk_ismt2_pp(n, m) << "\n";);
CTRACE(relevancy_bug, !is_relevant(n), tout << "n: " << mk_ismt2_pp(n, m) << "\n";);
SASSERT(is_relevant(n));
TRACE("check_relevancy", tout << "checking:\n" << mk_ll_pp(n, m) << "\n";);
TRACE(check_relevancy, tout << "checking:\n" << mk_ll_pp(n, m) << "\n";);
SASSERT(m_relevancy_propagator->check_relevancy_or(to_app(n), true));
}
else if (m.is_not(n)) {
CTRACE("relevancy_bug", !is_relevant(to_app(n)->get_arg(0)), tout << "n: " << mk_ismt2_pp(n, m) << "\n";);
CTRACE(relevancy_bug, !is_relevant(to_app(n)->get_arg(0)), tout << "n: " << mk_ismt2_pp(n, m) << "\n";);
SASSERT(is_relevant(to_app(n)->get_arg(0)));
}
else {
CTRACE("relevancy_bug", !is_relevant(n), tout << "n: " << mk_ismt2_pp(n, m) << "\n";);
CTRACE(relevancy_bug, !is_relevant(n), tout << "n: " << mk_ismt2_pp(n, m) << "\n";);
SASSERT(is_relevant(n));
}
}
@ -234,7 +234,7 @@ namespace smt {
for (enode* e : m_enodes) {
if (m.is_bool(e->get_expr())) {
enode * r = e->get_root();
CTRACE("eqc_bool", get_assignment(e) != get_assignment(r),
CTRACE(eqc_bool, get_assignment(e) != get_assignment(r),
tout << "#" << e->get_expr_id() << "\n" << mk_pp(e->get_expr(), m) << "\n";
tout << "#" << r->get_expr_id() << "\n" << mk_pp(r->get_expr(), m) << "\n";
tout << "assignments: " << get_assignment(e) << " " << get_assignment(r) << "\n";
@ -262,7 +262,7 @@ namespace smt {
(= get_enode(v1') get_enode(v2')) is congruent to (= lhs rhs).
*/
bool context::check_th_diseq_propagation() const {
TRACE("check_th_diseq_propagation", tout << "m_propagated_th_diseqs.size() " << m_propagated_th_diseqs.size() << "\n";);
TRACE(check_th_diseq_propagation, tout << "m_propagated_th_diseqs.size() " << m_propagated_th_diseqs.size() << "\n";);
unsigned num = get_num_bool_vars();
if (inconsistent() || get_manager().limit().is_canceled()) {
return true;
@ -271,20 +271,20 @@ namespace smt {
if (has_enode(v)) {
enode * n = bool_var2enode(v);
if (n->is_eq() && is_relevant(n) && get_assignment(v) == l_false && !m.is_iff(n->get_expr())) {
TRACE("check_th_diseq_propagation", tout << "checking: #" << n->get_expr_id() << " " << mk_bounded_pp(n->get_expr(), m) << "\n";);
TRACE(check_th_diseq_propagation, tout << "checking: #" << n->get_expr_id() << " " << mk_bounded_pp(n->get_expr(), m) << "\n";);
enode * lhs = n->get_arg(0)->get_root();
enode * rhs = n->get_arg(1)->get_root();
if (rhs->is_interpreted() && lhs->is_interpreted())
continue;
if (lhs == rhs)
continue;
TRACE("check_th_diseq_propagation", tout << "num. theory_vars: " << lhs->get_num_th_vars() << " "
TRACE(check_th_diseq_propagation, tout << "num. theory_vars: " << lhs->get_num_th_vars() << " "
<< mk_pp(lhs->get_expr()->get_sort(), m) << "\n";);
theory_var_list * l = lhs->get_th_var_list();
while (l) {
theory_id th_id = l->get_id();
theory * th = get_theory(th_id);
TRACE("check_th_diseq_propagation", tout << "checking theory: " << m.get_family_name(th_id) << "\n";);
TRACE(check_th_diseq_propagation, tout << "checking theory: " << m.get_family_name(th_id) << "\n";);
// if the theory doesn't use diseqs, then the diseqs are not propagated.
if (th->use_diseqs() && rhs->get_th_var(th_id) != null_theory_var) {
bool found = false;
@ -296,13 +296,13 @@ namespace smt {
if ((lhs == lhs_prime && rhs == rhs_prime) ||
(rhs == lhs_prime && lhs == rhs_prime)) {
TRACE("check_th_diseq_propagation", tout << "ok v" << v << " " << get_assignment(v) << "\n";);
TRACE(check_th_diseq_propagation, tout << "ok v" << v << " " << get_assignment(v) << "\n";);
found = true;
break;
}
}
}
CTRACE("check_th_diseq_propagation", !found,
CTRACE(check_th_diseq_propagation, !found,
tout
<< "checking theory: " << m.get_family_name(th_id) << "\n"
<< "root: #" << n->get_root()->get_expr_id() << " node: #" << n->get_expr_id() << "\n"
@ -324,7 +324,7 @@ namespace smt {
enode * n1 = p.first;
enode * n2 = p.second;
if (n1->get_root() == n2->get_root()) {
TRACE("diseq_bug",
TRACE(diseq_bug,
tout << "n1: #" << n1->get_expr_id() << ", n2: #" << n2->get_expr_id() <<
", r: #" << n1->get_root()->get_expr_id() << "\n";
tout << "n1 parents:\n"; display_parent_eqs(tout, n1);
@ -371,7 +371,7 @@ namespace smt {
case l_true:
if (!m_proto_model->eval(n, res, false))
return true;
CTRACE("model", !m.is_true(res), tout << n << " evaluates to " << res << "\n" << *m_proto_model << "\n";);
CTRACE(model, !m.is_true(res), tout << n << " evaluates to " << res << "\n" << *m_proto_model << "\n";);
if (m.is_false(res)) {
return false;
}
@ -379,7 +379,7 @@ namespace smt {
case l_false:
if (!m_proto_model->eval(n, res, false))
return true;
CTRACE("model", !m.is_false(res), tout << n << " evaluates to " << res << "\n" << *m_proto_model << "\n";);
CTRACE(model, !m.is_false(res), tout << n << " evaluates to " << res << "\n" << *m_proto_model << "\n";);
if (m.is_true(res)) {
return false;
}

View file

@ -468,7 +468,7 @@ namespace smt {
unsigned context::display_lemma_as_smt_problem(unsigned num_antecedents, literal const * antecedents, literal consequent, symbol const& logic) const {
std::string name = mk_lemma_name();
std::ofstream out(name);
TRACE("lemma", tout << name << "\n";);
TRACE(lemma, tout << name << "\n";);
display_lemma_as_smt_problem(out, num_antecedents, antecedents, consequent, logic);
out.close();
return m_lemma_id;
@ -524,7 +524,7 @@ namespace smt {
literal consequent, symbol const& logic) const {
std::string name = mk_lemma_name();
std::ofstream out(name);
TRACE("lemma", tout << name << "\n";
TRACE(lemma, tout << name << "\n";
display_lemma_as_smt_problem(tout, num_antecedents, antecedents, num_eq_antecedents, eq_antecedents, consequent, logic);
);
display_lemma_as_smt_problem(out, num_antecedents, antecedents, num_eq_antecedents, eq_antecedents, consequent, logic);

View file

@ -59,7 +59,7 @@ namespace smt {
if (update_children_parent)
arg->get_root()->m_parents.push_back(n);
}
TRACE("mk_enode_detail", tout << "new enode suppress_args: " << n->m_suppress_args << "\n";);
TRACE(mk_enode_detail, tout << "new enode suppress_args: " << n->m_suppress_args << "\n";);
SASSERT(n->m_suppress_args == suppress_args);
return n;
}

View file

@ -318,7 +318,7 @@ namespace smt {
}
expr_ref farkas_util::get() {
TRACE("arith",
TRACE(arith,
for (unsigned i = 0; i < m_coeffs.size(); ++i) {
tout << m_coeffs[i] << " * (" << mk_pp(m_ineqs[i].get(), m) << ") ";
}
@ -354,7 +354,7 @@ namespace smt {
res = extract_consequence(0, m_coeffs.size());
}
TRACE("arith",
TRACE(arith,
for (unsigned i = 0; i < m_coeffs.size(); ++i) {
tout << m_coeffs[i] << " * (" << mk_pp(m_ineqs[i].get(), m) << ") ";
}

View file

@ -38,7 +38,7 @@ namespace smt {
for (; it != end; ++it) {
symbol const & s = *it;
if (s.contains('@')) {
TRACE("for_each_relevant_expr", tout << "@ label: " << mk_pp(n, m_manager) << "\n";);
TRACE(for_each_relevant_expr, tout << "@ label: " << mk_pp(n, m_manager) << "\n";);
count += 1;
}
}
@ -74,7 +74,7 @@ namespace smt {
}
if (count > 1 && m_first) {
TRACE("for_each_relevant_expr", tout << mk_pp(n, m_manager) << "\n";);
TRACE(for_each_relevant_expr, tout << mk_pp(n, m_manager) << "\n";);
m_first = false;
}
@ -108,7 +108,7 @@ namespace smt {
}
if (count > 1 && m_first) {
TRACE("for_each_relevant_expr", tout << mk_pp(n, m_manager) << "\n";);
TRACE(for_each_relevant_expr, tout << mk_pp(n, m_manager) << "\n";);
m_first = false;
}
@ -121,7 +121,7 @@ namespace smt {
}
void for_each_relevant_expr::operator()(expr * n) {
TRACE("for_each_relevant_expr", tout << "#" << n->get_id() << "\n";);
TRACE(for_each_relevant_expr, tout << "#" << n->get_id() << "\n";);
}
void for_each_relevant_expr::reset() {
@ -140,8 +140,8 @@ namespace smt {
}
void for_each_relevant_expr::process(expr * n) {
TRACE("for_each_relevant_expr", tout << "processing:\n" << mk_bounded_pp(n, m_manager) << "\n";);
TRACE("for_each_relevant_expr", tout << "processing:\n" << mk_pp(n, m_manager) << "\n";);
TRACE(for_each_relevant_expr, tout << "processing:\n" << mk_bounded_pp(n, m_manager) << "\n";);
TRACE(for_each_relevant_expr, tout << "processing:\n" << mk_pp(n, m_manager) << "\n";);
if (m_cache.contains(n))
return;
m_todo.reset();
@ -196,7 +196,7 @@ namespace smt {
*/
void for_each_relevant_expr::process_relevant_child(app * n, lbool val) {
unsigned sz = n->get_num_args();
TRACE("for_each_relevant_expr", tout << val << " " << mk_bounded_pp(n, m_manager) << "\n";);
TRACE(for_each_relevant_expr, tout << val << " " << mk_bounded_pp(n, m_manager) << "\n";);
for (unsigned i = 0; i < sz; i++) {
expr * arg = n->get_arg(i);
if (!is_relevant(arg))
@ -204,7 +204,7 @@ namespace smt {
if (get_assignment(arg) != val)
continue;
if (m_cache.contains(arg)) {
TRACE("for_each_relevant_expr", tout << "justified by: " << mk_bounded_pp(arg, m_manager) << "\n";);
TRACE(for_each_relevant_expr, tout << "justified by: " << mk_bounded_pp(arg, m_manager) << "\n";);
return; // the current child justifies n.
}
}
@ -215,7 +215,7 @@ namespace smt {
if (get_assignment(arg) != val)
continue;
TRACE("for_each_relevant_expr", tout << "to_process: " << mk_bounded_pp(arg, m_manager) << "\n";);
TRACE(for_each_relevant_expr, tout << "to_process: " << mk_bounded_pp(arg, m_manager) << "\n";);
m_todo.push_back(arg);
return;
@ -271,7 +271,7 @@ namespace smt {
void collect_relevant_label_lits::operator()(expr * n) {
TRACE("for_each_relevant_expr",
TRACE(for_each_relevant_expr,
tout << "label: " << m_manager.is_label_lit(n) << " " << " " << get_assignment(n)
<< " " << mk_bounded_pp(n, m_manager) << "\n";);
if (!m_manager.is_label_lit(n))
@ -283,7 +283,7 @@ namespace smt {
void collect_relevant_labels::operator()(expr * n) {
bool pos;
TRACE("for_each_relevant_expr",
TRACE(for_each_relevant_expr,
tout << "label: " << m_manager.is_label(n) << " " << get_assignment(n)
<< " " << mk_bounded_pp(n, m_manager) << "\n";);
if (!m_manager.is_label(n, pos))

View file

@ -98,7 +98,7 @@ namespace {
m_solver.assert_expr(m.mk_not(m.mk_eq(s, t)));
bool is_eq = l_false == m_solver.check_sat(0,nullptr);
m_solver.pop(1);
TRACE("get_implied_equalities", tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << (is_eq?"eq":"unrelated") << "\n";);
TRACE(get_implied_equalities, tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << (is_eq?"eq":"unrelated") << "\n";);
if (is_eq) {
m_uf.merge(terms[i].id, terms[j].id);
if (!non_values.contains(j)) {
@ -126,7 +126,7 @@ namespace {
bool is_eq = l_false == m_solver.check_sat(0,nullptr);
m_solver.pop(1);
m_stats_timer.stop();
TRACE("get_implied_equalities", tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << (is_eq?"eq":"unrelated") << "\n";);
TRACE(get_implied_equalities, tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << (is_eq?"eq":"unrelated") << "\n";);
if (is_eq) {
m_uf.merge(terms[i].id, terms[j].id);
break;
@ -200,10 +200,10 @@ namespace {
for (unsigned i = 0; i < terms.size(); ++i) {
expr* t = terms[i].term;
vl = (*model)(t);
TRACE("get_implied_equalities", tout << mk_pp(t, m) << " |-> " << mk_pp(vl, m) << "\n";);
TRACE(get_implied_equalities, tout << mk_pp(t, m) << " |-> " << mk_pp(vl, m) << "\n";);
reduce_value(model, vl);
if (!m.is_value(vl)) {
TRACE("get_implied_equalities", tout << "Not a value: " << mk_pp(vl, m) << "\n";);
TRACE(get_implied_equalities, tout << "Not a value: " << mk_pp(vl, m) << "\n";);
non_values.insert(i);
continue;
}
@ -217,7 +217,7 @@ namespace {
m_solver.assert_expr(m.mk_not(m.mk_eq(t, s)));
lbool is_sat = m_solver.check_sat(0,nullptr);
m_solver.pop(1);
TRACE("get_implied_equalities", tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << is_sat << "\n";);
TRACE(get_implied_equalities, tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << is_sat << "\n";);
if (is_sat == l_false) {
found = true;
m_uf.merge(terms[i].id, terms[vec[j]].id);
@ -234,7 +234,7 @@ namespace {
if (!non_values.empty()) {
TRACE("get_implied_equalities", model_smt2_pp(tout, m, *model, 0););
TRACE(get_implied_equalities, model_smt2_pp(tout, m, *model, 0););
get_implied_equalities_filter_basic(non_values, terms);
//get_implied_equalities_basic(terms);
}
@ -351,7 +351,7 @@ namespace {
class_ids[term_ids[i].id] = m_uf.find(term_ids[i].id);
}
}
TRACE("get_implied_equalities",
TRACE(get_implied_equalities,
for (unsigned i = 0; i < num_terms; ++i) {
tout << mk_pp(terms[i], m) << " |-> " << class_ids[i] << "\n";
});

View file

@ -56,7 +56,7 @@ literal_vector collect_induction_literals::pre_select() {
continue;
result.push_back(lit);
}
TRACE("induction", ctx.display(tout << "literal index: " << m_literal_index << "\n" << result << "\n"););
TRACE(induction, ctx.display(tout << "literal index: " << m_literal_index << "\n" << result << "\n"););
ctx.push_trail(value_trail<unsigned>(m_literal_index));
m_literal_index = ctx.assigned_literals().size();

View file

@ -201,14 +201,14 @@ namespace smt {
// stack overflow.
// a caveat is that theory internalizers do rely on recursive descent so
// internalization over these follows top-down
TRACE("deep_internalize", tout << "expression is deep: #" << n->get_id() << "\n" << mk_ll_pp(n, m););
TRACE(deep_internalize, tout << "expression is deep: #" << n->get_id() << "\n" << mk_ll_pp(n, m););
ts_todo.push_back(expr_bool_pair(n, true));
}
}
svector<expr_bool_pair> sorted_exprs;
top_sort_expr(exprs, num_exprs, sorted_exprs);
TRACE("deep_internalize", for (auto & kv : sorted_exprs) tout << "#" << kv.first->get_id() << " " << kv.second << "\n"; );
TRACE(deep_internalize, for (auto & kv : sorted_exprs) tout << "#" << kv.first->get_id() << " " << kv.second << "\n"; );
for (auto & kv : sorted_exprs) {
expr* e = kv.first;
SASSERT(should_internalize_rec(e));
@ -226,10 +226,10 @@ namespace smt {
\remark pr is 0 if proofs are disabled.
*/
void context::internalize_assertion(expr * n, proof * pr, unsigned generation) {
TRACE("internalize_assertion", tout << mk_pp(n, m) << "\n";);
TRACE("internalize_assertion_ll", tout << mk_ll_pp(n, m) << "\n";);
TRACE("generation", tout << "generation: " << m_generation << "\n";);
TRACE("incompleteness_bug", tout << "[internalize-assertion]: #" << n->get_id() << "\n";);
TRACE(internalize_assertion, tout << mk_pp(n, m) << "\n";);
TRACE(internalize_assertion_ll, tout << mk_ll_pp(n, m) << "\n";);
TRACE(generation, tout << "generation: " << m_generation << "\n";);
TRACE(incompleteness_bug, tout << "[internalize-assertion]: #" << n->get_id() << "\n";);
flet<unsigned> l(m_generation, generation);
m_stats.m_max_generation = std::max(m_generation, m_stats.m_max_generation);
internalize_deep(n);
@ -312,7 +312,7 @@ namespace smt {
#define DISTINCT_SZ_THRESHOLD 32
void context::assert_distinct(app * n, proof * pr) {
TRACE("assert_distinct", tout << mk_pp(n, m) << "\n";);
TRACE(assert_distinct, tout << mk_pp(n, m) << "\n";);
unsigned num_args = n->get_num_args();
if (num_args == 0 || num_args <= DISTINCT_SZ_THRESHOLD || m.proofs_enabled()) {
assert_default(n, pr);
@ -327,7 +327,7 @@ namespace smt {
enode * e = mk_enode(val, false, false, true);
e->mark_as_interpreted();
app_ref eq(m.mk_eq(fapp, val), m);
TRACE("assert_distinct", tout << "eq: " << mk_pp(eq, m) << "\n";);
TRACE(assert_distinct, tout << "eq: " << mk_pp(eq, m) << "\n";);
assert_default(eq, nullptr);
mark_as_relevant(eq.get());
// TODO: we may want to hide the auxiliary values val and the function f from the model.
@ -366,8 +366,8 @@ namespace smt {
}
void context::internalize_rec(expr * n, bool gate_ctx) {
TRACE("internalize", tout << "internalizing:\n" << mk_pp(n, m) << "\n";);
TRACE("internalize_bug", tout << "internalizing:\n" << mk_bounded_pp(n, m) << "\n";);
TRACE(internalize, tout << "internalizing:\n" << mk_pp(n, m) << "\n";);
TRACE(internalize_bug, tout << "internalizing:\n" << mk_bounded_pp(n, m) << "\n";);
if (is_var(n)) {
throw default_exception("Formulas should not contain unbound variables");
}
@ -388,7 +388,7 @@ namespace smt {
\brief Internalize the given formula into the logical context.
*/
void context::internalize_formula(expr * n, bool gate_ctx) {
TRACE("internalize_bug", tout << "internalize formula: #" << n->get_id() << ", gate_ctx: " << gate_ctx << "\n" << mk_pp(n, m) << "\n";);
TRACE(internalize_bug, tout << "internalize formula: #" << n->get_id() << ", gate_ctx: " << gate_ctx << "\n" << mk_pp(n, m) << "\n";);
SASSERT(m.is_bool(n));
if (m.is_true(n) || m.is_false(n))
return;
@ -403,19 +403,19 @@ namespace smt {
if (b_internalized(n)) {
// n was already internalized as a boolean.
bool_var v = get_bool_var(n);
TRACE("internalize_bug", tout << "#" << n->get_id() << " already has bool_var v" << v << "\n";);
TRACE(internalize_bug, tout << "#" << n->get_id() << " already has bool_var v" << v << "\n";);
// n was already internalized as boolean, but an enode was
// not associated with it. So, an enode is necessary, if
// n is not in the context of a gate and is an application.
if (!gate_ctx && is_app(n)) {
if (e_internalized(n)) {
TRACE("internalize_bug", tout << "forcing enode #" << n->get_id() << " to merge with t/f\n";);
TRACE(internalize_bug, tout << "forcing enode #" << n->get_id() << " to merge with t/f\n";);
enode * e = get_enode(to_app(n));
set_merge_tf(e, v, false);
}
else {
TRACE("internalize_bug", tout << "creating enode for #" << n->get_id() << "\n";);
TRACE(internalize_bug, tout << "creating enode for #" << n->get_id() << "\n";);
mk_enode(to_app(n),
true, /* suppress arguments, we not not use CC for this kind of enode */
true, /* bool enode must be merged with true/false, since it is not in the context of a gate */
@ -451,7 +451,7 @@ namespace smt {
bool_var v = get_bool_var(n);
bool_var_data & d = get_bdata(v);
d.set_eq_flag();
TRACE("internalize", tout << mk_pp(n, m) << " " << literal(v, false) << "\n";);
TRACE(internalize, tout << mk_pp(n, m) << " " << literal(v, false) << "\n";);
sort * s = n->get_arg(0)->get_sort();
theory * th = m_theories.get_plugin(s->get_family_id());
@ -463,7 +463,7 @@ namespace smt {
\brief Internalize distinct constructor.
*/
void context::internalize_distinct(app * n, bool gate_ctx) {
TRACE("distinct", tout << "internalizing distinct: " << mk_pp(n, m) << "\n";);
TRACE(distinct, tout << "internalizing distinct: " << mk_pp(n, m) << "\n";);
SASSERT(!b_internalized(n));
SASSERT(m.is_distinct(n));
bool_var v = mk_bool_var(n);
@ -493,12 +493,12 @@ namespace smt {
bool context::internalize_theory_atom(app * n, bool gate_ctx) {
SASSERT(!b_internalized(n));
theory * th = m_theories.get_plugin(n->get_family_id());
TRACE("datatype_bug", tout << "internalizing theory atom:\n" << mk_pp(n, m) << "\n";);
TRACE(datatype_bug, tout << "internalizing theory atom:\n" << mk_pp(n, m) << "\n";);
if (!th || !th->internalize_atom(n, gate_ctx))
return false;
TRACE("datatype_bug", tout << "internalization succeeded\n" << mk_pp(n, m) << "\n";);
TRACE(datatype_bug, tout << "internalization succeeded\n" << mk_pp(n, m) << "\n";);
SASSERT(b_internalized(n));
TRACE("internalize_theory_atom", tout << "internalizing theory atom: #" << n->get_id() << "\n";);
TRACE(internalize_theory_atom, tout << "internalizing theory atom: #" << n->get_id() << "\n";);
bool_var v = get_bool_var(n);
if (!gate_ctx) {
// if the formula is not in the context of a gate, then it
@ -561,8 +561,8 @@ namespace smt {
context.
*/
void context::internalize_quantifier(quantifier * q, bool gate_ctx) {
TRACE("internalize_quantifier", tout << mk_pp(q, m) << "\n";);
CTRACE("internalize_quantifier_zero", q->get_weight() == 0, tout << mk_pp(q, m) << "\n";);
TRACE(internalize_quantifier, tout << mk_pp(q, m) << "\n";);
CTRACE(internalize_quantifier_zero, q->get_weight() == 0, tout << mk_pp(q, m) << "\n";);
SASSERT(gate_ctx); // limitation of the current implementation
SASSERT(!b_internalized(q));
if (!is_forall(q))
@ -583,7 +583,7 @@ namespace smt {
void context::internalize_lambda(quantifier * q) {
TRACE("internalize_quantifier", tout << mk_pp(q, m) << "\n";);
TRACE(internalize_quantifier, tout << mk_pp(q, m) << "\n";);
SASSERT(is_lambda(q));
if (e_internalized(q))
return;
@ -617,12 +617,12 @@ namespace smt {
bool context::has_lambda() {
for (auto const & [n, q] : m_lambdas) {
if (n->get_class_size() != 1) {
TRACE("context", tout << "class size " << n->get_class_size() << " " << enode_pp(n, *this) << "\n");
TRACE(context, tout << "class size " << n->get_class_size() << " " << enode_pp(n, *this) << "\n");
return true;
}
for (enode* p : enode::parents(n))
if (!is_beta_redex(p, n)) {
TRACE("context", tout << "not a beta redex " << enode_pp(p, *this) << "\n");
TRACE(context, tout << "not a beta redex " << enode_pp(p, *this) << "\n");
return true;
}
}
@ -636,7 +636,7 @@ namespace smt {
SASSERT(!b_internalized(n));
SASSERT(!e_internalized(n));
CTRACE("resolve_conflict_crash", m.is_not(n), tout << mk_ismt2_pp(n, m) << "\ngate_ctx: " << gate_ctx << "\n";);
CTRACE(resolve_conflict_crash, m.is_not(n), tout << mk_ismt2_pp(n, m) << "\ngate_ctx: " << gate_ctx << "\n";);
bool _is_gate = is_gate(m, n) || m.is_not(n);
// process args
@ -644,7 +644,7 @@ namespace smt {
internalize_rec(arg, _is_gate);
}
CTRACE("internalize_bug", b_internalized(n), tout << mk_ll_pp(n, m) << "\n";);
CTRACE(internalize_bug, b_internalized(n), tout << mk_ll_pp(n, m) << "\n";);
bool is_new_var = false;
bool_var v;
@ -720,7 +720,7 @@ namespace smt {
}
}
CTRACE("internalize_bug", e_internalized(n),
CTRACE(internalize_bug, e_internalized(n),
tout << "#" << n->get_id() << ", merge_tf: " << get_enode(n)->merge_tf() << "\n";);
}
@ -864,7 +864,7 @@ namespace smt {
literal c_lit = get_literal(c);
literal eq1_lit = get_literal(eq1);
literal eq2_lit = get_literal(eq2);
TRACE("internalize_ite_term_bug",
TRACE(internalize_ite_term_bug,
tout << mk_ismt2_pp(n, m) << "\n";
tout << mk_ismt2_pp(c, m) << "\n";
tout << mk_ismt2_pp(t, m) << "\n";
@ -876,7 +876,7 @@ namespace smt {
mk_gate_clause( c_lit, eq2_lit);
if (relevancy()) {
relevancy_eh * eh = m_relevancy_propagator->mk_term_ite_relevancy_eh(n, eq1, eq2);
TRACE("ite_term_relevancy", tout << "#" << n->get_id() << " #" << eq1->get_id() << " #" << eq2->get_id() << "\n";);
TRACE(ite_term_relevancy, tout << "#" << n->get_id() << " #" << eq1->get_id() << " #" << eq2->get_id() << "\n";);
add_rel_watch(c_lit, eh);
add_rel_watch(~c_lit, eh);
add_relevancy_eh(n, eh);
@ -923,8 +923,8 @@ namespace smt {
//SASSERT(!m.is_not(n));
unsigned id = n->get_id();
bool_var v = m_b_internalized_stack.size();
TRACE("mk_bool_var", tout << "creating boolean variable: " << v << " for:\n" << mk_pp(n, m) << " " << n->get_id() << "\n";);
TRACE("mk_var_bug", tout << "mk_bool: " << v << "\n";);
TRACE(mk_bool_var, tout << "creating boolean variable: " << v << " for:\n" << mk_pp(n, m) << " " << n->get_id() << "\n";);
TRACE(mk_var_bug, tout << "mk_bool: " << v << "\n";);
set_bool_var(id, v);
m_bdata.reserve(v+1);
m_activity.reserve(v+1);
@ -965,9 +965,9 @@ namespace smt {
unsigned n_id = n->get_id();
bool_var v = get_bool_var_of_id(n_id);
m_bool_var2expr[v] = nullptr;
TRACE("undo_mk_bool_var", tout << "undo_bool: " << v << "\n" << mk_pp(n, m) << "\n" << "m_bdata.size: " << m_bdata.size()
TRACE(undo_mk_bool_var, tout << "undo_bool: " << v << "\n" << mk_pp(n, m) << "\n" << "m_bdata.size: " << m_bdata.size()
<< " m_assignment.size: " << m_assignment.size() << "\n";);
TRACE("mk_var_bug", tout << "undo_mk_bool: " << v << "\n";);
TRACE(mk_var_bug, tout << "undo_mk_bool: " << v << "\n";);
// bool_var_data & d = m_bdata[v];
m_case_split_queue->del_var_eh(v);
if (is_quantifier(n))
@ -983,7 +983,7 @@ namespace smt {
in the egraph.
*/
enode * context::mk_enode(app * n, bool suppress_args, bool merge_tf, bool cgc_enabled) {
TRACE("mk_enode_detail", tout << mk_pp(n, m) << "\nsuppress_args: " << suppress_args << ", merge_tf: " <<
TRACE(mk_enode_detail, tout << mk_pp(n, m) << "\nsuppress_args: " << suppress_args << ", merge_tf: " <<
merge_tf << ", cgc_enabled: " << cgc_enabled << "\n";);
SASSERT(!e_internalized(n));
unsigned id = n->get_id();
@ -991,15 +991,15 @@ namespace smt {
unsigned _generation = 0;
if (!m_cached_generation.empty() && m_cached_generation.find(n, _generation)) {
generation = _generation;
CTRACE("cached_generation", generation != m_generation,
CTRACE(cached_generation, generation != m_generation,
tout << "cached_generation: #" << n->get_id() << " " << generation << " " << m_generation << "\n";);
}
enode * e = enode::mk(m, m_region, m_app2enode, n, generation, suppress_args, merge_tf, m_scope_lvl, cgc_enabled, true);
TRACE("mk_enode_detail", tout << "e.get_num_args() = " << e->get_num_args() << "\n";);
TRACE(mk_enode_detail, tout << "e.get_num_args() = " << e->get_num_args() << "\n";);
if (m.is_unique_value(n))
e->mark_as_interpreted();
TRACE("mk_var_bug", tout << "mk_enode: " << id << "\n";);
TRACE("generation", tout << "mk_enode: " << id << " " << generation << "\n";);
TRACE(mk_var_bug, tout << "mk_enode: " << id << "\n";);
TRACE(generation, tout << "mk_enode: " << id << " " << generation << "\n";);
m_app2enode.setx(id, e, nullptr);
m_e_internalized_stack.push_back(n);
m_trail_stack.push_back(&m_mk_enode_trail);
@ -1037,12 +1037,12 @@ namespace smt {
}
SASSERT(e_internalized(n));
m_stats.m_num_mk_enode++;
TRACE("mk_enode", tout << "created enode: #" << e->get_owner_id() << " for:\n" << mk_pp(n, m) << "\n";
TRACE(mk_enode, tout << "created enode: #" << e->get_owner_id() << " for:\n" << mk_pp(n, m) << "\n";
if (e->get_num_args() > 0) {
tout << "is_true_eq: " << e->is_true_eq() << " in cg_table: " << m_cg_table.contains_ptr(e) << " is_cgr: "
<< e->is_cgr() << "\n";
});
SCTRACE("causality", m_coming_from_quant, tout << "EN: #" << e->get_owner_id() << "\n";);
SCTRACE(causality, m_coming_from_quant, tout << "EN: #" << e->get_owner_id() << "\n";);
if (m.has_trace_stream())
m.trace_stream() << "[attach-enode] #" << n->get_id() << " " << m_generation << "\n";
@ -1062,8 +1062,8 @@ namespace smt {
SASSERT(!m_e_internalized_stack.empty());
m_stats.m_num_del_enode++;
expr * n = m_e_internalized_stack.back();
TRACE("undo_mk_enode", tout << "undo_enode: #" << n->get_id() << "\n" << mk_pp(n, m) << "\n";);
TRACE("mk_var_bug", tout << "undo_mk_enode: " << n->get_id() << "\n";);
TRACE(undo_mk_enode, tout << "undo_enode: #" << n->get_id() << "\n" << mk_pp(n, m) << "\n";);
TRACE(mk_var_bug, tout << "undo_mk_enode: " << n->get_id() << "\n";);
unsigned n_id = n->get_id();
SASSERT(is_app(n));
enode * e = m_app2enode[n_id];
@ -1135,7 +1135,7 @@ namespace smt {
clauses because they are deleted during backtracking.
*/
bool context::simplify_aux_clause_literals(unsigned & num_lits, literal * lits, literal_buffer & simp_lits) {
TRACE("simplify_aux_clause_literals", display_literals(tout, num_lits, lits); tout << "\n";);
TRACE(simplify_aux_clause_literals, display_literals(tout, num_lits, lits); tout << "\n";);
std::sort(lits, lits + num_lits);
literal prev = null_literal;
unsigned j = 0;
@ -1144,7 +1144,7 @@ namespace smt {
lbool val = get_assignment(curr);
switch (val) {
case l_false:
TRACE("simplify_aux_clause_literals", display_literal_verbose(tout << get_assign_level(curr) << " " << get_scope_level() << " " << curr << ":", curr); tout << "\n"; );
TRACE(simplify_aux_clause_literals, display_literal_verbose(tout << get_assign_level(curr) << " " << get_scope_level() << " " << curr << ":", curr); tout << "\n"; );
if (curr != prev) {
prev = curr;
simp_lits.push_back(~curr);
@ -1191,9 +1191,9 @@ namespace smt {
kind of simplification.
*/
bool context::simplify_aux_lemma_literals(unsigned & num_lits, literal * lits) {
TRACE("simplify_aux_lemma_literals", display_literals(tout << "1) ", num_lits, lits) << "\n";);
TRACE(simplify_aux_lemma_literals, display_literals(tout << "1) ", num_lits, lits) << "\n";);
std::sort(lits, lits + num_lits);
TRACE("simplify_aux_lemma_literals", display_literals(tout << "2) ", num_lits, lits) << "\n";);
TRACE(simplify_aux_lemma_literals, display_literals(tout << "2) ", num_lits, lits) << "\n";);
literal prev = null_literal;
unsigned i = 0;
unsigned j = 0;
@ -1215,7 +1215,7 @@ namespace smt {
}
}
num_lits = j;
TRACE("simplify_aux_lemma_literals", display_literals(tout << "3) ", num_lits, lits) << "\n";);
TRACE(simplify_aux_lemma_literals, display_literals(tout << "3) ", num_lits, lits) << "\n";);
return true;
}
@ -1379,7 +1379,7 @@ namespace smt {
The deletion event handler is ignored if binary clause optimization is applicable.
*/
clause * context::mk_clause(unsigned num_lits, literal * lits, justification * j, clause_kind k, clause_del_eh * del_eh) {
TRACE("mk_clause", display_literals_verbose(tout << "creating clause: " << literal_vector(num_lits, lits) << "\n", num_lits, lits) << "\n";);
TRACE(mk_clause, display_literals_verbose(tout << "creating clause: " << literal_vector(num_lits, lits) << "\n", num_lits, lits) << "\n";);
m_clause_proof.add(num_lits, lits, k, j);
literal_buffer simp_lits;
switch (k) {
@ -1420,7 +1420,7 @@ namespace smt {
default:
break;
}
TRACE("mk_clause", display_literals_verbose(tout << "after simplification: " << literal_vector(num_lits, lits) << "\n", num_lits, lits) << "\n";);
TRACE(mk_clause, display_literals_verbose(tout << "after simplification: " << literal_vector(num_lits, lits) << "\n", num_lits, lits) << "\n";);
unsigned activity = 1;
bool lemma = is_lemma(k);
@ -1430,7 +1430,7 @@ namespace smt {
case 0:
if (j && !j->in_region())
m_justifications.push_back(j);
TRACE("mk_clause", tout << "empty clause... setting conflict\n";);
TRACE(mk_clause, tout << "empty clause... setting conflict\n";);
set_conflict(j == nullptr ? b_justification::mk_axiom() : b_justification(j));
SASSERT(inconsistent());
return nullptr;
@ -1482,7 +1482,7 @@ namespace smt {
cls->swap_lits(0, w1_idx);
int w2_idx = select_watch_lit(cls, 1);
cls->swap_lits(1, w2_idx);
TRACE("mk_th_lemma", display_clause(tout, cls); tout << "\n";);
TRACE(mk_th_lemma, display_clause(tout, cls); tout << "\n";);
}
// display_clause(std::cout, cls); std::cout << "\n";
m_lemmas.push_back(cls);
@ -1517,8 +1517,8 @@ namespace smt {
add_lit_occs(*cls);
TRACE("add_watch_literal_bug", display_clause_detail(tout, cls););
TRACE("mk_clause_result", display_clause_detail(tout, cls););
TRACE(add_watch_literal_bug, display_clause_detail(tout, cls););
TRACE(mk_clause_result, display_clause_detail(tout, cls););
CASSERT("mk_clause", check_clause(cls));
return cls;
}}
@ -1559,7 +1559,7 @@ namespace smt {
void context::mk_th_clause(theory_id tid, unsigned num_lits, literal * lits, unsigned num_params, parameter * params, clause_kind k) {
justification * js = nullptr;
TRACE("mk_th_axiom", display_literals_verbose(tout, num_lits, lits) << "\n";);
TRACE(mk_th_axiom, display_literals_verbose(tout, num_lits, lits) << "\n";);
if (m.proofs_enabled()) {
js = mk_justification(theory_axiom_justification(tid, *this, num_lits, lits, num_params, params));
@ -1600,7 +1600,7 @@ namespace smt {
void context::mk_gate_clause(unsigned num_lits, literal * lits) {
if (m.proofs_enabled()) {
proof * pr = mk_clause_def_axiom(num_lits, lits, nullptr);
TRACE("gate_clause", tout << mk_ll_pp(pr, m););
TRACE(gate_clause, tout << mk_ll_pp(pr, m););
mk_clause(num_lits, lits, mk_justification(justification_proof_wrapper(*this, pr)));
}
else if (clause_proof_active()) {
@ -1641,7 +1641,7 @@ namespace smt {
expr * fact = m.get_fact(pr);
if (!m.is_or(fact)) {
proof * def = mk_clause_def_axiom(num_lits, lits, m.get_fact(pr));
TRACE("gate_clause", tout << mk_ll_pp(def, m) << "\n";
TRACE(gate_clause, tout << mk_ll_pp(def, m) << "\n";
tout << mk_ll_pp(pr, m););
proof * prs[2] = { def, pr };
pr = m.mk_unit_resolution(2, prs);
@ -1692,7 +1692,7 @@ namespace smt {
relevancy_eh * eh = m_relevancy_propagator->mk_ite_relevancy_eh(n);
literal l = get_literal(n->get_arg(0));
// when the condition of an ite is assigned to true or false, the ite-parent must be notified.
TRACE("propagate_relevant_ite", tout << "#" << n->get_id() << ", eh: " << eh << "\n";);
TRACE(propagate_relevant_ite, tout << "#" << n->get_id() << ", eh: " << eh << "\n";);
add_rel_watch(l, eh);
add_rel_watch(~l, eh);
}
@ -1709,12 +1709,12 @@ namespace smt {
void context::mk_and_cnstr(app * n) {
literal l = get_literal(n);
TRACE("mk_and_cnstr", tout << "l: "; display_literal(tout, l); tout << "\n";);
TRACE(mk_and_cnstr, tout << "l: "; display_literal(tout, l); tout << "\n";);
literal_buffer buffer;
buffer.push_back(l);
for (expr * arg : *n) {
literal l_arg = get_literal(arg);
TRACE("mk_and_cnstr", tout << "l_arg: "; display_literal(tout, l_arg); tout << "\n";);
TRACE(mk_and_cnstr, tout << "l_arg: "; display_literal(tout, l_arg); tout << "\n";);
mk_gate_clause(~l, l_arg);
buffer.push_back(~l_arg);
}
@ -1740,7 +1740,7 @@ namespace smt {
literal l1 = get_literal(n->get_arg(0));
literal l2 = get_literal(n->get_arg(1));
if (sign) l.neg();
TRACE("mk_iff_cnstr", tout << "l: " << l << ", l1: " << l1 << ", l2: " << l2 << "\n";);
TRACE(mk_iff_cnstr, tout << "l: " << l << ", l1: " << l1 << ", l2: " << l2 << "\n";);
mk_gate_clause(~l, l1, ~l2);
mk_gate_clause(~l, ~l1 , l2);
mk_gate_clause( l, l1, l2);

View file

@ -50,7 +50,7 @@ namespace smt {
auto& r = ctx.get_region();
m_literals = new (r) literal[num_lits];
memcpy(m_literals, lits, sizeof(literal) * num_lits);
TRACE("unit_resolution_justification_bug", tout << literal_vector(num_lits, lits) << "\n";);
TRACE(unit_resolution_justification_bug, tout << literal_vector(num_lits, lits) << "\n";);
SASSERT(m_num_literals > 0);
}
@ -63,7 +63,7 @@ namespace smt {
SASSERT(!js || !js->in_region());
m_literals = alloc_vect<literal>(num_lits);
memcpy(m_literals, lits, sizeof(literal) * num_lits);
TRACE("unit_resolution_justification_bug", tout << literal_vector(num_lits, lits) << "\n";);
TRACE(unit_resolution_justification_bug, tout << literal_vector(num_lits, lits) << "\n";);
SASSERT(num_lits != 0);
}
@ -97,7 +97,7 @@ namespace smt {
else
prs.push_back(pr);
}
TRACE("unit_resolution_justification_bug",
TRACE(unit_resolution_justification_bug,
tout << "in mk_proof\n" << literal_vector(m_num_literals, m_literals) << "\n";
for (proof* p : prs) tout << mk_ll_pp(m.get_fact(p), m););
return m.mk_unit_resolution(prs.size(), prs.data());
@ -231,7 +231,7 @@ namespace smt {
}
pr = m.mk_modus_ponens(pr2, pr1);
TRACE("mp_iff_justification", tout << mk_pp(fact1, m) << "\n" << mk_pp(fact2, m) << "\n" <<
TRACE(mp_iff_justification, tout << mk_pp(fact1, m) << "\n" << mk_pp(fact2, m) << "\n" <<
mk_pp(m.get_fact(pr), m) << "\n";);
return pr;
}

View file

@ -127,7 +127,7 @@ namespace smt {
lbool kernel::check(unsigned num_assumptions, expr * const * assumptions) {
lbool r = m_imp->m_kernel.check(num_assumptions, assumptions);
TRACE("smt_kernel", tout << "check result: " << r << "\n";);
TRACE(smt_kernel, tout << "check result: " << r << "\n";);
return r;
}

View file

@ -165,12 +165,12 @@ namespace smt {
bool model_checker::assert_neg_q_m(quantifier * q, expr_ref_vector & sks) {
expr_ref tmp(m);
TRACE("model_checker", tout << "curr_model:\n"; model_pp(tout, *m_curr_model););
TRACE(model_checker, tout << "curr_model:\n"; model_pp(tout, *m_curr_model););
if (!m_curr_model->eval(q->get_expr(), tmp, true)) {
return false;
}
TRACE("model_checker", tout << "q after applying interpretation:\n" << mk_ismt2_pp(tmp, m) << "\n";);
TRACE(model_checker, tout << "q after applying interpretation:\n" << mk_ismt2_pp(tmp, m) << "\n";);
ptr_buffer<expr> subst_args;
unsigned num_decls = q->get_num_decls();
subst_args.resize(num_decls, nullptr);
@ -189,14 +189,14 @@ namespace smt {
expr_ref sk_body = s(tmp, subst_args.size(), subst_args.data());
expr_ref r(m);
r = m.mk_not(sk_body);
TRACE("model_checker", tout << "mk_neg_q_m:\n" << mk_ismt2_pp(r, m) << "\n";);
TRACE(model_checker, tout << "mk_neg_q_m:\n" << mk_ismt2_pp(r, m) << "\n";);
m_aux_context->assert_expr(r);
return true;
}
bool model_checker::add_instance(quantifier * q, model * cex, expr_ref_vector & sks, bool use_inv) {
if (cex == nullptr || sks.empty()) {
TRACE("model_checker", tout << "no model is available\n";);
TRACE(model_checker, tout << "no model is available\n";);
return false;
}
array_util autil(m);
@ -212,22 +212,22 @@ namespace smt {
func_decl * sk_d = to_app(sk)->get_decl();
expr_ref sk_value(cex->get_some_const_interp(sk_d), m);
if (!sk_value) {
TRACE("model_checker", tout << "Could not get value for " << sk_d->get_name() << "\n";);
TRACE(model_checker, tout << "Could not get value for " << sk_d->get_name() << "\n";);
return false; // get_some_value failed... giving up
}
TRACE("model_checker", tout << "Got some value " << sk_value << "\n";);
TRACE(model_checker, tout << "Got some value " << sk_value << "\n";);
if (use_inv) {
unsigned sk_term_gen = 0;
expr * sk_term = m_model_finder.get_inv(q, i, sk_value, sk_term_gen);
if (sk_term != nullptr) {
TRACE("model_checker", tout << "Found inverse " << mk_pp(sk_term, m) << "\n";);
TRACE(model_checker, tout << "Found inverse " << mk_pp(sk_term, m) << "\n";);
SASSERT(!m.is_model_value(sk_term));
max_generation = std::max(sk_term_gen, max_generation);
sk_value = sk_term;
}
else {
TRACE("model_checker", tout << "no inverse value for " << sk_value << "\n";);
TRACE(model_checker, tout << "no inverse value for " << sk_value << "\n";);
return false;
}
}
@ -235,7 +235,7 @@ namespace smt {
expr * sk_term = get_term_from_ctx(sk_value);
func_decl * f = nullptr;
if (sk_term != nullptr) {
TRACE("model_checker", tout << "sk term " << mk_pp(sk_term, m) << "\n");
TRACE(model_checker, tout << "sk term " << mk_pp(sk_term, m) << "\n");
sk_value = sk_term;
}
// last ditch: am I an array?
@ -245,7 +245,7 @@ namespace smt {
}
if (contains_model_value(sk_value)) {
TRACE("model_checker", tout << "type compatible term " << mk_pp(sk_value, m) << "\n");
TRACE(model_checker, tout << "type compatible term " << mk_pp(sk_value, m) << "\n");
sk_value = get_type_compatible_term(sk_value);
}
func_decl * f = nullptr;
@ -267,7 +267,7 @@ namespace smt {
bindings.set(num_decls - i - 1, sk_value);
}
TRACE("model_checker", tout << q->get_qid() << " found (use_inv: " << use_inv << ") new instance: " << bindings << "\ndefs:\n" << defs << "\n";);
TRACE(model_checker, tout << q->get_qid() << " found (use_inv: " << use_inv << ") new instance: " << bindings << "\ndefs:\n" << defs << "\n";);
if (!defs.empty()) def = mk_and(defs);
max_generation = std::max(m_qm->get_generation(q), max_generation);
add_instance(q, bindings, max_generation, def.get());
@ -313,14 +313,14 @@ namespace smt {
func_decl * sk_d = to_app(sk)->get_decl();
expr_ref sk_value(cex->get_some_const_interp(sk_d), m);
if (!sk_value) {
TRACE("model_checker", tout << "no constant interpretation for " << mk_pp(sk, m) << "\n";);
TRACE(model_checker, tout << "no constant interpretation for " << mk_pp(sk, m) << "\n";);
return false; // get_some_value failed... aborting add_blocking_clause
}
diseqs.push_back(m.mk_not(m.mk_eq(sk, sk_value)));
}
expr_ref blocking_clause(m);
blocking_clause = m.mk_or(diseqs.size(), diseqs.data());
TRACE("model_checker", tout << "blocking clause:\n" << mk_ismt2_pp(blocking_clause, m) << "\n";);
TRACE(model_checker, tout << "blocking clause:\n" << mk_ismt2_pp(blocking_clause, m) << "\n";);
m_aux_context->assert_expr(blocking_clause);
return true;
}
@ -347,17 +347,17 @@ namespace smt {
scoped_ctx_push _push(m_aux_context.get());
quantifier * flat_q = get_flat_quantifier(q);
TRACE("model_checker", tout << "model checking:\n" << expr_ref(flat_q->get_expr(), m) << "\n";);
TRACE(model_checker, tout << "model checking:\n" << expr_ref(flat_q->get_expr(), m) << "\n";);
expr_ref_vector sks(m);
if (!assert_neg_q_m(flat_q, sks))
return false;
TRACE("model_checker", tout << "skolems:\n" << sks << "\n";);
TRACE(model_checker, tout << "skolems:\n" << sks << "\n";);
flet<bool> l(m_aux_context->get_fparams().m_array_fake_support, true);
lbool r = m_aux_context->check();
TRACE("model_checker", tout << "[complete] model-checker result: " << to_sat_str(r) << "\n";);
TRACE(model_checker, tout << "[complete] model-checker result: " << to_sat_str(r) << "\n";);
if (r != l_true) {
return is_safe_for_mbqi(q) && r == l_false; // quantifier is satisfied by m_curr_model
}
@ -373,7 +373,7 @@ namespace smt {
while (true) {
flet<bool> l(m_aux_context->get_fparams().m_array_fake_support, true);
lbool r = m_aux_context->check();
TRACE("model_checker", tout << "[restricted] model-checker (" << (num_new_instances+1) << ") result: " << to_sat_str(r) << "\n";);
TRACE(model_checker, tout << "[restricted] model-checker (" << (num_new_instances+1) << ") result: " << to_sat_str(r) << "\n";);
if (r != l_true)
break;
model_ref cex;
@ -384,7 +384,7 @@ namespace smt {
}
num_new_instances++;
if (num_new_instances >= m_max_cexs || !add_blocking_clause(cex.get(), sks)) {
TRACE("model_checker", tout << "Add blocking clause failed new-instances: " << num_new_instances << " max-cex: " << m_max_cexs << "\n";);
TRACE(model_checker, tout << "Add blocking clause failed new-instances: " << num_new_instances << " max-cex: " << m_max_cexs << "\n";);
// add_blocking_clause failed... stop the search for new counter-examples...
break;
}
@ -392,7 +392,7 @@ namespace smt {
if (num_new_instances == 0) {
// failed to create instances when restricting to inst sets... then use result of the complete model check
TRACE("model_checker", tout << "using complete_cex result:\n"; model_pp(tout, *complete_cex););
TRACE(model_checker, tout << "using complete_cex result:\n"; model_pp(tout, *complete_cex););
add_instance(q, complete_cex.get(), sks, false);
}
@ -455,7 +455,7 @@ namespace smt {
m_curr_model = md;
m_value2expr.reset();
TRACE("model_checker", tout << "MODEL_CHECKER INVOKED\n";
TRACE(model_checker, tout << "MODEL_CHECKER INVOKED\n";
tout << "model:\n"; model_pp(tout, *m_curr_model););
for (quantifier* q : *m_qm)
@ -466,7 +466,7 @@ namespace smt {
md->compress();
TRACE("model_checker", tout << "MODEL_CHECKER INVOKED\n";
TRACE(model_checker, tout << "MODEL_CHECKER INVOKED\n";
tout << "model:\n"; model_pp(tout, *m_curr_model););
if (m_params.m_mbqi_trace) {
verbose_stream() << "(smt.mbqi \"started\")\n";
@ -482,8 +482,8 @@ namespace smt {
if (found_relevant)
m_iteration_idx++;
TRACE("model_checker", tout << "model after check:\n"; model_pp(tout, *md););
TRACE("model_checker", tout << "model checker result: " << (num_failures == 0) << "\n";);
TRACE(model_checker, tout << "model after check:\n"; model_pp(tout, *md););
TRACE(model_checker, tout << "model checker result: " << (num_failures == 0) << "\n";);
m_max_cexs += m_params.m_mbqi_max_cexs;
if (num_failures == 0 && !m_context->validate_model()) {
@ -525,7 +525,7 @@ namespace smt {
continue;
}
TRACE("model_checker",
TRACE(model_checker,
tout << "Check: " << mk_pp(q, m) << "\n";
tout << m_context->get_assignment(q) << "\n";);
@ -537,7 +537,7 @@ namespace smt {
if (m_params.m_mbqi_trace || get_verbosity_level() >= 5) {
IF_VERBOSE(0, verbose_stream() << "(smt.mbqi :failed " << q->get_qid() << ")\n");
}
TRACE("model_checker", tout << "checking quantifier " << mk_pp(q, m) << " failed\n";);
TRACE(model_checker, tout << "checking quantifier " << mk_pp(q, m) << " failed\n";);
num_failures++;
}
}
@ -555,7 +555,7 @@ namespace smt {
}
bool model_checker::has_new_instances() {
TRACE("model_checker", tout << "instances: " << m_new_instances.size() << "\n";);
TRACE(model_checker, tout << "instances: " << m_new_instances.size() << "\n";);
return !m_new_instances.empty();
}
@ -569,7 +569,7 @@ namespace smt {
}
void model_checker::assert_new_instances() {
TRACE("model_checker_bug_detail", tout << "assert_new_instances, inconsistent: " << m_context->inconsistent() << "\n";);
TRACE(model_checker_bug_detail, tout << "assert_new_instances, inconsistent: " << m_context->inconsistent() << "\n";);
ptr_buffer<enode> bindings;
vector<std::tuple<enode *, enode *>> dummy;
for (instance const& inst : m_new_instances) {
@ -582,7 +582,7 @@ namespace smt {
for (unsigned i = 0; i < num_decls; i++) {
expr * b = m_pinned_exprs.get(offset + i);
if (!m_context->e_internalized(b)) {
TRACE("model_checker", tout << "internalizing b:\n" << mk_pp(b, m) << "\n";);
TRACE(model_checker, tout << "internalizing b:\n" << mk_pp(b, m) << "\n";);
m_context->internalize(b, false, gen);
}
bindings.push_back(m_context->get_enode(b));
@ -604,12 +604,12 @@ namespace smt {
}
}
TRACE("model_checker_bug_detail", tout << "instantiating... q:\n" << mk_pp(q, m) << "\n";
TRACE(model_checker_bug_detail, tout << "instantiating... q:\n" << mk_pp(q, m) << "\n";
tout << "inconsistent: " << m_context->inconsistent() << "\n";
tout << "bindings:\n" << expr_ref_vector(m, num_decls, m_pinned_exprs.data() + offset) << "\n";
tout << "def " << mk_pp(inst.m_def, m) << "\n";);
m_context->add_instance(q, nullptr, num_decls, bindings.data(), inst.m_def, gen, gen, gen, dummy);
TRACE("model_checker_bug_detail", tout << "after instantiating, inconsistent: " << m_context->inconsistent() << "\n";);
TRACE(model_checker_bug_detail, tout << "after instantiating, inconsistent: " << m_context->inconsistent() << "\n";);
}
}
}

View file

@ -93,7 +93,7 @@ namespace smt {
SASSERT(m_elems.contains(n));
SASSERT(m_inv.empty());
m_elems.erase(n);
TRACE("model_finder", tout << mk_pp(n, m) << "\n";);
TRACE(model_finder, tout << mk_pp(n, m) << "\n";);
m.dec_ref(n);
}
@ -126,7 +126,7 @@ namespace smt {
unsigned gen = kv.m_value;
expr* t_val = ev.eval(t, true);
if (!t_val) break;
TRACE("model_finder", tout << mk_pp(t, m) << " " << mk_pp(t_val, m) << "\n";);
TRACE(model_finder, tout << mk_pp(t, m) << " " << mk_pp(t_val, m) << "\n";);
expr* old_t = nullptr;
if (m_inv.find(t_val, old_t)) {
@ -568,7 +568,7 @@ namespace smt {
expr* n = kv.m_key;
expr* n_val = eval(n, true);
if (should_cleanup(n_val)) {
TRACE("model_finder", tout << "cleanup " << s << " " << mk_pp(n, m) << " " << mk_pp(n_val, m) << "\n";);
TRACE(model_finder, tout << "cleanup " << s << " " << mk_pp(n, m) << " " << mk_pp(n_val, m) << "\n";);
to_delete.push_back(n);
}
}
@ -595,11 +595,11 @@ namespace smt {
expr_ref tmp(m);
if (!m_model->eval(n, tmp, model_completion)) {
r = nullptr;
TRACE("model_finder", tout << "eval\n" << mk_pp(n, m) << "\n-----> null\n";);
TRACE(model_finder, tout << "eval\n" << mk_pp(n, m) << "\n-----> null\n";);
}
else {
r = tmp;
TRACE("model_finder", tout << "eval\n" << mk_pp(n, m) << "\n----->\n" << mk_pp(r, m) << "\n";);
TRACE(model_finder, tout << "eval\n" << mk_pp(n, m) << "\n----->\n" << mk_pp(r, m) << "\n";);
}
m_eval_cache[model_completion].insert(n, r);
m_eval_cache_range.push_back(r);
@ -679,7 +679,7 @@ namespace smt {
m_model->register_aux_decl(r->get_decl());
m_sort2k.insert(s, r);
m_ks.push_back(r);
TRACE("model_finder", tout << sort_ref(s, m) << " := " << "\n";);
TRACE(model_finder, tout << sort_ref(s, m) << " := " << "\n";);
return r;
}
@ -702,7 +702,7 @@ namespace smt {
return nullptr;
m_model->register_decl(k_decl, r);
SASSERT(m_model->get_const_interp(k_decl) == r);
TRACE("model_finder", tout << mk_pp(r, m) << "\n";);
TRACE(model_finder, tout << mk_pp(r, m) << "\n";);
return r;
}
@ -712,7 +712,7 @@ namespace smt {
It invokes get_k_interp that may fail.
*/
bool assert_k_diseq_exceptions(app* k, ptr_vector<expr> const& exceptions) {
TRACE("assert_k_diseq_exceptions", tout << "assert_k_diseq_exceptions, " << "k: " << mk_pp(k, m) << "\nexceptions:\n";
TRACE(assert_k_diseq_exceptions, tout << "assert_k_diseq_exceptions, " << "k: " << mk_pp(k, m) << "\nexceptions:\n";
for (expr* e : exceptions) tout << mk_pp(e, m) << "\n";);
expr* k_interp = get_k_interp(k);
if (k_interp == nullptr)
@ -730,7 +730,7 @@ namespace smt {
}
void set_projection_else(node* n) {
TRACE("model_finder", n->display(tout, m););
TRACE(model_finder, n->display(tout, m););
SASSERT(n->is_root());
SASSERT(!n->is_mono_proj());
instantiation_set const* s = n->get_instantiation_set();
@ -747,7 +747,7 @@ namespace smt {
return;
}
sort* s = n->get_sort();
TRACE("model_finder", tout << "trying to create k for " << mk_pp(s, m) << ", is_infinite: " << is_infinite(s) << "\n";);
TRACE(model_finder, tout << "trying to create k for " << mk_pp(s, m) << ", is_infinite: " << is_infinite(s) << "\n";);
if (is_infinite(s)) {
app* k = get_k_for(s);
if (assert_k_diseq_exceptions(k, exceptions)) {
@ -780,7 +780,7 @@ namespace smt {
for (expr* e : exceptions) {
arith_rw.mk_sub(e, one, e_minus_1);
arith_rw.mk_add(e, one, e_plus_1);
TRACE("mf_simp_bug", tout << "e:\n" << mk_ismt2_pp(e, m) << "\none:\n" << mk_ismt2_pp(one, m) << "\n";);
TRACE(mf_simp_bug, tout << "e:\n" << mk_ismt2_pp(e, m) << "\none:\n" << mk_ismt2_pp(one, m) << "\n";);
// Note: exceptions come from quantifiers bodies. So, they have generation 0.
n->insert(e_plus_1, 0);
n->insert(e_minus_1, 0);
@ -792,7 +792,7 @@ namespace smt {
for (expr* e : exceptions) {
bv_rw.mk_add(e, one, e_plus_1);
bv_rw.mk_sub(e, one, e_minus_1);
TRACE("mf_simp_bug", tout << "e:\n" << mk_ismt2_pp(e, m) << "\none:\n" << mk_ismt2_pp(one, m) << "\n";);
TRACE(mf_simp_bug, tout << "e:\n" << mk_ismt2_pp(e, m) << "\none:\n" << mk_ismt2_pp(one, m) << "\n";);
// Note: exceptions come from quantifiers bodies. So, they have generation 0.
n->insert(e_plus_1, 0);
n->insert(e_minus_1, 0);
@ -819,7 +819,7 @@ namespace smt {
already_found.insert(t_val);
}
}
TRACE("model_finder_bug", tout << "values for the instantiation_set of @" << n->get_id() << "\n";
TRACE(model_finder_bug, tout << "values for the instantiation_set of @" << n->get_id() << "\n";
for (expr* v : values) {
tout << mk_pp(v, m) << "\n";
});
@ -900,7 +900,7 @@ namespace smt {
func_decl* p = m.mk_fresh_func_decl(1, &s, s);
m_model->register_aux_decl(p, rpi);
n->set_proj(p);
TRACE("model_finder", n->display(tout << p->get_name() << "\n", m););
TRACE(model_finder, n->display(tout << p->get_name() << "\n", m););
}
void mk_simple_proj(node* n) {
@ -920,7 +920,7 @@ namespace smt {
pi->insert_new_entry(&v, v);
n->set_proj(p);
TRACE("model_finder", n->display(tout << p->get_name() << "\n", m););
TRACE(model_finder, n->display(tout << p->get_name() << "\n", m););
}
void mk_projections() {
@ -943,7 +943,7 @@ namespace smt {
func_interp* fi = m_model->get_func_interp(f);
if (fi == nullptr) {
fi = alloc(func_interp, m, f->get_arity());
TRACE("model_finder", tout << "register " << f->get_name() << "\n";);
TRACE(model_finder, tout << "register " << f->get_name() << "\n";);
m_model->register_decl(f, fi);
SASSERT(fi->is_partial());
}
@ -980,7 +980,7 @@ namespace smt {
for (node* n : m_root_nodes) {
SASSERT(n->is_root());
instantiation_set const* s = n->get_instantiation_set();
TRACE("model_finder", s->display(tout););
TRACE(model_finder, s->display(tout););
obj_map<expr, unsigned> const& elems = s->get_elems();
if (elems.empty()) {
// The method get_some_value cannot be used if n->get_sort() is an uninterpreted sort or is a sort built using uninterpreted sorts
@ -1010,7 +1010,7 @@ namespace smt {
sort2elems.insert(s, e);
}
n->insert(e, 0);
TRACE("model_finder", tout << "fresh constant: " << mk_pp(e, m) << "\n";);
TRACE(model_finder, tout << "fresh constant: " << mk_pp(e, m) << "\n";);
}
}
@ -1085,7 +1085,7 @@ namespace smt {
func_decl* f_aux = m.mk_fresh_func_decl(f->get_name(), symbol::null, arity, f->get_domain(), f->get_range());
func_interp* new_fi = alloc(func_interp, m, arity);
new_fi->set_else(m.mk_app(f_aux, args.size(), args.data()));
TRACE("model_finder", tout << "Setting new interpretation for " << f->get_name() << "\n" <<
TRACE(model_finder, tout << "Setting new interpretation for " << f->get_name() << "\n" <<
mk_pp(new_fi->get_else(), m) << "\n";
tout << "old interpretation: " << mk_pp(fi->get_interp(), m) << "\n";);
m_model->reregister_decl(f, new_fi, f_aux);
@ -1121,7 +1121,7 @@ namespace smt {
mk_projections();
mk_inverses();
complete_partial_funcs(partial_funcs);
TRACE("model_finder", tout << "after auf_solver fixing the model\n";
TRACE(model_finder, tout << "after auf_solver fixing the model\n";
display_nodes(tout);
tout << "NEW MODEL:\n";
model_pp(tout, *m_model););
@ -1197,7 +1197,7 @@ namespace smt {
void process_auf(quantifier* q, auf_solver& s, context* ctx) override {
node* n1 = s.get_A_f_i(m_f, m_arg_i);
node* n2 = s.get_uvar(q, m_var_j);
CTRACE("model_finder", n1->get_sort() != n2->get_sort(),
CTRACE(model_finder, n1->get_sort() != n2->get_sort(),
tout << "sort bug:\n" << mk_ismt2_pp(q->get_expr(), m) << "\n" << mk_ismt2_pp(q, m) << "\n";
tout << "decl(0): " << q->get_decl_name(0) << "\n";
tout << "f: " << m_f->get_name() << " i: " << m_arg_i << "\n";
@ -1414,7 +1414,7 @@ namespace smt {
app* get_array() const { return to_app(m_select->get_arg(0)); }
func_decl* get_array_func_decl(app* ground_array, auf_solver& s) {
TRACE("model_evaluator", tout << expr_ref(ground_array, m) << "\n";);
TRACE(model_evaluator, tout << expr_ref(ground_array, m) << "\n";);
expr* ground_array_interp = s.eval(ground_array, false);
if (ground_array_interp && m_array.is_as_array(ground_array_interp))
return m_array.get_as_array_func_decl(ground_array_interp);
@ -1442,7 +1442,7 @@ namespace smt {
void process_auf(quantifier* q, auf_solver& s, context* ctx) override {
ptr_buffer<enode> arrays;
get_auf_arrays(get_array(), ctx, arrays);
TRACE("select_var",
TRACE(select_var,
tout << "enodes matching: "; display(tout); tout << "\n";
for (enode* n : arrays) {
tout << "#" << n->get_expr_id() << "\n" << mk_pp(n->get_expr(), m) << "\n";
@ -1683,7 +1683,7 @@ namespace smt {
}
}
m_qinfo_vect.push_back(q.detach());
TRACE("model_finder", tout << "new quantifier qinfo: "; qi->display(tout); tout << "\n";);
TRACE(model_finder, tout << "new quantifier qinfo: "; qi->display(tout); tout << "\n";);
}
public:
@ -1707,7 +1707,7 @@ namespace smt {
m_mf(mf),
m_q(q, m),
m_uvar_inst_sets(nullptr) {
CTRACE("model_finder_bug", has_quantifiers(m_flat_q->get_expr()),
CTRACE(model_finder_bug, has_quantifiers(m_flat_q->get_expr()),
tout << mk_pp(q, m) << "\n" << mk_pp(m_flat_q, m) << "\n";);
}
@ -1812,7 +1812,7 @@ namespace smt {
bool is_var_plus_ground(expr* n, var*& v, expr_ref& t) {
bool inv;
TRACE("is_var_plus_ground", tout << mk_pp(n, m) << "\n";
TRACE(is_var_plus_ground, tout << mk_pp(n, m) << "\n";
tout << "is_var_plus_ground: " << is_var_plus_ground(n, inv, v, t) << "\n";
tout << "inv: " << inv << "\n";);
return is_var_plus_ground(n, inv, v, t) && !inv;
@ -1856,17 +1856,17 @@ namespace smt {
bool is_var_and_ground(expr* lhs, expr* rhs, var*& v, expr_ref& t, bool& inv) {
inv = false; // true if invert the sign
TRACE("is_var_and_ground", tout << "is_var_and_ground: " << mk_ismt2_pp(lhs, m) << " " << mk_ismt2_pp(rhs, m) << "\n";);
TRACE(is_var_and_ground, tout << "is_var_and_ground: " << mk_ismt2_pp(lhs, m) << " " << mk_ismt2_pp(rhs, m) << "\n";);
if (is_var(lhs) && is_ground(rhs)) {
v = to_var(lhs);
t = rhs;
TRACE("is_var_and_ground", tout << "var and ground\n";);
TRACE(is_var_and_ground, tout << "var and ground\n";);
return true;
}
else if (is_var(rhs) && is_ground(lhs)) {
v = to_var(rhs);
t = lhs;
TRACE("is_var_and_ground", tout << "ground and var\n";);
TRACE(is_var_and_ground, tout << "ground and var\n";);
return true;
}
else {
@ -1945,7 +1945,7 @@ namespace smt {
return false;
if (sign) {
bool r = is_le_ge(atom) && is_var_and_ground(to_app(atom)->get_arg(0), to_app(atom)->get_arg(1), v, t);
CTRACE("is_x_gle_t", r, tout << "is_x_gle_t: " << mk_ismt2_pp(atom, m) << "\n--->\n"
CTRACE(is_x_gle_t, r, tout << "is_x_gle_t: " << mk_ismt2_pp(atom, m) << "\n--->\n"
<< mk_ismt2_pp(v, m) << " " << mk_ismt2_pp(t, m) << "\n";
tout << "sign: " << sign << "\n";);
return r;
@ -1965,7 +1965,7 @@ namespace smt {
mk_add(tmp, one, t);
else
mk_sub(tmp, one, t);
TRACE("is_x_gle_t", tout << "is_x_gle_t: " << mk_ismt2_pp(atom, m) << "\n--->\n"
TRACE(is_x_gle_t, tout << "is_x_gle_t: " << mk_ismt2_pp(atom, m) << "\n--->\n"
<< mk_ismt2_pp(v, m) << " " << mk_ismt2_pp(t, m) << "\n";
tout << "sign: " << sign << "\n";);
return true;
@ -2114,7 +2114,7 @@ namespace smt {
}
void process_literal(expr* atom, bool sign) {
CTRACE("model_finder_bug", is_ground(atom), tout << mk_pp(atom, m) << "\n";);
CTRACE(model_finder_bug, is_ground(atom), tout << mk_pp(atom, m) << "\n";);
SASSERT(!is_ground(atom));
SASSERT(m.is_bool(atom));
@ -2348,12 +2348,12 @@ namespace smt {
}
void model_finder::register_quantifier(quantifier* q) {
TRACE("model_finder", tout << "registering:\n" << q->get_id() << ": " << q << " " << &m_q2info << " " << mk_pp(q, m) << "\n";);
TRACE(model_finder, tout << "registering:\n" << q->get_id() << ": " << q << " " << &m_q2info << " " << mk_pp(q, m) << "\n";);
quantifier_info* new_info = alloc(quantifier_info, *this, m, q);
m_q2info.insert(q, new_info);
m_quantifiers.push_back(q);
m_analyzer->operator()(new_info);
TRACE("model_finder", tout << "after analyzer:\n"; new_info->display(tout););
TRACE(model_finder, tout << "after analyzer:\n"; new_info->display(tout););
}
void model_finder::push_scope() {
@ -2420,7 +2420,7 @@ namespace smt {
qi->populate_inst_sets(*(m_auf_solver.get()), m_context);
}
m_auf_solver->fix_model(m_new_constraints);
TRACE("model_finder",
TRACE(model_finder,
for (quantifier* q : qs) {
quantifier_info* qi = get_quantifier_info(q);
quantifier* fq = qi->get_flat_q();
@ -2436,20 +2436,20 @@ namespace smt {
void model_finder::process_simple_macros(ptr_vector<quantifier>& qs, ptr_vector<quantifier>& residue, proto_model* mdl) {
simple_macro_solver sms(m, *this);
sms(*mdl, qs, residue);
TRACE("model_finder", tout << "model after processing simple macros:\n"; model_pp(tout, *mdl););
TRACE(model_finder, tout << "model after processing simple macros:\n"; model_pp(tout, *mdl););
}
void model_finder::process_hint_macros(ptr_vector<quantifier>& qs, ptr_vector<quantifier>& residue, proto_model* mdl) {
hint_macro_solver hms(m, *this);
hms(*mdl, qs, residue);
TRACE("model_finder", tout << "model after processing simple macros:\n"; model_pp(tout, *mdl););
TRACE(model_finder, tout << "model after processing simple macros:\n"; model_pp(tout, *mdl););
}
void model_finder::process_non_auf_macros(ptr_vector<quantifier>& qs, ptr_vector<quantifier>& residue, proto_model* mdl) {
non_auf_macro_solver nas(m, *this, m_dependencies);
nas.set_mbqi_force_template(m_context->get_fparams().m_mbqi_force_template);
nas(*mdl, qs, residue);
TRACE("model_finder", tout << "model after processing non auf macros:\n"; model_pp(tout, *mdl););
TRACE(model_finder, tout << "model after processing non auf macros:\n"; model_pp(tout, *mdl););
}
/**
@ -2473,7 +2473,7 @@ namespace smt {
collect_relevant_quantifiers(qs);
if (qs.empty())
return;
TRACE("model_finder", tout << "trying to satisfy quantifiers, given model:\n"; model_pp(tout, *m););
TRACE(model_finder, tout << "trying to satisfy quantifiers, given model:\n"; model_pp(tout, *m););
cleanup_quantifier_infos(qs);
m_dependencies.reset();
@ -2498,7 +2498,7 @@ namespace smt {
quantifier* flat_q = get_flat_quantifier(q);
SASSERT(flat_q->get_num_decls() >= q->get_num_decls());
mf::instantiation_set const* r = m_auf_solver->get_uvar_inst_set(flat_q, flat_q->get_num_decls() - q->get_num_decls() + i);
TRACE("model_finder", tout << "q: #" << q->get_id() << "\n" << mk_pp(q, m) << "\nflat_q: " << mk_pp(flat_q, m)
TRACE(model_finder, tout << "q: #" << q->get_id() << "\n" << mk_pp(q, m) << "\nflat_q: " << mk_pp(flat_q, m)
<< "\ni: " << i << " " << flat_q->get_num_decls() - q->get_num_decls() + i << "\n";);
if (r != nullptr)
return r;
@ -2563,7 +2563,7 @@ namespace smt {
}
expr_ref new_cnstr(m);
new_cnstr = m.mk_or(eqs.size(), eqs.data());
TRACE("model_finder", tout << "assert_restriction:\n" << mk_pp(new_cnstr, m) << "\n";);
TRACE(model_finder, tout << "assert_restriction:\n" << mk_pp(new_cnstr, m) << "\n";);
aux_ctx->assert_expr(new_cnstr);
asserted_something = true;
}
@ -2575,7 +2575,7 @@ namespace smt {
if (sz > 0) {
for (unsigned i = 0; i < sz; i++) {
expr* c = m_new_constraints.get(i);
TRACE("model_finder_bug_detail", tout << "asserting new constraint: " << mk_pp(c, m) << "\n";);
TRACE(model_finder_bug_detail, tout << "asserting new constraint: " << mk_pp(c, m) << "\n";);
m_context->internalize(c, true);
literal l(m_context->get_literal(c));
m_context->mark_as_relevant(l);

View file

@ -63,7 +63,7 @@ namespace smt {
// PARAM-TODO smt_params ---> params_ref
m_model = alloc(proto_model, m); // , m_context->get_fparams());
for (theory* th : m_context->theories()) {
TRACE("model_generator_bug", tout << "init_model for theory: " << th->get_name() << "\n";);
TRACE(model_generator_bug, tout << "init_model for theory: " << th->get_name() << "\n";);
th->init_model(*this);
}
}
@ -97,7 +97,7 @@ namespace smt {
sort * s = r->get_sort();
model_value_proc * proc = nullptr;
if (m.is_bool(s)) {
CTRACE("model", m_context->get_assignment(r) == l_undef,
CTRACE(model, m_context->get_assignment(r) == l_undef,
tout << mk_pp(r->get_expr(), m) << "\n";);
if (m_context->get_assignment(r) == l_true)
proc = alloc(expr_wrapper_proc, m.mk_true());
@ -115,7 +115,7 @@ namespace smt {
SASSERT(proc);
}
else {
TRACE("model", tout << "creating fresh value for #"
TRACE(model, tout << "creating fresh value for #"
<< r->get_expr_id() << " "
<< mk_bounded_pp(r->get_expr(), m) << " "
<< mk_pp(r->get_sort(), m) << "\n";);
@ -140,7 +140,7 @@ namespace smt {
if (!m.is_model_value(n)) {
sort * s = r->get_sort();
n = m_model->get_fresh_value(s);
CTRACE("model", n == 0,
CTRACE(model, n == 0,
tout << mk_pp(r->get_expr(), m) << "\nsort:\n" << mk_pp(s, m) << "\n";
tout << "is_finite: " << m_model->is_finite(s) << "\n";);
}
@ -184,7 +184,7 @@ namespace smt {
if (already_traversed.contains(s))
return true;
bool visited = true;
TRACE("mg_top_sort", tout << "fresh value of sort " << mk_pp(s, m) << "\n";
TRACE(mg_top_sort, tout << "fresh value of sort " << mk_pp(s, m) << "\n";
for (enode* r : roots)
if (r->get_sort() == s)
tout << mk_pp(r->get_expr(), m) << "\n";
@ -195,9 +195,9 @@ namespace smt {
SASSERT(r == r->get_root());
if (root2proc[r]->is_fresh())
continue; // r is associated with a fresh value...
TRACE("mg_top_sort", tout << "fresh!" << src.get_value()->get_idx() << " -> #" << r->get_owner_id() << " " << mk_pp(r->get_sort(), m) << "\n";);
TRACE(mg_top_sort, tout << "fresh!" << src.get_value()->get_idx() << " -> #" << r->get_owner_id() << " " << mk_pp(r->get_sort(), m) << "\n";);
visit_child(source(r), colors, todo, visited);
TRACE("mg_top_sort", tout << "visited: " << visited << ", todo.size(): " << todo.size() << "\n";);
TRACE(mg_top_sort, tout << "visited: " << visited << ", todo.size(): " << todo.size() << "\n";);
}
already_traversed.insert(s);
return visited;
@ -214,7 +214,7 @@ namespace smt {
for (model_value_dependency const& dep : dependencies) {
visit_child(dep, colors, todo, visited);
}
TRACE("mg_top_sort",
TRACE(mg_top_sort,
tout << "src: " << src << " ";
tout << mk_pp(n->get_expr(), m) << "\n";
for (model_value_dependency const& dep : dependencies) {
@ -231,7 +231,7 @@ namespace smt {
obj_hashtable<sort> & already_traversed,
svector<source> & todo,
svector<source> & sorted_sources) {
TRACE("mg_top_sort", tout << "process source, is_fresh: " << src.is_fresh_value() << " ";
TRACE(mg_top_sort, tout << "process source, is_fresh: " << src.is_fresh_value() << " ";
tout << src << ", todo.size(): " << todo.size() << "\n";);
int color = get_color(colors, src);
SASSERT(color != Grey);
@ -241,7 +241,7 @@ namespace smt {
todo.push_back(src);
while (!todo.empty()) {
source curr = todo.back();
TRACE("mg_top_sort", tout << "current source, is_fresh: " << curr.is_fresh_value() << " ";
TRACE(mg_top_sort, tout << "current source, is_fresh: " << curr.is_fresh_value() << " ";
tout << curr << ", todo.size(): " << todo.size() << "\n";);
switch (get_color(colors, curr)) {
case White:
@ -251,7 +251,7 @@ namespace smt {
case Grey:
// SASSERT(visit_children(curr, roots, root2proc, colors, already_traversed, todo));
set_color(colors, curr, Black);
TRACE("mg_top_sort", tout << "append " << curr << "\n";);
TRACE(mg_top_sort, tout << "append " << curr << "\n";);
sorted_sources.push_back(curr);
break;
case Black:
@ -261,7 +261,7 @@ namespace smt {
UNREACHABLE();
}
}
TRACE("mg_top_sort", tout << "END process_source, todo.size(): " << todo.size() << "\n";);
TRACE(mg_top_sort, tout << "END process_source, todo.size(): " << todo.size() << "\n";);
}
/**
@ -306,7 +306,7 @@ namespace smt {
expr_ref_vector dependency_values(m);
mk_value_procs(root2proc, roots, procs);
top_sort_sources(roots, root2proc, sources);
TRACE("sorted_sources",
TRACE(sorted_sources,
for (source const& curr : sources) {
if (curr.is_fresh_value()) {
tout << curr << " " << mk_pp(curr.get_value()->get_sort(), m) << "\n";
@ -334,16 +334,16 @@ namespace smt {
for (source const& curr : sources) {
if (curr.is_fresh_value()) {
sort * s = curr.get_value()->get_sort();
TRACE("model_fresh_bug", tout << curr << " : " << mk_pp(s, m) << " " << curr.get_value()->get_value() << "\n";);
TRACE(model_fresh_bug, tout << curr << " : " << mk_pp(s, m) << " " << curr.get_value()->get_value() << "\n";);
expr * val = m_model->get_fresh_value(s);
TRACE("model_fresh_bug", tout << curr << " := #" << (val == nullptr ? UINT_MAX : val->get_id()) << "\n";);
TRACE(model_fresh_bug, tout << curr << " := #" << (val == nullptr ? UINT_MAX : val->get_id()) << "\n";);
m_asts.push_back(val);
curr.get_value()->set_value(val);
}
else {
enode * n = curr.get_enode();
SASSERT(n->get_root() == n);
TRACE("mg_top_sort", tout << curr << "\n";);
TRACE(mg_top_sort, tout << curr << "\n";);
app* val = nullptr;
if (m.is_value(n->get_expr()))
val = to_app(n->get_expr());
@ -356,7 +356,7 @@ namespace smt {
for (model_value_dependency const& d : dependencies) {
if (d.is_fresh_value()) {
expr* val = d.get_value()->get_value();
CTRACE("mg_top_sort", !val,
CTRACE(mg_top_sort, !val,
tout << "#" << n->get_owner_id() << " " <<
mk_pp(n->get_expr(), m) << " -> " << d << "\n";);
// there is a cyclic dependency for default(A), where A
@ -368,7 +368,7 @@ namespace smt {
}
else {
enode * child = d.get_enode();
TRACE("mg_top_sort", tout << "#" << n->get_owner_id() << " (" << mk_pp(n->get_expr(), m) << "): "
TRACE(mg_top_sort, tout << "#" << n->get_owner_id() << " (" << mk_pp(n->get_expr(), m) << "): "
<< mk_pp(child->get_expr(), m) << " " << mk_pp(child->get_root()->get_expr(), m) << "\n";);
child = child->get_root();
dependency_values.push_back(m_root2value[child]);
@ -385,7 +385,7 @@ namespace smt {
for (enode * n : m_context->enodes()) {
if (is_uninterp_const(n->get_expr()) && m_context->is_relevant(n)) {
func_decl * d = n->get_expr()->get_decl();
TRACE("mg_top_sort", tout << d->get_name() << " " << (m_hidden_ufs.contains(d)?"hidden":"visible") << "\n";);
TRACE(mg_top_sort, tout << d->get_name() << " " << (m_hidden_ufs.contains(d)?"hidden":"visible") << "\n";);
if (m_hidden_ufs.contains(d)) continue;
expr * val = get_value(n);
m_model->register_decl(d, val);
@ -450,7 +450,7 @@ namespace smt {
SASSERT(m_model->has_interpretation(f));
SASSERT(m_model->get_func_interp(f) == fi);
// The entry must be new because n->get_cg() == n
TRACE("model",
TRACE(model,
tout << "insert new entry for:\n" << mk_ismt2_pp(n->get_expr(), m) << "\nargs: ";
for (unsigned i = 0; i < num_args; i++) {
tout << "#" << n->get_arg(i)->get_owner_id() << " ";
@ -506,20 +506,20 @@ namespace smt {
void model_generator::register_macros() {
unsigned num = m_context->get_num_macros();
TRACE("model", tout << "num. macros: " << num << "\n";);
TRACE(model, tout << "num. macros: " << num << "\n";);
expr_ref v(m);
for (unsigned i = 0; i < num; i++) {
func_decl * f = m_context->get_macro_interpretation(i, v);
func_interp * fi = alloc(func_interp, m, f->get_arity());
fi->set_else(v);
TRACE("model", tout << f->get_name() << "\n" << mk_pp(v, m) << "\n";);
TRACE(model, tout << f->get_name() << "\n" << mk_pp(v, m) << "\n";);
m_model->register_decl(f, fi);
}
}
proto_model * model_generator::mk_model() {
SASSERT(!m_model);
TRACE("model_verbose", m_context->display(tout););
TRACE(model_verbose, m_context->display(tout););
init_model();
register_existing_model_values();
mk_bool_model();
@ -527,7 +527,7 @@ namespace smt {
mk_func_interps();
finalize_theory_models();
register_macros();
TRACE("model", model_v2_pp(tout, *m_model, true););
TRACE(model, model_v2_pp(tout, *m_model, true););
return m_model.get();
}

View file

@ -211,23 +211,23 @@ namespace smt {
if (pat != nullptr) {
if (used_enodes.size() > 0) {
STRACE("causality", tout << "New-Match: "<< static_cast<void*>(f););
STRACE("triggers", tout <<", Pat: "<< expr_ref(pat, m()););
STRACE("causality", tout <<", Father:";);
STRACE(causality, tout << "New-Match: "<< static_cast<void*>(f););
STRACE(triggers, tout <<", Pat: "<< expr_ref(pat, m()););
STRACE(causality, tout <<", Father:";);
}
for (auto n : used_enodes) {
enode *orig = std::get<0>(n);
enode *substituted = std::get<1>(n);
(void) substituted;
if (orig == nullptr) {
STRACE("causality", tout << " #" << substituted->get_owner_id(););
STRACE(causality, tout << " #" << substituted->get_owner_id(););
}
else {
STRACE("causality", tout << " (#" << orig->get_owner_id() << " #" << substituted->get_owner_id() << ")";);
STRACE(causality, tout << " (#" << orig->get_owner_id() << " #" << substituted->get_owner_id() << ")";);
}
}
if (used_enodes.size() > 0) {
STRACE("causality", tout << "\n";);
STRACE(causality, tout << "\n";);
}
}
}
@ -300,7 +300,7 @@ namespace smt {
get_stat(q)->update_max_generation(max_generation);
fingerprint * f = m_context.add_fingerprint(q, q->get_id(), num_bindings, bindings, def);
if (f) {
if (is_trace_enabled("causality")) {
if (is_trace_enabled(TraceTag::causality)) {
log_causality(f,pat,used_enodes);
}
if (has_trace_stream()) {
@ -310,7 +310,7 @@ namespace smt {
m_num_instances++;
}
CTRACE("bindings", f != nullptr,
CTRACE(bindings, f != nullptr,
tout << expr_ref(q, m()) << "\n";
for (unsigned i = 0; i < num_bindings; ++i) {
tout << expr_ref(bindings[i]->get_expr(), m()) << " [r " << bindings[i]->get_root()->get_owner_id() << "] ";
@ -328,7 +328,7 @@ namespace smt {
}
m_qi_queue.init_search_eh();
m_plugin->init_search_eh();
TRACE("smt_params", m_params.display(tout); );
TRACE(smt_params, m_params.display(tout); );
}
void assign_eh(quantifier * q) {
@ -636,7 +636,7 @@ namespace smt {
mbqi.id to be instantiated with MBQI. The default value is the
empty string, so all quantifiers are instantiated. */
void add(quantifier * q) override {
TRACE("model_finder", tout << "add " << q->get_id() << ": " << q << " " << m_fparams->m_mbqi << " " << mbqi_enabled(q) << "\n";);
TRACE(model_finder, tout << "add " << q->get_id() << ": " << q << " " << m_fparams->m_mbqi << " " << mbqi_enabled(q) << "\n";);
if (m_fparams->m_mbqi && mbqi_enabled(q)) {
m_active = true;
m_model_finder->register_quantifier(q);
@ -687,13 +687,13 @@ namespace smt {
SASSERT(m.is_pattern(mp));
bool unary = (mp->get_num_args() == 1);
if (!unary && j >= num_eager_multi_patterns) {
TRACE("quantifier", tout << "delaying (too many multipatterns):\n" << mk_ismt2_pp(mp, m) << "\n"
TRACE(quantifier, tout << "delaying (too many multipatterns):\n" << mk_ismt2_pp(mp, m) << "\n"
<< "j: " << j << " unary: " << unary << " m_params.m_qi_max_eager_multipatterns: " << m_fparams->m_qi_max_eager_multipatterns
<< " num_eager_multi_patterns: " << num_eager_multi_patterns << "\n";);
m_lazy_mam->add_pattern(q, mp);
}
else {
TRACE("quantifier", tout << "adding:\n" << expr_ref(mp, m) << "\n";);
TRACE(quantifier, tout << "adding:\n" << expr_ref(mp, m) << "\n";);
m_mam->add_pattern(q, mp);
}
if (!unary)
@ -726,7 +726,7 @@ namespace smt {
m_model_finder->restart_eh();
m_model_checker->restart_eh();
}
TRACE("mam_stats", m_mam->display(tout););
TRACE(mam_stats, m_mam->display(tout););
}
bool is_shared(enode * n) const override {

View file

@ -129,7 +129,7 @@ namespace smt {
v.push_back(curr);
}
}
TRACE("collector",
TRACE(collector,
tout << "candidates:\n";
for (unsigned i = 0; i < m_num_vars; i++) {
tout << "var " << i << ":";
@ -143,7 +143,7 @@ namespace smt {
void quick_checker::collector::operator()(quantifier * q, bool conservative, vector<enode_vector> & candidates) {
flet<bool> l(m_conservative, conservative);
init(q);
TRACE("collector", tout << "model checking: #" << q->get_id() << "\n" << mk_pp(q, m_manager) << "\n";);
TRACE(collector, tout << "model checking: #" << q->get_id() << "\n" << mk_pp(q, m_manager) << "\n";);
collect(q->get_expr(), nullptr, 0);
save_result(candidates);
}
@ -159,7 +159,7 @@ namespace smt {
\brief Instantiate instances unsatisfied by the current model. Return true if new instances were generated.
*/
bool quick_checker::instantiate_unsat(quantifier * q) {
TRACE("quick_checker", tout << "instantiate instances unsatisfied by current model\n" << mk_pp(q, m_manager) << "\n";);
TRACE(quick_checker, tout << "instantiate instances unsatisfied by current model\n" << mk_pp(q, m_manager) << "\n";);
m_candidate_vectors.reset();
m_collector(q, true, m_candidate_vectors);
m_num_bindings = q->get_num_decls();
@ -170,7 +170,7 @@ namespace smt {
\brief Instantiate instances not satisfied by the current model. Return true if new instances were generated.
*/
bool quick_checker::instantiate_not_sat(quantifier * q) {
TRACE("quick_checker", tout << "instantiate instances not satisfied by current model\n" << mk_pp(q, m_manager) << "\n";);
TRACE(quick_checker, tout << "instantiate instances not satisfied by current model\n" << mk_pp(q, m_manager) << "\n";);
m_candidate_vectors.reset();
m_collector(q, false, m_candidate_vectors);
m_num_bindings = q->get_num_decls();
@ -208,8 +208,8 @@ namespace smt {
szs.push_back(sz);
it.push_back(0);
}
TRACE("quick_checker_sizes", tout << mk_pp(q, m_manager) << "\n"; for (unsigned i = 0; i < szs.size(); i++) tout << szs[i] << " "; tout << "\n";);
TRACE("quick_checker_candidates",
TRACE(quick_checker_sizes, tout << mk_pp(q, m_manager) << "\n"; for (unsigned i = 0; i < szs.size(); i++) tout << szs[i] << " "; tout << "\n";);
TRACE(quick_checker_candidates,
tout << "candidates:\n";
for (unsigned i = 0; i < m_num_bindings; i++) {
enode_vector & v = m_candidate_vectors[i];
@ -224,7 +224,7 @@ namespace smt {
m_bindings[m_num_bindings - i - 1] = m_candidate_vectors[i][it[i]];
if (!m_context.contains_instance(q, m_num_bindings, m_bindings.data())) {
bool is_candidate = false;
TRACE("quick_checker", tout << "processing bindings:";
TRACE(quick_checker, tout << "processing bindings:";
for (unsigned i = 0; i < m_num_bindings; i++) tout << " #" << m_bindings[i]->get_owner_id();
tout << "\n";);
if (unsat)
@ -232,8 +232,8 @@ namespace smt {
else
is_candidate = !check_quantifier(q, true);
if (is_candidate) {
TRACE("quick_checker", tout << "found new candidate\n";);
TRACE("quick_checker_sizes", tout << "found new candidate\n";
TRACE(quick_checker, tout << "found new candidate\n";);
TRACE(quick_checker_sizes, tout << "found new candidate\n";
for (unsigned i = 0; i < m_num_bindings; i++) tout << "#" << m_bindings[i]->get_owner_id() << " "; tout << "\n";);
unsigned max_generation = get_max_generation(m_num_bindings, m_bindings.data());
if (m_context.add_instance(q, nullptr /* no pattern was used */, m_num_bindings, m_bindings.data(), nullptr,
@ -329,7 +329,7 @@ namespace smt {
}
}
expr * new_a = canonize(a);
TRACE("quick_checker_canonizer", tout << "before:\n" << mk_pp(a, m_manager) << "\nafter:\n" << mk_pp(new_a, m_manager) << "\n";);
TRACE(quick_checker_canonizer, tout << "before:\n" << mk_pp(a, m_manager) << "\nafter:\n" << mk_pp(new_a, m_manager) << "\n";);
if (m_context.lit_internalized(new_a) && m_context.is_relevant(new_a)) {
lbool val = m_context.get_assignment(new_a);
if (val != l_undef)

View file

@ -276,7 +276,7 @@ namespace smt {
--i;
expr * n = m_relevant_exprs.get(i);
m_is_relevant.remove(n->get_id());
TRACE("propagate_relevancy", tout << "unmarking:\n" << mk_ismt2_pp(n, get_manager()) << "\n";);
TRACE(propagate_relevancy, tout << "unmarking:\n" << mk_ismt2_pp(n, get_manager()) << "\n";);
}
m_relevant_exprs.shrink(old_lim);
m_qhead = m_relevant_exprs.size();
@ -424,18 +424,18 @@ namespace smt {
\brief Propagate relevancy for an ite-expression.
*/
void propagate_relevant_ite(app * n) {
TRACE("propagate_relevant_ite", tout << "propagating relevancy for #" << n->get_id() << "\n" << mk_pp(n, get_manager()) << "\n";);
TRACE(propagate_relevant_ite, tout << "propagating relevancy for #" << n->get_id() << "\n" << mk_pp(n, get_manager()) << "\n";);
mark_as_relevant(n->get_arg(0));
switch (m_context.find_assignment(n->get_arg(0))) {
case l_false:
TRACE("propagate_relevant_ite", tout << "marking as relevant: " << mk_pp(n->get_arg(2), get_manager()) << "\n";);
TRACE(propagate_relevant_ite, tout << "marking as relevant: " << mk_pp(n->get_arg(2), get_manager()) << "\n";);
mark_as_relevant(n->get_arg(2));
break;
case l_undef:
TRACE("propagate_relevant_ite", tout << "ite c is unassigned\n";);
TRACE(propagate_relevant_ite, tout << "ite c is unassigned\n";);
break;
case l_true:
TRACE("propagate_relevant_ite", tout << "marking as relevant: " << mk_pp(n->get_arg(1), get_manager()) << "\n";);
TRACE(propagate_relevant_ite, tout << "marking as relevant: " << mk_pp(n->get_arg(1), get_manager()) << "\n";);
mark_as_relevant(n->get_arg(1));
break;
}
@ -456,8 +456,8 @@ namespace smt {
ast_manager & m = get_manager();
while (m_qhead < m_relevant_exprs.size()) {
expr * n = m_relevant_exprs.get(m_qhead);
TRACE("propagate_relevancy_to_args", tout << "propagating relevancy to args of #" << n->get_id() << "\n";);
TRACE("propagate_relevancy", tout << "marking as relevant:\n" << mk_bounded_pp(n, m) << "\n";);
TRACE(propagate_relevancy_to_args, tout << "propagating relevancy to args of #" << n->get_id() << "\n";);
TRACE(propagate_relevancy, tout << "marking as relevant:\n" << mk_bounded_pp(n, m) << "\n";);
SASSERT(is_relevant_core(n));
m_qhead++;
if (is_app(n)) {
@ -528,7 +528,7 @@ namespace smt {
SASSERT(is_relevant(n));
unsigned num_args = n->get_num_args();
for (unsigned i = 0; i < num_args; i++) {
CTRACE("relevancy_bug", !is_relevant(n->get_arg(i)), tout << "n: " << mk_ismt2_pp(n, get_manager()) << "\ni: " << i << "\n";);
CTRACE(relevancy_bug, !is_relevant(n->get_arg(i)), tout << "n: " << mk_ismt2_pp(n, get_manager()) << "\ni: " << i << "\n";);
SASSERT(is_relevant(n->get_arg(i)));
}
return true;
@ -545,7 +545,7 @@ namespace smt {
if (m_context.find_assignment(arg) == l_true && is_relevant(arg))
return true;
}
TRACE("check_relevancy", tout << "failed:\n" << mk_ll_pp(n, get_manager()); display(tout););
TRACE(check_relevancy, tout << "failed:\n" << mk_ll_pp(n, get_manager()); display(tout););
UNREACHABLE();
}
return true;
@ -572,7 +572,7 @@ namespace smt {
switch (m_context.find_assignment(n->get_arg(0))) {
case l_false:
if (get_manager().is_bool(n)) {
TRACE("ite_bug", tout << mk_bounded_pp(n, get_manager()) << "\n";);
TRACE(ite_bug, tout << mk_bounded_pp(n, get_manager()) << "\n";);
SASSERT(is_relevant(n->get_arg(2)));
}
else {
@ -604,7 +604,7 @@ namespace smt {
for (unsigned i = 0; i < sz; i++) {
expr * n = v.get(i);
if (is_relevant(n)) {
TRACE("check_relevancy", tout << "checking:\n" << mk_ll_pp(n, get_manager()) << "internalized: " << m_context.find_enode(n) << "\n";);
TRACE(check_relevancy, tout << "checking:\n" << mk_ll_pp(n, get_manager()) << "internalized: " << m_context.find_enode(n) << "\n";);
if (m.is_or(n)) {
SASSERT(check_relevancy_or(to_app(n), false));
}
@ -656,13 +656,13 @@ namespace smt {
rp.mark_as_relevant(m_parent->get_arg(0));
switch (rp.get_context().get_assignment(m_parent->get_arg(0))) {
case l_false:
TRACE("ite_term_relevancy", tout << "marking else: #" << m_else_eq->get_id() << "\n";);
TRACE(ite_term_relevancy, tout << "marking else: #" << m_else_eq->get_id() << "\n";);
rp.mark_as_relevant(m_else_eq);
break;
case l_undef:
break;
case l_true:
TRACE("ite_term_relevancy", tout << "marking then: #" << m_then_eq->get_id() << "\n";);
TRACE(ite_term_relevancy, tout << "marking then: #" << m_then_eq->get_id() << "\n";);
rp.mark_as_relevant(m_then_eq);
break;
}

View file

@ -52,14 +52,14 @@ namespace smt {
}
void setup::operator()(config_mode cm) {
TRACE("internalize", tout << "setup " << &m_context << "\n";);
TRACE(internalize, tout << "setup " << &m_context << "\n";);
SASSERT(m_context.get_scope_level() == 0);
SASSERT(!m_already_configured);
// if (m_params.m_mbqi && m_params.m_model_compact) {
// warning_msg("ignoring MODEL_COMPACT=true because it cannot be used with MBQI=true");
// m_params.m_model_compact = false;
// }
TRACE("setup", tout << "configuring logical context, logic: " << m_logic << " " << cm << "\n";);
TRACE(setup, tout << "configuring logical context, logic: " << m_logic << " " << cm << "\n";);
m_already_configured = true;
@ -142,7 +142,7 @@ namespace smt {
void setup::setup_auto_config() {
static_features st(m_manager);
IF_VERBOSE(100, verbose_stream() << "(smt.configuring)\n";);
TRACE("setup", tout << "setup, logic: " << m_logic << "\n";);
TRACE(setup, tout << "setup, logic: " << m_logic << "\n";);
// HACK: do not collect features for QF_BV and QF_AUFBV... since they do not use them...
if (m_logic == "QF_BV") {
setup_QF_BV();
@ -155,7 +155,7 @@ namespace smt {
ptr_vector<expr> fmls;
m_context.get_asserted_formulas(fmls);
st.collect(fmls.size(), fmls.data());
TRACE("setup", st.display_primitive(tout););
TRACE(setup, st.display_primitive(tout););
IF_VERBOSE(1000, st.display_primitive(verbose_stream()););
if (m_logic == "QF_UF")
setup_QF_UF(st);
@ -234,7 +234,7 @@ namespace smt {
void setup::setup_QF_UF(static_features const & st) {
check_no_arithmetic(st, "QF_UF");
setup_QF_UF();
TRACE("setup",
TRACE(setup,
tout << "st.m_num_theories: " << st.m_num_theories << "\n";
tout << "st.m_num_uninterpreted_functions: " << st.m_num_uninterpreted_functions << "\n";);
}
@ -268,7 +268,7 @@ namespace smt {
throw default_exception("Benchmark is not in QF_RDL (real difference logic).");
if (st.m_has_int)
throw default_exception("Benchmark has integer variables but it is marked as QF_RDL (real difference logic).");
TRACE("setup", tout << "setup_QF_RDL(st)\n";);
TRACE(setup, tout << "setup_QF_RDL(st)\n";);
check_no_uninterpreted_functions(st, "QF_RDL");
m_params.m_relevancy_lvl = 0;
m_params.m_arith_eq2ineq = true;
@ -294,11 +294,11 @@ namespace smt {
if (m_params.m_arith_auto_config_simplex || st.m_num_uninterpreted_constants > 4 * st.m_num_bool_constants
|| st.m_num_ite_terms > 0 /* theory_rdl and theory_frdl do not support ite-terms */) {
// if (!st.m_has_rational && !m_params.m_model && st.arith_k_sum_is_small()) {
// TRACE("rdl_bug", tout << "using theory_smi_arith\n";);
// TRACE(rdl_bug, tout << "using theory_smi_arith\n";);
// m_context.register_plugin(alloc(smt::theory_smi_arith, m_context));
// }
// else {
TRACE("rdl_bug", tout << "using theory_mi_arith\n";);
TRACE(rdl_bug, tout << "using theory_mi_arith\n";);
//setup_lra_arith();
m_context.register_plugin(alloc(smt::theory_mi_arith, m_context));
// }
@ -316,7 +316,7 @@ namespace smt {
}
void setup::setup_QF_IDL() {
TRACE("setup", tout << "setup_QF_IDL()\n";);
TRACE(setup, tout << "setup_QF_IDL()\n";);
m_params.setup_QF_IDL();
setup_lra_arith();
}
@ -326,9 +326,9 @@ namespace smt {
throw default_exception("Benchmark is not in QF_IDL (integer difference logic).");
if (st.m_has_real)
throw default_exception("Benchmark has real variables but it is marked as QF_IDL (integer difference logic).");
TRACE("setup", tout << "setup QF_IDL, m_arith_k_sum: " << st.m_arith_k_sum << " m_num_diff_terms: " << st.m_num_arith_terms << "\n";
TRACE(setup, tout << "setup QF_IDL, m_arith_k_sum: " << st.m_arith_k_sum << " m_num_diff_terms: " << st.m_num_arith_terms << "\n";
st.display_primitive(tout););
TRACE("setup", tout << "setup_QF_IDL(st)\n";);
TRACE(setup, tout << "setup_QF_IDL(st)\n";);
check_no_uninterpreted_functions(st, "QF_IDL");
m_params.m_relevancy_lvl = 0;
m_params.m_arith_eq2ineq = true;
@ -351,7 +351,7 @@ namespace smt {
m_params.m_random_initial_activity = IA_RANDOM;
}
TRACE("setup",
TRACE(setup,
tout << "RELEVANCY: " << m_params.m_relevancy_lvl << "\n";
tout << "ARITH_EQ_BOUNDS: " << m_params.m_arith_eq_bounds << "\n";);
@ -359,7 +359,7 @@ namespace smt {
m_context.register_plugin(alloc(smt::theory_mi_arith, m_context));
}
else if (!m_params.m_arith_auto_config_simplex && st.is_dense()) {
TRACE("setup", tout << "using dense diff logic...\n";);
TRACE(setup, tout << "using dense diff logic...\n";);
m_params.m_phase_selection = PS_CACHING_CONSERVATIVE;
if (st.arith_k_sum_is_small())
m_context.register_plugin(alloc(smt::theory_dense_si, m_context));
@ -369,24 +369,24 @@ namespace smt {
}
else {
// if (st.arith_k_sum_is_small()) {
// TRACE("setup", tout << "using small integer simplex...\n";
// TRACE(setup, tout << "using small integer simplex...\n";
// m_context.register_plugin(alloc(smt::theory_si_arith, m_context));
// }
// else {
TRACE("setup", tout << "using big integer simplex...\n";);
TRACE(setup, tout << "using big integer simplex...\n";);
m_context.register_plugin(alloc(smt::theory_i_arith, m_context));
// }
}
}
void setup::setup_QF_UFIDL() {
TRACE("setup", tout << "setup_QF_UFIDL()\n";);
TRACE(setup, tout << "setup_QF_UFIDL()\n";);
m_params.setup_QF_UFIDL();
setup_lra_arith();
}
void setup::setup_QF_UFIDL(static_features & st) {
TRACE("setup", tout << "setup_QF_UFIDL(st)\n";);
TRACE(setup, tout << "setup_QF_UFIDL(st)\n";);
if (st.m_has_real)
throw default_exception("Benchmark has real variables but it is marked as QF_UFIDL (uninterpreted functions and difference logic).");
m_params.m_relevancy_lvl = 0;
@ -425,7 +425,7 @@ namespace smt {
}
void setup::setup_QF_LRA() {
TRACE("setup", tout << "setup_QF_LRA()\n";);
TRACE(setup, tout << "setup_QF_LRA()\n";);
m_params.setup_QF_LRA();
setup_lra_arith();
}
@ -441,14 +441,14 @@ namespace smt {
}
void setup::setup_QF_LIA() {
TRACE("setup", tout << "setup_QF_LIA(st)\n";);
TRACE(setup, tout << "setup_QF_LIA(st)\n";);
m_params.setup_QF_LIA();
setup_lra_arith();
}
void setup::setup_QF_LIA(static_features const & st) {
check_no_uninterpreted_functions(st, "QF_LIA");
TRACE("setup", tout << "QF_LIA setup\n";);
TRACE(setup, tout << "QF_LIA setup\n";);
m_params.setup_QF_LIA(st);
setup_lra_arith();
}
@ -472,7 +472,7 @@ namespace smt {
}
void setup::setup_QF_BV() {
TRACE("setup", tout << "qf-bv\n";);
TRACE(setup, tout << "qf-bv\n";);
m_params.setup_QF_BV();
setup_bv();
}
@ -484,7 +484,7 @@ namespace smt {
}
void setup::setup_QF_AX() {
TRACE("setup", tout << "QF_AX\n";);
TRACE(setup, tout << "QF_AX\n";);
m_params.setup_QF_AX();
setup_arrays();
}
@ -495,7 +495,7 @@ namespace smt {
}
void setup::setup_QF_AUFLIA() {
TRACE("QF_AUFLIA", tout << "no static features\n";);
TRACE(QF_AUFLIA, tout << "no static features\n";);
m_params.setup_QF_AUFLIA();
setup_i_arith();
setup_arrays();
@ -508,9 +508,9 @@ namespace smt {
}
void setup::setup_AUFLIA(bool simple_array) {
TRACE("setup", tout << "AUFLIA\n";);
TRACE(setup, tout << "AUFLIA\n";);
m_params.setup_AUFLIA(simple_array);
TRACE("setup", tout << "max_eager_multipatterns: " << m_params.m_qi_max_eager_multipatterns << "\n";);
TRACE(setup, tout << "max_eager_multipatterns: " << m_params.m_qi_max_eager_multipatterns << "\n";);
m_context.register_plugin(alloc(smt::theory_i_arith, m_context));
setup_arrays();
}
@ -523,7 +523,7 @@ namespace smt {
}
void setup::setup_AUFLIRA(bool simple_array) {
TRACE("setup", tout << "AUFLIRA\n";);
TRACE(setup, tout << "AUFLIRA\n";);
m_params.setup_AUFLIRA(simple_array);
setup_mi_arith();
setup_arrays();
@ -732,12 +732,12 @@ namespace smt {
}
void setup::setup_datatypes() {
TRACE("datatype", tout << "registering theory datatype...\n";);
TRACE(datatype, tout << "registering theory datatype...\n";);
m_context.register_plugin(alloc(theory_datatype, m_context));
}
void setup::setup_recfuns() {
TRACE("recfun", tout << "registering theory recfun...\n";);
TRACE(recfun, tout << "registering theory recfun...\n";);
theory_recfun * th = alloc(theory_recfun, m_context);
m_context.register_plugin(th);
}
@ -815,7 +815,7 @@ namespace smt {
ptr_vector<expr> fmls;
m_context.get_asserted_formulas(fmls);
st.collect(fmls.size(), fmls.data());
TRACE("setup", tout << "setup_unknown\n";);
TRACE(setup, tout << "setup_unknown\n";);
setup_arith();
setup_arrays();
setup_bv();
@ -846,7 +846,7 @@ namespace smt {
}
void setup::setup_unknown(static_features & st) {
TRACE("setup", tout << "setup_unknown\n";);
TRACE(setup, tout << "setup_unknown\n";);
if (st.m_num_quantifiers > 0) {
if (st.m_has_real)
setup_AUFLIRA(false);
@ -863,7 +863,7 @@ namespace smt {
return;
}
TRACE("setup",
TRACE(setup,
tout << "num non UF theories: " << st.num_non_uf_theories() << "\n";
tout << "num theories: " << st.num_theories() << "\n";
tout << "is_diff_logic: " << is_diff_logic(st) << "\n";

View file

@ -196,7 +196,7 @@ namespace {
}
lbool check_sat_core2(unsigned num_assumptions, expr * const * assumptions) override {
TRACE("solver_na2as", tout << "smt_solver::check_sat_core: " << num_assumptions << "\n";);
TRACE(solver_na2as, tout << "smt_solver::check_sat_core: " << num_assumptions << "\n";);
return m_context.check(num_assumptions, assumptions);
}

View file

@ -135,7 +135,7 @@ namespace smt {
if (m.are_distinct(a, b))
return false_literal;
app_ref eq(ctx.mk_eq_atom(a, b), get_manager());
TRACE("mk_var_bug", tout << "mk_eq: " << eq->get_id() << " " << a->get_id() << " " << b->get_id() << "\n";
TRACE(mk_var_bug, tout << "mk_eq: " << eq->get_id() << " " << a->get_id() << " " << b->get_id() << "\n";
tout << mk_ll_pp(a, get_manager()) << "\n" << mk_ll_pp(b, get_manager()););
ctx.internalize(eq, gate_ctx);
return ctx.get_literal(eq);

View file

@ -512,22 +512,22 @@ namespace smt {
*/
template<typename VarValueTable>
bool assume_eqs(VarValueTable & table) {
TRACE("assume_eqs", tout << "starting...\n";);
TRACE(assume_eqs, tout << "starting...\n";);
table.reset();
bool result = false;
int num = get_num_vars();
for (theory_var v = 0; v < num; v++) {
enode * n = get_enode(v);
theory_var other = null_theory_var;
TRACE("assume_eqs",
TRACE(assume_eqs,
tout << "#" << n->get_owner_id() << " is_relevant_and_shared: " << is_relevant_and_shared(n) << "\n";);
if (n != nullptr && is_relevant_and_shared(n)) {
other = table.insert_if_not_there(v);
if (other != v) {
enode * n2 = get_enode(other);
TRACE("assume_eqs", tout << "value(#" << n->get_owner_id() << ") = value(#" << n2->get_owner_id() << ")\n";);
TRACE(assume_eqs, tout << "value(#" << n->get_owner_id() << ") = value(#" << n2->get_owner_id() << ")\n";);
if (assume_eq(n, n2)) {
TRACE("assume_eqs", tout << "new assumed eq\n";);
TRACE(assume_eqs, tout << "new assumed eq\n";);
result = true;
}
}

View file

@ -48,7 +48,7 @@ namespace smt {
m_thread[i] = i + 1;
}
TRACE("network_flow", {
TRACE(network_flow, {
tout << pp_vector("Predecessors", m_pred) << pp_vector("Threads", m_thread);
tout << pp_vector("Depths", m_depth) << pp_vector("Tree", m_tree);
});
@ -156,7 +156,7 @@ namespace smt {
SASSERT(is_ancestor_of(v, q));
TRACE("network_flow", {
TRACE(network_flow, {
tout << "update_spanning_tree: (" << p << ", " << q << ") enters, (";
tout << u << ", " << v << ") leaves\n";
});
@ -202,7 +202,7 @@ namespace smt {
SASSERT(!in_subtree_t2(u));
SASSERT(in_subtree_t2(v));
TRACE("network_flow", {
TRACE(network_flow, {
tout << pp_vector("Predecessors", m_pred) << pp_vector("Threads", m_thread);
tout << pp_vector("Depths", m_depth) << pp_vector("Tree", m_tree);
});

View file

@ -97,7 +97,7 @@ protected:
void reduce(goal& g) {
if (m.proofs_enabled())
return;
TRACE("ctx_solver_simplify_tactic", g.display(tout););
TRACE(ctx_solver_simplify_tactic, g.display(tout););
expr_ref fml(m);
tactic_report report("ctx-solver-simplify", g);
if (g.inconsistent())
@ -111,7 +111,7 @@ protected:
if (!m.inc())
return;
SASSERT(m_solver.get_scope_level() == 0);
TRACE("ctx_solver_simplify_tactic",
TRACE(ctx_solver_simplify_tactic,
for (expr* f : fmls) {
tout << mk_pp(f, m) << "\n";
}
@ -127,11 +127,11 @@ protected:
fml1 = m.mk_not(fml1);
m_solver.assert_expr(fml1);
lbool is_sat = m_solver.check();
TRACE("ctx_solver_simplify_tactic", tout << "is non-equivalence sat?: " << is_sat << "\n";);
TRACE(ctx_solver_simplify_tactic, tout << "is non-equivalence sat?: " << is_sat << "\n";);
if (is_sat == l_true) {
model_ref mdl;
m_solver.get_model(mdl);
TRACE("ctx_solver_simplify_tactic",
TRACE(ctx_solver_simplify_tactic,
tout << "result is not equivalent to input\n";
tout << mk_pp(fml1, m) << "\n";
tout << "evaluates to: " << (*mdl)(fml1) << "\n";
@ -203,7 +203,7 @@ protected:
goto done;
}
if (m.is_bool(e) && simplify_bool(n, res)) {
TRACE("ctx_solver_simplify_tactic",
TRACE(ctx_solver_simplify_tactic,
m_solver.display(tout) << "\n";
tout << "simplified: " << mk_pp(n, m) << "\n" << mk_pp(e, m) << " |-> " << mk_pp(res, m) << "\n";);
goto done;

View file

@ -55,7 +55,7 @@ public:
m_params_ref(p),
m_vars(m) {
updt_params_core(p);
TRACE("smt_tactic", tout << "p: " << p << "\n";);
TRACE(smt_tactic, tout << "p: " << p << "\n";);
}
tactic * translate(ast_manager & m) override {
@ -83,7 +83,7 @@ public:
}
void updt_params(params_ref const & p) override {
TRACE("smt_tactic", tout << "updt_params: " << p << "\n";);
TRACE(smt_tactic, tout << "updt_params: " << p << "\n";);
updt_params_core(p);
fparams().updt_params(p);
m_params_ref.copy(p);
@ -132,7 +132,7 @@ public:
m_params_ref.reset();
m_params_ref.append(o.params());
smt::kernel * new_ctx = alloc(smt::kernel, m, m_params, m_params_ref);
TRACE("smt_tactic", tout << "logic: " << o.m_logic << "\n";);
TRACE(smt_tactic, tout << "logic: " << o.m_logic << "\n";);
new_ctx->set_logic(o.m_logic);
if (o.m_callback) {
new_ctx->set_progress_callback(o.m_callback);
@ -159,15 +159,15 @@ public:
try {
IF_VERBOSE(10, verbose_stream() << "(smt.tactic start)\n";);
tactic_report report("smt", *in);
TRACE("smt_tactic", tout << this << "\nAUTO_CONFIG: " << fparams().m_auto_config << " HIDIV0: " << fparams().m_hi_div0 << " "
TRACE(smt_tactic, tout << this << "\nAUTO_CONFIG: " << fparams().m_auto_config << " HIDIV0: " << fparams().m_hi_div0 << " "
<< " PREPROCESS: " << fparams().m_preprocess << "\n";
tout << "RELEVANCY: " << fparams().m_relevancy_lvl << "\n";
tout << "fail-if-inconclusive: " << m_fail_if_inconclusive << "\n";
tout << "params_ref: " << m_params_ref << "\n";
tout << "nnf: " << fparams().m_nnf_cnf << "\n";);
TRACE("smt_tactic_params", m_params.display(tout););
TRACE("smt_tactic_detail", in->display(tout););
TRACE("smt_tactic_memory", tout << "wasted_size: " << m.get_allocator().get_wasted_size() << "\n";);
TRACE(smt_tactic_params, m_params.display(tout););
TRACE(smt_tactic_detail, in->display(tout););
TRACE(smt_tactic_memory, tout << "wasted_size: " << m.get_allocator().get_wasted_size() << "\n";);
scoped_init_ctx init(*this, m);
SASSERT(m_ctx);
@ -177,7 +177,7 @@ public:
ref<generic_model_converter> fmc;
if (in->unsat_core_enabled()) {
extract_clauses_and_dependencies(in, clauses, assumptions, bool2dep, fmc);
TRACE("mus", in->display_with_dependencies(tout);
TRACE(mus, in->display_with_dependencies(tout);
tout << clauses << "\n";);
if (in->proofs_enabled() && !assumptions.empty())
throw tactic_exception("smt tactic does not support simultaneous generation of proofs and unsat cores");
@ -210,14 +210,14 @@ public:
r = m_ctx->check(assumptions.size(), assumptions.data());
}
catch(...) {
TRACE("smt_tactic", tout << "exception\n";);
TRACE(smt_tactic, tout << "exception\n";);
m_ctx->collect_statistics(m_stats);
throw;
}
SASSERT(m_ctx);
m_ctx->collect_statistics(m_stats);
proof_ref pr(m_ctx->get_proof(), m);
TRACE("smt_tactic", tout << r << " " << pr << "\n";);
TRACE(smt_tactic, tout << r << " " << pr << "\n";);
switch (r) {
case l_true: {
if (m_fail_if_inconclusive && !in->sat_preserved())
@ -244,7 +244,7 @@ public:
}
case l_false: {
if (m_fail_if_inconclusive && !in->unsat_preserved()) {
TRACE("smt_tactic", tout << "failed to show to be unsat...\n";);
TRACE(smt_tactic, tout << "failed to show to be unsat...\n";);
throw tactic_exception("under-approximated goal found to be unsat");
}
// formula is unsat, reset the goal, and store false there.

View file

@ -73,7 +73,7 @@ struct unit_subsumption_tactic : public tactic {
r->elim_true();
result.push_back(r.get());
m_context.pop(2);
TRACE("unit_subsumption_tactic", g->display(tout); r->display(tout););
TRACE(unit_subsumption_tactic, g->display(tout); r->display(tout););
}
void assert_clauses(goal_ref const& g) {
@ -104,7 +104,7 @@ struct unit_subsumption_tactic : public tactic {
bool is_unsat = m_context.inconsistent();
m_context.pop(2);
if (is_unsat) {
TRACE("unit_subsumption_tactic", tout << "Removing clause " << i << "\n";);
TRACE(unit_subsumption_tactic, tout << "Removing clause " << i << "\n";);
m_is_deleted.set(i, true);
m_deleted.push_back(i);
}

View file

@ -182,13 +182,13 @@ namespace smt {
template<typename Ext>
typename theory_arith<Ext>::numeral theory_arith<Ext>::row::get_denominators_lcm() const {
numeral r(1);
TRACE("lcm_bug", tout << "starting get_denominators_lcm...\n";);
TRACE(lcm_bug, tout << "starting get_denominators_lcm...\n";);
typename vector<row_entry>::const_iterator it = m_entries.begin();
typename vector<row_entry>::const_iterator end = m_entries.end();
for (; it != end; ++it) {
if (!it->is_dead()) {
r = lcm(r, denominator(it->m_coeff));
TRACE("lcm_bug", tout << "it->m_coeff: " << it->m_coeff << ", denominator(it->m_coeff): " << denominator(it->m_coeff) << ", r: " << r << "\n";);
TRACE(lcm_bug, tout << "it->m_coeff: " << it->m_coeff << ", denominator(it->m_coeff): " << denominator(it->m_coeff) << ", r: " << r << "\n";);
}
}
return r;
@ -521,7 +521,7 @@ namespace smt {
typename vector<row_entry>::const_iterator end = r.end_entries();
for (; it != end; ++it) {
if (!it->is_dead() && !it->m_coeff.is_int()) {
TRACE("gomory_cut", display_row(tout, r, true););
TRACE(gomory_cut, display_row(tout, r, true););
return false;
}
}
@ -569,7 +569,7 @@ namespace smt {
void theory_arith<Ext>::move_unconstrained_to_base() {
if (lazy_pivoting_lvl() == 0)
return;
TRACE("move_unconstrained_to_base", tout << "before...\n"; display(tout););
TRACE(move_unconstrained_to_base, tout << "before...\n"; display(tout););
int num = get_num_vars();
for (theory_var v = 0; v < num; v++) {
if (m_var_occs[v].empty() && is_free(v)) {
@ -587,7 +587,7 @@ namespace smt {
case NON_BASE: {
col_entry const * entry = get_row_for_eliminating(v);
if (entry) {
TRACE("move_unconstrained_to_base", tout << "moving v" << v << " to the base\n";);
TRACE(move_unconstrained_to_base, tout << "moving v" << v << " to the base\n";);
row & r = m_rows[entry->m_row_id];
SASSERT(r[entry->m_row_idx].m_var == v);
pivot<false>(r.get_base_var(), v, r[entry->m_row_idx].m_coeff, m_eager_gcd);
@ -599,7 +599,7 @@ namespace smt {
} }
}
}
TRACE("move_unconstrained_to_base", tout << "after...\n"; display(tout););
TRACE(move_unconstrained_to_base, tout << "after...\n"; display(tout););
CASSERT("arith", wf_rows());
CASSERT("arith", wf_columns());
CASSERT("arith", valid_row_assignment());
@ -737,7 +737,7 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::derived_bound::push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled) {
TRACE("arith", tout << m_lits << " " << m_eqs.size() << "\n";);
TRACE(arith, tout << m_lits << " " << m_eqs.size() << "\n";);
if (proofs_enabled) {
for (literal l : m_lits)
a.push_lit(l, coeff, proofs_enabled);
@ -875,7 +875,7 @@ namespace smt {
bool use_upper = (kind == B_UPPER);
if (!it->m_coeff.is_pos())
use_upper = !use_upper;
TRACE("derived_bound", tout << "using " << (use_upper ? "upper" : "lower") << " bound of v" << v << "\n";);
TRACE(derived_bound, tout << "using " << (use_upper ? "upper" : "lower") << " bound of v" << v << "\n";);
bound * b = get_bound(v, use_upper);
SASSERT(b);
DEBUG_CODE({
@ -886,14 +886,14 @@ namespace smt {
accumulate_justification(*b, *new_bound, it->m_coeff, m_tmp_lit_set, m_tmp_eq_set);
}
}
TRACE("derived_bound",
TRACE(derived_bound,
tout << "explanation:\n";
for (literal l : new_bound->m_lits) tout << l << " ";
tout << " ";
for (auto const& e : new_bound->m_eqs)
tout << "#" << e.first->get_owner_id() << "=#" << e.second->get_owner_id() << " ";
tout << "\n";);
DEBUG_CODE(CTRACE("derived_bound", k != val, tout << "k: " << k << ", k_norm: " << k_norm << ", val: " << val << "\n";););
DEBUG_CODE(CTRACE(derived_bound, k != val, tout << "k: " << k << ", k_norm: " << k_norm << ", val: " << val << "\n";););
SASSERT(k == val);
}
@ -981,7 +981,7 @@ namespace smt {
was_unsafe |= is_unsafe;
bool inc_s = coeff.is_neg() ? inc : !inc;
unbounded &= !get_bound(s, inc_s);
TRACE("opt", tout << "is v" << x << " safe to leave for v" << s
TRACE(opt, tout << "is v" << x << " safe to leave for v" << s
<< "? " << (is_unsafe?"no":"yes") << " " << (has_int?"int":"real") << " " << (unbounded?"unbounded":"bounded") << "\n";
display_row(tout, r, true););
if (was_unsafe && !unbounded) return false;
@ -1040,7 +1040,7 @@ namespace smt {
template<typename Ext>
theory_var theory_arith<Ext>::add_objective(app* term) {
theory_var v = internalize_term_core(term);
TRACE("opt", tout << mk_pp(term, get_manager()) << " |-> v" << v << "\n";);
TRACE(opt, tout << mk_pp(term, get_manager()) << " |-> v" << v << "\n";);
SASSERT(!is_quasi_base(v));
if (!is_linear(get_manager(), term)) {
v = null_theory_var;
@ -1055,7 +1055,7 @@ namespace smt {
template<typename Ext>
inf_eps_rational<inf_rational> theory_arith<Ext>::maximize(theory_var v, expr_ref& blocker, bool& has_shared) {
TRACE("bound_bug", display_var(tout, v); display(tout););
TRACE(bound_bug, display_var(tout, v); display(tout););
if (ctx.get_fparams().m_threads > 1)
throw default_exception("multi-threaded optimization is not supported");
has_shared = false;
@ -1110,7 +1110,7 @@ namespace smt {
e = m_util.mk_gt(obj, e);
}
}
TRACE("opt", tout << e << "\n";);
TRACE(opt, tout << e << "\n";);
return e;
}
@ -1127,7 +1127,7 @@ namespace smt {
strm << val << " <= " << mk_pp(get_enode(v)->get_expr(), get_manager());
app* b = m.mk_const(symbol(strm.str()), m.mk_bool_sort());
expr_ref result(b, m);
TRACE("opt", tout << result << "\n";);
TRACE(opt, tout << result << "\n";);
if (!ctx.b_internalized(b)) {
fm.hide(b->get_decl());
bool_var bv = ctx.mk_bool_var(b);
@ -1139,7 +1139,7 @@ namespace smt {
m_var_occs[v].push_back(a);
m_atoms.push_back(a);
insert_bv2a(bv, a);
TRACE("arith", tout << mk_pp(b, m) << "\n";
TRACE(arith, tout << mk_pp(b, m) << "\n";
display_atom(tout, a, false););
}
return result;
@ -1349,7 +1349,7 @@ namespace smt {
}
has_shared |= ctx.is_shared(get_enode(s));
}
TRACE("opt",
TRACE(opt,
tout << (safe_gain(min_gain, max_gain)?"safe":"unsafe") << "\n";
tout << "min gain: " << min_gain;
tout << " max gain: " << max_gain << "\n";
@ -1414,7 +1414,7 @@ namespace smt {
if (is_int(x)) {
min_gain = inf_numeral::one();
}
TRACE("opt",
TRACE(opt,
tout << "v" << x << " := " << get_value(x) << " "
<< "min gain: " << min_gain << " "
<< "max gain: " << max_gain << "\n";);
@ -1473,7 +1473,7 @@ namespace smt {
if (!max_inc.is_minus_one()) {
if (is_int(x_i)) {
TRACE("opt",
TRACE(opt,
tout << "v" << x_i << " a_ij " << a_ij << " "
<< "min gain: " << min_gain << " "
<< "max gain: " << max_gain << "\n";);
@ -1490,7 +1490,7 @@ namespace smt {
is_tighter = true;
}
}
TRACE("opt",
TRACE(opt,
tout << "v" << x_i << (is_int(x_i)?" int":" real") << " a_ij " << a_ij << " "
<< "min gain: " << min_gain << " "
<< "max gain: " << max_gain << " tighter: "
@ -1555,7 +1555,7 @@ namespace smt {
++round;
(void)round;
TRACE("opt", tout << "round: " << round << ", max: " << max << "\n"; display_row(tout, r, true); tout << "state:\n"; display(tout););
TRACE(opt, tout << "round: " << round << ", max: " << max << "\n"; display_row(tout, r, true); tout << "state:\n"; display(tout););
typename vector<row_entry>::const_iterator it = r.begin_entries();
typename vector<row_entry>::const_iterator end = r.end_entries();
for (; it != end; ++it) {
@ -1578,12 +1578,12 @@ namespace smt {
if (!safe_to_leave) {
TRACE("opt", tout << "no variable picked\n";);
TRACE(opt, tout << "no variable picked\n";);
has_bound = true;
best_efforts++;
}
else if (curr_x_i == null_theory_var) {
TRACE("opt", tout << "v" << curr_x_j << " is unrestricted by other variables\n";);
TRACE(opt, tout << "v" << curr_x_j << " is unrestricted by other variables\n";);
// we can increase/decrease curr_x_j as much as we want.
x_i = null_theory_var; // unbounded
x_j = curr_x_j;
@ -1613,7 +1613,7 @@ namespace smt {
}
}
TRACE("opt", tout << "after traversing row:\nx_i: v" << x_i << ", x_j: v" << x_j << ", gain: " << max_gain << "\n";
TRACE(opt, tout << "after traversing row:\nx_i: v" << x_i << ", x_j: v" << x_j << ", gain: " << max_gain << "\n";
tout << "best efforts: " << best_efforts << " has shared: " << has_shared << "\n";);
@ -1625,7 +1625,7 @@ namespace smt {
}
if (x_j == null_theory_var) {
TRACE("opt", tout << "row is " << (max ? "maximized" : "minimized") << "\n";
TRACE(opt, tout << "row is " << (max ? "maximized" : "minimized") << "\n";
display_row(tout, r, true););
SASSERT(!maintain_integrality || valid_assignment());
SASSERT(satisfy_bounds());
@ -1643,7 +1643,7 @@ namespace smt {
if (max_gain.is_zero()) return BEST_EFFORT;
SASSERT(!unbounded_gain(max_gain));
update_value(x_j, max_gain);
TRACE("opt", tout << "moved v" << x_j << " to upper bound\n";);
TRACE(opt, tout << "moved v" << x_j << " to upper bound\n";);
SASSERT(!maintain_integrality || valid_assignment());
SASSERT(satisfy_bounds());
continue;
@ -1654,7 +1654,7 @@ namespace smt {
SASSERT(max_gain.is_pos());
max_gain.neg();
update_value(x_j, max_gain);
TRACE("opt", tout << "moved v" << x_j << " to lower bound\n";);
TRACE(opt, tout << "moved v" << x_j << " to lower bound\n";);
SASSERT(!maintain_integrality || valid_assignment());
SASSERT(satisfy_bounds());
continue;
@ -1684,11 +1684,11 @@ namespace smt {
(upper_bound(x_j) - lower_bound(x_j) == max_gain)) {
// can increase/decrease x_j up to upper/lower bound.
if (inc) {
TRACE("opt", tout << "moved v" << x_j << " to upper bound\n";);
TRACE(opt, tout << "moved v" << x_j << " to upper bound\n";);
}
else {
max_gain.neg();
TRACE("opt", tout << "moved v" << x_j << " to lower bound\n";);
TRACE(opt, tout << "moved v" << x_j << " to lower bound\n";);
}
update_value(x_j, max_gain);
SASSERT(!maintain_integrality || valid_assignment());
@ -1696,7 +1696,7 @@ namespace smt {
continue;
}
TRACE("opt", tout << "max: " << max << ", x_i: v" << x_i << ", x_j: v" << x_j << ", a_ij: " << a_ij << ", coeff: " << coeff << "\n";
TRACE(opt, tout << "max: " << max << ", x_i: v" << x_i << ", x_j: v" << x_j << ", a_ij: " << a_ij << ", coeff: " << coeff << "\n";
if (upper(x_i)) tout << "upper x_i: " << upper_bound(x_i) << " ";
if (lower(x_i)) tout << "lower x_i: " << lower_bound(x_i) << " ";
tout << "value x_i: " << get_value(x_i) << "\n";
@ -1712,7 +1712,7 @@ namespace smt {
bool inc_xi = inc?a_ij.is_neg():a_ij.is_pos();
if (!move_to_bound(x_i, inc_xi, best_efforts, has_shared)) {
TRACE("opt", tout << "can't move bound fully\n";);
TRACE(opt, tout << "can't move bound fully\n";);
// break; // break;
}
@ -1724,7 +1724,7 @@ namespace smt {
SASSERT(!maintain_integrality || valid_assignment());
SASSERT(satisfy_bounds());
}
TRACE("opt_verbose", display(tout););
TRACE(opt_verbose, display(tout););
return (best_efforts>0 || ctx.get_cancel_flag())?BEST_EFFORT:result;
}
@ -1760,7 +1760,7 @@ namespace smt {
}
bool result = false;
if (safe_gain(min_gain, max_gain)) {
TRACE("opt", tout << "Safe delta: " << max_gain << "\n";);
TRACE(opt, tout << "Safe delta: " << max_gain << "\n";);
SASSERT(!unbounded_gain(max_gain));
if (!inc) {
max_gain.neg();
@ -1805,7 +1805,7 @@ namespace smt {
SASSERT(satisfy_bounds());
SASSERT(!is_quasi_base(v));
if ((max && at_upper(v)) || (!max && at_lower(v))) {
TRACE("opt", display_var(tout << "At " << (max?"max: ":"min: ") << mk_pp(e, get_manager()) << " \n", v););
TRACE(opt, display_var(tout << "At " << (max?"max: ":"min: ") << mk_pp(e, get_manager()) << " \n", v););
return AT_BOUND; // nothing to be done...
}
m_tmp_row.reset();
@ -1823,16 +1823,16 @@ namespace smt {
}
max_min_t r = max_min(m_tmp_row, max, maintain_integrality, has_shared);
if (r == OPTIMIZED) {
TRACE("opt", tout << mk_pp(e, get_manager()) << " " << (max ? "max" : "min") << " value is: " << get_value(v) << "\n";
TRACE(opt, tout << mk_pp(e, get_manager()) << " " << (max ? "max" : "min") << " value is: " << get_value(v) << "\n";
display_row(tout, m_tmp_row, true); display_row_info(tout, m_tmp_row););
mk_bound_from_row(v, get_value(v), max ? B_UPPER : B_LOWER, m_tmp_row);
}
else if (r == UNBOUNDED) {
TRACE("opt", display_var(tout << "unbounded: " << mk_pp(e, get_manager()) << "\n", v););
TRACE(opt, display_var(tout << "unbounded: " << mk_pp(e, get_manager()) << "\n", v););
}
else {
TRACE("opt", display_var(tout << "not optimized: " << mk_pp(e, get_manager()) << "\n", v););
TRACE(opt, display_var(tout << "not optimized: " << mk_pp(e, get_manager()) << "\n", v););
}
return r;
}
@ -1856,7 +1856,7 @@ namespace smt {
if (succ) {
// process new bounds
bool r = propagate_core();
TRACE("opt", tout << "after max/min round:\n"; display(tout););
TRACE(opt, tout << "after max/min round:\n"; display(tout););
return r;
}
return true;
@ -1936,7 +1936,7 @@ namespace smt {
}
}
fi_succeeded:
TRACE("freedom_interval",
TRACE(freedom_interval,
tout << "freedom variable for:\n";
display_var(tout, x_j);
tout << "[";
@ -2017,7 +2017,7 @@ namespace smt {
SASSERT(m_tmp_row.size() > 0);
#if 0
TRACE("imply_eq", display_row_info(tout, m_tmp_row););
TRACE(imply_eq, display_row_info(tout, m_tmp_row););
m_tmp_acc_lits.reset();
m_tmp_acc_eqs.reset();
m_tmp_lit_set.reset();
@ -2028,7 +2028,7 @@ namespace smt {
(OPTIMIZED == max_min(m_tmp_row, false)) &&
is_zero_row(m_tmp_row, false, m_tmp_acc_lits, m_tmp_acc_eqs, m_tmp_lit_set, m_tmp_eq_set)) {
// v1 == v2
TRACE("imply_eq", tout << "found new implied equality:\n";
TRACE(imply_eq, tout << "found new implied equality:\n";
display_var(tout, v1); display_var(tout, v2););
// TODO: assert implied equality
// return true;
@ -2138,7 +2138,7 @@ namespace smt {
candidates.push_back(other);
}
}
TRACE("arith_rand", tout << "candidates.size() == " << candidates.size() << "\n";);
TRACE(arith_rand, tout << "candidates.size() == " << candidates.size() << "\n";);
if (candidates.empty())
return;
@ -2176,7 +2176,7 @@ namespace smt {
enode * r = n->get_root();
enode_vector::const_iterator it = r->begin_parents();
enode_vector::const_iterator end = r->end_parents();
TRACE("shared", tout << ctx.get_scope_level() << " " << v << " " << r->get_num_parents() << "\n";);
TRACE(shared, tout << ctx.get_scope_level() << " " << v << " " << r->get_num_parents() << "\n";);
for (; it != end; ++it) {
enode * parent = *it;
app * o = parent->get_expr();
@ -2200,7 +2200,7 @@ namespace smt {
// See comment in m_liberal_final_check declaration
if (m_liberal_final_check)
mutate_assignment();
TRACE("assume_eq_int", display(tout););
TRACE(assume_eq_int, display(tout););
unsigned old_sz = m_assume_eq_candidates.size();
m_var_value_table.reset();
@ -2237,7 +2237,7 @@ namespace smt {
enode* n1 = get_enode(v1);
enode* n2 = get_enode(v2);
m_assume_eq_head++;
CTRACE("arith",
CTRACE(arith,
get_value(v1) == get_value(v2) && n1->get_root() != n2->get_root(),
tout << "assuming eq: " << ctx.pp(n1) << " = #" << ctx.pp(n2) << "\n";);
if (get_value(v1) == get_value(v2) &&

View file

@ -29,14 +29,14 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::found_unsupported_op(app * n) {
CTRACE("arith", m_unsupported_ops.empty(), tout << "found non supported expression:\n" << mk_pp(n, m) << "\n";);
CTRACE(arith, m_unsupported_ops.empty(), tout << "found non supported expression:\n" << mk_pp(n, m) << "\n";);
m_unsupported_ops.push_back(n);
ctx.push_trail(push_back_vector<ptr_vector<app>>(m_unsupported_ops));
}
template<typename Ext>
void theory_arith<Ext>::found_underspecified_op(app * n) {
CTRACE("arith", m_underspecified_ops.empty(), tout << "found underspecified expression:\n" << mk_pp(n, m) << "\n";);
CTRACE(arith, m_underspecified_ops.empty(), tout << "found underspecified expression:\n" << mk_pp(n, m) << "\n";);
m_underspecified_ops.push_back(n);
ctx.push_trail(push_back_vector<ptr_vector<app>>(m_underspecified_ops));
@ -80,7 +80,7 @@ namespace smt {
static unsigned counter = 0;
counter++;
if (counter % 1000 == 0) {
TRACE("arith_adaptive", tout << "arith_conflicts: " << get_num_conflicts() << " total_conflicts: " << total_conflicts << " factor: " << f << "\n";);
TRACE(arith_adaptive, tout << "arith_conflicts: " << get_num_conflicts() << " total_conflicts: " << total_conflicts << " factor: " << f << "\n";);
}
});
return f >= adaptive_assertion_threshold();
@ -102,7 +102,7 @@ namespace smt {
SASSERT(r == static_cast<int>(m_columns.size()));
SASSERT(check_vector_sizes());
bool is_int = is_int_expr(n->get_expr());
TRACE("mk_arith_var", tout << mk_pp(n->get_expr(), m) << " is_int: " << is_int << "\n";);
TRACE(mk_arith_var, tout << mk_pp(n->get_expr(), m) << " is_int: " << is_int << "\n";);
m_columns .push_back(column());
m_data .push_back(var_data(is_int));
if (random_initial_value()) {
@ -129,7 +129,7 @@ namespace smt {
m_nl_monomials.push_back(r);
SASSERT(check_vector_sizes());
SASSERT(m_var_occs[r].empty());
TRACE("mk_arith_var",
TRACE(mk_arith_var,
tout << "#" << n->get_owner_id() << " :=\n" << mk_ll_pp(n->get_expr(), m) << "\n";
tout << "is_attached_to_var: " << is_attached_to_var(n) << ", var: " << n->get_th_var(get_id()) << "\n";);
ctx.attach_th_var(n, this, r);
@ -343,8 +343,8 @@ namespace smt {
*/
template<typename Ext>
theory_var theory_arith<Ext>::internalize_add(app * n) {
TRACE("add_bug", tout << "n: " << mk_pp(n, m) << "\n";);
CTRACE("internalize_add_bug", n->get_num_args() == 2 && n->get_arg(0) == n->get_arg(1), tout << "n: " << mk_pp(n, m) << "\n";);
TRACE(add_bug, tout << "n: " << mk_pp(n, m) << "\n";);
CTRACE(internalize_add_bug, n->get_num_args() == 2 && n->get_arg(0) == n->get_arg(1), tout << "n: " << mk_pp(n, m) << "\n";);
SASSERT(m_util.is_add(n));
unsigned r_id = mk_row();
scoped_row_vars _sc(m_row_vars, m_row_vars_top);
@ -376,7 +376,7 @@ namespace smt {
*/
template<typename Ext>
theory_var theory_arith<Ext>::internalize_mul_core(app * t) {
TRACE("internalize_mul_core", tout << "internalizing...\n" << mk_pp(t, m) << "\n";);
TRACE(internalize_mul_core, tout << "internalizing...\n" << mk_pp(t, m) << "\n";);
if (!m_util.is_mul(t))
return internalize_term_core(t);
for (expr* arg : *t) {
@ -400,7 +400,7 @@ namespace smt {
template<typename Ext>
theory_var theory_arith<Ext>::internalize_mul(app * m) {
rational _val;
TRACE("arith", tout << m->get_num_args() << " " << mk_pp(m, get_manager()) << "\n";);
TRACE(arith, tout << m->get_num_args() << " " << mk_pp(m, get_manager()) << "\n";);
SASSERT(m_util.is_mul(m));
expr* arg0 = m->get_arg(0);
expr* arg1 = m->get_arg(1);
@ -465,7 +465,7 @@ namespace smt {
template<typename Ext>
theory_var theory_arith<Ext>::internalize_mod(app * n) {
TRACE("arith_mod", tout << "internalizing...\n" << mk_pp(n, m) << "\n";);
TRACE(arith_mod, tout << "internalizing...\n" << mk_pp(n, m) << "\n";);
rational r(1);
theory_var s = mk_binary_op(n);
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
@ -511,7 +511,7 @@ namespace smt {
literal l_conseq = ctx.get_literal(s_conseq);
if (negated) l_conseq.neg();
TRACE("arith", tout << mk_pp(ante, m) << "\n" << mk_pp(conseq, m) << "\n";
TRACE(arith, tout << mk_pp(ante, m) << "\n" << mk_pp(conseq, m) << "\n";
tout << s_ante << "\n" << s_conseq << "\n";
tout << l_ante << "\n" << l_conseq << "\n";);
@ -544,12 +544,12 @@ namespace smt {
void theory_arith<Ext>::mk_div_axiom(expr * p, expr * q) {
if (!m_util.is_zero(q)) {
expr_ref div(m), zero(m), eqz(m), eq(m);
TRACE("div_axiom_bug", tout << "expanding div_axiom for: " << mk_pp(p, m) << " / " << mk_pp(q, m) << "\n";);
TRACE(div_axiom_bug, tout << "expanding div_axiom for: " << mk_pp(p, m) << " / " << mk_pp(q, m) << "\n";);
div = m_util.mk_div(p, q);
zero = m_util.mk_numeral(rational(0), false);
eqz = m.mk_eq(q, zero);
eq = m.mk_eq(m_util.mk_mul(q, div), p);
TRACE("div_axiom_bug", tout << "eqz: " << mk_pp(eqz, m) << "\neq: " << mk_pp(eq, m) << "\n";);
TRACE(div_axiom_bug, tout << "eqz: " << mk_pp(eqz, m) << "\neq: " << mk_pp(eq, m) << "\n";);
mk_axiom(eqz, eq);
}
}
@ -572,7 +572,7 @@ namespace smt {
eq = m.mk_eq(qr, dividend);
lower = m_util.mk_ge(mod, zero);
upper = m_util.mk_le(mod, abs_divisor);
TRACE("div_axiom_bug",
TRACE(div_axiom_bug,
tout << "eqz: " << eqz << "\n";
tout << "neq: " << eq << "\n";
tout << "lower: " << lower << "\n";
@ -611,7 +611,7 @@ namespace smt {
div_ge = m_util.mk_ge(m_util.mk_sub(dividend, m_util.mk_mul(divisor, div)), zero);
s(div_ge);
mk_axiom(eqz, div_ge, false);
TRACE("arith", tout << eqz << " " << div_ge << "\n");
TRACE(arith, tout << eqz << " " << div_ge << "\n");
}
if (m_params.m_arith_enum_const_mod && m_util.is_numeral(divisor, k) &&
@ -721,7 +721,7 @@ namespace smt {
SASSERT(n->get_num_args() == 1);
if (ctx.e_internalized(n))
return expr2var(n);
TRACE("to_real_bug", tout << "to-real\n" << mk_ismt2_pp(n, m) << "\n";);
TRACE(to_real_bug, tout << "to-real\n" << mk_ismt2_pp(n, m) << "\n";);
theory_var arg = internalize_term_core(to_app(n->get_arg(0)));
// n may be internalized by the call above if n is of the form (to_real (to_int t))
// The internalizer for (to_int t) will create (to_real (to_int t)) and internalize it.
@ -793,7 +793,7 @@ namespace smt {
*/
template<typename Ext>
theory_var theory_arith<Ext>::internalize_term_core(app * n) {
TRACE("arith_internalize_detail", tout << "internalize_term_core:\n" << mk_pp(n, m) << "\n";);
TRACE(arith_internalize_detail, tout << "internalize_term_core:\n" << mk_pp(n, m) << "\n";);
if (ctx.e_internalized(n)) {
enode * e = ctx.get_enode(n);
if (is_attached_to_var(e))
@ -845,10 +845,10 @@ namespace smt {
return mk_var(mk_enode(n));
}
TRACE("arith_internalize_detail", tout << "before:\n" << mk_pp(n, m) << "\n";);
TRACE(arith_internalize_detail, tout << "before:\n" << mk_pp(n, m) << "\n";);
if (!ctx.e_internalized(n))
ctx.internalize(n, false);
TRACE("arith_internalize_detail", tout << "after:\n" << mk_pp(n, m) << "\n";);
TRACE(arith_internalize_detail, tout << "after:\n" << mk_pp(n, m) << "\n";);
enode * e = ctx.get_enode(n);
if (!is_attached_to_var(e))
return mk_var(e);
@ -892,7 +892,7 @@ namespace smt {
theory_var s = r[r.size() - 1].m_var;
r.m_base_var = s;
set_var_row(s, r_id);
TRACE("init_row_bug", tout << "before:\n"; display_row_info(tout, r););
TRACE(init_row_bug, tout << "before:\n"; display_row_info(tout, r););
if (lazy_pivoting_lvl() > 2) {
set_var_kind(s, QUASI_BASE);
normalize_quasi_base_row(r_id);
@ -903,7 +903,7 @@ namespace smt {
SASSERT(get_var_kind(s) == BASE);
SASSERT(!has_var_kind(get_var_row(s), BASE));
}
TRACE("init_row_bug", tout << "after:\n"; display_row_info(tout, r););
TRACE(init_row_bug, tout << "after:\n"; display_row_info(tout, r););
if (propagation_mode() != bound_prop_mode::BP_NONE)
mark_row_for_bound_prop(r_id);
SASSERT(r.is_coeff_of(s, numeral::one()));
@ -949,10 +949,10 @@ namespace smt {
*/
template<typename Ext>
void theory_arith<Ext>::quasi_base_row2base_row(unsigned r_id) {
TRACE("quasi_base_row2base_row", tout << "quasi_base_row2base_row...\n";);
TRACE(quasi_base_row2base_row, tout << "quasi_base_row2base_row...\n";);
buffer<linear_monomial> to_add;
collect_vars(r_id, BASE, to_add);
TRACE("quasi_base_bug_detail",
TRACE(quasi_base_bug_detail,
display_row_info(tout, r_id);
for (unsigned i = 0; i < to_add.size(); i++) {
theory_var v = to_add[i].m_var;
@ -995,7 +995,7 @@ namespace smt {
save_value(s);
}
m_value[s] = get_implied_value(s);
TRACE("valid_row_assignment_bug", display_row_info(tout, r_id););
TRACE(valid_row_assignment_bug, display_row_info(tout, r_id););
SASSERT(!has_var_kind(r_id, BASE));
SASSERT(!has_var_kind(r_id, QUASI_BASE));
SASSERT(valid_row_assignment(m_rows[r_id]));
@ -1014,13 +1014,13 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::mk_clause(literal l1, literal l2, unsigned num_params, parameter * params) {
TRACE("arith", literal lits[2]; lits[0] = l1; lits[1] = l2; ctx.display_literals_verbose(tout, 2, lits); tout << "\n";);
TRACE(arith, literal lits[2]; lits[0] = l1; lits[1] = l2; ctx.display_literals_verbose(tout, 2, lits); tout << "\n";);
ctx.mk_th_axiom(get_id(), l1, l2, num_params, params);
}
template<typename Ext>
void theory_arith<Ext>::mk_clause(literal l1, literal l2, literal l3, unsigned num_params, parameter * params) {
TRACE("arith", literal lits[3]; lits[0] = l1; lits[1] = l2; lits[2] = l3; ctx.display_literals_verbose(tout, 3, lits); tout << "\n";);
TRACE(arith, literal lits[3]; lits[0] = l1; lits[1] = l2; lits[2] = l3; ctx.display_literals_verbose(tout, 3, lits); tout << "\n";);
ctx.mk_th_axiom(get_id(), l1, l2, l3, num_params, params);
}
@ -1028,7 +1028,7 @@ namespace smt {
void theory_arith<Ext>::mk_bound_axioms(atom * a1) {
theory_var v = a1->get_var();
atoms & occs = m_var_occs[v];
TRACE("mk_bound_axioms", tout << "add bound axioms for v" << v << " " << a1 << "\n";);
TRACE(mk_bound_axioms, tout << "add bound axioms for v" << v << " " << a1 << "\n";);
if (!ctx.is_searching()) {
//
// NB. We make an assumption that user push calls propagation
@ -1040,7 +1040,7 @@ namespace smt {
}
inf_numeral const & k1(a1->get_k());
atom_kind kind1 = a1->get_atom_kind();
TRACE("mk_bound_axioms", display_atom(tout << "making bound axioms for " << a1 << " ", a1, true); tout << "\n";);
TRACE(mk_bound_axioms, display_atom(tout << "making bound axioms for " << a1 << " ", a1, true); tout << "\n";);
typename atoms::iterator it = occs.begin();
typename atoms::iterator end = occs.end();
@ -1051,7 +1051,7 @@ namespace smt {
atom* a2 = *it;
inf_numeral const & k2(a2->get_k());
atom_kind kind2 = a2->get_atom_kind();
TRACE("mk_bound_axioms", display_atom(tout << "compare " << a2 << " ", a2, true); tout << "\n";);
TRACE(mk_bound_axioms, display_atom(tout << "compare " << a2 << " ", a2, true); tout << "\n";);
if (k1 == k2 && kind1 == kind2) {
continue;
@ -1085,7 +1085,7 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::mk_bound_axiom(atom* a1, atom* a2) {
TRACE("mk_bound_axioms", tout << a1 << " " << a2 << "\n";);
TRACE(mk_bound_axioms, tout << a1 << " " << a2 << "\n";);
theory_var v = a1->get_var();
literal l1(a1->get_bool_var());
literal l2(a2->get_bool_var());
@ -1152,7 +1152,7 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::flush_bound_axioms() {
CTRACE("arith_verbose", !m_new_atoms.empty(), tout << "flush bound axioms\n";);
CTRACE(arith_verbose, !m_new_atoms.empty(), tout << "flush bound axioms\n";);
while (!m_new_atoms.empty()) {
ptr_vector<atom> atoms;
@ -1167,7 +1167,7 @@ namespace smt {
--i;
}
}
CTRACE("arith", atoms.size() > 1, for (auto* a : atoms) a->display(*this, tout) << "\n";);
CTRACE(arith, atoms.size() > 1, for (auto* a : atoms) a->display(*this, tout) << "\n";);
ptr_vector<atom> occs(m_var_occs[v]);
std::sort(atoms.begin(), atoms.end(), compare_atoms());
@ -1274,7 +1274,7 @@ namespace smt {
template<typename Ext>
bool theory_arith<Ext>::internalize_atom(app * n, bool gate_ctx) {
TRACE("arith_internalize", tout << "internalizing atom:\n" << mk_bounded_pp(n, m) << "\n";);
TRACE(arith_internalize, tout << "internalizing atom:\n" << mk_bounded_pp(n, m) << "\n";);
SASSERT(m_util.is_le(n) || m_util.is_ge(n) || m_util.is_is_int(n));
SASSERT(!ctx.b_internalized(n));
atom_kind kind;
@ -1282,7 +1282,7 @@ namespace smt {
if (m_util.is_is_int(n)) {
internalize_is_int(n);
if (ctx.b_internalized(n)) {
TRACE("arith_internalize", tout << "term was re-internalized: #" << n->get_id() << "\n";);
TRACE(arith_internalize, tout << "term was re-internalized: #" << n->get_id() << "\n";);
return true;
}
bool_var bv = ctx.mk_bool_var(n);
@ -1306,11 +1306,11 @@ namespace smt {
}
theory_var v = internalize_term_core(lhs);
if (v == null_theory_var) {
TRACE("arith_internalize", tout << "failed to internalize: #" << n->get_id() << "\n";);
TRACE(arith_internalize, tout << "failed to internalize: #" << n->get_id() << "\n";);
return false;
}
if (ctx.b_internalized(n)) {
TRACE("arith_internalize", tout << "term was re-internalized: #" << n->get_id() << "\n";);
TRACE(arith_internalize, tout << "term was re-internalized: #" << n->get_id() << "\n";);
return true;
}
bool_var bv = ctx.mk_bool_var(n);
@ -1333,14 +1333,14 @@ namespace smt {
occs.push_back(a);
m_atoms.push_back(a);
insert_bv2a(bv, a);
TRACE("arith_internalize", tout << "succeeded... v" << v << " " << kind << " " << k << "\n");
TRACE(arith_internalize, tout << "succeeded... v" << v << " " << kind << " " << k << "\n");
return true;
}
template<typename Ext>
bool theory_arith<Ext>::internalize_term(app * term) {
theory_var v = internalize_term_core(term);
TRACE("arith_internalize", tout << "internalising term: v" << v << " " << mk_bounded_pp(term, m) << "\n";);
TRACE(arith_internalize, tout << "internalising term: v" << v << " " << mk_bounded_pp(term, m) << "\n";);
return v != null_theory_var;
}
@ -1358,7 +1358,7 @@ namespace smt {
if (n1->get_th_var(get_id()) != null_theory_var &&
n2->get_th_var(get_id()) != null_theory_var &&
n1 != n2) {
TRACE("mk_axioms_bug", tout << mk_bounded_pp(atom, m, 5) << "\n";);
TRACE(mk_axioms_bug, tout << mk_bounded_pp(atom, m, 5) << "\n";);
m_arith_eq_adapter.mk_axioms(n1, n2);
}
}
@ -1373,7 +1373,7 @@ namespace smt {
void theory_arith<Ext>::assign_eh(bool_var v, bool is_true) {
atom * a = get_bv2a(v);
if (!a) return;
TRACE("arith", tout << "assign p" << literal(v,!is_true) << " : " << mk_bounded_pp(ctx.bool_var2expr(v), m) << "\n";);
TRACE(arith, tout << "assign p" << literal(v,!is_true) << " : " << mk_bounded_pp(ctx.bool_var2expr(v), m) << "\n";);
SASSERT(ctx.get_assignment(a->get_bool_var()) != l_undef);
SASSERT((ctx.get_assignment(a->get_bool_var()) == l_true) == is_true);
a->assign_eh(is_true, get_epsilon(a->get_var()));
@ -1382,7 +1382,7 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::relevant_eh(app * n) {
TRACE("arith_relevant_eh", tout << "relevant_eh: " << mk_pp(n, m) << "\n";);
TRACE(arith_relevant_eh, tout << "relevant_eh: " << mk_pp(n, m) << "\n";);
if (m_util.is_mod(n))
mk_idiv_mod_axioms(n->get_arg(0), n->get_arg(1));
else if (m_util.is_rem(n))
@ -1397,7 +1397,7 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::new_eq_eh(theory_var v1, theory_var v2) {
TRACE("arith_new_eq_eh", tout << ctx.pp(get_enode(v1)) << "\n" << ctx.pp(get_enode(v2)) << "\n";);
TRACE(arith_new_eq_eh, tout << ctx.pp(get_enode(v1)) << "\n" << ctx.pp(get_enode(v2)) << "\n";);
enode * n1 = get_enode(v1);
@ -1451,7 +1451,7 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::new_diseq_eh(theory_var v1, theory_var v2) {
TRACE("arith_new_diseq_eh", tout << mk_bounded_pp(get_enode(v1)->get_expr(), m) << "\n" <<
TRACE(arith_new_diseq_eh, tout << mk_bounded_pp(get_enode(v1)->get_expr(), m) << "\n" <<
mk_bounded_pp(get_enode(v2)->get_expr(), m) << "\n";);
m_stats.m_assert_diseq++;
m_arith_eq_adapter.new_diseq_eh(v1, v2);
@ -1464,7 +1464,7 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::init_search_eh() {
TRACE("arith_init_search", display(tout););
TRACE(arith_init_search, display(tout););
m_num_conflicts = 0;
m_branch_cut_counter = 0;
m_eager_gcd = m_params.m_arith_eager_gcd;
@ -1490,22 +1490,22 @@ namespace smt {
SASSERT(m_to_patch.empty());
TRACE("arith", tout << "m_final_check_idx: " << m_final_check_idx << ", result: " << result << "\n";);
TRACE(arith, tout << "m_final_check_idx: " << m_final_check_idx << ", result: " << result << "\n";);
switch (m_final_check_idx) {
case 0:
ok = check_int_feasibility();
TRACE("arith", tout << "check_int_feasibility(), ok: " << ok << "\n";);
TRACE(arith, tout << "check_int_feasibility(), ok: " << ok << "\n";);
break;
case 1:
if (assume_eqs())
ok = FC_CONTINUE;
else
ok = FC_DONE;
TRACE("arith", tout << "assume_eqs(), ok: " << ok << "\n";);
TRACE(arith, tout << "assume_eqs(), ok: " << ok << "\n";);
break;
default:
ok = process_non_linear();
TRACE("arith", tout << "non_linear(), ok: " << ok << "\n";);
TRACE(arith, tout << "non_linear(), ok: " << ok << "\n";);
break;
}
m_final_check_idx = (m_final_check_idx + 1) % 3;
@ -1516,7 +1516,7 @@ namespace smt {
result = FC_GIVEUP;
break;
case FC_CONTINUE:
TRACE("arith",
TRACE(arith,
tout << "continue arith..."
<< (ctx.inconsistent()?"inconsistent\n":"\n"););
return FC_CONTINUE;
@ -1527,7 +1527,7 @@ namespace smt {
for (app* n : m_unsupported_ops) {
if (!ctx.is_relevant(n))
continue;
TRACE("arith", tout << "Found unsupported operation " << mk_pp(n, m) << "\n");
TRACE(arith, tout << "Found unsupported operation " << mk_pp(n, m) << "\n");
result = FC_GIVEUP;
}
}
@ -1536,8 +1536,8 @@ namespace smt {
template<typename Ext>
final_check_status theory_arith<Ext>::final_check_eh() {
TRACE("arith_eq_adapter_info", m_arith_eq_adapter.display_already_processed(tout););
TRACE("arith", display(tout););
TRACE(arith_eq_adapter_info, m_arith_eq_adapter.display_already_processed(tout););
TRACE(arith, display(tout););
if (!propagate_core())
return FC_CONTINUE;
@ -1554,7 +1554,7 @@ namespace smt {
m_liberal_final_check = false;
m_changed_assignment = false;
result = final_check_core();
TRACE("arith", tout << "result: " << result << "\n";);
TRACE(arith, tout << "result: " << result << "\n";);
return result;
}
@ -1869,7 +1869,7 @@ namespace smt {
SASSERT(m_value[v] == get_value(v));
m_old_value[v] = m_value[v];
m_update_trail_stack.push_back(v);
TRACE("save_value", tout << "v" << v << " = " << get_value(v) << "\n";);
TRACE(save_value, tout << "v" << v << " = " << get_value(v) << "\n";);
}
m_changed_assignment = true;
}
@ -1883,9 +1883,9 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::restore_assignment() {
CASSERT("arith", valid_row_assignment());
TRACE("restore_assignment_bug", tout << "START restore_assignment...\n";);
TRACE(restore_assignment_bug, tout << "START restore_assignment...\n";);
for (theory_var v : m_update_trail_stack) {
TRACE("restore_assignment_bug", tout << "restoring v" << v << " <- " << m_old_value[v] << "\n";);
TRACE(restore_assignment_bug, tout << "restoring v" << v << " <- " << m_old_value[v] << "\n";);
SASSERT(!is_quasi_base(v));
SASSERT(m_in_update_trail_stack.contains(v));
m_value[v] = m_old_value[v];
@ -1953,7 +1953,7 @@ namespace smt {
template<typename Ext>
template<bool Lazy>
void theory_arith<Ext>::pivot(theory_var x_i, theory_var x_j, numeral const & a_ij, bool apply_gcd_test) {
TRACE("arith_pivoting", tout << "pivoting: v" << x_i << ", v" << x_j << "\n";);
TRACE(arith_pivoting, tout << "pivoting: v" << x_i << ", v" << x_j << "\n";);
m_stats.m_pivots++;
SASSERT(is_base(x_i) || is_quasi_base(x_i));
SASSERT(x_i != x_j);
@ -1996,15 +1996,15 @@ namespace smt {
CASSERT("arith", wf_rows());
CASSERT("arith", wf_columns());
CASSERT("arith", valid_row_assignment());
TRACE("arith_pivot", tout << "after pivoting:\n";
TRACE(arith_pivot, tout << "after pivoting:\n";
display(tout););
TRACE("pivot_shape", display_rows_shape(tout););
TRACE("pivot_stats", display_rows_stats(tout););
TRACE(pivot_shape, display_rows_shape(tout););
TRACE(pivot_stats, display_rows_stats(tout););
TRACE_CODE({
static unsigned val = 0;
val ++;
if (val % 100 == 0) {
TRACE("pivot_bignums", display_rows_bignums(tout););
TRACE(pivot_bignums, display_rows_bignums(tout););
}});
}
@ -2042,7 +2042,7 @@ namespace smt {
}
}
}
CTRACE("eliminate", !Lazy && c.size() != 1,
CTRACE(eliminate, !Lazy && c.size() != 1,
tout << "eliminating v" << x_i << ", Lazy: " << Lazy << ", c.size: " << c.size() << "\n";
display(tout););
SASSERT(Lazy || c.size() == 1);
@ -2063,16 +2063,16 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::update_and_pivot(theory_var x_i, theory_var x_j, numeral const & a_ij, inf_numeral const & x_i_new_val) {
CASSERT("arith", valid_row_assignment());
TRACE("update_and_pivot_bug_detail", display(tout););
TRACE(update_and_pivot_bug_detail, display(tout););
SASSERT(is_base(x_i));
inf_numeral theta = m_value[x_i];
TRACE("update_and_pivot_bug", tout << "theta 1) " << theta << " " << x_i_new_val << "\n";);
TRACE(update_and_pivot_bug, tout << "theta 1) " << theta << " " << x_i_new_val << "\n";);
theta -= x_i_new_val;
TRACE("update_and_pivot_bug", tout << "theta 2) " << theta << " " << a_ij << "\n";);
TRACE(update_and_pivot_bug, tout << "theta 2) " << theta << " " << a_ij << "\n";);
theta /= a_ij;
TRACE("update_and_pivot_bug", tout << "theta 3) " << theta << "\n";);
TRACE(update_and_pivot_bug, tout << "theta 3) " << theta << "\n";);
update_value(x_j, theta);
CTRACE("arith", get_value(x_i) != x_i_new_val,
CTRACE(arith, get_value(x_i) != x_i_new_val,
tout << "x_i: " << x_i << ", x_j: " << x_j << ", a_ij: " << a_ij << ", x_i_new_val: " << x_i_new_val << "\n";
tout << "new val: " << get_value(x_i) << ", theta: " << theta << "\n";
display(tout););
@ -2215,8 +2215,8 @@ namespace smt {
*/
template<typename Ext>
theory_var theory_arith<Ext>::select_pivot(theory_var x_i, bool is_below, numeral & out_a_ij) {
TRACE("select_pivot", tout << "m_blands_rule: " << m_blands_rule << " v" << x_i << "\n";);
CTRACE("select_pivot_info", x_i > 500, ctx.display(tout););
TRACE(select_pivot, tout << "m_blands_rule: " << m_blands_rule << " v" << x_i << "\n";);
CTRACE(select_pivot_info, x_i > 500, ctx.display(tout););
if (m_blands_rule)
return select_blands_pivot_core(x_i, is_below, out_a_ij);
else if (is_below)
@ -2238,7 +2238,7 @@ namespace smt {
*/
template<typename Ext>
bool theory_arith<Ext>::make_var_feasible(theory_var x_i) {
CTRACE("arith_bug", !is_base(x_i),
CTRACE(arith_bug, !is_base(x_i),
tout << "x_i: " << x_i << ", below_lower(x_i): " << below_lower(x_i) <<
", above_upper(x_i): " << above_upper(x_i) << "\n"; display(tout););
SASSERT(is_base(x_i));
@ -2255,13 +2255,13 @@ namespace smt {
return true;
}
TRACE("make_var_feasible", display_row(tout, get_var_row(x_i), false););
TRACE(make_var_feasible, display_row(tout, get_var_row(x_i), false););
numeral a_ij;
theory_var x_j = select_pivot(x_i, is_below, a_ij);
if (x_j != null_theory_var) {
SASSERT(is_base(x_i));
TRACE("pivot_bug", display_row_info(tout, get_var_row(x_i)););
TRACE(pivot_bug, display_row_info(tout, get_var_row(x_i)););
update_and_pivot(x_i, x_j, a_ij, get_bound(x_i, !is_below)->get_value());
return true;
}
@ -2274,7 +2274,7 @@ namespace smt {
template<typename Ext>
theory_var theory_arith<Ext>::select_lg_error_var(bool least) {
TRACE("select_pivot", tout << "starting...\n";);
TRACE(select_pivot, tout << "starting...\n";);
theory_var best = null_theory_var;
inf_numeral best_error;
inf_numeral curr_error;
@ -2287,7 +2287,7 @@ namespace smt {
continue;
SASSERT(curr_error > inf_numeral(0));
if (best == null_theory_var || (!least && curr_error > best_error) || (least && curr_error < best_error)) {
TRACE("select_pivot", tout << "best: " << best << " v" << v
TRACE(select_pivot, tout << "best: " << best << " v" << v
<< ", best_error: " << best_error << ", curr_error: " << curr_error << "\n";);
best = v;
best_error = curr_error;
@ -2325,7 +2325,7 @@ namespace smt {
*/
template<typename Ext>
bool theory_arith<Ext>::make_feasible() {
TRACE("arith_make_feasible", tout << "make_feasible\n"; display(tout););
TRACE(arith_make_feasible, tout << "make_feasible\n"; display(tout););
CASSERT("arith", wf_rows());
CASSERT("arith", wf_columns());
CASSERT("arith", valid_row_assignment());
@ -2344,7 +2344,7 @@ namespace smt {
if (m_left_basis.contains(v)) {
num_repeated++;
if (num_repeated > blands_rule_threshold()) {
TRACE("blands_rule", tout << "using blands rule, " << num_repeated << "\n";);
TRACE(blands_rule, tout << "using blands rule, " << num_repeated << "\n";);
// std::cerr << "BLANDS RULE...\n";
m_blands_rule = true;
}
@ -2354,15 +2354,15 @@ namespace smt {
}
}
if (!make_var_feasible(v)) {
TRACE("arith_make_feasible", tout << "make_feasible: unsat\n"; display(tout););
TRACE(arith_make_feasible, tout << "make_feasible: unsat\n"; display(tout););
return false;
}
TRACE("arith_make_feasible_detail", display(tout););
TRACE(arith_make_feasible_detail, display(tout););
if (ctx.get_cancel_flag()) {
return true;
}
}
TRACE("arith_make_feasible", tout << "make_feasible: sat\n"; display(tout););
TRACE(arith_make_feasible, tout << "make_feasible: sat\n"; display(tout););
CASSERT("arith", wf_rows());
CASSERT("arith", wf_columns());
CASSERT("arith", valid_row_assignment());
@ -2418,7 +2418,7 @@ namespace smt {
explain_bound(r, idx, !is_below, delta, ante);
b->push_justification(ante, numeral(1), coeffs_enabled());
TRACE("sign_row_conflict", tout << "v" << x_i << " is_below: " << is_below << " delta: " << delta << "\n"; display_var(tout, x_i);
TRACE(sign_row_conflict, tout << "v" << x_i << " is_below: " << is_below << " delta: " << delta << "\n"; display_var(tout, x_i);
tout << "is_below_lower: " << below_lower(x_i) << ", is_above_upper: " << above_upper(x_i) << "\n";
display_row(tout, r, true);
display_row(tout, r, false);
@ -2461,7 +2461,7 @@ namespace smt {
SASSERT(get_var_kind(v) == BASE);
case BASE:
if (!m_to_patch.contains(v) && get_value(v) < k) {
TRACE("to_patch_bug", tout << "need to be patched (assert_lower): "; display_var(tout, v););
TRACE(to_patch_bug, tout << "need to be patched (assert_lower): "; display_var(tout, v););
m_to_patch.insert(v);
}
break;
@ -2489,7 +2489,7 @@ namespace smt {
theory_var v = b->get_var();
inf_numeral const & k = b->get_value();
TRACE("arith", display_bound(tout, b); tout << "v" << v << " <= " << k << "\n";);
TRACE(arith, display_bound(tout, b); tout << "v" << v << " <= " << k << "\n";);
bound * u = upper(v);
bound * l = lower(v);
@ -2509,7 +2509,7 @@ namespace smt {
SASSERT(get_var_kind(v) == BASE);
case BASE:
if (!m_to_patch.contains(v) && get_value(v) > k) {
TRACE("to_patch_bug", tout << "need to be patched (assert upper): "; display_var(tout, v););
TRACE(to_patch_bug, tout << "need to be patched (assert upper): "; display_var(tout, v););
m_to_patch.insert(v);
}
break;
@ -2530,11 +2530,11 @@ namespace smt {
template<typename Ext>
bool theory_arith<Ext>::assert_bound(bound * b) {
TRACE("assert_bound", display_bound(tout, b); display(tout););
TRACE(assert_bound, display_bound(tout, b); display(tout););
theory_var v = b->get_var();
if (b->is_atom()) {
CTRACE("unassigned_atoms", m_unassigned_atoms[v] <= 0, display_var(tout, v););
CTRACE(unassigned_atoms, m_unassigned_atoms[v] <= 0, display_var(tout, v););
SASSERT(m_unassigned_atoms[v] > 0);
push_dec_unassigned_atoms_trail(v);
m_unassigned_atoms[v]--;
@ -2552,7 +2552,7 @@ namespace smt {
break;
}
TRACE("arith_bound", tout << "result: " << result << "\n"; display(tout););
TRACE(arith_bound, tout << "result: " << result << "\n"; display(tout););
return result;
}
@ -2565,7 +2565,7 @@ namespace smt {
antecedents ante(*this);
b1->push_justification(ante, numeral(1), coeffs_enabled());
b2->push_justification(ante, numeral(1), coeffs_enabled());
TRACE("arith_conflict", tout << "bound conflict v" << b1->get_var() << "\n";
TRACE(arith_conflict, tout << "bound conflict v" << b1->get_var() << "\n";
display_bound(tout, b1, 0);
display_bound(tout, b2, 0););
set_conflict(ante, ante, "farkas");
@ -2647,7 +2647,7 @@ namespace smt {
if (!it->is_dead()) {
#define UPDATE_IDX(IDX) IDX = IDX == -1 ? i : -2
if (skip_big_coeffs() && it->m_coeff.is_big()) {
TRACE("is_row_useful", tout << "skipping row that contains big number...\n"; display_row_info(tout, r););
TRACE(is_row_useful, tout << "skipping row that contains big number...\n"; display_row_info(tout, r););
lower_idx = -2;
upper_idx = -2;
return;
@ -2700,7 +2700,7 @@ namespace smt {
// implied_k is a lower bound for entry.m_var
bound * curr = lower(entry.m_var);
if (curr == nullptr || implied_k > curr->get_value()) {
TRACE("arith_imply_bound",
TRACE(arith_imply_bound,
tout << "implying lower bound for v" << entry.m_var << " " << implied_k << " using row:\n";
display_row_info(tout, r);
display_var(tout, entry.m_var););
@ -2711,7 +2711,7 @@ namespace smt {
// implied_k is an upper bound for it->m_var
bound * curr = upper(entry.m_var);
if (curr == nullptr || implied_k < curr->get_value()) {
TRACE("arith_imply_bound",
TRACE(arith_imply_bound,
tout << "implying upper bound for v" << entry.m_var << " " << implied_k << " using row:\n";
display_row_info(tout, r);
display_var(tout, entry.m_var););
@ -2755,7 +2755,7 @@ namespace smt {
implied_k.addmul(it->m_coeff, b);
// implied_k is a bound for the monomial in position it
implied_k /= it->m_coeff;
TRACE("arith_imply_bound",
TRACE(arith_imply_bound,
display_var(tout, it->m_var);
tout << "implied bound: " << (it->m_coeff.is_pos() ? ">=" : "<=") << implied_k << "\n";);
if (it->m_coeff.is_pos() == is_lower) {
@ -2763,7 +2763,7 @@ namespace smt {
bound * curr = lower(it->m_var);
if (curr == nullptr || implied_k > curr->get_value()) {
// improved lower bound
TRACE("arith_imply_bound",
TRACE(arith_imply_bound,
tout << "implying lower bound for v" << it->m_var << " " << implied_k << " using row:\n";
display_row_info(tout, r);
display_var(tout, it->m_var););
@ -2775,7 +2775,7 @@ namespace smt {
bound * curr = upper(it->m_var);
if (curr == nullptr || implied_k < curr->get_value()) {
// improved upper bound
TRACE("arith_imply_bound",
TRACE(arith_imply_bound,
tout << "implying upper bound for v" << it->m_var << " " << implied_k << " using row:\n";
display_row_info(tout, r);
display_var(tout, it->m_var););
@ -2801,7 +2801,7 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::explain_bound(row const & r, int idx, bool is_lower, inf_numeral & delta, antecedents& ante) {
SASSERT(delta >= inf_numeral::zero());
TRACE("arith_conflict", tout << "delta: " << delta << " relax: " << relax_bounds() << " lits: " << ante.lits().size() << " eqs: " << ante.eqs().size() << " idx: " << idx << "\n";);
TRACE(arith_conflict, tout << "delta: " << delta << " relax: " << relax_bounds() << " lits: " << ante.lits().size() << " eqs: " << ante.eqs().size() << " idx: " << idx << "\n";);
if (!relax_bounds() && (!ante.lits().empty() || !ante.eqs().empty())) {
return;
@ -2817,7 +2817,7 @@ namespace smt {
}
typename vector<row_entry>::const_iterator it = r.begin_entries();
typename vector<row_entry>::const_iterator end = r.end_entries();
TRACE("arith_proof", display_row(tout, r, false); );
TRACE(arith_proof, display_row(tout, r, false); );
for (int idx2 = 0; it != end; ++it, ++idx2) {
if (!it->is_dead() && idx != idx2) {
bound * b = get_bound(it->m_var, is_lower ? it->m_coeff.is_pos() : it->m_coeff.is_neg());
@ -2826,7 +2826,7 @@ namespace smt {
continue;
}
if (!relax_bounds() || delta.is_zero()) {
TRACE("propagate_bounds", tout << "push justification: v" << it->m_var << "\n";);
TRACE(propagate_bounds, tout << "push justification: v" << it->m_var << "\n";);
b->push_justification(ante, it->m_coeff, coeffs_enabled());
continue;
}
@ -2850,7 +2850,7 @@ namespace smt {
// limit_k1 += delta * coeff;
limit_k1.addmul(inv_coeff, delta);
}
TRACE("propagate_bounds_bug", tout << "is_b_lower: " << is_b_lower << " k1: " << k_1 << " limit_k1: "
TRACE(propagate_bounds_bug, tout << "is_b_lower: " << is_b_lower << " k1: " << k_1 << " limit_k1: "
<< limit_k1 << " delta: " << delta << " coeff: " << coeff << "\n";);
inf_numeral k_2 = k_1;
atom * new_atom = nullptr;
@ -2863,7 +2863,7 @@ namespace smt {
if (val == l_undef)
continue;
// TODO: check if the following line is a bottleneck
TRACE("arith", tout << "v" << a->get_bool_var() << " " << (val == l_true) << "\n";);
TRACE(arith, tout << "v" << a->get_bool_var() << " " << (val == l_true) << "\n";);
a->assign_eh(val == l_true, get_epsilon(a->get_var()));
if (val != l_undef && a->get_bound_kind() == b->get_bound_kind()) {
@ -2892,14 +2892,14 @@ namespace smt {
SASSERT(!is_b_lower || k_2 < k_1);
SASSERT(is_b_lower || k_2 > k_1);
if (is_b_lower) {
TRACE("propagate_bounds", tout << "coeff: " << coeff << ", k_1 - k_2: " << k_1 - k_2 << ", delta: " << delta << "\n";);
TRACE(propagate_bounds, tout << "coeff: " << coeff << ", k_1 - k_2: " << k_1 - k_2 << ", delta: " << delta << "\n";);
delta -= coeff*(k_1 - k_2);
}
else {
TRACE("propagate_bounds", tout << "coeff: " << coeff << ", k_2 - k_1: " << k_2 - k_1 << ", delta: " << delta << "\n";);
TRACE(propagate_bounds, tout << "coeff: " << coeff << ", k_2 - k_1: " << k_2 - k_1 << ", delta: " << delta << "\n";);
delta -= coeff*(k_2 - k_1);
}
TRACE("propagate_bounds", tout << "delta (after replace): " << delta << "\n";);
TRACE(propagate_bounds, tout << "delta (after replace): " << delta << "\n";);
new_atom->push_justification(ante, coeff, coeffs_enabled());
SASSERT(delta >= inf_numeral::zero());
}
@ -2925,7 +2925,7 @@ namespace smt {
delta = k;
delta -= k2;
}
TRACE("propagate_bounds", tout << "v" << v << " >= " << k << ", v" << v << " >= " << k2 << ", delta: " << delta << "\n";
TRACE(propagate_bounds, tout << "v" << v << " >= " << k << ", v" << v << " >= " << k2 << ", delta: " << delta << "\n";
display_row(tout, r););
assign_bound_literal(l, r, idx, is_lower, delta);
++count;
@ -2942,7 +2942,7 @@ namespace smt {
delta -= k;
delta -= epsilon;
if (delta.is_nonneg()) {
TRACE("propagate_bounds", tout << "v" << v << " <= " << k << ", not v" << v << " >= " << k2 << ", delta: " << delta << "\n";
TRACE(propagate_bounds, tout << "v" << v << " <= " << k << ", not v" << v << " >= " << k2 << ", delta: " << delta << "\n";
display_row(tout, r););
assign_bound_literal(~l, r, idx, is_lower, delta);
++count;
@ -2958,7 +2958,7 @@ namespace smt {
delta -= k2;
delta -= epsilon;
if (delta.is_nonneg()) {
TRACE("propagate_bounds", tout << "v" << v << " >= " << k << ", not v" << v << " <= " << k2 << ", delta: " << delta << "\n";
TRACE(propagate_bounds, tout << "v" << v << " >= " << k << ", not v" << v << " <= " << k2 << ", delta: " << delta << "\n";
display_row(tout, r););
assign_bound_literal(~l, r, idx, is_lower, delta);
++count;
@ -2970,7 +2970,7 @@ namespace smt {
delta = k2;
delta -= k;
}
TRACE("propagate_bounds", tout << "v" << v << " <= " << k << ", v" << v << " <= " << k2 << ", delta: " << delta << "\n";
TRACE(propagate_bounds, tout << "v" << v << " <= " << k << ", v" << v << " <= " << k2 << ", delta: " << delta << "\n";
display_row(tout, r););
assign_bound_literal(l, r, idx, is_lower, delta);
++count;
@ -2990,11 +2990,11 @@ namespace smt {
explain_bound(r, idx, is_lower, delta, ante);
TRACE("propagate_bounds",
TRACE(propagate_bounds,
ante.display(tout) << " --> ";
ctx.display_detailed_literal(tout, l) << "\n");
TRACE("arith", tout << "@" << ctx.get_scope_level() << ": ";
TRACE(arith, tout << "@" << ctx.get_scope_level() << ": ";
ante.display(tout) << " --> ";
ctx.display_detailed_literal(tout, l) << "\n");
@ -3025,7 +3025,7 @@ namespace smt {
*/
template<typename Ext>
void theory_arith<Ext>::propagate_bounds() {
TRACE("propagate_bounds_detail", display(tout););
TRACE(propagate_bounds_detail, display(tout););
unsigned count = 0;
for (unsigned r_idx : m_to_check) {
row & r = m_rows[r_idx];
@ -3077,7 +3077,7 @@ namespace smt {
SASSERT(num_literals != 0 || num_eqs != 0);
m_stats.m_conflicts++;
m_num_conflicts++;
TRACE("arith_conflict",
TRACE(arith_conflict,
if (proof_rule)
tout << proof_rule << "\n";
tout << "@" << ctx.get_scope_level() << "\n";
@ -3184,7 +3184,7 @@ namespace smt {
if (u != nullptr)
update_epsilon(get_value(v), u->get_value());
}
TRACE("epsilon_bug", tout << "epsilon: " << m_epsilon << "\n";);
TRACE(epsilon_bug, tout << "epsilon: " << m_epsilon << "\n";);
}
/**
@ -3228,7 +3228,7 @@ namespace smt {
if (get_value(v) != get_value(v2)) {
// v and v2 are not known to be equal.
// The choice of m_epsilon is making them equal.
TRACE("refine_epsilon",
TRACE(refine_epsilon,
tout << "v" << v << " v" << v2 << " " << get_value(v) << " " << get_value(v2) << " " << value << std::endl;
);
refine = true;
@ -3243,13 +3243,13 @@ namespace smt {
return;
numeral two(2);
m_epsilon = m_epsilon / two;
TRACE("refine_epsilon", tout << "new epsilon..." << m_epsilon << std::endl;);
TRACE(refine_epsilon, tout << "new epsilon..." << m_epsilon << std::endl;);
}
}
template<typename Ext>
void theory_arith<Ext>::init_model(model_generator & mg) {
TRACE("theory_arith", tout << "init model invoked...\n";
TRACE(theory_arith, tout << "init model invoked...\n";
for (app* n : m_underspecified_ops) {
tout << mk_pp(n, m) << "\n";
});
@ -3279,7 +3279,7 @@ namespace smt {
inf_numeral const & val = get_value(v);
rational num = val.get_rational().to_rational() + m_epsilon.to_rational() * val.get_infinitesimal().to_rational();
if (is_int(v) && !num.is_int()) {
TRACE("arith", tout << "Truncating non-integer value. This is possible for non-linear constraints v" << v << " " << num << "\n";);
TRACE(arith, tout << "Truncating non-integer value. This is possible for non-linear constraints v" << v << " " << num << "\n";);
num = floor(num);
}
return alloc(expr_wrapper_proc, m_factory->mk_num_value(num, m_util.is_int(var2expr(v))));
@ -3368,7 +3368,7 @@ namespace smt {
CASSERT("arith", wf_rows());
CASSERT("arith", wf_columns());
CASSERT("arith", valid_row_assignment());
TRACE("arith_pop_scope_bug", display(tout););
TRACE(arith_pop_scope_bug, display(tout););
// The m_update_trail_stack may not be empty.
// In an old version, only propagate_core and methods invoked by propagate_core were
// inserting elements in the m_update_trail_stack stack.
@ -3492,13 +3492,13 @@ namespace smt {
case QUASI_BASE:
SASSERT(m_columns[v].size() == 1);
del_row(get_var_row(v));
TRACE("arith_make_feasible", tout << "del row v" << v << "\n";);
TRACE(arith_make_feasible, tout << "del row v" << v << "\n";);
break;
case BASE:
SASSERT(lazy_pivoting_lvl() != 0 || m_columns[v].size() == 1);
if (lazy_pivoting_lvl() > 0)
eliminate<false>(v, false);
TRACE("arith_make_feasible", tout << "del row v" << v << "\n";);
TRACE(arith_make_feasible, tout << "del row v" << v << "\n";);
del_row(get_var_row(v));
break;
case NON_BASE: {
@ -3510,10 +3510,10 @@ namespace smt {
pivot<false>(r.get_base_var(), v, r[entry->m_row_idx].m_coeff, false);
SASSERT(is_base(v));
del_row(get_var_row(v));
TRACE("arith_make_feasible", tout << "del row v" << v << "\n";);
TRACE(arith_make_feasible, tout << "del row v" << v << "\n";);
}
else {
TRACE("arith_make_feasible", tout << "no row v" << v << "\n";);
TRACE(arith_make_feasible, tout << "no row v" << v << "\n";);
}
break;
} }

View file

@ -63,7 +63,7 @@ namespace smt {
lower(v2)->push_justification(ante, numeral::zero(), proofs_enabled());
upper(v)->push_justification(ante, numeral::zero(), proofs_enabled());
TRACE("arith_eq", tout << "propagate eq: v" << v << " = v" << v2 << "\n";
TRACE(arith_eq, tout << "propagate eq: v" << v << " = v" << v2 << "\n";
display_var(tout, v);
display_var(tout, v2););
m_stats.m_fixed_eqs++;
@ -174,7 +174,7 @@ namespace smt {
timer.stop();
ok++;
if (ok % 100000 == 0) {
TRACE("arith_eq",
TRACE(arith_eq,
tout << total << " " << ok << " "
<< static_cast<double>(ok)/static_cast<double>(total)
<< " " << timer.get_seconds() << "\n";
@ -215,7 +215,7 @@ namespace smt {
void theory_arith<Ext>::propagate_cheap_eq(unsigned rid) {
if (!propagate_eqs())
return;
TRACE("arith_eq_verbose", tout << "checking if row " << rid << " can propagate equality.\n";
TRACE(arith_eq_verbose, tout << "checking if row " << rid << " can propagate equality.\n";
display_row_info(tout, rid););
row const & r = m_rows[rid];
theory_var x;
@ -245,7 +245,7 @@ namespace smt {
//
// x1 <= k1 x1 >= k1, x2 <= x1 + k2 x2 >= x1 + k2
//
TRACE("arith_eq", tout << "fixed\n";);
TRACE(arith_eq, tout << "fixed\n";);
lower(x2)->push_justification(ante, numeral::zero(), proofs_enabled());
upper(x2)->push_justification(ante, numeral::zero(), proofs_enabled());
m_stats.m_fixed_eqs++;
@ -258,7 +258,7 @@ namespace smt {
// found equality x = y
antecedents ante(*this);
collect_fixed_var_justifications(r, ante);
TRACE("arith_eq", tout << "propagate eq using x-y=0 row:\n"; display_row_info(tout, r););
TRACE(arith_eq, tout << "propagate eq using x-y=0 row:\n"; display_row_info(tout, r););
m_stats.m_offset_eqs++;
propagate_eq_to_core(x, y, ante);
}
@ -293,7 +293,7 @@ namespace smt {
antecedents ante(*this);
collect_fixed_var_justifications(r, ante);
collect_fixed_var_justifications(r2, ante);
TRACE("arith_eq", tout << "propagate eq two rows:\n";
TRACE(arith_eq, tout << "propagate eq two rows:\n";
tout << "x : v" << x << "\n";
tout << "x2 : v" << x2 << "\n";
display_row_info(tout, r);
@ -321,7 +321,7 @@ namespace smt {
enode * _x = get_enode(x);
enode * _y = get_enode(y);
// I doesn't make sense to propagate an equality (to the core) of variables of different sort.
CTRACE("arith", _x->get_sort() != _y->get_sort(), tout << enode_pp(_x, ctx) << " = " << enode_pp(_y, ctx) << "\n");
CTRACE(arith, _x->get_sort() != _y->get_sort(), tout << enode_pp(_x, ctx) << " = " << enode_pp(_y, ctx) << "\n");
if (_x->get_sort() != _y->get_sort())
return;
@ -335,7 +335,7 @@ namespace smt {
eqs.size(), eqs.data(),
_x, _y,
antecedents.num_params(), antecedents.params("eq-propagate")));
TRACE("arith_eq", tout << "detected equality: #" << _x->get_owner_id() << " = #" << _y->get_owner_id() << "\n";
TRACE(arith_eq, tout << "detected equality: #" << _x->get_owner_id() << " = #" << _y->get_owner_id() << "\n";
display_var(tout, x);
display_var(tout, y);
for (literal lit : lits)

View file

@ -147,7 +147,7 @@ namespace smt {
template<typename Ext>
theory_var theory_arith<Ext>::find_infeasible_int_base_var() {
theory_var r = find_bounded_infeasible_int_base_var();
CTRACE("find_infeasible_int_base_var", r != null_theory_var, display_var(tout << "bounded infeasible", r););
CTRACE(find_infeasible_int_base_var, r != null_theory_var, display_var(tout << "bounded infeasible", r););
unsigned n = 0;
@ -169,7 +169,7 @@ namespace smt {
}
}
}
CTRACE("find_infeasible_int_base_var", r != null_theory_var, tout << "found small value v" << r << "\n");
CTRACE(find_infeasible_int_base_var, r != null_theory_var, tout << "found small value v" << r << "\n");
}
if (r == null_theory_var) {
@ -179,7 +179,7 @@ namespace smt {
SELECT_VAR(v);
}
}
CTRACE("find_infeasible_int_base_var", r != null_theory_var, tout << "found base v" << r << "\n");
CTRACE(find_infeasible_int_base_var, r != null_theory_var, tout << "found base v" << r << "\n");
}
@ -191,7 +191,7 @@ namespace smt {
SELECT_VAR(v);
}
}
CTRACE("find_infeasible_int_base_var", r != null_theory_var, tout << "found quasi base v" << r << "\n");
CTRACE(find_infeasible_int_base_var, r != null_theory_var, tout << "found quasi base v" << r << "\n");
}
CASSERT("arith", wf_rows());
CASSERT("arith", wf_columns());
@ -210,7 +210,7 @@ namespace smt {
m_stats.m_branches++;
numeral k = ceil(get_value(v));
rational _k = k.to_rational();
TRACE("arith_int", tout << "branching v" << v << " = " << get_value(v) << "\n";
TRACE(arith_int, tout << "branching v" << v << " = " << get_value(v) << "\n";
display_var(tout, v);
tout << "k = " << k << ", _k = "<< _k << std::endl;
);
@ -222,7 +222,7 @@ namespace smt {
std::function<expr*(void)> fn = [&]() { return m.mk_or(bound, m.mk_not(bound)); };
scoped_trace_stream _sts(*this, fn);
IF_VERBOSE(10, verbose_stream() << "branch " << bound << "\n");
TRACE("arith_int", tout << mk_bounded_pp(bound, m) << "\n";);
TRACE(arith_int, tout << mk_bounded_pp(bound, m) << "\n";);
ctx.internalize(bound, true);
ctx.mark_as_relevant(bound.get());
}
@ -255,7 +255,7 @@ namespace smt {
for (auto const& r : m_rows) {
theory_var b = r.get_base_var();
if (b == null_theory_var) {
TRACE("arith_int", display_row(tout << "null: ", r, true); );
TRACE(arith_int, display_row(tout << "null: ", r, true); );
continue;
}
bool is_tight = false;
@ -273,7 +273,7 @@ namespace smt {
const_coeff = u->get_value().get_rational();
}
if (!is_tight) {
TRACE("arith_int",
TRACE(arith_int,
display_row(tout << "!tight: ", r, true);
display_var(tout, b);
);
@ -299,7 +299,7 @@ namespace smt {
continue;
}
if (!is_int(x)) {
TRACE("arith_int", display_row(tout << "!int: ", r, true); );
TRACE(arith_int, display_row(tout << "!int: ", r, true); );
is_tight = false;
continue;
}
@ -327,7 +327,7 @@ namespace smt {
row[i] *= denom.to_rational();
}
}
TRACE("arith_int",
TRACE(arith_int,
tout << "extracted row:\n";
for (unsigned i = 0; i < max_row; ++i) {
tout << row[i] << " ";
@ -368,7 +368,7 @@ namespace smt {
}
}
if (pol.empty()) {
TRACE("arith_int", tout << "The witness is trivial\n";);
TRACE(arith_int, tout << "The witness is trivial\n";);
return false;
}
expr_ref p1(get_manager()), p2(get_manager());
@ -390,7 +390,7 @@ namespace smt {
ctx.mk_th_axiom(get_id(), l1, l2);
}
TRACE("arith_int",
TRACE(arith_int,
tout << "cut: (or " << mk_pp(p1, get_manager()) << " " << mk_pp(p2, get_manager()) << ")\n";
);
@ -471,10 +471,10 @@ namespace smt {
expr_ref pol(m);
pol = m_util.mk_add(_args.size(), _args.data());
result = m_util.mk_ge(pol, m_util.mk_numeral(k, all_int));
TRACE("arith_mk_polynomial", tout << "before simplification:\n" << result << "\n";);
TRACE(arith_mk_polynomial, tout << "before simplification:\n" << result << "\n";);
proof_ref pr(m);
get_context().get_rewriter()(result, result, pr);
TRACE("arith_mk_polynomial", tout << "after simplification:\n" << result << "\n";);
TRACE(arith_mk_polynomial, tout << "after simplification:\n" << result << "\n";);
SASSERT(is_well_sorted(get_manager(), result));
}
@ -511,12 +511,12 @@ namespace smt {
bool cfv = constrain_free_vars(r);
if (cfv || !is_gomory_cut_target(r)) {
TRACE("gomory_cut", tout << "failed to apply gomory cut:\n";
TRACE(gomory_cut, tout << "failed to apply gomory cut:\n";
tout << "constrain_free_vars(r): " << cfv << "\n";);
return false;
}
TRACE("gomory_cut", tout << "applying cut at:\n"; display_row_info(tout, r););
TRACE(gomory_cut, tout << "applying cut at:\n"; display_row_info(tout, r););
antecedents ante(*this);
@ -564,14 +564,14 @@ namespace smt {
k.addmul(new_a_ij, upper_bound(x_j).get_rational());
upper(x_j)->push_justification(ante, new_a_ij, coeffs_enabled());
}
TRACE("gomory_cut_detail", tout << a_ij << "*v" << x_j << " k: " << k << "\n";);
TRACE(gomory_cut_detail, tout << a_ij << "*v" << x_j << " k: " << k << "\n";);
pol.push_back(row_entry(new_a_ij, x_j));
}
else {
++num_ints;
SASSERT(is_int(x_j));
numeral f_j = Ext::fractional_part(a_ij);
TRACE("gomory_cut_detail",
TRACE(gomory_cut_detail,
tout << a_ij << "*v" << x_j << "\n";
tout << "fractional_part: " << Ext::fractional_part(a_ij) << "\n";
tout << "f_j: " << f_j << "\n";
@ -601,7 +601,7 @@ namespace smt {
k.addmul(new_a_ij, upper_bound(x_j).get_rational());
upper(x_j)->push_justification(ante, new_a_ij, coeffs_enabled());
}
TRACE("gomory_cut_detail", tout << "new_a_ij: " << new_a_ij << " k: " << k << "\n";);
TRACE(gomory_cut_detail, tout << "new_a_ij: " << new_a_ij << " k: " << k << "\n";);
pol.push_back(row_entry(new_a_ij, x_j));
lcm_den = lcm(lcm_den, denominator(new_a_ij));
}
@ -609,7 +609,7 @@ namespace smt {
}
}
CTRACE("empty_pol", pol.empty(), display_row_info(tout, r););
CTRACE(empty_pol, pol.empty(), display_row_info(tout, r););
expr_ref bound(get_manager());
if (pol.empty()) {
@ -636,7 +636,7 @@ namespace smt {
else {
if (num_ints > 0) {
lcm_den = lcm(lcm_den, denominator(k));
TRACE("gomory_cut_detail", tout << "k: " << k << " lcm_den: " << lcm_den << "\n";
TRACE(gomory_cut_detail, tout << "k: " << k << " lcm_den: " << lcm_den << "\n";
for (unsigned i = 0; i < pol.size(); i++) {
tout << pol[i].m_coeff << " " << pol[i].m_var << "\n";
}
@ -651,7 +651,7 @@ namespace smt {
}
k *= lcm_den;
}
TRACE("gomory_cut_detail", tout << "after *lcm\n";
TRACE(gomory_cut_detail, tout << "after *lcm\n";
for (unsigned i = 0; i < pol.size(); i++) {
tout << pol[i].m_coeff << " * v" << pol[i].m_var << "\n";
}
@ -659,7 +659,7 @@ namespace smt {
}
mk_polynomial_ge(pol.size(), pol.data(), k.to_rational(), bound);
}
TRACE("gomory_cut", tout << "new cut:\n" << bound << "\n"; ante.display(tout););
TRACE(gomory_cut, tout << "new cut:\n" << bound << "\n"; ante.display(tout););
literal l = null_literal;
context & ctx = get_context();
{
@ -695,7 +695,7 @@ namespace smt {
return true;
m_stats.m_gcd_tests++;
numeral lcm_den = r.get_denominators_lcm();
TRACE("gcd_test_bug", r.display(tout); tout << "lcm: " << lcm_den << "\n";);
TRACE(gcd_test_bug, r.display(tout); tout << "lcm: " << lcm_den << "\n";);
numeral consts(0);
numeral gcds(0);
numeral least_coeff(0);
@ -729,7 +729,7 @@ namespace smt {
}
SASSERT(gcds.is_int());
SASSERT(least_coeff.is_int());
TRACE("gcd_test_bug", tout << "coeff: " << e.m_coeff << ", gcds: " << gcds
TRACE(gcd_test_bug, tout << "coeff: " << e.m_coeff << ", gcds: " << gcds
<< " least_coeff: " << least_coeff << " consts: " << consts << "\n";);
}
}
@ -742,7 +742,7 @@ namespace smt {
}
if (!(consts / gcds).is_int()) {
TRACE("gcd_test", tout << "row failed the GCD test:\n"; display_row_info(tout, r););
TRACE(gcd_test, tout << "row failed the GCD test:\n"; display_row_info(tout, r););
antecedents ante(*this);
m_stats.m_gcd_conflicts++;
collect_fixed_var_justifications(r, ante);
@ -822,7 +822,7 @@ namespace smt {
if (u1 < l1) {
m_stats.m_gcd_conflicts++;
TRACE("gcd_test", tout << "row failed the extended GCD test:\n"; display_row_info(tout, r););
TRACE(gcd_test, tout << "row failed the extended GCD test:\n"; display_row_info(tout, r););
collect_fixed_var_justifications(r, ante);
context & ctx = get_context();
ctx.set_conflict(
@ -902,7 +902,7 @@ namespace smt {
// check whether value of v is already a multiple of m.
if ((get_value(v).get_rational() / m).is_int())
continue;
TRACE("patch_int",
TRACE(patch_int,
tout << "TARGET v" << v << " -> [";
if (inf_l) tout << "-oo"; else tout << ceil(l);
tout << ", ";
@ -957,13 +957,13 @@ namespace smt {
*/
template<typename Ext>
final_check_status theory_arith<Ext>::check_int_feasibility() {
TRACE("arith_int_detail", get_context().display(tout););
TRACE(arith_int_detail, get_context().display(tout););
if (!has_infeasible_int_var()) {
TRACE("arith", tout << "FC_DONE 1...\n"; display(tout););
TRACE(arith, tout << "FC_DONE 1...\n"; display(tout););
return FC_DONE;
}
TRACE("arith",
TRACE(arith,
int num = get_num_vars();
for (theory_var v = 0; v < num; v++) {
if (is_int(v) && !get_value(v).is_int()) {
@ -976,7 +976,7 @@ namespace smt {
}
});
TRACE("arith_int_fracs_min_max",
TRACE(arith_int_fracs_min_max,
numeral max(0);
numeral min(1);
int num = get_num_vars();
@ -993,7 +993,7 @@ namespace smt {
tout << "max: " << max << ", min: " << min << "\n";);
if (m_params.m_arith_ignore_int) {
TRACE("arith", tout << "Ignore int: give up\n";);
TRACE(arith, tout << "Ignore int: give up\n";);
return FC_GIVEUP;
}
@ -1005,7 +1005,7 @@ namespace smt {
remove_fixed_vars_from_base();
TRACE("arith_int_freedom",
TRACE(arith_int_freedom,
int num = get_num_vars();
bool inf_l; bool inf_u;
inf_numeral l; inf_numeral u;
@ -1030,7 +1030,7 @@ namespace smt {
if (get_context().inconsistent())
return FC_CONTINUE;
TRACE("arith_int_inf",
TRACE(arith_int_inf,
int num = get_num_vars();
for (theory_var v = 0; v < num; v++) {
if (is_int(v) && !get_value(v).is_int()) {
@ -1038,7 +1038,7 @@ namespace smt {
}
});
TRACE("arith_int_rows",
TRACE(arith_int_rows,
unsigned num = 0;
for (auto const& e : m_rows) {
theory_var v = e.get_base_var();
@ -1055,7 +1055,7 @@ namespace smt {
theory_var int_var = find_infeasible_int_base_var();
if (int_var == null_theory_var) {
m_stats.m_patches_succ++;
TRACE("arith_int_incomp", tout << "FC_DONE 2...\n"; display(tout););
TRACE(arith_int_incomp, tout << "FC_DONE 2...\n"; display(tout););
return m_liberal_final_check || !m_changed_assignment ? FC_DONE : FC_CONTINUE;
}
@ -1072,22 +1072,22 @@ namespace smt {
m_branch_cut_counter++;
// TODO: add giveup code
TRACE("gomory_cut", tout << m_branch_cut_counter << ", " << m_params.m_arith_branch_cut_ratio << std::endl;);
TRACE(gomory_cut, tout << m_branch_cut_counter << ", " << m_params.m_arith_branch_cut_ratio << std::endl;);
if (m_branch_cut_counter % m_params.m_arith_branch_cut_ratio == 0) {
TRACE("opt_verbose", display(tout););
TRACE(opt_verbose, display(tout););
move_non_base_vars_to_bounds();
if (!make_feasible()) {
TRACE("arith_int", tout << "failed to move variables to bounds.\n";);
TRACE(arith_int, tout << "failed to move variables to bounds.\n";);
failed();
return FC_CONTINUE;
}
theory_var int_var = find_infeasible_int_base_var();
if (int_var != null_theory_var) {
TRACE("arith_int", tout << "v" << int_var << " does not have an integer assignment: " << get_value(int_var) << "\n";);
TRACE(arith_int, tout << "v" << int_var << " does not have an integer assignment: " << get_value(int_var) << "\n";);
SASSERT(is_base(int_var));
row const & r = m_rows[get_var_row(int_var)];
if (!mk_gomory_cut(r)) {
TRACE("gomory_cut", tout << "silent failure\n";);
TRACE(gomory_cut, tout << "silent failure\n";);
}
return FC_CONTINUE;
}
@ -1100,7 +1100,7 @@ namespace smt {
theory_var int_var = find_infeasible_int_base_var();
if (int_var != null_theory_var) {
TRACE("arith_int", tout << "v" << int_var << " does not have an integer assignment: " << get_value(int_var) << "\n";);
TRACE(arith_int, tout << "v" << int_var << " does not have an integer assignment: " << get_value(int_var) << "\n";);
// apply branching
branch_infeasible_int_var(int_var);
++m_stats.m_branch_infeasible_var;

View file

@ -78,21 +78,21 @@ namespace smt {
int i = 0;
theory_var s = r.m_base_var;
SASSERT(is_base(s) || is_quasi_base(s));
CTRACE("arith_bug", !(!is_base(s) || (!has_var_kind(r_id, BASE) && !has_var_kind(r_id, QUASI_BASE))),
CTRACE(arith_bug, !(!is_base(s) || (!has_var_kind(r_id, BASE) && !has_var_kind(r_id, QUASI_BASE))),
display_row_info(tout, r_id););
SASSERT(!is_base(s) || (!has_var_kind(r_id, BASE) && !has_var_kind(r_id, QUASI_BASE)));
CTRACE("arith_bug", is_quasi_base(s) && has_var_kind(r_id, QUASI_BASE), display_row_info(tout, r_id););
CTRACE(arith_bug, is_quasi_base(s) && has_var_kind(r_id, QUASI_BASE), display_row_info(tout, r_id););
SASSERT(!is_quasi_base(s) || !has_var_kind(r_id, QUASI_BASE));
SASSERT(r.is_coeff_of(s, numeral::one()));
typename vector<row_entry>::const_iterator it = r.begin_entries();
typename vector<row_entry>::const_iterator end = r.end_entries();
for (; it != end; ++it, ++i) {
if (!it->is_dead()) {
CTRACE("row_bug", already_found[it->m_var], display_row_info(tout, r_id););
CTRACE(row_bug, already_found[it->m_var], display_row_info(tout, r_id););
SASSERT(!already_found[it->m_var]);
already_found[it->m_var] = true;
column const & c = m_columns[it->m_var];
CTRACE("row_bug", it->m_coeff.is_zero(), display_row_info(tout, r_id););
CTRACE(row_bug, it->m_coeff.is_zero(), display_row_info(tout, r_id););
SASSERT(!it->m_coeff.is_zero());
SASSERT(c[it->m_col_idx].m_row_id == static_cast<int>(r_id));
SASSERT(c[it->m_col_idx].m_row_idx == i);
@ -129,7 +129,7 @@ namespace smt {
for (; it != end; ++it, ++i) {
if (!it->is_dead()) {
row const & r = m_rows[it->m_row_id];
CTRACE("wf_column", r.size() == 0, tout << "v" << v << ", it->m_row_id: " << it->m_row_id << "\n"; display_row_info(tout, r); display(tout););
CTRACE(wf_column, r.size() == 0, tout << "v" << v << ", it->m_row_id: " << it->m_row_id << "\n"; display_row_info(tout, r); display(tout););
SASSERT(r.size() != 0);
SASSERT(r[it->m_row_idx].m_var == v);
SASSERT(r[it->m_row_idx].m_col_idx == i);
@ -158,7 +158,7 @@ namespace smt {
*/
template<typename Ext>
bool theory_arith<Ext>::valid_row_assignment() const {
TRACE("valid_row_assignment", display(tout););
TRACE(valid_row_assignment, display(tout););
typename vector<row>::const_iterator it = m_rows.begin();
typename vector<row>::const_iterator end = m_rows.end();
for (; it != end; ++it) {
@ -182,7 +182,7 @@ namespace smt {
sum += it->m_coeff * m_value[it->m_var];
}
}
CTRACE("valid_row_assignment_bug", !sum.is_zero(), tout << "checking: "; display_row_info(tout, r););
CTRACE(valid_row_assignment_bug, !sum.is_zero(), tout << "checking: "; display_row_info(tout, r););
SASSERT(sum.is_zero());
}
return true;
@ -194,7 +194,7 @@ namespace smt {
return true;
int num = get_num_vars();
for (theory_var v = 0; v < num; v++) {
CTRACE("bound_bug", below_lower(v) || above_upper(v), display_var(tout, v); display(tout););
CTRACE(bound_bug, below_lower(v) || above_upper(v), display_var(tout, v); display(tout););
SASSERT(!below_lower(v));
SASSERT(!above_upper(v));
if (below_lower(v) || above_upper(v)) return false;
@ -207,7 +207,7 @@ namespace smt {
int num = get_num_vars();
for (theory_var v = 0; v < num; v++) {
if (is_int(v) && !get_value(v).is_int()) {
TRACE("bound_bug", display_var(tout, v); display(tout););
TRACE(bound_bug, display_var(tout, v); display(tout););
return false;
}
}
@ -223,7 +223,7 @@ namespace smt {
satisfy_integrality()) {
return true;
}
TRACE("arith", display(tout););
TRACE(arith, display(tout););
return false;
}

View file

@ -83,7 +83,7 @@ void theory_arith<Ext>::mark_dependents(theory_var v, svector<theory_var> & vars
for (auto& ce : c) {
if (ce.is_dead() || already_visited_rows.contains(ce.m_row_id))
continue;
TRACE("non_linear_bug", tout << "visiting row: " << ce.m_row_id << "\n";);
TRACE(non_linear_bug, tout << "visiting row: " << ce.m_row_id << "\n";);
already_visited_rows.insert(ce.m_row_id);
row & r = m_rows[ce.m_row_id];
theory_var s = r.get_base_var();
@ -98,7 +98,7 @@ void theory_arith<Ext>::mark_dependents(theory_var v, svector<theory_var> & vars
for (auto& re : r) {
if (!re.is_dead() && !is_fixed(re.m_var))
mark_var(re.m_var, vars, already_found);
CTRACE("non_linear", !re.is_dead() && is_fixed(re.m_var), tout << "skipped fixed\n");
CTRACE(non_linear, !re.is_dead() && is_fixed(re.m_var), tout << "skipped fixed\n");
}
}
}
@ -122,10 +122,10 @@ void theory_arith<Ext>::get_non_linear_cluster(svector<theory_var> & vars) {
// NB: vars changes inside of loop
for (unsigned idx = 0; idx < vars.size(); ++idx) {
theory_var v = vars[idx];
TRACE("non_linear", tout << "marking dependents of: v" << v << "\n";);
TRACE(non_linear, tout << "marking dependents of: v" << v << "\n";);
mark_dependents(v, vars, already_found, already_visited_rows);
}
TRACE("non_linear", tout << "variables in non linear cluster: ";
TRACE(non_linear, tout << "variables in non linear cluster: ";
for (theory_var v : vars) tout << "v" << v << " "; tout << "\n";
for (theory_var v : m_nl_monomials) tout << "non-linear v" << v << " " << mk_pp(var2expr(v), m) << "\n";);
}
@ -262,7 +262,7 @@ void theory_arith<Ext>::mul_bound_of(expr * var, unsigned power, interval & targ
theory_var v = expr2var(var);
interval i = mk_interval_for(v);
TRACE("non_linear",
TRACE(non_linear,
display_interval(tout << "bound: ",i); tout << i << "\n";
tout << mk_pp(var, get_manager()) << "\n";
tout << "power " << power << ": " << expt(i, power) << "\n";
@ -274,7 +274,7 @@ void theory_arith<Ext>::mul_bound_of(expr * var, unsigned power, interval & targ
get_manager().limit().inc((target.is_lower_open() || target.minus_infinity()) ? 1 : target.get_lower_value().bitsize());
get_manager().limit().inc((target.is_upper_open() || target.plus_infinity()) ? 1 : target.get_upper_value().bitsize());
TRACE("non_linear", display_interval(tout << "target after: ", target); tout << "\n";);
TRACE(non_linear, display_interval(tout << "target after: ", target); tout << "\n";);
}
/**
@ -289,7 +289,7 @@ template<typename Ext>
interval theory_arith<Ext>::evaluate_as_interval(expr * n) {
expr* arg;
rational val;
#define TR() TRACE("nl_evaluate", tout << "eval: " << mk_bounded_pp(n, get_manager(), 10) << "\n";\
#define TR() TRACE(nl_evaluate, tout << "eval: " << mk_bounded_pp(n, get_manager(), 10) << "\n";\
display_nested_form(tout, n); tout << "\ninterval: " << r << "\n";);
if (has_var(n)) {
@ -328,7 +328,7 @@ interval theory_arith<Ext>::evaluate_as_interval(expr * n) {
return r;
}
else {
TRACE("nl_evaluate", tout << "is unknown\n";);
TRACE(nl_evaluate, tout << "is unknown\n";);
return interval(m_dep_manager);
}
}
@ -372,7 +372,7 @@ void theory_arith<Ext>::mk_derived_nl_bound(theory_var v, inf_numeral const & co
m_asserted_bounds.push_back(new_bound);
// copy justification to new bound
dependency2new_bound(dep, *new_bound);
TRACE("non_linear", new_bound->display(*this, tout); tout << "\n";);
TRACE(non_linear, new_bound->display(*this, tout); tout << "\n";);
}
/**
@ -400,7 +400,7 @@ bool theory_arith<Ext>::update_bounds_using_interval(theory_var v, interval cons
}
bound * old_lower = lower(v);
if (old_lower == nullptr || new_lower > old_lower->get_value()) {
TRACE("non_linear", tout << "NEW lower bound for v" << v << " " << mk_pp(var2expr(v), get_manager())
TRACE(non_linear, tout << "NEW lower bound for v" << v << " " << mk_pp(var2expr(v), get_manager())
<< " " << new_lower << "\n";
display_interval(tout, i); tout << "\n";);
mk_derived_nl_bound(v, new_lower, B_LOWER, i.get_lower_dependencies());
@ -424,7 +424,7 @@ bool theory_arith<Ext>::update_bounds_using_interval(theory_var v, interval cons
}
bound * old_upper = upper(v);
if (old_upper == nullptr || new_upper < old_upper->get_value()) {
TRACE("non_linear", tout << "NEW upper bound for v" << v << " " << new_upper << "\n";
TRACE(non_linear, tout << "NEW upper bound for v" << v << " " << new_upper << "\n";
display_interval(tout, i); tout << "\n";);
mk_derived_nl_bound(v, new_upper, B_UPPER, i.get_upper_dependencies());
r = true;
@ -436,7 +436,7 @@ bool theory_arith<Ext>::update_bounds_using_interval(theory_var v, interval cons
template<typename Ext>
bool theory_arith<Ext>::update_bounds_using_interval(expr * n, interval const & i) {
SASSERT(expr2var(n) != null_theory_var);
TRACE("non_linear", tout << "NL bounds for m: " << i << "\n" << mk_pp(n, get_manager()) << "\n";);
TRACE(non_linear, tout << "NL bounds for m: " << i << "\n" << mk_pp(n, get_manager()) << "\n";);
return update_bounds_using_interval(expr2var(n), i);
}
@ -446,20 +446,20 @@ bool theory_arith<Ext>::update_bounds_using_interval(expr * n, interval const &
template<typename Ext>
bool theory_arith<Ext>::propagate_nl_upward(expr * m) {
SASSERT(is_pure_monomial(m));
TRACE("nl_arith_bug", tout << "processing upward:\n" << mk_pp(m, get_manager()) << "\n";);
TRACE(nl_arith_bug, tout << "processing upward:\n" << mk_pp(m, get_manager()) << "\n";);
buffer<var_power_pair> vp;
rational coeff = decompose_monomial(m, vp);
interval new_bounds(m_dep_manager, coeff);
for (var_power_pair const& p : vp) {
expr * var = p.first;
unsigned power = p.second;
TRACE("nl_arith_bug", tout << "interval before: " << new_bounds << "\n";
TRACE(nl_arith_bug, tout << "interval before: " << new_bounds << "\n";
theory_var v = expr2var(var);
interval i = mk_interval_for(v);
display_var(tout, v);
tout << "interval for v" << i << " " << mk_pp(var, get_manager()) << "\npower: " << power << " " << expt(i, power) << "\n";);
mul_bound_of(var, power, new_bounds);
TRACE("nl_arith_bug", tout << "interval after: " << new_bounds << "\n";);
TRACE(nl_arith_bug, tout << "interval after: " << new_bounds << "\n";);
}
return update_bounds_using_interval(m, new_bounds);
}
@ -494,7 +494,7 @@ bool theory_arith<Ext>::propagate_nl_downward(expr * n, var_power_pair const& p)
if (other_bounds.contains_zero())
return false; // interval division requires that divisor doesn't contain 0.
interval r = mk_interval_for(n);
TRACE("nl_arith_bug", tout << "m: " << mk_ismt2_pp(n, get_manager()) << "\nv: " << mk_ismt2_pp(v, get_manager()) <<
TRACE(nl_arith_bug, tout << "m: " << mk_ismt2_pp(n, get_manager()) << "\nv: " << mk_ismt2_pp(v, get_manager()) <<
"\npower: " << power << "\n";
display_interval(tout << "monomial bounds\n", r);
display_interval(tout << "other bounds\n", other_bounds);
@ -511,7 +511,7 @@ bool theory_arith<Ext>::propagate_nl_downward(expr * n, var_power_pair const& p)
*/
template<typename Ext>
bool theory_arith<Ext>::propagate_nl_bounds(expr * m) {
TRACE("non_linear", tout << "propagate several bounds using:\n"; display_monomial(tout, m); tout << "\n";);
TRACE(non_linear, tout << "propagate several bounds using:\n"; display_monomial(tout, m); tout << "\n";);
bool result = propagate_nl_upward(m);
buffer<var_power_pair> vp;
rational coeff = decompose_monomial(m, vp);
@ -538,14 +538,14 @@ bool theory_arith<Ext>::propagate_nl_bounds() {
if (!ctx.is_relevant(m))
continue;
auto p = analyze_monomial(m);
TRACE("propagate_nl_bound", tout << "m: " << mk_ismt2_pp(m, get_manager()) << "\n" << "p: " << p.first << "\n";);
TRACE(propagate_nl_bound, tout << "m: " << mk_ismt2_pp(m, get_manager()) << "\n" << "p: " << p.first << "\n";);
unsigned num_bad_vars = p.first;
var_power_pair q = p.second;
SASSERT(num_bad_vars != 1 || q.first != nullptr);
if (num_bad_vars >= 2)
continue;
bool is_free_m = is_free(m);
TRACE("propagate_nl_bound", tout << "is_free_m: " << is_free_m << "\n";);
TRACE(propagate_nl_bound, tout << "is_free_m: " << is_free_m << "\n";);
if (num_bad_vars == 1 && is_free_m)
continue;
if (num_bad_vars == 0) {
@ -602,11 +602,11 @@ bool theory_arith<Ext>::check_monomial_assignment(theory_var v, bool & computed_
theory_var curr = expr2var(arg);
SASSERT(curr != null_theory_var);
v_val = get_value(curr, computed_epsilon);
TRACE("non_linear", tout << mk_pp(arg, get_manager()) << " = " << v_val << "\n";);
TRACE(non_linear, tout << mk_pp(arg, get_manager()) << " = " << v_val << "\n";);
val *= v_val;
}
v_val = get_value(v, computed_epsilon);
TRACE("non_linear", tout << "v" << v << " := " << v_val << " == " << val << "\n";);
TRACE(non_linear, tout << "v" << v << " := " << v_val << " == " << val << "\n";);
return v_val == val;
}
@ -619,9 +619,9 @@ template<typename Ext>
bool theory_arith<Ext>::check_monomial_assignments() {
bool computed_epsilon = false;
for (theory_var v : m_nl_monomials) {
TRACE("non_linear", tout << "v" << v << " is relevant: " << ctx.is_relevant(get_enode(v)) << "\n");
TRACE(non_linear, tout << "v" << v << " is relevant: " << ctx.is_relevant(get_enode(v)) << "\n");
if (ctx.is_relevant(get_enode(v)) && !check_monomial_assignment(v, computed_epsilon)) {
TRACE("non_linear", tout << "check_monomial_assignment failed for:\n" << mk_ismt2_pp(var2expr(v), get_manager()) << "\n";
TRACE(non_linear, tout << "check_monomial_assignment failed for:\n" << mk_ismt2_pp(var2expr(v), get_manager()) << "\n";
display_var(tout, v););
return false;
}
@ -641,7 +641,7 @@ bool theory_arith<Ext>::check_monomial_assignments() {
*/
template<typename Ext>
theory_var theory_arith<Ext>::find_nl_var_for_branching() {
TRACE("nl_branching", tout << "looking for variable to branch...\n"; display(tout););
TRACE(nl_branching, tout << "looking for variable to branch...\n"; display(tout););
theory_var target = null_theory_var;
bool bounded = false;
unsigned n = 0;
@ -657,7 +657,7 @@ theory_var theory_arith<Ext>::find_nl_var_for_branching() {
SASSERT(is_pure_monomial(m));
for (expr * arg : *to_app(m)) {
theory_var curr = ctx.get_enode(arg)->get_th_var(get_id());
TRACE("nl_branching", tout << "target: v" << target << ", curr: v" << curr << "\n";);
TRACE(nl_branching, tout << "target: v" << target << ", curr: v" << curr << "\n";);
if (!is_fixed(curr) && is_int(curr)) {
if (is_bounded(curr)) {
numeral new_range;
@ -671,14 +671,14 @@ theory_var theory_arith<Ext>::find_nl_var_for_branching() {
}
else if (!bounded) {
n++;
TRACE("nl_branching", tout << "n: " << n << "\n";);
TRACE(nl_branching, tout << "n: " << n << "\n";);
if (m_random()%n == 0)
target = curr;
SASSERT(target != null_theory_var);
}
SASSERT(target != null_theory_var);
}
TRACE("nl_branching", tout << "after target: v" << target << "\n";);
TRACE(nl_branching, tout << "after target: v" << target << "\n";);
}
}
}
@ -694,7 +694,7 @@ theory_var theory_arith<Ext>::find_nl_var_for_branching() {
*/
template<typename Ext>
bool theory_arith<Ext>::branch_nl_int_var(theory_var v) {
TRACE("non_linear", tout << "BRANCHING on v" << v << "\n";);
TRACE(non_linear, tout << "BRANCHING on v" << v << "\n";);
m_stats.m_nl_branching++;
SASSERT(is_int(v));
expr_ref bound(get_manager());
@ -704,7 +704,7 @@ bool theory_arith<Ext>::branch_nl_int_var(theory_var v) {
bound = m_util.mk_ge(var2expr(v), m_util.mk_numeral(upper_bound(v).get_rational().to_rational(), true));
else
bound = m_util.mk_eq(var2expr(v), m_util.mk_numeral(rational(0), true));
TRACE("non_linear", tout << "new bound:\n" << mk_pp(bound, get_manager()) << "\n";);
TRACE(non_linear, tout << "new bound:\n" << mk_pp(bound, get_manager()) << "\n";);
ast_manager & m = get_manager();
{
std::function<expr*(void)> fn = [&]() { return m.mk_or(bound, m.mk_not(bound)); };
@ -729,7 +729,7 @@ bool theory_arith<Ext>::is_monomial_linear(expr * m) const {
if (!ctx.e_internalized(arg))
return false;
theory_var _var = expr2var(arg);
CTRACE("non_linear", is_fixed(_var),
CTRACE(non_linear, is_fixed(_var),
tout << mk_pp(arg, get_manager()) << " is fixed: " << lower_bound(_var) << "\n";);
if (!is_fixed(_var)) {
num_nl_vars++;
@ -754,7 +754,7 @@ typename theory_arith<Ext>::numeral theory_arith<Ext>::get_monomial_fixed_var_pr
if (is_fixed(_var))
r *= lower_bound(_var).get_rational();
}
TRACE("arith", tout << mk_pp(m, get_manager()) << " " << r << "\n";);
TRACE(arith, tout << mk_pp(m, get_manager()) << " " << r << "\n";);
return r;
}
@ -778,7 +778,7 @@ expr * theory_arith<Ext>::get_monomial_non_fixed_var(expr * m) const {
*/
template<typename Ext>
bool theory_arith<Ext>::propagate_linear_monomial(theory_var v) {
TRACE("non_linear_verbose", tout << "checking whether v" << v << " became linear...\n";);
TRACE(non_linear_verbose, tout << "checking whether v" << v << " became linear...\n";);
if (m_data[v].m_nl_propagated)
return false; // already propagated this monomial.
expr * m = var2expr(v);
@ -789,13 +789,13 @@ bool theory_arith<Ext>::propagate_linear_monomial(theory_var v) {
m_data[v].m_nl_propagated = true;
m_nl_propagated.push_back(v);
TRACE("non_linear", tout << "v" << v << " is linear " << mk_pp(m, get_manager()) << "\n";);
TRACE(non_linear, tout << "v" << v << " is linear " << mk_pp(m, get_manager()) << "\n";);
numeral k = get_monomial_fixed_var_product(m);
TRACE("non_linear", tout << "new linear monomial... k: " << k << "\n";);
TRACE(non_linear, tout << "new linear monomial... k: " << k << "\n";);
expr * x_n = k.is_zero() ? nullptr : get_monomial_non_fixed_var(m);
TRACE("non_linear_bug", if (x_n != 0) { tout << "x_n: " << mk_bounded_pp(x_n, get_manager()) << "\nx_n: #" << x_n->get_id() << "\n"; });
TRACE(non_linear_bug, if (x_n != 0) { tout << "x_n: " << mk_bounded_pp(x_n, get_manager()) << "\nx_n: #" << x_n->get_id() << "\n"; });
derived_bound * new_lower = nullptr;
derived_bound * new_upper = nullptr;
if (x_n != nullptr) {
@ -807,16 +807,16 @@ bool theory_arith<Ext>::propagate_linear_monomial(theory_var v) {
// Let m be (* x_1 ... x_n), then assert equality
// (= (+ (* x_1 ... x_n) (* -k x_n)) 0) when x_1 ... x_{n-1} are fixed variables.
// where k = lower(x_1)*...*lower(x_{n-1})
TRACE("non_linear", tout << "x_n: " << mk_pp(x_n, get_manager()) << "\n";);
TRACE(non_linear, tout << "x_n: " << mk_pp(x_n, get_manager()) << "\n";);
k.neg();
expr * k_x_n = k.is_one() ? x_n : m_util.mk_mul(m_util.mk_numeral(k.to_rational(), is_int(v)), x_n);
expr * rhs = m_util.mk_add(m, k_x_n);
TRACE("non_linear_bug", tout << "rhs: " << mk_bounded_pp(rhs, get_manager(),5) << "\ninternalized: " << ctx.e_internalized(rhs) << "\n";);
TRACE(non_linear_bug, tout << "rhs: " << mk_bounded_pp(rhs, get_manager(),5) << "\ninternalized: " << ctx.e_internalized(rhs) << "\n";);
if (!has_var(rhs)) {
ctx.internalize(rhs, false);
ctx.mark_as_relevant(rhs);
}
TRACE("non_linear_bug", tout << "enode: " << ctx.get_enode(rhs) << " enode_id: " << ctx.get_enode(rhs)->get_owner_id() << "\n";);
TRACE(non_linear_bug, tout << "enode: " << ctx.get_enode(rhs) << " enode_id: " << ctx.get_enode(rhs)->get_owner_id() << "\n";);
IF_VERBOSE(3,
for (auto* arg : *to_app(m))
if (is_fixed(expr2var(arg)))
@ -833,7 +833,7 @@ bool theory_arith<Ext>::propagate_linear_monomial(theory_var v) {
// Assert the equality
// (= (* x_1 ... x_n) k)
TRACE("non_linear", tout << "all variables are fixed, and bound is: " << k << "\n";);
TRACE(non_linear, tout << "all variables are fixed, and bound is: " << k << "\n";);
new_lower = alloc(derived_bound, v, inf_numeral(k), B_LOWER);
new_upper = alloc(derived_bound, v, inf_numeral(k), B_UPPER);
}
@ -868,7 +868,7 @@ bool theory_arith<Ext>::propagate_linear_monomial(theory_var v) {
}
accumulate_justification(*l, *new_lower, numeral::zero(), m_tmp_lit_set, m_tmp_eq_set);
TRACE("non_linear",
TRACE(non_linear,
for (literal l : new_lower->m_lits) {
ctx.display_detailed_literal(tout, l) << " ";
}
@ -876,7 +876,7 @@ bool theory_arith<Ext>::propagate_linear_monomial(theory_var v) {
accumulate_justification(*u, *new_lower, numeral::zero(), m_tmp_lit_set, m_tmp_eq_set);
TRACE("non_linear",
TRACE(non_linear,
for (literal l : new_lower->m_lits) {
ctx.display_detailed_literal(tout, l) << " ";
}
@ -887,7 +887,7 @@ bool theory_arith<Ext>::propagate_linear_monomial(theory_var v) {
new_upper->m_lits.append(new_lower->m_lits);
new_upper->m_eqs.append(new_lower->m_eqs);
TRACE("non_linear",
TRACE(non_linear,
new_lower->display(*this, tout << "lower: "); tout << "\n";
new_upper->display(*this, tout << "upper: "); tout << "\n";
for (literal lit : new_upper->m_lits) {
@ -909,7 +909,7 @@ bool theory_arith<Ext>::propagate_linear_monomials() {
return false;
if (!reflection_enabled())
return false;
TRACE("non_linear_verbose", tout << "propagating linear monomials...\n";);
TRACE(non_linear_verbose, tout << "propagating linear monomials...\n";);
bool p = false;
// CMW: m_nl_monomials can grow during this loop, so
// don't use iterators.
@ -917,7 +917,7 @@ bool theory_arith<Ext>::propagate_linear_monomials() {
if (propagate_linear_monomial(m_nl_monomials[i]))
p = true;
}
CTRACE("non_linear", p, display(tout););
CTRACE(non_linear, p, display(tout););
return p;
}
@ -1123,7 +1123,7 @@ bool theory_arith<Ext>::get_polynomial_info(buffer<coeff_expr> const & p, sbuffe
auto add_occ = [&](expr* v) {
if (has_var(v) && !is_fixed(expr2var(v))) {
TRACE("nl_info", tout << "adding occ: " << mk_bounded_pp(v, get_manager()) << "\n";);
TRACE(nl_info, tout << "adding occ: " << mk_bounded_pp(v, get_manager()) << "\n";);
unsigned occs = 0;
m_var2num_occs.find(v, occs);
m_var2num_occs.insert(v, 1 + occs);
@ -1162,7 +1162,7 @@ bool theory_arith<Ext>::get_polynomial_info(buffer<coeff_expr> const & p, sbuffe
template<typename Ext>
expr_ref theory_arith<Ext>::p2expr(buffer<coeff_expr> & p) {
SASSERT(!p.empty());
TRACE("p2expr_bug", display_coeff_exprs(tout, p););
TRACE(p2expr_bug, display_coeff_exprs(tout, p););
ptr_buffer<expr> args;
rational c2;
for (coeff_expr const& ce : p) {
@ -1349,7 +1349,7 @@ unsigned theory_arith<Ext>::get_min_degree(buffer<coeff_expr> & p, expr * var) {
*/
template<typename Ext>
expr * theory_arith<Ext>::factor(expr * m, expr * var, unsigned d) {
TRACE("factor", tout << "m: " << mk_pp(m, get_manager()) << "\nvar: " << mk_pp(var, get_manager()) << "\nd: " << d << "\n";);
TRACE(factor, tout << "m: " << mk_pp(m, get_manager()) << "\nvar: " << mk_pp(var, get_manager()) << "\nd: " << d << "\n";);
if (d == 0)
return m;
if (m == var) {
@ -1376,10 +1376,10 @@ expr * theory_arith<Ext>::factor(expr * m, expr * var, unsigned d) {
}
insert(m);
SASSERT(idx == d);
TRACE("factor_bug", tout << "new_args:\n"; for(unsigned i = 0; i < new_args.size(); i++) tout << mk_pp(new_args[i], get_manager()) << "\n";);
TRACE(factor_bug, tout << "new_args:\n"; for(unsigned i = 0; i < new_args.size(); i++) tout << mk_pp(new_args[i], get_manager()) << "\n";);
expr * result = mk_nary_mul(new_args.size(), new_args.data(), m_util.is_int(var));
m_nl_new_exprs.push_back(result);
TRACE("factor", tout << "result: " << mk_pp(result, get_manager()) << "\n";);
TRACE(factor, tout << "result: " << mk_pp(result, get_manager()) << "\n";);
return result;
}
@ -1391,7 +1391,7 @@ expr_ref theory_arith<Ext>::horner(unsigned depth, buffer<coeff_expr> & p, expr
SASSERT(!p.empty());
SASSERT(var != 0);
unsigned d = get_min_degree(p, var);
TRACE("horner_bug", tout << "poly:\n";
TRACE(horner_bug, tout << "poly:\n";
for (unsigned i = 0; i < p.size(); i++) { if (i > 0) tout << " + "; tout << p[i].first << "*" << mk_pp(p[i].second, get_manager()); } tout << "\n";
tout << "var: " << mk_pp(var, get_manager()) << "\n";
tout << "min_degree: " << d << "\n";);
@ -1435,7 +1435,7 @@ expr_ref theory_arith<Ext>::horner(unsigned depth, buffer<coeff_expr> & p, expr
*/
template<typename Ext>
expr_ref theory_arith<Ext>::cross_nested(unsigned depth, buffer<coeff_expr> & p, expr * var) {
TRACE("non_linear", tout << "p.size: " << p.size() << "\n";);
TRACE(non_linear, tout << "p.size: " << p.size() << "\n";);
if (var == nullptr) {
sbuffer<var_num_occs> varinfo;
if (!get_polynomial_info(p, varinfo))
@ -1459,7 +1459,7 @@ expr_ref theory_arith<Ext>::cross_nested(unsigned depth, buffer<coeff_expr> & p,
unsigned n = UINT_MAX;
unsigned nm = UINT_MAX;
if (in_monovariate_monomials(p, var, i1, a, n, i2, b, nm)) {
CTRACE("in_monovariate_monomials", n == nm,
CTRACE(in_monovariate_monomials, n == nm,
for (unsigned i = 0; i < p.size(); i++) {
if (i > 0) tout << " + "; tout << p[i].first << "*" << mk_pp(p[i].second, get_manager());
}
@ -1500,7 +1500,7 @@ expr_ref theory_arith<Ext>::cross_nested(unsigned depth, buffer<coeff_expr> & p,
rhs2 = rhs;
new_expr = b.is_one() ? rhs2 : m_util.mk_mul(m_util.mk_numeral(b, m_util.is_int(var)), rhs2);
m_nl_new_exprs.push_back(new_expr);
TRACE("non_linear", tout << "new_expr:\n"; display_nested_form(tout, new_expr); tout << "\n";);
TRACE(non_linear, tout << "new_expr:\n"; display_nested_form(tout, new_expr); tout << "\n";);
buffer<coeff_expr> rest;
unsigned sz = p.size();
for (unsigned i = 0; i < sz; i++) {
@ -1509,7 +1509,7 @@ expr_ref theory_arith<Ext>::cross_nested(unsigned depth, buffer<coeff_expr> & p,
}
if (rest.empty())
return expr_ref(new_expr, get_manager());
TRACE("non_linear", tout << "rest size: " << rest.size() << ", i1: " << i1 << ", i2: " << i2 << "\n";);
TRACE(non_linear, tout << "rest size: " << rest.size() << ", i1: " << i1 << ", i2: " << i2 << "\n";);
expr_ref h = cross_nested(depth + 1, rest, nullptr);
expr * r = m_util.mk_add(new_expr, h);
m_nl_new_exprs.push_back(r);
@ -1532,7 +1532,7 @@ bool theory_arith<Ext>::is_cross_nested_consistent(buffer<coeff_expr> & p) {
if (varinfo.empty())
return true;
std::stable_sort(varinfo.begin(), varinfo.end(), var_num_occs_lt());
TRACE("cross_nested", tout << "var num occs:\n";
TRACE(cross_nested, tout << "var num occs:\n";
for (auto const& kv : varinfo) {
tout << mk_bounded_pp(kv.first, get_manager()) << " -> " << kv.second << "\n";
});
@ -1544,18 +1544,18 @@ bool theory_arith<Ext>::is_cross_nested_consistent(buffer<coeff_expr> & p) {
// This is not really a problem, since evaluate_as_interval will work even if cn is not well-sorted.
if (!cn)
continue;
TRACE("cross_nested", tout << "nested form for var:\n" << mk_ismt2_pp(var, get_manager()) << "\n";
TRACE(cross_nested, tout << "nested form for var:\n" << mk_ismt2_pp(var, get_manager()) << "\n";
display_nested_form(tout, cn); tout << "\n";
tout << "c:\n" << mk_ismt2_pp(cn, get_manager()) << "\n";);
interval i = evaluate_as_interval(cn);
TRACE("cross_nested", tout << "interval: " << i << "\n";);
TRACE(cross_nested, tout << "interval: " << i << "\n";);
v_dependency * d = nullptr;
if (!i.minus_infinity() && (i.get_lower_value().is_pos() || (i.get_lower_value().is_zero() && i.is_lower_open())))
d = i.get_lower_dependencies();
else if (!i.plus_infinity() && (i.get_upper_value().is_neg() || (i.get_upper_value().is_zero() && i.is_upper_open())))
d = i.get_upper_dependencies();
if (d) {
TRACE("cross_nested", tout << "nested form conflict: " << i << "\n";);
TRACE(cross_nested, tout << "nested form conflict: " << i << "\n";);
set_conflict(d);
return false;
}
@ -1573,7 +1573,7 @@ bool theory_arith<Ext>::is_cross_nested_consistent(row const & r) {
if (!is_problematic_non_linear_row(r))
return true;
TRACE("cross_nested", tout << "is_cross_nested_consistent:\n"; display_row(tout, r, false);
TRACE(cross_nested, tout << "is_cross_nested_consistent:\n"; display_row(tout, r, false);
display(tout);
);
@ -1613,13 +1613,13 @@ bool theory_arith<Ext>::is_cross_nested_consistent(row const & r) {
if (!get_manager().int_real_coercions() && is_mixed_real_integer(r))
return true; // giving up... see comment above
TRACE("cross_nested", tout << "checking problematic row...\n";);
TRACE(cross_nested, tout << "checking problematic row...\n";);
rational c = rational::one();
if (is_integer(r))
c = r.get_denominators_lcm().to_rational();
TRACE("non_linear", tout << "check problematic row:\n"; display_row(tout, r); display_row(tout, r, false););
TRACE(non_linear, tout << "check problematic row:\n"; display_row(tout, r); display_row(tout, r, false););
buffer<coeff_expr> p;
for (auto & col : r) {
if (!col.is_dead()) {
@ -1627,7 +1627,7 @@ bool theory_arith<Ext>::is_cross_nested_consistent(row const & r) {
}
}
SASSERT(!p.empty());
CTRACE("cross_nested_bug", !c.is_one(), tout << "c: " << c << "\n"; display_row(tout, r); tout << "---> p (coeffs, exprs):\n"; display_coeff_exprs(tout, p););
CTRACE(cross_nested_bug, !c.is_one(), tout << "c: " << c << "\n"; display_row(tout, r); tout << "---> p (coeffs, exprs):\n"; display_coeff_exprs(tout, p););
return is_cross_nested_consistent(p);
}
@ -1741,7 +1741,7 @@ grobner::monomial * theory_arith<Ext>::mk_gb_monomial(rational const & _coeff, e
*/
template<typename Ext>
void theory_arith<Ext>::add_row_to_gb(row const & r, grobner & gb) {
TRACE("grobner", tout << "adding row to gb\n"; display_row(tout, r););
TRACE(grobner, tout << "adding row to gb\n"; display_row(tout, r););
ptr_buffer<grobner::monomial> monomials;
v_dependency * dep = nullptr;
m_tmp_var_set.reset();
@ -1753,7 +1753,7 @@ void theory_arith<Ext>::add_row_to_gb(row const & r, grobner & gb) {
grobner::monomial * new_m = mk_gb_monomial(coeff, m, gb, dep, m_tmp_var_set);
if (new_m)
monomials.push_back(new_m);
TRACE("grobner",
TRACE(grobner,
tout << "monomial: " << mk_pp(m, get_manager()) << "\n";
tout << "new monomial: "; if (new_m) gb.display_monomial(tout, *new_m); else tout << "null"; tout << "\n";);
}
@ -1844,7 +1844,7 @@ void theory_arith<Ext>::set_conflict(v_dependency * d) {
derived_bound b(null_theory_var, inf_numeral(0), B_LOWER);
dependency2new_bound(d, b);
set_conflict(b, ante, "arith_nl");
TRACE("non_linear", for (literal lit : b.m_lits) ctx.display_literal_verbose(tout, lit) << "\n"; tout << "\n";);
TRACE(non_linear, for (literal lit : b.m_lits) ctx.display_literal_verbose(tout, lit) << "\n"; tout << "\n";);
}
/**
@ -1861,22 +1861,22 @@ bool theory_arith<Ext>::is_inconsistent(interval const & I, unsigned num_monomia
if (r.minus_infinity() && r.plus_infinity())
return false;
}
TRACE("non_linear_bug", tout << "is_inconsistent, r: " << r << "\n";);
TRACE(non_linear_bug, tout << "is_inconsistent, r: " << r << "\n";);
v_dependency * interval_deps = nullptr;
bool conflict = false;
if (!r.minus_infinity() && (r.get_lower_value().is_pos() || (r.get_lower_value().is_zero() && r.is_lower_open()))) {
interval_deps = r.get_lower_dependencies();
conflict = true;
TRACE("non_linear_bug", tout << "is inconsistent, interval_deps: " << interval_deps << "\n";);
TRACE(non_linear_bug, tout << "is inconsistent, interval_deps: " << interval_deps << "\n";);
}
else if (!r.plus_infinity() && (r.get_upper_value().is_neg() || (r.get_upper_value().is_zero() && r.is_upper_open()))) {
interval_deps = r.get_upper_dependencies();
conflict = true;
TRACE("non_linear_bug", tout << "is inconsistent, interval_deps: " << interval_deps << "\n";);
TRACE(non_linear_bug, tout << "is inconsistent, interval_deps: " << interval_deps << "\n";);
}
// interval_deps cannot be used to check if a conflict was detected, since interval_deps may be 0 even when r does not contain 0
if (conflict) {
TRACE("non_linear", tout << "conflicting interval for = 0 equation: " << r << "\n";);
TRACE(non_linear, tout << "conflicting interval for = 0 equation: " << r << "\n";);
set_conflict(m_dep_manager.mk_join(interval_deps, dep));
return true;
}
@ -1891,7 +1891,7 @@ template<typename Ext>
bool theory_arith<Ext>::is_inconsistent(grobner::equation const * eq, grobner & gb) {
interval zero(m_dep_manager, rational(0));
if (is_inconsistent(zero, eq->get_num_monomials(), eq->get_monomials(), eq->get_dependency())) {
TRACE("non_linear", tout << "found conflict\n"; gb.display_equation(tout, *eq););
TRACE(non_linear, tout << "found conflict\n"; gb.display_equation(tout, *eq););
return true;
}
return false;
@ -2018,7 +2018,7 @@ bool theory_arith<Ext>::is_inconsistent2(grobner::equation const * eq, grobner &
monomials.push_back(const_cast<grobner::monomial*>(m1));
continue;
}
TRACE("non_linear", tout << "found perfect square monomial m1: "; gb.display_monomial(tout, *m1); tout << "\n";);
TRACE(non_linear, tout << "found perfect square monomial m1: "; gb.display_monomial(tout, *m1); tout << "\n";);
// try to find another perfect square
unsigned j = i + 1;
for (; j < num; j++) {
@ -2028,7 +2028,7 @@ bool theory_arith<Ext>::is_inconsistent2(grobner::equation const * eq, grobner &
rational b;
if (!is_perfect_square(m2, b))
continue;
TRACE("non_linear", tout << "found perfect square monomial m2: "; gb.display_monomial(tout, *m2); tout << "\n";);
TRACE(non_linear, tout << "found perfect square monomial m2: "; gb.display_monomial(tout, *m2); tout << "\n";);
// try to find -2*root(m1)*root(m2)
// This monomial must be smaller than m1, since m2 is smaller than m1.
unsigned k = i + 1;
@ -2040,7 +2040,7 @@ bool theory_arith<Ext>::is_inconsistent2(grobner::equation const * eq, grobner &
continue;
// m1, m2, and m1m2 form a perfect square.
// check if [0, oo) provides a better lowerbound than adding the intervals of m1, m2 and m1m2;
TRACE("non_linear", tout << "found perfect square (M1-M2)^2:\n";
TRACE(non_linear, tout << "found perfect square (M1-M2)^2:\n";
gb.display_monomial(tout, *m1); tout << "\n";
gb.display_monomial(tout, *m2); tout << "\n";
gb.display_monomial(tout, *m1m2); tout << "\n";);
@ -2048,7 +2048,7 @@ bool theory_arith<Ext>::is_inconsistent2(grobner::equation const * eq, grobner &
I += intervals[j];
I += intervals[k];
if (I.minus_infinity() || I.get_lower_value().is_neg()) {
TRACE("non_linear", tout << "the lower bound improved when perfect square is eliminated.\n";);
TRACE(non_linear, tout << "the lower bound improved when perfect square is eliminated.\n";);
// Found improvement...
// mark these monomials as deleted
deleted[i] = true;
@ -2069,7 +2069,7 @@ bool theory_arith<Ext>::is_inconsistent2(grobner::equation const * eq, grobner &
return false; // didn't find any perfect square.
interval ge_zero(m_dep_manager, rational(0), false, true, nullptr);
if (is_inconsistent(ge_zero, monomials.size(), monomials.data(), eq->get_dependency())) {
TRACE("non_linear", tout << "found conflict\n"; gb.display_equation(tout, *eq););
TRACE(non_linear, tout << "found conflict\n"; gb.display_equation(tout, *eq););
return true;
}
return false;
@ -2116,10 +2116,10 @@ bool theory_arith<Ext>::internalize_gb_eq(grobner::equation const * eq) {
pol = mk_nary_add(args.size(), args.data());
expr_ref s_pol(get_manager());
proof_ref pr(get_manager());
TRACE("gb_bug", tout << mk_ll_pp(pol, get_manager()) << "\n";);
TRACE(gb_bug, tout << mk_ll_pp(pol, get_manager()) << "\n";);
s(pol, s_pol, pr);
if (!has_var(s_pol)) {
TRACE("spol_bug", tout << "internalizing...\n" << mk_ll_pp(s_pol, get_manager()) << "\n";);
TRACE(spol_bug, tout << "internalizing...\n" << mk_ll_pp(s_pol, get_manager()) << "\n";);
ctx.internalize(s_pol, false);
ctx.mark_as_relevant(s_pol.get());
}
@ -2127,12 +2127,12 @@ bool theory_arith<Ext>::internalize_gb_eq(grobner::equation const * eq) {
// s_pol = k
theory_var v = expr2var(s_pol);
// v = k
CTRACE("spol_bug", v == null_theory_var, tout << mk_ll_pp(s_pol, get_manager()) << "\n"; display(tout););
CTRACE(spol_bug, v == null_theory_var, tout << mk_ll_pp(s_pol, get_manager()) << "\n"; display(tout););
SASSERT(v != null_theory_var);
// assert bounds for s_pol
mk_derived_nl_bound(v, inf_numeral(k), B_LOWER, eq->get_dependency());
mk_derived_nl_bound(v, inf_numeral(k), B_UPPER, eq->get_dependency());
TRACE("non_linear", tout << "inserted new equation into the tableau\n"; display_var(tout, v););
TRACE(non_linear, tout << "inserted new equation into the tableau\n"; display_var(tout, v););
return true;
}
@ -2157,18 +2157,18 @@ bool theory_arith<Ext>::get_gb_eqs_and_look_for_conflict(ptr_vector<grobner::equ
eqs.reset();
gb.get_equations(eqs);
TRACE("grobner", tout << "after gb\n";
TRACE(grobner, tout << "after gb\n";
std::function<void(std::ostream& out, expr* v)> _fn = [&](std::ostream& out, expr* v) { out << "v" << expr2var(v); };
for (grobner::equation* eq : eqs)
gb.display_equation(tout, *eq, _fn);
);
for (grobner::equation* eq : eqs) {
if (is_inconsistent(eq, gb) || is_inconsistent2(eq, gb)) {
TRACE("grobner", tout << "inconsistent: "; gb.display_equation(tout, *eq););
TRACE(grobner, tout << "inconsistent: "; gb.display_equation(tout, *eq););
return true;
}
}
TRACE("grobner", tout << "not found\n"; );
TRACE(grobner, tout << "not found\n"; );
return false;
}
@ -2180,7 +2180,7 @@ bool theory_arith<Ext>::try_to_modify_eqs(ptr_vector<grobner::equation>& eqs, gr
bool modified = false;
for (grobner::equation const* eq : eqs) {
unsigned num_monomials = eq->get_num_monomials();
CTRACE("grobner_bug", num_monomials <= 0, gb.display_equation(tout, *eq););
CTRACE(grobner_bug, num_monomials <= 0, gb.display_equation(tout, *eq););
if (num_monomials == 0)
continue; // HACK: the equation 0 = 0, should have been discarded by the GB module.
if (eq->get_monomial(0)->get_degree() != 1)
@ -2192,11 +2192,11 @@ bool theory_arith<Ext>::try_to_modify_eqs(ptr_vector<grobner::equation>& eqs, gr
expr * var = m->get_var(0);
if (gb.get_weight(var) > MAX_DEFAULT_WEIGHT)
continue; // variable was already updated
TRACE("non_linear", tout << "increased weight of: " << mk_bounded_pp(var, get_manager()) << "\n";);
TRACE(non_linear, tout << "increased weight of: " << mk_bounded_pp(var, get_manager()) << "\n";);
gb.set_weight(var, next_weight);
next_weight++;
gb.update_order();
TRACE("non_linear", tout << "after updating order\n"; gb.display(tout););
TRACE(non_linear, tout << "after updating order\n"; gb.display(tout););
modified = true;
break;
}
@ -2215,8 +2215,8 @@ bool theory_arith<Ext>::scan_for_linear(ptr_vector<grobner::equation>& eqs, grob
SASSERT(false);
for (grobner::equation* eq : eqs) {
if (!eq->is_linear_combination()) {
TRACE("non_linear", tout << "processing new equality:\n"; gb.display_equation(tout, *eq););
TRACE("non_linear_bug", tout << "processing new equality:\n"; gb.display_equation(tout, *eq););
TRACE(non_linear, tout << "processing new equality:\n"; gb.display_equation(tout, *eq););
TRACE(non_linear_bug, tout << "processing new equality:\n"; gb.display_equation(tout, *eq););
if (internalize_gb_eq(eq))
result = true;
}
@ -2254,18 +2254,18 @@ typename theory_arith<Ext>::gb_result theory_arith<Ext>::compute_grobner(svector
return GB_FAIL;
grobner gb(get_manager(), m_dep_manager);
init_grobner(nl_cluster, gb);
TRACE("non_linear", display(tout););
TRACE(non_linear, display(tout););
bool warn = false;
unsigned next_weight = MAX_DEFAULT_WEIGHT + 1; // next weight using during perturbation phase.
ptr_vector<grobner::equation> eqs;
do {
TRACE("grobner", tout << "before grobner:\n";
TRACE(grobner, tout << "before grobner:\n";
std::function<void(std::ostream& out, expr* v)> _fn = [&](std::ostream& out, expr* v) { out << "v" << expr2var(v); };
gb.display(tout, _fn));
compute_basis(gb, warn);
update_statistics(gb);
TRACE("non_linear_gb", tout << "after:\n"; gb.display(tout););
TRACE(non_linear_gb, tout << "after:\n"; gb.display(tout););
if (ctx.get_cancel_flag())
return GB_FAIL;
if (get_gb_eqs_and_look_for_conflict(eqs, gb))
@ -2319,14 +2319,14 @@ final_check_status theory_arith<Ext>::process_non_linear() {
}
if (!m_params.m_nl_arith) {
TRACE("non_linear", tout << "Non-linear is not enabled\n";);
TRACE(non_linear, tout << "Non-linear is not enabled\n";);
return FC_GIVEUP;
}
TRACE("process_non_linear", display(tout););
TRACE(process_non_linear, display(tout););
if (m_nl_rounds > m_params.m_nl_arith_rounds) {
TRACE("non_linear", tout << "GIVEUP non linear problem...\n";);
TRACE(non_linear, tout << "GIVEUP non linear problem...\n";);
IF_VERBOSE(3, verbose_stream() << "Max. non linear arithmetic rounds. Increase threshold using NL_ARITH_ROUNDS=<limit>\n";);
return FC_GIVEUP;
}
@ -2336,9 +2336,9 @@ final_check_status theory_arith<Ext>::process_non_linear() {
elim_quasi_base_rows();
move_non_base_vars_to_bounds();
TRACE("non_linear_verbose", tout << "processing non linear constraints...\n"; ctx.display(tout););
TRACE(non_linear_verbose, tout << "processing non linear constraints...\n"; ctx.display(tout););
if (!make_feasible()) {
TRACE("non_linear", tout << "failed to move variables to bounds.\n";);
TRACE(non_linear, tout << "failed to move variables to bounds.\n";);
failed();
return FC_CONTINUE;
}
@ -2404,7 +2404,7 @@ final_check_status theory_arith<Ext>::process_non_linear() {
return m_liberal_final_check || !m_changed_assignment ? FC_DONE : FC_CONTINUE;
}
TRACE("non_linear", display(tout););
TRACE(non_linear, display(tout););
return FC_GIVEUP;
}

View file

@ -40,7 +40,7 @@ namespace smt {
void theory_array::merge_eh(theory_var v1, theory_var v2, theory_var, theory_var) {
// v1 is the new root
TRACE("array",
TRACE(array,
tout << "merging v" << v1 << " v" << v2 << "\n"; display_var(tout, v1);
tout << mk_pp(get_enode(v1)->get_expr(), m) << " <- " << mk_pp(get_enode(v2)->get_expr(), m) << "\n";);
SASSERT(v1 == find(v1));
@ -54,7 +54,7 @@ namespace smt {
add_parent_store(v1, d2->m_parent_stores[i]);
for (unsigned i = 0; i < d2->m_parent_selects.size(); ++i)
add_parent_select(v1, d2->m_parent_selects[i]);
TRACE("array", tout << "after merge\n"; display_var(tout, v1););
TRACE(array, tout << "after merge\n"; display_var(tout, v1););
}
void theory_array::unmerge_eh(theory_var v1, theory_var v2) {
@ -67,7 +67,7 @@ namespace smt {
SASSERT(r == static_cast<int>(m_var_data.size()));
m_var_data.push_back(alloc(var_data));
var_data * d = m_var_data[r];
TRACE("array", tout << mk_bounded_pp(n->get_expr(), m) << "\nis_array: " << is_array_sort(n) << ", is_select: " << is_select(n) <<
TRACE(array, tout << mk_bounded_pp(n->get_expr(), m) << "\nis_array: " << is_array_sort(n) << ", is_select: " << is_select(n) <<
", is_store: " << is_store(n) << "\n";);
d->m_is_array = is_array_sort(n);
if (d->m_is_array)
@ -88,7 +88,7 @@ namespace smt {
v = find(v);
var_data * d = m_var_data[v];
d->m_parent_selects.push_back(s);
TRACE("array", tout << v << " " << mk_pp(s->get_expr(), m) << " " << mk_pp(get_enode(v)->get_expr(), m) << "\n";);
TRACE(array, tout << v << " " << mk_pp(s->get_expr(), m) << " " << mk_pp(get_enode(v)->get_expr(), m) << "\n";);
m_trail_stack.push(push_back_trail<enode *, false>(d->m_parent_selects));
for (enode* n : d->m_stores)
instantiate_axiom2a(s, n);
@ -141,7 +141,7 @@ namespace smt {
add_weak_var(v);
return;
}
TRACE("array", tout << "#" << v << "\n";);
TRACE(array, tout << "#" << v << "\n";);
m_trail_stack.push(reset_flag_trail(d->m_prop_upward));
d->m_prop_upward = true;
if (!m_params.m_array_delay_exp_axiom)
@ -195,14 +195,14 @@ namespace smt {
}
void theory_array::instantiate_axiom1(enode * store) {
TRACE("array", tout << "axiom 1:\n" << mk_bounded_pp(store->get_expr(), m) << "\n";);
TRACE(array, tout << "axiom 1:\n" << mk_bounded_pp(store->get_expr(), m) << "\n";);
SASSERT(is_store(store));
m_stats.m_num_axiom1++;
assert_store_axiom1(store);
}
void theory_array::instantiate_axiom2a(enode * select, enode * store) {
TRACE("array", tout << "axiom 2a: #" << select->get_owner_id() << " #" << store->get_owner_id() << "\n";);
TRACE(array, tout << "axiom 2a: #" << select->get_owner_id() << " #" << store->get_owner_id() << "\n";);
SASSERT(is_select(select));
SASSERT(is_store(store));
if (assert_store_axiom2(store, select))
@ -210,7 +210,7 @@ namespace smt {
}
bool theory_array::instantiate_axiom2b(enode * select, enode * store) {
TRACE("array_axiom2b", tout << "axiom 2b: #" << select->get_owner_id() << " #" << store->get_owner_id() << "\n";);
TRACE(array_axiom2b, tout << "axiom 2b: #" << select->get_owner_id() << " #" << store->get_owner_id() << "\n";);
SASSERT(is_select(select));
SASSERT(is_store(store));
if (assert_store_axiom2(store, select)) {
@ -221,7 +221,7 @@ namespace smt {
}
void theory_array::instantiate_extensionality(enode * a1, enode * a2) {
TRACE("array", tout << "extensionality: #" << a1->get_owner_id() << " #" << a2->get_owner_id() << "\n";);
TRACE(array, tout << "extensionality: #" << a1->get_owner_id() << " #" << a2->get_owner_id() << "\n";);
SASSERT(is_array_sort(a1));
SASSERT(is_array_sort(a2));
if (m_params.m_array_extensional && assert_extensionality(a1, a2))
@ -238,7 +238,7 @@ namespace smt {
//
bool theory_array::internalize_term_core(app * n) {
TRACE("array_bug", tout << mk_bounded_pp(n, m) << "\n";);
TRACE(array_bug, tout << mk_bounded_pp(n, m) << "\n";);
for (expr* arg : *n)
ctx.internalize(arg, false);
// force merge-tf by re-internalizing expression.
@ -266,7 +266,7 @@ namespace smt {
found_unsupported_op(n);
return false;
}
TRACE("array_bug", tout << mk_bounded_pp(n, m) << "\n";);
TRACE(array_bug, tout << mk_bounded_pp(n, m) << "\n";);
if (!internalize_term_core(n)) {
return true;
}
@ -309,7 +309,7 @@ namespace smt {
v1 = find(v1);
v2 = find(v2);
var_data * d1 = m_var_data[v1];
TRACE("ext", tout << "extensionality: " << d1->m_is_array << "\n"
TRACE(ext, tout << "extensionality: " << d1->m_is_array << "\n"
<< mk_bounded_pp(get_enode(v1)->get_expr(), m, 5) << "\n"
<< mk_bounded_pp(get_enode(v2)->get_expr(), m, 5) << "\n";);
@ -323,7 +323,7 @@ namespace smt {
if (laziness() == 0)
return;
if (m.is_ite(n)) {
TRACE("array", tout << "relevant ite " << mk_pp(n, m) << "\n";);
TRACE(array, tout << "relevant ite " << mk_pp(n, m) << "\n";);
}
if (!is_store(n) && !is_select(n))
return;
@ -394,7 +394,7 @@ namespace smt {
bool should_giveup = m_found_unsupported_op || has_propagate_up_trail();
if (r == FC_DONE && should_giveup && !ctx.get_fparams().m_array_fake_support)
r = FC_GIVEUP;
CTRACE("array", r != FC_DONE || m_found_unsupported_op, tout << r << "\n";);
CTRACE(array, r != FC_DONE || m_found_unsupported_op, tout << r << "\n";);
return r;
}

View file

@ -151,7 +151,7 @@ namespace smt {
mk_th_axiom(3, lits);
}
void mk_th_axiom(unsigned n, literal* lits) {
TRACE("card", ctx().display_literals_verbose(tout, n, lits) << "\n";);
TRACE(card, ctx().display_literals_verbose(tout, n, lits) << "\n";);
IF_VERBOSE(10, ctx().display_literals_verbose(verbose_stream(), n, lits) << "\n");
ctx().mk_th_axiom(th.get_id(), n, lits);
}
@ -359,7 +359,7 @@ namespace smt {
expr_ref idx = mk_index_skolem(set_sz, set, k);
app_ref sel(mk_select(set, idx), m);
mk_th_axiom(~sz_lit, le_lit, mk_literal(sel));
TRACE("card", tout << idx << " " << sel << " " << i.m_size << "\n";);
TRACE(card, tout << idx << " " << sel << " " << i.m_size << "\n";);
}
return l_false;
}
@ -543,7 +543,7 @@ namespace smt {
if (r == l_true) r = trace_call("ensure_values_assigned", ensure_values_assigned());
if (r == l_true) r = trace_call("ensure_non_empty", ensure_non_empty());
if (r == l_true) r = trace_call("ensure_no_overflow", ensure_no_overflow());
CTRACE("card", r != l_true, display(tout););
CTRACE(card, r != l_true, display(tout););
switch (r) {
case l_true:
return FC_DONE;
@ -622,7 +622,7 @@ namespace smt {
expr* sz = kv.m_key->get_arg(1);
assumptions.push_back(mk_size_limit(set, sz));
}
TRACE("card", tout << "ASSUMPTIONS: " << assumptions << "\n";);
TRACE(card, tout << "ASSUMPTIONS: " << assumptions << "\n";);
}
};

View file

@ -40,7 +40,7 @@ namespace smt {
void theory_array_base::found_unsupported_op(expr * n) {
if (!ctx.get_fparams().m_array_fake_support && !m_found_unsupported_op) {
TRACE("array", tout << mk_ll_pp(n, m) << "\n";);
TRACE(array, tout << mk_ll_pp(n, m) << "\n";);
ctx.push_trail(value_trail<bool>(m_found_unsupported_op));
m_found_unsupported_op = true;
}
@ -48,7 +48,7 @@ namespace smt {
app * theory_array_base::mk_select(unsigned num_args, expr * const * args) {
app * r = m.mk_app(get_family_id(), OP_SELECT, 0, nullptr, num_args, args);
TRACE("mk_var_bug", tout << "mk_select: " << r->get_id() << " num_args: " << num_args;
TRACE(mk_var_bug, tout << "mk_select: " << r->get_id() << " num_args: " << num_args;
for (unsigned i = 0; i < num_args; i++) tout << " " << args[i]->get_id();
tout << "\n";);
return r;
@ -86,7 +86,7 @@ namespace smt {
}
void theory_array_base::assert_axiom(unsigned num_lits, literal * lits) {
TRACE("array_axiom",
TRACE(array_axiom,
tout << "literals:\n";
for (unsigned i = 0; i < num_lits; ++i) {
expr * e = ctx.bool_var2expr(lits[i].var());
@ -120,7 +120,7 @@ namespace smt {
expr_ref sel(m);
sel = mk_select(sel_args.size(), sel_args.data());
expr * val = n->get_arg(num_args - 1);
TRACE("array", tout << mk_bounded_pp(sel, m) << " = " << mk_bounded_pp(val, m) << "\n";);
TRACE(array, tout << mk_bounded_pp(sel, m) << " = " << mk_bounded_pp(val, m) << "\n";);
if (m.proofs_enabled()) {
literal l(mk_eq(sel, val, true));
ctx.mark_as_relevant(l);
@ -129,7 +129,7 @@ namespace smt {
if (m.has_trace_stream()) m.trace_stream() << "[end-of-instance]\n";
}
else {
TRACE("mk_var_bug", tout << "mk_sel: " << sel->get_id() << "\n";);
TRACE(mk_var_bug, tout << "mk_sel: " << sel->get_id() << "\n";);
ctx.internalize(sel, false);
ctx.assign_eq(ctx.get_enode(sel), ctx.get_enode(val), eq_justification::mk_axiom());
ctx.mark_as_relevant(sel.get());
@ -147,7 +147,7 @@ namespace smt {
i_n /= j_n => select(store(a, i_1, ..., i_n, v), j_1, ..., j_n) = select(a, j_1, ..., j_n)
*/
void theory_array_base::assert_store_axiom2_core(enode * store, enode * select) {
TRACE("array", tout << "generating axiom2: #" << store->get_owner_id() << " #" << select->get_owner_id() << "\n";
TRACE(array, tout << "generating axiom2: #" << store->get_owner_id() << " #" << select->get_owner_id() << "\n";
tout << mk_bounded_pp(store->get_expr(), m) << "\n" << mk_bounded_pp(select->get_expr(), m) << "\n";);
SASSERT(is_store(store));
SASSERT(is_select(select));
@ -176,7 +176,7 @@ namespace smt {
enode * idx2 = is[i];
if (idx1->get_root() == idx2->get_root()) {
TRACE("array_bug", tout << "indexes are equal... skipping...\n";);
TRACE(array_bug, tout << "indexes are equal... skipping...\n";);
continue;
}
@ -184,11 +184,11 @@ namespace smt {
sel1 = mk_select(sel1_args.size(), sel1_args.data());
sel2 = mk_select(sel2_args.size(), sel2_args.data());
if (sel1 == sel2) {
TRACE("array_bug", tout << "sel1 and sel2 are equal:\n";);
TRACE(array_bug, tout << "sel1 and sel2 are equal:\n";);
break;
}
init = true;
TRACE("array", tout << mk_bounded_pp(sel1, m) << " " << mk_bounded_pp(sel2, m) << "\n";);
TRACE(array, tout << mk_bounded_pp(sel1, m) << " " << mk_bounded_pp(sel2, m) << "\n";);
conseq = mk_eq(sel1, sel2, true);
conseq_expr = ctx.bool_var2expr(conseq.var());
}
@ -204,8 +204,8 @@ namespace smt {
// ctx.force_phase(ante);
ctx.add_rel_watch(~ante, conseq_expr);
// ctx.mark_as_relevant(conseq_expr);
TRACE("array", tout << "asserting axiom2: " << ante << "\n";);
TRACE("array_map_bug", tout << "axiom2:\n";
TRACE(array, tout << "asserting axiom2: " << ante << "\n";);
TRACE(array_map_bug, tout << "axiom2:\n";
tout << mk_ismt2_pp(idx1->get_expr(), m) << "\n=\n" << mk_ismt2_pp(idx2->get_expr(), m);
tout << "\nimplies\n" << mk_ismt2_pp(conseq_expr, m) << "\n";);
if (m.has_trace_stream()) {
@ -227,11 +227,11 @@ namespace smt {
if (i == num_args)
return false;
if (ctx.add_fingerprint(store, store->get_owner_id(), select->get_num_args() - 1, select->get_args() + 1)) {
TRACE("array", tout << "adding axiom2 to todo queue\n";);
TRACE(array, tout << "adding axiom2 to todo queue\n";);
m_axiom2_todo.push_back(std::make_pair(store, select));
return true;
}
TRACE("array", tout << "axiom already instantiated: #" << store->get_owner_id() << " #" << select->get_owner_id() << "\n";);
TRACE(array, tout << "axiom already instantiated: #" << store->get_owner_id() << " #" << select->get_owner_id() << "\n";);
return false;
}
@ -299,7 +299,7 @@ namespace smt {
m_array_value.find(parent, other)) {
if (ctx.is_diseq(parent, other)) {
TRACE("array_ext", tout << "selects are disequal\n";);
TRACE(array_ext, tout << "selects are disequal\n";);
return true;
}
}
@ -320,7 +320,7 @@ namespace smt {
}
void theory_array_base::assert_congruent(enode * a1, enode * a2) {
TRACE("array", tout << "congruent: #" << a1->get_owner_id() << " #" << a2->get_owner_id() << "\n";);
TRACE(array, tout << "congruent: #" << a1->get_owner_id() << " #" << a2->get_owner_id() << "\n";);
SASSERT(is_array_sort(a1));
SASSERT(is_array_sort(a2));
if (a1->get_owner_id() > a2->get_owner_id())
@ -353,7 +353,7 @@ namespace smt {
}
expr_ref sel1(mk_select(args1.size(), args1.data()), m);
expr_ref sel2(mk_select(args2.size(), args2.data()), m);
TRACE("ext", tout << mk_bounded_pp(sel1, m) << "\n" << mk_bounded_pp(sel2, m) << "\n";);
TRACE(ext, tout << mk_bounded_pp(sel1, m) << "\n" << mk_bounded_pp(sel2, m) << "\n";);
literal n1_eq_n2 = mk_eq(e1, e2, true);
literal sel1_eq_sel2 = mk_eq(sel1, sel2, true);
ctx.mark_as_relevant(n1_eq_n2);
@ -529,7 +529,7 @@ namespace smt {
// issue #3532, #3529
//
if (ctx.is_shared(r) || is_select_arg(r)) {
TRACE("array", tout << "new shared var: #" << r->get_owner_id() << " " << is_select_arg(r) << "\n";);
TRACE(array, tout << "new shared var: #" << r->get_owner_id() << " " << is_select_arg(r) << "\n";);
theory_var r_th_var = r->get_th_var(get_id());
SASSERT(r_th_var != null_theory_var);
result.push_back(r_th_var);
@ -537,7 +537,7 @@ namespace smt {
r->set_mark();
to_unmark.push_back(r);
}
TRACE("array", tout << "collecting shared vars...\n" << unsigned_vector(result.size(), (unsigned*)result.data()) << "\n";);
TRACE(array, tout << "collecting shared vars...\n" << unsigned_vector(result.size(), (unsigned*)result.data()) << "\n";);
unmark_enodes(to_unmark.size(), to_unmark.data());
}
@ -552,7 +552,7 @@ namespace smt {
sbuffer<theory_var>::iterator it1 = roots.begin();
sbuffer<theory_var>::iterator end1 = roots.end();
for (; it1 != end1; ++it1) {
TRACE("array_bug", tout << "mk_interface_eqs: processing: v" << *it1 << "\n";);
TRACE(array_bug, tout << "mk_interface_eqs: processing: v" << *it1 << "\n";);
theory_var v1 = *it1;
enode * n1 = get_enode(v1);
sort * s1 = n1->get_expr()->get_sort();
@ -615,7 +615,7 @@ namespace smt {
void theory_array_base::set_default(theory_var v, enode* n) {
TRACE("array", tout << "set default: " << v << " " << pp(n, m) << "\n";);
TRACE(array, tout << "set default: " << v << " " << pp(n, m) << "\n";);
v = mg_find(v);
if (m_defaults[v] == 0) {
m_defaults[v] = n;
@ -662,7 +662,7 @@ namespace smt {
if (m_defaults[u] == 0) {
m_defaults[u] = m_defaults[v];
}
CTRACE("array", m_defaults[v],
CTRACE(array, m_defaults[v],
tout << pp(m_defaults[v]->get_root(), m) << "\n";
tout << pp(m_defaults[u]->get_root(), m) << "\n";
);
@ -739,7 +739,7 @@ namespace smt {
mg_merge(v, get_representative(w));
TRACE("array", tout << "merge: " << pp(n, m) << " " << v << " " << w << "\n";);
TRACE(array, tout << "merge: " << pp(n, m) << " " << v << " " << w << "\n";);
}
else if (is_const(n)) {
set_default(v, n->get_arg(0));
@ -996,7 +996,7 @@ namespace smt {
// The implementation should not assume a fresh value is created for
// the else_val if the range is finite
TRACE("array", tout << pp(n, m) << " " << mk_pp(range, m) << " " << range->is_infinite() << "\n";);
TRACE(array, tout << pp(n, m) << " " << mk_pp(range, m) << " " << range->is_infinite() << "\n";);
if (range->is_infinite())
else_val = TAG(void*, mg.mk_extra_fresh_value(n->get_expr(), range), 1);
else
@ -1025,7 +1025,7 @@ namespace smt {
result->add_entry(args.size(), args.data(), select);
}
}
TRACE("array",
TRACE(array,
tout << pp(n->get_root(), m) << "\n";
if (sel_set) {
for (enode* s : *sel_set) {

View file

@ -111,7 +111,7 @@ namespace smt {
}
m_trail_stack.push(reset_flag_trail(d->m_prop_upward));
d->m_prop_upward = true;
TRACE("array", tout << "#" << v << "\n";);
TRACE(array, tout << "#" << v << "\n";);
if (!m_params.m_array_delay_exp_axiom) {
instantiate_axiom2b_for(v);
instantiate_axiom_map_for(v);
@ -133,7 +133,7 @@ namespace smt {
// call set_prop_upward on array arguments.
//
void theory_array_full::set_prop_upward(enode * n) {
TRACE("array", tout << pp(n, m) << "\n";);
TRACE(array, tout << pp(n, m) << "\n";);
if (is_store(n)) {
set_prop_upward(n->get_arg(0)->get_th_var(get_id()));
}
@ -265,7 +265,7 @@ namespace smt {
if (ctx.e_internalized(n)) {
return true;
}
TRACE("array", tout << mk_pp(n, m) << "\n";);
TRACE(array, tout << mk_pp(n, m) << "\n";);
if (is_store(n) || is_select(n)) {
return theory_array::internalize_term(n);
@ -358,7 +358,7 @@ namespace smt {
add_as_array(v1, n);
for (enode* n : d2->m_lambdas)
add_lambda(v1, n);
TRACE("array",
TRACE(array,
tout << pp(get_enode(v1), m) << "\n";
tout << pp(get_enode(v2), m) << "\n";
tout << "merge in\n"; display_var(tout, v2);
@ -369,7 +369,7 @@ namespace smt {
SASSERT(v != null_theory_var);
v = find(v);
var_data* d = m_var_data[v];
TRACE("array", tout << "v" << v << " " << pp(get_enode(v), m) << " "
TRACE(array, tout << "v" << v << " " << pp(get_enode(v), m) << " "
<< d->m_prop_upward << " " << m_params.m_array_delay_exp_axiom << "\n";);
for (enode * store : d->m_stores) {
SASSERT(is_store(store));
@ -382,7 +382,7 @@ namespace smt {
}
void theory_array_full::add_parent_select(theory_var v, enode * s) {
TRACE("array",
TRACE(array,
tout << v << " select parent: " << pp(s, m) << "\n";
display_var(tout, v);
);
@ -408,7 +408,7 @@ namespace smt {
}
void theory_array_full::relevant_eh(app* n) {
TRACE("array", tout << mk_pp(n, m) << "\n";);
TRACE(array, tout << mk_pp(n, m) << "\n";);
theory_array::relevant_eh(n);
if (!is_default(n) && !is_select(n) && !is_map(n) && !is_const(n) && !is_as_array(n)){
return;
@ -469,7 +469,7 @@ namespace smt {
func_decl* f = to_func_decl(map->get_decl()->get_parameter(0).get_ast());
TRACE("array_map_bug", tout << "invoked instantiate_select_map_axiom\n";
TRACE(array_map_bug, tout << "invoked instantiate_select_map_axiom\n";
tout << sl->get_owner_id() << " " << mp->get_owner_id() << "\n";
tout << mk_ismt2_pp(sl->get_expr(), m) << "\n" << mk_ismt2_pp(mp->get_expr(), m) << "\n";);
@ -477,10 +477,10 @@ namespace smt {
return false;
}
TRACE("array_map_bug", tout << "new axiom\n";);
TRACE(array_map_bug, tout << "new axiom\n";);
m_stats.m_num_map_axiom++;
TRACE("array",
TRACE(array,
tout << mk_bounded_pp(mp->get_expr(), m) << "\n";
tout << mk_bounded_pp(sl->get_expr(), m) << "\n";);
unsigned num_args = select->get_num_args();
@ -512,7 +512,7 @@ namespace smt {
ctx.internalize(sel1, false);
ctx.internalize(sel2, false);
TRACE("array_map_bug",
TRACE(array_map_bug,
tout << "select-map axiom\n" << mk_ismt2_pp(sel1, m) << "\n=\n" << mk_ismt2_pp(sel2,m) << "\n";);
return try_assign_eq(sel1, sel2);
@ -532,7 +532,7 @@ namespace smt {
if (!ctx.add_fingerprint(this, m_default_map_fingerprint, 1, &mp)) {
return false;
}
TRACE("array", tout << mk_bounded_pp(map, m) << "\n";);
TRACE(array, tout << mk_bounded_pp(map, m) << "\n";);
m_stats.m_num_default_map_axiom++;
@ -558,7 +558,7 @@ namespace smt {
}
m_stats.m_num_default_const_axiom++;
SASSERT(is_const(cnst));
TRACE("array", tout << mk_bounded_pp(cnst->get_expr(), m) << "\n";);
TRACE(array, tout << mk_bounded_pp(cnst->get_expr(), m) << "\n";);
expr* val = cnst->get_arg(0)->get_expr();
expr_ref def(mk_default(cnst->get_expr()), m);
ctx.internalize(def, false);
@ -578,7 +578,7 @@ namespace smt {
}
m_stats.m_num_default_as_array_axiom++;
SASSERT(is_as_array(arr));
TRACE("array", tout << mk_bounded_pp(arr->get_owner(), m) << "\n";);
TRACE(array, tout << mk_bounded_pp(arr->get_owner(), m) << "\n";);
expr* def = mk_default(arr->get_owner());
func_decl * f = array_util(m).get_as_array_func_decl(arr->get_owner());
ptr_vector<expr> args;
@ -599,7 +599,7 @@ namespace smt {
expr* e = arr->get_expr();
expr_ref def(mk_default(e), m);
quantifier* lam = m.is_lambda_def(arr->get_decl());
TRACE("array", tout << mk_pp(lam, m) << "\n" << mk_pp(e, m) << "\n");
TRACE(array, tout << mk_pp(lam, m) << "\n" << mk_pp(e, m) << "\n");
expr_ref_vector args(m);
var_subst subst(m, false);
args.push_back(subst(lam, to_app(e)->get_num_args(), to_app(e)->get_args()));
@ -675,7 +675,7 @@ namespace smt {
}
expr * sel = mk_select(sel_args.size(), sel_args.data());
expr * val = cnst->get_expr()->get_arg(0);
TRACE("array", tout << "new select-const axiom...\n";
TRACE(array, tout << "new select-const axiom...\n";
tout << "const: " << mk_bounded_pp(cnst->get_expr(), m) << "\n";
tout << "select: " << mk_bounded_pp(select->get_expr(), m) << "\n";
tout << " sel/const: " << mk_bounded_pp(sel, m) << "\n";
@ -710,7 +710,7 @@ namespace smt {
expr * sel = mk_select(sel_args.size(), sel_args.data());
func_decl * f = array_util(m).get_as_array_func_decl(arr->get_expr());
expr_ref val(m.mk_app(f, sel_args.size()-1, sel_args.data()+1), m);
TRACE("array", tout << "new select-as-array axiom...\n";
TRACE(array, tout << "new select-as-array axiom...\n";
tout << "as-array: " << mk_bounded_pp(arr->get_expr(), m) << "\n";
tout << "select: " << mk_bounded_pp(select->get_expr(), m) << "\n";
tout << " sel/as-array: " << mk_bounded_pp(sel, m) << "\n";
@ -736,7 +736,7 @@ namespace smt {
expr_ref def1(m), def2(m);
TRACE("array", tout << mk_bounded_pp(store_app, m) << "\n";);
TRACE(array, tout << mk_bounded_pp(store_app, m) << "\n";);
unsigned num_args = store_app->get_num_args();
@ -827,14 +827,14 @@ namespace smt {
for (enode* n : m_as_array) {
for (enode* p : n->get_parents())
if (!ctx.is_beta_redex(p, n)) {
TRACE("array", tout << "not a beta redex " << enode_pp(p, ctx) << "\n");
TRACE(array, tout << "not a beta redex " << enode_pp(p, ctx) << "\n");
return true;
}
}
for (enode* n : m_lambdas)
for (enode* p : n->get_parents())
if (!is_default(p) && !ctx.is_beta_redex(p, n)) {
TRACE("array", tout << "lambda is not a beta redex " << enode_pp(p, ctx) << "\n");
TRACE(array, tout << "lambda is not a beta redex " << enode_pp(p, ctx) << "\n");
return true;
}
return false;
@ -843,7 +843,7 @@ namespace smt {
bool theory_array_full::instantiate_parent_stores_default(theory_var v) {
SASSERT(v != null_theory_var);
TRACE("array", tout << "v" << v << "\n";);
TRACE(array, tout << "v" << v << "\n";);
v = find(v);
var_data* d = m_var_data[v];
bool result = false;
@ -859,7 +859,7 @@ namespace smt {
}
bool theory_array_full::try_assign_eq(expr* v1, expr* v2) {
TRACE("array", tout << mk_bounded_pp(v1, m) << "\n==\n" << mk_bounded_pp(v2, m) << "\n";);
TRACE(array, tout << mk_bounded_pp(v1, m) << "\n==\n" << mk_bounded_pp(v2, m) << "\n";);
if (m_eqs.contains(v1, v2)) {
return false;

View file

@ -65,7 +65,7 @@ namespace smt {
}
}
TRACE("bv", tout << "v" << v << " #" << owner->get_id() << "\n";
TRACE(bv, tout << "v" << v << " #" << owner->get_id() << "\n";
for (unsigned i = 0; i < bv_size; i++)
tout << mk_bounded_pp(m_bits_expr[i], m) << "\n";
);
@ -87,7 +87,7 @@ namespace smt {
void theory_bv::mk_bit2bool(app * n) {
SASSERT(!ctx.b_internalized(n));
TRACE("bv", tout << "bit2bool: " << mk_pp(n, ctx.get_manager()) << "\n";);
TRACE(bv, tout << "bit2bool: " << mk_pp(n, ctx.get_manager()) << "\n";);
expr* first_arg = n->get_arg(0);
if (!ctx.e_internalized(first_arg)) {
@ -233,7 +233,7 @@ namespace smt {
*/
void theory_bv::assert_new_diseq_axiom(theory_var v1, theory_var v2, unsigned idx) {
SASSERT(m_bits[v1][idx] == ~m_bits[v2][idx]);
TRACE("bv_diseq_axiom", tout << "found new diseq axiom\n"; display_var(tout, v1); display_var(tout, v2););
TRACE(bv_diseq_axiom, tout << "found new diseq axiom\n"; display_var(tout, v1); display_var(tout, v2););
// found new disequality
m_stats.m_num_diseq_static++;
app * e1 = get_expr(v1);
@ -286,7 +286,7 @@ namespace smt {
}
else {
theory_id th_id = ctx.get_var_theory(l.var());
TRACE("init_bits", tout << l << " " << th_id << "\n";);
TRACE(init_bits, tout << l << " " << th_id << "\n";);
if (th_id == get_id()) {
atom * a = get_bv2a(l.var());
SASSERT(a && a->is_bit());
@ -327,7 +327,7 @@ namespace smt {
for (unsigned i = 0; i < sz; i++) {
expr * bit = bits.get(i);
literal l = ctx.get_literal(bit);
TRACE("init_bits", tout << "bit " << i << " of #" << n->get_owner_id() << "\n" << mk_bounded_pp(bit, m) << "\n";);
TRACE(init_bits, tout << "bit " << i << " of #" << n->get_owner_id() << "\n" << mk_bounded_pp(bit, m) << "\n";);
add_bit(v, l);
}
find_wpos(v);
@ -342,20 +342,20 @@ namespace smt {
unsigned & wpos = m_wpos[v];
unsigned init = wpos;
for (; wpos < sz; wpos++) {
TRACE("find_wpos", tout << "curr bit: " << bits[wpos] << "\n";);
TRACE(find_wpos, tout << "curr bit: " << bits[wpos] << "\n";);
if (ctx.get_assignment(bits[wpos]) == l_undef) {
TRACE("find_wpos", tout << "moved wpos of v" << v << " to " << wpos << "\n";);
TRACE(find_wpos, tout << "moved wpos of v" << v << " to " << wpos << "\n";);
return;
}
}
wpos = 0;
for (; wpos < init; wpos++) {
if (ctx.get_assignment(bits[wpos]) == l_undef) {
TRACE("find_wpos", tout << "moved wpos of v" << v << " to " << wpos << "\n";);
TRACE(find_wpos, tout << "moved wpos of v" << v << " to " << wpos << "\n";);
return;
}
}
TRACE("find_wpos", tout << "v" << v << " is a fixed variable.\n";);
TRACE(find_wpos, tout << "v" << v << " is a fixed variable.\n";);
fixed_var_eh(v);
}
@ -444,7 +444,7 @@ namespace smt {
ctx.mark_as_relevant(oeq);
unsigned sz = get_bv_size(v1);
TRACE("bv",
TRACE(bv,
tout << mk_pp(o1, m) << " = " << mk_pp(o2, m) << " "
<< ctx.get_scope_level() << "\n";);
literal_vector eqs;
@ -494,7 +494,7 @@ namespace smt {
get_bv_size(v2) == sz && get_fixed_value(v2, val2) && val == val2) {
if (get_enode(v)->get_root() != get_enode(v2)->get_root()) {
SASSERT(get_bv_size(v) == get_bv_size(v2));
TRACE("fixed_var_eh", tout << "detected equality: v" << v << " = v" << v2 << "\n";
TRACE(fixed_var_eh, tout << "detected equality: v" << v << " = v" << v2 << "\n";
display_var(tout, v);
display_var(tout, v2););
m_stats.m_num_th2core_eq++;
@ -551,7 +551,7 @@ namespace smt {
}
bool theory_bv::get_fixed_value(app* x, numeral & result) const {
CTRACE("bv", !ctx.e_internalized(x), tout << "not internalized " << mk_pp(x, m) << "\n";);
CTRACE(bv, !ctx.e_internalized(x), tout << "not internalized " << mk_pp(x, m) << "\n";);
if (!ctx.e_internalized(x)) return false;
enode * e = ctx.get_enode(x);
theory_var v = e->get_th_var(get_id());
@ -596,7 +596,7 @@ namespace smt {
void theory_bv::internalize_bv2int(app* n) {
SASSERT(!ctx.e_internalized(n));
TRACE("bv", tout << mk_bounded_pp(n, m) << "\n";);
TRACE(bv, tout << mk_bounded_pp(n, m) << "\n";);
process_args(n);
mk_enode(n);
m_bv2int.push_back(ctx.get_enode(n));
@ -613,7 +613,7 @@ namespace smt {
//
SASSERT(ctx.e_internalized(n));
SASSERT(m_util.is_ubv2int(n));
TRACE("bv2int_bug", tout << "bv2int:\n" << mk_pp(n, m) << "\n";);
TRACE(bv2int_bug, tout << "bv2int:\n" << mk_pp(n, m) << "\n";);
sort * int_sort = n->get_sort();
app * k = to_app(n->get_arg(0));
SASSERT(m_util.is_bv_sort(k->get_sort()));
@ -649,7 +649,7 @@ namespace smt {
th_rewriter rw(m);
rw(sum);
literal l(mk_eq(n, sum, false));
TRACE("bv",
TRACE(bv,
tout << mk_pp(n, m) << "\n";
tout << mk_pp(sum, m) << "\n";
ctx.display_literal_verbose(tout, l);
@ -705,7 +705,7 @@ namespace smt {
ctx.mk_th_axiom(get_id(), 1, &l);
}
TRACE("bv",
TRACE(bv,
tout << mk_pp(lhs, m) << " == \n";
tout << mk_pp(rhs, m) << "\n";
);
@ -721,7 +721,7 @@ namespace smt {
rhs = m_autil.mk_mod(div_rhs, m_autil.mk_numeral(mod, true));
rhs = ctx.mk_eq_atom(rhs, m_autil.mk_int(1));
lhs = n_bits.get(i);
TRACE("bv", tout << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << "\n";);
TRACE(bv, tout << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << "\n";);
l = literal(mk_eq(lhs, rhs, false));
ctx.mark_as_relevant(l);
{
@ -793,7 +793,7 @@ namespace smt {
bits.swap(new_bits); \
} \
init_bits(e, bits); \
TRACE("bv_verbose", tout << arg_bits << " " << bits << " " << new_bits << "\n";); \
TRACE(bv_verbose, tout << arg_bits << " " << bits << " " << new_bits << "\n";); \
}
void theory_bv::internalize_sub(app *n) {
@ -889,7 +889,7 @@ namespace smt {
bool theory_bv::internalize_term_core(app * term) {
SASSERT(term->get_family_id() == get_family_id());
TRACE("bv", tout << "internalizing term: " << mk_bounded_pp(term, m) << "\n";);
TRACE(bv, tout << "internalizing term: " << mk_bounded_pp(term, m) << "\n";);
if (approximate_term(term)) {
return false;
}
@ -951,7 +951,7 @@ namespace smt {
case OP_BUREM: return false;
case OP_BSMOD: return false;
default:
TRACE("bv_op", tout << "unsupported operator: " << mk_ll_pp(term, m) << "\n";);
TRACE(bv_op, tout << "unsupported operator: " << mk_ll_pp(term, m) << "\n";);
UNREACHABLE();
return false;
}
@ -1095,7 +1095,7 @@ namespace smt {
}
bool theory_bv::internalize_atom(app * atom, bool gate_ctx) {
TRACE("bv", tout << "internalizing atom: " << mk_bounded_pp(atom, m) << "\n";);
TRACE(bv, tout << "internalizing atom: " << mk_bounded_pp(atom, m) << "\n";);
SASSERT(atom->get_family_id() == get_family_id());
if (approximate_term(atom)) {
return false;
@ -1129,7 +1129,7 @@ namespace smt {
sort* s = arg->get_sort();
if (m_util.is_bv_sort(s) && m_util.get_bv_size(arg) > params().m_bv_blast_max_size) {
if (!m_approximates_large_bvs) {
TRACE("bv", tout << "found large size bit-vector:\n" << mk_pp(n, m) << "\n";);
TRACE(bv, tout << "found large size bit-vector:\n" << mk_pp(n, m) << "\n";);
ctx.push_trail(value_trail<bool>(m_approximates_large_bvs));
m_approximates_large_bvs = true;
}
@ -1149,8 +1149,8 @@ namespace smt {
}
void theory_bv::new_eq_eh(theory_var v1, theory_var v2) {
TRACE("bv_eq", tout << "new_eq: " << mk_pp(get_enode(v1)->get_expr(), m) << " = " << mk_pp(get_enode(v2)->get_expr(), m) << "\n";);
TRACE("bv", tout << "new_eq_eh v" << v1 << " = v" << v2 << " @ " << ctx.get_scope_level() <<
TRACE(bv_eq, tout << "new_eq: " << mk_pp(get_enode(v1)->get_expr(), m) << " = " << mk_pp(get_enode(v2)->get_expr(), m) << "\n";);
TRACE(bv, tout << "new_eq_eh v" << v1 << " = v" << v2 << " @ " << ctx.get_scope_level() <<
" relevant1: " << ctx.is_relevant(get_enode(v1)) <<
" relevant2: " << ctx.is_relevant(get_enode(v2)) << "\n";);
m_find.merge(v1, v2);
@ -1226,7 +1226,7 @@ namespace smt {
literal arg = ctx.get_literal(diff);
lits.push_back(arg);
}
TRACE("bv",
TRACE(bv,
tout << mk_pp(get_enode(v1)->get_expr(), m) << " = " << mk_pp(get_enode(v2)->get_expr(), m) << " "
<< ctx.get_scope_level()
<< "\n";
@ -1239,7 +1239,7 @@ namespace smt {
void theory_bv::assign_eh(bool_var v, bool is_true) {
atom * a = get_bv2a(v);
TRACE("bv", tout << "assert: p" << v << " #" << ctx.bool_var2expr(v)->get_id() << " is_true: " << is_true << " " << ctx.inconsistent() << "\n";);
TRACE(bv, tout << "assert: p" << v << " #" << ctx.bool_var2expr(v)->get_id() << " is_true: " << is_true << " " << ctx.inconsistent() << "\n";);
if (a->is_bit()) {
m_prop_queue.reset();
bit_atom * b = static_cast<bit_atom*>(a);
@ -1277,7 +1277,7 @@ namespace smt {
continue;
}
theory_var v2 = next(v);
TRACE("bv", tout << "propagating v" << v << " #" << get_enode(v)->get_owner_id() << "[" << idx << "] = " << val << " " << ctx.get_scope_level() << "\n";);
TRACE(bv, tout << "propagating v" << v << " #" << get_enode(v)->get_owner_id() << "[" << idx << "] = " << val << " " << ctx.get_scope_level() << "\n";);
literal antecedent = bit;
if (val == l_false) {
@ -1287,8 +1287,8 @@ namespace smt {
literal_vector & bits2 = m_bits[v2];
literal bit2 = bits2[idx];
lbool val2 = ctx.get_assignment(bit2);
TRACE("bv_bit_prop", tout << "propagating #" << get_enode(v2)->get_owner_id() << "[" << idx << "] = " << val2 << "\n";);
TRACE("bv", tout << bit << " -> " << bit2 << " " << val << " -> " << val2 << " " << ctx.get_scope_level() << "\n";);
TRACE(bv_bit_prop, tout << "propagating #" << get_enode(v2)->get_owner_id() << "[" << idx << "] = " << val2 << "\n";);
TRACE(bv, tout << bit << " -> " << bit2 << " " << val << " -> " << val2 << " " << ctx.get_scope_level() << "\n";);
if (bit == ~bit2) {
add_new_diseq_axiom(v, v2, idx);
@ -1302,7 +1302,7 @@ namespace smt {
}
assign_bit(consequent, v, v2, idx, antecedent, false);
if (ctx.inconsistent()) {
TRACE("bv", tout << "inconsistent " << bit << " " << bit2 << "\n";);
TRACE(bv, tout << "inconsistent " << bit << " " << bit2 << "\n";);
m_prop_queue.reset();
return;
}
@ -1311,7 +1311,7 @@ namespace smt {
}
}
m_prop_queue.reset();
TRACE("bv_bit_prop", tout << "done propagating\n";);
TRACE(bv_bit_prop, tout << "done propagating\n";);
}
void theory_bv::assign_bit(literal consequent, theory_var v1, theory_var v2, unsigned idx, literal antecedent, bool propagate_eqc) {
@ -1320,7 +1320,7 @@ namespace smt {
SASSERT(ctx.get_assignment(antecedent) == l_true);
SASSERT(m_bits[v2][idx].var() == consequent.var());
SASSERT(consequent.var() != antecedent.var());
TRACE("bv_bit_prop", tout << "assigning: " << consequent << " @ " << ctx.get_scope_level();
TRACE(bv_bit_prop, tout << "assigning: " << consequent << " @ " << ctx.get_scope_level();
tout << " using "; ctx.display_literal(tout, antecedent);
tout << " " << enode_pp(get_enode(v1), ctx) << " " << enode_pp(get_enode(v2), ctx) << " idx: " << idx << "\n";
tout << "propagate_eqc: " << propagate_eqc << "\n";);
@ -1360,14 +1360,14 @@ namespace smt {
// So, we need to propagate the assignment to other bits.
bool_var bv = consequent.var();
atom * a = get_bv2a(bv);
CTRACE("bv", !a, tout << ctx.literal2expr(literal(bv, false)) << "\n");
CTRACE(bv, !a, tout << ctx.literal2expr(literal(bv, false)) << "\n");
if (!a)
return;
SASSERT(a->is_bit());
bit_atom * b = static_cast<bit_atom*>(a);
var_pos_occ * curr = b->m_occs;
while (curr) {
TRACE("assign_bit_bug", tout << "curr->m_var: v" << curr->m_var << ", curr->m_idx: " << curr->m_idx << ", v2: v" << v2 << ", idx: " << idx << "\n";
TRACE(assign_bit_bug, tout << "curr->m_var: v" << curr->m_var << ", curr->m_idx: " << curr->m_idx << ", v2: v" << v2 << ", idx: " << idx << "\n";
tout << "find(curr->m_var): v" << find(curr->m_var) << ", find(v2): v" << find(v2) << "\n";
tout << "is bit of #" << get_enode(curr->m_var)->get_owner_id() << "\n";
);
@ -1381,8 +1381,8 @@ namespace smt {
}
void theory_bv::relevant_eh(app * n) {
TRACE("arith", tout << "relevant: #" << n->get_id() << " " << ctx.e_internalized(n) << ": " << mk_bounded_pp(n, m) << "\n";);
TRACE("bv", tout << "relevant: #" << n->get_id() << " " << ctx.e_internalized(n) << ": " << mk_pp(n, m) << "\n";);
TRACE(arith, tout << "relevant: #" << n->get_id() << " " << ctx.e_internalized(n) << ": " << mk_bounded_pp(n, m) << "\n";);
TRACE(bv, tout << "relevant: #" << n->get_id() << " " << ctx.e_internalized(n) << ": " << mk_pp(n, m) << "\n";);
if (m.is_bool(n)) {
bool_var v = ctx.get_bool_var(n);
atom * a = get_bv2a(v);
@ -1415,7 +1415,7 @@ namespace smt {
theory_var v = e->get_th_var(get_id());
if (v != null_theory_var) {
literal_vector & bits = m_bits[v];
TRACE("bv", tout << "mark bits relevant: " << bits.size() << ": " << bits << "\n";);
TRACE(bv, tout << "mark bits relevant: " << bits.size() << ": " << bits << "\n";);
SASSERT(!is_bv(v) || bits.size() == get_bv_size(v));
for (literal lit : bits) {
ctx.mark_as_relevant(lit);
@ -1446,7 +1446,7 @@ namespace smt {
m_diseq_watch_trail.shrink(old_trail_sz);
m_diseq_watch_lim.shrink(m_diseq_watch_lim.size()-num_scopes);
theory::pop_scope_eh(num_scopes);
TRACE("bv_verbose", m_find.display(tout << ctx.get_scope_level() << " - "
TRACE(bv_verbose, m_find.display(tout << ctx.get_scope_level() << " - "
<< num_scopes << " = " << (ctx.get_scope_level() - num_scopes) << "\n"););
}
@ -1503,17 +1503,17 @@ namespace smt {
void theory_bv::merge_eh(theory_var r1, theory_var r2, theory_var v1, theory_var v2) {
TRACE("bv", tout << "merging: v" << v1 << " #" << get_enode(v1)->get_owner_id() << " v" << v2 << " #" << get_enode(v2)->get_owner_id() << "\n";);
TRACE("bv_bit_prop", tout << "merging: #" << get_enode(v1)->get_owner_id() << " #" << get_enode(v2)->get_owner_id() << "\n";);
TRACE(bv, tout << "merging: v" << v1 << " #" << get_enode(v1)->get_owner_id() << " v" << v2 << " #" << get_enode(v2)->get_owner_id() << "\n";);
TRACE(bv_bit_prop, tout << "merging: #" << get_enode(v1)->get_owner_id() << " #" << get_enode(v2)->get_owner_id() << "\n";);
if (!merge_zero_one_bits(r1, r2)) {
TRACE("bv", tout << "conflict detected\n";);
TRACE(bv, tout << "conflict detected\n";);
return; // conflict was detected
}
m_prop_queue.reset();
SASSERT(m_bits[v1].size() == m_bits[v2].size());
unsigned sz = m_bits[v1].size();
bool changed = true;
TRACE("bv", tout << "bits size: " << sz << "\n";);
TRACE(bv, tout << "bits size: " << sz << "\n";);
if (sz == 0 && !m_bv2int.empty()) {
// int2bv(bv2int(x)) = x when int2bv(bv2int(x)) has same sort as x
enode* n1 = get_enode(r1);
@ -1568,7 +1568,7 @@ namespace smt {
}
lbool val1 = ctx.get_assignment(bit1);
lbool val2 = ctx.get_assignment(bit2);
TRACE("bv", tout << "merge v" << v1 << " " << bit1 << ":= " << val1 << " " << bit2 << ":= " << val2 << "\n";);
TRACE(bv, tout << "merge v" << v1 << " " << bit1 << ":= " << val1 << " " << bit2 << ":= " << val2 << "\n";);
if (val1 == l_undef && !ctx.is_relevant(bit1))
ctx.mark_as_relevant(bit1);
if (val2 == l_undef && !ctx.is_relevant(bit2))
@ -1577,7 +1577,7 @@ namespace smt {
continue;
changed = true;
if (val1 != l_undef && val2 != l_undef) {
TRACE("bv", tout << "inconsistent "; display_var(tout, v1); display_var(tout, v2); tout << "idx: " << idx << "\n";);
TRACE(bv, tout << "inconsistent "; display_var(tout, v1); display_var(tout, v2); tout << "idx: " << idx << "\n";);
}
if (val1 != l_undef && bit2 != false_literal && bit2 != true_literal) {
literal antecedent = bit1;
@ -1793,7 +1793,7 @@ namespace smt {
void theory_bv::initialize_value(expr* var, expr* value) {
rational val;
unsigned sz;
TRACE("bv", tout << "initializing " << mk_pp(var, m) << " := " << mk_pp(value, m) << "\n");
TRACE(bv, tout << "initializing " << mk_pp(var, m) << " := " << mk_pp(value, m) << "\n");
if (!m_util.is_numeral(value, val, sz)) {
IF_VERBOSE(5, verbose_stream() << "value should be a bit-vector " << mk_pp(value, m) << "\n");
return;
@ -1934,7 +1934,7 @@ namespace smt {
literal bit2 = bits2[i];
lbool val1 = ctx.get_assignment(bit1);
lbool val2 = ctx.get_assignment(bit2);
CTRACE("bv_bug", val1 != val2,
CTRACE(bv_bug, val1 != val2,
tout << "equivalence class is inconsistent, i: " << i << "\n";
display_var(tout, v1);
display_var(tout, v2);

View file

@ -307,7 +307,7 @@ namespace smt {
* 2. Assign values to characters that haven't been assigned.
*/
bool theory_char::final_check() {
TRACE("seq", tout << "final check " << get_num_vars() << "\n";);
TRACE(seq, tout << "final check " << get_num_vars() << "\n";);
m_var2value.reset();
m_var2value.resize(get_num_vars(), UINT_MAX);
m_value2var.reset();
@ -318,7 +318,7 @@ namespace smt {
for (unsigned v = get_num_vars(); v-- > 0; ) {
expr* e = get_expr(v);
if (seq.is_char(e) && m_var2value[v] == UINT_MAX && get_char_value(v, c)) {
CTRACE("seq_verbose", seq.is_char(e), tout << mk_pp(e, m) << " root: " << get_enode(v)->is_root() << " is_value: " << get_char_value(v, c) << "\n";);
CTRACE(seq_verbose, seq.is_char(e), tout << mk_pp(e, m) << " root: " << get_enode(v)->is_root() << " is_value: " << get_char_value(v, c) << "\n";);
enode* r = get_enode(v)->get_root();
m_value2var.reserve(c + 1, null_theory_var);
theory_var u = m_value2var[c];
@ -358,7 +358,7 @@ namespace smt {
return false;
}
}
TRACE("seq", tout << "fresh: " << mk_pp(e, m) << " := " << c << "\n";);
TRACE(seq, tout << "fresh: " << mk_pp(e, m) << " := " << c << "\n";);
for (enode* n : *get_enode(v))
m_var2value[n->get_th_var(get_id())] = c;
m_value2var.reserve(c + 1, null_theory_var);
@ -370,7 +370,7 @@ namespace smt {
}
void theory_char::enforce_bits() {
TRACE("seq", tout << "enforce bits\n";);
TRACE(seq, tout << "enforce bits\n";);
for (unsigned v = get_num_vars(); v-- > 0; ) {
expr* e = get_expr(v);
if (seq.is_char(e) && get_enode(v)->is_root() && !has_bits(v))
@ -379,7 +379,7 @@ namespace smt {
}
void theory_char::enforce_value_bound(theory_var v) {
TRACE("seq", tout << "enforce bound " << v << "\n";);
TRACE(seq, tout << "enforce bound " << v << "\n";);
enode* n = ensure_enode(seq.mk_char(seq.max_char()));
theory_var w = n->get_th_var(get_id());
SASSERT(has_bits(w));
@ -395,7 +395,7 @@ namespace smt {
void theory_char::enforce_ackerman(theory_var v, theory_var w) {
if (v > w)
std::swap(v, w);
TRACE("seq", tout << "enforce ackerman " << v << " " << w << "\n";);
TRACE(seq, tout << "enforce ackerman " << v << " " << w << "\n";);
literal eq = mk_literal(m.mk_eq(get_expr(v), get_expr(w)));
ctx.mark_as_relevant(eq);
literal_vector lits;

View file

@ -109,7 +109,7 @@ namespace smt {
}
else {
ctx.internalize(rhs, false);
TRACE("datatype", tout << "adding axiom:\n" << pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n";);
TRACE(datatype, tout << "adding axiom:\n" << pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n";);
if (antecedent == null_literal) {
ctx.assign_eq(lhs, ctx.get_enode(rhs), eq_justification::mk_axiom());
}
@ -124,9 +124,9 @@ namespace smt {
SASSERT(ctx.get_assignment(antecedent) == l_true);
enode * _rhs = ctx.get_enode(rhs);
justification * js = ctx.mk_justification(dt_eq_justification(get_id(), ctx, antecedent, lhs, _rhs));
TRACE("datatype", tout << "assigning... #" << lhs->get_owner_id() << " #" << _rhs->get_owner_id() << "\n";
TRACE(datatype, tout << "assigning... #" << lhs->get_owner_id() << " #" << _rhs->get_owner_id() << "\n";
tout << "v" << lhs->get_th_var(get_id()) << " v" << _rhs->get_th_var(get_id()) << "\n";);
TRACE("datatype_detail", display(tout););
TRACE(datatype_detail, display(tout););
ctx.assign_eq(lhs, _rhs, eq_justification(js));
}
}
@ -138,7 +138,7 @@ namespace smt {
*/
void theory_datatype::assert_is_constructor_axiom(enode * n, func_decl * c, literal antecedent) {
app* e = n->get_expr();
TRACE("datatype_bug", tout << "creating axiom (= n (c (acc_1 n) ... (acc_m n))) for\n"
TRACE(datatype_bug, tout << "creating axiom (= n (c (acc_1 n) ... (acc_m n))) for\n"
<< mk_pp(c, m) << " " << mk_pp(e, m) << "\n";);
m_stats.m_assert_cnstr++;
SASSERT(m_util.is_constructor(c));
@ -201,7 +201,7 @@ namespace smt {
SASSERT(is_recognizer(r));
SASSERT(m_util.get_recognizer_constructor(r->get_decl()) == c->get_decl());
SASSERT(c->get_root() == r->get_arg(0)->get_root());
TRACE("recognizer_conflict",
TRACE(recognizer_conflict,
tout << mk_ismt2_pp(c->get_expr(), m) << "\n" << mk_ismt2_pp(r->get_expr(), m) << "\n";);
literal l(ctx.enode2bool_var(r));
SASSERT(ctx.get_assignment(l) == l_false);
@ -289,13 +289,13 @@ namespace smt {
}
bool theory_datatype::internalize_atom(app * atom, bool gate_ctx) {
TRACE("datatype", tout << "internalizing atom:\n" << mk_pp(atom, m) << "\n";);
TRACE(datatype, tout << "internalizing atom:\n" << mk_pp(atom, m) << "\n";);
return internalize_term(atom);
}
bool theory_datatype::internalize_term(app * term) {
force_push();
TRACE("datatype", tout << "internalizing term:\n" << mk_pp(term, m) << "\n";);
TRACE(datatype, tout << "internalizing term:\n" << mk_pp(term, m) << "\n";);
unsigned num_args = term->get_num_args();
for (unsigned i = 0; i < num_args; i++)
ctx.internalize(term->get_arg(i), m.is_bool(term) && has_quantifiers(term));
@ -382,8 +382,8 @@ namespace smt {
// (assert (> (len a) 1)
//
// If the theory variable is not created for 'a', then a wrong model will be generated.
TRACE("datatype", tout << "apply_sort_cnstr: #" << n->get_owner_id() << " " << pp(n, m) << "\n";);
TRACE("datatype_bug",
TRACE(datatype, tout << "apply_sort_cnstr: #" << n->get_owner_id() << " " << pp(n, m) << "\n";);
TRACE(datatype_bug,
tout << "apply_sort_cnstr:\n" << pp(n, m) << " ";
tout << m_util.is_datatype(s) << " ";
if (m_util.is_datatype(s)) tout << "is-infinite: " << s->is_infinite() << " ";
@ -416,7 +416,7 @@ namespace smt {
enode * n = ctx.bool_var2enode(v);
if (!is_recognizer(n))
return;
TRACE("datatype", tout << "assigning recognizer: #" << n->get_owner_id() << " is_true: " << is_true << "\n"
TRACE(datatype, tout << "assigning recognizer: #" << n->get_owner_id() << " is_true: " << is_true << "\n"
<< enode_pp(n, ctx) << "\n";);
SASSERT(n->get_num_args() == 1);
enode * arg = n->get_arg(0);
@ -446,7 +446,7 @@ namespace smt {
void theory_datatype::relevant_eh(app * n) {
force_push();
TRACE("datatype", tout << "relevant_eh: " << mk_pp(n, m) << "\n";);
TRACE(datatype, tout << "relevant_eh: " << mk_pp(n, m) << "\n";);
SASSERT(ctx.relevancy());
if (is_recognizer(n)) {
SASSERT(ctx.e_internalized(n));
@ -562,7 +562,7 @@ namespace smt {
// explain the cycle root -> ... -> app -> root
void theory_datatype::occurs_check_explain(enode * app, enode * root) {
TRACE("datatype", tout << "occurs_check_explain " << mk_bounded_pp(app->get_expr(), m) << " <-> " << mk_bounded_pp(root->get_expr(), m) << "\n";);
TRACE(datatype, tout << "occurs_check_explain " << mk_bounded_pp(app->get_expr(), m) << " <-> " << mk_bounded_pp(root->get_expr(), m) << "\n";);
// first: explain that root=v, given that app=cstor(...,v,...)
@ -581,7 +581,7 @@ namespace smt {
m_used_eqs.push_back(enode_pair(app, root));
}
TRACE("datatype",
TRACE(datatype,
tout << "occurs_check\n";
for (enode_pair const& p : m_used_eqs)
tout << enode_eq_pp(p, ctx);
@ -700,7 +700,7 @@ namespace smt {
a3 = cons(v3, a1)
*/
bool theory_datatype::occurs_check(enode * n) {
TRACE("datatype_verbose", tout << "occurs check: " << enode_pp(n, ctx) << "\n";);
TRACE(datatype_verbose, tout << "occurs check: " << enode_pp(n, ctx) << "\n";);
m_stats.m_occurs_check++;
bool res = false;
@ -715,7 +715,7 @@ namespace smt {
if (oc_cycle_free(app))
continue;
TRACE("datatype_verbose", tout << "occurs check loop: " << enode_pp(app, ctx) << (op==ENTER?" enter":" exit")<< "\n";);
TRACE(datatype_verbose, tout << "occurs check loop: " << enode_pp(app, ctx) << (op==ENTER?" enter":" exit")<< "\n";);
switch (op) {
case ENTER:
@ -839,7 +839,7 @@ namespace smt {
datatype_value_proc * result = alloc(datatype_value_proc, c_decl);
for (enode* arg : enode::args(d->m_constructor))
result->add_dependency(arg);
TRACE("datatype",
TRACE(datatype,
tout << pp(n, m) << "\n";
tout << "depends on\n";
for (enode* arg : enode::args(d->m_constructor))
@ -850,7 +850,7 @@ namespace smt {
void theory_datatype::merge_eh(theory_var v1, theory_var v2, theory_var, theory_var) {
// v1 is the new root
TRACE("datatype", tout << "merging v" << v1 << " v" << v2 << "\n";);
TRACE(datatype, tout << "merging v" << v1 << " v" << v2 << "\n";);
SASSERT(v1 == static_cast<int>(m_find.find(v1)));
var_data * d1 = m_var_data[v1];
var_data * d2 = m_var_data[v2];
@ -896,7 +896,7 @@ namespace smt {
unsigned c_idx = m_util.get_recognizer_constructor_idx(recognizer->get_decl());
if (d->m_recognizers[c_idx] == nullptr) {
lbool val = ctx.get_assignment(recognizer);
TRACE("datatype", tout << "adding recognizer to v" << v << " rec: #" << recognizer->get_owner_id() << " val: " << val << "\n";);
TRACE(datatype, tout << "adding recognizer to v" << v << " rec: #" << recognizer->get_owner_id() << " val: " << val << "\n";);
if (val == l_true) {
// do nothing...
// If recognizer assignment was already processed, then
@ -938,7 +938,7 @@ namespace smt {
SASSERT(w != null_theory_var);
add_recognizer(w, recognizer);
}
CTRACE("datatype", d->m_recognizers.empty(), ctx.display(tout););
CTRACE(datatype, d->m_recognizers.empty(), ctx.display(tout););
SASSERT(!d->m_recognizers.empty());
literal_vector lits;
enode_pair_vector eqs;
@ -964,11 +964,11 @@ namespace smt {
unassigned_idx = idx;
num_unassigned++;
}
TRACE("datatype", tout << "propagate " << num_unassigned << " eqs: " << eqs.size() << "\n";);
TRACE(datatype, tout << "propagate " << num_unassigned << " eqs: " << eqs.size() << "\n";);
if (num_unassigned == 0) {
// conflict
SASSERT(!lits.empty());
TRACE("datatype_conflict", tout << mk_ismt2_pp(recognizer->get_expr(), m) << "\n";
TRACE(datatype_conflict, tout << mk_ismt2_pp(recognizer->get_expr(), m) << "\n";
for (literal l : lits)
ctx.display_detailed_literal(tout, l) << "\n";
for (auto const& p : eqs)
@ -1019,7 +1019,7 @@ namespace smt {
func_decl * r = nullptr;
m_stats.m_splits++;
TRACE("datatype_bug", tout << "non_rec_c: " << non_rec_c->get_name() << " #rec: " << d->m_recognizers.size() << "\n";);
TRACE(datatype_bug, tout << "non_rec_c: " << non_rec_c->get_name() << " #rec: " << d->m_recognizers.size() << "\n";);
if (d->m_recognizers.empty()) {
r = m_util.get_constructor_is(non_rec_c);
@ -1063,7 +1063,7 @@ namespace smt {
}
SASSERT(r != nullptr);
app_ref r_app(m.mk_app(r, n->get_expr()), m);
TRACE("datatype", tout << "creating split: " << mk_pp(r_app, m) << "\n";);
TRACE(datatype, tout << "creating split: " << mk_pp(r_app, m) << "\n";);
ctx.internalize(r_app, false);
bool_var bv = ctx.get_bool_var(r_app);
ctx.set_true_first_flag(bv);

View file

@ -123,7 +123,7 @@ namespace smt {
template<typename Ext>
void theory_dense_diff_logic<Ext>::found_non_diff_logic_expr(expr * n) {
if (!m_non_diff_logic_exprs) {
TRACE("non_diff_logic", tout << "found non diff logic expression:\n" << mk_pp(n, m) << "\n";);
TRACE(non_diff_logic, tout << "found non diff logic expression:\n" << mk_pp(n, m) << "\n";);
ctx.push_trail(value_trail<bool>(m_non_diff_logic_exprs));
IF_VERBOSE(0, verbose_stream() << "(smt.diff_logic: non-diff logic expression " << mk_pp(n, m) << ")\n";);
m_non_diff_logic_exprs = true;
@ -136,7 +136,7 @@ namespace smt {
found_non_diff_logic_expr(n); // little hack... TODO: change to no_memory and return l_undef if SAT
return false;
}
TRACE("ddl", tout << "internalizing atom:\n" << mk_pp(n, m) << "\n";);
TRACE(ddl, tout << "internalizing atom:\n" << mk_pp(n, m) << "\n";);
SASSERT(!ctx.b_internalized(n));
SASSERT(m_autil.is_le(n) || m_autil.is_ge(n));
theory_var source, target;
@ -167,15 +167,15 @@ namespace smt {
s = mk_zero_for(t);
}
else {
TRACE("ddl", tout << "failed to internalize:\n" << mk_pp(n, m) << "\n";);
TRACE(ddl, tout << "failed to internalize:\n" << mk_pp(n, m) << "\n";);
found_non_diff_logic_expr(n);
return false;
}
TRACE("arith", tout << expr_ref(lhs, m) << " " << expr_ref(s, m) << " " << expr_ref(t, m) << "\n";);
TRACE(arith, tout << expr_ref(lhs, m) << " " << expr_ref(s, m) << " " << expr_ref(t, m) << "\n";);
source = internalize_term_core(s);
target = internalize_term_core(t);
if (source == null_theory_var || target == null_theory_var) {
TRACE("ddl", tout << "failed to internalize:\n" << mk_pp(n, m) << "\n";);
TRACE(ddl, tout << "failed to internalize:\n" << mk_pp(n, m) << "\n";);
found_non_diff_logic_expr(n);
return false;
}
@ -192,7 +192,7 @@ namespace smt {
m_bv2atoms.setx(bv, a, 0);
m_matrix[source][target].m_occs.push_back(a);
m_matrix[target][source].m_occs.push_back(a);
TRACE("ddl", tout << "succeeded internalizing:\n" << mk_pp(n, m) << "\n";);
TRACE(ddl, tout << "succeeded internalizing:\n" << mk_pp(n, m) << "\n";);
return true;
}
@ -212,9 +212,9 @@ namespace smt {
found_non_diff_logic_expr(term); // little hack... TODO: change to no_memory and return l_undef if SAT
return false;
}
TRACE("ddl", tout << "internalizing term: " << mk_pp(term, m) << "\n";);
TRACE(ddl, tout << "internalizing term: " << mk_pp(term, m) << "\n";);
theory_var v = internalize_term_core(term);
TRACE("ddl", tout << mk_pp(term, m) << "\ninternalization result: " << (v != null_theory_var) << "\n";);
TRACE(ddl, tout << mk_pp(term, m) << "\ninternalization result: " << (v != null_theory_var) << "\n";);
if (v == null_theory_var)
found_non_diff_logic_expr(term);
return v != null_theory_var;
@ -222,7 +222,7 @@ namespace smt {
template<typename Ext>
void theory_dense_diff_logic<Ext>::internalize_eq_eh(app * atom, bool_var v) {
TRACE("ddl", tout << "eq-eh: " << mk_pp(atom, m) << "\n";);
TRACE(ddl, tout << "eq-eh: " << mk_pp(atom, m) << "\n";);
if (memory::above_high_watermark())
return;
app * lhs = to_app(atom->get_arg(0));
@ -255,7 +255,7 @@ namespace smt {
template<typename Ext>
void theory_dense_diff_logic<Ext>::assign_eh(bool_var v, bool is_true) {
if (ctx.has_th_justification(v, get_id())) {
TRACE("ddl", tout << "ignoring atom propagated by the theory.\n";);
TRACE(ddl, tout << "ignoring atom propagated by the theory.\n";);
return;
}
atom * a = m_bv2atoms.get(v, 0);
@ -268,7 +268,7 @@ namespace smt {
theory_var s = a->get_source();
theory_var t = a->get_target();
numeral k = a->get_offset();
TRACE("assign_profile", tout << "#" << get_enode(s)->get_owner_id() << " #" << get_enode(t)->get_owner_id() << " " << k << "\n";);
TRACE(assign_profile, tout << "#" << get_enode(s)->get_owner_id() << " #" << get_enode(t)->get_owner_id() << " " << k << "\n";);
if (l.sign()) {
k.neg();
k -= get_epsilon(s);
@ -277,7 +277,7 @@ namespace smt {
else {
add_edge(s, t, k, l);
}
TRACE("ddl_detail", display(tout););
TRACE(ddl_detail, display(tout););
}
template<typename Ext>
@ -345,11 +345,11 @@ namespace smt {
while (it != begin) {
--it;
atom * a = *it;
TRACE("del_atoms", tout << "deleting: p" << a->get_bool_var() << "\n";);
TRACE(del_atoms, tout << "deleting: p" << a->get_bool_var() << "\n";);
m_bv2atoms[a->get_bool_var()] = 0;
theory_var s = a->get_source();
theory_var t = a->get_target();
TRACE("del_atoms", tout << "m_matrix.size() " << m_matrix.size() <<
TRACE(del_atoms, tout << "m_matrix.size() " << m_matrix.size() <<
", m_matrix[s].size() " << m_matrix[s].size() <<
", m_matrix[t].size(): " << m_matrix[t].size() <<
", t: " << t << ", s: " << s << "\n";);
@ -435,8 +435,8 @@ namespace smt {
*/
template<typename Ext>
void theory_dense_diff_logic<Ext>::get_antecedents(theory_var source, theory_var target, literal_vector & result) {
TRACE("ddl", tout << "get_antecedents, source: #" << get_enode(source)->get_owner_id() << ", target: #" << get_enode(target)->get_owner_id() << "\n";);
CTRACE("ddl", !is_connected(source, target), display(tout););
TRACE(ddl, tout << "get_antecedents, source: #" << get_enode(source)->get_owner_id() << ", target: #" << get_enode(target)->get_owner_id() << "\n";);
CTRACE(ddl, !is_connected(source, target), display(tout););
SASSERT(is_connected(source, target));
svector<var_pair> & todo = m_tmp_pairs;
todo.reset();
@ -488,7 +488,7 @@ namespace smt {
new_dist = k;
new_dist += it->m_distance;
cell & s_x = m_matrix[s][x];
TRACE("ddl",
TRACE(ddl,
tout << "s: #" << get_enode(s)->get_owner_id() << " x: #" << get_enode(x)->get_owner_id() << " new_dist: " << new_dist << "\n";
tout << "already has edge: " << s_x.m_edge_id << " old dist: " << s_x.m_distance << "\n";);
if (s_x.m_edge_id == null_edge_id || new_dist < s_x.m_distance) {
@ -557,7 +557,7 @@ namespace smt {
SASSERT(a->get_target() == target);
if (c.m_distance <= a->get_offset()) {
m_stats.m_num_propagations++;
TRACE("ddl", tout << "asserting atom to true: "; display_atom(tout, a);
TRACE(ddl, tout << "asserting atom to true: "; display_atom(tout, a);
tout << "distance(#" << get_enode(source)->get_owner_id() << ", #" << get_enode(target)->get_owner_id()
<< "): " << c.m_distance << "\n";);
assign_literal(literal(a->get_bool_var(), false), source, target);
@ -568,7 +568,7 @@ namespace smt {
SASSERT(a->get_target() == source);
if (neg_dist > a->get_offset()) {
m_stats.m_num_propagations++;
TRACE("ddl", tout << "asserting atom to true: "; display_atom(tout, a);
TRACE(ddl, tout << "asserting atom to true: "; display_atom(tout, a);
tout << "distance(#" << get_enode(source)->get_owner_id() << ", #" << get_enode(target)->get_owner_id()
<< "): " << c.m_distance << "\n";);
assign_literal(literal(a->get_bool_var(), true), source, target);
@ -580,11 +580,11 @@ namespace smt {
template<typename Ext>
inline void theory_dense_diff_logic<Ext>::add_edge(theory_var source, theory_var target, numeral const & offset, literal l) {
TRACE("ddl", tout << "trying adding edge: #" << get_enode(source)->get_owner_id() << " -- " << offset << " --> #" << get_enode(target)->get_owner_id() << "\n";);
TRACE(ddl, tout << "trying adding edge: #" << get_enode(source)->get_owner_id() << " -- " << offset << " --> #" << get_enode(target)->get_owner_id() << "\n";);
cell & c_inv = m_matrix[target][source];
if (c_inv.m_edge_id != null_edge_id && - c_inv.m_distance > offset) {
// conflict detected.
TRACE("ddl", tout << "conflict detected: #" << get_enode(source)->get_owner_id() << " #" << get_enode(target)->get_owner_id() <<
TRACE(ddl, tout << "conflict detected: #" << get_enode(source)->get_owner_id() << " #" << get_enode(target)->get_owner_id() <<
" offset: " << offset << ", c_inv.m_edge_id: " << c_inv.m_edge_id << ", c_inv.m_distance: " << c_inv.m_distance << "\n";);
literal_vector & antecedents = m_tmp_literals;
antecedents.reset();
@ -598,7 +598,7 @@ namespace smt {
cell & c = m_matrix[source][target];
if (c.m_edge_id == null_edge_id || offset < c.m_distance) {
TRACE("ddl", tout << "adding edge: #" << get_enode(source)->get_owner_id() << " -- " << offset << " --> #" << get_enode(target)->get_owner_id() << "\n";);
TRACE(ddl, tout << "adding edge: #" << get_enode(source)->get_owner_id() << " -- " << offset << " --> #" << get_enode(target)->get_owner_id() << "\n";);
m_edges.push_back(edge(source, target, offset, l));
update_cells();
}
@ -636,7 +636,7 @@ namespace smt {
k += e.m_offset;
k += get_distance(t, j);
if (c.m_distance != k) {
CTRACE("ddl", c.m_distance != k, tout << "i: " << i << " j: " << j << " k: " << k << " c.m_distance: " << c.m_distance << "\n";
CTRACE(ddl, c.m_distance != k, tout << "i: " << i << " j: " << j << " k: " << k << " c.m_distance: " << c.m_distance << "\n";
display(tout););
SASSERT(c.m_distance == k);
}
@ -718,7 +718,7 @@ namespace smt {
}
for (int i = 0; i < num_vars; i++)
m_assignment[i].neg();
TRACE("ddl_model",
TRACE(ddl_model,
tout << "ddl model\n";
for (theory_var v = 0; v < num_vars; v++) {
tout << "#" << mk_pp(get_enode(v)->get_expr(), m) << " = " << m_assignment[v] << "\n";
@ -762,7 +762,7 @@ namespace smt {
template<typename Ext>
void theory_dense_diff_logic<Ext>::compute_epsilon() {
m_epsilon = rational(1, 2);
TRACE("ddl", display(tout););
TRACE(ddl, display(tout););
typename edges::const_iterator it = m_edges.begin();
typename edges::const_iterator end = m_edges.end();
// first edge is null
@ -777,7 +777,7 @@ namespace smt {
rational k_y = m_assignment[e.m_source].get_infinitesimal().to_rational();
rational n_c = e.m_offset.get_rational().to_rational();
rational k_c = e.m_offset.get_infinitesimal().to_rational();
TRACE("ddl",
TRACE(ddl,
tout << e.m_source << " - " << e.m_target << " <= " << e.m_offset << "\n";
tout << "(n_x,k_x): " << n_x << ", " << k_x <<
", (n_y,k_y): " << n_y << ", " << k_y <<
@ -785,7 +785,7 @@ namespace smt {
if (n_x < n_y + n_c && k_x > k_y + k_c) {
rational new_epsilon = (n_y + n_c - n_x) / (2*(k_x - k_y - k_c));
if (new_epsilon < m_epsilon) {
TRACE("ddl", tout << "new epsilon: " << new_epsilon << "\n";);
TRACE(ddl, tout << "new epsilon: " << new_epsilon << "\n";);
m_epsilon = new_epsilon;
}
}
@ -810,7 +810,7 @@ namespace smt {
SASSERT(m_assignment[v].is_zero());
}
}
TRACE("ddl_model",
TRACE(ddl_model,
tout << "ddl model\n";
for (theory_var v = 0; v < num_vars; v++) {
tout << "#" << mk_pp(get_enode(v)->get_expr(), m) << " = " << m_assignment[v] << "\n";
@ -981,7 +981,7 @@ namespace smt {
vars.push_back(w);
Simplex::row row = S.add_row(w, vars.size(), vars.data(), coeffs.data());
TRACE("opt", S.display(tout); display(tout););
TRACE(opt, S.display(tout); display(tout););
// optimize
lbool is_sat = S.make_feasible();
@ -989,7 +989,7 @@ namespace smt {
blocker = m.mk_false();
return inf_eps::infinity();
}
TRACE("opt", S.display(tout); );
TRACE(opt, S.display(tout); );
SASSERT(is_sat != l_false);
lbool is_fin = S.minimize(w);
@ -999,7 +999,7 @@ namespace smt {
case l_true: {
simplex::mpq_ext::eps_numeral const& val = S.get_value(w);
inf_rational r(-rational(val.first), -rational(val.second));
TRACE("opt", tout << r << " " << "\n";
TRACE(opt, tout << r << " " << "\n";
S.display_row(tout, row, true););
Simplex::row_iterator it = S.row_begin(row), end = S.row_end(row);
expr_ref_vector& core = m_objective_assignments[v];
@ -1015,7 +1015,7 @@ namespace smt {
core.push_back(tmp);
}
}
TRACE("opt", tout << core << "\n";);
TRACE(opt, tout << core << "\n";);
}
for (unsigned i = 0; i < num_nodes; ++i) {
mpq_inf const& val = S.get_value(i);
@ -1031,7 +1031,7 @@ namespace smt {
return inf_eps(rational(0), r);
}
default:
TRACE("opt", tout << "unbounded\n"; );
TRACE(opt, tout << "unbounded\n"; );
blocker = m.mk_false();
return inf_eps::infinity();
}
@ -1039,7 +1039,7 @@ namespace smt {
template<typename Ext>
theory_var theory_dense_diff_logic<Ext>::add_objective(app* term) {
TRACE("opt", tout << mk_pp(term, m) << "\n";);
TRACE(opt, tout << mk_pp(term, m) << "\n";);
objective_term objective;
theory_var result = m_objectives.size();
rational q(1), r(0);
@ -1073,7 +1073,7 @@ namespace smt {
expr_ref theory_dense_diff_logic<Ext>::mk_ineq(theory_var v, inf_eps const& val, bool is_strict) {
objective_term const& t = m_objectives[v];
expr_ref e(m), f(m), f2(m);
TRACE("opt", tout << "mk_ineq " << v << " " << val << "\n";);
TRACE(opt, tout << "mk_ineq " << v << " " << val << "\n";);
if (t.size() == 1 && t[0].second.is_one()) {
f = get_enode(t[0].first)->get_expr();
}
@ -1097,7 +1097,7 @@ namespace smt {
if (is_strict) {
f = m.mk_not(f);
}
TRACE("arith", tout << "block: " << f << "\n";);
TRACE(arith, tout << "block: " << f << "\n";);
return f;
}

View file

@ -90,9 +90,9 @@ bool theory_diff_logic<Ext>::internalize_term(app * term) {
if (!m_consistent)
return false;
bool result = null_theory_var != mk_term(term);
CTRACE("arith", !result, tout << "Did not internalize " << mk_pp(term, m) << "\n";);
CTRACE(arith, !result, tout << "Did not internalize " << mk_pp(term, m) << "\n";);
if (!result) {
TRACE("non_diff_logic", tout << "Terms may not be internalized\n";);
TRACE(non_diff_logic, tout << "Terms may not be internalized\n";);
found_non_diff_logic_expr(term);
}
return result;
@ -169,7 +169,7 @@ public:
template<typename Ext>
void theory_diff_logic<Ext>::found_non_diff_logic_expr(expr * n) {
if (!m_non_diff_logic_exprs) {
TRACE("non_diff_logic", tout << "found non diff logic expression:\n" << mk_pp(n, m) << "\n";);
TRACE(non_diff_logic, tout << "found non diff logic expression:\n" << mk_pp(n, m) << "\n";);
IF_VERBOSE(0, verbose_stream() << "(smt.diff_logic: non-diff logic expression " << mk_pp(n, m) << ")\n";);
ctx.push_trail(value_trail<bool>(m_non_diff_logic_exprs));
m_non_diff_logic_exprs = true;
@ -277,7 +277,7 @@ bool theory_diff_logic<Ext>::internalize_atom(app * n, bool gate_ctx) {
m_atoms.push_back(a);
m_bool_var2atom.insert(bv, a);
TRACE("arith",
TRACE(arith,
tout << mk_pp(n, m) << "\n";
m_graph.display_edge(tout << "pos: ", pos);
m_graph.display_edge(tout << "neg: ", neg);
@ -288,7 +288,7 @@ bool theory_diff_logic<Ext>::internalize_atom(app * n, bool gate_ctx) {
template<typename Ext>
void theory_diff_logic<Ext>::internalize_eq_eh(app * atom, bool_var v) {
TRACE("arith", tout << mk_pp(atom, m) << "\n";);
TRACE(arith, tout << mk_pp(atom, m) << "\n";);
app * lhs = to_app(atom->get_arg(0));
app * rhs = to_app(atom->get_arg(1));
app * s;
@ -335,7 +335,7 @@ void theory_diff_logic<Ext>::collect_statistics(::statistics & st) const {
template<typename Ext>
void theory_diff_logic<Ext>::push_scope_eh() {
TRACE("arith", tout << "push\n";);
TRACE(arith, tout << "push\n";);
theory::push_scope_eh();
m_graph.push();
m_scopes.push_back(scope());
@ -347,7 +347,7 @@ void theory_diff_logic<Ext>::push_scope_eh() {
template<typename Ext>
void theory_diff_logic<Ext>::pop_scope_eh(unsigned num_scopes) {
TRACE("arith", tout << "pop " << num_scopes << "\n";);
TRACE(arith, tout << "pop " << num_scopes << "\n";);
unsigned lvl = m_scopes.size();
SASSERT(num_scopes <= lvl);
unsigned new_lvl = lvl - num_scopes;
@ -358,7 +358,7 @@ void theory_diff_logic<Ext>::pop_scope_eh(unsigned num_scopes) {
m_scopes.shrink(new_lvl);
unsigned num_edges = m_graph.get_num_edges();
m_graph.pop(num_scopes);
CTRACE("arith", !m_graph.is_feasible_dbg(), m_graph.display(tout););
CTRACE(arith, !m_graph.is_feasible_dbg(), m_graph.display(tout););
if (num_edges != m_graph.get_num_edges() && m_num_simplex_edges > 0) {
m_S.reset();
m_num_simplex_edges = 0;
@ -375,7 +375,7 @@ final_check_status theory_diff_logic<Ext>::final_check_eh() {
return FC_CONTINUE;
}
TRACE("arith_final", display(tout); );
TRACE(arith_final, display(tout); );
if (!is_consistent())
return FC_CONTINUE;
SASSERT(is_consistent());
@ -388,7 +388,7 @@ final_check_status theory_diff_logic<Ext>::final_check_eh() {
if (fid != get_family_id() &&
fid != m.get_basic_family_id() &&
!is_uninterp_const(n->get_expr())) {
TRACE("arith", tout << mk_pp(n->get_expr(), m) << "\n";);
TRACE(arith, tout << mk_pp(n->get_expr(), m) << "\n";);
return FC_GIVEUP;
}
}
@ -518,11 +518,11 @@ void theory_diff_logic<Ext>::propagate() {
if (m_num_propagation_calls * (m_stats.m_num_conflicts + 1) >
m_params.m_arith_adaptive_propagation_threshold * ctx.m_stats.m_num_conflicts) {
m_num_propagation_calls = 1;
TRACE("arith_prop", tout << "propagating: " << m_num_propagation_calls << "\n";);
TRACE(arith_prop, tout << "propagating: " << m_num_propagation_calls << "\n";);
propagate_core();
}
else {
TRACE("arith_prop", tout << "skipping propagation " << m_num_propagation_calls << "\n";);
TRACE(arith_prop, tout << "skipping propagation " << m_num_propagation_calls << "\n";);
}
break;
}
@ -536,7 +536,7 @@ void theory_diff_logic<Ext>::propagate() {
}
++m_num_propagation_calls;
bool do_propagate = (m_num_propagation_calls * m_agility > m_params.m_arith_adaptive_propagation_threshold);
TRACE("arith_prop", tout << (do_propagate?"propagating: ":"skipping ")
TRACE(arith_prop, tout << (do_propagate?"propagating: ":"skipping ")
<< " " << m_num_propagation_calls
<< " agility: " << m_agility << "\n";);
if (do_propagate) {
@ -578,13 +578,13 @@ void theory_diff_logic<Ext>::propagate_core() {
template<typename Ext>
bool theory_diff_logic<Ext>::propagate_atom(atom* a) {
TRACE("arith", a->display(*this, tout); tout << "\n";);
TRACE(arith, a->display(*this, tout); tout << "\n";);
if (ctx.inconsistent()) {
return false;
}
int edge_id = a->get_asserted_edge();
if (!m_graph.enable_edge(edge_id)) {
TRACE("arith", display(tout););
TRACE(arith, display(tout););
set_neg_cycle_conflict();
return false;
@ -599,7 +599,7 @@ void theory_diff_logic<Ext>::new_edge(dl_var src, dl_var dst, unsigned num_edges
return;
}
TRACE("dl_activity", tout << "\n";);
TRACE(dl_activity, tout << "\n";);
numeral w(0);
for (unsigned i = 0; i < num_edges; ++i) {
@ -648,7 +648,7 @@ void theory_diff_logic<Ext>::new_edge(dl_var src, dl_var dst, unsigned num_edges
}
lits.push_back(lit);
TRACE("dl_activity",
TRACE(dl_activity,
tout << mk_pp(le, m) << "\n";
tout << "edge: " << a->get_pos() << "\n";
ctx.display_literals_verbose(tout, lits.size(), lits.data());
@ -667,7 +667,7 @@ void theory_diff_logic<Ext>::new_edge(dl_var src, dl_var dst, unsigned num_edges
ctx.mk_clause(lits.size(), lits.data(), js, CLS_TH_LEMMA, nullptr);
#if 0
TRACE("arith",
TRACE(arith,
tout << "shortcut:\n";
for (unsigned i = 0; i < num_edges; ++i) {
edge_id e = edges[i];
@ -698,7 +698,7 @@ void theory_diff_logic<Ext>::set_neg_cycle_conflict() {
m_graph.traverse_neg_cycle2(m_params.m_arith_stronger_lemmas, m_nc_functor);
inc_conflicts();
literal_vector const& lits = m_nc_functor.get_lits();
TRACE("arith_conflict",
TRACE(arith_conflict,
tout << "conflict: ";
for (literal lit : lits) ctx.display_literal_info(tout, lit);
tout << "\n";);
@ -746,7 +746,7 @@ theory_var theory_diff_logic<Ext>::mk_term(app* n) {
theory_var source, target;
enode* e;
TRACE("arith", tout << mk_pp(n, m) << "\n";);
TRACE(arith, tout << mk_pp(n, m) << "\n";);
rational r;
if (m_util.is_numeral(n, r)) {
@ -809,7 +809,7 @@ theory_var theory_diff_logic<Ext>::mk_num(app* n, rational const& r) {
template<typename Ext>
theory_var theory_diff_logic<Ext>::mk_var(enode* n) {
theory_var v = theory::mk_var(n);
TRACE("diff_logic_vars", tout << "mk_var: " << v << "\n";);
TRACE(diff_logic_vars, tout << "mk_var: " << v << "\n";);
m_graph.init_var(v);
ctx.attach_th_var(n, this, v);
set_sort(n->get_expr());
@ -849,10 +849,10 @@ theory_var theory_diff_logic<Ext>::mk_var(app* n) {
v = mk_var(e);
}
if (is_interpreted(n)) {
TRACE("non_diff_logic", tout << "Variable should not be interpreted\n";);
TRACE(non_diff_logic, tout << "Variable should not be interpreted\n";);
found_non_diff_logic_expr(n);
}
TRACE("arith", tout << mk_pp(n, m) << " |-> " << v << "\n";);
TRACE(arith, tout << mk_pp(n, m) << " |-> " << v << "\n";);
return v;
}
@ -902,12 +902,12 @@ void theory_diff_logic<Ext>::compute_delta() {
rational k_y = m_graph.get_assignment(src).get_infinitesimal().to_rational();
rational n_c = w.get_rational().to_rational();
rational k_c = w.get_infinitesimal().to_rational();
TRACE("arith", tout << "(n_x,k_x): " << n_x << ", " << k_x << ", (n_y,k_y): "
TRACE(arith, tout << "(n_x,k_x): " << n_x << ", " << k_x << ", (n_y,k_y): "
<< n_y << ", " << k_y << ", (n_c,k_c): " << n_c << ", " << k_c << "\n";);
if (n_x < n_y + n_c && k_x > k_y + k_c) {
rational new_delta = (n_y + n_c - n_x) / (2*(k_x - k_y - k_c));
if (new_delta < m_delta) {
TRACE("arith", tout << "new delta: " << new_delta << "\n";);
TRACE(arith, tout << "new delta: " << new_delta << "\n";);
m_delta = new_delta;
}
}
@ -933,7 +933,7 @@ model_value_proc * theory_diff_logic<Ext>::mk_value(enode * n, model_generator &
numeral val = m_graph.get_assignment(v);
num = val.get_rational().to_rational() + m_delta * val.get_infinitesimal().to_rational();
}
TRACE("arith", tout << mk_pp(n->get_expr(), m) << " |-> " << num << "\n";);
TRACE(arith, tout << mk_pp(n->get_expr(), m) << " |-> " << num << "\n";);
bool is_int = m_util.is_int(n->get_expr());
if (is_int && !num.is_int())
throw default_exception("difference logic solver was used on mixed int/real problem");
@ -1036,7 +1036,7 @@ void theory_diff_logic<Ext>::new_eq_or_diseq(bool is_eq, theory_var v1, theory_v
log_axiom_instantiation(body);
}
TRACE("diff_logic",
TRACE(diff_logic,
tout << v1 << " .. " << v2 << "\n";
tout << mk_pp(eq.get(), m) <<"\n";);
@ -1233,12 +1233,12 @@ theory_diff_logic<Ext>::maximize(theory_var v, expr_ref& blocker, bool& has_shar
has_shared = false;
Simplex& S = m_S;
CTRACE("arith",!m_graph.is_feasible_dbg(), m_graph.display(tout););
CTRACE(arith,!m_graph.is_feasible_dbg(), m_graph.display(tout););
SASSERT(m_graph.is_feasible_dbg());
update_simplex(S);
TRACE("arith",
TRACE(arith,
objective_term const& objective = m_objectives[v];
for (auto const& o : objective) {
tout << "Coefficient " << o.second
@ -1247,7 +1247,7 @@ theory_diff_logic<Ext>::maximize(theory_var v, expr_ref& blocker, bool& has_shar
tout << "Free coefficient " << m_objective_consts[v] << "\n";
);
TRACE("opt",
TRACE(opt,
S.display(tout);
for (unsigned i = 0; i < m_graph.get_num_nodes(); ++i)
tout << "$" << i << ": " << node2simplex(i) << "\n";
@ -1260,7 +1260,7 @@ theory_diff_logic<Ext>::maximize(theory_var v, expr_ref& blocker, bool& has_shar
blocker = m.mk_false();
return inf_eps::infinity();
}
TRACE("opt", S.display(tout); );
TRACE(opt, S.display(tout); );
SASSERT(is_sat != l_false);
unsigned w = obj2simplex(v);
lbool is_fin = S.minimize(w);
@ -1285,7 +1285,7 @@ theory_diff_logic<Ext>::maximize(theory_var v, expr_ref& blocker, bool& has_shar
}
}
ensure_rational_solution(S);
TRACE("opt", tout << r << " " << "\n";
TRACE(opt, tout << r << " " << "\n";
S.display_row(tout, row, true);
S.display(tout);
);
@ -1297,14 +1297,14 @@ theory_diff_logic<Ext>::maximize(theory_var v, expr_ref& blocker, bool& has_shar
rational r = rational(val.first);
m_graph.set_assignment(i, numeral(r));
}
CTRACE("arith",!m_graph.is_feasible_dbg(), m_graph.display(tout););
CTRACE(arith,!m_graph.is_feasible_dbg(), m_graph.display(tout););
SASSERT(m_graph.is_feasible_dbg());
inf_eps r1(rational(0), r);
blocker = mk_gt(v, r1);
return inf_eps(rational(0), r + m_objective_consts[v]);
}
default:
TRACE("opt", tout << "unbounded\n"; );
TRACE(opt, tout << "unbounded\n"; );
blocker = m.mk_false();
return inf_eps::infinity();
}
@ -1445,7 +1445,7 @@ theory* theory_diff_logic<Ext>::mk_fresh(context* new_ctx) {
template<typename Ext>
void theory_diff_logic<Ext>::init_zero() {
if (m_izero != null_theory_var) return;
TRACE("arith", tout << "init zero\n";);
TRACE(arith, tout << "init zero\n";);
app* zero;
enode* e;
zero = m_util.mk_numeral(rational(0), true);

View file

@ -96,7 +96,7 @@ namespace smt {
else {
result = m_th.u().mk_numeral(0, s);
}
TRACE("theory_dl", tout << mk_pp(result, m_th.m()) << "\n";);
TRACE(theory_dl, tout << mk_pp(result, m_th.m()) << "\n";);
return result;
}
};
@ -114,7 +114,7 @@ namespace smt {
char const * get_name() const override { return "datalog"; }
bool internalize_atom(app * atom, bool gate_ctx) override {
TRACE("theory_dl", tout << mk_pp(atom, m()) << "\n";);
TRACE(theory_dl, tout << mk_pp(atom, m()) << "\n";);
if (ctx.b_internalized(atom)) {
return true;
}
@ -136,7 +136,7 @@ namespace smt {
}
bool internalize_term(app * term) override {
TRACE("theory_dl", tout << mk_pp(term, m()) << "\n";);
TRACE(theory_dl, tout << mk_pp(term, m()) << "\n";);
if (u().is_finite_sort(term)) {
return mk_rep(term);
}
@ -229,7 +229,7 @@ namespace smt {
if (is_attached_to_var(e)) {
return false;
}
TRACE("theory_dl", tout << mk_pp(n, m()) << "\n";);
TRACE(theory_dl, tout << mk_pp(n, m()) << "\n";);
theory_var var = mk_var(e);
ctx.attach_th_var(e, this, var);
return true;
@ -272,7 +272,7 @@ namespace smt {
}
void assert_cnstr(expr* e) {
TRACE("theory_dl", tout << mk_pp(e, m()) << "\n";);
TRACE(theory_dl, tout << mk_pp(e, m()) << "\n";);
if (m().has_trace_stream()) log_axiom_instantiation(e);
ctx.internalize(e, false);
if (m().has_trace_stream()) m().trace_stream() << "[end-of-instance]\n";

View file

@ -61,7 +61,7 @@ namespace smt {
}
app * theory_fpa::fpa_value_proc::mk_value(model_generator & mg, expr_ref_vector const & values) {
TRACE("t_fpa_detail",
TRACE(t_fpa_detail,
ast_manager & m = m_th.get_manager();
for (unsigned i = 0; i < values.size(); i++)
tout << "value[" << i << "] = " << mk_ismt2_pp(values[i], m) << std::endl;);
@ -126,7 +126,7 @@ namespace smt {
mpfm.set(f, m_ebits, m_sbits, mpzm.is_one(sgn_z), mpzm.get_int64(exp_u), sig_z);
result = m_fu.mk_value(f);
TRACE("t_fpa", tout << "result: [" <<
TRACE(t_fpa, tout << "result: [" <<
mpzm.to_string(sgn_z) << "," <<
mpzm.to_string(exp_z) << "," <<
mpzm.to_string(sig_z) << "] --> " <<
@ -138,7 +138,7 @@ namespace smt {
app * theory_fpa::fpa_rm_value_proc::mk_value(model_generator & mg, expr_ref_vector const & values) {
SASSERT(values.size() == 1);
TRACE("t_fpa_detail",
TRACE(t_fpa_detail,
ast_manager & m = m_th.get_manager();
for (unsigned i = 0; i < values.size(); i++)
tout << "value[" << i << "] = " << mk_ismt2_pp(values[i], m) << std::endl;);
@ -160,7 +160,7 @@ namespace smt {
default: result = m_fu.mk_round_toward_zero();
}
TRACE("t_fpa", tout << "result: " << mk_ismt2_pp(result, m_th.get_manager()) << std::endl;);
TRACE(t_fpa, tout << "result: " << mk_ismt2_pp(result, m_th.get_manager()) << std::endl;);
return result;
}
@ -170,18 +170,18 @@ namespace smt {
{
expr_ref res(m);
expr * ccnv;
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 (m_conversions.find(e, ccnv)) {
res = ccnv;
TRACE("t_fpa_detail", tout << "cached:" << std::endl;
TRACE(t_fpa_detail, tout << "cached:" << std::endl;
tout << mk_ismt2_pp(e, m) << std::endl << " -> " << std::endl <<
mk_ismt2_pp(res, m) << std::endl;);
}
else {
res = m_rw.convert(m_th_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 <<
mk_ismt2_pp(res, m) << std::endl;);
@ -210,14 +210,14 @@ namespace smt {
m_th_rw(res);
CTRACE("t_fpa", !m.is_true(res), tout << "side condition: " << mk_ismt2_pp(res, m) << std::endl;);
CTRACE(t_fpa, !m.is_true(res), tout << "side condition: " << mk_ismt2_pp(res, m) << std::endl;);
return res;
}
void theory_fpa::assert_cnstr(expr * e) {
expr_ref _e(e, m);
if (m.is_true(e)) return;
TRACE("t_fpa_detail", tout << "asserting " << mk_ismt2_pp(e, m) << "\n";);
TRACE(t_fpa_detail, tout << "asserting " << mk_ismt2_pp(e, m) << "\n";);
if (m.has_trace_stream()) log_axiom_instantiation(e);
ctx.internalize(e, false);
if (m.has_trace_stream()) m.trace_stream() << "[end-of-instance]\n";
@ -229,11 +229,11 @@ namespace smt {
void theory_fpa::attach_new_th_var(enode * n) {
theory_var v = mk_var(n);
ctx.attach_th_var(n, this, v);
TRACE("t_fpa", tout << "new theory var: " << mk_ismt2_pp(n->get_expr(), m) << " := " << v << "\n";);
TRACE(t_fpa, tout << "new theory var: " << mk_ismt2_pp(n->get_expr(), m) << " := " << v << "\n";);
}
bool theory_fpa::internalize_atom(app * atom, bool gate_ctx) {
TRACE("t_fpa_internalize", tout << "internalizing atom: " << mk_ismt2_pp(atom, m) << std::endl;);
TRACE(t_fpa_internalize, tout << "internalizing atom: " << mk_ismt2_pp(atom, m) << std::endl;);
SASSERT(atom->get_family_id() == get_family_id());
if (ctx.b_internalized(atom))
@ -254,7 +254,7 @@ namespace smt {
}
bool theory_fpa::internalize_term(app * term) {
TRACE("t_fpa_internalize", tout << "internalizing term: " << mk_ismt2_pp(term, m) << "\n";);
TRACE(t_fpa_internalize, tout << "internalizing term: " << mk_ismt2_pp(term, m) << "\n";);
SASSERT(term->get_family_id() == get_family_id());
SASSERT(!ctx.e_internalized(term));
@ -294,7 +294,7 @@ namespace smt {
}
void theory_fpa::apply_sort_cnstr(enode * n, sort * s) {
TRACE("t_fpa", tout << "apply sort cnstr for: " << mk_ismt2_pp(n->get_expr(), m) << "\n";);
TRACE(t_fpa, tout << "apply sort cnstr for: " << mk_ismt2_pp(n->get_expr(), m) << "\n";);
SASSERT(s->get_family_id() == get_family_id());
SASSERT(m_fpa_util.is_float(s) || m_fpa_util.is_rm(s));
SASSERT(m_fpa_util.is_float(n->get_expr()) || m_fpa_util.is_rm(n->get_expr()));
@ -325,7 +325,7 @@ namespace smt {
enode * e_x = get_enode(x);
enode * e_y = get_enode(y);
TRACE("t_fpa", tout << "new eq: " << x << " = " << y << std::endl;
TRACE(t_fpa, tout << "new eq: " << x << " = " << y << std::endl;
tout << mk_ismt2_pp(e_x->get_expr(), m) << std::endl << " = " << std::endl <<
mk_ismt2_pp(e_y->get_expr(), m) << std::endl;);
@ -340,7 +340,7 @@ namespace smt {
expr_ref xc = convert(xe);
expr_ref yc = convert(ye);
TRACE("t_fpa_detail", tout << "xc = " << mk_ismt2_pp(xc, m) << std::endl <<
TRACE(t_fpa_detail, tout << "xc = " << mk_ismt2_pp(xc, m) << std::endl <<
"yc = " << mk_ismt2_pp(yc, m) << std::endl;);
expr_ref c(m);
@ -364,7 +364,7 @@ namespace smt {
enode * e_x = get_enode(x);
enode * e_y = get_enode(y);
TRACE("t_fpa", tout << "new diseq: " << x << " != " << y << std::endl;
TRACE(t_fpa, tout << "new diseq: " << x << " != " << y << std::endl;
tout << mk_ismt2_pp(e_x->get_expr(), m) << std::endl << " != " << std::endl <<
mk_ismt2_pp(e_y->get_expr(), m) << std::endl;);
@ -413,14 +413,14 @@ namespace smt {
void theory_fpa::pop_scope_eh(unsigned num_scopes) {
m_trail_stack.pop_scope(num_scopes);
TRACE("t_fpa", tout << "pop " << num_scopes << "; now " << m_trail_stack.get_num_scopes() << "\n";);
TRACE(t_fpa, tout << "pop " << num_scopes << "; now " << m_trail_stack.get_num_scopes() << "\n";);
theory::pop_scope_eh(num_scopes);
}
void theory_fpa::assign_eh(bool_var v, bool is_true) {
expr * e = ctx.bool_var2expr(v);
TRACE("t_fpa", tout << "assign_eh for: " << v << " (" << is_true << "):\n" << mk_ismt2_pp(e, m) << "\n";);
TRACE(t_fpa, tout << "assign_eh for: " << v << " (" << is_true << "):\n" << mk_ismt2_pp(e, m) << "\n";);
expr_ref converted = convert(e);
converted = m.mk_and(converted, mk_side_conditions());
@ -432,7 +432,7 @@ namespace smt {
}
void theory_fpa::relevant_eh(app * n) {
TRACE("t_fpa", tout << "relevant_eh for: " << mk_ismt2_pp(n, m) << "\n";);
TRACE(t_fpa, tout << "relevant_eh for: " << mk_ismt2_pp(n, m) << "\n";);
mpf_manager & mpfm = m_fpa_util.fm();
@ -465,7 +465,7 @@ namespace smt {
else {
expr_ref wu(m);
wu = m.mk_eq(m_converter.unwrap(wrapped, n->get_sort()), n);
TRACE("t_fpa", tout << "w/u eq: " << std::endl << mk_ismt2_pp(wu, m) << std::endl;);
TRACE(t_fpa, tout << "w/u eq: " << std::endl << mk_ismt2_pp(wu, m) << std::endl;);
assert_cnstr(wu);
}
}
@ -486,7 +486,7 @@ namespace smt {
}
void theory_fpa::reset_eh() {
TRACE("t_fpa", tout << "reset_eh\n";);
TRACE(t_fpa, tout << "reset_eh\n";);
pop_scope_eh(m_trail_stack.get_num_scopes());
m_converter.reset();
m_rw.reset();
@ -502,13 +502,13 @@ namespace smt {
}
final_check_status theory_fpa::final_check_eh() {
TRACE("t_fpa", tout << "final_check_eh\n";);
TRACE(t_fpa, tout << "final_check_eh\n";);
SASSERT(m_converter.m_extra_assertions.empty());
return FC_DONE;
}
void theory_fpa::init_model(model_generator & mg) {
TRACE("t_fpa", tout << "initializing model" << std::endl; display(tout););
TRACE(t_fpa, tout << "initializing model" << std::endl; display(tout););
m_factory = alloc(fpa_value_factory, m, get_family_id());
mg.register_factory(m_factory);
}
@ -537,7 +537,7 @@ namespace smt {
}
model_value_proc * theory_fpa::mk_value(enode * n, model_generator & mg) {
TRACE("t_fpa", tout << "mk_value for: " << mk_ismt2_pp(n->get_expr(), m) <<
TRACE(t_fpa, tout << "mk_value for: " << mk_ismt2_pp(n->get_expr(), m) <<
" (sort " << mk_ismt2_pp(n->get_expr()->get_sort(), m) << ")\n";);
app_ref owner(m);
@ -557,7 +557,7 @@ namespace smt {
wrapped = m_converter.wrap(owner);
SASSERT(m_bv_util.is_bv(wrapped));
CTRACE("t_fpa_detail", !ctx.e_internalized(wrapped),
CTRACE(t_fpa_detail, !ctx.e_internalized(wrapped),
tout << "Model dependency not internalized: " <<
mk_ismt2_pp(wrapped, m) <<
" (owner " << (!ctx.e_internalized(owner) ? "not" : "is") <<
@ -575,7 +575,7 @@ namespace smt {
vp->add_dependency(ctx.get_enode(a0));
vp->add_dependency(ctx.get_enode(a1));
vp->add_dependency(ctx.get_enode(a2));
TRACE("t_fpa_detail", tout << "Depends on: " <<
TRACE(t_fpa_detail, tout << "Depends on: " <<
mk_ismt2_pp(a0, m) << " eq. cls. #" << get_enode(a0)->get_root()->get_expr()->get_id() << std::endl <<
mk_ismt2_pp(a1, m) << " eq. cls. #" << get_enode(a1)->get_root()->get_expr()->get_id() << std::endl <<
mk_ismt2_pp(a2, m) << " eq. cls. #" << get_enode(a2)->get_root()->get_expr()->get_id() << std::endl;);
@ -587,7 +587,7 @@ namespace smt {
a0 = to_app(owner->get_arg(0));
fpa_rm_value_proc * vp = alloc(fpa_rm_value_proc, this);
vp->add_dependency(ctx.get_enode(a0));
TRACE("t_fpa_detail", tout << "Depends on: " <<
TRACE(t_fpa_detail, tout << "Depends on: " <<
mk_ismt2_pp(a0, m) << " eq. cls. #" << get_enode(a0)->get_root()->get_expr()->get_id() << std::endl;);
res = vp;
}
@ -603,7 +603,7 @@ namespace smt {
fpa_value_proc * vp = alloc(fpa_value_proc, this, ebits, sbits);
enode * en = ctx.get_enode(wrapped);
vp->add_dependency(en);
TRACE("t_fpa_detail", tout << "Depends on: " << mk_ismt2_pp(wrapped, m) << " eq. cls. #" << en->get_root()->get_expr()->get_id() << std::endl;);
TRACE(t_fpa_detail, tout << "Depends on: " << mk_ismt2_pp(wrapped, m) << " eq. cls. #" << en->get_root()->get_expr()->get_id() << std::endl;);
res = vp;
}
}

View file

@ -242,7 +242,7 @@ class theory_lra::imp {
lp().push();
add_def_constraint_and_equality(var, lp::GE, rational(c));
add_def_constraint_and_equality(var, lp::LE, rational(c));
TRACE("arith", tout << "add " << cnst << ", var = " << var << "\n";);
TRACE(arith, tout << "add " << cnst << ", var = " << var << "\n";);
return var;
}
@ -272,13 +272,13 @@ class theory_lra::imp {
void found_unsupported(expr* n) {
ctx().push_trail(push_back_vector<ptr_vector<expr>>(m_not_handled));
TRACE("arith", tout << "unsupported " << mk_pp(n, m) << "\n");
TRACE(arith, tout << "unsupported " << mk_pp(n, m) << "\n");
m_not_handled.push_back(n);
}
void found_underspecified(expr* n) {
if (a.is_underspecified(n)) {
TRACE("arith", tout << "Unhandled: " << mk_pp(n, m) << "\n";);
TRACE(arith, tout << "Unhandled: " << mk_pp(n, m) << "\n";);
ctx().push_trail(push_back_vector<ptr_vector<app>>(m_underspecified));
m_underspecified.push_back(to_app(n));
}
@ -559,7 +559,7 @@ class theory_lra::imp {
theory_var v = mk_var(n);
vars.push_back(register_theory_var_in_lar_solver(v));
}
TRACE("arith", tout << "v" << v << " := " << bpp(t) << "\n" << vars << "\n";);
TRACE(arith, tout << "v" << v << " := " << bpp(t) << "\n" << vars << "\n";);
m_solver->register_existing_terms();
ensure_nla();
m_nla->add_monic(register_theory_var_in_lar_solver(v), vars.size(), vars.data());
@ -568,7 +568,7 @@ class theory_lra::imp {
}
enode * mk_enode(app * n) {
TRACE("arith_verbose", tout << bpp(n) << " internalized: " << ctx().e_internalized(n) << "\n";);
TRACE(arith_verbose, tout << bpp(n) << " internalized: " << ctx().e_internalized(n) << "\n";);
if (reflect(n))
for (expr* arg : *n)
if (!ctx().e_internalized(arg))
@ -588,12 +588,12 @@ class theory_lra::imp {
void mk_clause(literal l1, literal l2, unsigned num_params, parameter * params) {
TRACE("arith", literal lits[2]; lits[0] = l1; lits[1] = l2; ctx().display_literals_verbose(tout, 2, lits); tout << "\n";);
TRACE(arith, literal lits[2]; lits[0] = l1; lits[1] = l2; ctx().display_literals_verbose(tout, 2, lits); tout << "\n";);
ctx().mk_th_axiom(get_id(), l1, l2, num_params, params);
}
void mk_clause(literal l1, literal l2, literal l3, unsigned num_params, parameter * params) {
TRACE("arith", literal lits[3]; lits[0] = l1; lits[1] = l2; lits[2] = l3; ctx().display_literals_smt2(tout, 3, lits); tout << "\n";);
TRACE(arith, literal lits[3]; lits[0] = l1; lits[1] = l2; lits[2] = l3; ctx().display_literals_smt2(tout, 3, lits); tout << "\n";);
ctx().mk_th_axiom(get_id(), l1, l2, l3, num_params, params);
}
@ -734,7 +734,7 @@ class theory_lra::imp {
}
void updt_unassigned_bounds(theory_var v, int inc) {
TRACE("arith_verbose", tout << "v" << v << " " << m_unassigned_bounds[v] << " += " << inc << "\n";);
TRACE(arith_verbose, tout << "v" << v << " " << m_unassigned_bounds[v] << " += " << inc << "\n";);
ctx().push_trail(vector_value_trail<unsigned, false>(m_unassigned_bounds, v));
m_unassigned_bounds[v] += inc;
}
@ -745,7 +745,7 @@ class theory_lra::imp {
theory_var internalize_def(app* term, scoped_internalize_state& st) {
TRACE("arith", tout << expr_ref(term, m) << "\n";);
TRACE(arith, tout << expr_ref(term, m) << "\n";);
if (ctx().e_internalized(term)) {
IF_VERBOSE(0, verbose_stream() << "repeated term\n";);
return mk_var(term);
@ -787,7 +787,7 @@ class theory_lra::imp {
theory_var internalize_linearized_def(app* term, scoped_internalize_state& st) {
theory_var v = mk_var(term);
TRACE("arith_internalize", tout << "v" << v << " " << bpp(term) << "\n";);
TRACE(arith_internalize, tout << "v" << v << " " << bpp(term) << "\n";);
if (is_unit_var(st) && v == st.vars()[0])
return st.vars()[0];
@ -804,7 +804,7 @@ class theory_lra::imp {
else {
vi = lp().add_term(m_left_side, v);
SASSERT(lp().column_has_term(vi));
TRACE("arith_verbose",
TRACE(arith_verbose,
tout << "v" << v << " := " << mk_pp(term, m)
<< " slack: " << vi << " scopes: " << m_scopes.size() << "\n";
lp().print_term(lp().get_term(vi), tout) << "\n";);
@ -884,7 +884,7 @@ public:
}
bool internalize_atom(app * atom, bool gate_ctx) {
TRACE("arith_internalize", tout << bpp(atom) << "\n";);
TRACE(arith_internalize, tout << bpp(atom) << "\n";);
SASSERT(!ctx().b_internalized(atom));
expr* n1, *n2;
rational r;
@ -914,7 +914,7 @@ public:
return true;
}
else {
TRACE("arith", tout << "Could not internalize " << mk_pp(atom, m) << "\n";);
TRACE(arith, tout << "Could not internalize " << mk_pp(atom, m) << "\n";);
found_unsupported(atom);
return true;
}
@ -928,7 +928,7 @@ public:
m_bounds_trail.push_back(v);
m_bool_var2bound.insert(bv, b);
mk_bound_axioms(*b);
TRACE("arith_internalize", tout << "Internalized " << bv << ": " << bpp(atom) << "\n";);
TRACE(arith_internalize, tout << "Internalized " << bv << ": " << bpp(atom) << "\n";);
return true;
}
@ -959,7 +959,7 @@ public:
}
void assign_eh(bool_var v, bool is_true) {
TRACE("arith", tout << "assign p" << literal(v, !is_true) << ": " << bpp(ctx().bool_var2expr(v)) << "\n";);
TRACE(arith, tout << "assign p" << literal(v, !is_true) << ": " << bpp(ctx().bool_var2expr(v)) << "\n";);
m_asserted_atoms.push_back(delayed_atom(v, is_true));
}
@ -996,7 +996,7 @@ public:
}
void new_eq_eh(theory_var v1, theory_var v2) {
TRACE("arith", tout << "eq " << v1 << " == " << v2 << "\n";);
TRACE(arith, tout << "eq " << v1 << " == " << v2 << "\n";);
if (!is_int(v1) && !is_real(v1))
return;
m_arith_eq_adapter.new_eq_eh(v1, v2);
@ -1007,13 +1007,13 @@ public:
}
void new_diseq_eh(theory_var v1, theory_var v2) {
TRACE("arith", tout << "v" << v1 << " != " << "v" << v2 << "\n";);
TRACE(arith, tout << "v" << v1 << " != " << "v" << v2 << "\n";);
++m_stats.m_assert_diseq;
m_arith_eq_adapter.new_diseq_eh(v1, v2);
}
void apply_sort_cnstr(enode* n, sort*) {
TRACE("arith", tout << "sort constraint: " << pp(n) << "\n";);
TRACE(arith, tout << "sort constraint: " << pp(n) << "\n";);
#if 0
if (!th.is_attached_to_var(n))
mk_var(n->get_owner());
@ -1045,7 +1045,7 @@ public:
m_bv_to_propagate.reset();
if (m_nla)
m_nla->pop(num_scopes);
TRACE("arith", tout << "num scopes: " << num_scopes << " new scope level: " << m_scopes.size() << "\n";);
TRACE(arith, tout << "num scopes: " << num_scopes << " new scope level: " << m_scopes.size() << "\n";);
}
void restart_eh() {
@ -1219,14 +1219,14 @@ public:
add_def_constraint_and_equality(vi, lp::GE, rational::zero());
add_def_constraint_and_equality(vi, lp::LT, abs(r));
SASSERT(!is_infeasible());
TRACE("arith", tout << term << "\n" << lp().constraints(););
TRACE(arith, tout << term << "\n" << lp().constraints(););
}
void mk_idiv_mod_axioms(expr * p, expr * q) {
if (a.is_zero(q)) {
return;
}
TRACE("arith", tout << expr_ref(p, m) << " " << expr_ref(q, m) << "\n";);
TRACE(arith, tout << expr_ref(p, m) << " " << expr_ref(q, m) << "\n";);
// if q is zero, then idiv and mod are uninterpreted functions.
expr_ref div(a.mk_idiv(p, q), m);
expr_ref mod(a.mk_mod(p, q), m);
@ -1309,7 +1309,7 @@ public:
div_ge = a.mk_ge(a.mk_sub(p, a.mk_mul(q, div)), zero);
ctx().get_rewriter()(div_ge);
mk_axiom(eqz, mk_literal(div_ge));
TRACE("arith", tout << eqz << " " << div_ge << "\n");
TRACE(arith, tout << eqz << " " << div_ge << "\n");
}
@ -1413,7 +1413,7 @@ public:
literal mk_literal(expr* e) {
expr_ref pinned(e, m);
TRACE("mk_bool_var", tout << pinned << " " << pinned->get_id() << "\n";);
TRACE(mk_bool_var, tout << pinned << " " << pinned->get_id() << "\n";);
if (!ctx().e_internalized(e)) {
ctx().internalize(e, false);
}
@ -1461,7 +1461,7 @@ public:
if (m.inc() && m_solver.get() && th.get_num_vars() > 0) {
ctx().push_trail(value_trail<bool>(m_model_is_initialized));
m_model_is_initialized = lp().init_model();
TRACE("arith", display(tout << "update variable values " << m_model_is_initialized << "\n"););
TRACE(arith, display(tout << "update variable values " << m_model_is_initialized << "\n"););
}
}
@ -1498,7 +1498,7 @@ public:
}
}
}
TRACE("arith",
TRACE(arith,
for (theory_var v = 0; v < sz; ++v)
if (th.is_relevant_and_shared(get_enode(v)))
tout << "v" << v << " ";
@ -1513,7 +1513,7 @@ public:
if (delayed_assume_eqs())
return true;
TRACE("arith_verbose", display(tout););
TRACE(arith_verbose, display(tout););
random_update();
m_model_eqs.reset();
@ -1555,7 +1555,7 @@ public:
enode* n1 = get_enode(v1);
enode* n2 = get_enode(v2);
m_assume_eq_head++;
CTRACE("arith",
CTRACE(arith,
is_eq(v1, v2) && n1->get_root() != n2->get_root(),
tout << "assuming eq: v" << v1 << " = v" << v2 << "\n";);
if (is_eq(v1, v2) && n1->get_root() != n2->get_root() && th.assume_eq(n1, n2)) {
@ -1620,7 +1620,7 @@ public:
bool int_undef = false;
switch (is_sat) {
case l_true:
TRACE("arith", display(tout));
TRACE(arith, display(tout));
switch (check_lia()) {
case FC_DONE:
@ -1629,7 +1629,7 @@ public:
return FC_CONTINUE;
case FC_GIVEUP:
int_undef = true;
TRACE("arith", tout << "check-lia giveup\n";);
TRACE(arith, tout << "check-lia giveup\n";);
if (ctx().get_fparams().m_arith_ignore_int)
st = FC_CONTINUE;
break;
@ -1641,7 +1641,7 @@ public:
case FC_CONTINUE:
return FC_CONTINUE;
case FC_GIVEUP:
TRACE("arith", tout << "check-nra giveup\n";);
TRACE(arith, tout << "check-nra giveup\n";);
st = FC_GIVEUP;
break;
}
@ -1662,7 +1662,7 @@ public:
st = FC_CONTINUE;
break;
case FC_GIVEUP:
TRACE("arith", tout << "give up " << mk_pp(e, m) << "\n");
TRACE(arith, tout << "give up " << mk_pp(e, m) << "\n");
if (st != FC_CONTINUE)
st = FC_GIVEUP;
break;
@ -1677,13 +1677,13 @@ public:
get_infeasibility_explanation_and_set_conflict();
return FC_CONTINUE;
case l_undef:
TRACE("arith", tout << "check feasible is undef\n";);
TRACE(arith, tout << "check feasible is undef\n";);
return m.inc() ? FC_CONTINUE : FC_GIVEUP;
default:
UNREACHABLE();
break;
}
TRACE("arith", tout << "default giveup\n";);
TRACE(arith, tout << "default giveup\n";);
return FC_GIVEUP;
}
@ -1739,11 +1739,11 @@ public:
rational g = gcd_reduce(coeffs);
if (!g.is_one()) {
if (lower_bound) {
TRACE("arith", tout << "lower: " << offset << " / " << g << " = " << offset / g << " >= " << ceil(offset / g) << "\n";);
TRACE(arith, tout << "lower: " << offset << " / " << g << " = " << offset / g << " >= " << ceil(offset / g) << "\n";);
offset = ceil(offset / g);
}
else {
TRACE("arith", tout << "upper: " << offset << " / " << g << " = " << offset / g << " <= " << floor(offset / g) << "\n";);
TRACE(arith, tout << "upper: " << offset << " / " << g << " = " << offset / g << " <= " << floor(offset / g) << "\n";);
offset = floor(offset / g);
}
}
@ -1754,7 +1754,7 @@ public:
for (auto& kv : coeffs) kv.m_value.neg();
}
// CTRACE("arith", is_int,
// CTRACE(arith, is_int,
// lp().print_term(term, tout << "term: ") << "\n";
// tout << "offset: " << offset << " gcd: " << g << "\n";);
@ -1769,7 +1769,7 @@ public:
// Note: it is not safe to rewrite atom because the rewriter can
// destroy structure, such as (div x 24) >= 0 becomes x >= 0 and the internal variable
// corresponding to (div x 24) is not constrained.
TRACE("arith", tout << t << ": " << atom << "\n";
TRACE(arith, tout << t << ": " << atom << "\n";
lp().print_term(term, tout << "bound atom: ") << (lower_bound?" >= ":" <= ") << k << "\n";);
ctx().internalize(atom, true);
ctx().mark_as_relevant(atom.get());
@ -1883,9 +1883,9 @@ public:
}
final_check_status check_lia() {
TRACE("arith",);
TRACE(arith,);
if (!m.inc()) {
TRACE("arith", tout << "canceled\n";);
TRACE(arith, tout << "canceled\n";);
return FC_CONTINUE;
}
auto cr = m_lia->check(&m_explanation);
@ -1897,7 +1897,7 @@ public:
break;
case lp::lia_move::branch: {
TRACE("arith", tout << "branch\n";);
TRACE(arith, tout << "branch\n";);
bool u = m_lia->is_upper();
auto const & k = m_lia->offset();
rational offset;
@ -1921,7 +1921,7 @@ public:
case lp::lia_move::cut: {
if (ctx().get_fparams().m_arith_ignore_int)
return FC_GIVEUP;
TRACE("arith", tout << "cut\n";);
TRACE(arith, tout << "cut\n";);
// m_explanation implies term <= k
reset_evidence();
for (auto ev : m_explanation) {
@ -1935,21 +1935,21 @@ public:
m.trace_stream() << "[end-of-instance]\n";
}
IF_VERBOSE(4, verbose_stream() << "cut " << b << "\n");
TRACE("arith", dump_cut_lemma(tout, m_lia->get_term(), m_lia->offset(), m_explanation, m_lia->is_upper()););
TRACE(arith, dump_cut_lemma(tout, m_lia->get_term(), m_lia->offset(), m_explanation, m_lia->is_upper()););
literal lit(ctx().get_bool_var(b), false);
TRACE("arith",
TRACE(arith,
ctx().display_lemma_as_smt_problem(tout << "new cut:\n", m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), lit);
display(tout););
assign(lit, m_core, m_eqs, m_params);
return FC_CONTINUE;
}
case lp::lia_move::conflict:
TRACE("arith", tout << "conflict\n";);
TRACE(arith, tout << "conflict\n";);
// ex contains unsat core
set_conflict();
return FC_CONTINUE;
case lp::lia_move::undef:
TRACE("arith", tout << "lia undef\n";);
TRACE(arith, tout << "lia undef\n";);
return FC_CONTINUE;
case lp::lia_move::continue_with_check:
return FC_CONTINUE;
@ -1994,7 +1994,7 @@ public:
default:
UNREACHABLE();
}
TRACE("arith", tout << "is_lower: " << is_lower << " pos " << pos << "\n";);
TRACE(arith, tout << "is_lower: " << is_lower << " pos " << pos << "\n";);
expr_ref atom(m);
// TBD utility: lp::lar_term term = mk_term(ineq.m_poly);
// then term is used instead of ineq.m_term
@ -2041,10 +2041,10 @@ public:
final_check_status check_nla() {
if (!m.inc()) {
TRACE("arith", tout << "canceled\n";);
TRACE(arith, tout << "canceled\n";);
return FC_GIVEUP;
}
CTRACE("arith",!m_nla, tout << "no nla\n";);
CTRACE(arith,!m_nla, tout << "no nla\n";);
if (!m_nla)
return FC_DONE;
if (!m_nla->need_check())
@ -2071,7 +2071,7 @@ public:
enode * n = get_enode(v);
enode * r = n->get_root();
unsigned usz = m_underspecified.size();
TRACE("shared", tout << ctx().get_scope_level() << " " << enode_pp(n, ctx()) << " " << v << " underspecified " << usz << " parents " << r->get_num_parents() << "\n";);
TRACE(shared, tout << ctx().get_scope_level() << " " << enode_pp(n, ctx()) << " " << v << " underspecified " << usz << " parents " << r->get_num_parents() << "\n";);
if (r->get_num_parents() > 2*usz) {
for (unsigned i = 0; i < usz; ++i) {
app* u = m_underspecified[i];
@ -2130,7 +2130,7 @@ public:
auto [bv, is_true] = m_asserted_atoms[m_asserted_qhead];
api_bound* b = nullptr;
TRACE("arith", tout << "propagate: " << literal(bv, !is_true) << "\n";
TRACE(arith, tout << "propagate: " << literal(bv, !is_true) << "\n";
if (!m_bool_var2bound.contains(bv)) tout << "not found\n");
if (m_bool_var2bound.find(bv, b) && !assert_bound(bv, is_true, *b)) {
get_infeasibility_explanation_and_set_conflict();
@ -2147,7 +2147,7 @@ public:
switch(lbl) {
case l_false:
TRACE("arith", tout << "propagation conflict\n";);
TRACE(arith, tout << "propagation conflict\n";);
get_infeasibility_explanation_and_set_conflict();
break;
case l_true:
@ -2169,7 +2169,7 @@ public:
}
void add_equality(lpvar j, rational const& k, lp::explanation const& exp) {
TRACE("arith", tout << "equality " << j << " " << k << "\n");
TRACE(arith, tout << "equality " << j << " " << k << "\n");
theory_var v;
if (k == 1)
v = m_one_var;
@ -2264,12 +2264,12 @@ public:
if (v == null_theory_var)
return 0;
TRACE("arith", tout << "v" << v << " " << be.kind() << " " << be.m_bound << "\n";);
TRACE(arith, tout << "v" << v << " " << be.kind() << " " << be.m_bound << "\n";);
reserve_bounds(v);
if (m_unassigned_bounds[v] == 0 && !should_refine_bounds()) {
TRACE("arith", tout << "return\n";);
TRACE(arith, tout << "return\n";);
return 0;
}
lp_bounds const& bounds = m_bounds[v];
@ -2282,10 +2282,10 @@ public:
literal lit = is_bound_implied(be.kind(), be.m_bound, *b);
if (lit == null_literal)
continue;
TRACE("arith", tout << lit << " bound: " << *b << " first: " << first << "\n";);
TRACE(arith, tout << lit << " bound: " << *b << " first: " << first << "\n";);
ctx().display_literal_verbose(verbose_stream() << "miss ", lit) << "\n";
display(verbose_stream());
TRACE("arith", ctx().display_literal_verbose(tout << "miss ", lit) << "\n");
TRACE(arith, ctx().display_literal_verbose(tout << "miss ", lit) << "\n");
exit(0);
++count;
@ -2301,12 +2301,12 @@ public:
if (v == null_theory_var)
return 0;
TRACE("arith", tout << "v" << v << " " << be.kind() << " " << be.m_bound << "\n";);
TRACE(arith, tout << "v" << v << " " << be.kind() << " " << be.m_bound << "\n";);
reserve_bounds(v);
if (m_unassigned_bounds[v] == 0 && !should_refine_bounds()) {
TRACE("arith", tout << "return\n";);
TRACE(arith, tout << "return\n";);
return 0;
}
lp_bounds const& bounds = m_bounds[v];
@ -2319,7 +2319,7 @@ public:
literal lit = is_bound_implied(be.kind(), be.m_bound, *b);
if (lit == null_literal)
continue;
TRACE("arith", tout << lit << " bound: " << *b << " first: " << first << "\n";);
TRACE(arith, tout << lit << " bound: " << *b << " first: " << first << "\n";);
++count;
@ -2330,9 +2330,9 @@ public:
m_explanation.clear();
lp().explain_implied_bound(be, m_bp);
}
CTRACE("arith", m_unassigned_bounds[v] == 0, tout << "missed bound\n";);
CTRACE(arith, m_unassigned_bounds[v] == 0, tout << "missed bound\n";);
updt_unassigned_bounds(v, -1);
TRACE("arith",
TRACE(arith,
ctx().display_literals_verbose(tout, m_core);
tout << "\n --> ";
ctx().display_literal_verbose(tout, lit);
@ -2405,7 +2405,7 @@ public:
enode* n1 = get_enode(uv);
enode* n2 = get_enode(vv);
TRACE("arith", tout << "add-eq " << pp(n1) << " == " << pp(n2) << "\n";);
TRACE(arith, tout << "add-eq " << pp(n1) << " == " << pp(n2) << "\n";);
if (n1->get_root() == n2->get_root())
return false;
expr* e1 = n1->get_expr();
@ -2771,7 +2771,7 @@ public:
void flush_bound_axioms() {
CTRACE("arith", !m_new_bounds.empty(), tout << "flush bound axioms\n";);
CTRACE(arith, !m_new_bounds.empty(), tout << "flush bound axioms\n";);
while (!m_new_bounds.empty()) {
lp_bounds atoms;
@ -2786,7 +2786,7 @@ public:
--i;
}
}
CTRACE("arith", atoms.size() > 1,
CTRACE(arith, atoms.size() > 1,
for (auto* a : atoms) a->display(tout) << "\n";);
lp_bounds occs(m_bounds[v]);
@ -2910,7 +2910,7 @@ public:
literal lit1(bv, !is_true);
literal lit2 = null_literal;
bool find_glb = (is_true == (k == lp_api::lower_t));
TRACE("arith_verbose", tout << "v" << v << " find_glb: " << find_glb << " is_true: " << is_true << " k: " << k << " is_lower: " << (k == lp_api::lower_t) << "\n";);
TRACE(arith_verbose, tout << "v" << v << " find_glb: " << find_glb << " is_true: " << is_true << " k: " << k << " is_lower: " << (k == lp_api::lower_t) << "\n";);
if (find_glb) {
rational glb;
api_bound* lb = nullptr;
@ -2949,7 +2949,7 @@ public:
++m_stats.m_bound_propagations2;
reset_evidence();
m_core.push_back(lit1);
TRACE("arith",
TRACE(arith,
ctx().display_literals_verbose(tout, m_core);
ctx().display_literal_verbose(tout << " => ", lit2);
tout << "\n";);
@ -3019,13 +3019,13 @@ public:
//
void propagate_bound_compound(bool_var bv, bool is_true, api_bound& b) {
theory_var v = b.get_var();
TRACE("arith", tout << pp(v) << "\n";);
TRACE(arith, tout << pp(v) << "\n";);
if (static_cast<unsigned>(v) >= m_use_list.size()) {
return;
}
for (auto const& vb : m_use_list[v]) {
if (ctx().get_assignment(vb->get_lit()) != l_undef) {
TRACE("arith_verbose", display_bound(tout << "assigned ", *vb) << "\n";);
TRACE(arith_verbose, display_bound(tout << "assigned ", *vb) << "\n";);
continue;
}
inf_rational r;
@ -3052,7 +3052,7 @@ public:
// get_glb and get_lub set m_core, m_eqs, m_params
if (lit != null_literal) {
TRACE("arith",
TRACE(arith,
ctx().display_literals_verbose(tout, m_core);
ctx().display_literal_verbose(tout << "\n --> ", lit) << "\n";
);
@ -3061,7 +3061,7 @@ public:
assign(lit, m_core, m_eqs, m_params);
}
else {
TRACE("arith_verbose", display_bound(tout << "skip ", *vb) << "\n";);
TRACE(arith_verbose, display_bound(tout << "skip ", *vb) << "\n";);
}
}
}
@ -3113,7 +3113,7 @@ public:
r += value * mono.coeff();
set_evidence(ci, m_core, m_eqs);
}
TRACE("arith_verbose", tout << (is_lub?"lub":"glb") << " is " << r << "\n";);
TRACE(arith_verbose, tout << (is_lub?"lub":"glb") << " is " << r << "\n";);
return true;
}
@ -3129,7 +3129,7 @@ public:
}
bool assert_bound(bool_var bv, bool is_true, api_bound& b) {
TRACE("arith", tout << b << "\n";);
TRACE(arith, tout << b << "\n";);
lp::constraint_index ci = b.get_constraint(is_true);
lp().activate(ci);
if (is_infeasible())
@ -3222,7 +3222,7 @@ public:
}
constraint_bound& b = vec[tv];
if (b.first == UINT_MAX || (is_lower? b.second < v : b.second > v)) {
TRACE("arith", tout << "tighter bound " << tv << "\n";);
TRACE(arith, tout << "tighter bound " << tv << "\n";);
m_history.push_back(vec[tv]);
ctx().push_trail(history_trail<constraint_bound>(vec, tv, m_history));
b.first = ci;
@ -3264,7 +3264,7 @@ public:
if (lp().column_has_term(vi)) {
theory_var v = lp().local_to_external(vi);
rational val;
TRACE("arith", tout << lp().get_variable_name(vi) << " " << v << "\n";);
TRACE(arith, tout << lp().get_variable_name(vi) << " " << v << "\n";);
if (v != null_theory_var && a.is_numeral(get_owner(v), val) && bound == val) {
dep = nullptr;
return bound == val;
@ -3305,7 +3305,7 @@ public:
u_dependency* ci1 = nullptr, *ci2 = nullptr, *ci3 = nullptr, *ci4 = nullptr;
theory_var v1 = lp().local_to_external(vi1);
theory_var v2 = lp().local_to_external(vi2);
TRACE("arith", tout << "fixed: " << pp(v1) << " " << pp(v2) << "\n";);
TRACE(arith, tout << "fixed: " << pp(v1) << " " << pp(v2) << "\n";);
// we expect lp() to ensure that none of these returns happen.
if (is_equal(v1, v2))
return;
@ -3337,7 +3337,7 @@ public:
ext_theory_eq_propagation_justification(
get_id(), ctx(), m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), x, y));
TRACE("arith",
TRACE(arith,
for (auto c : m_core)
ctx().display_detailed_literal(tout << ctx().get_assign_level(c.var()) << " " << c << " ", c) << "\n";
for (auto e : m_eqs)
@ -3365,7 +3365,7 @@ public:
else
return;
enode* y = get_enode(w);
TRACE("arith", tout << pp(x) << " == " << pp(y) << "\n");
TRACE(arith, tout << pp(x) << " == " << pp(y) << "\n");
if (x->get_sort() != y->get_sort())
return;
if (x->get_root() == y->get_root())
@ -3377,15 +3377,15 @@ public:
}
lbool make_feasible() {
TRACE("pcs", tout << lp().constraints(););
TRACE("arith_verbose", tout << "before calling lp().find_feasible_solution()\n"; display(tout););
TRACE(pcs, tout << lp().constraints(););
TRACE(arith_verbose, tout << "before calling lp().find_feasible_solution()\n"; display(tout););
auto status = lp().find_feasible_solution();
TRACE("arith_verbose", display(tout););
TRACE(arith_verbose, display(tout););
if (lp().is_feasible())
return l_true;
if (status == lp::lp_status::INFEASIBLE)
return l_false;
TRACE("arith", tout << "status treated as inconclusive: " << status << "\n";);
TRACE(arith, tout << "status treated as inconclusive: " << status << "\n";);
// TENTATIVE_UNBOUNDED, UNBOUNDED, TENTATIVE_DUAL_UNBOUNDED, DUAL_UNBOUNDED,
// TIME_EXAUSTED, EMPTY, UNSTABLE
return l_undef;
@ -3454,7 +3454,7 @@ public:
// lp().shrink_explanation_to_minimum(m_explanation); // todo, enable when perf is fixed
++m_num_conflicts;
++m_stats.m_conflicts;
TRACE("arith_conflict",
TRACE(arith_conflict,
tout << "@" << ctx().get_scope_level() << (is_conflict ? " conflict":" lemma");
for (auto const& p : m_params) tout << " " << p;
tout << "\n";
@ -3486,7 +3486,7 @@ public:
if (ctx().get_assignment(c) == l_true)
return;
}
TRACE("arith", ctx().display_literals_verbose(tout, m_core) << "\n";);
TRACE(arith, ctx().display_literals_verbose(tout, m_core) << "\n";);
ctx().mk_th_axiom(get_id(), m_core.size(), m_core.data());
}
}
@ -3521,7 +3521,7 @@ public:
m_factory->register_value(val);
}
TRACE("arith", display(tout););
TRACE(arith, display(tout););
}
nlsat::anum const& nl_value(theory_var v, scoped_anum& r) const {
@ -3532,8 +3532,8 @@ public:
else {
m_todo_terms.push_back({t, rational::one()});
TRACE("nl_value", tout << "v" << v << " " << t << "\n";);
TRACE("nl_value", tout << "v" << v << " := w" << t << "\n";
TRACE(nl_value, tout << "v" << v << " " << t << "\n";);
TRACE(nl_value, tout << "v" << v << " := w" << t << "\n";
lp().print_term(lp().get_term(t), tout) << "\n";);
m_nla->am().set(r, 0);
@ -3542,7 +3542,7 @@ public:
t = m_todo_terms.back().first;
m_todo_terms.pop_back();
lp::lar_term const& term = lp().get_term(t);
TRACE("nl_value", lp().print_term(term, tout) << "\n";);
TRACE(nl_value, lp().print_term(term, tout) << "\n";);
scoped_anum r1(m_nla->am());
rational c1(0);
m_nla->am().set(r1, c1.to_mpq());
@ -3576,7 +3576,7 @@ public:
}
else {
rational r = get_value(v);
TRACE("arith", tout << mk_pp(o, m) << " v" << v << " := " << r << "\n";);
TRACE(arith, tout << mk_pp(o, m) << " v" << v << " := " << r << "\n";);
SASSERT("integer variables should have integer values: " && (!a.is_int(o) || r.is_int() || m.limit().is_canceled()));
if (a.is_int(o) && !r.is_int()) r = floor(r);
return alloc(expr_wrapper_proc, m_factory->mk_value(r, o->get_sort()));
@ -3588,7 +3588,7 @@ public:
if (!is_registered_var(v)) return false;
lpvar vi = get_lpvar(v);
if (lp().has_value(vi, val)) {
TRACE("arith", tout << expr_ref(n->get_expr(), m) << " := " << val << "\n";);
TRACE(arith, tout << expr_ref(n->get_expr(), m) << " := " << val << "\n";);
if (is_int(n) && !val.is_int()) return false;
return true;
}
@ -3817,7 +3817,7 @@ public:
cancel_eh<reslimit> eh(m.limit());
scoped_timer timer(1000, &eh);
bool result = l_true != nctx.check();
CTRACE("arith", !result, ctx().display_lemma_as_smt_problem(tout, m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), false_literal););
CTRACE(arith, !result, ctx().display_lemma_as_smt_problem(tout, m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), false_literal););
return result;
}
@ -3831,7 +3831,7 @@ public:
cancel_eh<reslimit> eh(m.limit());
scoped_timer timer(1000, &eh);
bool result = l_true != nctx.check();
CTRACE("arith", !result, ctx().display_lemma_as_smt_problem(tout, m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), lit);
CTRACE(arith, !result, ctx().display_lemma_as_smt_problem(tout, m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), lit);
display(tout););
return result;
}
@ -3879,7 +3879,7 @@ public:
lp().backup_x();
}
if (!is_registered_var(v)) {
TRACE("arith", tout << "cannot get bound for v" << v << "\n";);
TRACE(arith, tout << "cannot get bound for v" << v << "\n";);
st = lp::lp_status::UNBOUNDED;
}
else if (!m.limit().inc()) {
@ -3913,20 +3913,20 @@ public:
switch (st) {
case lp::lp_status::OPTIMAL: {
init_variable_values();
TRACE("arith", display(tout << st << " v" << v << " vi: " << vi << "\n"););
TRACE(arith, display(tout << st << " v" << v << " vi: " << vi << "\n"););
auto val = value(v);
blocker = mk_gt(v);
return val;
}
case lp::lp_status::FEASIBLE: {
auto val = value(v);
TRACE("arith", display(tout << st << " v" << v << " vi: " << vi << "\n"););
TRACE(arith, display(tout << st << " v" << v << " vi: " << vi << "\n"););
blocker = mk_gt(v);
return val;
}
default:
SASSERT(st == lp::lp_status::UNBOUNDED);
TRACE("arith", display(tout << st << " v" << v << " vi: " << vi << "\n"););
TRACE(arith, display(tout << st << " v" << v << " vi: " << vi << "\n"););
has_shared = false;
blocker = m.mk_false();
return inf_eps(rational::one(), inf_rational());
@ -3953,12 +3953,12 @@ public:
else
e = a.mk_gt(obj, e);
}
TRACE("opt", tout << "v" << v << " " << val << " " << r << " " << e << "\n";);
TRACE(opt, tout << "v" << v << " " << val << " " << r << " " << e << "\n";);
return e;
}
theory_var add_objective(app* term) {
TRACE("opt", tout << expr_ref(term, m) << "\n";);
TRACE(opt, tout << expr_ref(term, m) << "\n";);
theory_var v = internalize_def(term);
register_theory_var_in_lar_solver(v);
return v;
@ -3969,7 +3969,7 @@ public:
}
void term2coeffs(lp::lar_term const& term, u_map<rational>& coeffs, rational const& coeff) {
TRACE("arith", lp().print_term(term, tout) << "\n";);
TRACE(arith, lp().print_term(term, tout) << "\n";);
for (lp::lar_term::ival ti : term) {
theory_var w;
auto tv = ti.j();
@ -3982,7 +3982,7 @@ public:
else {
w = lp().local_to_external(tv);
SASSERT(w >= 0);
TRACE("arith", tout << tv << ": " << w << "\n";);
TRACE(arith, tout << tv << ": " << w << "\n";);
}
rational c0(0);
coeffs.find(w, c0);
@ -4055,7 +4055,7 @@ public:
bool is_strict = val.get_infinitesimal().is_pos();
app_ref b(m);
bool is_int = a.is_int(get_enode(v)->get_expr());
TRACE("arith", display(tout << "v" << v << "\n"););
TRACE(arith, display(tout << "v" << v << "\n"););
if (is_strict) {
b = a.mk_le(mk_obj(v), a.mk_numeral(r, is_int));
}
@ -4077,12 +4077,12 @@ public:
m_bounds_trail.push_back(v);
m_bool_var2bound.insert(bv, a);
TRACE("arith", tout << "internalized " << bv << ": " << mk_pp(b, m) << "\n";);
TRACE(arith, tout << "internalized " << bv << ": " << mk_pp(b, m) << "\n";);
}
if (is_strict) {
b = m.mk_not(b);
}
TRACE("arith", tout << b << "\n";);
TRACE(arith, tout << b << "\n";);
return expr_ref(b, m);
}

View file

@ -251,7 +251,7 @@ namespace smt {
context& ctx = th.get_context();
unsigned sz = size();
unsigned bound = k();
TRACE("pb", th.display(tout << "assign: " << m_lit << " " << ~alit << " " << bound << "\n", *this, true););
TRACE(pb, th.display(tout << "assign: " << m_lit << " " << ~alit << " " << bound << "\n", *this, true););
SASSERT(0 < bound && bound < sz);
SASSERT(ctx.get_assignment(alit) == l_false);
@ -273,7 +273,7 @@ namespace smt {
for (unsigned i = bound + 1; i < sz; ++i) {
literal lit2 = lit(i);
if (ctx.get_assignment(lit2) != l_false) {
TRACE("pb", tout << "swap " << lit2 << "\n";);
TRACE(pb, tout << "swap " << lit2 << "\n";);
std::swap(m_args[index], m_args[i]);
th.watch_literal(lit2, this);
return l_undef;
@ -282,12 +282,12 @@ namespace smt {
// conflict
if (bound != index && ctx.get_assignment(lit(bound)) == l_false) {
TRACE("pb", tout << "conflict " << lit(bound) << " " << alit << "\n";);
TRACE(pb, tout << "conflict " << lit(bound) << " " << alit << "\n";);
set_conflict(th, alit);
return l_false;
}
TRACE("pb", tout << "no swap " << index << " " << alit << "\n";);
TRACE(pb, tout << "no swap " << index << " " << alit << "\n";);
// there are no literals to swap with,
// prepare for unit propagation by swapping the false literal into
// position bound. Then literals in positions 0..bound-1 have to be
@ -548,7 +548,7 @@ namespace smt {
c->prune();
c->post_prune();
TRACE("pb", display(tout, *c); tout << " := " << lit << " " << is_true << "\n";);
TRACE(pb, display(tout, *c); tout << " := " << lit << " " << is_true << "\n";);
switch (is_true) {
case l_false:
lit.neg();
@ -586,7 +586,7 @@ namespace smt {
init_watch(abv);
m_var_infos[abv].m_ineq = c.detach();
m_ineqs_trail.push_back(abv);
TRACE("pb", display(tout, *c););
TRACE(pb, display(tout, *c););
return true;
}
@ -624,7 +624,7 @@ namespace smt {
app_ref tmp(m), fml(m);
tmp = pb.mk_fresh_bool();
fml = m.mk_iff(tmp, arg);
TRACE("pb", tout << "create proxy " << fml << "\n";);
TRACE(pb, tout << "create proxy " << fml << "\n";);
ctx.internalize(fml, false);
SASSERT(ctx.b_internalized(tmp));
bv = ctx.get_bool_var(tmp);
@ -947,7 +947,7 @@ namespace smt {
}
c.inc_propagations(*this);
m_stats.m_num_propagations++;
TRACE("pb", tout << "#prop: " << c.num_propagations() << " - " << c.lit() << " => " << l << "\n";
TRACE(pb, tout << "#prop: " << c.num_propagations() << " - " << c.lit() << " => " << l << "\n";
display(tout, c, true) << "\n";);
SASSERT(validate_unit_propagation(c));
ctx.assign(l, ctx.mk_justification(card_justification(c, l, get_id())));
@ -986,7 +986,7 @@ namespace smt {
}
final_check_status theory_pb::final_check_eh() {
TRACE("pb", display(tout););
TRACE(pb, display(tout););
DEBUG_CODE(validate_final_check(););
return FC_DONE;
}
@ -995,7 +995,7 @@ namespace smt {
ptr_vector<ineq>* ineqs = nullptr;
literal nlit(v, is_true);
init_watch(v);
TRACE("pb", tout << "assign: " << ~nlit << "\n";);
TRACE(pb, tout << "assign: " << ~nlit << "\n";);
ineqs = m_var_infos[v].m_lit_watch[nlit.sign()];
if (ineqs != nullptr) {
for (unsigned i = 0; i < ineqs->size(); ++i) {
@ -1133,7 +1133,7 @@ namespace smt {
}
}
TRACE("pb",
TRACE(pb,
tout << "assign: " << c.lit() << "\n";
display(tout, c); );
@ -1245,7 +1245,7 @@ namespace smt {
//
}
TRACE("pb",
TRACE(pb,
tout << "assign: " << literal(v,!is_true) << "\n";
display(tout, c); );
@ -1497,7 +1497,7 @@ namespace smt {
void theory_pb::add_assign(ineq& c, literal_vector const& lits, literal l) {
inc_propagations(c);
m_stats.m_num_propagations++;
TRACE("pb", tout << "#prop:" << c.m_num_propagations << " - " << lits;
TRACE(pb, tout << "#prop:" << c.m_num_propagations << " - " << lits;
tout << " => " << l << "\n";
display(tout, c, true););
@ -1512,7 +1512,7 @@ namespace smt {
void theory_pb::add_clause(ineq& c, literal_vector const& lits) {
inc_propagations(c);
m_stats.m_num_conflicts++;
TRACE("pb", tout << "#prop:" << c.m_num_propagations << " - " << lits << "\n";
TRACE(pb, tout << "#prop:" << c.m_num_propagations << " - " << lits << "\n";
display(tout, c, true););
justification* js = nullptr;
if (proofs_enabled()) {
@ -1673,7 +1673,7 @@ namespace smt {
*/
literal theory_pb::get_asserting_literal(literal p) {
unsigned lvl = 0;
TRACE("pb", tout << p << " " << ctx.get_assignment(p) << "\n";);
TRACE(pb, tout << p << " " << ctx.get_assignment(p) << "\n";);
if (ctx.get_assignment(p) == l_false && get_abs_coeff(p.var()) != 0 && p == literal(p.var(), get_coeff(p.var()) < 0)) {
return p;
@ -1797,7 +1797,7 @@ namespace smt {
m_coeffs[v] /= static_cast<int>(g);
}
m_bound = (m_bound + g - 1) / g;
TRACE("pb", display_resolved_lemma(tout << "cut\n"););
TRACE(pb, display_resolved_lemma(tout << "cut\n"););
}
}
@ -1807,7 +1807,7 @@ namespace smt {
bool theory_pb::resolve_conflict(card& c, literal_vector const& confl) {
TRACE("pb", display(tout << "resolve conflict\n", c, true); );
TRACE(pb, display(tout << "resolve conflict\n", c, true); );
bool_var v;
m_conflict_lvl = 0;
@ -1851,7 +1851,7 @@ namespace smt {
while (m_num_marks > 0) {
TRACE("pb", tout << "conseq: " << conseq << "\n");
TRACE(pb, tout << "conseq: " << conseq << "\n");
v = conseq.var();
int offset = get_abs_coeff(v);
@ -1869,7 +1869,7 @@ namespace smt {
js = ctx.get_justification(v);
TRACE("pb",
TRACE(pb,
display_resolved_lemma(tout << conseq << "\n");
ctx.display(tout, js););
@ -1889,13 +1889,13 @@ namespace smt {
clause& cls = *js.get_clause();
justification* cjs = cls.get_justification();
unsigned num_lits = cls.get_num_literals();
CTRACE("pb", cjs, tout << (typeid(smt::unit_resolution_justification) == typeid(*cjs)) << "\n");
CTRACE(pb, cjs, tout << (typeid(smt::unit_resolution_justification) == typeid(*cjs)) << "\n");
if (cjs && typeid(smt::unit_resolution_justification) == typeid(*cjs)) {
clear_marks();
return false;
}
else if (cjs && !is_proof_justification(*cjs)) {
TRACE("pb", tout << "not processing justification over: " << conseq << " " << typeid(*cjs).name() << "\n";);
TRACE(pb, tout << "not processing justification over: " << conseq << " " << typeid(*cjs).name() << "\n";);
break;
}
if (cls.get_literal(0) == conseq) {
@ -1908,7 +1908,7 @@ namespace smt {
for (unsigned i = 2; i < num_lits; ++i) {
process_antecedent(cls.get_literal(i), offset);
}
TRACE("pb", tout << literal_vector(cls.get_num_literals(), cls.begin()) << "\n";);
TRACE(pb, tout << literal_vector(cls.get_num_literals(), cls.begin()) << "\n";);
break;
}
case b_justification::BIN_CLAUSE:
@ -1926,7 +1926,7 @@ namespace smt {
pbj = dynamic_cast<card_justification*>(j);
}
if (pbj == nullptr) {
TRACE("pb", tout << "skip justification for " << conseq << "\n";);
TRACE(pb, tout << "skip justification for " << conseq << "\n";);
bound = 0;
// this is possible when conseq is an assumption.
// The justification of conseq is itself,
@ -1975,7 +1975,7 @@ namespace smt {
}
SASSERT(validate_lemma());
TRACE("pb", display_resolved_lemma(tout << "done\n"););
TRACE(pb, display_resolved_lemma(tout << "done\n"););
normalize_active_coeffs();
@ -2016,7 +2016,7 @@ namespace smt {
++m_stats.m_num_resolves;
SASSERT(validate_antecedents(m_antecedents));
TRACE("pb", tout << "assign " << m_antecedents << " ==> " << alit << "\n";);
TRACE(pb, tout << "assign " << m_antecedents << " ==> " << alit << "\n";);
ctx.assign(alit, ctx.mk_justification(theory_propagation_justification(get_id(), ctx, m_antecedents.size(), m_antecedents.data(), alit, 0, nullptr)));
DEBUG_CODE(
@ -2082,7 +2082,7 @@ namespace smt {
sum += c.coeff(i);
}
}
CTRACE("pb", (sum >= c.k()),
CTRACE(pb, (sum >= c.k()),
display(tout << "invalid assign" , c, true);
for (literal lit : lits) tout << lit << " ";
tout << " => " << l << "\n";);
@ -2090,7 +2090,7 @@ namespace smt {
}
void theory_pb::validate_final_check() {
TRACE("pb", tout << "validate " << m_var_infos.size() << "\n";);
TRACE(pb, tout << "validate " << m_var_infos.size() << "\n";);
for (auto & vi : m_var_infos) {
if (vi.m_ineq) {
validate_final_check(*vi.m_ineq);
@ -2103,11 +2103,11 @@ namespace smt {
void theory_pb::validate_final_check(card& c) {
if (ctx.get_assignment(c.lit()) == l_undef) {
TRACE("pb", display(tout << "is undef ", c, true););
TRACE(pb, display(tout << "is undef ", c, true););
return;
}
if (!ctx.is_relevant(c.lit())) {
TRACE("pb", display(tout << "not relevant ", c, true););
TRACE(pb, display(tout << "not relevant ", c, true););
return;
}
@ -2123,7 +2123,7 @@ namespace smt {
break;
}
}
TRACE("pb_verbose", display(tout << "validate: ", c, true);
TRACE(pb_verbose, display(tout << "validate: ", c, true);
tout << "sum: " << sum << " " << maxsum << " ";
tout << ctx.get_assignment(c.lit()) << "\n";);
@ -2135,11 +2135,11 @@ namespace smt {
void theory_pb::validate_final_check(ineq& c) {
if (ctx.get_assignment(c.lit()) == l_undef) {
TRACE("pb", tout << c.lit() << " is undef\n";);
TRACE(pb, tout << c.lit() << " is undef\n";);
return;
}
if (!ctx.is_relevant(c.lit())) {
TRACE("pb", tout << c.lit() << " is not relevant\n";);
TRACE(pb, tout << c.lit() << " is not relevant\n";);
return;
}
numeral sum = numeral::zero(), maxsum = numeral::zero();
@ -2154,7 +2154,7 @@ namespace smt {
break;
}
}
TRACE("pb", display(tout << "validate: ", c, true);
TRACE(pb, display(tout << "validate: ", c, true);
tout << "sum: " << sum << " " << maxsum << " ";
tout << ctx.get_assignment(c.lit()) << "\n";
ctx.display(tout);

View file

@ -24,7 +24,7 @@ Revision History:
#include "smt/theory_recfun.h"
#define TRACEFN(x) TRACE("recfun", tout << x << '\n';)
#define TRACEFN(x) TRACE(recfun, tout << x << '\n';)
namespace smt {
@ -48,7 +48,7 @@ namespace smt {
}
bool theory_recfun::internalize_atom(app * atom, bool gate_ctx) {
TRACE("recfun", tout << mk_pp(atom, m) << " " << u().has_defs() << "\n");
TRACE(recfun, tout << mk_pp(atom, m) << " " << u().has_defs() << "\n");
if (!u().has_defs()) {
// if (u().is_defined(atom))
// throw default_exception("recursive atom definition is out of scope");

View file

@ -307,7 +307,7 @@ void theory_seq::init() {
m_max_unfolding_depth = ctx.get_fparams().m_seq_min_unfolding;
}
#define TRACEFIN(s) { TRACE("seq", tout << ">>" << s << "\n";); IF_VERBOSE(20, verbose_stream() << s << "\n"); }
#define TRACEFIN(s) { TRACE(seq, tout << ">>" << s << "\n";); IF_VERBOSE(20, verbose_stream() << s << "\n"); }
struct scoped_enable_trace {
scoped_enable_trace() {
@ -324,8 +324,8 @@ final_check_status theory_seq::final_check_eh() {
}
m_new_propagation = false;
TRACE("seq", display(tout << "level: " << ctx.get_scope_level() << "\n"););
TRACE("seq_verbose", ctx.display(tout););
TRACE(seq, display(tout << "level: " << ctx.get_scope_level() << "\n"););
TRACE(seq_verbose, ctx.display(tout););
if (simplify_and_solve_eqs()) {
++m_stats.m_solve_eqs;
@ -425,13 +425,13 @@ final_check_status theory_seq::final_check_eh() {
}
if (m_unhandled_expr) {
TRACEFIN("give_up");
TRACE("seq", tout << "unhandled: " << mk_pp(m_unhandled_expr, m) << "\n";);
TRACE(seq, tout << "unhandled: " << mk_pp(m_unhandled_expr, m) << "\n";);
return FC_GIVEUP;
}
if (is_solved()) {
//scoped_enable_trace _se;
TRACEFIN("is_solved");
TRACE("seq", display(tout););
TRACE(seq, display(tout););
return FC_DONE;
}
TRACEFIN("give_up");
@ -504,7 +504,7 @@ bool theory_seq::fixed_length(expr* len_e, bool is_zero, bool check_long_strings
expr_ref seq(e, m), head(m), tail(m);
TRACE("seq", tout << "Fixed: " << mk_bounded_pp(e, m, 2) << " " << lo << "\n";);
TRACE(seq, tout << "Fixed: " << mk_bounded_pp(e, m, 2) << " " << lo << "\n";);
literal a = mk_eq(len_e, m_autil.mk_numeral(lo, true), false);
if (ctx.get_assignment(a) == l_false)
return false;
@ -545,7 +545,7 @@ void theory_seq::propagate_non_empty(literal lit, expr* s) {
}
bool theory_seq::propagate_is_conc(expr* e, expr* conc) {
TRACE("seq", tout << mk_pp(conc, m) << " is non-empty\n";);
TRACE(seq, tout << mk_pp(conc, m) << " is non-empty\n";);
literal lit = ~mk_eq_empty(e);
if (ctx.get_assignment(lit) == l_true) {
propagate_lit(nullptr, 1, &lit, mk_eq(e, conc, false));
@ -592,13 +592,13 @@ bool theory_seq::check_extensionality(expr* e1, enode* n1, enode* n2) {
m_new_eqs.reset();
bool change = false;
if (!m_seq_rewrite.reduce_eq(e1, e2, m_new_eqs, change)) {
TRACE("seq", tout << "exclude " << mk_pp(o1, m) << " " << mk_pp(o2, m) << "\n";);
TRACE(seq, tout << "exclude " << mk_pp(o1, m) << " " << mk_pp(o2, m) << "\n";);
m_exclude.update(o1, o2);
return true;
}
for (auto const& p : m_new_eqs) {
if (m_exclude.contains(p.first, p.second)) {
TRACE("seq", tout << "excluded " << mk_pp(p.first, m) << " " << mk_pp(p.second, m) << "\n";);
TRACE(seq, tout << "excluded " << mk_pp(p.first, m) << " " << mk_pp(p.second, m) << "\n";);
return true;
}
}
@ -710,12 +710,12 @@ bool theory_seq::check_lts() {
bool theory_seq::is_solved() {
if (!m_eqs.empty()) {
TRACE("seq", tout << "(seq.giveup " << m_eqs[0].ls << " = " << m_eqs[0].rs << " is unsolved)\n";);
TRACE(seq, tout << "(seq.giveup " << m_eqs[0].ls << " = " << m_eqs[0].rs << " is unsolved)\n";);
IF_VERBOSE(10, verbose_stream() << "(seq.giveup " << m_eqs[0].ls << " = " << m_eqs[0].rs << " is unsolved)\n";);
return false;
}
if (!m_ncs.empty()) {
TRACE("seq", display_nc(tout << "(seq.giveup ", m_ncs[0]); tout << " is unsolved)\n";);
TRACE(seq, display_nc(tout << "(seq.giveup ", m_ncs[0]); tout << " is unsolved)\n";);
IF_VERBOSE(10, display_nc(verbose_stream() << "(seq.giveup ", m_ncs[0]); verbose_stream() << " is unsolved)\n";);
return false;
}
@ -777,7 +777,7 @@ bool theory_seq::propagate_lit(dependency* dep, unsigned n, literal const* _lits
ctx.mark_as_relevant(lit);
enode_pair_vector eqs;
linearize(dep, eqs, lits);
TRACE("seq",
TRACE(seq,
tout << "scope: " << ctx.get_scope_level() << "\n";
tout << lits << "\n";
ctx.display_detailed_literal(tout << "assert:", lit);
@ -803,7 +803,7 @@ void theory_seq::set_conflict(dependency* dep, literal_vector const& _lits) {
}
void theory_seq::set_conflict(enode_pair_vector const& eqs, literal_vector const& lits) {
TRACE("seq", display_deps(tout << "assert conflict:", lits, eqs););
TRACE(seq, display_deps(tout << "assert conflict:", lits, eqs););
ctx.set_conflict(
ctx.mk_justification(
ext_theory_conflict_justification(
@ -818,12 +818,12 @@ bool theory_seq::propagate_eq(dependency* dep, enode* n1, enode* n2) {
literal_vector lits;
enode_pair_vector eqs;
linearize(dep, eqs, lits);
TRACE("seq_verbose",
TRACE(seq_verbose,
tout << "assert: " << mk_bounded_pp(n1->get_expr(), m) << " = " << mk_bounded_pp(n2->get_expr(), m) << " <-\n";
display_deps(tout, dep);
);
TRACE("seq",
TRACE(seq,
tout << "assert: "
<< mk_bounded_pp(n1->get_expr(), m) << " = " << mk_bounded_pp(n2->get_expr(), m) << " <-\n"
<< lits << "\n";
@ -906,14 +906,14 @@ bool theory_seq::simplify_eq(expr_ref_vector& ls, expr_ref_vector& rs, dependenc
expr_ref_pair_vector& new_eqs = m_new_eqs;
new_eqs.reset();
bool changed = false;
TRACE("seq",
TRACE(seq,
for (expr* l : ls) tout << "s#" << l->get_id() << " " << mk_bounded_pp(l, m, 2) << "\n";
tout << " = \n";
for (expr* r : rs) tout << "s#" << r->get_id() << " " << mk_bounded_pp(r, m, 2) << "\n";);
if (!m_seq_rewrite.reduce_eq(ls, rs, new_eqs, changed)) {
// equality is inconsistent.
TRACE("seq_verbose", tout << ls << " != " << rs << "\n";);
TRACE(seq_verbose, tout << ls << " != " << rs << "\n";);
set_conflict(deps);
return true;
}
@ -922,7 +922,7 @@ bool theory_seq::simplify_eq(expr_ref_vector& ls, expr_ref_vector& rs, dependenc
SASSERT(new_eqs.empty());
return false;
}
TRACE("seq",
TRACE(seq,
tout << "reduced to\n";
for (auto p : new_eqs) {
tout << mk_bounded_pp(p.first, m, 2) << "\n";
@ -932,10 +932,10 @@ bool theory_seq::simplify_eq(expr_ref_vector& ls, expr_ref_vector& rs, dependenc
);
m_seq_rewrite.add_seqs(ls, rs, new_eqs);
if (new_eqs.empty()) {
TRACE("seq", tout << "solved\n";);
TRACE(seq, tout << "solved\n";);
return true;
}
TRACE("seq_verbose",
TRACE(seq_verbose,
tout << ls << " = " << rs << "\n";);
for (auto const& p : new_eqs) {
if (ctx.inconsistent())
@ -950,14 +950,14 @@ bool theory_seq::simplify_eq(expr_ref_vector& ls, expr_ref_vector& rs, dependenc
}
}
else if (m_util.is_seq(li) || m_util.is_re(li)) {
TRACE("seq_verbose", tout << "inserting " << li << " = " << ri << "\n";);
TRACE(seq_verbose, tout << "inserting " << li << " = " << ri << "\n";);
m_eqs.push_back(mk_eqdep(li, ri, deps));
}
else {
propagate_eq(deps, ensure_enode(li), ensure_enode(ri));
}
}
TRACE("seq_verbose",
TRACE(seq_verbose,
if (!ls.empty() || !rs.empty()) tout << ls << " = " << rs << ";\n";
for (auto const& p : new_eqs) {
tout << mk_pp(p.first, m) << " = " << mk_pp(p.second, m) << ";\n";
@ -994,7 +994,7 @@ bool theory_seq::add_solution(expr* l, expr* r, dependency* deps) {
m_rep.update(l, r, deps);
enode* n1 = ensure_enode(l);
enode* n2 = ensure_enode(r);
TRACE("seq", tout << mk_bounded_pp(l, m, 2) << " ==> " << mk_bounded_pp(r, m, 2) << "\n"; display_deps(tout, deps);
TRACE(seq, tout << mk_bounded_pp(l, m, 2) << " ==> " << mk_bounded_pp(r, m, 2) << "\n"; display_deps(tout, deps);
tout << "#" << n1->get_owner_id() << " ==> #" << n2->get_owner_id() << "\n";
tout << (n1->get_root() == n2->get_root()) << "\n";);
propagate_eq(deps, n1, n2);
@ -1034,7 +1034,7 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con
SASSERT(!lhs.empty() || !rhs.empty());
deps = mk_join(deps, lits);
m_eqs.push_back(depeq(m_eq_id++, lhs, rhs, deps));
TRACE("seq", tout << "Propagate equal lengths " << l << " " << r << "\n";);
TRACE(seq, tout << "Propagate equal lengths " << l << " " << r << "\n";);
propagate_eq(deps, lits, l, r, true);
return true;
}
@ -1046,7 +1046,7 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con
rhs.append(rs.size()-1, rs.data());
SASSERT(!lhs.empty() || !rhs.empty());
deps = mk_join(deps, lits);
TRACE("seq", tout << "Propagate equal lengths " << l << " " << r << "\n" << "ls: " << ls << "\nrs: " << rs << "\n";);
TRACE(seq, tout << "Propagate equal lengths " << l << " " << r << "\n" << "ls: " << ls << "\nrs: " << rs << "\n";);
m_eqs.push_back(depeq(m_eq_id++, lhs, rhs, deps));
propagate_eq(deps, lits, l, r, true);
return true;
@ -1059,7 +1059,7 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con
len2 += len;
}
if (len1 == len2 && 0 < j && j < rs.size() && reduce_length(1, j, true, ls, rs, deps)) {
TRACE("seq", tout << "l equal\n";);
TRACE(seq, tout << "l equal\n";);
return true;
}
}
@ -1069,7 +1069,7 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con
len2 += len;
}
if (len1 == len2 && 0 < j && j < ls.size() && reduce_length(j, 1, true, ls, rs, deps)) {
TRACE("seq", tout << "r equal\n";);
TRACE(seq, tout << "r equal\n";);
return true;
}
}
@ -1079,7 +1079,7 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con
len2 += len;
}
if (len1 == len2 && 0 < j && j < rs.size() && reduce_length(ls.size()-1, rs.size()-j, false, ls, rs, deps)) {
TRACE("seq", tout << "l suffix equal\n";);
TRACE(seq, tout << "l suffix equal\n";);
return true;
}
}
@ -1089,7 +1089,7 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con
len2 += len;
}
if (len1 == len2 && 0 < j && j < ls.size() && reduce_length(ls.size()-j, rs.size()-1, false, ls, rs, deps)) {
TRACE("seq", tout << "r suffix equal\n";);
TRACE(seq, tout << "r suffix equal\n";);
return true;
}
}
@ -1132,7 +1132,7 @@ bool theory_seq::reduce_length(unsigned i, unsigned j, bool front, expr_ref_vect
deps = mk_join(deps, lit);
m_eqs.push_back(depeq(m_eq_id++, lhs, rhs, deps));
propagate_eq(deps, l, r, true);
TRACE("seq", tout << "propagate eq\n" << m_eqs.size() << "\nlhs: " << lhs << "\nrhs: " << rhs << "\n";);
TRACE(seq, tout << "propagate eq\n" << m_eqs.size() << "\nlhs: " << lhs << "\nrhs: " << rhs << "\n";);
return true;
}
else {
@ -1172,7 +1172,7 @@ bool theory_seq::get_length(expr* e, expr_ref& len, literal_vector& lits) {
lits.append(4, _lits);
return true;
}
TRACE("seq", tout << mk_pp(e, m) << "\n"; ctx.display_literals_verbose(tout, 4, _lits); tout << "\n";
TRACE(seq, tout << mk_pp(e, m) << "\n"; ctx.display_literals_verbose(tout, 4, _lits); tout << "\n";
for (unsigned i = 0; i < 4; ++i) tout << ctx.get_assignment(_lits[i]) << "\n";);
}
else if (m_util.str.is_at(e, s, i)) {
@ -1185,7 +1185,7 @@ bool theory_seq::get_length(expr* e, expr_ref& len, literal_vector& lits) {
ctx.get_assignment(i_lt_len_s) == l_true) {
len = m_autil.mk_int(1);
lits.append(2, _lits);
TRACE("seq", ctx.display_literals_verbose(tout, 2, _lits); tout << "\n";);
TRACE(seq, ctx.display_literals_verbose(tout, 2, _lits); tout << "\n";);
return true;
}
}
@ -1198,7 +1198,7 @@ bool theory_seq::get_length(expr* e, expr_ref& len, literal_vector& lits) {
ctx.get_assignment(i_lt_len_s) == l_true) {
len = i;
lits.append(2, _lits);
TRACE("seq", ctx.display_literals_verbose(tout << "pre length", 2, _lits); tout << "\n";);
TRACE(seq, ctx.display_literals_verbose(tout << "pre length", 2, _lits); tout << "\n";);
return true;
}
}
@ -1210,7 +1210,7 @@ bool theory_seq::get_length(expr* e, expr_ref& len, literal_vector& lits) {
ctx.get_assignment(len_s_ge_i) == l_true) {
len = mk_sub(mk_len(s), i);
lits.append(2, _lits);
TRACE("seq", ctx.display_literals_verbose(tout << "post length " << len << "\n", 2, _lits) << "\n";);
TRACE(seq, ctx.display_literals_verbose(tout << "post length " << len << "\n", 2, _lits) << "\n";);
return true;
}
}
@ -1224,12 +1224,12 @@ bool theory_seq::get_length(expr* e, expr_ref& len, literal_vector& lits) {
case l_true:
len = mk_sub(mk_sub(len_s, l), m_autil.mk_int(1));
lits.push_back(len_s_gt_l);
TRACE("seq", ctx.display_literals_verbose(tout << "tail length " << len << "\n", lits) << "\n";);
TRACE(seq, ctx.display_literals_verbose(tout << "tail length " << len << "\n", lits) << "\n";);
return true;
case l_false:
len = m_autil.mk_int(0);
lits.push_back(~len_s_gt_l);
TRACE("seq", ctx.display_literals_verbose(tout << "tail length " << len << "\n", lits) << "\n";);
TRACE(seq, ctx.display_literals_verbose(tout << "tail length " << len << "\n", lits) << "\n";);
return true;
default:
break;
@ -1271,7 +1271,7 @@ bool theory_seq::solve_nc(unsigned idx) {
expr* a = nullptr, *b = nullptr;
VERIFY(m_util.str.is_contains(n.contains(), a, b));
lbool is_gt = ctx.get_assignment(len_gt);
TRACE("seq", ctx.display_literal_smt2(tout << len_gt << " := " << is_gt << "\n", len_gt) << "\n";);
TRACE(seq, ctx.display_literal_smt2(tout << len_gt << " := " << is_gt << "\n", len_gt) << "\n";);
switch (is_gt) {
case l_true:
@ -1354,7 +1354,7 @@ bool theory_seq::explain_eq(expr* e1, expr* e2, dependency*& dep) {
unfold(c2, v2);
unsigned i = 0, j = 0;
TRACE("seq",
TRACE(seq,
tout << "1:\n";
display_explain(tout, 0, e1);
tout << "2:\n";
@ -1385,7 +1385,7 @@ bool theory_seq::explain_eq(expr* e1, expr* e2, dependency*& dep) {
if (e1 == e2) {
if (c1->m_parent && c2->m_parent &&
c1->m_parent->m_expr == c2->m_parent->m_expr) {
TRACE("seq", tout << "parent: " << mk_pp(e1, m) << " " << mk_pp(c1->m_parent->m_expr, m) << "\n";);
TRACE(seq, tout << "parent: " << mk_pp(e1, m) << " " << mk_pp(c1->m_parent->m_expr, m) << "\n";);
c1 = c1->m_parent;
c2 = c2->m_parent;
v1[c1->m_last] = c1;
@ -1420,7 +1420,7 @@ bool theory_seq::explain_eq(expr* e1, expr* e2, dependency*& dep) {
}
}
else {
TRACE("seq", tout << "Could not solve " << mk_pp(e1, m) << " = " << mk_pp(e2, m) << "\n";);
TRACE(seq, tout << "Could not solve " << mk_pp(e1, m) << " = " << mk_pp(e2, m) << "\n";);
result = false;
break;
}
@ -1443,7 +1443,7 @@ bool theory_seq::explain_empty(expr_ref_vector& es, dependency*& dep) {
m_util.str.get_concat_units(a, es);
continue;
}
TRACE("seq", tout << "Could not set to empty: " << es << "\n";);
TRACE(seq, tout << "Could not set to empty: " << es << "\n";);
return false;
}
return true;
@ -1531,7 +1531,7 @@ void theory_seq::add_length(expr* l) {
VERIFY(m_util.str.is_length(l, e));
if (has_length(e))
return;
TRACE("seq", tout << mk_bounded_pp(e, m, 2) << "\n";);
TRACE(seq, tout << mk_bounded_pp(e, m, 2) << "\n";);
m_length.push_back(l);
m_has_length.insert(e);
m_trail_stack.push(push_back_vector<expr_ref_vector>(m_length));
@ -2027,7 +2027,7 @@ public:
add_buffer(sbuffer, zs);
}
else {
TRACE("seq", tout << "Not a string: " << tmp << "\n";);
TRACE(seq, tout << "Not a string: " << tmp << "\n";);
}
++k;
break;
@ -2048,7 +2048,7 @@ public:
break;
}
}
// TRACE("seq", tout << src << " " << sbuffer << "\n";);
// TRACE(seq, tout << src << " " << sbuffer << "\n";);
}
result = th.m_util.str.mk_string(zstring(sbuffer.size(), sbuffer.data()));
}
@ -2070,7 +2070,7 @@ public:
th.m_str_rewrite(result);
}
th.m_factory->add_trail(result);
TRACE("seq", tout << pp(m_node, th.m) << " -> " << result << "\n";);
TRACE(seq, tout << pp(m_node, th.m) << " -> " << result << "\n";);
return to_app(result);
}
};
@ -2096,7 +2096,7 @@ app* theory_seq::get_ite_value(expr* e) {
model_value_proc * theory_seq::mk_value(enode * n, model_generator & mg) {
app* e = n->get_expr();
TRACE("seq", tout << mk_pp(e, m) << "\n";);
TRACE(seq, tout << mk_pp(e, m) << "\n";);
// Shortcut for well-founded values to avoid some quadratic overhead
expr* x = nullptr, *y = nullptr, *z = nullptr;
@ -2118,18 +2118,18 @@ model_value_proc * theory_seq::mk_value(enode * n, model_generator & mg) {
seq_value_proc* sv = alloc(seq_value_proc, *this, n, srt);
unsigned end = m_concat.size();
TRACE("seq", tout << "sequence: " << start << " " << end << " " << mk_pp(e, m) << "\n";);
TRACE(seq, tout << "sequence: " << start << " " << end << " " << mk_pp(e, m) << "\n";);
for (unsigned i = start; i < end; ++i) {
expr* c = m_concat[i];
expr *c1;
TRACE("seq", tout << "elem: " << mk_pp(c, m) << "\n";);
TRACE(seq, tout << "elem: " << mk_pp(c, m) << "\n";);
if (m_util.str.is_unit(c, c1)) {
if (ctx.e_internalized(c1))
sv->add_unit(ctx.get_enode(c1));
else if (m.is_value(c1))
sv->add_string(c);
else {
TRACE("seq", tout << "not internalized " << mk_pp(c, m) << "\n";);
TRACE(seq, tout << "not internalized " << mk_pp(c, m) << "\n";);
}
}
else if (m_util.str.is_itos(c, c1)) {
@ -2142,7 +2142,7 @@ model_value_proc * theory_seq::mk_value(enode * n, model_generator & mg) {
}
else {
app_ref val(mk_value(to_app(c)), m);
TRACE("seq", tout << "WARNING: " << val << " is prone to result in incorrect model\n";);
TRACE(seq, tout << "WARNING: " << val << " is prone to result in incorrect model\n";);
sv->add_string(val);
}
}
@ -2172,7 +2172,7 @@ app* theory_seq::mk_value(app* e) {
m_rewrite(result);
}
m_factory->add_trail(result);
TRACE("seq", tout << mk_pp(e, m) << " -> " << result << "\n";);
TRACE(seq, tout << mk_pp(e, m) << " -> " << result << "\n";);
m_rep.update(e, result, nullptr);
return to_app(result);
}
@ -2424,7 +2424,7 @@ void theory_seq::validate_fmls(enode_pair_vector const& eqs, literal_vector cons
for (auto const& p : eqs) {
fmls.push_back(m.mk_eq(p.first->get_expr(), p.second->get_expr()));
}
TRACE("seq", tout << fmls << "\n";);
TRACE(seq, tout << fmls << "\n";);
for (unsigned i = 0; i < fmls.size(); ++i) {
fml = elim_skolem(fmls.get(i));
@ -2438,7 +2438,7 @@ void theory_seq::validate_fmls(enode_pair_vector const& eqs, literal_vector cons
if (r == l_true) {
model_ref mdl;
k.get_model(mdl);
TRACE("seq", tout << "failed to validate\n" << *mdl << "\n");
TRACE(seq, tout << "failed to validate\n" << *mdl << "\n");
IF_VERBOSE(0,
verbose_stream() << r << "\n" << fmls << "\n";
verbose_stream() << *mdl.get() << "\n";
@ -2472,9 +2472,9 @@ bool theory_seq::canonize(expr* e, dependency*& eqs, expr_ref& result) {
if (!expand(e, eqs, result)) {
return false;
}
TRACE("seq", tout << mk_bounded_pp(e, m, 2) << " expands to\n" << mk_bounded_pp(result, m, 2) << "\n";);
TRACE(seq, tout << mk_bounded_pp(e, m, 2) << " expands to\n" << mk_bounded_pp(result, m, 2) << "\n";);
m_rewrite(result);
TRACE("seq", tout << mk_bounded_pp(e, m, 2) << " rewrites to\n" << mk_bounded_pp(result, m, 2) << "\n";);
TRACE(seq, tout << mk_bounded_pp(e, m, 2) << " rewrites to\n" << mk_bounded_pp(result, m, 2) << "\n";);
return true;
}
@ -2654,7 +2654,7 @@ bool theory_seq::expand1(expr* e0, dependency*& eqs, expr_ref& result) {
case l_undef:
ctx.mark_as_relevant(lit);
m_new_propagation = true;
TRACE("seq", tout << "undef: " << mk_bounded_pp(e, m, 2) << "\n";
TRACE(seq, tout << "undef: " << mk_bounded_pp(e, m, 2) << "\n";
tout << lit << "@ level: " << ctx.get_scope_level() << "\n";);
return false;
}
@ -2668,7 +2668,7 @@ bool theory_seq::expand1(expr* e0, dependency*& eqs, expr_ref& result) {
expr_dep edr(e0, result, deps);
m_rep.add_cache(edr);
eqs = m_dm.mk_join(eqs, deps);
TRACE("seq_verbose", tout << mk_pp(e0, m) << " |--> " << result << "\n";
TRACE(seq_verbose, tout << mk_pp(e0, m) << " |--> " << result << "\n";
if (eqs) display_deps(tout, eqs););
return true;
}
@ -2690,7 +2690,7 @@ void theory_seq::propagate() {
++m_axioms_head;
}
while (!m_replay.empty() && !ctx.inconsistent()) {
TRACE("seq", tout << "replay at level: " << ctx.get_scope_level() << "\n";);
TRACE(seq, tout << "replay at level: " << ctx.get_scope_level() << "\n";);
apply& app = *m_replay[m_replay.size() - 1];
app(*this);
m_replay.pop_back();
@ -2703,7 +2703,7 @@ void theory_seq::propagate() {
void theory_seq::enque_axiom(expr* e) {
if (!m_axiom_set.contains(e)) {
TRACE("seq", tout << "add axiom " << mk_bounded_pp(e, m) << "\n";);
TRACE(seq, tout << "add axiom " << mk_bounded_pp(e, m) << "\n";);
m_axioms.push_back(e);
m_axiom_set.insert(e);
m_trail_stack.push(push_back_vector<expr_ref_vector>(m_axioms));
@ -2712,7 +2712,7 @@ void theory_seq::enque_axiom(expr* e) {
}
void theory_seq::deque_axiom(expr* n) {
TRACE("seq", tout << "deque: " << mk_bounded_pp(n, m, 2) << "\n";);
TRACE(seq, tout << "deque: " << mk_bounded_pp(n, m, 2) << "\n";);
if (m_util.str.is_length(n)) {
add_length(n);
m_ax.add_length_axiom(n);
@ -2777,7 +2777,7 @@ void theory_seq::deque_axiom(expr* n) {
expr_ref theory_seq::add_elim_string_axiom(expr* n) {
zstring s;
TRACE("seq", tout << mk_pp(n, m) << "\n";);
TRACE(seq, tout << mk_pp(n, m) << "\n";);
VERIFY(m_util.str.is_string(n, s));
if (s.length() == 0) {
return expr_ref(n, m);
@ -2874,18 +2874,18 @@ bool theory_seq::get_length(expr* e, rational& val) {
len = mk_len(c);
if (!has_length(c)) {
add_axiom(mk_literal(m_autil.mk_ge(len, m_autil.mk_int(0))));
TRACE("seq", tout << "literal has no length " << mk_pp(c, m) << "\n";);
TRACE(seq, tout << "literal has no length " << mk_pp(c, m) << "\n";);
return false;
}
else if (m_arith_value.get_value(len, val1) && !val1.is_neg())
val += val1;
else {
TRACE("seq", tout << "length has not been internalized " << mk_pp(c, m) << "\n";);
TRACE(seq, tout << "length has not been internalized " << mk_pp(c, m) << "\n";);
return false;
}
}
}
CTRACE("seq", !val.is_int(), tout << "length is not an integer\n";);
CTRACE(seq, !val.is_int(), tout << "length is not an integer\n";);
return val.is_int();
}
@ -2894,7 +2894,7 @@ bool theory_seq::get_length(expr* e, rational& val) {
lit => s = (nth s 0) ++ (nth s 1) ++ ... ++ (nth s idx) ++ (tail s idx)
*/
void theory_seq::ensure_nth(literal lit, expr* s, expr* idx) {
TRACE("seq", tout << "ensure-nth: " << lit << " " << mk_bounded_pp(s, m, 2) << " " << mk_bounded_pp(idx, m, 2) << "\n";);
TRACE(seq, tout << "ensure-nth: " << lit << " " << mk_bounded_pp(s, m, 2) << " " << mk_bounded_pp(idx, m, 2) << "\n";);
rational r;
SASSERT(ctx.get_assignment(lit) == l_true);
VERIFY(m_autil.is_numeral(idx, r) && r.is_unsigned());
@ -2967,7 +2967,7 @@ void theory_seq::add_axiom(literal l1, literal l2, literal l3, literal l4, liter
}
void theory_seq::add_axiom(literal_vector & lits) {
TRACE("seq", ctx.display_literals_verbose(tout << "assert " << lits << " :", lits) << "\n";);
TRACE(seq, ctx.display_literals_verbose(tout << "assert " << lits << " :", lits) << "\n";);
for (literal lit : lits)
if (ctx.get_assignment(lit) == l_true)
@ -3024,11 +3024,11 @@ bool theory_seq::propagate_eq(dependency* deps, literal_vector const& _lits, exp
deps = mk_join(deps, _lits);
new_eq_eh(deps, n1, n2);
}
TRACE("seq_verbose",
TRACE(seq_verbose,
tout << "assert: #" << e1->get_id() << " " << mk_pp(e1, m) << " = " << mk_pp(e2, m) << " <- \n";
if (!lits.empty()) { ctx.display_literals_verbose(tout, lits) << "\n"; });
TRACE("seq",
TRACE(seq,
tout << "assert:" << mk_bounded_pp(e1, m, 2) << " = " << mk_bounded_pp(e2, m, 2) << " <- \n";
tout << lits << "\n";
tout << "#" << e1->get_id() << "\n";
@ -3053,8 +3053,8 @@ void theory_seq::assign_eh(bool_var v, bool is_true) {
expr* e1 = nullptr, *e2 = nullptr;
expr_ref f(m);
literal lit(v, !is_true);
TRACE("seq", tout << (is_true?"":"not ") << mk_bounded_pp(e, m) << "\n";);
TRACE("seq", tout << (is_true?"":"not ") << mk_bounded_pp(e, m) << " " << ctx.get_scope_level() << " " << lit << "\n";);
TRACE(seq, tout << (is_true?"":"not ") << mk_bounded_pp(e, m) << "\n";);
TRACE(seq, tout << (is_true?"":"not ") << mk_bounded_pp(e, m) << " " << ctx.get_scope_level() << " " << lit << "\n";);
if (m_util.str.is_prefix(e, e1, e2)) {
if (is_true) {
@ -3157,7 +3157,7 @@ void theory_seq::assign_eh(bool_var v, bool is_true) {
}
else {
TRACE("seq", tout << mk_pp(e, m) << "\n";);
TRACE(seq, tout << mk_pp(e, m) << "\n";);
IF_VERBOSE(0, verbose_stream() << mk_pp(e, m) << "\n");
UNREACHABLE();
}
@ -3182,7 +3182,7 @@ void theory_seq::new_eq_eh(theory_var v1, theory_var v2) {
void theory_seq::new_eq_eh(dependency* deps, enode* n1, enode* n2) {
expr* e1 = n1->get_expr();
expr* e2 = n2->get_expr();
TRACE("seq", tout << mk_bounded_pp(e1, m) << " = " << mk_bounded_pp(e2, m) << "\n";);
TRACE(seq, tout << mk_bounded_pp(e1, m) << " = " << mk_bounded_pp(e2, m) << "\n";);
if (n1 != n2 && m_util.is_seq(e1)) {
theory_var v1 = n1->get_th_var(get_id());
theory_var v2 = n2->get_th_var(get_id());
@ -3194,7 +3194,7 @@ void theory_seq::new_eq_eh(dependency* deps, enode* n1, enode* n2) {
m_find.merge(v1, v2);
expr_ref o1(e1, m);
expr_ref o2(e2, m);
TRACE("seq", tout << mk_bounded_pp(o1, m) << " = " << mk_bounded_pp(o2, m) << "\n";);
TRACE(seq, tout << mk_bounded_pp(o1, m) << " = " << mk_bounded_pp(o2, m) << "\n";);
m_eqs.push_back(mk_eqdep(o1, o2, deps));
solve_eqs(m_eqs.size()-1);
enforce_length_coherence(n1, n2);
@ -3219,7 +3219,7 @@ void theory_seq::new_diseq_eh(theory_var v1, theory_var v2) {
return;
m_exclude.update(e1, e2);
expr_ref eq(m.mk_eq(e1, e2), m);
TRACE("seq", tout << "new disequality " << ctx.get_scope_level() << ": " << mk_bounded_pp(eq, m, 2) << "\n";);
TRACE(seq, tout << "new disequality " << ctx.get_scope_level() << ": " << mk_bounded_pp(eq, m, 2) << "\n";);
m_rewrite(eq);
if (!m.is_false(eq)) {
literal lit = mk_eq(e1, e2, false);
@ -3336,7 +3336,7 @@ void theory_seq::add_unhandled_expr(expr* n) {
void theory_seq::add_theory_assumptions(expr_ref_vector & assumptions) {
if (m_has_seq) {
TRACE("seq", tout << "add_theory_assumption\n";);
TRACE(seq, tout << "add_theory_assumption\n";);
expr_ref dlimit = m_sk.mk_max_unfolding_depth(m_max_unfolding_depth);
m_trail_stack.push(value_trail<literal>(m_max_unfolding_lit));
m_max_unfolding_lit = mk_literal(dlimit);
@ -3349,7 +3349,7 @@ void theory_seq::add_theory_assumptions(expr_ref_vector & assumptions) {
}
bool theory_seq::should_research(expr_ref_vector & unsat_core) {
TRACE("seq", tout << unsat_core << " " << m_util.has_re() << "\n";);
TRACE(seq, tout << unsat_core << " " << m_util.has_re() << "\n";);
if (!m_has_seq)
return false;
unsigned k_min = UINT_MAX, k = 0, n = 0;
@ -3451,11 +3451,11 @@ bool theory_seq::canonizes(bool is_true, expr* e) {
dependency* deps = nullptr;
expr_ref cont(m);
if (!canonize(e, deps, cont)) cont = e;
TRACE("seq", tout << is_true << ": " << mk_bounded_pp(e, m, 2) << " -> " << mk_bounded_pp(cont, m, 2) << "\n";
TRACE(seq, tout << is_true << ": " << mk_bounded_pp(e, m, 2) << " -> " << mk_bounded_pp(cont, m, 2) << "\n";
if (deps) display_deps(tout, deps););
if ((m.is_true(cont) && !is_true) ||
(m.is_false(cont) && is_true)) {
TRACE("seq", display(tout); tout << ctx.get_assignment(ctx.get_literal(e)) << "\n";);
TRACE(seq, display(tout); tout << ctx.get_assignment(ctx.get_literal(e)) << "\n";);
literal lit = ctx.get_literal(e);
if (is_true) lit.neg();
propagate_lit(deps, 0, nullptr, lit);
@ -3463,7 +3463,7 @@ bool theory_seq::canonizes(bool is_true, expr* e) {
}
if ((m.is_false(cont) && !is_true) ||
(m.is_true(cont) && is_true)) {
TRACE("seq", display(tout););
TRACE(seq, display(tout););
return true;
}
return false;

View file

@ -155,7 +155,7 @@ namespace smt {
ctx.set_var_theory(v, get_id());
atom* a = alloc(atom, v, *r, v0, v1);
m_atoms.push_back(a);
TRACE("special_relations", tout << mk_pp(atm, m) << " : bv" << v << " v" << a->v1() << " v" << a->v2() << ' ' << gate_ctx << "\n";);
TRACE(special_relations, tout << mk_pp(atm, m) << " : bv" << v << " v" << a->v1() << " v" << a->v2() << ' ' << gate_ctx << "\n";);
m_bool_var2atom.insert(v, a);
return true;
}
@ -167,7 +167,7 @@ namespace smt {
theory_var v = n->get_th_var(get_id());
if (null_theory_var == v) {
v = theory::mk_var(n);
TRACE("special_relations", tout << "v" << v << " := " << mk_pp(e, get_manager()) << "\n";);
TRACE(special_relations, tout << "v" << v << " := " << mk_pp(e, get_manager()) << "\n";);
ctx.attach_th_var(n, this, v);
}
return v;
@ -187,7 +187,7 @@ namespace smt {
}
final_check_status theory_special_relations::final_check_eh() {
TRACE("special_relations", tout << "\n";);
TRACE(special_relations, tout << "\n";);
for (auto const& kv : m_relations) {
lbool r = final_check(*kv.m_value);
switch (r) {
@ -286,12 +286,12 @@ namespace smt {
literal consequent = ctx.get_literal(tc_app);
ctx.mark_as_relevant(consequent);
justification* j = ctx.mk_justification(theory_propagation_justification(get_id(), ctx, 1, &lit, consequent));
TRACE("special_relations", tout << "propagate: " << tc_app << "\n";);
TRACE(special_relations, tout << "propagate: " << tc_app << "\n";);
ctx.assign(consequent, j);
new_assertion = true;
}
else {
TRACE("special_relations", tout << "add edge " << tc_app << " relevant: " << ctx.is_relevant(tcn) << "\n");
TRACE(special_relations, tout << "add edge " << tc_app << " relevant: " << ctx.is_relevant(tcn) << "\n");
theory_var v1 = get_representative(get_th_var(arg1));
theory_var v2 = get_representative(get_th_var(arg2));
r_graph.init_var(v1);
@ -325,7 +325,7 @@ namespace smt {
theory_var r1 = get_representative(a.v1());
theory_var r2 = get_representative(a.v2());
if (r_graph.can_reach(r1, r2)) {
TRACE("special_relations",
TRACE(special_relations,
tout << a.v1() << ": " << mk_pp(arg1, m) << " -> "
<< a.v2() << ": " << mk_pp(arg2, m) << " is positive reachable\n";
r.m_graph.display(tout);
@ -386,14 +386,14 @@ namespace smt {
}
case l_undef:
ctx.set_true_first_flag(bv);
TRACE("special_relations", tout << f_app << " is undefined\n";);
TRACE(special_relations, tout << f_app << " is undefined\n";);
new_assertion = true;
break;
}
}
}
if (new_assertion) {
TRACE("special_relations", tout << "new assertion\n";);
TRACE(special_relations, tout << "new assertion\n";);
return l_false;
}
return final_check_po(r);
@ -407,14 +407,14 @@ namespace smt {
if (a.phase()) {
continue;
}
TRACE("special_relations", tout << a.v1() << " !<= " << a.v2() << "\n";);
TRACE(special_relations, tout << a.v1() << " !<= " << a.v2() << "\n";);
target.reset();
theory_var w;
// v1 !<= v2 is asserted
target.insert(a.v1());
if (r.m_graph.reachable(a.v2(), target, visited, w)) {
// we already have v2 <= v1
TRACE("special_relations", tout << "already: " << a.v2() << " <= " << a.v1() << "\n";);
TRACE(special_relations, tout << "already: " << a.v2() << " <= " << a.v1() << "\n";);
continue;
}
if (a.v1() == a.v2()) {
@ -439,7 +439,7 @@ namespace smt {
r.m_explanation.reset();
r.m_graph.find_shortest_reachable_path(a.v1(), w, timestamp, r);
r.m_graph.find_shortest_reachable_path(a.v2(), w, timestamp, r);
TRACE("special_relations", tout << "added edge\n";);
TRACE(special_relations, tout << "added edge\n";);
r.m_explanation.push_back(a.explanation());
literal_vector const& lits = r.m_explanation;
if (!r.m_graph.add_non_strict_edge(a.v2(), a.v1(), lits)) {
@ -482,7 +482,7 @@ namespace smt {
void theory_special_relations::set_conflict(relation& r) {
literal_vector const& lits = r.m_explanation;
TRACE("special_relations", ctx.display_literals_verbose(tout, lits) << "\n";);
TRACE(special_relations, ctx.display_literals_verbose(tout, lits) << "\n";);
vector<parameter> params;
ctx.set_conflict(
ctx.mk_justification(
@ -515,7 +515,7 @@ namespace smt {
res = l_undef;
break;
}
TRACE("special_relations", r.display(*this, tout << res << "\n"););
TRACE(special_relations, r.display(*this, tout << res << "\n"););
return res;
}
@ -548,7 +548,7 @@ namespace smt {
r.m_graph.find_shortest_zero_edge_path(i, j, timestamp, r);
r.m_graph.find_shortest_zero_edge_path(j, i, timestamp, r);
literal_vector const& lits = r.m_explanation;
TRACE("special_relations", ctx.display_literals_verbose(tout << mk_pp(x->get_expr(), m) << " = " << mk_pp(y->get_expr(), m) << "\n", lits) << "\n";);
TRACE(special_relations, ctx.display_literals_verbose(tout << mk_pp(x->get_expr(), m) << " = " << mk_pp(y->get_expr(), m) << "\n", lits) << "\n";);
IF_VERBOSE(20, ctx.display_literals_verbose(verbose_stream() << mk_pp(x->get_expr(), m) << " = " << mk_pp(y->get_expr(), m) << "\n", lits) << "\n";);
eq_justification js(ctx.mk_justification(ext_theory_eq_propagation_justification(get_id(), ctx, lits.size(), lits.data(), 0, nullptr,
x, y)));
@ -607,9 +607,9 @@ namespace smt {
r.m_explanation.reset();
unsigned timestamp = r.m_graph.get_timestamp();
bool found_path = a.v1() == a.v2() || r.m_graph.find_shortest_reachable_path(a.v1(), a.v2(), timestamp, r);
TRACE("special_relations", tout << "check " << a.v1() << " -> " << a.v2() << " found_path: " << found_path << "\n");
TRACE(special_relations, tout << "check " << a.v1() << " -> " << a.v2() << " found_path: " << found_path << "\n");
if (found_path) {
TRACE("special_relations", tout << "check po conflict\n";);
TRACE(special_relations, tout << "check po conflict\n";);
r.m_explanation.push_back(a.explanation());
set_conflict(r);
return l_false;
@ -663,7 +663,7 @@ namespace smt {
}
void theory_special_relations::assign_eh(bool_var v, bool is_true) {
TRACE("special_relations", tout << "assign bv" << v << " " << (is_true?" <- true":" <- false") << "\n";);
TRACE(special_relations, tout << "assign bv" << v << " " << (is_true?" <- true":" <- false") << "\n";);
atom* a = m_bool_var2atom[v];
a->set_phase(is_true);
a->get_relation().m_asserted_atoms.push_back(a);
@ -722,7 +722,7 @@ namespace smt {
if (get_enode(src)->get_root() == get_enode(dst)->get_root()) continue;
VERIFY(g.add_strict_edge(src, dst, literal_vector()));
}
TRACE("special_relations", g.display(tout););
TRACE(special_relations, g.display(tout););
}
/**
@ -749,7 +749,7 @@ namespace smt {
}
}
}
TRACE("special_relations", g.display(tout););
TRACE(special_relations, g.display(tout););
}
bool theory_special_relations::disconnected(graph const& g, dl_var u, dl_var v) const {
@ -799,7 +799,7 @@ namespace smt {
expr* arg = get_expr(i);
fi->insert_new_entry(&arg, arith.mk_numeral(val.to_rational(), true));
}
TRACE("special_relations", r.m_graph.display(tout););
TRACE(special_relations, r.m_graph.display(tout););
r.pop(1);
fi->set_else(arith.mk_numeral(rational(0), true));
mg.get_model().register_decl(fn, fi);
@ -985,7 +985,7 @@ namespace smt {
m.mk_ite(m.mk_app(memf, dst, Ap), T,
m.mk_app(connectedf, Ap, dst, Sp)));
TRACE("special_relations", tout << connected_body << "\n";);
TRACE(special_relations, tout << connected_body << "\n";);
recfun_replace rep(m);
var* vars[3] = { AV, dstV, SV };
p.set_definition(rep, connected, false, 3, vars, connected_body);
@ -1037,7 +1037,7 @@ namespace smt {
}
bool theory_special_relations::is_neighbour_edge(graph const& g, edge_id edge) const {
CTRACE("special_relations_verbose", g.is_enabled(edge),
CTRACE(special_relations_verbose, g.is_enabled(edge),
tout << edge << ": " << g.get_source(edge) << " " << g.get_target(edge) << " ";
tout << (g.get_assignment(g.get_target(edge)) - g.get_assignment(g.get_source(edge))) << "\n";);
@ -1067,7 +1067,7 @@ namespace smt {
for (edge_id e : g.get_out_edges(v)) {
if (is_strict_neighbour_edge(g, e)) {
dl_var dst = g.get_target(e);
TRACE("special_relations", tout << v << " -> " << dst << "\n";);
TRACE(special_relations, tout << v << " -> " << dst << "\n";);
if (!processed[dst]) {
all_p = false;
nodes.push_back(dst);
@ -1081,7 +1081,7 @@ namespace smt {
processed[v] = true;
}
}
TRACE("special_relations",
TRACE(special_relations,
for (unsigned i = 0; i < sz; ++i) {
tout << i << ": " << num_children[i] << "\n";
});

File diff suppressed because it is too large Load diff

View file

@ -76,7 +76,7 @@ public:
expr* v0 = get_fresh_value(seq);
return u.re.mk_to_re(v0);
}
TRACE("t_str", tout << "unexpected sort in get_fresh_value(): " << mk_pp(s, m_manager) << std::endl;);
TRACE(t_str, tout << "unexpected sort in get_fresh_value(): " << mk_pp(s, m_manager) << std::endl;);
UNREACHABLE(); return nullptr;
}
void register_value(expr * n) override { /* Ignore */ }
@ -93,15 +93,15 @@ public:
binary_search_trail(obj_map<expr, ptr_vector<expr> > & target, expr * entry) :
target(target), entry(entry) {}
void undo() override {
TRACE("t_str_binary_search", tout << "in binary_search_trail::undo()" << std::endl;);
TRACE(t_str_binary_search, tout << "in binary_search_trail::undo()" << std::endl;);
if (target.contains(entry)) {
if (!target[entry].empty()) {
target[entry].pop_back();
} else {
TRACE("t_str_binary_search", tout << "WARNING: attempt to remove length tester from an empty stack" << std::endl;);
TRACE(t_str_binary_search, tout << "WARNING: attempt to remove length tester from an empty stack" << std::endl;);
}
} else {
TRACE("t_str_binary_search", tout << "WARNING: attempt to access length tester map via invalid key" << std::endl;);
TRACE(t_str_binary_search, tout << "WARNING: attempt to access length tester map via invalid key" << std::endl;);
}
}
};

View file

@ -129,7 +129,7 @@ namespace smt {
expr_ref final_diseq(mk_and(branch), sub_m);
fixed_length_assumptions.push_back(final_diseq);
TRACE("str_fl", tout << "inserting into fixed_lesson" <<std::endl;);
TRACE(str_fl, tout << "inserting into fixed_lesson" <<std::endl;);
fixed_length_lesson.insert(final_diseq, std::make_tuple(PFUN, f, f));
return true;
@ -183,7 +183,7 @@ namespace smt {
expr_ref final_diseq(mk_not(sub_m, mk_and(branch)), sub_m);
fixed_length_assumptions.push_back(final_diseq);
TRACE("str_fl", tout << "inserting into fixed_lesson" <<std::endl;);
TRACE(str_fl, tout << "inserting into fixed_lesson" <<std::endl;);
fixed_length_lesson.insert(final_diseq, std::make_tuple(NFUN, f, f));
return true;
@ -245,7 +245,7 @@ namespace smt {
expr_ref final_diseq(mk_and(branch), sub_m);
fixed_length_assumptions.push_back(final_diseq);
TRACE("str_fl", tout << "inserting into fixed_lesson" <<std::endl;);
TRACE(str_fl, tout << "inserting into fixed_lesson" <<std::endl;);
fixed_length_lesson.insert(final_diseq, std::make_tuple(PFUN, f, f));
return true;
@ -298,7 +298,7 @@ namespace smt {
expr_ref final_diseq(mk_not(sub_m, mk_and(branch)), sub_m);
fixed_length_assumptions.push_back(final_diseq);
TRACE("str_fl", tout << "inserting into fixed_lesson" <<std::endl;);
TRACE(str_fl, tout << "inserting into fixed_lesson" <<std::endl;);
fixed_length_lesson.insert(final_diseq, std::make_tuple(NFUN, f, f));
return true;
@ -365,7 +365,7 @@ namespace smt {
expr_ref final_diseq(mk_or(branches), sub_m);
fixed_length_assumptions.push_back(final_diseq);
TRACE("str_fl", tout << "inserting into fixed_lesson" <<std::endl;);
TRACE(str_fl, tout << "inserting into fixed_lesson" <<std::endl;);
fixed_length_lesson.insert(final_diseq, std::make_tuple(PFUN, f, f));
return true;
@ -425,7 +425,7 @@ namespace smt {
expr_ref final_diseq(mk_not(sub_m, mk_or(branches)), sub_m);
fixed_length_assumptions.push_back(final_diseq);
TRACE("str_fl", tout << "inserting into fixed_lesson" <<std::endl;);
TRACE(str_fl, tout << "inserting into fixed_lesson" <<std::endl;);
fixed_length_lesson.insert(final_diseq, std::make_tuple(NFUN, f, f));
return true;
@ -476,17 +476,17 @@ namespace smt {
}
}
if (!zero_solution && polarity) {
TRACE("str_fl", tout << "contradiction: regex has no zero-length solutions, but our string must be a solution" << std::endl;);
TRACE(str_fl, tout << "contradiction: regex has no zero-length solutions, but our string must be a solution" << std::endl;);
cex = m.mk_or(m.mk_not(f), m.mk_not(ctx.mk_eq_atom(mk_strlen(str), mk_int(0))));
ctx.get_rewriter()(cex);
return false;
} else if (zero_solution && !polarity) {
TRACE("str_fl", tout << "contradiction: regex has zero-length solutions, but our string must not be a solution" << std::endl;);
TRACE(str_fl, tout << "contradiction: regex has zero-length solutions, but our string must not be a solution" << std::endl;);
cex = m.mk_or(f, m.mk_not(ctx.mk_eq_atom(mk_strlen(str), mk_int(0))));
ctx.get_rewriter()(cex);
return false;
} else {
TRACE("str_fl", tout << "regex constraint satisfied without asserting constraints to subsolver" << std::endl;);
TRACE(str_fl, tout << "regex constraint satisfied without asserting constraints to subsolver" << std::endl;);
return true;
}
} else {
@ -551,7 +551,7 @@ namespace smt {
expr_ref result(mk_or(ors), sub_m);
th_rewriter rw(sub_m);
rw(result);
TRACE("str_fl", tout << "regex path constraint: " << mk_pp(result, sub_m) << std::endl;);
TRACE(str_fl, tout << "regex path constraint: " << mk_pp(result, sub_m) << std::endl;);
if (sub_m.is_false(result)) {
// There are no solutions of that length in the automaton.
@ -588,7 +588,7 @@ namespace smt {
ctx.get_rewriter()(cex);
return false;
} else {
TRACE("str_fl", tout << "regex constraint satisfied without asserting constraints to subsolver" << std::endl;);
TRACE(str_fl, tout << "regex constraint satisfied without asserting constraints to subsolver" << std::endl;);
return true;
}
} else {
@ -633,11 +633,11 @@ namespace smt {
rational varLen_value;
bool var_hasLen = fixed_length_get_len_value(term, varLen_value);
if (!var_hasLen || varLen_value.is_neg()) {
TRACE("str_fl", tout << "variable " << mk_pp(term, m) << " has no length assignment or impossible length assignment - asserting conflict axiom" << std::endl;);
TRACE(str_fl, tout << "variable " << mk_pp(term, m) << " has no length assignment or impossible length assignment - asserting conflict axiom" << std::endl;);
cex = expr_ref(m_autil.mk_ge(mk_strlen(term), mk_int(0)), m);
return false;
}
TRACE("str_fl", tout << "creating character terms for variable " << mk_pp(term, m) << ", length = " << varLen_value << std::endl;);
TRACE(str_fl, tout << "creating character terms for variable " << mk_pp(term, m) << ", length = " << varLen_value << std::endl;);
chars = alloc(expr_ref_vector, m);
for (rational i = rational::zero(); i < varLen_value; ++i) {
// TODO we can probably name these better for the sake of debugging
@ -683,7 +683,7 @@ namespace smt {
cex = expr_ref(m.mk_or(m_autil.mk_ge(arg2, mk_int(0)), m_autil.mk_le(arg2, mk_int(0))), m);
return false;
}
TRACE("str_fl", tout << "reduce substring term: base=" << mk_pp(term, m) << " (length="<<base_chars.size()<<"), pos=" << pos.to_string() << ", len=" << len.to_string() << std::endl;);
TRACE(str_fl, tout << "reduce substring term: base=" << mk_pp(term, m) << " (length="<<base_chars.size()<<"), pos=" << pos.to_string() << ", len=" << len.to_string() << std::endl;);
// Case 1: pos < 0 or pos >= strlen(base) or len < 0
// ==> (Substr ...) = ""
if (pos.is_neg() || pos >= rational(base_chars.size()) || len.is_neg()) {
@ -724,7 +724,7 @@ namespace smt {
cex = m.mk_or(m_autil.mk_ge(pos, mk_int(0)), m_autil.mk_le(pos, mk_int(0)));
return false;
}
TRACE("str_fl", tout << "reduce str.at: base=" << mk_pp(base, m) << ", pos=" << pos_value.to_string() << std::endl;);
TRACE(str_fl, tout << "reduce str.at: base=" << mk_pp(base, m) << ", pos=" << pos_value.to_string() << std::endl;);
if (pos_value.is_neg() || pos_value >= rational(base_chars.size())) {
// return the empty string
eqc_chars.reset();
@ -751,7 +751,7 @@ namespace smt {
cex = expr_ref(m.mk_or(m_autil.mk_ge(mk_strlen(term), mk_int(0)), m_autil.mk_le(mk_strlen(term), mk_int(0))), m);
return false;
}
TRACE("str_fl", tout << "reduce int.to.str: n=" << iValue << std::endl;);
TRACE(str_fl, tout << "reduce int.to.str: n=" << iValue << std::endl;);
if (iValue.is_neg()) {
if (!termLen.is_zero()) {
// conflict
@ -776,17 +776,17 @@ namespace smt {
return true;
}
} else {
TRACE("str_fl", tout << "string term " << mk_pp(term, m) << " handled as uninterpreted function" << std::endl;);
TRACE(str_fl, tout << "string term " << mk_pp(term, m) << " handled as uninterpreted function" << std::endl;);
expr_ref_vector *chars = nullptr;
if (!uninterpreted_to_char_subterm_map.find(term, chars)) {
rational ufLen_value;
bool uf_hasLen = fixed_length_get_len_value(term, ufLen_value);
if (!uf_hasLen || ufLen_value.is_neg()) {
TRACE("str_fl", tout << "uninterpreted function " << mk_pp(term, m) << " has no length assignment or impossible length assignment - asserting conflict axiom" << std::endl;);
TRACE(str_fl, tout << "uninterpreted function " << mk_pp(term, m) << " has no length assignment or impossible length assignment - asserting conflict axiom" << std::endl;);
cex = expr_ref(m_autil.mk_ge(mk_strlen(term), mk_int(0)), m);
return false;
}
TRACE("str_fl", tout << "creating character terms for uninterpreted function " << mk_pp(term, m) << ", length = " << ufLen_value << std::endl;);
TRACE(str_fl, tout << "creating character terms for uninterpreted function " << mk_pp(term, m) << ", length = " << ufLen_value << std::endl;);
chars = alloc(expr_ref_vector, m);
for (rational i = rational::zero(); i < ufLen_value; ++i) {
expr_ref ch(mk_fresh_const("char", u.mk_char_sort()), m);
@ -816,7 +816,7 @@ namespace smt {
}
if (lhs_chars.size() != rhs_chars.size()) {
TRACE("str_fl", tout << "length information inconsistent: " << mk_pp(lhs, m) << " has " << lhs_chars.size() <<
TRACE(str_fl, tout << "length information inconsistent: " << mk_pp(lhs, m) << " has " << lhs_chars.size() <<
" chars, " << mk_pp(rhs, m) << " has " << rhs_chars.size() << " chars" << std::endl;);
// equal strings ought to have equal lengths
cex = m.mk_or(m.mk_not(ctx.mk_eq_atom(lhs, rhs)), ctx.mk_eq_atom(mk_strlen(lhs), mk_strlen(rhs)));
@ -827,7 +827,7 @@ namespace smt {
expr_ref cRHS(rhs_chars.get(i), sub_m);
expr_ref _e(sub_m.mk_eq(cLHS, cRHS), sub_m);
fixed_length_assumptions.push_back(_e);
TRACE("str_fl", tout << "inserting into fixed_lesson" <<std::endl;);
TRACE(str_fl, tout << "inserting into fixed_lesson" <<std::endl;);
fixed_length_lesson.insert(_e, std::make_tuple(rational(i), lhs, rhs));
}
return true;
@ -861,7 +861,7 @@ namespace smt {
}
if (lhsLen != rhsLen) {
TRACE("str", tout << "skip disequality: len(lhs) = " << lhsLen << ", len(rhs) = " << rhsLen << std::endl;);
TRACE(str, tout << "skip disequality: len(lhs) = " << lhsLen << ", len(rhs) = " << rhsLen << std::endl;);
return true;
}
@ -875,7 +875,7 @@ namespace smt {
expr_ref final_diseq(mk_or(diseqs), sub_m);
fixed_length_assumptions.push_back(final_diseq);
TRACE("str_fl", tout << "inserting into fixed_lesson" <<std::endl;);
TRACE(str_fl, tout << "inserting into fixed_lesson" <<std::endl;);
fixed_length_lesson.insert(final_diseq, std::make_tuple(NEQ, lhs, rhs));
return true;
@ -887,7 +887,7 @@ namespace smt {
ast_manager & m = get_manager();
TRACE("str",
TRACE(str,
ast_manager & m = get_manager();
tout << "dumping all formulas:" << std::endl;
for (expr_ref_vector::iterator i = formulas.begin(); i != formulas.end(); ++i) {
@ -920,10 +920,10 @@ namespace smt {
sort * bool_sort = m.mk_bool_sort();
for (expr * var : free_variables) {
TRACE("str_fl", tout << "initialize free variable " << mk_pp(var, m) << std::endl;);
TRACE(str_fl, tout << "initialize free variable " << mk_pp(var, m) << std::endl;);
rational var_lenVal;
if (!fixed_length_get_len_value(var, var_lenVal)) {
TRACE("str_fl", tout << "free variable " << mk_pp(var, m) << " has no length assignment" << std::endl;);
TRACE(str_fl, tout << "free variable " << mk_pp(var, m) << " has no length assignment" << std::endl;);
expr_ref var_len_assertion(m_autil.mk_ge(mk_strlen(var), mk_int(0)), m);
assert_axiom(var_len_assertion);
add_persisted_axiom(var_len_assertion);
@ -932,7 +932,7 @@ namespace smt {
expr_ref_vector var_chars(m);
expr_ref str_counterexample(m);
if (!fixed_length_reduce_string_term(subsolver, var, var_chars, str_counterexample)) {
TRACE("str_fl", tout << "free variable " << mk_pp(var, m) << " caused a conflict; asserting and continuing" << std::endl;);
TRACE(str_fl, tout << "free variable " << mk_pp(var, m) << " caused a conflict; asserting and continuing" << std::endl;);
assert_axiom(str_counterexample);
return l_undef;
}
@ -943,13 +943,13 @@ namespace smt {
expr * subformula = nullptr;
if (m.is_not(f, subformula)) {
if (!get_context().is_relevant(subformula)) {
TRACE("str_fl", tout << "skip reducing formula " << mk_pp(f, m) << ", not relevant (and neither is its subformula)" << std::endl;);
TRACE(str_fl, tout << "skip reducing formula " << mk_pp(f, m) << ", not relevant (and neither is its subformula)" << std::endl;);
continue;
} else {
TRACE("str_fl", tout << "considering formula " << mk_pp(f, m) << ", its subformula is relevant but it is not" << std::endl;);
TRACE(str_fl, tout << "considering formula " << mk_pp(f, m) << ", its subformula is relevant but it is not" << std::endl;);
}
} else {
TRACE("str_fl", tout << "skip reducing formula " << mk_pp(f, m) << ", not relevant" << std::endl;);
TRACE(str_fl, tout << "skip reducing formula " << mk_pp(f, m) << ", not relevant" << std::endl;);
continue;
}
}
@ -963,7 +963,7 @@ namespace smt {
if (m.is_eq(f, lhs, rhs)) {
sort * lhs_sort = lhs->get_sort();
if (lhs_sort == str_sort) {
TRACE("str_fl", tout << "reduce string equality: " << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << std::endl;);
TRACE(str_fl, tout << "reduce string equality: " << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << std::endl;);
expr_ref cex(m);
expr_ref left(lhs, m);
expr_ref right(rhs, m);
@ -975,10 +975,10 @@ namespace smt {
}
fixed_length_reduced_boolean_formulas.push_back(f);
} else {
TRACE("str_fl", tout << "skip reducing formula " << mk_pp(f, m) << ", not an equality over strings" << std::endl;);
TRACE(str_fl, tout << "skip reducing formula " << mk_pp(f, m) << ", not an equality over strings" << std::endl;);
}
} else if (u.str.is_in_re(f)) {
TRACE("str_fl", tout << "reduce regex membership: " << mk_pp(f, m) << std::endl;);
TRACE(str_fl, tout << "reduce regex membership: " << mk_pp(f, m) << std::endl;);
expr_ref cex_clause(m);
expr_ref re(f, m);
if (!fixed_length_reduce_regex_membership(subsolver, re, cex_clause, true)) {
@ -991,10 +991,10 @@ namespace smt {
// TODO in some cases (e.g. len(haystack) is only slightly greater than len(needle))
// we might be okay to assert the full disjunction because there are very few disjuncts
if (m_params.m_FixedLengthRefinement) {
TRACE("str_fl", tout << "abstracting out positive contains: " << mk_pp(f, m) << std::endl;);
TRACE(str_fl, tout << "abstracting out positive contains: " << mk_pp(f, m) << std::endl;);
abstracted_boolean_formulas.push_back(f);
} else {
TRACE("str_fl", tout << "reduce positive contains: " << mk_pp(f, m) << std::endl;);
TRACE(str_fl, tout << "reduce positive contains: " << mk_pp(f, m) << std::endl;);
expr_ref cex(m);
expr_ref cont(f, m);
if (!fixed_length_reduce_contains(subsolver, cont, cex)) {
@ -1005,7 +1005,7 @@ namespace smt {
fixed_length_reduced_boolean_formulas.push_back(f);
}
} else if (u.str.is_prefix(f)) {
TRACE("str_fl", tout << "reduce positive prefix: " << mk_pp(f, m) << std::endl;);
TRACE(str_fl, tout << "reduce positive prefix: " << mk_pp(f, m) << std::endl;);
expr_ref cex(m);
expr_ref pref(f, m);
if (!fixed_length_reduce_prefix(subsolver, pref, cex)) {
@ -1015,7 +1015,7 @@ namespace smt {
}
fixed_length_reduced_boolean_formulas.push_back(f);
} else if (u.str.is_suffix(f)) {
TRACE("str_fl", tout << "reduce positive suffix: " << mk_pp(f, m) << std::endl;);
TRACE(str_fl, tout << "reduce positive suffix: " << mk_pp(f, m) << std::endl;);
expr_ref cex(m);
expr_ref suf(f, m);
if (!fixed_length_reduce_suffix(subsolver, suf, cex)) {
@ -1029,7 +1029,7 @@ namespace smt {
if (m.is_eq(subterm, lhs, rhs)) {
sort * lhs_sort = lhs->get_sort();
if (lhs_sort == str_sort) {
TRACE("str_fl", tout << "reduce string disequality: " << mk_pp(lhs, m) << " != " << mk_pp(rhs, m) << std::endl;);
TRACE(str_fl, tout << "reduce string disequality: " << mk_pp(lhs, m) << " != " << mk_pp(rhs, m) << std::endl;);
expr_ref cex(m);
expr_ref left(lhs, m);
expr_ref right(rhs, m);
@ -1042,7 +1042,7 @@ namespace smt {
fixed_length_reduced_boolean_formulas.push_back(f);
}
} else if (u.str.is_in_re(subterm)) {
TRACE("str_fl", tout << "reduce negative regex membership: " << mk_pp(f, m) << std::endl;);
TRACE(str_fl, tout << "reduce negative regex membership: " << mk_pp(f, m) << std::endl;);
expr_ref cex_clause(m);
expr_ref re(subterm, m);
if (!fixed_length_reduce_regex_membership(subsolver, re, cex_clause, false)) {
@ -1052,7 +1052,7 @@ namespace smt {
}
fixed_length_reduced_boolean_formulas.push_back(f);
} else if (u.str.is_contains(subterm)) {
TRACE("str_fl", tout << "reduce negative contains: " << mk_pp(subterm, m) << std::endl;);
TRACE(str_fl, tout << "reduce negative contains: " << mk_pp(subterm, m) << std::endl;);
expr_ref cex(m);
expr_ref cont(subterm, m);
if (!fixed_length_reduce_negative_contains(subsolver, cont, cex)) {
@ -1062,7 +1062,7 @@ namespace smt {
}
fixed_length_reduced_boolean_formulas.push_back(f);
} else if (u.str.is_prefix(subterm)) {
TRACE("str_fl", tout << "reduce negative prefix: " << mk_pp(subterm, m) << std::endl;);
TRACE(str_fl, tout << "reduce negative prefix: " << mk_pp(subterm, m) << std::endl;);
expr_ref cex(m);
expr_ref pref(subterm, m);
if (!fixed_length_reduce_negative_prefix(subsolver, pref, cex)) {
@ -1072,7 +1072,7 @@ namespace smt {
}
fixed_length_reduced_boolean_formulas.push_back(f);
} else if (u.str.is_suffix(subterm)) {
TRACE("str_fl", tout << "reduce negative suffix: " << mk_pp(subterm, m) << std::endl;);
TRACE(str_fl, tout << "reduce negative suffix: " << mk_pp(subterm, m) << std::endl;);
expr_ref cex(m);
expr_ref suf(subterm, m);
if (!fixed_length_reduce_negative_suffix(subsolver, suf, cex)) {
@ -1082,14 +1082,14 @@ namespace smt {
}
fixed_length_reduced_boolean_formulas.push_back(f);
} else {
TRACE("str_fl", tout << "skip reducing formula " << mk_pp(f, m) << ", not a boolean formula we handle" << std::endl;);
TRACE(str_fl, tout << "skip reducing formula " << mk_pp(f, m) << ", not a boolean formula we handle" << std::endl;);
}
} else {
TRACE("str_fl", tout << "skip reducing formula " << mk_pp(f, m) << ", not a boolean formula we handle" << std::endl;);
TRACE(str_fl, tout << "skip reducing formula " << mk_pp(f, m) << ", not a boolean formula we handle" << std::endl;);
continue;
}
} else {
TRACE("str_fl", tout << "skip reducing formula " << mk_pp(f, m) << ", not relevant to strings" << std::endl;);
TRACE(str_fl, tout << "skip reducing formula " << mk_pp(f, m) << ", not relevant to strings" << std::endl;);
continue;
}
}
@ -1100,7 +1100,7 @@ namespace smt {
arith_value v(get_manager());
v.init(&get_context());
for (auto e : string_int_conversion_terms) {
TRACE("str_fl", tout << "pre-run check str-int term " << mk_pp(e, get_manager()) << std::endl;);
TRACE(str_fl, tout << "pre-run check str-int term " << mk_pp(e, get_manager()) << std::endl;);
expr* _arg;
if (u.str.is_stoi(e, _arg)) {
expr_ref arg(_arg, m);
@ -1111,11 +1111,11 @@ namespace smt {
add_persisted_axiom(stoi_cex);
return l_undef;
}
TRACE("str_fl", tout << "length of term is " << slen << std::endl;);
TRACE(str_fl, tout << "length of term is " << slen << std::endl;);
rational ival;
if (v.get_value(e, ival)) {
TRACE("str_fl", tout << "integer theory assigns " << ival << " to " << mk_pp(e, get_manager()) << std::endl;);
TRACE(str_fl, tout << "integer theory assigns " << ival << " to " << mk_pp(e, get_manager()) << std::endl;);
// if ival is non-negative, because we know the length of arg, we can add a character constraint for arg
if (ival.is_nonneg()) {
zstring ival_str(ival.to_string());
@ -1145,14 +1145,14 @@ namespace smt {
fixed_length_reduced_boolean_formulas.push_back(m.mk_eq(e, mk_int(ival)));
}
} else {
TRACE("str_fl", tout << "integer theory has no assignment for " << mk_pp(e, get_manager()) << std::endl;);
TRACE(str_fl, tout << "integer theory has no assignment for " << mk_pp(e, get_manager()) << std::endl;);
// consistency needs to be checked after the string is assigned
}
} else if (u.str.is_to_code(e, _arg)) {
expr_ref arg(_arg, m);
rational ival;
if (v.get_value(e, ival)) {
TRACE("str_fl", tout << "integer theory assigns " << ival << " to " << mk_pp(e, m) << std::endl;);
TRACE(str_fl, tout << "integer theory assigns " << ival << " to " << mk_pp(e, m) << std::endl;);
if (ival >= rational::zero() && ival <= rational(u.max_char())) {
zstring ival_str(ival.get_unsigned());
expr_ref arg_char_expr(mk_string(ival_str), m);
@ -1169,7 +1169,7 @@ namespace smt {
fixed_length_reduced_boolean_formulas.push_back(m.mk_eq(e, mk_int(ival)));
}
} else {
TRACE("str_fl", tout << "integer theory has no assignment for " << mk_pp(e, m) << std::endl;);
TRACE(str_fl, tout << "integer theory has no assignment for " << mk_pp(e, m) << std::endl;);
// consistency needs to be checked after the string is assigned
}
} else if (u.str.is_itos(e, _arg)) {
@ -1181,10 +1181,10 @@ namespace smt {
add_persisted_axiom(stoi_cex);
return l_undef;
}
TRACE("str_fl", tout << "length of term is " << slen << std::endl;);
TRACE(str_fl, tout << "length of term is " << slen << std::endl;);
rational ival;
if (v.get_value(arg, ival)) {
TRACE("str_fl", tout << "integer theory assigns " << ival << " to " << mk_pp(arg, get_manager()) << std::endl;);
TRACE(str_fl, tout << "integer theory assigns " << ival << " to " << mk_pp(arg, get_manager()) << std::endl;);
zstring ival_str;
if (ival.is_neg()) {
// e must be the empty string, i.e. have length 0
@ -1211,14 +1211,14 @@ namespace smt {
}
fixed_length_reduced_boolean_formulas.push_back(m.mk_eq(arg, mk_int(ival)));
} else {
TRACE("str_fl", tout << "integer theory has no assignment for " << mk_pp(arg, get_manager()) << std::endl;);
TRACE(str_fl, tout << "integer theory has no assignment for " << mk_pp(arg, get_manager()) << std::endl;);
// consistency needs to be checked after the string is assigned
}
} else if (u.str.is_from_code(e, _arg)) {
expr_ref arg(_arg, m);
rational ival;
if (v.get_value(arg, ival)) {
TRACE("str_fl", tout << "integer theory assigns " << ival << " to " << mk_pp(arg, m) << std::endl;);
TRACE(str_fl, tout << "integer theory assigns " << ival << " to " << mk_pp(arg, m) << std::endl;);
if (ival >= rational::zero() && ival <= rational(u.max_char())) {
zstring ival_str(ival.get_unsigned());
expr_ref arg_char_expr(mk_string(ival_str), m);
@ -1236,7 +1236,7 @@ namespace smt {
fixed_length_reduced_boolean_formulas.push_back(m.mk_eq(e, mk_int(ival)));
}
} else {
TRACE("str_fl", tout << "integer theory has no assignment for " << mk_pp(arg, m) << std::endl;);
TRACE(str_fl, tout << "integer theory has no assignment for " << mk_pp(arg, m) << std::endl;);
// consistency needs to be checked after the string is assigned
}
}
@ -1249,7 +1249,7 @@ namespace smt {
precondition.push_back(m.mk_eq(u.str.mk_length(var), mk_int(val)));
}
TRACE("str_fl",
TRACE(str_fl,
tout << "formulas asserted to subsolver:" << std::endl;
for (auto e : fixed_length_assumptions) {
tout << mk_pp(e, subsolver.m()) << std::endl;
@ -1268,12 +1268,12 @@ namespace smt {
}
);
TRACE("str_fl", tout << "calling subsolver" << std::endl;);
TRACE(str_fl, tout << "calling subsolver" << std::endl;);
lbool subproblem_status = subsolver.check(fixed_length_assumptions);
if (subproblem_status == l_true) {
TRACE("str_fl", tout << "subsolver found SAT; reconstructing model" << std::endl;);
TRACE(str_fl, tout << "subsolver found SAT; reconstructing model" << std::endl;);
model_ref subModel;
subsolver.get_model(subModel);
@ -1296,7 +1296,7 @@ namespace smt {
model.insert(var, strValue);
subst.insert(var, mk_string(strValue));
}
TRACE("str_fl",
TRACE(str_fl,
for (auto entry : model) {
tout << mk_pp(entry.m_key, m) << " = " << entry.m_value << std::endl;
}
@ -1326,7 +1326,7 @@ namespace smt {
arith_value v(get_manager());
v.init(&get_context());
for (auto e : string_int_conversion_terms) {
TRACE("str_fl", tout << "post-run check str-int term " << mk_pp(e, get_manager()) << std::endl;);
TRACE(str_fl, tout << "post-run check str-int term " << mk_pp(e, get_manager()) << std::endl;);
expr* _arg;
if (u.str.is_stoi(e, _arg)) {
expr_ref arg(_arg, m);
@ -1335,7 +1335,7 @@ namespace smt {
expr_ref arg_subst(arg, m);
(*replacer)(arg, arg_subst);
rw(arg_subst);
TRACE("str_fl", tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(arg_subst, m) << std::endl;);
TRACE(str_fl, tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(arg_subst, m) << std::endl;);
zstring arg_zstr;
if (u.str.is_string(arg_subst, arg_zstr)) {
@ -1363,7 +1363,7 @@ namespace smt {
expr_ref arg_subst(arg, m);
(*replacer)(arg, arg_subst);
rw(arg_subst);
TRACE("str_fl", tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(arg_subst, m) << std::endl;);
TRACE(str_fl, tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(arg_subst, m) << std::endl;);
zstring arg_zstr;
if (u.str.is_string(arg_subst, arg_zstr)) {
if (ival >= rational::zero() && ival <= rational(u.max_char())) {
@ -1392,7 +1392,7 @@ namespace smt {
expr_ref e_subst(e, m);
(*replacer)(e, e_subst);
rw(e_subst);
TRACE("str_fl", tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(e_subst, m) << std::endl;);
TRACE(str_fl, tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(e_subst, m) << std::endl;);
zstring e_zstr;
if (u.str.is_string(e_subst, e_zstr)) {
@ -1432,7 +1432,7 @@ namespace smt {
expr_ref e_subst(e, m);
(*replacer)(e, e_subst);
rw(e_subst);
TRACE("str_fl", tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(e_subst, m) << std::endl;);
TRACE(str_fl, tout << "ival = " << ival << ", string arg evaluates to " << mk_pp(e_subst, m) << std::endl;);
zstring e_zstr;
if (u.str.is_string(e_subst, e_zstr)) {
// if arg is out of range, e must be empty
@ -1470,11 +1470,11 @@ namespace smt {
th_rewriter rw(m);
if (!abstracted_boolean_formulas.empty()) {
for (auto f : abstracted_boolean_formulas) {
TRACE("str_fl", tout << "refinement of boolean formula: " << mk_pp(f, m) << std::endl;);
TRACE(str_fl, tout << "refinement of boolean formula: " << mk_pp(f, m) << std::endl;);
expr_ref f_new(m);
(*replacer)(f, f_new);
rw(f_new);
TRACE("str_fl", tout << "after substitution and simplification, evaluates to: " << mk_pp(f_new, m) << std::endl;);
TRACE(str_fl, tout << "after substitution and simplification, evaluates to: " << mk_pp(f_new, m) << std::endl;);
// now there are three cases, depending on what f_new evaluates to:
// true -> OK, do nothing
// false -> refine abstraction by generating conflict clause
@ -1493,7 +1493,7 @@ namespace smt {
cex.push_back(ctx.mk_eq_atom(needle, needle_assignment));
return l_false;
} else {
TRACE("str_fl", tout << "error: unhandled refinement term " << mk_pp(f, m) << std::endl;);
TRACE(str_fl, tout << "error: unhandled refinement term " << mk_pp(f, m) << std::endl;);
NOT_IMPLEMENTED_YET();
}
} else {
@ -1506,7 +1506,7 @@ namespace smt {
return l_true;
} else if (subproblem_status == l_false) {
if (m_params.m_FixedLengthNaiveCounterexamples) {
TRACE("str_fl", tout << "subsolver found UNSAT; constructing length counterexample" << std::endl;);
TRACE(str_fl, tout << "subsolver found UNSAT; constructing length counterexample" << std::endl;);
for (auto e : fixed_length_used_len_terms) {
expr * var = &e.get_key();
rational val = e.get_value();
@ -1517,17 +1517,17 @@ namespace smt {
}
return l_false;
} else {
TRACE("str_fl", tout << "subsolver found UNSAT; reconstructing unsat core" << std::endl;);
TRACE("str_fl", tout << "unsat core has size " << subsolver.get_unsat_core_size() << std::endl;);
TRACE(str_fl, tout << "subsolver found UNSAT; reconstructing unsat core" << std::endl;);
TRACE(str_fl, tout << "unsat core has size " << subsolver.get_unsat_core_size() << std::endl;);
bool negate_pre = false;
for (unsigned i = 0; i < subsolver.get_unsat_core_size(); ++i) {
TRACE("str", tout << "entry " << i << " = " << mk_pp(subsolver.get_unsat_core_expr(i), m) << std::endl;);
TRACE(str, tout << "entry " << i << " = " << mk_pp(subsolver.get_unsat_core_expr(i), m) << std::endl;);
rational index;
expr* lhs;
expr* rhs;
TRACE("str_fl", tout << fixed_length_lesson.size() << std::endl;);
TRACE(str_fl, tout << fixed_length_lesson.size() << std::endl;);
std::tie(index, lhs, rhs) = fixed_length_lesson.find(subsolver.get_unsat_core_expr(i));
TRACE("str_fl", tout << "lesson: " << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << " at index " << index << std::endl;);
TRACE(str_fl, tout << "lesson: " << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << " at index " << index << std::endl;);
cex.push_back(refine(lhs, rhs, index));
if (index < rational(0)) {
negate_pre = true;
@ -1541,7 +1541,7 @@ namespace smt {
return l_false;
}
} else { // l_undef
TRACE("str_fl", tout << "WARNING: subsolver found UNKNOWN" << std::endl;);
TRACE(str_fl, tout << "WARNING: subsolver found UNKNOWN" << std::endl;);
return l_undef;
}
}

View file

@ -50,20 +50,20 @@ namespace smt {
expr * re = nullptr;
u.str.is_in_re(str_in_re, str, re);
if (!ctx.b_internalized(str_in_re)) {
TRACE("str", tout << "regex term " << mk_pp(str_in_re, m) << " not internalized; fixing and continuing" << std::endl;);
TRACE(str, tout << "regex term " << mk_pp(str_in_re, m) << " not internalized; fixing and continuing" << std::endl;);
ctx.internalize(str_in_re, false);
finalCheckProgressIndicator = true;
continue;
}
lbool current_assignment = ctx.get_assignment(str_in_re);
TRACE("str", tout << "regex term: " << mk_pp(str, m) << " in " << mk_pp(re, m) << " : " << current_assignment << std::endl;);
TRACE(str, tout << "regex term: " << mk_pp(str, m) << " in " << mk_pp(re, m) << " : " << current_assignment << std::endl;);
if (current_assignment == l_undef) {
continue;
}
if (!regex_terms_with_length_constraints.contains(str_in_re)) {
if (current_assignment == l_true && check_regex_length_linearity(re)) {
TRACE("str", tout << "regex length constraints expected to be linear -- generating and asserting them" << std::endl;);
TRACE(str, tout << "regex length constraints expected to be linear -- generating and asserting them" << std::endl;);
if (regex_term_to_length_constraint.contains(str_in_re)) {
// use existing length constraint
@ -87,7 +87,7 @@ namespace smt {
expr_ref top_level_length_constraint(m.mk_implies(premise, _top_level_length_constraint), m);
th_rewriter rw(m);
rw(top_level_length_constraint);
TRACE("str", tout << "top-level length constraint: " << mk_pp(top_level_length_constraint, m) << std::endl;);
TRACE(str, tout << "top-level length constraint: " << mk_pp(top_level_length_constraint, m) << std::endl;);
// assert and track length constraint
assert_axiom(top_level_length_constraint);
for(auto v : extra_length_vars) {
@ -110,10 +110,10 @@ namespace smt {
rational exact_length_value;
if (get_len_value(str, exact_length_value)) {
TRACE("str", tout << "exact length of " << mk_pp(str, m) << " is " << exact_length_value << std::endl;);
TRACE(str, tout << "exact length of " << mk_pp(str, m) << " is " << exact_length_value << std::endl;);
if (regex_terms_with_path_constraints.contains(str_in_re)) {
TRACE("str", tout << "term " << mk_pp(str_in_re, m) << " already has path constraints set up" << std::endl;);
TRACE(str, tout << "term " << mk_pp(str_in_re, m) << " already has path constraints set up" << std::endl;);
continue;
}
@ -163,7 +163,7 @@ namespace smt {
}
if (zero_solution) {
TRACE("str", tout << "zero-length solution OK -- asserting empty path constraint" << std::endl;);
TRACE(str, tout << "zero-length solution OK -- asserting empty path constraint" << std::endl;);
expr_ref_vector lhs_terms(m);
if (current_assignment == l_true) {
lhs_terms.push_back(str_in_re);
@ -177,7 +177,7 @@ namespace smt {
regex_terms_with_path_constraints.insert(str_in_re);
m_trail_stack.push(insert_obj_trail<expr>(regex_terms_with_path_constraints, str_in_re));
} else {
TRACE("str", tout << "zero-length solution not admitted by this automaton -- asserting conflict clause" << std::endl;);
TRACE(str, tout << "zero-length solution not admitted by this automaton -- asserting conflict clause" << std::endl;);
expr_ref_vector lhs_terms(m);
if (current_assignment == l_true) {
lhs_terms.push_back(str_in_re);
@ -199,11 +199,11 @@ namespace smt {
// no automata available, or else all bounds assumptions are invalid
unsigned expected_complexity = estimate_regex_complexity(re);
if (expected_complexity <= m_params.m_RegexAutomata_DifficultyThreshold || regex_get_counter(regex_fail_count, str_in_re) >= m_params.m_RegexAutomata_FailedAutomatonThreshold) {
CTRACE("str", regex_get_counter(regex_fail_count, str_in_re) >= m_params.m_RegexAutomata_FailedAutomatonThreshold,
CTRACE(str, regex_get_counter(regex_fail_count, str_in_re) >= m_params.m_RegexAutomata_FailedAutomatonThreshold,
tout << "failed automaton threshold reached for " << mk_pp(str_in_re, m) << " -- automatically constructing full automaton" << std::endl;);
eautomaton * aut = m_mk_aut(re);
if (aut == nullptr) {
TRACE("str", tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;);
TRACE(str, tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;);
return false;
}
aut->compress();
@ -213,7 +213,7 @@ namespace smt {
regex_automaton_assumptions.insert(re, svector<regex_automaton_under_assumptions>());
}
regex_automaton_assumptions[re].push_back(new_aut);
TRACE("str", tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;);
TRACE(str, tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;);
find_automaton_initial_bounds(str_in_re, aut);
} else {
regex_inc_counter(regex_fail_count, str_in_re);
@ -226,8 +226,8 @@ namespace smt {
rational upper_bound_value;
bool lower_bound_exists = lower_bound(str_len, lower_bound_value);
bool upper_bound_exists = upper_bound(str_len, upper_bound_value);
CTRACE("str", lower_bound_exists, tout << "lower bound of " << mk_pp(str, m) << " is " << lower_bound_value << std::endl;);
CTRACE("str", upper_bound_exists, tout << "upper bound of " << mk_pp(str, m) << " is " << upper_bound_value << std::endl;);
CTRACE(str, lower_bound_exists, tout << "lower bound of " << mk_pp(str, m) << " is " << lower_bound_value << std::endl;);
CTRACE(str, upper_bound_exists, tout << "upper bound of " << mk_pp(str, m) << " is " << upper_bound_value << std::endl;);
bool new_lower_bound_info = true;
bool new_upper_bound_info = true;
@ -284,13 +284,13 @@ namespace smt {
}
}
if (!last_ub.is_minus_one() || !need_assumption) {
CTRACE("str", !need_assumption, tout << "using automaton with full length information" << std::endl;);
CTRACE("str", need_assumption, tout << "using automaton with assumed upper bound of " << last_ub << std::endl;);
CTRACE(str, !need_assumption, tout << "using automaton with full length information" << std::endl;);
CTRACE(str, need_assumption, tout << "using automaton with assumed upper bound of " << last_ub << std::endl;);
rational refined_upper_bound;
bool solution_at_upper_bound = refine_automaton_upper_bound(last_assumption.get_automaton(),
upper_bound_value, refined_upper_bound);
TRACE("str", tout << "refined upper bound is " << refined_upper_bound <<
TRACE(str, tout << "refined upper bound is " << refined_upper_bound <<
(solution_at_upper_bound?", solution at upper bound":", no solution at upper bound") << std::endl;);
expr_ref_vector lhs(m);
@ -341,7 +341,7 @@ namespace smt {
if (expected_complexity <= m_params.m_RegexAutomata_DifficultyThreshold || failureThresholdExceeded) {
eautomaton * aut = m_mk_aut(re);
if (aut == nullptr) {
TRACE("str", tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;);
TRACE(str, tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;);
return false;
}
aut->compress();
@ -351,7 +351,7 @@ namespace smt {
regex_automaton_assumptions.insert(re, svector<regex_automaton_under_assumptions>());
}
regex_automaton_assumptions[re].push_back(new_aut);
TRACE("str", tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;);
TRACE(str, tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;);
find_automaton_initial_bounds(str_in_re, aut);
} else {
regex_inc_counter(regex_fail_count, str_in_re);
@ -392,12 +392,12 @@ namespace smt {
}
}
if (!last_lb.is_zero() || !need_assumption) {
CTRACE("str", !need_assumption, tout << "using automaton with full length information" << std::endl;);
CTRACE("str", need_assumption, tout << "using automaton with assumed lower bound of " << last_lb << std::endl;);
CTRACE(str, !need_assumption, tout << "using automaton with full length information" << std::endl;);
CTRACE(str, need_assumption, tout << "using automaton with assumed lower bound of " << last_lb << std::endl;);
rational refined_lower_bound;
bool solution_at_lower_bound = refine_automaton_lower_bound(last_assumption.get_automaton(),
lower_bound_value, refined_lower_bound);
TRACE("str", tout << "refined lower bound is " << refined_lower_bound <<
TRACE(str, tout << "refined lower bound is " << refined_lower_bound <<
(solution_at_lower_bound?", solution at lower bound":", no solution at lower bound") << std::endl;);
expr_ref_vector lhs(m);
@ -451,7 +451,7 @@ namespace smt {
if (expected_complexity <= m_params.m_RegexAutomata_DifficultyThreshold || failureThresholdExceeded) {
eautomaton * aut = m_mk_aut(re);
if (aut == nullptr) {
TRACE("str", tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;);
TRACE(str, tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;);
return false;
}
aut->compress();
@ -461,7 +461,7 @@ namespace smt {
regex_automaton_assumptions.insert(re, svector<regex_automaton_under_assumptions>());
}
regex_automaton_assumptions[re].push_back(new_aut);
TRACE("str", tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;);
TRACE(str, tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;);
find_automaton_initial_bounds(str_in_re, aut);
} else {
// TODO check negation?
@ -487,7 +487,7 @@ namespace smt {
|| failureThresholdExceeded) {
eautomaton * aut = m_mk_aut(re);
if (aut == nullptr) {
TRACE("str", tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;);
TRACE(str, tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;);
return false;
}
aut->compress();
@ -497,7 +497,7 @@ namespace smt {
regex_automaton_assumptions.insert(re, svector<regex_automaton_under_assumptions>());
}
regex_automaton_assumptions[re].push_back(new_aut);
TRACE("str", tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;);
TRACE(str, tout << "add new automaton for " << mk_pp(re, m) << ": no assumptions" << std::endl;);
find_automaton_initial_bounds(str_in_re, aut);
} else {
regex_inc_counter(regex_fail_count, str_in_re);
@ -579,9 +579,9 @@ namespace smt {
} // foreach(term in str_in_re_terms)
eautomaton * aut_inter = nullptr;
CTRACE("str", !intersect_constraints.empty(), tout << "check intersection of automata constraints for " << mk_pp(str, m) << std::endl;);
CTRACE(str, !intersect_constraints.empty(), tout << "check intersection of automata constraints for " << mk_pp(str, m) << std::endl;);
for (auto aut : intersect_constraints) {
TRACE("str",
TRACE(str,
{
unsigned v = regex_get_counter(regex_length_attempt_count, aut.get_regex_term());
tout << "length attempt count of " << mk_pp(aut.get_regex_term(), m) << " is " << v
@ -593,7 +593,7 @@ namespace smt {
if (aut_inter != nullptr) {
intersectionDifficulty = estimate_automata_intersection_difficulty(aut_inter, aut.get_automaton());
}
TRACE("str", tout << "intersection difficulty is " << intersectionDifficulty << std::endl;);
TRACE(str, tout << "intersection difficulty is " << intersectionDifficulty << std::endl;);
if (intersectionDifficulty <= m_params.m_RegexAutomata_IntersectionDifficultyThreshold
|| regex_get_counter(regex_intersection_fail_count, aut.get_regex_term()) >= m_params.m_RegexAutomata_FailedIntersectionThreshold) {
@ -616,7 +616,7 @@ namespace smt {
expr_ref rc(u.re.mk_complement(aut.get_regex_term()), m);
eautomaton * aut_c = m_mk_aut(rc);
if (aut_c == nullptr) {
TRACE("str", tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;);
TRACE(str, tout << "ERROR: symbolic automaton construction failed, likely due to non-constant term in regex" << std::endl;);
return false;
}
regex_automata.push_back(aut_c);
@ -642,7 +642,7 @@ namespace smt {
if (aut_inter != nullptr) {
aut_inter->compress();
}
TRACE("str", tout << "intersected " << used_intersect_constraints.size() << " constraints" << std::endl;);
TRACE(str, tout << "intersected " << used_intersect_constraints.size() << " constraints" << std::endl;);
expr_ref_vector conflict_terms(m);
expr_ref conflict_lhs(m);
@ -667,7 +667,7 @@ namespace smt {
}
}
conflict_lhs = mk_and(conflict_terms);
TRACE("str", tout << "conflict lhs: " << mk_pp(conflict_lhs, m) << std::endl;);
TRACE(str, tout << "conflict lhs: " << mk_pp(conflict_lhs, m) << std::endl;);
if (used_intersect_constraints.size() > 1 && aut_inter != nullptr) {
// check whether the intersection is only the empty string
@ -677,7 +677,7 @@ namespace smt {
// if there are no moves from the initial state,
// the only solution is the empty string
if (aut_inter->get_moves_from(initial_state).empty()) {
TRACE("str", tout << "product automaton only accepts empty string" << std::endl;);
TRACE(str, tout << "product automaton only accepts empty string" << std::endl;);
expr_ref rhs1(ctx.mk_eq_atom(str, mk_string("")), m);
expr_ref rhs2(ctx.mk_eq_atom(mk_strlen(str), m_autil.mk_numeral(rational::zero(), true)), m);
expr_ref rhs(m.mk_and(rhs1, rhs2), m);
@ -687,7 +687,7 @@ namespace smt {
}
if (aut_inter != nullptr && aut_inter->is_empty()) {
TRACE("str", tout << "product automaton is empty; asserting conflict clause" << std::endl;);
TRACE(str, tout << "product automaton is empty; asserting conflict clause" << std::endl;);
expr_ref conflict_clause(m.mk_not(mk_and(conflict_terms)), m);
assert_axiom(conflict_clause);
add_persisted_axiom(conflict_clause);
@ -736,7 +736,7 @@ namespace smt {
} else if (u.re.is_full_char(re) || u.re.is_full_seq(re)) {
return 1;
} else {
TRACE("str", tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;);
TRACE(str, tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;);
return 1;
}
}
@ -776,7 +776,7 @@ namespace smt {
} else if (u.re.is_full_char(re) || u.re.is_full_seq(re)) {
return 1;
} else {
TRACE("str", tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;);
TRACE(str, tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;);
return 1;
}
}
@ -822,7 +822,7 @@ namespace smt {
} else if (u.re.is_loop(re, sub1, lo, hi) || u.re.is_loop(re, sub1, lo)) {
return check_regex_length_linearity_helper(sub1, already_star);
} else {
TRACE("str", tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;);
TRACE(str, tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;);
return false;
}
}
@ -898,7 +898,7 @@ namespace smt {
}
}
} else {
TRACE("str", tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;);
TRACE(str, tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;);
lens.reset();
}
}
@ -965,7 +965,7 @@ namespace smt {
expr_ref retval(m_autil.mk_ge(lenVar, m_autil.mk_numeral(rational::zero(), true)), m);
return retval;
} else {
TRACE("str", tout << "subterm lengths:";
TRACE(str, tout << "subterm lengths:";
for(integer_set::iterator it = subterm_lens.begin(); it != subterm_lens.end(); ++it) {
tout << " " << *it;
}
@ -1023,7 +1023,7 @@ namespace smt {
expr_ref retval(m_autil.mk_ge(lenVar, m_autil.mk_numeral(rational::zero(), true)), m);
return retval;
} else {
TRACE("str", tout << "WARNING: unknown regex term " << mk_pp(re, m) << std::endl;);
TRACE(str, tout << "WARNING: unknown regex term " << mk_pp(re, m) << std::endl;);
expr_ref retval(m_autil.mk_ge(lenVar, m_autil.mk_numeral(rational::zero(), true)), m);
return retval;
}
@ -1284,12 +1284,12 @@ namespace smt {
if (u.is_const_char(cond, char_val)) {
SASSERT(char_val < 256);
TRACE("str", tout << "rewrite character constant " << char_val << std::endl;);
TRACE(str, tout << "rewrite character constant " << char_val << std::endl;);
zstring str_const(char_val);
retval = u.str.mk_string(str_const);
return retval;
} else if (is_var(cond)) {
TRACE("str", tout << "substitute var" << std::endl;);
TRACE(str, tout << "substitute var" << std::endl;);
retval = ch_var;
return retval;
} else if (m.is_eq(cond, lhs, rhs)) {
@ -1301,7 +1301,7 @@ namespace smt {
retval = ctx.mk_eq_atom(new_lhs, new_rhs);
return retval;
} else if (m.is_bool(cond)) {
TRACE("str", tout << "rewrite boolean term " << mk_pp(cond, m) << std::endl;);
TRACE(str, tout << "rewrite boolean term " << mk_pp(cond, m) << std::endl;);
app * a_cond = to_app(cond);
expr_ref_vector rewritten_args(m);
for (unsigned i = 0; i < a_cond->get_num_args(); ++i) {
@ -1311,10 +1311,10 @@ namespace smt {
rewritten_args.push_back(new_arg);
}
retval = m.mk_app(a_cond->get_decl(), rewritten_args.data());
TRACE("str", tout << "final rewritten term is " << mk_pp(retval, m) << std::endl;);
TRACE(str, tout << "final rewritten term is " << mk_pp(retval, m) << std::endl;);
return retval;
} else {
TRACE("str", tout << "ERROR: unrecognized automaton path constraint " << mk_pp(cond, m) << ", cannot translate" << std::endl;);
TRACE(str, tout << "ERROR: unrecognized automaton path constraint " << mk_pp(cond, m) << ", cannot translate" << std::endl;);
retval = nullptr;
return retval;
}
@ -1432,7 +1432,7 @@ namespace smt {
unsigned lo_val, hi_val;
if (u.is_const_char(range_lo, lo_val) && u.is_const_char(range_hi, hi_val)) {
TRACE("str", tout << "make range predicate from " << lo_val << " to " << hi_val << std::endl;);
TRACE(str, tout << "make range predicate from " << lo_val << " to " << hi_val << std::endl;);
expr_ref cond_rhs(m);
expr_ref_vector cond_rhs_terms(m);
for (unsigned i = lo_val; i <= hi_val; ++i) {
@ -1446,7 +1446,7 @@ namespace smt {
cond = mk_and(m, 2, args);
aut_path_add_next(next, trail, mv.dst(), cond);
} else {
TRACE("str", tout << "warning: non-bitvectors in automaton range predicate" << std::endl;);
TRACE(str, tout << "warning: non-bitvectors in automaton range predicate" << std::endl;);
UNREACHABLE();
}
} else if (mv.t()->is_pred()) {
@ -1482,7 +1482,7 @@ namespace smt {
}
}
expr_ref result(mk_or(ors));
TRACE("str", tout << "regex path constraint: " << mk_pp(result, m) << "\n";);
TRACE(str, tout << "regex path constraint: " << mk_pp(result, m) << "\n";);
expr_ref concat_rhs(m);
if (pathChars.size() == 1) {

View file

@ -50,7 +50,7 @@ void theory_user_propagator::add_expr(expr* term, bool ensure_enode) {
expr_ref r(m);
expr* e = term;
ctx.get_rewriter()(e, r);
TRACE("user_propagate", tout << "add " << mk_bounded_pp(e, m) << "\n");
TRACE(user_propagate, tout << "add " << mk_bounded_pp(e, m) << "\n");
if (!is_ground(r)) {
if (m_add_expr_fresh.contains(term))
return;
@ -89,7 +89,7 @@ bool theory_user_propagator::propagate_cb(
unsigned num_fixed, expr* const* fixed_ids,
unsigned num_eqs, expr* const* eq_lhs, expr* const* eq_rhs,
expr* conseq) {
CTRACE("user_propagate", ctx.lit_internalized(conseq) && ctx.get_assignment(ctx.get_literal(conseq)) == l_true,
CTRACE(user_propagate, ctx.lit_internalized(conseq) && ctx.get_assignment(ctx.get_literal(conseq)) == l_true,
ctx.display(tout << "redundant consequence: " << mk_pp(conseq, m) << "\n"));
expr_ref _conseq(conseq, m);
@ -160,9 +160,9 @@ final_check_status theory_user_propagator::final_check_eh() {
catch (...) {
throw default_exception("Exception thrown in \"final\"-callback");
}
CTRACE("user_propagate", can_propagate(), tout << "can propagate\n");
CTRACE(user_propagate, can_propagate(), tout << "can propagate\n");
propagate();
CTRACE("user_propagate", ctx.inconsistent(), tout << "inconsistent\n");
CTRACE(user_propagate, ctx.inconsistent(), tout << "inconsistent\n");
// check if it became inconsistent or something new was propagated/registered
bool done = (sz1 == m_prop.size()) && (sz2 == get_num_vars()) && !ctx.inconsistent();
return done ? FC_DONE : FC_CONTINUE;
@ -313,7 +313,7 @@ void theory_user_propagator::propagate_consequence(prop_info const& prop) {
DEBUG_CODE(for (expr* e : prop.m_ids) VERIFY(m_fixed.contains(expr2var(e))););
DEBUG_CODE(for (literal lit : m_lits) VERIFY(ctx.get_assignment(lit) == l_true););
TRACE("user_propagate", tout << "propagating #" << prop.m_conseq->get_id() << ": " << prop.m_conseq << "\n";
TRACE(user_propagate, tout << "propagating #" << prop.m_conseq->get_id() << ": " << prop.m_conseq << "\n";
for (auto const& [a,b] : m_eqs) tout << enode_pp(a, ctx) << " == " << enode_pp(b, ctx) << "\n";
for (expr* e : prop.m_ids) tout << mk_pp(e, m) << "\n";
for (literal lit : m_lits) tout << lit << "\n");
@ -358,7 +358,7 @@ void theory_user_propagator::propagate_consequence(prop_info const& prop) {
else
ctx.mk_th_lemma(get_id(), m_lits);
}
TRACE("user_propagate", ctx.display(tout););
TRACE(user_propagate, ctx.display(tout););
}
@ -370,7 +370,7 @@ void theory_user_propagator::propagate_new_fixed(prop_info const& prop) {
void theory_user_propagator::propagate() {
if (m_qhead == m_prop.size() && m_to_add_qhead == m_to_add.size() && m_replay_qhead == m_clauses_to_replay.size())
return;
TRACE("user_propagate", tout << "propagating queue head: " << m_qhead << " prop queue: " << m_prop.size() << "\n");
TRACE(user_propagate, tout << "propagating queue head: " << m_qhead << " prop queue: " << m_prop.size() << "\n");
force_push();
unsigned qhead = m_replay_qhead;

View file

@ -98,7 +98,7 @@ namespace smt {
template<typename Ext>
theory_var theory_utvpi<Ext>::mk_var(enode* n) {
th_var v = theory::mk_var(n);
TRACE("utvpi", tout << v << " " << mk_pp(n->get_expr(), m) << "\n";);
TRACE(utvpi, tout << v << " " << mk_pp(n->get_expr(), m) << "\n";);
m_graph.init_var(to_var(v));
m_graph.init_var(neg(to_var(v)));
ctx.attach_th_var(n, this, v);
@ -176,7 +176,7 @@ namespace smt {
t2 = a.mk_numeral(k, s2->get_sort());
eq = m.mk_eq(s2.get(), t2.get());
TRACE("utvpi", tout << v1 << " .. " << v2 << "\n" << eq << "\n";);
TRACE(utvpi, tout << v1 << " .. " << v2 << "\n" << eq << "\n";);
VERIFY (internalize_atom(eq.get(), false));
@ -204,7 +204,7 @@ namespace smt {
inc_conflicts();
literal_vector const& lits = m_nc_functor.get_lits();
IF_VERBOSE(20, ctx.display_literals_smt2(verbose_stream() << "conflict:\n", lits));
TRACE("utvpi", ctx.display_literals_smt2(tout << "conflict:\n", lits););
TRACE(utvpi, ctx.display_literals_smt2(tout << "conflict:\n", lits););
vector<parameter> params;
if (m.proofs_enabled()) {
@ -231,7 +231,7 @@ namespace smt {
std::stringstream msg;
msg << "found non utvpi logic expression:\n" << mk_pp(n, m) << '\n';
auto str = msg.str();
TRACE("utvpi", tout << str;);
TRACE(utvpi, tout << str;);
warning_msg("%s", str.c_str());
ctx.push_trail(value_trail<bool>(m_non_utvpi_exprs));
m_non_utvpi_exprs = true;
@ -340,7 +340,7 @@ namespace smt {
edge_id neg = add_ineq(coeffs, w2, ~l);
m_atoms.push_back(atom(bv, pos, neg));
TRACE("utvpi",
TRACE(utvpi,
tout << mk_pp(n, m) << "\n";
m_graph.display_edge(tout << "pos: ", pos);
m_graph.display_edge(tout << "neg: ", neg);
@ -354,7 +354,7 @@ namespace smt {
if (!m_consistent)
return false;
bool result = !ctx.inconsistent() && null_theory_var != mk_term(term);
CTRACE("utvpi", !result, tout << "Did not internalize " << mk_pp(term, m) << "\n";);
CTRACE(utvpi, !result, tout << "Did not internalize " << mk_pp(term, m) << "\n";);
return result;
}
@ -504,7 +504,7 @@ namespace smt {
template<typename Ext>
bool theory_utvpi<Ext>::propagate_atom(atom const& a) {
TRACE("utvpi", a.display(*this, tout); tout << "\n";);
TRACE(utvpi, a.display(*this, tout); tout << "\n";);
int edge_id = a.get_asserted_edge();
if (!enable_edge(edge_id)) {
m_graph.traverse_neg_cycle2(m_params.m_arith_stronger_lemmas, m_nc_functor);
@ -516,7 +516,7 @@ namespace smt {
template<typename Ext>
theory_var theory_utvpi<Ext>::mk_term(app* n) {
TRACE("utvpi", tout << mk_pp(n, m) << "\n";);
TRACE(utvpi, tout << mk_pp(n, m) << "\n";);
bool cl = m_test.linearize(n);
if (!cl) {
@ -640,7 +640,7 @@ namespace smt {
SASSERT(v2 != null_theory_var);
SASSERT(pos2 || terms[1].second.is_minus_one());
}
TRACE("utvpi", tout << (pos1?"$":"-$") << v1;
TRACE(utvpi, tout << (pos1?"$":"-$") << v1;
if (terms.size() == 2) tout << (pos2?" + $":" - $") << v2;
tout << " + " << weight << " <= 0\n";);
edge_id id = m_graph.get_num_edges();
@ -757,7 +757,7 @@ namespace smt {
}
}
TRACE("utvpi",
TRACE(utvpi,
tout << "Disparity: " << v1 << " - " << v2 << "\n";
tout << "decrement: " << zero_v << "\n";
display(tout);
@ -770,7 +770,7 @@ namespace smt {
todo.push_back(k);
}
}
TRACE("utvpi", display(tout););
TRACE(utvpi, display(tout););
SASSERT(m_graph.is_feasible_dbg());
}
DEBUG_CODE(
@ -831,7 +831,7 @@ namespace smt {
break;
}
(void)ok;
CTRACE("utvpi", !ok,
CTRACE(utvpi, !ok,
tout << "validation failed:\n";
tout << "Assignment: " << assign << "\n";
tout << mk_pp(e, m) << "\n";
@ -840,7 +840,7 @@ namespace smt {
display(tout);
m_graph.display_agl(tout);
);
// CTRACE("utvpi", ok, tout << "validation success: " << mk_pp(e, m) << "\n";);
// CTRACE(utvpi, ok, tout << "validation success: " << mk_pp(e, m) << "\n";);
SASSERT(ok);
}
}
@ -857,7 +857,7 @@ namespace smt {
if (m.is_eq(e, e1, e2)) {
return eval_num(e1) == eval_num(e2);
}
TRACE("utvpi", tout << "expression not handled: " << mk_pp(e, m) << "\n";);
TRACE(utvpi, tout << "expression not handled: " << mk_pp(e, m) << "\n";);
return false;
}
@ -890,7 +890,7 @@ namespace smt {
if (is_uninterp_const(e)) {
return mk_value(mk_var(e), a.is_int(e));
}
TRACE("utvpi", tout << "expression not handled: " << mk_pp(e, m) << "\n";);
TRACE(utvpi, tout << "expression not handled: " << mk_pp(e, m) << "\n";);
UNREACHABLE();
return rational(0);
}
@ -905,7 +905,7 @@ namespace smt {
rational num = val.get_rational() + (m_delta * val.get_infinitesimal().to_rational());
num = num/rational(2);
SASSERT(!is_int || num.is_int());
TRACE("utvpi",
TRACE(utvpi,
expr* n = get_enode(v)->get_expr();
tout << mk_pp(n, m) << " |-> (" << val1 << " - " << val2 << ")/2 = " << num << "\n";);
@ -917,7 +917,7 @@ namespace smt {
theory_var v = n->get_th_var(get_id());
bool is_int = a.is_int(n->get_expr());
rational num = mk_value(v, is_int);
TRACE("utvpi", tout << mk_pp(n->get_expr(), m) << " |-> " << num << "\n";);
TRACE(utvpi, tout << mk_pp(n->get_expr(), m) << " |-> " << num << "\n";);
return alloc(expr_wrapper_proc, m_factory->mk_num_value(num, is_int));
}

View file

@ -67,7 +67,7 @@ namespace smt {
}
}
}
TRACE("opt",
TRACE(opt,
tout << "cost save: ";
for (unsigned i = 0; i < m_cost_save.size(); ++i) {
tout << m_cost_save[i] << " ";
@ -102,7 +102,7 @@ namespace smt {
m_normalize = true;
bool_var bv = register_var(var, true);
(void)bv;
TRACE("opt", tout << "inc: " << ctx.inconsistent() << " enable: v" << m_bool2var[bv]
TRACE(opt, tout << "inc: " << ctx.inconsistent() << " enable: v" << m_bool2var[bv]
<< " b" << bv << " " << mk_pp(var, get_manager()) << "\n" << wfml << "\n";);
return var;
}
@ -112,7 +112,7 @@ namespace smt {
bool_var bv = ctx.get_bool_var(var);
theory_var tv = m_bool2var[bv];
m_enabled[tv] = false;
TRACE("opt", tout << "disable: v" << tv << " b" << bv << " " << mk_pp(var, get_manager()) << "\n";);
TRACE(opt, tout << "disable: v" << tv << " b" << bv << " " << mk_pp(var, get_manager()) << "\n";);
}
bool_var theory_wmaxsat::register_var(app* var, bool attach) {
@ -164,7 +164,7 @@ namespace smt {
ctx.push_trail(push_back_vector<svector<theory_var> >(m_costs));
ctx.push_trail(value_trail<bool>(m_assigned[tv]));
m_zcost += w;
TRACE("opt", tout << "Assign v" << tv << " weight: " << w << " cost: " << m_zcost << " " << mk_pp(m_vars[m_bool2var[v]].get(), get_manager()) << "\n";);
TRACE(opt, tout << "Assign v" << tv << " weight: " << w << " cost: " << m_zcost << " " << mk_pp(m_vars[m_bool2var[v]].get(), get_manager()) << "\n";);
m_costs.push_back(tv);
m_assigned[tv] = true;
if (m_zcost >= m_zmin_cost) {
@ -178,7 +178,7 @@ namespace smt {
final_check_status theory_wmaxsat::final_check_eh() {
if (m_normalize) normalize();
TRACE("opt", tout << "cost: " << m_zcost << " min cost: " << m_zmin_cost << "\n";);
TRACE(opt, tout << "cost: " << m_zcost << " min cost: " << m_zmin_cost << "\n";);
return FC_DONE;
}
@ -245,7 +245,7 @@ namespace smt {
m_found_optimal = true;
m_cost_save.reset();
m_cost_save.append(m_costs);
TRACE("opt",
TRACE(opt,
tout << "costs: ";
for (unsigned i = 0; i < m_costs.size(); ++i) {
tout << pp(get_enode(m_costs[i]), get_manager()) << " ";
@ -255,7 +255,7 @@ namespace smt {
);
}
expr_ref result(m.mk_or(disj.size(), disj.data()), m);
TRACE("opt",
TRACE(opt,
tout << result << " weight: " << weight << "\n";
tout << "cost: " << m_zcost << " min-cost: " << m_zmin_cost << "\n";);
return result;
@ -279,7 +279,7 @@ namespace smt {
weight += m_zweights[costs[i]];
lits.push_back(literal(m_var2bool[costs[i]]));
}
TRACE("opt", ctx.display_literals_verbose(tout, lits); tout << "\n";);
TRACE(opt, ctx.display_literals_verbose(tout, lits); tout << "\n";);
ctx.set_conflict(
ctx.mk_justification(
@ -324,7 +324,7 @@ namespace smt {
bool_var w = m_var2bool[m_costs[i]];
lits.push_back(literal(w));
}
TRACE("opt",
TRACE(opt,
ctx.display_literals_verbose(tout, lits.size(), lits.data());
ctx.display_literal_verbose(tout << " --> ", lit););