3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-22 11:07:51 +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

@ -33,9 +33,9 @@ namespace sat {
vector<cut_set> const& aig_cuts::operator()() {
if (m_config.m_full) flush_roots();
unsigned_vector node_ids = filter_valid_nodes();
TRACE("cut_simplifier", display(tout););
TRACE(cut_simplifier, display(tout););
augment(node_ids);
TRACE("cut_simplifier", display(tout););
TRACE(cut_simplifier, display(tout););
++m_num_cut_calls;
return m_cuts;
}
@ -328,13 +328,13 @@ namespace sat {
}
else if (m_aig[v][0].is_const() || !insert_aux(v, n)) {
m_literals.shrink(m_literals.size() - n.size());
TRACE("cut_simplifier", tout << "duplicate\n";);
TRACE(cut_simplifier, tout << "duplicate\n";);
}
SASSERT(!m_aig[v].empty());
}
void aig_cuts::add_node(bool_var v, uint64_t lut, unsigned sz, bool_var const* args) {
TRACE("cut_simplifier", tout << v << " == " << cut::table2string(sz, lut) << " " << bool_var_vector(sz, args) << "\n";);
TRACE(cut_simplifier, tout << v << " == " << cut::table2string(sz, lut) << " " << bool_var_vector(sz, args) << "\n";);
reserve(v);
unsigned offset = m_literals.size();
node n(lut, sz, offset);
@ -346,7 +346,7 @@ namespace sat {
}
void aig_cuts::add_node(literal head, bool_op op, unsigned sz, literal const* args) {
TRACE("cut_simplifier", tout << head << " == " << op << " " << literal_vector(sz, args) << "\n";);
TRACE(cut_simplifier, tout << head << " == " << op << " " << literal_vector(sz, args) << "\n";);
unsigned v = head.var();
reserve(v);
unsigned offset = m_literals.size();
@ -407,7 +407,7 @@ namespace sat {
flush_roots(to_root, cs);
}
m_roots.reset();
TRACE("cut_simplifier", display(tout););
TRACE(cut_simplifier, display(tout););
}
bool aig_cuts::flush_roots(bool_var var, to_root const& to_root, node& n) {
@ -711,7 +711,7 @@ namespace sat {
m_clause.push_back(lit);
}
m_clause.push_back(parity ? r : ~r);
TRACE("cut_simplifier", tout << "validate: " << m_clause << "\n";);
TRACE(cut_simplifier, tout << "validate: " << m_clause << "\n";);
on_clause(m_clause);
}
return;
@ -726,7 +726,7 @@ namespace sat {
m_clause.push_back(lit);
}
m_clause.push_back(0 == (n.lut() & (1ull << i)) ? ~r : r);
TRACE("cut_simplifier", tout << n.lut() << " " << m_clause << "\n";);
TRACE(cut_simplifier, tout << n.lut() << " " << m_clause << "\n";);
on_clause(m_clause);
}
return;

View file

@ -47,9 +47,9 @@ namespace sat {
report _report(*this);
configure_solver(solver);
clauses2anf(solver);
TRACE("anf_simplifier", solver.display(tout); s.display(tout););
TRACE(anf_simplifier, solver.display(tout); s.display(tout););
solver.simplify();
TRACE("anf_simplifier", solver.display(tout););
TRACE(anf_simplifier, solver.display(tout););
anf2clauses(solver);
anf2phase(solver);
save_statistics(solver);
@ -85,7 +85,7 @@ namespace sat {
literal lit(p.var(), p.lo().is_zero());
s.assign_unit(lit);
++m_stats.m_num_units;
TRACE("anf_simplifier", tout << "unit " << p << " : " << lit << "\n";);
TRACE(anf_simplifier, tout << "unit " << p << " : " << lit << "\n";);
}
else if (p.is_binary()) {
// equivalence
@ -95,7 +95,7 @@ namespace sat {
literal y(p.lo().var(), p.lo().lo().is_one());
add_eq(x, y);
++m_stats.m_num_eqs;
TRACE("anf_simplifier", tout << "equivalence " << p << " : " << x << " == " << y << "\n";);
TRACE(anf_simplifier, tout << "equivalence " << p << " : " << x << " == " << y << "\n";);
}
}
@ -248,7 +248,7 @@ namespace sat {
oclauses.shrink(j);
}
TRACE("anf_simplifier",
TRACE(anf_simplifier,
tout << "kept:\n";
for (clause* cp : clauses) tout << *cp << "\n";
for (auto b : bins) tout << b.first << " " << b.second << "\n";
@ -390,7 +390,7 @@ namespace sat {
auto& m = ps.get_manager();
dd::pdd p = (lit2pdd(b.first) | lit2pdd(b.second)) ^ true;
ps.add(p);
TRACE("anf_simplifier", tout << "bin: " << b.first << " " << b.second << " : " << p << "\n";);
TRACE(anf_simplifier, tout << "bin: " << b.first << " " << b.second << " : " << p << "\n";);
}
void anf_simplifier::add_clause(clause const& c, pdd_solver& ps) {
@ -400,7 +400,7 @@ namespace sat {
for (literal l : c) p |= lit2pdd(l);
p = p ^ true;
ps.add(p);
TRACE("anf_simplifier", tout << "clause: " << c << " : " << p << "\n";);
TRACE(anf_simplifier, tout << "clause: " << c << " : " << p << "\n";);
}
void anf_simplifier::add_xor(literal_vector const& x, pdd_solver& ps) {
@ -408,7 +408,7 @@ namespace sat {
dd::pdd p = m.one();
for (literal l : x) p ^= lit2pdd(l);
ps.add(p);
TRACE("anf_simplifier", tout << "xor: " << x << " : " << p << "\n";);
TRACE(anf_simplifier, tout << "xor: " << x << " : " << p << "\n";);
}
void anf_simplifier::add_aig(literal head, literal_vector const& ands, pdd_solver& ps) {
@ -417,7 +417,7 @@ namespace sat {
for (literal l : ands) q &= lit2pdd(l);
dd::pdd p = lit2pdd(head) ^ q;
ps.add(p);
TRACE("anf_simplifier", tout << "aig: " << head << " == " << ands << " poly : " << p << "\n";);
TRACE(anf_simplifier, tout << "aig: " << head << " == " << ands << " poly : " << p << "\n";);
}
void anf_simplifier::add_if(literal head, literal c, literal th, literal el, pdd_solver& ps) {
@ -425,7 +425,7 @@ namespace sat {
dd::pdd cond = lit2pdd(c);
dd::pdd p = lit2pdd(head) ^ (cond & lit2pdd(th)) ^ (~cond & lit2pdd(el));
ps.add(p);
TRACE("anf_simplifier", tout << "ite: " << head << " == " << c << "?" << th << ":" << el << " poly : " << p << "\n";);
TRACE(anf_simplifier, tout << "ite: " << head << " == " << c << "?" << th << ":" << el << " poly : " << p << "\n";);
}
void anf_simplifier::save_statistics(pdd_solver& solver) {

View file

@ -168,7 +168,7 @@ namespace sat {
return;
}
CASSERT("asymm_branch", s.check_invariant());
TRACE("asymm_branch_detail", s.display(tout););
TRACE(asymm_branch_detail, s.display(tout););
report rpt(*this);
bool_vector saved_phase(s.m_phase);
flet<bool> _is_probing(s.m_is_probing, true);
@ -343,7 +343,7 @@ namespace sat {
return false;
}
SASSERT(!s.inconsistent());
TRACE("asymm_branch_detail", tout << "assigning: " << l << "\n";);
TRACE(asymm_branch_detail, tout << "assigning: " << l << "\n";);
s.assign_scoped(l);
s.propagate_core(false); // must not use propagate(), since check_missed_propagation may fail for c
return s.inconsistent();
@ -403,7 +403,7 @@ namespace sat {
s.set_conflict();
return false;
case 1:
TRACE("asymm_branch", tout << "produced unit clause: " << c[0] << "\n";);
TRACE(asymm_branch, tout << "produced unit clause: " << c[0] << "\n";);
s.assign_unit(c[0]);
s.propagate_core(false);
scoped_d.del_clause();
@ -433,7 +433,7 @@ namespace sat {
}
bool asymm_branch::process(clause & c) {
TRACE("asymm_branch_detail", tout << "processing: " << c << "\n";);
TRACE(asymm_branch_detail, tout << "processing: " << c << "\n";);
SASSERT(s.scope_lvl() == 0);
SASSERT(!s.inconsistent());

View file

@ -44,7 +44,7 @@ namespace sat {
report(bcd& f):f(f) {}
~report() {
IF_VERBOSE(1, verbose_stream() << "Decomposed set " << f.m_L.size() << " rest: " << f.m_R.size() << "\n";);
TRACE("sat",
TRACE(sat,
tout << "Decomposed set " << f.m_L.size() << "\n";
for (bclause b : f.m_L) tout << b.lit << ": " << *b.cls << "\n";
tout << "Remainder " << f.m_R.size() << "\n";
@ -90,7 +90,7 @@ namespace sat {
m_bin_clauses.push_back(cls);
register_clause(cls);
}
TRACE("sat", for (clause* cls : m_clauses) if (cls) tout << *cls << "\n";);
TRACE(sat, for (clause* cls : m_clauses) if (cls) tout << *cls << "\n";);
}
void bcd::register_clause(clause* cls) {
@ -128,7 +128,7 @@ namespace sat {
}
m_L.append(tmpL);
m_R.append(tmpR);
TRACE("bcd", tout << lit << " " << "pos: " << tmpL.size() << " " << "neg: " << tmpR.size() << "\n";);
TRACE(bcd, tout << lit << " " << "pos: " << tmpL.size() << " " << "neg: " << tmpR.size() << "\n";);
}
void bcd::pure_decompose(use_list& ul, literal lit, svector<bclause>& clauses) {
@ -239,7 +239,7 @@ namespace sat {
}
literal bcd::find_blocked(use_list& ul, clause const& cls) {
TRACE("bcd", tout << cls << "\n";);
TRACE(bcd, tout << cls << "\n";);
for (literal lit : cls) {
m_marked[(~lit).index()] = true;
@ -247,7 +247,7 @@ namespace sat {
literal result = null_literal;
for (literal lit : cls) {
if (is_blocked(ul, lit)) {
TRACE("bcd", tout << "is blocked " << lit << " : " << cls << "\n";);
TRACE(bcd, tout << "is blocked " << lit << " : " << cls << "\n";);
result = lit;
break;
}
@ -342,7 +342,7 @@ namespace sat {
}
}
IF_VERBOSE(0, verbose_stream() << "num merge: " << num_merge << "\n");
TRACE("sat", uf.display(tout););
TRACE(sat, uf.display(tout););
}
void bcd::cleanup() {

View file

@ -178,7 +178,7 @@ namespace sat {
size_t size = clause::get_obj_size(num_lits);
void * mem = m_allocator.allocate(size);
clause * cls = new (mem) clause(m_id_gen.mk(), num_lits, lits, learned);
TRACE("sat_clause", tout << "alloc: " << cls->id() << " " << *cls << " " << (learned?"l":"a") << "\n";);
TRACE(sat_clause, tout << "alloc: " << cls->id() << " " << *cls << " " << (learned?"l":"a") << "\n";);
SASSERT(!learned || cls->is_learned());
return cls;
}
@ -196,7 +196,7 @@ namespace sat {
}
void clause_allocator::del_clause(clause * cls) {
TRACE("sat_clause", tout << "delete: " << cls->id() << " " << *cls << "\n";);
TRACE(sat_clause, tout << "delete: " << cls->id() << " " << *cls << "\n";);
m_id_gen.recycle(cls->id());
size_t size = clause::get_obj_size(cls->m_capacity);
cls->~clause();

View file

@ -32,7 +32,7 @@ namespace sat {
unsigned m_num_redundant;
public:
clause_use_list() {
STRACE("clause_use_list_bug", tout << "[cul_created] " << this << "\n";);
STRACE(clause_use_list_bug, tout << "[cul_created] " << this << "\n";);
m_size = 0;
m_num_redundant = 0;
}
@ -52,7 +52,7 @@ namespace sat {
bool empty() const { return size() == 0; }
void insert(clause & c) {
STRACE("clause_use_list_bug", tout << "[cul_insert] " << this << " " << &c << "\n";);
STRACE(clause_use_list_bug, tout << "[cul_insert] " << this << " " << &c << "\n";);
SASSERT(!m_clauses.contains(&c));
SASSERT(!c.was_removed());
m_clauses.push_back(&c);
@ -61,7 +61,7 @@ namespace sat {
}
void erase_not_removed(clause & c) {
STRACE("clause_use_list_bug", tout << "[cul_erase_not_removed] " << this << " " << &c << "\n";);
STRACE(clause_use_list_bug, tout << "[cul_erase_not_removed] " << this << " " << &c << "\n";);
SASSERT(m_clauses.contains(&c));
SASSERT(!c.was_removed());
m_clauses.erase(&c);
@ -70,7 +70,7 @@ namespace sat {
}
void erase(clause & c) {
STRACE("clause_use_list_bug", tout << "[cul_erase] " << this << " " << &c << "\n";);
STRACE(clause_use_list_bug, tout << "[cul_erase] " << this << " " << &c << "\n";);
SASSERT(m_clauses.contains(&c));
// SASSERT(c.was_removed());
m_size--;

View file

@ -45,7 +45,7 @@ namespace sat {
SASSERT(it->empty());
continue;
}
TRACE("cleanup_bug", tout << "processing wlist of " << to_literal(l_idx) << "\n";);
TRACE(cleanup_bug, tout << "processing wlist of " << to_literal(l_idx) << "\n";);
watch_list & wlist = *it;
watch_list::iterator it2 = wlist.begin();
watch_list::iterator it_prev = it2;
@ -53,7 +53,7 @@ namespace sat {
for (; it2 != end2; ++it2) {
switch (it2->get_kind()) {
case watched::BINARY:
TRACE("cleanup_bug",
TRACE(cleanup_bug,
tout << ~to_literal(l_idx) << " " << it2->get_literal() << "\n";
tout << s.value(~to_literal(l_idx)) << " " << s.value(it2->get_literal()) << "\n";
tout << s.was_eliminated(it2->get_literal()) << " " << s.inconsistent() << "\n";);
@ -62,7 +62,7 @@ namespace sat {
*it_prev = *it2;
++it_prev;
}
TRACE("cleanup_bug", tout << "keeping: " << ~to_literal(l_idx) << " " << it2->get_literal() << "\n";);
TRACE(cleanup_bug, tout << "keeping: " << ~to_literal(l_idx) << " " << it2->get_literal() << "\n";);
break;
case watched::CLAUSE:
// skip
@ -86,9 +86,9 @@ namespace sat {
clause_vector::iterator end = cs.end();
for (; it != end; ++it) {
clause & c = *(*it);
TRACE("sat_cleaner_bug", tout << "cleaning: " << c << "\n";
TRACE(sat_cleaner_bug, tout << "cleaning: " << c << "\n";
for (unsigned i = 0; i < c.size(); i++) tout << c[i] << ": " << s.value(c[i]) << "\n";);
CTRACE("sat_cleaner_frozen", c.frozen(), tout << c << "\n";);
CTRACE(sat_cleaner_frozen, c.frozen(), tout << c << "\n";);
unsigned sz = c.size();
unsigned i = 0, j = 0;
m_cleanup_counter += sz;
@ -108,7 +108,7 @@ namespace sat {
}
}
end_loop:
CTRACE("sat_cleaner_frozen", c.frozen(),
CTRACE(sat_cleaner_frozen, c.frozen(),
tout << "sat: " << (i < sz) << ", new_size: " << j << "\n";
tout << mk_lits_pp(j, c.begin()) << "\n";);
if (i < sz) {
@ -117,7 +117,7 @@ namespace sat {
}
else {
unsigned new_sz = j;
CTRACE("sat_cleaner_bug", new_sz < 2, tout << "new_sz: " << new_sz << "\n";
CTRACE(sat_cleaner_bug, new_sz < 2, tout << "new_sz: " << new_sz << "\n";
if (c.size() > 0) tout << "unit: " << c[0] << "\n";
s.display_watches(tout););
switch (new_sz) {
@ -131,7 +131,7 @@ namespace sat {
break;
case 2:
SASSERT(s.value(c[0]) == l_undef && s.value(c[1]) == l_undef);
TRACE("cleanup_bug", tout << "clause became binary: " << c[0] << " " << c[1] << "\n";);
TRACE(cleanup_bug, tout << "clause became binary: " << c[0] << " " << c[1] << "\n";);
s.mk_bin_clause(c[0], c[1], c.is_learned());
s.del_clause(c);
break;
@ -198,7 +198,7 @@ namespace sat {
unsigned trail_sz = s.m_trail.size();
s.propagate(false); // make sure that everything was propagated.
TRACE("sat_cleaner_bug", s.display(tout); s.display_watches(tout););
TRACE(sat_cleaner_bug, s.display(tout); s.display_watches(tout););
if (s.m_inconsistent)
return false;
if (m_last_num_units == trail_sz)

View file

@ -159,7 +159,7 @@ namespace sat {
bool force = s.m_config.m_cut_force;
report _report(*this);
TRACE("cut_simplifier", s.display(tout););
TRACE(cut_simplifier, s.display(tout););
unsigned n = 0, i = 0;
++m_stats.m_num_calls;
do {
@ -220,7 +220,7 @@ namespace sat {
// <=>
// ~head = t1 + t2 + ..
literal head = ~xors[index];
TRACE("cut_simplifier", tout << xors << "\n";);
TRACE(cut_simplifier, tout << xors << "\n";);
unsigned sz = xors.size() - 1;
m_lits.reset();
for (unsigned i = xors.size(); i-- > 0; ) {
@ -342,7 +342,7 @@ namespace sat {
void cut_simplifier::assign_equiv(cut const& c, literal u, literal v) {
if (u.var() == v.var()) return;
IF_VERBOSE(10, verbose_stream() << u << " " << v << " " << c << "\n";);
TRACE("cut_simplifier", tout << u << " == " << v << "\n";);
TRACE(cut_simplifier, tout << u << " == " << v << "\n";);
certify_equivalence(u, v, c);
validate_eq(u, v);
}

View file

@ -180,7 +180,7 @@ namespace sat {
}
void drat::append(literal l, status st) {
TRACE("sat_drat", pp(tout, st) << " " << l << "\n";);
TRACE(sat_drat, pp(tout, st) << " " << l << "\n";);
declare(l);
IF_VERBOSE(20, trace(verbose_stream(), 1, &l, st););
@ -198,7 +198,7 @@ namespace sat {
}
void drat::append(literal l1, literal l2, status st) {
TRACE("sat_drat", pp(tout, st) << " " << l1 << " " << l2 << "\n";);
TRACE(sat_drat, pp(tout, st) << " " << l1 << " " << l2 << "\n";);
declare(l1);
declare(l2);
literal lits[2] = { l1, l2 };
@ -230,7 +230,7 @@ namespace sat {
}
void drat::append(clause& c, status st) {
TRACE("sat_drat", pp(tout, st) << " " << c << "\n";);
TRACE(sat_drat, pp(tout, st) << " " << c << "\n";);
for (literal lit : c) declare(lit);
unsigned n = c.size();
IF_VERBOSE(20, trace(verbose_stream(), n, c.begin(), st););
@ -371,7 +371,7 @@ namespace sat {
case l_undef: num_undef++; break;
}
}
CTRACE("sat_drat", num_true == 0 && num_undef == 1, display(tout););
CTRACE(sat_drat, num_true == 0 && num_undef == 1, display(tout););
VERIFY(num_true != 0 || num_undef != 1);
}
}
@ -425,7 +425,7 @@ namespace sat {
exit(0);
UNREACHABLE();
//display(std::cout);
TRACE("sat_drat",
TRACE(sat_drat,
tout << literal_vector(n, c) << "\n";
display(tout);
s.display(tout););
@ -545,7 +545,7 @@ namespace sat {
void drat::assign(literal l, clause* c) {
lbool new_value = l.sign() ? l_false : l_true;
lbool old_value = value(l);
// TRACE("sat_drat", tout << "assign " << l << " := " << new_value << " from " << old_value << "\n";);
// TRACE(sat_drat, tout << "assign " << l << " := " << new_value << " from " << old_value << "\n";);
switch (old_value) {
case l_false:
m_inconsistent = true;
@ -578,7 +578,7 @@ namespace sat {
watched_clause& wc = m_watched_clauses[idx];
clause& c = *wc.m_clause;
//TRACE("sat_drat", tout << "Propagate " << l << " " << c << " watch: " << wc.m_l1 << " " << wc.m_l2 << "\n";);
//TRACE(sat_drat, tout << "Propagate " << l << " " << c << " watch: " << wc.m_l1 << " " << wc.m_l2 << "\n";);
if (wc.m_l1 == ~l) {
std::swap(wc.m_l1, wc.m_l2);
}

View file

@ -70,7 +70,7 @@ namespace sat {
}
if (l1 != r1 || l2 != r2) {
if (r1.index() < r2.index()) {
TRACE("elim_eqs", tout << l1 << " " << l2 << " " << r1 << " " << r2 << "\n";);
TRACE(elim_eqs, tout << l1 << " " << l2 << " " << r1 << " " << r2 << "\n";);
m_new_bin.push_back(bin(r1, r2, it->is_learned()));
}
continue;
@ -101,7 +101,7 @@ namespace sat {
clause_vector::iterator end = cs.end();
for (; it != end; ++it) {
clause & c = *(*it);
TRACE("sats", tout << "processing: " << c << "\n";);
TRACE(sats, tout << "processing: " << c << "\n";);
unsigned sz = c.size();
unsigned i;
for (i = 0; i < sz; i++) {
@ -135,10 +135,10 @@ namespace sat {
}
std::sort(c.begin(), c.end());
for (literal l : c) VERIFY(l == norm(roots, l));
TRACE("sats", tout << "after normalization/sorting: " << c << "\n"; tout.flush(););
TRACE(sats, tout << "after normalization/sorting: " << c << "\n"; tout.flush(););
DEBUG_CODE({
for (literal l : c) {
CTRACE("sat", l != norm(roots, l), tout << l << " " << norm(roots, l) << "\n"; tout.flush(););
CTRACE(sat, l != norm(roots, l), tout << l << " " << norm(roots, l) << "\n"; tout.flush(););
SASSERT(l == norm(roots, l));
} });
@ -165,7 +165,7 @@ namespace sat {
c[j] = l;
j++;
}
TRACE("elim_eqs", tout << "after removing duplicates: " << c << " j: " << j << "\n";);
TRACE(elim_eqs, tout << "after removing duplicates: " << c << " j: " << j << "\n";);
if (i < sz) {
drat_delete_clause();
@ -233,7 +233,7 @@ namespace sat {
m_solver.m_cut_simplifier->set_root(v, r);
bool set_root = m_solver.set_root(l, r);
TRACE("elim_eqs", tout << l << " " << r << "\n";);
TRACE(elim_eqs, tout << l << " " << r << "\n";);
if (m_solver.is_assumption(v) || (m_solver.is_external(v) && (m_solver.is_incremental() || !set_root))) {
// cannot really eliminate v, since we have to notify extension of future assignments
if (m_solver.m_config.m_drat) {
@ -245,7 +245,7 @@ namespace sat {
}
else {
model_converter::entry & e = mc.mk(model_converter::ELIM_VAR, v);
TRACE("save_elim", tout << "marking as deleted: " << v << " l: " << l << " r: " << r << "\n";);
TRACE(save_elim, tout << "marking as deleted: " << v << " l: " << l << " r: " << r << "\n";);
m_solver.set_eliminated(v, true);
mc.insert(e, ~l, r);
mc.insert(e, l, ~r);
@ -256,7 +256,7 @@ namespace sat {
bool elim_eqs::check_clause(clause const& c, literal_vector const& roots) const {
for (literal l : c) {
CTRACE("elim_eqs_bug", m_solver.was_eliminated(l.var()), tout << "lit: " << l << " " << norm(roots, l) << "\n";
CTRACE(elim_eqs_bug, m_solver.was_eliminated(l.var()), tout << "lit: " << l << " " << norm(roots, l) << "\n";
tout << c << "\n";);
if (m_solver.was_eliminated(l.var())) {
IF_VERBOSE(0, verbose_stream() << c << " contains eliminated literal " << l << " " << norm(roots, l) << "\n";);
@ -278,9 +278,9 @@ namespace sat {
}
void elim_eqs::operator()(literal_vector const & roots, bool_var_vector const & to_elim) {
TRACE("elim_eqs", tout << "before bin cleanup\n"; m_solver.display(tout););
TRACE(elim_eqs, tout << "before bin cleanup\n"; m_solver.display(tout););
cleanup_bin_watches(roots);
TRACE("elim_eqs", tout << "after bin cleanup\n"; m_solver.display(tout););
TRACE(elim_eqs, tout << "after bin cleanup\n"; m_solver.display(tout););
cleanup_clauses(roots, m_solver.m_clauses);
if (m_solver.inconsistent()) return;
cleanup_clauses(roots, m_solver.m_learned);
@ -288,11 +288,11 @@ namespace sat {
save_elim(roots, to_elim);
m_solver.propagate(false);
SASSERT(check_clauses(roots));
TRACE("elim_eqs", tout << "after full cleanup\n"; m_solver.display(tout););
TRACE(elim_eqs, tout << "after full cleanup\n"; m_solver.display(tout););
}
void elim_eqs::operator()(union_find<>& uf) {
TRACE("elim_eqs", tout << "before union-find bin\n";);
TRACE(elim_eqs, tout << "before union-find bin\n";);
literal_vector roots(m_solver.num_vars(), null_literal);
bool_var_vector to_elim;
for (unsigned i = m_solver.num_vars(); i-- > 0; ) {
@ -301,7 +301,7 @@ namespace sat {
if (idx != l1.index()) {
roots[i] = to_literal(idx);
to_elim.push_back(i);
TRACE("elim_eqs", tout << "remove " << roots[i] << "\n";);
TRACE(elim_eqs, tout << "remove " << roots[i] << "\n";);
}
else {
roots[i] = l1;

View file

@ -36,7 +36,7 @@ namespace sat {
void solver::do_gc() {
if (!should_gc()) return;
TRACE("sat", tout << m_conflicts_since_gc << " " << m_gc_threshold << "\n";);
TRACE(sat, tout << m_conflicts_since_gc << " " << m_gc_threshold << "\n";);
unsigned gc = m_stats.m_gc_clause;
m_conflicts_since_gc = 0;
m_gc_threshold += m_config.m_gc_increment;
@ -157,7 +157,7 @@ namespace sat {
\brief GC (the second) half of the clauses in the database.
*/
void solver::gc_half(char const * st_name) {
TRACE("sat", tout << "gc\n";);
TRACE(sat, tout << "gc\n";);
unsigned sz = m_learned.size();
unsigned new_sz = sz/2; // std::min(sz/2, m_clauses.size()*2);
unsigned j = new_sz;
@ -192,7 +192,7 @@ namespace sat {
\brief Use gc based on dynamic psm. Clauses are initially frozen.
*/
void solver::gc_dyn_psm() {
TRACE("sat", tout << "gc\n";);
TRACE(sat, tout << "gc\n";);
// To do gc at scope_lvl() > 0, I will need to use the reinitialization stack, or live with the fact
// that I may miss some propagations for reactivated clauses.
SASSERT(at_base_lvl());
@ -213,7 +213,7 @@ namespace sat {
double d_tk = V_tk == 0 ? static_cast<double>(num_vars() + 1) : static_cast<double>(h)/static_cast<double>(V_tk);
if (d_tk < m_min_d_tk)
m_min_d_tk = d_tk;
TRACE("sat_frozen", tout << "m_min_d_tk: " << m_min_d_tk << "\n";);
TRACE(sat_frozen, tout << "m_min_d_tk: " << m_min_d_tk << "\n";);
unsigned frozen = 0;
unsigned deleted = 0;
unsigned activated = 0;
@ -242,7 +242,7 @@ namespace sat {
c.unmark_used();
if (psm(c) > static_cast<unsigned>(c.size() * m_min_d_tk)) {
// move to frozen;
TRACE("sat_frozen", tout << "freezing size: " << c.size() << " psm: " << psm(c) << " " << c << "\n";);
TRACE(sat_frozen, tout << "freezing size: " << c.size() << " psm: " << psm(c) << " " << c << "\n";);
detach_clause(c);
c.reset_inact_rounds();
c.freeze();
@ -284,7 +284,7 @@ namespace sat {
// return true if should keep the clause, and false if we should delete it.
bool solver::activate_frozen_clause(clause & c) {
TRACE("sat_gc", tout << "reactivating:\n" << c << "\n";);
TRACE(sat_gc, tout << "reactivating:\n" << c << "\n";);
SASSERT(at_base_lvl());
// do some cleanup
unsigned sz = c.size();
@ -304,7 +304,7 @@ namespace sat {
break;
}
}
TRACE("sat", tout << "after cleanup:\n" << mk_lits_pp(j, c.begin()) << "\n";);
TRACE(sat, tout << "after cleanup:\n" << mk_lits_pp(j, c.begin()) << "\n";);
unsigned new_sz = j;
switch (new_sz) {
case 0:

View file

@ -48,18 +48,18 @@ namespace sat {
}
}
}
TRACE("sat", tout << "clause " << c << " not found in watch-list\n");
TRACE("sat", s.display_watches(tout));
TRACE(sat, tout << "clause " << c << " not found in watch-list\n");
TRACE(sat, s.display_watches(tout));
UNREACHABLE();
return false;
}
bool integrity_checker::check_clause(clause const & c) const {
CTRACE("sat_bug", c.was_removed(), s.display(tout << "c: " << c.id() << ": " << c << "\n"));
CTRACE(sat_bug, c.was_removed(), s.display(tout << "c: " << c.id() << ": " << c << "\n"));
SASSERT(!c.was_removed());
for (unsigned i = 0; i < c.size(); i++) {
VERIFY(c[i].var() <= s.num_vars());
CTRACE("sat_bug", s.was_eliminated(c[i].var()),
CTRACE(sat_bug, s.was_eliminated(c[i].var()),
tout << "l: " << c[i].var() << "\n";
tout << "c: " << c << "\n";
s.display(tout););
@ -84,7 +84,7 @@ namespace sat {
// the clause has been satisfied or all other literals are assigned to false.
if (!on_prop_stack && s.status(c) != l_true) {
for (unsigned i = 2; i < c.size(); i++) {
CTRACE("sat_bug", s.value(c[i]) != l_false,
CTRACE(sat_bug, s.value(c[i]) != l_false,
tout << c << " status: " << s.status(c) << "\n";
for (unsigned i = 0; i < c.size(); i++) tout << "val(" << i << "): " << s.value(c[i]) << "\n";);
VERIFY(s.value(c[i]) == l_false);
@ -151,7 +151,7 @@ namespace sat {
switch (w.get_kind()) {
case watched::BINARY:
VERIFY(!s.was_eliminated(w.get_literal().var()));
CTRACE("sat_watched_bug", !s.get_wlist(~(w.get_literal())).contains(watched(l, w.is_learned())),
CTRACE(sat_watched_bug, !s.get_wlist(~(w.get_literal())).contains(watched(l, w.is_learned())),
tout << "l: " << l << " l2: " << w.get_literal() << "\n";
tout << "was_eliminated1: " << s.was_eliminated(l.var());
tout << " was_eliminated2: " << s.was_eliminated(w.get_literal().var());
@ -176,7 +176,7 @@ namespace sat {
unsigned l_idx = 0;
for (watch_list const& wlist : s.m_watches) {
literal l = ~to_literal(l_idx++);
CTRACE("sat_bug",
CTRACE(sat_bug,
s.was_eliminated(l.var()) && !wlist.empty(),
tout << "l: " << l << "\n";
s.display_watches(tout);
@ -203,7 +203,7 @@ namespace sat {
}
for (clause* cp : s.m_learned) {
if (ids.contains(cp->id())) {
TRACE("sat", tout << "Repeated clause: " << cp->id() << "\n";);
TRACE(sat, tout << "Repeated clause: " << cp->id() << "\n";);
return false;
}
}

View file

@ -261,7 +261,7 @@ namespace sat {
void local_search::verify_constraint(constraint const& c) const {
uint64_t value = constraint_value(c);
IF_VERBOSE(11, display(verbose_stream() << "verify ", c););
TRACE("sat", display(verbose_stream() << "verify ", c););
TRACE(sat, display(verbose_stream() << "verify ", c););
if (c.m_k < value) {
IF_VERBOSE(0, display(verbose_stream() << "violated constraint: ", c) << "value: " << value << "\n";);
}
@ -492,14 +492,14 @@ namespace sat {
return l_false;
walksat();
TRACE("sat", tout << m_units << "\n";);
TRACE(sat, tout << m_units << "\n";);
// remove unit clauses
for (unsigned i = m_units.size(); i-- > num_units; ) {
m_vars[m_units[i]].m_unit = false;
}
m_units.shrink(num_units);
TRACE("sat", display(tout););
TRACE(sat, display(tout););
lbool result;
if (m_is_unsat) {
@ -715,7 +715,7 @@ namespace sat {
m_max_steps = std::min(static_cast<unsigned>(20 * num_vars()), static_cast<unsigned>(1 << 17)); // cut steps off at 100K
TRACE("sat",
TRACE(sat,
tout << "seed:\t" << m_config.random_seed() << '\n';
tout << "best_known_value:\t" << m_config.best_known_value() << '\n';
tout << "max_steps:\t" << m_max_steps << '\n';

View file

@ -82,7 +82,7 @@ namespace sat {
}
void lookahead::add_binary(literal l1, literal l2) {
TRACE("sat", tout << "binary: " << l1 << " " << l2 << "\n";);
TRACE(sat, tout << "binary: " << l1 << " " << l2 << "\n";);
SASSERT(l1 != l2);
// don't add tautologies and don't add already added binaries
if (~l1 == l2) return;
@ -95,7 +95,7 @@ namespace sat {
}
void lookahead::del_binary(unsigned idx) {
// TRACE("sat", display(tout << "Delete " << to_literal(idx) << "\n"););
// TRACE(sat, display(tout << "Delete " << to_literal(idx) << "\n"););
literal_vector & lits = m_binary[idx];
SASSERT(!lits.empty());
literal l = lits.back();
@ -157,7 +157,7 @@ namespace sat {
if (!is_fixed(w)) {
if (is_stamped(~w)) {
// u \/ v, ~v \/ w, u \/ ~w => u is unit
TRACE("sat", tout << "tc1: " << u << "\n";);
TRACE(sat, tout << "tc1: " << u << "\n";);
propagated(u);
return false;
}
@ -183,14 +183,14 @@ namespace sat {
}
set_bstamps(~u);
if (is_stamped(~v)) {
TRACE("sat", tout << "try_add_binary: " << u << "\n";);
TRACE(sat, tout << "try_add_binary: " << u << "\n";);
propagated(u); // u \/ ~v, u \/ v => u is a unit literal
}
else if (!is_stamped(v) && add_tc1(u, v)) {
// u \/ v is not in index
set_bstamps(~v);
if (is_stamped(~u)) {
TRACE("sat", tout << "try_add_binary: " << v << "\n";);
TRACE(sat, tout << "try_add_binary: " << v << "\n";);
propagated(v); // v \/ ~u, u \/ v => v is a unit literal
}
else if (add_tc1(v, u)) {
@ -258,14 +258,14 @@ namespace sat {
}
}
}
TRACE("sat", display_candidates(tout););
TRACE(sat, display_candidates(tout););
SASSERT(!m_candidates.empty());
heap_sort();
while (m_candidates.size() > max_num_cand) {
m_candidates.pop_back();
}
SASSERT(!m_candidates.empty() && m_candidates.size() <= max_num_cand);
TRACE("sat", display_candidates(tout););
TRACE(sat, display_candidates(tout););
return true;
}
@ -342,7 +342,7 @@ namespace sat {
}
}
}
TRACE("sat", display_candidates(tout << "sum: " << sum << "\n"););
TRACE(sat, display_candidates(tout << "sum: " << sum << "\n"););
if (skip_candidates > 0) {
IF_VERBOSE(1, verbose_stream() << "(sat-lookahead :candidates " << m_candidates.size() << " :skipped " << skip_candidates << ")\n";);
}
@ -395,7 +395,7 @@ namespace sat {
literal_vector const& lits1 = m_binary[l.index()];
for (literal lit1 : lits1) {
if (!is_true(lit1)) {
TRACE("sat", tout << l << " " << lit1 << "\n";);
TRACE(sat, tout << l << " " << lit1 << "\n";);
return false;
}
}
@ -403,7 +403,7 @@ namespace sat {
literal_vector const& lits2 = m_binary[l.index()];
for (literal lit2 : lits2) {
if (!is_true(lit2)) {
TRACE("sat", tout << l << " " << lit2 << "\n";);
TRACE(sat, tout << l << " " << lit2 << "\n";);
return false;
}
}
@ -651,7 +651,7 @@ namespace sat {
if (get_rank(lit) == 0) get_scc(lit);
if (get_rank(~lit) == 0) get_scc(~lit);
}
TRACE("sat", display_scc(tout););
TRACE(sat, display_scc(tout););
}
void lookahead::init_scc() {
inc_bstamp();
@ -669,7 +669,7 @@ namespace sat {
m_rank_max = UINT_MAX;
m_active = null_literal;
m_settled = null_literal;
TRACE("sat", display_dfs(tout););
TRACE(sat, display_dfs(tout););
}
void lookahead::init_dfs_info(literal l) {
unsigned idx = l.index();
@ -712,7 +712,7 @@ namespace sat {
}
void lookahead::get_scc(literal v) {
TRACE("scc", tout << v << "\n";);
TRACE(scc, tout << v << "\n";);
set_parent(v, null_literal);
activate_scc(v);
do {
@ -764,7 +764,7 @@ namespace sat {
set_link(v, m_settled); m_settled = t;
while (t != v) {
if (t == ~v) {
TRACE("sat", display_scc(tout << "found contradiction during scc search\n"););
TRACE(sat, display_scc(tout << "found contradiction during scc search\n"););
set_conflict();
break;
}
@ -850,13 +850,13 @@ namespace sat {
literal pp = null_literal;
unsigned h = 0;
literal w, uu;
TRACE("sat",
TRACE(sat,
for (literal u = m_settled; u != null_literal; u = get_link(u)) {
tout << u << " ";
}
tout << "\n";);
for (literal u = m_settled; u != null_literal; u = uu) {
TRACE("sat", tout << "process: " << u << "\n";);
TRACE(sat, tout << "process: " << u << "\n";);
uu = get_link(u);
literal p = get_parent(u);
if (p != pp) {
@ -869,7 +869,7 @@ namespace sat {
unsigned sz = num_next(~u);
for (unsigned j = 0; j < sz; ++j) {
literal v = ~get_next(~u, j);
TRACE("sat", tout << "child " << v << " link: " << get_link(v) << "\n";);
TRACE(sat, tout << "child " << v << " link: " << get_link(v) << "\n";);
literal pv = get_parent(v);
// skip nodes in same equivalence, they will all be processed
if (pv == p) continue;
@ -888,10 +888,10 @@ namespace sat {
set_child(u, null_literal);
set_link(u, v);
set_child(w, u);
TRACE("sat", tout << "child(" << w << ") = " << u << " link(" << u << ") = " << v << "\n";);
TRACE(sat, tout << "child(" << w << ") = " << u << " link(" << u << ") = " << v << "\n";);
}
}
TRACE("sat",
TRACE(sat,
display_forest(tout << "forest: ", get_child(null_literal));
tout << "\n";
display_scc(tout); );
@ -958,7 +958,7 @@ namespace sat {
}
}
SASSERT(2*m_lookahead.size() == offset);
TRACE("sat", for (unsigned i = 0; i < m_lookahead.size(); ++i)
TRACE(sat, for (unsigned i = 0; i < m_lookahead.size(); ++i)
tout << m_lookahead[i].m_lit << " : " << m_lookahead[i].m_offset << "\n";);
}
@ -1040,7 +1040,7 @@ namespace sat {
propagate();
m_qhead = m_trail.size();
m_init_freevars = m_freevars.size();
TRACE("sat", m_s.display(tout); display(tout););
TRACE(sat, m_s.display(tout); display(tout););
}
void lookahead::copy_clauses(clause_vector const& clauses, bool learned) {
@ -1095,7 +1095,7 @@ namespace sat {
--i;
literal l = m_trail[i];
set_undef(l);
TRACE("sat", tout << "inserting free var v" << l.var() << "\n";);
TRACE(sat, tout << "inserting free var v" << l.var() << "\n";);
m_freevars.insert_fresh(l.var());
}
@ -1163,7 +1163,7 @@ namespace sat {
literal l2 = m_wstack[i];
//update_prefix(~lit);
//update_prefix(m_wstack[i]);
TRACE("sat", tout << "windfall: " << nlit << " " << l2 << "\n";);
TRACE(sat, tout << "windfall: " << nlit << " " << l2 << "\n";);
// if we use try_add_binary, then this may produce new assignments
// these assignments get put on m_trail, and they are cleared by
// lookahead_backtrack.
@ -1234,7 +1234,7 @@ namespace sat {
if (is_fixed(l1)) {
if (is_false(l1)) {
if (is_false(l2)) {
TRACE("sat", tout << l1 << " " << l2 << " " << "\n";);
TRACE(sat, tout << l1 << " " << l2 << " " << "\n";);
set_conflict();
return l_false;
}
@ -1270,7 +1270,7 @@ namespace sat {
for (binary const& b : m_ternary[(~l).index()]) {
if (sz-- == 0) break;
// this could create a conflict from propagation, but we complete the transaction.
TRACE("sat", display(tout););
TRACE(sat, display(tout););
literal l1 = b.m_u;
literal l2 = b.m_v;
switch (propagate_ternary(l1, l2)) {
@ -1705,7 +1705,7 @@ namespace sat {
}
}
TRACE("sat",
TRACE(sat,
for (literal lit : clauses) {
if (lit == null_literal) {
tout << "\n";
@ -1721,7 +1721,7 @@ namespace sat {
void lookahead::propagate_binary(literal l) {
literal_vector const& lits = m_binary[l.index()];
TRACE("sat", tout << l << " => " << lits << "\n";);
TRACE(sat, tout << l << " => " << lits << "\n";);
for (literal lit : lits) {
if (inconsistent()) break;
assign(lit);
@ -1732,7 +1732,7 @@ namespace sat {
unsigned i = m_qhead;
for (; i < m_trail.size() && !inconsistent(); ++i) {
literal l = m_trail[i];
TRACE("sat", tout << "propagate " << l << " @ " << m_level << "\n";);
TRACE(sat, tout << "propagate " << l << " @ " << m_level << "\n";);
propagate_binary(l);
}
while (m_qhead < m_trail.size() && !inconsistent()) {
@ -1741,12 +1741,12 @@ namespace sat {
SASSERT(m_qhead == m_trail.size() || (inconsistent() && m_qhead < m_trail.size()));
//SASSERT(!missed_conflict());
//VERIFY(!missed_propagation());
TRACE("sat_verbose", display(tout << scope_lvl() << " " << (inconsistent()?"unsat":"sat") << "\n"););
TRACE(sat_verbose, display(tout << scope_lvl() << " " << (inconsistent()?"unsat":"sat") << "\n"););
}
void lookahead::compute_lookahead_reward() {
TRACE("sat", display_lookahead(tout); );
TRACE(sat, display_lookahead(tout); );
m_delta_decrease = pow(m_config.m_delta_rho, 1.0 / (double)m_lookahead.size());
unsigned base = 2;
bool change = true;
@ -1775,7 +1775,7 @@ namespace sat {
unsat = true;
}
else {
TRACE("sat", tout << "lookahead: " << lit << " @ " << m_lookahead[i].m_offset << "\n";);
TRACE(sat, tout << "lookahead: " << lit << " @ " << m_lookahead[i].m_offset << "\n";);
reset_lookahead_reward(lit);
unsigned num_units = push_lookahead1(lit, level);
update_lookahead_reward(lit, level);
@ -1788,7 +1788,7 @@ namespace sat {
pop_lookahead1(lit, num_units);
}
if (unsat) {
TRACE("sat", tout << "backtracking and setting " << ~lit << "\n";);
TRACE(sat, tout << "backtracking and setting " << ~lit << "\n";);
lookahead_backtrack();
assign(~lit);
propagate();
@ -1821,7 +1821,7 @@ namespace sat {
base += 2 * m_lookahead.size();
}
lookahead_backtrack();
TRACE("sat", display_lookahead(tout); );
TRACE(sat, display_lookahead(tout); );
}
literal lookahead::select_literal() {
@ -1838,13 +1838,13 @@ namespace sat {
if (mixd == h) ++count;
if (mixd > h || (mixd == h && m_s.m_rand(count) == 0)) {
CTRACE("sat", l != null_literal, tout << lit << " mix diff: " << mixd << "\n";);
CTRACE(sat, l != null_literal, tout << lit << " mix diff: " << mixd << "\n";);
if (mixd > h) count = 1;
h = mixd;
l = diff1 < diff2 ? lit : ~lit;
}
}
TRACE("sat", tout << "selected: " << l << "\n";);
TRACE(sat, tout << "selected: " << l << "\n";);
return l;
}
@ -1937,7 +1937,7 @@ namespace sat {
unsat = push_lookahead2(lit, level);
}
if (unsat) {
TRACE("sat", tout << "unit: " << ~lit << "\n";);
TRACE(sat, tout << "unit: " << ~lit << "\n";);
++m_stats.m_double_lookahead_propagations;
SASSERT(m_level == dl_truth);
lookahead_backtrack();
@ -2007,13 +2007,13 @@ namespace sat {
void lookahead::assign(literal l) {
SASSERT(m_level > 0);
if (is_undef(l)) {
TRACE("sat", tout << "assign: " << l << " @ " << m_level << " " << m_trail_lim.size() << " " << m_search_mode << "\n";);
TRACE(sat, tout << "assign: " << l << " @ " << m_level << " " << m_trail_lim.size() << " " << m_search_mode << "\n";);
set_true(l);
SASSERT(m_trail.empty() || get_level(m_trail.back()) >= get_level(l));
m_trail.push_back(l);
if (m_search_mode == lookahead_mode::searching) {
m_stats.m_propagations++;
TRACE("sat", tout << "removing free var v" << l.var() << "\n";);
TRACE(sat, tout << "removing free var v" << l.var() << "\n";);
if (l.var() > m_freevars.max_var()) IF_VERBOSE(0, verbose_stream() << "bigger than max-var: " << l << " " << " " << m_freevars.max_var() << "\n";);
if (!m_freevars.contains(l.var())) IF_VERBOSE(0, verbose_stream() << "does not contain: " << l << " eliminated: " << m_s.was_eliminated(l.var()) << "\n";);
if (m_freevars.contains(l.var())) { m_freevars.remove(l.var()); }
@ -2021,7 +2021,7 @@ namespace sat {
}
}
else if (is_false(l)) {
TRACE("sat", tout << "conflict: " << l << " @ " << m_level << " " << m_search_mode << "\n";);
TRACE(sat, tout << "conflict: " << l << " @ " << m_level << " " << m_search_mode << "\n";);
SASSERT(!is_true(l));
validate_assign(l);
set_conflict();
@ -2032,7 +2032,7 @@ namespace sat {
assign(l);
for (unsigned i = m_trail.size()-1; i < m_trail.size() && !inconsistent(); ++i) {
literal l = m_trail[i];
TRACE("sat", tout << "propagate " << l << " @ " << m_level << "\n";);
TRACE(sat, tout << "propagate " << l << " @ " << m_level << "\n";);
propagate_binary(l);
}
if (m_search_mode == lookahead_mode::lookahead1) {
@ -2058,7 +2058,7 @@ namespace sat {
literal_vector trail;
m_search_mode = lookahead_mode::searching;
while (true) {
TRACE("sat", display(tout););
TRACE(sat, display(tout););
inc_istamp();
checkpoint();
literal l = choose();
@ -2069,7 +2069,7 @@ namespace sat {
if (l == null_literal) {
return l_true;
}
TRACE("sat", tout << "choose: " << l << " " << trail << "\n";);
TRACE(sat, tout << "choose: " << l << " " << trail << "\n";);
++m_stats.m_decisions;
IF_VERBOSE(1, display_search_string(););
push(l, c_fixed_truth);
@ -2165,11 +2165,11 @@ namespace sat {
}
while (true) {
TRACE("sat", display(tout););
TRACE(sat, display(tout););
checkpoint();
inc_istamp();
if (inconsistent()) {
TRACE("sat", tout << "inconsistent: " << m_cube_state.m_cube << "\n";);
TRACE(sat, tout << "inconsistent: " << m_cube_state.m_cube << "\n";);
m_cube_state.m_freevars_threshold = m_freevars.size();
m_cube_state.m_psat_threshold = m_config.m_cube_cutoff == adaptive_psat_cutoff ? psat_heur() : dbl_max; // MN. only compute PSAT if enabled
m_cube_state.inc_conflict();
@ -2204,7 +2204,7 @@ namespace sat {
double prev_psat = m_config.m_cube_cutoff == adaptive_psat_cutoff ? psat_heur() : dbl_max; // MN. only compute PSAT if enabled
literal lit = choose();
if (inconsistent()) {
TRACE("sat", tout << "inconsistent: " << m_cube_state.m_cube << "\n";);
TRACE(sat, tout << "inconsistent: " << m_cube_state.m_cube << "\n";);
m_cube_state.m_freevars_threshold = prev_nfreevars;
m_cube_state.m_psat_threshold = prev_psat;
m_cube_state.inc_conflict();
@ -2220,7 +2220,7 @@ namespace sat {
init_model();
return m_freevars.empty() ? l_true : l_undef;
}
TRACE("sat", tout << "choose: " << lit << " cube: " << m_cube_state.m_cube << "\n";);
TRACE(sat, tout << "choose: " << lit << " cube: " << m_cube_state.m_cube << "\n";);
SASSERT(vars.empty() || vars.contains(lit.var()));
++m_stats.m_decisions;
push(lit, c_fixed_truth);

View file

@ -438,7 +438,7 @@ namespace sat {
void set_min(literal v, literal u) { m_dfs[v.index()].m_min = u; }
void set_rank(literal v, unsigned r) { m_dfs[v.index()].m_rank = r; }
void set_height(literal v, unsigned h) { m_dfs[v.index()].m_height = h; }
void set_parent(literal v, literal p) { TRACE("scc", tout << v << " <- " << p << "\n";); m_dfs[v.index()].m_parent = p; }
void set_parent(literal v, literal p) { TRACE(scc, tout << v << " <- " << p << "\n";); m_dfs[v.index()].m_parent = p; }
void set_vcomp(literal v, literal u) { m_dfs[v.index()].m_vcomp = u; }
void get_scc(literal v);
void activate_scc(literal l);
@ -532,7 +532,7 @@ namespace sat {
unsigned do_double(literal l, unsigned& base);
unsigned double_look(literal l, unsigned& base);
void set_conflict() { TRACE("sat", tout << "conflict\n";); m_inconsistent = true; }
void set_conflict() { TRACE(sat, tout << "conflict\n";); m_inconsistent = true; }
bool inconsistent() const { return m_inconsistent; }
unsigned scope_lvl() const { return m_trail_lim.size(); }

View file

@ -115,7 +115,7 @@ namespace sat {
m_removed_clauses.append(m_clauses_to_remove);
bool_var v;
uint64_t lut = convert_combination(m_vars, v);
TRACE("aig_simplifier",
TRACE(aig_simplifier,
for (clause* cp : m_clauses_to_remove) {
tout << *cp << "\n" << v << ": " << m_vars << "\n";
}

View file

@ -116,7 +116,7 @@ namespace sat {
bool undef = false;
for (literal const& l : e.m_clauses) {
if (l == null_literal) {
CTRACE("sat", !sat,
CTRACE(sat, !sat,
tout << "exposed: " << m_exposed_lim << "\n";
if (m_solver) m_solver->display(tout);
display(tout);
@ -159,7 +159,7 @@ namespace sat {
if (l == null_literal) {
// end of clause
if (!sat) {
TRACE("sat_model_bug", tout << "failed eliminated: " << mk_lits_pp(static_cast<unsigned>(it - itbegin), itbegin) << "\n";);
TRACE(sat_model_bug, tout << "failed eliminated: " << mk_lits_pp(static_cast<unsigned>(it - itbegin), itbegin) << "\n";);
(void)itbegin;
ok = false;
}
@ -223,7 +223,7 @@ namespace sat {
for (literal l : c) e.m_clauses.push_back(l);
e.m_clauses.push_back(null_literal);
add_elim_stack(e);
TRACE("sat_mc_bug", tout << "adding: " << c << "\n";);
TRACE(sat_mc_bug, tout << "adding: " << c << "\n";);
}
void model_converter::insert(entry & e, literal l1, literal l2) {
@ -234,7 +234,7 @@ namespace sat {
e.m_clauses.push_back(l2);
e.m_clauses.push_back(null_literal);
add_elim_stack(e);
TRACE("sat_mc_bug", tout << "adding (binary): " << l1 << " " << l2 << "\n";);
TRACE(sat_mc_bug, tout << "adding (binary): " << l1 << " " << l2 << "\n";);
}
void model_converter::insert(entry & e, clause_wrapper const & c) {
@ -246,7 +246,7 @@ namespace sat {
e.m_clauses.push_back(c[i]);
e.m_clauses.push_back(null_literal);
add_elim_stack(e);
// TRACE("sat_mc_bug", tout << "adding (wrapper): "; for (literal l : c) tout << l << " "; tout << "\n";);
// TRACE(sat_mc_bug, tout << "adding (wrapper): "; for (literal l : c) tout << l << " "; tout << "\n";);
}
void model_converter::insert(entry & e, literal_vector const& c) {
@ -256,7 +256,7 @@ namespace sat {
for (literal l : c) e.m_clauses.push_back(l);
e.m_clauses.push_back(null_literal);
add_elim_stack(e);
TRACE("sat_mc_bug", tout << "adding: " << c << "\n";);
TRACE(sat_mc_bug, tout << "adding: " << c << "\n";);
}
@ -274,7 +274,7 @@ namespace sat {
SASSERT(it2->var() != it->var());
if (it2->var() == it->var()) return false;
for (literal l : it2->m_clauses) {
CTRACE("sat_model_converter", l.var() == it->var(), tout << "var: " << it->var() << "\n"; display(tout););
CTRACE(sat_model_converter, l.var() == it->var(), tout << "var: " << it->var() << "\n"; display(tout););
SASSERT(l.var() != it->var());
VERIFY(l == null_literal || l.var() < num_vars);
if (it2->var() == it->var()) return false;

View file

@ -35,7 +35,7 @@ namespace sat {
m_mus.append(m_core);
s.m_core.reset();
s.m_core.append(m_mus);
TRACE("sat", tout << "new core: " << s.m_core << "\n";);
TRACE(sat, tout << "new core: " << s.m_core << "\n";);
}
void mus::update_model() {
@ -56,7 +56,7 @@ namespace sat {
lbool mus::mus1() {
bool minimize_partial = s.m_config.m_core_minimize_partial;
TRACE("sat", tout << "old core: " << s.get_core() << "\n";);
TRACE(sat, tout << "old core: " << s.get_core() << "\n";);
literal_vector& core = get_core();
literal_vector& mus = m_mus;
if (!minimize_partial && core.size() > 64) {
@ -66,7 +66,7 @@ namespace sat {
IF_VERBOSE(1, verbose_stream() << "(sat.mus num-to-process: " << core.size() << " mus: " << mus.size();
if (minimize_partial) verbose_stream() << " max-restarts: " << m_max_num_restarts;
verbose_stream() << ")\n";);
TRACE("sat",
TRACE(sat,
tout << "core: " << core << "\n";
tout << "mus: " << mus << "\n";);
@ -88,7 +88,7 @@ namespace sat {
scoped_append _sa(mus, core);
mus.push_back(~lit);
is_sat = s.check(mus.size(), mus.data());
TRACE("sat", tout << "mus: " << mus << "\n";);
TRACE(sat, tout << "mus: " << mus << "\n";);
}
IF_VERBOSE(1, verbose_stream() << "(sat.mus " << is_sat << ")\n";);
switch (is_sat) {
@ -115,7 +115,7 @@ namespace sat {
IF_VERBOSE(3, verbose_stream() << "(sat.mus unit reduction, literal is in both cores " << lit << ")\n";);
}
else {
TRACE("sat", tout << "core: " << new_core << " mus: " << mus << "\n";);
TRACE(sat, tout << "core: " << new_core << " mus: " << mus << "\n";);
core.reset();
for (unsigned i = 0; i < new_core.size(); ++i) {
literal lit = new_core[i];

View file

@ -82,13 +82,13 @@ namespace sat {
else {
m_to_assert.reset();
s.push();
TRACE("sat", tout << "probing " << l << "\n";);
TRACE(sat, tout << "probing " << l << "\n";);
s.assign_scoped(l);
m_counter--;
unsigned old_tr_sz = s.m_trail.size();
s.propagate(false);
if (s.inconsistent()) {
TRACE("sat", tout << "probe failed: " << ~l << "\n";);
TRACE(sat, tout << "probe failed: " << ~l << "\n";);
// ~l must be true
s.drat_explain_conflict();
s.pop(1);
@ -121,19 +121,19 @@ namespace sat {
}
void probing::process_core(bool_var v) {
TRACE("probing", tout << "processing: " << v << " counter: " << -m_counter << "\n";);
TRACE(probing, tout << "processing: " << v << " counter: " << -m_counter << "\n";);
SASSERT(s.m_qhead == s.m_trail.size());
SASSERT(s.value(v) == l_undef);
m_counter--;
s.push();
literal l(v, false);
s.assign_scoped(l);
TRACE("sat", tout << "probing " << l << "\n";);
TRACE(sat, tout << "probing " << l << "\n";);
unsigned old_tr_sz = s.m_trail.size();
s.propagate(false);
if (s.inconsistent()) {
// ~l must be true
TRACE("sat", tout << "probe failed: " << ~l << "\n";
TRACE(sat, tout << "probe failed: " << ~l << "\n";
s.display(tout););
s.drat_explain_conflict();
s.pop(1);

View file

@ -65,7 +65,7 @@ namespace sat {
}
void proof_trim::del(literal_vector const& cl, clause* cp) {
CTRACE("sat", cp, tout << "del " << *cp << "\n");
CTRACE(sat, cp, tout << "del " << *cp << "\n");
if (cp)
s.detach_clause(*cp);
else
@ -314,7 +314,7 @@ namespace sat {
clause* proof_trim::del(literal_vector const& cl) {
clause* cp = nullptr;
TRACE("sat", tout << "del: " << cl << "\n");
TRACE(sat, tout << "del: " << cl << "\n");
if (cl.size() == 2) {
s.detach_bin_clause(cl[0], cl[1], true);
return cp;
@ -325,7 +325,7 @@ namespace sat {
auto& [clauses, id, in_core] = e->get_data().m_value;
if (!clauses.empty()) {
cp = clauses.back();
TRACE("sat", tout << "del: " << *cp << "\n");
TRACE(sat, tout << "del: " << *cp << "\n");
s.detach_clause(*cp);
clauses.pop_back();
}

View file

@ -136,7 +136,7 @@ namespace sat {
// visited all successors
if (lowlink[l_idx] == index[l_idx]) {
// found new SCC
CTRACE("scc_cycle", s.back() != l_idx, {
CTRACE(scc_cycle, s.back() != l_idx, {
tout << "cycle: ";
unsigned j = s.size() - 1;
unsigned l2_idx;
@ -153,7 +153,7 @@ namespace sat {
bool_var v = l.var();
if (roots[v] != null_literal) {
// variable was already assigned... just consume stack
TRACE("scc_detail", tout << "consuming stack...\n";);
TRACE(scc_detail, tout << "consuming stack...\n";);
unsigned l2_idx;
do {
l2_idx = s.back();
@ -164,7 +164,7 @@ namespace sat {
}
else {
// check if the SCC has an external variable, and check for conflicts
TRACE("scc_detail", tout << "assigning roots...\n";);
TRACE(scc_detail, tout << "assigning roots...\n";);
literal r = null_literal;
unsigned j = s.size() - 1;
unsigned l2_idx;
@ -186,7 +186,7 @@ namespace sat {
r = to_literal(l_idx);
}
TRACE("scc_detail", tout << "r: " << r << "\n";);
TRACE(scc_detail, tout << "r: " << r << "\n";);
do {
l2_idx = s.back();
@ -228,23 +228,23 @@ namespace sat {
return 0;
CASSERT("scc_bug", m_solver.check_invariant());
report rpt(*this);
TRACE("scc", m_solver.display(tout););
TRACE("scc_details", m_solver.display_watches(tout););
TRACE(scc, m_solver.display(tout););
TRACE(scc_details, m_solver.display_watches(tout););
literal_vector roots;
bool_var_vector to_elim;
if (!extract_roots(roots, to_elim))
return 0;
TRACE("scc", for (unsigned i = 0; i < roots.size(); i++) { tout << i << " -> " << roots[i] << "\n"; }
TRACE(scc, for (unsigned i = 0; i < roots.size(); i++) { tout << i << " -> " << roots[i] << "\n"; }
tout << "to_elim: "; for (unsigned v : to_elim) tout << v << " "; tout << "\n";);
m_num_elim += to_elim.size();
elim_eqs eliminator(m_solver);
eliminator(roots, to_elim);
TRACE("scc_detail", m_solver.display(tout););
TRACE(scc_detail, m_solver.display(tout););
CASSERT("scc_bug", m_solver.check_invariant());
if (m_scc_tr)
reduce_tr();
TRACE("scc_detail", m_solver.display(tout););
TRACE(scc_detail, m_solver.display(tout););
return to_elim.size();
}

View file

@ -135,7 +135,7 @@ namespace sat {
}
m_sub_todo.erase(c);
c.set_removed(true);
TRACE("sat_simplifier", tout << "del_clause: " << c << "\n";);
TRACE(sat_simplifier, tout << "del_clause: " << c << "\n";);
m_need_cleanup = true;
m_use_list.erase(c);
}
@ -180,7 +180,7 @@ namespace sat {
m_sub_bin_todo.reset();
m_elim_todo.reset();
init_visited();
TRACE("after_cleanup", s.display(tout););
TRACE(after_cleanup, s.display(tout););
CASSERT("sat_solver", s.check_invariant());
}
@ -194,10 +194,10 @@ namespace sat {
initialize();
CASSERT("sat_solver", s.check_invariant());
TRACE("sat_simplifier", s.display(tout););
TRACE(sat_simplifier, s.display(tout););
s.m_cleaner(true);
TRACE("after_cleanup", s.display(tout););
TRACE(after_cleanup, s.display(tout););
CASSERT("sat_solver", s.check_invariant());
m_need_cleanup = false;
m_use_list.init(s.num_vars());
@ -243,7 +243,7 @@ namespace sat {
bool vars_eliminated = m_num_elim_vars > m_old_num_elim_vars;
if (m_need_cleanup || vars_eliminated) {
TRACE("after_simplifier", tout << "cleanning watches...\n";);
TRACE(after_simplifier, tout << "cleanning watches...\n";);
cleanup_watches();
move_clauses(s.m_learned, true);
move_clauses(s.m_clauses, false);
@ -252,7 +252,7 @@ namespace sat {
}
CASSERT("sat_solver", s.check_invariant());
TRACE("sat_simplifier", s.display(tout); tout << "model_converter:\n"; s.m_mc.display(tout););
TRACE(sat_simplifier, s.display(tout); tout << "model_converter:\n"; s.m_mc.display(tout););
finalize();
}
@ -301,7 +301,7 @@ namespace sat {
}
void simplifier::cleanup_clauses(clause_vector & cs, bool learned, bool vars_eliminated) {
TRACE("sat", tout << "cleanup_clauses\n";);
TRACE(sat, tout << "cleanup_clauses\n";);
clause_vector::iterator it = cs.begin();
clause_vector::iterator it2 = it;
clause_vector::iterator end = cs.end();
@ -428,7 +428,7 @@ namespace sat {
clause_use_list const & cs = m_use_list.get(target);
for (auto it = cs.mk_iterator(); !it.at_end(); it.next()) {
clause & c2 = it.curr();
CTRACE("sat_simplifier", c2.was_removed(), tout << "clause has been removed:\n" << c2 << "\n";);
CTRACE(sat_simplifier, c2.was_removed(), tout << "clause has been removed:\n" << c2 << "\n";);
SASSERT(!c2.was_removed());
if (&c2 != &c1 &&
c1.size() <= c2.size() &&
@ -470,16 +470,16 @@ namespace sat {
if (c1.is_learned() && !c2.is_learned()) {
s.set_learned(c1, false);
}
TRACE("subsumption", tout << c1 << " subsumed " << c2 << "\n";);
TRACE(subsumption, tout << c1 << " subsumed " << c2 << "\n";);
remove_clause(c2, false);
m_num_subsumed++;
}
else if (!c2.was_removed()) {
// subsumption resolution
TRACE("subsumption_resolution", tout << c1 << " sub-ref(" << *l_it << ") " << c2 << "\n";);
TRACE(subsumption_resolution, tout << c1 << " sub-ref(" << *l_it << ") " << c2 << "\n";);
elim_lit(c2, *l_it);
m_num_sub_res++;
TRACE("subsumption_resolution", tout << "result: " << c2 << "\n";);
TRACE(subsumption_resolution, tout << "result: " << c2 << "\n";);
}
if (s.inconsistent())
break;
@ -570,7 +570,7 @@ namespace sat {
// c2 was subsumed
if (c1.is_learned() && !c2.is_learned())
s.set_learned(c1, false);
TRACE("subsumption", tout << c1 << " subsumed " << c2 << "\n";);
TRACE(subsumption, tout << c1 << " subsumed " << c2 << "\n";);
remove_clause(c2, false);
m_num_subsumed++;
}
@ -672,7 +672,7 @@ namespace sat {
}
void simplifier::elim_lit(clause & c, literal l) {
TRACE("elim_lit", tout << "processing: " << l << " @ " << c << "\n";);
TRACE(elim_lit, tout << "processing: " << l << " @ " << c << "\n";);
m_need_cleanup = true;
m_num_elim_lits++;
insert_elim_todo(l.var());
@ -694,31 +694,31 @@ namespace sat {
unsigned sz0 = c.size();
if (cleanup_clause(c)) {
// clause was satisfied
TRACE("elim_lit", tout << "clause was satisfied\n";);
TRACE(elim_lit, tout << "clause was satisfied\n";);
remove_clause(c, true);
return;
}
unsigned sz = c.size();
switch (sz) {
case 0:
TRACE("elim_lit", tout << "clause is empty\n";);
TRACE(elim_lit, tout << "clause is empty\n";);
s.set_conflict();
break;
case 1:
TRACE("elim_lit", tout << "clause became unit: " << c[0] << "\n";);
TRACE(elim_lit, tout << "clause became unit: " << c[0] << "\n";);
c.restore(sz0);
propagate_unit(c[0]);
// unit propagation removes c
break;
case 2:
TRACE("elim_lit", tout << "clause became binary: " << c[0] << " " << c[1] << "\n";);
TRACE(elim_lit, tout << "clause became binary: " << c[0] << " " << c[1] << "\n";);
c.restore(sz0);
s.mk_bin_clause(c[0], c[1], c.is_learned());
m_sub_bin_todo.push_back(bin_clause(c[0], c[1], c.is_learned()));
remove_clause(c, sz0 != sz);
break;
default:
TRACE("elim_lit", tout << "result: " << c << "\n";);
TRACE(elim_lit, tout << "result: " << c << "\n";);
m_sub_todo.insert(c);
break;
}
@ -742,7 +742,7 @@ namespace sat {
back_subsumption1(c);
if (w.is_learned() && !c.is_learned()) {
SASSERT(wlist[j] == w);
TRACE("set_not_learned_bug",
TRACE(set_not_learned_bug,
tout << "marking as not learned: " << l2 << " " << wlist[j].is_learned() << "\n";);
wlist[j].set_learned(false);
mark_as_not_learned_core(get_wlist(~l2), l);
@ -806,7 +806,7 @@ namespace sat {
continue;
}
if (it->get_literal() == last_lit) {
TRACE("subsumption", tout << "eliminating: " << ~to_literal(l_idx)
TRACE(subsumption, tout << "eliminating: " << ~to_literal(l_idx)
<< " " << it->get_literal() << "\n";);
elim++;
}
@ -850,9 +850,9 @@ namespace sat {
subsumption_report rpt(*this);
elim_dup_bins();
subsume_with_binaries();
TRACE("subsumption_bug", s.display(tout););
TRACE(subsumption_bug, s.display(tout););
while (true) {
TRACE("subsumption", tout << "sub_todo size: " << m_sub_todo.size() << "\n";);
TRACE(subsumption, tout << "sub_todo size: " << m_sub_todo.size() << "\n";);
m_sub_counter -= m_sub_bin_todo.size();
while (!m_sub_bin_todo.empty()) {
@ -869,7 +869,7 @@ namespace sat {
checkpoint();
TRACE("subsumption_bug", s.display(tout););
TRACE(subsumption_bug, s.display(tout););
if (m_sub_todo.empty()) {
m_last_sub_trail_sz = s.m_trail.size();
@ -883,7 +883,7 @@ namespace sat {
c.unmark_strengthened();
m_sub_counter--;
TRACE("subsumption", tout << "next: " << c << "\n";);
TRACE(subsumption, tout << "next: " << c << "\n";);
if (s.m_trail.size() > m_last_sub_trail_sz) {
unsigned sz0 = c.size();
if (cleanup_clause(c)) {
@ -901,7 +901,7 @@ namespace sat {
// unit propagation removes c
continue;
case 2:
TRACE("subsumption", tout << "clause became binary: " << c << "\n";);
TRACE(subsumption, tout << "clause became binary: " << c << "\n";);
s.mk_bin_clause(c[0], c[1], c.is_learned());
m_sub_bin_todo.push_back(bin_clause(c[0], c[1], c.is_learned()));
c.restore(sz0);
@ -911,7 +911,7 @@ namespace sat {
break;
}
}
TRACE("subsumption", tout << "using: " << c << "\n";);
TRACE(subsumption, tout << "using: " << c << "\n";);
back_subsumption1(c);
}
}
@ -1584,7 +1584,7 @@ namespace sat {
}
void block_covered_clause(clause& c, literal l, model_converter::kind k) {
TRACE("blocked_clause", tout << "new blocked clause: " << c << "\n";);
TRACE(blocked_clause, tout << "new blocked clause: " << c << "\n";);
SASSERT(!s.is_external(l));
model_converter::entry& new_entry = m_mc.mk(k, l.var());
for (literal lit : c) {
@ -1599,7 +1599,7 @@ namespace sat {
SASSERT(!s.is_external(blocked));
model_converter::entry& new_entry = m_mc.mk(k, blocked.var());
literal l2 = w.get_literal();
TRACE("blocked_clause", tout << "new blocked clause: " << l2 << " " << l1 << "\n";);
TRACE(blocked_clause, tout << "new blocked clause: " << l2 << " " << l1 << "\n";);
s.set_learned(l1, l2);
m_mc.insert(new_entry, m_covered_clause);
m_mc.set_clause(new_entry, l1, l2);
@ -1716,7 +1716,7 @@ namespace sat {
};
void simplifier::elim_blocked_clauses() {
TRACE("blocked_clause_bug", tout << "trail: " << s.m_trail.size() << "\n"; s.display_watches(tout); s.display(tout););
TRACE(blocked_clause_bug, tout << "trail: " << s.m_trail.size() << "\n"; s.display_watches(tout); s.display(tout););
blocked_cls_report rpt(*this);
blocked_clause_elim elim(*this, m_blocked_clause_limit, s.m_mc, m_use_list, s.m_watches);
elim();
@ -1740,7 +1740,7 @@ namespace sat {
unsigned num_bin_pos = num_nonlearned_bin(pos_l);
unsigned num_bin_neg = num_nonlearned_bin(neg_l);
unsigned cost = 2 * num_pos * num_neg + num_pos * num_bin_neg + num_neg * num_bin_pos;
CTRACE("sat_simplifier", cost == 0, tout << v << " num_pos: " << num_pos << " num_neg: " << num_neg << " num_bin_pos: " << num_bin_pos
CTRACE(sat_simplifier, cost == 0, tout << v << " num_pos: " << num_pos << " num_neg: " << num_neg << " num_bin_pos: " << num_bin_pos
<< " num_bin_neg: " << num_bin_neg << " cost: " << cost << "\n";);
return cost;
}
@ -1765,7 +1765,7 @@ namespace sat {
}
m_elim_todo.reset();
std::stable_sort(tmp.begin(), tmp.end(), bool_var_and_cost_lt());
TRACE("sat_simplifier",
TRACE(sat_simplifier,
for (auto& p : tmp) tout << "(" << p.first << ", " << p.second << ") ";
tout << "\n";);
for (auto& p : tmp)
@ -1803,7 +1803,7 @@ namespace sat {
Return false if the result is a tautology
*/
bool simplifier::resolve(clause_wrapper const & c1, clause_wrapper const & c2, literal l, literal_vector & r) {
CTRACE("resolve_bug", !c1.contains(l) || !c2.contains(~l), tout << c1 << "\n" << c2 << "\nl: " << l << "\n";);
CTRACE(resolve_bug, !c1.contains(l) || !c2.contains(~l), tout << c1 << "\n" << c2 << "\nl: " << l << "\n";);
if (m_visited.size() <= 2*s.num_vars())
m_visited.resize(2*s.num_vars(), false);
if (c1.was_removed() && !c1.contains(l))
@ -1873,7 +1873,7 @@ namespace sat {
watch_list::iterator end2 = wlist2.end();
for (; it2 != end2; ++it2) {
if (it2->is_binary_clause() && it2->get_literal() == l) {
TRACE("bin_clause_bug", tout << "removing: " << l << " " << it2->get_literal() << "\n";);
TRACE(bin_clause_bug, tout << "removing: " << l << " " << it2->get_literal() << "\n";);
m_sub_bin_todo.erase(bin_clause(l2, l, it2->is_learned()));
continue;
}
@ -1884,7 +1884,7 @@ namespace sat {
m_sub_bin_todo.erase(bin_clause(l, l2, w.is_learned()));
}
}
TRACE("bin_clause_bug", tout << "collapsing watch_list of: " << l << "\n";);
TRACE(bin_clause_bug, tout << "collapsing watch_list of: " << l << "\n";);
wlist.finalize();
}
@ -1903,7 +1903,7 @@ namespace sat {
c.set_removed(true);
m_use_list.erase(c, l);
m_sub_todo.erase(c);
TRACE("sat_simplifier", tout << "del_clause (elim_var): " << c << "\n";);
TRACE(sat_simplifier, tout << "del_clause (elim_var): " << c << "\n";);
m_need_cleanup = true;
}
}
@ -1922,7 +1922,7 @@ namespace sat {
unsigned num_pos = pos_occs.num_irredundant() + num_bin_pos;
unsigned num_neg = neg_occs.num_irredundant() + num_bin_neg;
TRACE("sat_simplifier", tout << v << " num_pos: " << num_pos << " neg_pos: " << num_neg << "\n";);
TRACE(sat_simplifier, tout << v << " num_pos: " << num_pos << " neg_pos: " << num_neg << "\n";);
if (num_pos >= m_res_occ_cutoff && num_neg >= m_res_occ_cutoff)
return false;
@ -1939,7 +1939,7 @@ namespace sat {
before_lits += it.curr().size();
}
TRACE("sat_simplifier", tout << v << " num_pos: " << num_pos << " neg_pos: " << num_neg << " before_lits: " << before_lits << "\n";);
TRACE(sat_simplifier, tout << v << " num_pos: " << num_pos << " neg_pos: " << num_neg << " before_lits: " << before_lits << "\n";);
if (num_pos >= m_res_occ_cutoff3 && num_neg >= m_res_occ_cutoff3 && before_lits > m_res_lit_cutoff3 && s.m_clauses.size() > m_res_cls_cutoff2)
return false;
@ -1955,24 +1955,24 @@ namespace sat {
collect_clauses(pos_l, m_pos_cls);
collect_clauses(neg_l, m_neg_cls);
TRACE("sat_simplifier", tout << "collecting number of after_clauses\n";);
TRACE(sat_simplifier, tout << "collecting number of after_clauses\n";);
unsigned before_clauses = num_pos + num_neg;
unsigned after_clauses = 0;
for (clause_wrapper& c1 : m_pos_cls) {
for (clause_wrapper& c2 : m_neg_cls) {
m_new_cls.reset();
if (resolve(c1, c2, pos_l, m_new_cls)) {
TRACE("sat_simplifier", tout << c1 << "\n" << c2 << "\n-->\n";
TRACE(sat_simplifier, tout << c1 << "\n" << c2 << "\n-->\n";
for (literal l : m_new_cls) tout << l << " "; tout << "\n";);
after_clauses++;
if (after_clauses > before_clauses) {
TRACE("sat_simplifier", tout << "too many after clauses: " << after_clauses << "\n";);
TRACE(sat_simplifier, tout << "too many after clauses: " << after_clauses << "\n";);
return false;
}
}
}
}
TRACE("sat_simplifier", tout << "eliminate " << v << ", before: " << before_clauses << " after: " << after_clauses << "\n";
TRACE(sat_simplifier, tout << "eliminate " << v << ", before: " << before_clauses << " after: " << after_clauses << "\n";
tout << "pos\n";
for (auto & c : m_pos_cls)
tout << c << "\n";
@ -2000,7 +2000,7 @@ namespace sat {
m_new_cls.reset();
if (!resolve(c1, c2, pos_l, m_new_cls))
continue;
TRACE("sat_simplifier", tout << c1 << "\n" << c2 << "\n-->\n" << m_new_cls << "\n";);
TRACE(sat_simplifier, tout << c1 << "\n" << c2 << "\n-->\n" << m_new_cls << "\n";);
if (cleanup_clause(m_new_cls)) {
continue; // clause is already satisfied.
}

View file

@ -90,9 +90,9 @@ namespace sat {
solver::~solver() {
m_ext = nullptr;
SASSERT(m_config.m_num_threads > 1 || m_trim || rlimit().is_canceled() || check_invariant());
CTRACE("sat", !m_clauses.empty(), tout << "Delete clauses\n";);
CTRACE(sat, !m_clauses.empty(), tout << "Delete clauses\n";);
del_clauses(m_clauses);
CTRACE("sat", !m_learned.empty(), tout << "Delete learned\n";);
CTRACE(sat, !m_learned.empty(), tout << "Delete learned\n";);
del_clauses(m_learned);
dealloc(m_cuber);
m_cuber = nullptr;
@ -346,7 +346,7 @@ namespace sat {
DEBUG_CODE({
for (unsigned i = 0; i < num_lits; i++) {
CTRACE("sat", was_eliminated(lits[i]), tout << lits[i] << " was eliminated\n";);
CTRACE(sat, was_eliminated(lits[i]), tout << lits[i] << " was eliminated\n";);
SASSERT(!was_eliminated(lits[i]));
}
});
@ -412,12 +412,12 @@ namespace sat {
clause * solver::mk_clause_core(unsigned num_lits, literal * lits, sat::status st) {
bool redundant = st.is_redundant();
TRACE("sat", tout << "mk_clause: " << mk_lits_pp(num_lits, lits) << (redundant?" learned":" aux") << "\n";);
TRACE(sat, tout << "mk_clause: " << mk_lits_pp(num_lits, lits) << (redundant?" learned":" aux") << "\n";);
bool logged = false;
if (!redundant || !st.is_sat()) {
unsigned old_sz = num_lits;
bool keep = m_trim || simplify_clause(num_lits, lits);
TRACE("sat_mk_clause", tout << "mk_clause (after simp), keep: " << keep << "\n" << mk_lits_pp(num_lits, lits) << "\n";);
TRACE(sat_mk_clause, tout << "mk_clause (after simp), keep: " << keep << "\n" << mk_lits_pp(num_lits, lits) << "\n";);
if (!keep) {
return nullptr; // clause is equivalent to true.
}
@ -472,7 +472,7 @@ namespace sat {
}
watched* w0 = redundant ? find_binary_watch(get_wlist(~l1), l2) : nullptr;
if (w0 && !m_trim) {
TRACE("sat", tout << "found binary " << l1 << " " << l2 << "\n";);
TRACE(sat, tout << "found binary " << l1 << " " << l2 << "\n";);
if (w0->is_learned() && !redundant) {
w0->set_learned(false);
w0 = find_binary_watch(get_wlist(~l2), l1);
@ -532,13 +532,13 @@ namespace sat {
void solver::push_reinit_stack(clause & c) {
SASSERT(!at_base_lvl());
TRACE("sat_reinit", tout << "adding to reinit stack: " << c << "\n";);
TRACE(sat_reinit, tout << "adding to reinit stack: " << c << "\n";);
m_clauses_to_reinit.push_back(clause_wrapper(c));
c.set_reinit_stack(true);
}
void solver::push_reinit_stack(literal l1, literal l2) {
TRACE("sat_reinit", tout << "adding to reinit stack: " << l1 << " " << l2 << "\n";);
TRACE(sat_reinit, tout << "adding to reinit stack: " << l1 << " " << l2 << "\n";);
m_clauses_to_reinit.push_back(clause_wrapper(l1, l2));
}
@ -802,7 +802,7 @@ namespace sat {
unsigned num_lits = cls.size();
for (unsigned i = 1; i < num_lits; i++) {
literal l = cls[i];
CTRACE("sat", value(l) != l_false, tout << l << ":=" << value(l););
CTRACE(sat, value(l) != l_false, tout << l << ":=" << value(l););
SASSERT(value(l) == l_false);
if (max_false_idx == UINT_MAX || lvl(l) > lvl(cls[max_false_idx]))
max_false_idx = i;
@ -877,13 +877,13 @@ namespace sat {
m_inconsistent = true;
m_conflict = c;
m_not_l = not_l;
TRACE("sat", display(display_justification(tout << "conflict " << not_l << " ", c) << "\n"));
TRACE(sat, display(display_justification(tout << "conflict " << not_l << " ", c) << "\n"));
}
void solver::assign_core(literal l, justification j) {
SASSERT(value(l) == l_undef);
SASSERT(!m_trail.contains(l) && !m_trail.contains(~l));
TRACE("sat_assign_core", tout << l << " " << j << "\n";);
TRACE(sat_assign_core, tout << l << " " << j << "\n";);
if (j.level() == 0) {
if (m_config.m_drat)
drat_log_unit(l, j);
@ -1015,7 +1015,7 @@ namespace sat {
bool keep;
unsigned curr_level = lvl(l);
TRACE("sat_propagate", tout << "propagating: " << l << "@" << curr_level << " " << m_justification[l.var()] << "\n"; );
TRACE(sat_propagate, tout << "propagating: " << l << "@" << curr_level << " " << m_justification[l.var()] << "\n"; );
literal not_l = ~l;
SASSERT(value(l) == l_true);
@ -1052,7 +1052,7 @@ namespace sat {
break;
case watched::CLAUSE: {
if (value(it->get_blocked_literal()) == l_true) {
TRACE("propagate_clause_bug", tout << "blocked literal " << it->get_blocked_literal() << "\n";
TRACE(propagate_clause_bug, tout << "blocked literal " << it->get_blocked_literal() << "\n";
tout << get_clause(it) << "\n";);
*it2 = *it;
it2++;
@ -1060,10 +1060,10 @@ namespace sat {
}
clause_offset cls_off = it->get_clause_offset();
clause& c = get_clause(cls_off);
TRACE("propagate_clause_bug", tout << "processing... " << c << "\nwas_removed: " << c.was_removed() << "\n";);
TRACE(propagate_clause_bug, tout << "processing... " << c << "\nwas_removed: " << c.was_removed() << "\n";);
if (c[0] == not_l)
std::swap(c[0], c[1]);
CTRACE("propagate_bug", c[1] != not_l, tout << "l: " << l << " " << c << "\n";);
CTRACE(propagate_bug, c[1] != not_l, tout << "l: " << l << " " << c << "\n";);
if (c.was_removed() || c.size() == 1 || c[1] != not_l) {
@ -1267,8 +1267,8 @@ namespace sat {
propagate(false);
if (check_inconsistent()) return l_false;
if (m_config.m_force_cleanup) do_cleanup(true);
TRACE("sat", display(tout););
TRACE("before_search", display(tout););
TRACE(sat, display(tout););
TRACE(before_search, display(tout););
if (m_config.m_gc_burst) {
// force gc
@ -1283,7 +1283,7 @@ namespace sat {
if (m_config.m_max_conflicts == 0) {
IF_VERBOSE(SAT_VB_LVL, verbose_stream() << "(sat \"abort: max-conflicts = 0\")\n";);
TRACE("sat", display(tout); m_mc.display(tout););
TRACE(sat, display(tout); m_mc.display(tout););
return l_undef;
}
@ -1662,7 +1662,7 @@ namespace sat {
if (num_vars() == 0)
return null_bool_var;
next = m_rand() % num_vars();
TRACE("random_split", tout << "next: " << next << " value(next): " << value(next) << "\n";);
TRACE(random_split, tout << "next: " << next << " value(next): " << value(next) << "\n";);
if (value(next) == l_undef && !was_eliminated(next))
return next;
}
@ -1730,7 +1730,7 @@ namespace sat {
push();
m_stats.m_decision++;
CTRACE("sat", m_best_phase[next] != guess(next), tout << "phase " << phase << " " << m_best_phase[next] << " " << guess(next) << "\n");
CTRACE(sat, m_best_phase[next] != guess(next), tout << "phase " << phase << " " << m_best_phase[next] << " " << guess(next) << "\n");
if (phase == l_undef)
phase = guess(next) ? l_true: l_false;
@ -1754,7 +1754,7 @@ namespace sat {
if (!is_pos)
next_lit.neg();
TRACE("sat_decide", tout << scope_lvl() << ": next-case-split: " << next_lit << "\n";);
TRACE(sat_decide, tout << scope_lvl() << ": next-case-split: " << next_lit << "\n";);
assign_scoped(next_lit);
return true;
}
@ -1845,7 +1845,7 @@ namespace sat {
if (inconsistent())
return;
TRACE("sat",
TRACE(sat,
tout << literal_vector(num_lits, lits) << "\n";
if (!m_user_scope_literals.empty())
tout << "user literals: " << m_user_scope_literals << "\n";
@ -1894,7 +1894,7 @@ namespace sat {
pop_to_base_level();
push();
reset_assumptions();
TRACE("sat", tout << "reassert: " << m_min_core << "\n";);
TRACE(sat, tout << "reassert: " << m_min_core << "\n";);
for (literal lit : m_min_core) {
SASSERT(is_external(lit.var()));
add_assumption(lit);
@ -1906,7 +1906,7 @@ namespace sat {
void solver::reinit_assumptions() {
if (tracking_assumptions() && at_base_lvl() && !inconsistent()) {
TRACE("sat", tout << "assumptions: " << m_assumptions << " user scopes: " << m_user_scope_literals << "\n";);
TRACE(sat, tout << "assumptions: " << m_assumptions << " user scopes: " << m_user_scope_literals << "\n";);
if (!propagate(false)) return;
push();
for (literal lit : m_user_scope_literals) {
@ -1921,7 +1921,7 @@ namespace sat {
if (!inconsistent())
propagate(false);
TRACE("sat",
TRACE(sat,
tout << "consistent: " << !inconsistent() << "\n";
for (literal a : m_assumptions) {
index_set s;
@ -2006,7 +2006,7 @@ namespace sat {
m_mc.init_search(*this);
if (m_ext)
m_ext->init_search();
TRACE("sat", display(tout););
TRACE(sat, display(tout););
}
bool solver::should_simplify() const {
@ -2022,7 +2022,7 @@ namespace sat {
log_stats();
m_simplifications++;
TRACE("sat", tout << "simplify\n";);
TRACE(sat, tout << "simplify\n";);
pop(scope_lvl());
struct report {
@ -2152,7 +2152,7 @@ namespace sat {
m_best_phase[v] = value(v) == l_true;
}
}
TRACE("sat_mc_bug", m_mc.display(tout););
TRACE(sat_mc_bug, m_mc.display(tout););
#if 0
IF_VERBOSE(2, for (bool_var v = 0; v < num; v++) verbose_stream() << v << ": " << m_model[v] << "\n";);
@ -2184,7 +2184,7 @@ namespace sat {
throw solver_exception("check model failed");
}
TRACE("sat", for (bool_var v = 0; v < num; v++) tout << v << ": " << m_model[v] << "\n";);
TRACE(sat, for (bool_var v = 0; v < num; v++) tout << v << ": " << m_model[v] << "\n";);
if (m_clone) {
IF_VERBOSE(1, verbose_stream() << "\"checking model (on original set of clauses)\"\n";);
@ -2202,7 +2202,7 @@ namespace sat {
clause const & c = *cp;
if (!c.satisfied_by(m)) {
IF_VERBOSE(1, verbose_stream() << "failed clause " << c.id() << ": " << c << "\n";);
TRACE("sat", tout << "failed: " << c << "\n";
TRACE(sat, tout << "failed: " << c << "\n";
tout << "assumptions: " << m_assumptions << "\n";
tout << "trail: " << m_trail << "\n";
tout << "model: " << m << "\n";
@ -2227,7 +2227,7 @@ namespace sat {
if (value_at(l2, m) != l_true) {
IF_VERBOSE(1, verbose_stream() << "failed binary: " << l << " := " << value_at(l, m) << " " << l2 << " := " << value_at(l2, m) << "\n");
IF_VERBOSE(1, verbose_stream() << "elim l1: " << was_eliminated(l.var()) << " elim l2: " << was_eliminated(l2) << "\n");
TRACE("sat", m_mc.display(tout << "failed binary: " << l << " " << l2 << "\n"););
TRACE(sat, m_mc.display(tout << "failed binary: " << l << " " << l2 << "\n"););
ok = false;
}
}
@ -2238,7 +2238,7 @@ namespace sat {
if (value_at(l, m) != l_true) {
VERIFY(is_external(l.var()));
IF_VERBOSE(1, verbose_stream() << "assumption: " << l << " does not model check " << value_at(l, m) << "\n";);
TRACE("sat",
TRACE(sat,
tout << l << " does not model check\n";
tout << "trail: " << m_trail << "\n";
tout << "model: " << m << "\n";
@ -2257,7 +2257,7 @@ namespace sat {
bool ok = check_clauses(m);
if (ok && !m_mc.check_model(m)) {
ok = false;
TRACE("sat", tout << "model: " << m << "\n"; m_mc.display(tout););
TRACE(sat, tout << "model: " << m << "\n"; m_mc.display(tout););
IF_VERBOSE(0, verbose_stream() << "model check failed\n");
}
return ok;
@ -2349,9 +2349,9 @@ namespace sat {
}
log_stats();
}
TRACE("sat", tout << "restart " << restart_level(to_base) << "\n";);
TRACE(sat, tout << "restart " << restart_level(to_base) << "\n";);
IF_VERBOSE(30, display_status(verbose_stream()););
TRACE("sat", tout << "restart " << restart_level(to_base) << "\n";);
TRACE(sat, tout << "restart " << restart_level(to_base) << "\n";);
pop_reinit(restart_level(to_base));
set_next_restart();
}
@ -2446,7 +2446,7 @@ namespace sat {
if (m_conflict_lvl <= 1 && (!m_assumptions.empty() ||
!m_ext_assumption_set.empty() ||
!m_user_scope_literals.empty())) {
TRACE("sat", tout << "unsat core\n";);
TRACE(sat, tout << "unsat core\n";);
resolve_conflict_for_unsat_core();
return l_false;
}
@ -2455,7 +2455,7 @@ namespace sat {
drat_explain_conflict();
if (m_config.m_drat)
drat_log_clause(0, nullptr, sat::status::redundant());
TRACE("sat", tout << "conflict level is 0\n";);
TRACE(sat, tout << "conflict level is 0\n";);
return l_false;
}
@ -2464,7 +2464,7 @@ namespace sat {
// that only get triggered after decisions.
if (allow_backtracking() && unique_max && !m_force_conflict_analysis) {
TRACE("sat", tout << "unique max " << js << " " << m_not_l << "\n";);
TRACE(sat, tout << "unique max " << js << " " << m_not_l << "\n";);
pop_reinit(m_scope_lvl - m_conflict_lvl + 1);
m_force_conflict_analysis = true;
++m_stats.m_backtracks;
@ -2494,7 +2494,7 @@ namespace sat {
// save space for first uip
m_lemma.push_back(null_literal);
TRACE("sat_conflict_detail",
TRACE(sat_conflict_detail,
tout << "resolve: " << m_not_l << " "
<< " js: " << js
<< " idx: " << idx
@ -2504,13 +2504,13 @@ namespace sat {
unsigned num_marks = 0;
literal consequent = null_literal;
if (m_not_l != null_literal) {
TRACE("sat_conflict_detail", tout << "not_l: " << m_not_l << "\n";);
TRACE(sat_conflict_detail, tout << "not_l: " << m_not_l << "\n";);
process_antecedent(m_not_l, num_marks);
consequent = ~m_not_l;
}
do {
TRACE("sat_conflict_detail", tout << "processing consequent: " << consequent << " @" << (consequent==null_literal?m_conflict_lvl:lvl(consequent)) << "\n";
TRACE(sat_conflict_detail, tout << "processing consequent: " << consequent << " @" << (consequent==null_literal?m_conflict_lvl:lvl(consequent)) << "\n";
tout << "num_marks: " << num_marks << "\n";
display_justification(tout, js) << "\n";);
@ -2540,7 +2540,7 @@ namespace sat {
}
case justification::EXT_JUSTIFICATION: {
fill_ext_antecedents(consequent, js, false);
TRACE("sat", tout << "ext antecedents: " << m_ext_antecedents << "\n";);
TRACE(sat, tout << "ext antecedents: " << m_ext_antecedents << "\n";);
for (literal l : m_ext_antecedents)
process_antecedent(l, num_marks);
break;
@ -2560,12 +2560,12 @@ namespace sat {
}
SASSERT(lvl(c_var) < m_conflict_lvl);
}
CTRACE("sat", idx == 0,
CTRACE(sat, idx == 0,
tout << "conflict level " << m_conflict_lvl << "\n";
for (literal lit : m_trail)
if (is_marked(lit.var()))
tout << "missed " << lit << "@" << lvl(lit) << "\n";);
CTRACE("sat", idx == 0, display(tout););
CTRACE(sat, idx == 0, display(tout););
if (idx == 0)
IF_VERBOSE(0, verbose_stream() << "num-conflicts: " << m_stats.m_conflict << "\n");
VERIFY(idx > 0);
@ -2577,7 +2577,7 @@ namespace sat {
num_marks--;
reset_mark(c_var);
TRACE("sat", display_justification(tout << consequent << " ", js) << "\n";);
TRACE(sat, display_justification(tout << consequent << " ", js) << "\n";);
}
while (num_marks > 0);
@ -2588,7 +2588,7 @@ namespace sat {
}
void solver::learn_lemma_and_backjump() {
TRACE("sat_lemma", tout << "new lemma size: " << m_lemma.size() << "\n" << m_lemma << "\n";);
TRACE(sat_lemma, tout << "new lemma size: " << m_lemma.size() << "\n" << m_lemma << "\n";);
if (m_lemma.empty()) {
pop_reinit(m_scope_lvl);
@ -2601,7 +2601,7 @@ namespace sat {
reset_lemma_var_marks();
if (m_config.m_dyn_sub_res)
dyn_sub_res();
TRACE("sat_lemma", tout << "new lemma (after minimization) size: " << m_lemma.size() << "\n" << m_lemma << "\n";);
TRACE(sat_lemma, tout << "new lemma (after minimization) size: " << m_lemma.size() << "\n" << m_lemma << "\n";);
}
else {
reset_lemma_var_marks();
@ -2619,7 +2619,7 @@ namespace sat {
backtrack_lvl = backjump_lvl;
for (unsigned i = m_lemma.size(); i-- > 1;) {
if (lvl(m_lemma[i]) == backjump_lvl) {
TRACE("sat", tout << "swap " << m_lemma[0] << "@" << lvl(m_lemma[0]) << m_lemma[1] << "@" << backjump_lvl << "\n";);
TRACE(sat, tout << "swap " << m_lemma[0] << "@" << lvl(m_lemma[0]) << m_lemma[1] << "@" << backjump_lvl << "\n";);
std::swap(m_lemma[i], m_lemma[0]);
break;
}
@ -2638,7 +2638,7 @@ namespace sat {
pop_reinit(num_scopes);
}
else {
TRACE("sat", tout << "backtrack " << (m_scope_lvl - backtrack_lvl + 1) << " scopes\n";);
TRACE(sat, tout << "backtrack " << (m_scope_lvl - backtrack_lvl + 1) << " scopes\n";);
++m_stats.m_backtracks;
pop_reinit(m_scope_lvl - backtrack_lvl + 1);
}
@ -2650,7 +2650,7 @@ namespace sat {
m_par->share_clause(*this, *lemma);
}
m_lemma.reset();
TRACE("sat_conflict_detail", tout << "consistent " << (!m_inconsistent) << " scopes: " << scope_lvl() << " backtrack: " << backtrack_lvl << " backjump: " << backjump_lvl << "\n";);
TRACE(sat_conflict_detail, tout << "consistent " << (!m_inconsistent) << " scopes: " << scope_lvl() << " backtrack: " << backtrack_lvl << " backjump: " << backjump_lvl << "\n";);
decay_activity();
updt_phase_counters();
}
@ -2668,7 +2668,7 @@ namespace sat {
void solver::process_antecedent_for_unsat_core(literal antecedent) {
bool_var var = antecedent.var();
SASSERT(var < num_vars());
TRACE("sat", tout << antecedent << " " << (is_marked(var)?"+":"-") << "\n";);
TRACE(sat, tout << antecedent << " " << (is_marked(var)?"+":"-") << "\n";);
if (!is_marked(var)) {
mark(var);
m_unmark.push_back(var);
@ -2679,7 +2679,7 @@ namespace sat {
}
void solver::process_consequent_for_unsat_core(literal consequent, justification const& js) {
TRACE("sat", tout << "processing consequent: ";
TRACE(sat, tout << "processing consequent: ";
if (consequent == null_literal) tout << "null\n";
else tout << consequent << "\n";
display_justification(tout << "js kind: ", js) << "\n";);
@ -2722,7 +2722,7 @@ namespace sat {
}
void solver::resolve_conflict_for_unsat_core() {
TRACE("sat_verbose", display(tout);
TRACE(sat_verbose, display(tout);
unsigned level = 0;
for (literal l : m_trail) {
if (level != lvl(l)) {
@ -2755,7 +2755,7 @@ namespace sat {
literal consequent = m_not_l;
if (m_not_l != null_literal) {
justification js = m_justification[m_not_l.var()];
TRACE("sat", tout << "not_l: " << m_not_l << "\n";
TRACE(sat, tout << "not_l: " << m_not_l << "\n";
display_justification(tout, js) << "\n";);
process_antecedent_for_unsat_core(m_not_l);
@ -2818,7 +2818,7 @@ namespace sat {
if (not_l != null_literal) {
level = lvl(not_l);
}
TRACE("sat", tout << "level " << not_l << " is " << level << " " << js << "\n");
TRACE(sat, tout << "level " << not_l << " is " << level << " " << js << "\n");
switch (js.get_kind()) {
case justification::NONE:
@ -2842,7 +2842,7 @@ namespace sat {
UNREACHABLE();
break;
}
TRACE("sat", tout << "max-level " << level << " " << unique_max << "\n");
TRACE(sat, tout << "max-level " << level << " " << unique_max << "\n");
return level;
}
@ -2869,7 +2869,7 @@ namespace sat {
bool_var var = antecedent.var();
unsigned var_lvl = lvl(var);
SASSERT(var < num_vars());
TRACE("sat_verbose", tout << "process " << var << "@" << var_lvl << " marked " << is_marked(var) << " conflict " << m_conflict_lvl << "\n";);
TRACE(sat_verbose, tout << "process " << var << "@" << var_lvl << " marked " << is_marked(var) << " conflict " << m_conflict_lvl << "\n";);
if (!is_marked(var) && var_lvl > 0) {
mark(var);
switch (m_config.m_branching_heuristic) {
@ -2917,7 +2917,7 @@ namespace sat {
unsigned sz = m_trail.size();
for (unsigned i = head; i < sz; i++) {
bool_var v = m_trail[i].var();
TRACE("forget_phase", tout << "forgetting phase of v" << v << "\n";);
TRACE(forget_phase, tout << "forgetting phase of v" << v << "\n";);
m_phase[v] = m_rand() % 2 == 0;
}
if (is_sat_phase() && head >= m_best_phase_size) {
@ -3229,7 +3229,7 @@ namespace sat {
UNREACHABLE();
break;
}
TRACE("sat_conflict",
TRACE(sat_conflict,
display_justification(tout << var << " ",js) << "\n";);
}
return true;
@ -3496,7 +3496,7 @@ namespace sat {
void solver::push() {
SASSERT(!m_ext || !m_ext->can_propagate());
SASSERT(!inconsistent());
TRACE("sat_verbose", tout << "q:" << m_qhead << " trail: " << m_trail.size() << "\n";);
TRACE(sat_verbose, tout << "q:" << m_qhead << " trail: " << m_trail.size() << "\n";);
SASSERT(m_qhead == m_trail.size());
m_scopes.push_back(scope());
scope & s = m_scopes.back();
@ -3568,7 +3568,7 @@ namespace sat {
cleanup_watch(literal(v, true));
}
TRACE("sat",
TRACE(sat,
tout << "clauses to reinit: " << (m_clauses_to_reinit.size() - old_sz) << "\n";
tout << "new level: " << new_lvl << "\n";
tout << "vars to reinit: " << m_vars_to_reinit << "\n";
@ -3654,7 +3654,7 @@ namespace sat {
DEBUG_CODE(for (literal l : m_trail) SASSERT(lvl(l.var()) <= new_lvl););
m_qhead = m_trail.size();
if (!m_replay_assign.empty()) IF_VERBOSE(20, verbose_stream() << "replay assign: " << m_replay_assign.size() << "\n");
CTRACE("sat", !m_replay_assign.empty(), tout << "replay-assign: " << m_replay_assign << "\n";);
CTRACE(sat, !m_replay_assign.empty(), tout << "replay-assign: " << m_replay_assign << "\n";);
for (unsigned i = m_replay_assign.size(); i-- > 0; ) {
literal lit = m_replay_assign[i];
SASSERT(value(lit) == l_true);
@ -3710,7 +3710,7 @@ namespace sat {
m_cut_simplifier = nullptr; // for simplicity, wipe it out
if (m_ext)
m_ext->user_push();
TRACE("sat", tout << "user_push: " << lit << "\n";);
TRACE(sat, tout << "user_push: " << lit << "\n";);
}
void solver::user_pop(unsigned num_scopes) {
@ -3725,7 +3725,7 @@ namespace sat {
m_ext->user_pop(num_scopes);
gc_vars(max_var);
TRACE("sat", display(tout););
TRACE(sat, display(tout););
m_qhead = 0;
unsigned j = 0;
@ -3859,7 +3859,7 @@ namespace sat {
literal l2 = w.get_literal();
if (l.index() > l2.index())
continue;
TRACE("cleanup_bug", tout << "collected: " << l << " " << l2 << "\n";);
TRACE(cleanup_bug, tout << "collected: " << l << " " << l2 << "\n";);
r.push_back(bin_clause(l, l2));
}
}
@ -4121,7 +4121,7 @@ namespace sat {
if (c.frozen())
continue;
if (is_empty(c) || is_unit(c)) {
TRACE("sat_missed_prop", tout << "missed_propagation: " << c << "\n";
TRACE(sat_missed_prop, tout << "missed_propagation: " << c << "\n";
for (literal l : c) tout << l << ": " << value(l) << "\n";);
UNREACHABLE();
}
@ -4355,16 +4355,16 @@ namespace sat {
void solver::fixup_consequence_core() {
index_set s;
TRACE("sat", tout << m_core << "\n";);
TRACE(sat, tout << m_core << "\n";);
for (unsigned i = 0; i < m_core.size(); ++i) {
TRACE("sat", tout << m_core[i] << ": "; display_index_set(tout, m_antecedents.find(m_core[i].var())) << "\n";);
TRACE(sat, tout << m_core[i] << ": "; display_index_set(tout, m_antecedents.find(m_core[i].var())) << "\n";);
s |= m_antecedents.find(m_core[i].var());
}
m_core.reset();
for (unsigned idx : s) {
m_core.push_back(to_literal(idx));
}
TRACE("sat", tout << m_core << "\n";);
TRACE(sat, tout << m_core << "\n";);
}
bool solver::reached_max_conflicts() {
@ -4385,7 +4385,7 @@ namespace sat {
for (bool_var v : vars) {
unfixed_vars.insert(v);
}
TRACE("sat", tout << asms << "\n";);
TRACE(sat, tout << asms << "\n";);
m_antecedents.reset();
pop_to_base_level();
if (inconsistent()) return l_false;
@ -4438,7 +4438,7 @@ namespace sat {
}
lbool solver::get_consequences(literal_vector const& asms, literal_vector const& lits, vector<literal_vector>& conseq) {
TRACE("sat", tout << asms << "\n";);
TRACE(sat, tout << asms << "\n";);
m_antecedents.reset();
literal_set unfixed_lits(lits), assumptions(asms);
bool_var_set unfixed_vars;
@ -4489,7 +4489,7 @@ namespace sat {
propagate(false);
while (inconsistent()) {
if (!resolve_conflict()) {
TRACE("sat", display(tout << "inconsistent\n"););
TRACE(sat, display(tout << "inconsistent\n"););
m_inconsistent = false;
is_sat = l_undef;
break;
@ -4516,7 +4516,7 @@ namespace sat {
}
}
if (is_sat == l_false) {
TRACE("sat", tout << "unsat\n";);
TRACE(sat, tout << "unsat\n";);
m_inconsistent = false;
}
if (is_sat == l_true) {
@ -4576,7 +4576,7 @@ namespace sat {
void solver::extract_fixed_consequences(literal_set const& unfixed_lits, literal_set const& assumptions, bool_var_set& unfixed_vars, vector<literal_vector>& conseq) {
for (literal lit: unfixed_lits) {
TRACE("sat", tout << "extract: " << lit << " " << value(lit) << " " << lvl(lit) << "\n";);
TRACE(sat, tout << "extract: " << lit << " " << value(lit) << " " << lvl(lit) << "\n";);
if (lvl(lit) <= 1 && value(lit) == l_true) {
extract_fixed_consequences(lit, assumptions, unfixed_vars, conseq);
}
@ -4597,7 +4597,7 @@ namespace sat {
bool solver::extract_assumptions(literal lit, index_set& s) {
justification js = m_justification[lit.var()];
TRACE("sat", tout << lit << " " << js << "\n";);
TRACE(sat, tout << lit << " " << js << "\n";);
bool all_found = true;
switch (js.get_kind()) {
case justification::NONE:
@ -4635,7 +4635,7 @@ namespace sat {
UNREACHABLE();
break;
}
TRACE("sat", display_index_set(tout << lit << ": " , s) << "\n";);
TRACE(sat, display_index_set(tout << lit << ": " , s) << "\n";);
return all_found;
}

View file

@ -395,7 +395,7 @@ namespace sat {
unsigned trail_size() const { return m_trail.size(); }
literal scope_literal(unsigned n) const { return m_trail[m_scopes[n].m_trail_lim]; }
void assign(literal l, justification j) {
TRACE("sat_assign", tout << l << " previous value: " << value(l) << " j: " << j << "\n";);
TRACE(sat_assign, tout << l << " previous value: " << value(l) << " j: " << j << "\n";);
switch (value(l)) {
case l_false: set_conflict(j, ~l); break;
case l_undef: assign_core(l, j); break;
@ -418,7 +418,7 @@ namespace sat {
bool limit_reached() {
if (!m_rlimit.inc()) {
m_model_is_current = false;
TRACE("sat", tout << "canceled\n";);
TRACE(sat, tout << "canceled\n";);
m_reason_unknown = "sat.canceled";
return true;
}

View file

@ -213,7 +213,7 @@ public:
}
}
TRACE("sat", tout << _assumptions << "\n";);
TRACE(sat, tout << _assumptions << "\n";);
m_dep2asm.reset();
lbool r = internalize_formulas();
if (r != l_true) return r;
@ -366,7 +366,7 @@ public:
ast_manager& get_manager() const override { return m; }
void assert_expr_core(expr * t) override {
TRACE("goal2sat", tout << mk_pp(t, m) << "\n";);
TRACE(goal2sat, tout << mk_pp(t, m) << "\n";);
m_is_cnf &= is_clause(t);
m_fmls.push_back(t);
}
@ -488,7 +488,7 @@ public:
lbool get_consequences_core(expr_ref_vector const& assumptions, expr_ref_vector const& vars, expr_ref_vector& conseq) override {
init_preprocess();
TRACE("sat", tout << assumptions << "\n" << vars << "\n";);
TRACE(sat, tout << assumptions << "\n" << vars << "\n";);
sat::literal_vector asms;
sat::bool_var_vector bvars;
vector<sat::literal_vector> lconseq;
@ -513,7 +513,7 @@ public:
// the consequences that cover them.
u_map<unsigned> bool_var2conseq;
for (unsigned i = 0; i < lconseq.size(); ++i) {
TRACE("sat", tout << lconseq[i] << "\n";);
TRACE(sat, tout << lconseq[i] << "\n";);
bool_var2conseq.insert(lconseq[i][0].var(), i);
}
@ -607,7 +607,7 @@ public:
m_cached_mc = m_mcs.back();
m_cached_mc = concat(solver::get_model_converter().get(), m_cached_mc.get());
m_cached_mc = concat(m_cached_mc.get(), m_sat_mc.get());
TRACE("sat", m_cached_mc->display(tout););
TRACE(sat, m_cached_mc->display(tout););
return m_cached_mc;
}
else {
@ -627,7 +627,7 @@ public:
s2g(m_solver, m_map, m_params, g, m_sat_mc);
m_internalized_fmls.reset();
g.get_formulas(m_internalized_fmls);
TRACE("sat", m_solver.display(tout); tout << m_internalized_fmls << "\n";);
TRACE(sat, m_solver.display(tout); tout << m_internalized_fmls << "\n";);
m_internalized_converted = true;
}
@ -738,7 +738,7 @@ private:
m_has_uninterpreted = true;
std::stringstream strm;
strm << "(sat.giveup interpreted functions sent to SAT solver " << funs <<")";
TRACE("sat", tout << strm.str() << "\n";);
TRACE(sat, tout << strm.str() << "\n";);
IF_VERBOSE(1, verbose_stream() << strm.str() << "\n";);
set_reason_unknown(strm.str());
return l_undef;
@ -771,7 +771,7 @@ private:
throw default_exception("generation of proof objects is not supported in this mode");
}
SASSERT(!g->proofs_enabled());
TRACE("sat", m_solver.display(tout); g->display(tout););
TRACE(sat, m_solver.display(tout); g->display(tout););
try {
if (m_is_cnf) {
@ -785,7 +785,7 @@ private:
catch (tactic_exception & ex) {
IF_VERBOSE(1, verbose_stream() << "exception in tactic " << ex.what() << "\n";);
set_reason_unknown(ex.what());
TRACE("sat", tout << "exception: " << ex.what() << "\n";);
TRACE(sat, tout << "exception: " << ex.what() << "\n";);
m_preprocess = nullptr;
m_bb_rewriter = nullptr;
return l_undef;
@ -803,7 +803,7 @@ private:
g = m_subgoals[0];
m_pc = g->pc();
m_mcs.set(m_mcs.size()-1, concat(m_mcs.back(), g->mc()));
TRACE("sat", g->display_with_dependencies(tout););
TRACE(sat, g->display_with_dependencies(tout););
// ensure that if goal is already internalized, then import mc from m_solver.
@ -881,12 +881,12 @@ private:
bvars.push_back(b);
}
}
CTRACE("sat", internalized, tout << "var: " << bvars << "\n";);
CTRACE(sat, internalized, tout << "var: " << bvars << "\n";);
}
else if (is_uninterp_const(v) && bvutil.is_bv(v)) {
// variable does not occur in assertions, so is unconstrained.
}
CTRACE("sat", !internalized, tout << "unhandled variable " << mk_pp(v, m) << "\n";);
CTRACE(sat, !internalized, tout << "unhandled variable " << mk_pp(v, m) << "\n";);
return internalized;
}
@ -907,7 +907,7 @@ private:
}
}
else {
TRACE("sat", tout << "variable is not bound " << mk_pp(v, m) << "\n";);
TRACE(sat, tout << "variable is not bound " << mk_pp(v, m) << "\n";);
return false;
}
}
@ -1021,7 +1021,7 @@ private:
}
}
}
CTRACE("sat", m_dep2asm.size() != m_asms.size(),
CTRACE(sat, m_dep2asm.size() != m_asms.size(),
tout << m_dep2asm.size() << " vs " << m_asms.size() << "\n";
tout << m_asms << "\n";
for (auto const& kv : m_dep2asm) {
@ -1040,7 +1040,7 @@ private:
u_map<expr*> asm2dep;
extract_asm2dep(asm2dep);
sat::literal_vector const& core = m_solver.get_core();
TRACE("sat",
TRACE(sat,
for (auto const& kv : m_dep2asm) {
tout << mk_pp(kv.m_key, m) << " |-> " << sat::literal(kv.m_value) << "\n";
}
@ -1078,7 +1078,7 @@ private:
}
void get_model_core(model_ref & mdl) override {
TRACE("sat", tout << "retrieve model " << (m_solver.model_is_current()?"present":"absent") << "\n";);
TRACE(sat, tout << "retrieve model " << (m_solver.model_is_current()?"present":"absent") << "\n";);
if (!m_solver.model_is_current()) {
mdl = nullptr;
return;
@ -1087,8 +1087,8 @@ private:
mdl = nullptr;
return;
}
TRACE("sat", m_solver.display_model(tout););
CTRACE("sat", m_sat_mc, m_sat_mc->display(tout););
TRACE(sat, m_solver.display_model(tout););
CTRACE(sat, m_sat_mc, m_sat_mc->display(tout););
sat::model ll_m = m_solver.get_model();
mdl = alloc(model, m);
if (m_sat_mc) {
@ -1115,18 +1115,18 @@ private:
}
}
TRACE("sat", m_solver.display(tout););
TRACE(sat, m_solver.display(tout););
if (m_sat_mc) {
(*m_sat_mc)(mdl);
}
m_goal2sat.update_model(mdl);
if (m_mcs.back()) {
TRACE("sat", m_mcs.back()->display(tout););
TRACE(sat, m_mcs.back()->display(tout););
(*m_mcs.back())(mdl);
}
TRACE("sat", model_smt2_pp(tout, m, *mdl, 0););
TRACE(sat, model_smt2_pp(tout, m, *mdl, 0););
if (!gparams::get_ref().get_bool("model_validate", false)) {
return;
@ -1142,7 +1142,7 @@ private:
eval(f, tmp);
if (m.limit().is_canceled())
return;
CTRACE("sat", !m.is_true(tmp),
CTRACE(sat, !m.is_true(tmp),
tout << "Evaluation failed: " << mk_pp(f, m) << " to " << tmp << "\n";
model_smt2_pp(tout, m, *(mdl.get()), 0););
if (m.is_false(tmp)) {

View file

@ -172,7 +172,7 @@ public:
expr_ref_vector assumptions(m);
for (unsigned i = 0; i < sz; ++i)
assumptions.push_back(ensure_literal(_assumptions[i]));
TRACE("sat", tout << assumptions << "\n";);
TRACE(sat, tout << assumptions << "\n";);
lbool r = internalize_formulas(assumptions);
if (r != l_true)
return r;
@ -501,7 +501,7 @@ public:
if (is_internalized() && m_internalized_converted) {
if (m_sat_mc) m_sat_mc->flush_smc(m_solver, m_map);
m_cached_mc = concat(solver::get_model_converter().get(), m_sat_mc.get());
TRACE("sat", m_cached_mc->display(tout););
TRACE(sat, m_cached_mc->display(tout););
return m_cached_mc;
}
else {
@ -521,7 +521,7 @@ public:
s2g(m_solver, m_map, m_params, g, m_sat_mc);
m_internalized_fmls.reset();
g.get_formulas(m_internalized_fmls);
TRACE("sat", m_solver.display(tout); tout << m_internalized_fmls << "\n";);
TRACE(sat, m_solver.display(tout); tout << m_internalized_fmls << "\n";);
m_internalized_converted = true;
}
@ -604,7 +604,7 @@ private:
if (is_internalized() && assumptions.empty())
return l_true;
TRACE("sat", tout << "qhead " << m_qhead << "\n");
TRACE(sat, tout << "qhead " << m_qhead << "\n");
m_internalized_converted = false;
@ -624,7 +624,7 @@ private:
return;
for (sat::literal c : m_solver.get_core())
m_core.push_back(m_dep.lit2orig(c));
TRACE("sat",
TRACE(sat,
tout << "core: " << m_solver.get_core() << "\n";
tout << "core: " << m_core << "\n";
m_solver.display(tout));
@ -644,7 +644,7 @@ private:
}
void get_model_core(model_ref & mdl) override {
TRACE("sat", tout << "retrieve model " << (m_solver.model_is_current()?"present":"absent") << "\n";);
TRACE(sat, tout << "retrieve model " << (m_solver.model_is_current()?"present":"absent") << "\n";);
mdl = nullptr;
auto ext = get_euf();
if (ext)
@ -655,8 +655,8 @@ private:
return;
if (m_fmls.size() > m_qhead)
return;
TRACE("sat", m_solver.display_model(tout););
CTRACE("sat", m_sat_mc, m_sat_mc->display(tout););
TRACE(sat, m_solver.display_model(tout););
CTRACE(sat, m_sat_mc, m_sat_mc->display(tout););
sat::model ll_m = m_solver.get_model();
mdl = alloc(model, m);
if (m_sat_mc)
@ -680,12 +680,12 @@ private:
}
}
TRACE("sat", m_solver.display(tout););
TRACE(sat, m_solver.display(tout););
if (m_sat_mc)
(*m_sat_mc)(mdl);
m_goal2sat.update_model(mdl);
TRACE("sat", model_smt2_pp(tout, m, *mdl, 0););
TRACE(sat, model_smt2_pp(tout, m, *mdl, 0););
if (gparams::get_ref().get_bool("model_validate", false)) {
IF_VERBOSE(1, verbose_stream() << "Verifying solution\n";);
@ -699,7 +699,7 @@ private:
eval(f, tmp);
if (m.limit().is_canceled())
return;
CTRACE("sat", !m.is_true(tmp),
CTRACE(sat, !m.is_true(tmp),
tout << "Evaluation failed: " << mk_pp(f, m) << " to " << tmp << "\n";
model_smt2_pp(tout, m, *(mdl.get()), 0););
if (m.is_false(tmp)) {

View file

@ -57,7 +57,7 @@ namespace sat {
SASSERT(c.size() > 2);
unsigned filter = get_clause_filter(c);
s.init_visited();
TRACE("sat_xor", tout << c << "\n";);
TRACE(sat_xor, tout << c << "\n";);
bool parity = false;
unsigned mask = 0, i = 0;
for (literal l : c) {
@ -117,7 +117,7 @@ namespace sat {
s.set_external(l.var());
}
if (parity == (lits.size() % 2 == 0)) lits[0].neg();
TRACE("sat_xor", tout << parity << ": " << lits << "\n";);
TRACE(sat_xor, tout << parity << ": " << lits << "\n";);
m_on_xor(lits);
}
@ -137,7 +137,7 @@ namespace sat {
m_missing.push_back(i);
}
}
TRACE("sat_xor", tout << l1 << " " << l2 << "\n";);
TRACE(sat_xor, tout << l1 << " " << l2 << "\n";);
return update_combinations(c, parity, mask);
}
@ -154,7 +154,7 @@ namespace sat {
m_clauses_to_remove.push_back(&c2);
c2.mark_used();
}
TRACE("sat_xor", tout << c2 << "\n";);
TRACE(sat_xor, tout << c2 << "\n";);
// insert missing
unsigned mask = 0;
m_missing.reset();
@ -192,7 +192,7 @@ namespace sat {
// return true if xor clause is covered.
unsigned sz = c.size();
for (unsigned i = 0; i < (1ul << sz); ++i) {
TRACE("sat_xor", tout << i << ": " << parity << " " << m_parity[sz][i] << " " << get_combination(i) << "\n";);
TRACE(sat_xor, tout << i << ": " << parity << " " << m_parity[sz][i] << " " << get_combination(i) << "\n";);
if (parity == m_parity[sz][i] && !get_combination(i)) {
return false;
}

View file

@ -104,7 +104,7 @@ namespace arith {
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);
@ -551,7 +551,7 @@ namespace arith {
force_push();
expr* e1 = var2expr(v1);
expr* e2 = var2expr(v2);
TRACE("arith", tout << "new eq: v" << v1 << " v" << v2 << "\n";);
TRACE(arith, tout << "new eq: v" << v1 << " v" << v2 << "\n";);
if (e1->get_id() > e2->get_id())
std::swap(e1, e2);
@ -572,7 +572,7 @@ namespace arith {
}
void solver::new_diseq_eh(euf::th_eq const& e) {
TRACE("artih", tout << mk_bounded_pp(e.eq(), m) << "\n");
TRACE(artih, tout << mk_bounded_pp(e.eq(), m) << "\n");
ensure_column(e.v1());
ensure_column(e.v2());
m_delayed_eqs.push_back(std::make_pair(e, false));
@ -637,7 +637,7 @@ namespace arith {
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(););
}
/**
@ -676,14 +676,14 @@ namespace arith {
if (a.is_numeral(q, r2) && r2.is_pos()) {
if (!a.is_bounded(n)) {
TRACE("arith", tout << "unbounded " << expr_ref(n, m) << "\n";);
TRACE(arith, tout << "unbounded " << expr_ref(n, m) << "\n";);
continue;
}
theory_var v = internalize_def(n);
lp::impq val_v = get_ivalue(v);
if (val_v.y.is_zero() && val_v.x == div(r1.x, r2)) continue;
TRACE("arith", tout << get_value(v) << " != " << r1 << " div " << r2 << "\n";);
TRACE(arith, tout << get_value(v) << " != " << r1 << " div " << r2 << "\n";);
rational div_r = div(r1.x, r2);
// p <= q * div(r1, q) + q - 1 => div(p, q) <= div(r1, r2)
// p >= q * div(r1, q) => div(r1, q) <= div(p, q)
@ -709,7 +709,7 @@ namespace arith {
all_divs_valid = false;
TRACE("arith", tout << r1 << " div " << r2 << "\n";);
TRACE(arith, tout << r1 << " div " << r2 << "\n";);
continue;
}
}

View file

@ -255,8 +255,8 @@ namespace arith {
cancel_eh<reslimit> eh(m.limit());
scoped_timer timer(1000, &eh);
bool result = l_true != vs->check_sat();
CTRACE("arith", !result, vs->display(tout));
CTRACE("arith", !result, s().display(tout));
CTRACE(arith, !result, vs->display(tout));
CTRACE(arith, !result, s().display(tout));
SASSERT(result);
return result;
}

View file

@ -81,13 +81,13 @@ namespace arith {
void solver::found_unsupported(expr* n) {
ctx.push(value_trail<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 = n;
}
void solver::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(push_back_vector(m_underspecified));
m_underspecified.push_back(to_app(n));
}
@ -126,7 +126,7 @@ namespace arith {
var = lp().add_var(v, is_int);
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;
}
@ -321,7 +321,7 @@ namespace arith {
}
bool solver::internalize_atom(expr* atom) {
TRACE("arith", tout << mk_pp(atom, m) << "\n";);
TRACE(arith, tout << mk_pp(atom, m) << "\n";);
expr* n1, *n2;
rational r;
lp_api::bound_kind k;
@ -378,7 +378,7 @@ namespace arith {
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;
}
@ -394,7 +394,7 @@ namespace arith {
updt_unassigned_bounds(v, +1);
m_bounds_trail.push_back(v);
m_bool_var2bound.insert(bv, b);
TRACE("arith_verbose", tout << "Internalized " << lit << ": " << mk_pp(atom, m) << " " << *b << "\n";);
TRACE(arith_verbose, tout << "Internalized " << lit << ": " << mk_pp(atom, m) << " " << *b << "\n";);
m_new_bounds.push_back(b);
//add_use_lists(b);
return true;
@ -407,7 +407,7 @@ namespace arith {
}
theory_var solver::internalize_def(expr* term, scoped_internalize_state& st) {
TRACE("arith", tout << expr_ref(term, m) << "\n";);
TRACE(arith, tout << expr_ref(term, m) << "\n";);
if (ctx.get_enode(term))
return mk_evar(term);
@ -432,7 +432,7 @@ namespace arith {
void solver::internalize_args(app* t, bool force) {
SASSERT(!m.is_bool(t));
TRACE("arith", tout << mk_pp(t, m) << " " << force << " " << reflect(t) << "\n";);
TRACE(arith, tout << mk_pp(t, m) << " " << force << " " << reflect(t) << "\n";);
if (!force && !reflect(t))
return;
for (expr* arg : *t)
@ -497,7 +497,7 @@ namespace arith {
theory_var v = mk_evar(n);
vars.push_back(register_theory_var_in_lar_solver(v));
}
TRACE("arith", tout << "v" << v << " := " << mk_pp(t, m) << "\n" << vars << "\n";);
TRACE(arith, tout << "v" << v << " := " << mk_pp(t, m) << "\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());
@ -507,7 +507,7 @@ namespace arith {
theory_var solver::internalize_linearized_def(expr* term, scoped_internalize_state& st) {
theory_var v = mk_evar(term);
TRACE("arith", tout << mk_bounded_pp(term, m) << " v" << v << "\n";);
TRACE(arith, tout << mk_bounded_pp(term, m) << " v" << v << "\n";);
if (is_unit_var(st) && v == st.vars()[0])
return st.vars()[0];
@ -524,7 +524,7 @@ namespace arith {
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";);
@ -566,7 +566,7 @@ namespace arith {
enode* solver::mk_enode(expr* e) {
TRACE("arith", tout << expr_ref(e, m) << "\n";);
TRACE(arith, tout << expr_ref(e, m) << "\n";);
enode* n = ctx.get_enode(e);
if (n)
return n;
@ -588,7 +588,7 @@ namespace arith {
if (e->is_attached_to(get_id()))
return e->get_th_var(get_id());
theory_var v = mk_var(e);
TRACE("arith_verbose", tout << "v" << v << " " << mk_pp(n, m) << "\n";);
TRACE(arith_verbose, tout << "v" << v << " " << mk_pp(n, m) << "\n";);
SASSERT(m_bounds.size() <= static_cast<unsigned>(v) || m_bounds[v].empty());
reserve_bounds(v);
ctx.attach_th_var(e, this, v);

View file

@ -92,7 +92,7 @@ namespace arith {
while (m_asserted_qhead < m_asserted.size() && !s().inconsistent() && m.inc()) {
literal lit = m_asserted[m_asserted_qhead];
api_bound* b = nullptr;
CTRACE("arith", !m_bool_var2bound.contains(lit.var()), tout << "not found " << lit << "\n";);
CTRACE(arith, !m_bool_var2bound.contains(lit.var()), tout << "not found " << lit << "\n";);
if (m_bool_var2bound.find(lit.var(), b))
assert_bound(lit.sign() == b->get_lit().sign(), *b);
++m_asserted_qhead;
@ -150,7 +150,7 @@ namespace arith {
bool v_is_int = b.is_int();
literal lit2 = sat::null_literal;
bool find_glb = (same_polarity == (k == lp_api::lower_t));
TRACE("arith", tout << lit1 << " v" << v << " val " << val << " find_glb: " << find_glb << " is_true: " << is_true << " k: " << k << " is_lower: " << (k == lp_api::lower_t) << "\n";);
TRACE(arith, tout << lit1 << " v" << v << " val " << val << " 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;
@ -197,7 +197,7 @@ namespace arith {
++m_stats.m_bound_propagations2;
reset_evidence();
m_core.push_back(lit1);
TRACE("arith", tout << lit2 << " <- " << m_core << "\n";);
TRACE(arith, tout << lit2 << " <- " << m_core << "\n";);
arith_proof_hint* ph = nullptr;
if (ctx.use_drat()) {
m_arith_hint.set_type(ctx, hint_type::farkas_h);
@ -239,7 +239,7 @@ namespace arith {
if (m_unassigned_bounds[v] == 0 && !should_refine_bounds())
return;
TRACE("arith", tout << "lp bound v" << v << " " << be.kind() << " " << be.m_bound << "\n";);
TRACE(arith, tout << "lp bound v" << v << " " << be.kind() << " " << be.m_bound << "\n";);
lp_bounds const& bounds = m_bounds[v];
bool first = true;
@ -250,7 +250,7 @@ namespace arith {
literal lit = is_bound_implied(be.kind(), be.m_bound, *b);
if (lit == sat::null_literal)
continue;
TRACE("arith", tout << "lp bound " << lit << " bound: " << *b << " first: " << first << "\n";);
TRACE(arith, tout << "lp bound " << lit << " bound: " << *b << " first: " << first << "\n";);
lp().settings().stats().m_num_of_implied_bounds++;
if (first) {
@ -259,9 +259,9 @@ namespace arith {
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", for (auto lit : m_core) tout << lit << ": " << s().value(lit) << "\n";);
TRACE(arith, for (auto lit : m_core) tout << lit << ": " << s().value(lit) << "\n";);
DEBUG_CODE(for (auto lit : m_core) { VERIFY(s().value(lit) == l_true); });
++m_stats.m_bound_propagations1;
assign(lit, m_core, m_eqs, explain(hint_type::bound_h, lit));
@ -273,27 +273,27 @@ namespace arith {
literal solver::is_bound_implied(lp::lconstraint_kind k, rational const& value, api_bound const& b) const {
if ((k == lp::LE || k == lp::LT) && b.get_bound_kind() == lp_api::upper_t && value <= b.get_value()) {
TRACE("arith", tout << "v <= value <= b.get_value() => v <= b.get_value() \n";);
TRACE(arith, tout << "v <= value <= b.get_value() => v <= b.get_value() \n";);
return b.get_lit();
}
if ((k == lp::GE || k == lp::GT) && b.get_bound_kind() == lp_api::lower_t && b.get_value() <= value) {
TRACE("arith", tout << "b.get_value() <= value <= v => b.get_value() <= v \n";);
TRACE(arith, tout << "b.get_value() <= value <= v => b.get_value() <= v \n";);
return b.get_lit();
}
if (k == lp::LE && b.get_bound_kind() == lp_api::lower_t && value < b.get_value()) {
TRACE("arith", tout << "v <= value < b.get_value() => v < b.get_value()\n";);
TRACE(arith, tout << "v <= value < b.get_value() => v < b.get_value()\n";);
return ~b.get_lit();
}
if (k == lp::LT && b.get_bound_kind() == lp_api::lower_t && value <= b.get_value()) {
TRACE("arith", tout << "v < value <= b.get_value() => v < b.get_value()\n";);
TRACE(arith, tout << "v < value <= b.get_value() => v < b.get_value()\n";);
return ~b.get_lit();
}
if (k == lp::GE && b.get_bound_kind() == lp_api::upper_t && b.get_value() < value) {
TRACE("arith", tout << "b.get_value() < value <= v => b.get_value() < v\n";);
TRACE(arith, tout << "b.get_value() < value <= v => b.get_value() < v\n";);
return ~b.get_lit();
}
if (k == lp::GT && b.get_bound_kind() == lp_api::upper_t && b.get_value() <= value) {
TRACE("arith", tout << "b.get_value() <= value < v => b.get_value() < v\n";);
TRACE(arith, tout << "b.get_value() <= value < v => b.get_value() < v\n";);
return ~b.get_lit();
}
return sat::null_literal;
@ -306,7 +306,7 @@ namespace arith {
}
void solver::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;
@ -407,7 +407,7 @@ namespace arith {
void solver::assert_bound(bool is_true, api_bound& b) {
lp::constraint_index ci = b.get_constraint(is_true);
lp().activate(ci);
TRACE("arith", tout << b << " " << is_infeasible() << "\n";);
TRACE(arith, tout << b << " " << is_infeasible() << "\n";);
if (is_infeasible())
return;
lp::lconstraint_kind k = bound2constraint_kind(b.is_int(), b.get_bound_kind(), is_true);
@ -445,7 +445,7 @@ namespace arith {
}
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(history_trail<constraint_bound>(vec, tv, m_history));
b.first = ci;
@ -468,7 +468,7 @@ namespace arith {
}
void solver::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;
@ -483,7 +483,7 @@ namespace arith {
--i;
}
}
CTRACE("arith_verbose", !atoms.empty(),
CTRACE(arith_verbose, !atoms.empty(),
for (unsigned i = 0; i < atoms.size(); ++i) {
atoms[i]->display(tout); tout << "\n";
});
@ -611,7 +611,7 @@ namespace arith {
if (!found_bad && value == get_phase(n->bool_var()))
continue;
TRACE("arith", ctx.display_validation_failure(tout << *b << "\n", mdl, n));
TRACE(arith, ctx.display_validation_failure(tout << *b << "\n", mdl, n));
IF_VERBOSE(0, ctx.display_validation_failure(verbose_stream() << *b << "\n", mdl, n));
UNREACHABLE();
}
@ -633,7 +633,7 @@ namespace arith {
}
else if (v != euf::null_theory_var) {
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: " && (ctx.get_config().m_arith_ignore_int || !a.is_int(o) || r.is_int() || m_not_handled != nullptr || m.limit().is_canceled()));
if (a.is_int(o) && !r.is_int())
r = floor(r);
@ -687,7 +687,7 @@ namespace arith {
}
void solver::push_core() {
TRACE("arith_verbose", tout << "push\n";);
TRACE(arith_verbose, tout << "push\n";);
m_scopes.push_back(scope());
scope& sc = m_scopes.back();
sc.m_bounds_lim = m_bounds_trail.size();
@ -700,7 +700,7 @@ namespace arith {
}
void solver::pop_core(unsigned num_scopes) {
TRACE("arith", tout << "pop " << num_scopes << "\n";);
TRACE(arith, tout << "pop " << num_scopes << "\n";);
unsigned old_size = m_scopes.size() - num_scopes;
del_bounds(m_scopes[old_size].m_bounds_lim);
m_asserted.shrink(m_scopes[old_size].m_asserted_lim);
@ -710,7 +710,7 @@ namespace arith {
m_new_bounds.reset();
if (m_nla)
m_nla->pop(num_scopes);
TRACE("arith_verbose", tout << "num scopes: " << num_scopes << " new scope level: " << m_scopes.size() << "\n";);
TRACE(arith_verbose, tout << "num scopes: " << num_scopes << " new scope level: " << m_scopes.size() << "\n";);
th_euf_solver::pop_core(num_scopes);
}
@ -731,7 +731,7 @@ namespace arith {
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: " << mk_pp(var2expr(v1), m) << " " << mk_pp(var2expr(v2), m) << "\n";);
TRACE(arith, tout << "fixed: " << mk_pp(var2expr(v1), m) << " " << mk_pp(var2expr(v2), m) << "\n";);
// we expect lp() to ensure that none of these returns happen.
if (is_equal(v1, v2))
@ -773,7 +773,7 @@ namespace arith {
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 != euf::null_theory_var && a.is_numeral(var2expr(v), val) && bound == val) {
dep = nullptr;
return bound == val;
@ -804,7 +804,7 @@ namespace arith {
}
void solver::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(vector_value_trail<unsigned, false>(m_unassigned_bounds, v));
m_unassigned_bounds[v] += inc;
}
@ -831,7 +831,7 @@ namespace arith {
void solver::init_model() {
if (m.inc() && m_solver.get() && get_num_vars() > 0) {
TRACE("arith", display(tout << "update variable values\n"););
TRACE(arith, display(tout << "update variable values\n"););
ctx.push(value_trail<bool>(m_model_is_initialized));
m_model_is_initialized = true;
lp().init_model();
@ -888,7 +888,7 @@ namespace arith {
void solver::random_update() {
if (m_nla)
return;
TRACE("arith", tout << s().scope_lvl() << "\n"; tout.flush(););
TRACE(arith, tout << s().scope_lvl() << "\n"; tout.flush(););
m_tmp_var_set.reset();
m_model_eqs.reset();
svector<lpvar> vars;
@ -925,7 +925,7 @@ namespace arith {
if (delayed_assume_eqs())
return true;
TRACE("arith", display(tout););
TRACE(arith, display(tout););
random_update();
m_model_eqs.reset();
theory_var sz = static_cast<theory_var>(get_num_vars());
@ -941,7 +941,7 @@ namespace arith {
if (!is_registered_var(v))
continue;
theory_var other = m_model_eqs.insert_if_not_there(v);
TRACE("arith", tout << "insert: v" << v << " := " << get_value(v) << " found: v" << other << "\n";);
TRACE(arith, tout << "insert: v" << v << " := " << get_value(v) << " found: v" << other << "\n";);
if (!is_equal(other, v))
m_assume_eq_candidates.push_back({ v, other });
}
@ -964,7 +964,7 @@ namespace arith {
enode* n1 = var2enode(v1);
enode* n2 = var2enode(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))
@ -1013,7 +1013,7 @@ namespace arith {
get_infeasibility_explanation_and_set_conflict();
return sat::check_result::CR_CONTINUE;
case l_undef:
TRACE("arith", tout << "check feasible is undef\n";);
TRACE(arith, tout << "check feasible is undef\n";);
return sat::check_result::CR_CONTINUE;
case l_true:
break;
@ -1025,7 +1025,7 @@ namespace arith {
auto st = sat::check_result::CR_DONE;
bool int_undef = false;
TRACE("arith", ctx.display(tout););
TRACE(arith, ctx.display(tout););
switch (check_lia()) {
case l_true:
@ -1033,7 +1033,7 @@ namespace arith {
case l_false:
return sat::check_result::CR_CONTINUE;
case l_undef:
TRACE("arith", tout << "check-lia giveup\n";);
TRACE(arith, tout << "check-lia giveup\n";);
int_undef = true;
st = sat::check_result::CR_CONTINUE;
break;
@ -1049,7 +1049,7 @@ namespace arith {
case l_false:
return sat::check_result::CR_CONTINUE;
case l_undef:
TRACE("arith", tout << "check-nra giveup\n";);
TRACE(arith, tout << "check-nra giveup\n";);
st = sat::check_result::CR_GIVEUP;
break;
}
@ -1068,7 +1068,7 @@ namespace arith {
if (ctx.get_config().m_arith_ignore_int && int_undef)
return sat::check_result::CR_GIVEUP;
if (m_not_handled != nullptr) {
TRACE("arith", tout << "unhandled operator " << mk_pp(m_not_handled, m) << "\n";);
TRACE(arith, tout << "unhandled operator " << mk_pp(m_not_handled, m) << "\n";);
return sat::check_result::CR_GIVEUP;
}
return st;
@ -1083,8 +1083,8 @@ namespace arith {
}
else {
m_todo_terms.push_back(std::make_pair(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);
@ -1093,7 +1093,7 @@ namespace arith {
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());
@ -1116,10 +1116,10 @@ namespace arith {
}
lbool solver::make_feasible() {
TRACE("pcs", tout << lp().constraints(););
TRACE(pcs, tout << lp().constraints(););
auto status = lp().find_feasible_solution();
TRACE("arith_verbose", display(tout););
TRACE("arith", tout << status << "\n");
TRACE(arith_verbose, display(tout););
TRACE(arith, tout << status << "\n");
switch (status) {
case lp::lp_status::INFEASIBLE:
return l_false;
@ -1130,7 +1130,7 @@ namespace arith {
return l_true;
case lp::lp_status::TIME_EXHAUSTED:
default:
TRACE("arith", tout << "status treated as inconclusive: " << status << "\n";);
TRACE(arith, tout << "status treated as inconclusive: " << status << "\n";);
return l_undef;
}
}
@ -1147,7 +1147,7 @@ namespace arith {
new_eq_eh(e);
else if (is_eq(e.v1(), e.v2())) {
mk_diseq_axiom(e.v1(), e.v2());
TRACE("arith", tout << mk_bounded_pp(e.eq(), m) << " " << use_nra_model() << "\n");
TRACE(arith, tout << mk_bounded_pp(e.eq(), m) << " " << use_nra_model() << "\n");
found_diseq = true;
break;
}
@ -1156,7 +1156,7 @@ namespace arith {
}
lbool solver::check_lia() {
TRACE("arith", );
TRACE(arith, );
if (!m.inc())
return l_undef;
lbool lia_check = l_undef;
@ -1173,7 +1173,7 @@ namespace arith {
break;
case lp::lia_move::branch: {
TRACE("arith", tout << "branch\n";);
TRACE(arith, tout << "branch\n";);
app_ref b(m);
bool u = m_lia->is_upper();
auto const& k = m_lia->offset();
@ -1191,7 +1191,7 @@ namespace arith {
break;
}
case lp::lia_move::cut: {
TRACE("arith", tout << "cut\n";);
TRACE(arith, tout << "cut\n";);
++m_stats.m_cuts;
// m_explanation implies term <= k
reset_evidence();
@ -1207,16 +1207,16 @@ namespace arith {
break;
}
case lp::lia_move::conflict:
TRACE("arith", tout << "conflict\n";);
TRACE(arith, tout << "conflict\n";);
// ex contains unsat core
set_conflict(hint_type::cut_h);
return l_false;
case lp::lia_move::undef:
TRACE("arith", tout << "lia undef\n";);
TRACE(arith, tout << "lia undef\n";);
lia_check = l_undef;
break;
case lp::lia_move::continue_with_check:
TRACE("arith", tout << "continue-with-check\n");
TRACE(arith, tout << "continue-with-check\n");
lia_check = l_false;
break;
default:
@ -1256,7 +1256,7 @@ namespace arith {
for (auto ev : m_explanation)
set_evidence(ev.ci());
TRACE("arith_conflict",
TRACE(arith_conflict,
tout << "Lemma - " << (is_conflict ? "conflict" : "propagation") << "\n";
for (literal c : m_core) tout << c << ": " << literal2expr(c) << " := " << s().value(c) << "\n";
for (auto p : m_eqs) tout << ctx.bpp(p.first) << " == " << ctx.bpp(p.second) << "\n";);
@ -1367,11 +1367,11 @@ namespace arith {
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);
}
}
@ -1382,7 +1382,7 @@ namespace arith {
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";);
@ -1393,7 +1393,7 @@ namespace arith {
else
atom = a.mk_le(t, a.mk_numeral(offset, is_int));
TRACE("arith", tout << t << ": " << atom << "\n";
TRACE(arith, tout << t << ": " << atom << "\n";
lp().print_term(term, tout << "bound atom: ") << (lower_bound ? " >= " : " <= ") << k << "\n";);
mk_literal(atom);
return atom;
@ -1404,7 +1404,7 @@ namespace arith {
}
void solver::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();
@ -1417,7 +1417,7 @@ namespace arith {
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);
@ -1493,17 +1493,17 @@ namespace arith {
else
lit = ctx.expr2literal(mk_bound(ineq.term(), ineq.rs(), is_lower));
TRACE("arith", tout << "is_lower: " << is_lower << " sign " << sign << " " << ctx.literal2expr(lit) << "\n";);
TRACE(arith, tout << "is_lower: " << is_lower << " sign " << sign << " " << ctx.literal2expr(lit) << "\n";);
return sign ? ~lit : lit;
}
lbool solver::check_nla() {
if (!m.inc()) {
TRACE("arith", tout << "canceled\n";);
TRACE(arith, tout << "canceled\n";);
return l_undef;
}
CTRACE("arith", !m_nla, tout << "no nla\n";);
CTRACE(arith, !m_nla, tout << "no nla\n";);
if (!m_nla)
return l_true;
if (!m_nla->need_check())
@ -1519,7 +1519,7 @@ namespace arith {
case l_undef:
break;
}
TRACE("arith", tout << "nla " << r << "\n");
TRACE(arith, tout << "nla " << r << "\n");
return r;
}

View file

@ -55,7 +55,7 @@ namespace arith {
lo = lo1, is_strict = is_strict1;
found = true;
}
CTRACE("arith_value", !found, tout << "value not found for " << mk_pp(e, m) << "\n";);
CTRACE(arith_value, !found, tout << "value not found for " << mk_pp(e, m) << "\n";);
return found;
}
@ -74,7 +74,7 @@ namespace arith {
hi = hi1, is_strict = is_strict1;
found = true;
}
CTRACE("arith_value", !found, tout << "value not found for " << mk_pp(e, m) << "\n";);
CTRACE(arith_value, !found, tout << "value not found for " << mk_pp(e, m) << "\n";);
return found;
}
@ -109,7 +109,7 @@ namespace arith {
if (m_thr && m_thr->get_value(next, val)) return true;
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

@ -34,7 +34,7 @@ namespace array {
void solver::push_axiom(axiom_record const& r) {
unsigned idx = m_axiom_trail.size();
m_axiom_trail.push_back(r);
TRACE("array", display(tout, r) << " " << m_axioms.contains(idx) << "\n";);
TRACE(array, display(tout, r) << " " << m_axioms.contains(idx) << "\n";);
if (m_axioms.contains(idx))
m_axiom_trail.pop_back();
else {
@ -79,7 +79,7 @@ namespace array {
expr* child = r.n->get_expr();
SASSERT(can_beta_reduce(r.n));
TRACE("array", tout << "default-axiom: " << mk_bounded_pp(child, m, 2) << "\n";);
TRACE(array, tout << "default-axiom: " << mk_bounded_pp(child, m, 2) << "\n";);
if (a.is_const(child))
return assert_default_const_axiom(to_app(child));
else if (a.is_store(child))
@ -101,7 +101,7 @@ namespace array {
r.select->get_arg(0)->get_root() != r.n->get_root() &&
!r.is_delayed() && m_enable_delay;
TRACE("array", display(tout << "select-axiom: " << (should_delay ? "delay " : ""), r) << "\n";);
TRACE(array, display(tout << "select-axiom: " << (should_delay ? "delay " : ""), r) << "\n";);
if (should_delay) {
IF_VERBOSE(11, verbose_stream() << "delay: " << mk_bounded_pp(child, m) << " " << mk_bounded_pp(select, m) << "\n");
@ -131,7 +131,7 @@ namespace array {
* n := store(a, i, v)
*/
bool solver::assert_store_axiom(app* e) {
TRACE("array", tout << "store-axiom: " << mk_bounded_pp(e, m) << "\n";);
TRACE(array, tout << "store-axiom: " << mk_bounded_pp(e, m) << "\n";);
++m_stats.m_num_store_axiom;
SASSERT(a.is_store(e));
unsigned num_args = e->get_num_args();
@ -182,7 +182,7 @@ namespace array {
euf::enode* s1 = e_internalize(sel1);
euf::enode* s2 = e_internalize(sel2);
TRACE("array",
TRACE(array,
tout << "select-store " << ctx.bpp(s1) << " " << ctx.bpp(s1->get_root()) << "\n";
tout << "select-store " << ctx.bpp(s2) << " " << ctx.bpp(s2->get_root()) << "\n";);
@ -228,7 +228,7 @@ namespace array {
new_prop = true;
}
++m_stats.m_num_select_store_axiom;
TRACE("array", tout << "select-stored " << new_prop << "\n";);
TRACE(array, tout << "select-stored " << new_prop << "\n";);
return new_prop;
}
@ -270,7 +270,7 @@ namespace array {
expr_ref sel2(a.mk_select(args2), m);
literal lit1 = eq_internalize(e1, e2);
literal lit2 = eq_internalize(sel1, sel2);
TRACE("array", tout << "extensionality-axiom: " << mk_bounded_pp(e1, m) << " == " << mk_bounded_pp(e2, m) << "\n" << lit1 << " " << ~lit2 << "\n";);
TRACE(array, tout << "extensionality-axiom: " << mk_bounded_pp(e1, m) << " == " << mk_bounded_pp(e2, m) << "\n" << lit1 << " " << ~lit2 << "\n";);
return add_clause(lit1, ~lit2);
}
@ -465,7 +465,7 @@ namespace array {
expr_ref alpha(a.mk_select(args), m);
expr_ref beta(alpha);
rewrite(beta);
TRACE("array", tout << alpha << " == " << beta << "\n";);
TRACE(array, tout << alpha << " == " << beta << "\n";);
return ctx.propagate(e_internalize(alpha), e_internalize(beta), array_axiom());
}
@ -473,7 +473,7 @@ namespace array {
\brief assert n1 = n2 => forall vars . (n1 vars) = (n2 vars)
*/
bool solver::assert_congruent_axiom(expr* e1, expr* e2) {
TRACE("array", tout << "congruence-axiom: " << mk_bounded_pp(e1, m) << " " << mk_bounded_pp(e2, m) << "\n";);
TRACE(array, tout << "congruence-axiom: " << mk_bounded_pp(e1, m) << " " << mk_bounded_pp(e2, m) << "\n";);
++m_stats.m_num_congruence_axiom;
sort* srt = e1->get_sort();
unsigned dimension = get_array_arity(srt);
@ -638,20 +638,20 @@ namespace array {
euf::enode * n = var2enode(i);
if (!is_array(n))
continue;
CTRACE("array", !ctx.is_relevant(n), tout << "not relevant: " << ctx.bpp(n) << "\n");
CTRACE(array, !ctx.is_relevant(n), tout << "not relevant: " << ctx.bpp(n) << "\n");
if (!ctx.is_relevant(n))
continue;
euf::enode * r = n->get_root();
if (r->is_marked1())
continue;
// arrays used as indices in other arrays have to be treated as shared issue #3532, #3529
CTRACE("array", !ctx.is_shared(r) && !is_shared_arg(r), tout << "not shared: " << ctx.bpp(r) << "\n");
CTRACE(array, !ctx.is_shared(r) && !is_shared_arg(r), tout << "not shared: " << ctx.bpp(r) << "\n");
if (ctx.is_shared(r) || is_shared_arg(r))
roots.push_back(r->get_th_var(get_id()));
r->mark1();
to_unmark.push_back(r);
}
TRACE("array", tout << "collecting shared vars...\n"; for (auto v : roots) tout << ctx.bpp(var2enode(v)) << "\n";);
TRACE(array, tout << "collecting shared vars...\n"; for (auto v : roots) tout << ctx.bpp(var2enode(v)) << "\n";);
for (auto* n : to_unmark)
n->unmark1();
}

View file

@ -23,7 +23,7 @@ namespace array {
sat::literal solver::internalize(expr* e, bool sign, bool root) {
SASSERT(m.is_bool(e));
if (!visit_rec(m, e, sign, root)) {
TRACE("array", tout << mk_pp(e, m) << "\n";);
TRACE(array, tout << mk_pp(e, m) << "\n";);
return sat::null_literal;
}
auto lit = expr2literal(e);

View file

@ -129,7 +129,7 @@ namespace array {
args.reset();
for (unsigned i = 1; i < p->num_args(); ++i) {
if (!values.get(p->get_arg(i)->get_root_id())) {
TRACE("array", tout << ctx.bpp(p->get_arg(i)) << "\n");
TRACE(array, tout << ctx.bpp(p->get_arg(i)) << "\n");
}
SASSERT(values.get(p->get_arg(i)->get_root_id()));
}
@ -138,7 +138,7 @@ namespace array {
fi->insert_entry(args.data(), value);
}
TRACE("array", tout << "array-as-function " << ctx.bpp(n) << " := " << mk_pp(f, m) << "\n" << "default " << mk_pp(fi->get_else(), m) << "\n";);
TRACE(array, tout << "array-as-function " << ctx.bpp(n) << " := " << mk_pp(f, m) << "\n" << "default " << mk_pp(fi->get_else(), m) << "\n";);
parameter p(f);
values.set(n->get_expr_id(), m.mk_app(get_id(), OP_AS_ARRAY, 1, &p));
}
@ -282,7 +282,7 @@ namespace array {
theory_var w = get_th_var(n->get_arg(0));
SASSERT(w != euf::null_theory_var);
mg_merge(v, get_representative(w));
TRACE("array", tout << "merge: " << ctx.bpp(n) << " " << v << " " << w << "\n";);
TRACE(array, tout << "merge: " << ctx.bpp(n) << " " << v << " " << w << "\n";);
}
else if (a.is_default(e)) {
theory_var w = get_th_var(n->get_arg(0));
@ -294,7 +294,7 @@ namespace array {
void solver::set_default(theory_var v, euf::enode* n) {
v = mg_find(v);
CTRACE("array", !m_defaults[v], tout << "set default: " << v << " " << ctx.bpp(n) << "\n";);
CTRACE(array, !m_defaults[v], tout << "set default: " << v << " " << ctx.bpp(n) << "\n";);
if (!m_defaults[v])
m_defaults[v] = n;
}
@ -343,7 +343,7 @@ namespace array {
if (!m_defaults[u])
m_defaults[u] = m_defaults[v];
CTRACE("array", m_defaults[v],
CTRACE(array, m_defaults[v],
tout << ctx.bpp(m_defaults[v]->get_root()) << "\n";
tout << ctx.bpp(m_defaults[u]->get_root()) << "\n";
);

View file

@ -150,7 +150,7 @@ namespace array {
void solver::merge_eh(theory_var v1, theory_var v2, theory_var, theory_var) {
euf::enode* n1 = var2enode(v1);
euf::enode* n2 = var2enode(v2);
TRACE("array", tout << "merge: " << ctx.bpp(n1) << " == " << ctx.bpp(n2) << "\n";);
TRACE(array, tout << "merge: " << ctx.bpp(n1) << " == " << ctx.bpp(n2) << "\n";);
SASSERT(n1->get_root() == n2->get_root());
SASSERT(v1 == find(v1));
expr* e1 = n1->get_expr();
@ -179,8 +179,8 @@ namespace array {
v_child = find(v_child);
ctx.push_vec(get_var_data(v_child).m_parent_selects, select);
euf::enode* child = var2enode(v_child);
TRACE("array", tout << "v" << v_child << " - " << ctx.bpp(select) << " " << ctx.bpp(child) << " prop: " << should_prop_upward(get_var_data(v_child)) << "\n";);
TRACE("array", tout << "can beta reduce " << can_beta_reduce(child) << "\n";);
TRACE(array, tout << "v" << v_child << " - " << ctx.bpp(select) << " " << ctx.bpp(child) << " prop: " << should_prop_upward(get_var_data(v_child)) << "\n";);
TRACE(array, tout << "can beta reduce " << can_beta_reduce(child) << "\n";);
if (can_beta_reduce(child))
push_axiom(select_axiom(select, child));
propagate_parent_select_axioms(v_child);

View file

@ -132,7 +132,7 @@ namespace bv {
if (r1 == r2)
return true;
TRACE("bv", tout << mk_bounded_pp(e, m) << " evaluates to " << r1 << " arguments: " << args << "\n";);
TRACE(bv, tout << mk_bounded_pp(e, m) << " evaluates to " << r1 << " arguments: " << args << "\n";);
// check x*0 = 0
if (!check_mul_zero(e, args, r1, r2))
return false;
@ -207,7 +207,7 @@ namespace bv {
};
auto add_inv = [&](expr* s) {
inv = invert(s, n);
TRACE("bv", tout << "enforce " << inv << "\n";);
TRACE(bv, tout << "enforce " << inv << "\n";);
add_unit(eq_internalize(inv, n));
};
bool ok = true;
@ -280,14 +280,14 @@ namespace bv {
expr_ref mul1(m.mk_app(n->get_decl(), arg_values[0], n->get_arg(1)), m);
set_delay_internalize(mul1, internalize_mode::init_bits_only_i);
add_unit(eq_internalize(mul1, n->get_arg(1)));
TRACE("bv", tout << mul1 << "\n";);
TRACE(bv, tout << mul1 << "\n";);
return false;
}
if (bv.is_one(arg_values[1])) {
expr_ref mul1(m.mk_app(n->get_decl(), n->get_arg(0), arg_values[1]), m);
set_delay_internalize(mul1, internalize_mode::init_bits_only_i);
add_unit(eq_internalize(mul1, n->get_arg(0)));
TRACE("bv", tout << mul1 << "\n";);
TRACE(bv, tout << mul1 << "\n";);
return false;
}
return true;

View file

@ -90,7 +90,7 @@ namespace bv {
m_wpos.push_back(0);
m_zero_one_bits.push_back(zero_one_bits());
ctx.attach_th_var(n, this, r);
TRACE("bv", tout << "mk-var: v" << r << " " << n->get_expr_id() << " " << mk_bounded_pp(n->get_expr(), m) << "\n";);
TRACE(bv, tout << "mk-var: v" << r << " " << n->get_expr_id() << " " << mk_bounded_pp(n->get_expr(), m) << "\n";);
return r;
}
@ -240,7 +240,7 @@ namespace bv {
}
void solver::mk_bits(theory_var v) {
TRACE("bv", tout << "v" << v << "@" << s().scope_lvl() << "\n";);
TRACE(bv, tout << "v" << v << "@" << s().scope_lvl() << "\n";);
expr* e = var2expr(v);
unsigned bv_size = get_bv_size(v);
m_bits[v].reset();
@ -248,7 +248,7 @@ namespace bv {
expr_ref b2b(bv.mk_bit2bool(e, i), m);
m_bits[v].push_back(sat::null_literal);
sat::literal lit = ctx.internalize(b2b, false, false);
TRACE("bv", tout << "add-bit: " << lit << " " << literal2expr(lit) << "\n";);
TRACE(bv, tout << "add-bit: " << lit << " " << literal2expr(lit) << "\n";);
if (m_bits[v].back() == sat::null_literal)
m_bits[v].back() = lit;
SASSERT(m_bits[v].back() == lit);
@ -293,7 +293,7 @@ namespace bv {
SASSERT(l == mk_true() || ~l == mk_true());
bool is_true = l == mk_true();
zero_one_bits& bits = m_zero_one_bits[v];
TRACE("bv", tout << "register v" << v << " " << l << " " << mk_true() << "\n";);
TRACE(bv, tout << "register v" << v << " " << l << " " << mk_true() << "\n";);
bits.push_back(zero_one_bit(v, idx, is_true));
}
@ -303,7 +303,7 @@ namespace bv {
void solver::add_bit(theory_var v, literal l) {
unsigned idx = m_bits[v].size();
m_bits[v].push_back(l);
TRACE("bv", tout << "add-bit: v" << v << "[" << idx << "] " << l << " " << literal2expr(l) << "@" << s().scope_lvl() << "\n";);
TRACE(bv, tout << "add-bit: v" << v << "[" << idx << "] " << l << " " << literal2expr(l) << "@" << s().scope_lvl() << "\n";);
SASSERT(m_num_scopes == 0);
s().set_external(l.var());
euf::enode* n = bool_var2enode(l.var());
@ -346,7 +346,7 @@ namespace bv {
unsigned i = 0;
for (expr* bit : bits) {
sat::literal lit = ctx.internalize(bit, false, false);
TRACE("bv", tout << "set " << m_bits[v][i] << " == " << lit << "\n";);
TRACE(bv, tout << "set " << m_bits[v][i] << " == " << lit << "\n";);
add_clause(~lit, m_bits[v][i]);
add_clause(lit, ~m_bits[v][i]);
++i;
@ -589,7 +589,7 @@ namespace bv {
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 solver::internalize_novfl(app* n, std::function<void(unsigned, expr* const*, expr* const*, expr_ref&)>& fn) {
@ -675,7 +675,7 @@ namespace bv {
sat::literal lit0 = m_bits[v_arg][idx];
if (lit0 == sat::null_literal) {
m_bits[v_arg][idx] = lit;
TRACE("bv", tout << "add-bit: " << lit << " " << literal2expr(lit) << "\n";);
TRACE(bv, tout << "add-bit: " << lit << " " << literal2expr(lit) << "\n";);
atom* a = new (get_region()) atom(lit.var());
a->m_occs = new (get_region()) var_pos_occ(v_arg, idx);
insert_bv2a(lit.var(), a);
@ -760,7 +760,7 @@ namespace bv {
expr_ref oe = mk_var_eq(v1, v2);
literal oeq = ctx.internalize(oe, false, false);
unsigned sz = m_bits[v1].size();
TRACE("bv", tout << "ackerman-eq: " << s().scope_lvl() << " " << oe << "\n";);
TRACE(bv, tout << "ackerman-eq: " << s().scope_lvl() << " " << oe << "\n";);
literal_vector eqs;
eqs.push_back(oeq);
for (unsigned i = 0; i < sz; ++i) {
@ -771,7 +771,7 @@ namespace bv {
add_clause(eq, ~oeq);
eqs.push_back(~eq);
}
TRACE("bv", for (auto l : eqs) tout << mk_bounded_pp(literal2expr(l), m) << " "; tout << "\n";);
TRACE(bv, for (auto l : eqs) tout << mk_bounded_pp(literal2expr(l), m) << " "; tout << "\n";);
euf::th_proof_hint* ph = ctx.mk_smt_clause(name(), eqs.size(), eqs.data());
s().mk_clause(eqs, sat::status::th(true, m.get_basic_family_id(), ph));
}

View file

@ -88,7 +88,7 @@ namespace bv {
m_fixed_var_table.insert(key, v1);
else if (n1->get_root() != var2enode(v2)->get_root()) {
SASSERT(get_bv_size(v1) == get_bv_size(v2));
TRACE("bv", tout << "detected equality: v" << v1 << " = v" << v2 << "\n" << pp(v1) << pp(v2););
TRACE(bv, tout << "detected equality: v" << v1 << " = v" << v2 << "\n" << pp(v1) << pp(v2););
m_stats.m_num_bit2eq++;
add_fixed_eq(v1, v2);
ctx.propagate(n1, var2enode(v2), mk_bit2eq_justification(v1, v2));
@ -134,11 +134,11 @@ namespace bv {
unsigned idx = (i + wpos) % sz;
if (s().value(bits[idx]) == l_undef) {
wpos = idx;
TRACE("bv", tout << "moved wpos of v" << v << " to " << wpos << "\n";);
TRACE(bv, tout << "moved wpos of v" << v << " to " << wpos << "\n";);
return false;
}
}
TRACE("bv", tout << "v" << v << " is a fixed variable.\n";);
TRACE(bv, tout << "v" << v << " is a fixed variable.\n";);
fixed_var_eh(v);
return true;
}
@ -162,7 +162,7 @@ namespace bv {
*/
void solver::mk_new_diseq_axiom(theory_var v1, theory_var v2, unsigned idx) {
SASSERT(m_bits[v1][idx] == ~m_bits[v2][idx]);
TRACE("bv", tout << "found new diseq axiom\n" << pp(v1) << pp(v2););
TRACE(bv, tout << "found new diseq axiom\n" << pp(v1) << pp(v2););
m_stats.m_num_diseq_static++;
expr_ref eq(m.mk_eq(var2expr(v1), var2expr(v2)), m);
add_unit(~ctx.internalize(eq, false, false));
@ -201,7 +201,7 @@ namespace bv {
void solver::new_eq_eh(euf::th_eq const& eq) {
force_push();
TRACE("bv", tout << "new eq " << mk_bounded_pp(var2expr(eq.v1()), m) << " == " << mk_bounded_pp(var2expr(eq.v2()), m) << "\n";);
TRACE(bv, tout << "new eq " << mk_bounded_pp(var2expr(eq.v1()), m) << " == " << mk_bounded_pp(var2expr(eq.v2()), m) << "\n";);
if (is_bv(eq.v1())) {
m_find.merge(eq.v1(), eq.v2());
VERIFY(eq.is_eq());
@ -244,7 +244,7 @@ namespace bv {
if (s().is_probing())
return;
TRACE("bv", tout << "diff: " << v1 << " != " << v2 << " @" << s().scope_lvl() << "\n";);
TRACE(bv, tout << "diff: " << v1 << " != " << v2 << " @" << s().scope_lvl() << "\n";);
unsigned sz = m_bits[v1].size();
if (sz == 1)
return;
@ -303,7 +303,7 @@ namespace bv {
euf::enode_pair solver::get_justification_eq(size_t j) {
auto& c = bv_justification::from_index(j);
TRACE("bv", display_constraint(tout, j) << "\n";);
TRACE(bv, display_constraint(tout, j) << "\n";);
switch (c.m_kind) {
case bv_justification::kind_t::eq2bit:
UNREACHABLE();
@ -325,7 +325,7 @@ namespace bv {
void solver::get_antecedents(literal l, sat::ext_justification_idx idx, literal_vector& r, bool probing) {
auto& c = bv_justification::from_index(idx);
TRACE("bv", display_constraint(tout, idx) << "\n";);
TRACE(bv, display_constraint(tout, idx) << "\n";);
switch (c.m_kind) {
case bv_justification::kind_t::eq2bit:
SASSERT(s().value(c.m_antecedent) == l_true);
@ -523,7 +523,7 @@ namespace bv {
void solver::asserted(literal l) {
atom* a = get_bv2a(l.var());
TRACE("bv", tout << "asserted: " << l << "\n";);
TRACE(bv, tout << "asserted: " << l << "\n";);
if (a) {
force_push();
m_prop_queue.push_back(propagation_item(a));
@ -589,7 +589,7 @@ namespace bv {
literal bit1 = m_bits[v1][idx];
lbool val = s().value(bit1);
TRACE("bv", tout << "propagating v" << v1 << " #" << var2enode(v1)->get_expr_id() << "[" << idx << "] = " << val << "\n";);
TRACE(bv, tout << "propagating v" << v1 << " #" << var2enode(v1)->get_expr_id() << "[" << idx << "] = " << val << "\n";);
if (val == l_undef)
return false;
@ -600,7 +600,7 @@ namespace bv {
for (theory_var v2 = m_find.next(v1); v2 != v1; v2 = m_find.next(v2)) {
literal bit2 = m_bits[v2][idx];
SASSERT(m_bits[v1][idx] != ~m_bits[v2][idx]);
TRACE("bv", tout << "propagating #" << var2enode(v2)->get_expr_id() << "[" << idx << "] = " << s().value(bit2) << "\n";);
TRACE(bv, tout << "propagating #" << var2enode(v2)->get_expr_id() << "[" << idx << "] = " << s().value(bit2) << "\n";);
if (val == l_false)
bit2.neg();
@ -651,7 +651,7 @@ namespace bv {
}
void solver::push_core() {
TRACE("bv", tout << "push: " << get_num_vars() << "@" << m_prop_queue_lim.size() << "\n";);
TRACE(bv, tout << "push: " << get_num_vars() << "@" << m_prop_queue_lim.size() << "\n";);
th_euf_solver::push_core();
m_prop_queue_lim.push_back(m_prop_queue.size());
}
@ -666,7 +666,7 @@ namespace bv {
m_bits.shrink(old_sz);
m_wpos.shrink(old_sz);
m_zero_one_bits.shrink(old_sz);
TRACE("bv", tout << "num vars " << old_sz << "@" << m_prop_queue_lim.size() << "\n";);
TRACE(bv, tout << "num vars " << old_sz << "@" << m_prop_queue_lim.size() << "\n";);
}
void solver::simplify() {
@ -724,7 +724,7 @@ namespace bv {
assert_ackerman(v, w);
}
}
TRACE("bv", tout << "infer new equations for bit-vectors that are now equal\n";);
TRACE(bv, tout << "infer new equations for bit-vectors that are now equal\n";);
}
void solver::clauses_modifed() {}
@ -886,10 +886,10 @@ namespace bv {
void solver::merge_eh(theory_var r1, theory_var r2, theory_var v1, theory_var v2) {
TRACE("bv", tout << "merging: v" << v1 << " #" << var2enode(v1)->get_expr_id() << " v" << v2 << " #" << var2enode(v2)->get_expr_id() << "\n";);
TRACE(bv, tout << "merging: v" << v1 << " #" << var2enode(v1)->get_expr_id() << " v" << v2 << " #" << var2enode(v2)->get_expr_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
}
SASSERT(m_bits[v1].size() == m_bits[v2].size());
@ -899,7 +899,7 @@ namespace bv {
for (unsigned idx = 0; !s().inconsistent() && idx < sz; idx++) {
literal bit1 = m_bits[v1][idx];
literal bit2 = m_bits[v2][idx];
CTRACE("bv", bit1 == ~bit2, tout << pp(v1) << pp(v2) << "idx: " << idx << "\n";);
CTRACE(bv, bit1 == ~bit2, tout << pp(v1) << pp(v2) << "idx: " << idx << "\n";);
if (bit1 == ~bit2) {
mk_new_diseq_axiom(v1, v2, idx);
return;
@ -907,10 +907,10 @@ namespace bv {
SASSERT(bit1 != ~bit2);
lbool val1 = s().value(bit1);
lbool val2 = s().value(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 == val2)
continue;
CTRACE("bv", (val1 != l_undef && val2 != l_undef), tout << "inconsistent "; tout << pp(v1) << pp(v2) << "idx: " << idx << "\n";);
CTRACE(bv, (val1 != l_undef && val2 != l_undef), tout << "inconsistent "; tout << pp(v1) << pp(v2) << "idx: " << idx << "\n";);
if (val1 == l_false)
assign_bit(~bit2, v1, v2, idx, ~bit1, true);
else if (val1 == l_true)
@ -927,7 +927,7 @@ namespace bv {
sat::constraint_base::initialize(mem, this);
auto* constraint = new (sat::constraint_base::ptr2mem(mem)) bv_justification(v1, v2, c, a);
auto jst = sat::justification::mk_ext_justification(s().scope_lvl(), constraint->to_index());
TRACE("bv", tout << jst << " " << constraint << "\n");
TRACE(bv, tout << jst << " " << constraint << "\n");
return jst;
}

View file

@ -119,7 +119,7 @@ namespace dt {
where acc_i are the accessors of constructor c.
*/
void solver::assert_is_constructor_axiom(enode* n, func_decl* c, literal antecedent) {
TRACE("dt", tout << mk_pp(c, m) << " " << ctx.bpp(n) << "\n";);
TRACE(dt, tout << mk_pp(c, m) << " " << ctx.bpp(n) << "\n";);
m_stats.m_assert_cnstr++;
expr* e = n->get_expr();
SASSERT(dt.is_constructor(c));
@ -159,7 +159,7 @@ namespace dt {
SASSERT(is_recognizer(r));
SASSERT(dt.get_recognizer_constructor(r->get_decl()) == c->get_decl());
SASSERT(c->get_root() == r->get_arg(0)->get_root());
TRACE("dt", tout << ctx.bpp(c) << "\n" << ctx.bpp(r) << "\n";);
TRACE(dt, tout << ctx.bpp(c) << "\n" << ctx.bpp(r) << "\n";);
literal l = ctx.enode2literal(r);
SASSERT(s().value(l) == l_false);
clear_mark();
@ -254,7 +254,7 @@ namespace dt {
SASSERT(!d->m_constructor);
SASSERT(!recognizer || ctx.value(recognizer) == l_false || !is_final);
TRACE("dt", tout << ctx.bpp(n) << " non_rec_c: " << non_rec_c->get_name() << " #rec: " << d->m_recognizers.size() << "\n";);
TRACE(dt, tout << ctx.bpp(n) << " non_rec_c: " << non_rec_c->get_name() << " #rec: " << d->m_recognizers.size() << "\n";);
if (!recognizer && non_rec_c->get_arity() == 0) {
sat::literal eq = eq_internalize(n->get_expr(), m.mk_const(non_rec_c));
@ -332,7 +332,7 @@ namespace dt {
*
*/
void solver::apply_sort_cnstr(enode* n, sort* s) {
TRACE("dt", tout << "apply_sort_cnstr: #" << ctx.bpp(n) << "\n";);
TRACE(dt, tout << "apply_sort_cnstr: #" << ctx.bpp(n) << "\n";);
force_push();
if (!is_attached_to_var(n))
mk_var(n);
@ -348,7 +348,7 @@ namespace dt {
enode* n = bool_var2enode(lit.var());
if (!is_recognizer(n))
return;
TRACE("dt", tout << "assigning recognizer: #" << n->get_expr_id() << " " << ctx.bpp(n) << "\n";);
TRACE(dt, tout << "assigning recognizer: #" << n->get_expr_id() << " " << ctx.bpp(n) << "\n";);
SASSERT(n->num_args() == 1);
enode* arg = n->get_arg(0);
theory_var tv = arg->get_th_var(get_id());
@ -369,7 +369,7 @@ namespace dt {
}
void solver::add_recognizer(theory_var v, enode* recognizer) {
TRACE("dt", tout << "add recognizer " << v << " " << mk_pp(recognizer->get_expr(), m) << "\n";);
TRACE(dt, tout << "add recognizer " << v << " " << mk_pp(recognizer->get_expr(), m) << "\n";);
v = m_find.find(v);
var_data* d = m_var_data[v];
sort* s = recognizer->get_decl()->get_domain(0);
@ -384,7 +384,7 @@ namespace dt {
return;
lbool val = ctx.value(recognizer);
TRACE("dt", tout << "adding recognizer to v" << v << " rec: #" << recognizer->get_expr_id() << " val: " << val << "\n";);
TRACE(dt, tout << "adding recognizer to v" << v << " rec: #" << recognizer->get_expr_id() << " val: " << val << "\n";);
// do nothing...
// If recognizer assignment was already processed, then
@ -423,7 +423,7 @@ namespace dt {
return;
}
CTRACE("dt", d->m_recognizers.empty(), ctx.display(tout););
CTRACE(dt, d->m_recognizers.empty(), ctx.display(tout););
SASSERT(!d->m_recognizers.empty());
m_lits.reset();
enode_pair_vector eqs;
@ -449,7 +449,7 @@ namespace dt {
}
++idx;
}
TRACE("dt", tout << "propagate " << num_unassigned << " eqs: " << eqs.size() << "\n";);
TRACE(dt, tout << "propagate " << num_unassigned << " eqs: " << eqs.size() << "\n";);
if (num_unassigned == 0) {
auto* ph = ctx.mk_smt_hint(name(), m_lits, eqs);
ctx.set_conflict(euf::th_explain::conflict(*this, m_lits, eqs, ph));
@ -488,7 +488,7 @@ namespace dt {
var_data* d2 = m_var_data[v2];
auto* con1 = d1->m_constructor;
auto* con2 = d2->m_constructor;
TRACE("dt", tout << "merging v" << v1 << " v" << v2 << "\n" << ctx.bpp(var2enode(v1)) << " == " << ctx.bpp(var2enode(v2)) << " " << ctx.bpp(con1) << " " << ctx.bpp(con2) << "\n";);
TRACE(dt, tout << "merging v" << v1 << " v" << v2 << "\n" << ctx.bpp(var2enode(v1)) << " == " << ctx.bpp(var2enode(v2)) << " " << ctx.bpp(con1) << " " << ctx.bpp(con2) << "\n";);
if (con1 && con2 && con1->get_decl() != con2->get_decl())
ctx.set_conflict(euf::th_explain::conflict(*this, con1, con2, ctx.mk_smt_hint(name(), con1, con2)));
else if (con2 && !con1) {
@ -598,7 +598,7 @@ namespace dt {
// explain the cycle root -> ... -> app -> root
void solver::occurs_check_explain(enode* app, enode* root) {
TRACE("dt", tout << "occurs_check_explain " << ctx.bpp(app) << " <-> " << ctx.bpp(root) << "\n";);
TRACE(dt, tout << "occurs_check_explain " << ctx.bpp(app) << " <-> " << ctx.bpp(root) << "\n";);
// first: explain that root=v, given that app=cstor(...,v,...)
@ -616,7 +616,7 @@ namespace dt {
if (app != root)
m_used_eqs.push_back(enode_pair(app, root));
TRACE("dt",
TRACE(dt,
tout << "occurs_check\n"; for (enode_pair const& p : m_used_eqs) tout << ctx.bpp(p.first) << " - " << ctx.bpp(p.second) << " ";);
}
@ -685,7 +685,7 @@ namespace dt {
a3 = cons(v3, a1)
*/
bool solver::occurs_check(enode* n) {
TRACE("dt_verbose", tout << "occurs check: " << ctx.bpp(n) << "\n";);
TRACE(dt_verbose, tout << "occurs check: " << ctx.bpp(n) << "\n";);
m_stats.m_occurs_check++;
bool res = false;
@ -700,7 +700,7 @@ namespace dt {
if (oc_cycle_free(app))
continue;
TRACE("dt_verbose", tout << "occurs check loop: " << ctx.bpp(app) << (op == ENTER ? " enter" : " exit") << "\n";);
TRACE(dt_verbose, tout << "occurs check loop: " << ctx.bpp(app) << (op == ENTER ? " enter" : " exit") << "\n";);
switch (op) {
case ENTER:
@ -716,7 +716,7 @@ namespace dt {
if (res) {
clear_mark();
ctx.set_conflict(euf::th_explain::conflict(*this, m_used_eqs, ctx.mk_smt_hint(name(), m_used_eqs)));
TRACE("dt", tout << "occurs check conflict: " << ctx.bpp(n) << "\n";);
TRACE(dt, tout << "occurs check conflict: " << ctx.bpp(n) << "\n";);
}
return res;
}
@ -783,7 +783,7 @@ namespace dt {
if (v == euf::null_theory_var)
return false;
euf::enode* con = m_var_data[m_find.find(v)]->m_constructor;
TRACE("dt", display(tout) << ctx.bpp(n) << " con: " << ctx.bpp(con) << "\n";);
TRACE(dt, display(tout) << ctx.bpp(n) << " con: " << ctx.bpp(con) << "\n";);
if (con->num_args() == 0)
dep.insert(n, nullptr);
for (enode* arg : euf::enode_args(con))

View file

@ -124,7 +124,7 @@ namespace euf {
return;
if (!enable_cc(a, b))
return;
TRACE("ack", tout << "conflict eh: " << mk_pp(a, m) << " == " << mk_pp(b, m) << "\n";);
TRACE(ack, tout << "conflict eh: " << mk_pp(a, m) << " == " << mk_pp(b, m) << "\n";);
insert(a, b);
gc();
}
@ -136,7 +136,7 @@ namespace euf {
return;
if (!enable_eq(a, b, c))
return;
TRACE("ack", tout << mk_pp(a, m) << " " << mk_pp(b, m) << " " << mk_pp(c, m) << "\n";);
TRACE(ack, tout << mk_pp(a, m) << " " << mk_pp(b, m) << " " << mk_pp(c, m) << "\n";);
insert(a, b, c);
gc();
}
@ -144,7 +144,7 @@ namespace euf {
void ackerman::used_cc_eh(app* a, app* b) {
if (ctx.m_drating)
return;
TRACE("ack", tout << "used cc: " << mk_pp(a, m) << " == " << mk_pp(b, m) << "\n";);
TRACE(ack, tout << "used cc: " << mk_pp(a, m) << " == " << mk_pp(b, m) << "\n";);
SASSERT(a->get_decl() == b->get_decl());
SASSERT(a->get_num_args() == b->get_num_args());
if (!enable_cc(a, b))
@ -191,7 +191,7 @@ namespace euf {
void ackerman::add_cc(expr* _a, expr* _b) {
app* a = to_app(_a);
app* b = to_app(_b);
TRACE("ack", tout << mk_pp(a, m) << " " << mk_pp(b, m) << "\n";);
TRACE(ack, tout << mk_pp(a, m) << " " << mk_pp(b, m) << "\n";);
sat::literal_vector lits;
unsigned sz = a->get_num_args();
@ -216,7 +216,7 @@ namespace euf {
expr_ref eq1(ctx.mk_eq(a, c), m);
expr_ref eq2(ctx.mk_eq(b, c), m);
expr_ref eq3(ctx.mk_eq(a, b), m);
TRACE("ack", tout << mk_pp(a, m) << " " << mk_pp(b, m) << " " << mk_pp(c, m) << "\n";);
TRACE(ack, tout << mk_pp(a, m) << " " << mk_pp(b, m) << " " << mk_pp(c, m) << "\n";);
lits[0] = ~ctx.mk_literal(eq1);
lits[1] = ~ctx.mk_literal(eq2);
lits[2] = ctx.mk_literal(eq3);

View file

@ -63,7 +63,7 @@ namespace euf {
SASSERT(n->bool_var() != sat::null_bool_var);
return literal(n->bool_var(), sign);
}
TRACE("euf", tout << "non-bool\n";);
TRACE(euf, tout << "non-bool\n";);
return sat::null_literal;
}
if (si.is_bool_op(e)) {
@ -171,7 +171,7 @@ namespace euf {
lit = lit2;
}
TRACE("euf", tout << "attach b" << v << " " << mk_bounded_pp(e, m) << "\n";);
TRACE(euf, tout << "attach b" << v << " " << mk_bounded_pp(e, m) << "\n";);
m_bool_var2expr.reserve(v + 1, nullptr);
if (m_bool_var2expr[v] && m_egraph.find(e)) {
if (m_egraph.find(e)->bool_var() != v) {
@ -190,7 +190,7 @@ namespace euf {
enode* n = m_egraph.find(e);
if (!n)
n = mk_enode(e, 0, nullptr);
CTRACE("euf", n->bool_var() != sat::null_bool_var && n->bool_var() != v, display(tout << bpp(n) << " " << n->bool_var() << " vs " << v << "\n"));
CTRACE(euf, n->bool_var() != sat::null_bool_var && n->bool_var() != v, display(tout << bpp(n) << " " << n->bool_var() << " vs " << v << "\n"));
SASSERT(n->bool_var() == sat::null_bool_var || n->bool_var() == v);
m_egraph.set_bool_var(n, v);
if (si.is_bool_op(e))

View file

@ -53,7 +53,7 @@ namespace euf {
!m.is_bool(n->get_app()->get_arg(0)) &&
(n->get_arg(0)->get_root() == n->get_arg(1)->get_root())) {
enable_trace("euf");
TRACE("euf", display(tout << n->get_expr_id() << ": " << mk_pp(n->get_expr(), m) << "\n"
TRACE(euf, display(tout << n->get_expr_id() << ": " << mk_pp(n->get_expr(), m) << "\n"
<< "#" << n->get_arg(0)->get_expr_id() << " == #" << n->get_arg(1)->get_expr_id() << " r: " << n->get_arg(0)->get_root_id() << "\n");
);
UNREACHABLE();

View file

@ -48,7 +48,7 @@ namespace euf {
else
value = factory.get_fresh_value(srt);
(void)s;
TRACE("model", tout << s.bpp(r) << " := " << value << "\n";);
TRACE(model, tout << s.bpp(r) << " := " << value << "\n";);
values.set(id, value);
expr_ref_vector* vals = nullptr;
if (!sort2values.find(srt, vals)) {
@ -77,7 +77,7 @@ namespace euf {
}
void solver::update_model(model_ref& mdl, bool validate) {
TRACE("model", tout << "create model\n";);
TRACE(model, tout << "create model\n";);
if (m_qmodel) {
mdl = m_qmodel;
return;
@ -95,7 +95,7 @@ namespace euf {
values2model(deps, mdl);
for (auto* mb : m_solvers)
mb->finalize_model(*mdl);
TRACE("model", tout << "created model " << *mdl << "\n";);
TRACE(model, tout << "created model " << *mdl << "\n";);
if (validate)
validate_model(*mdl);
}
@ -137,7 +137,7 @@ namespace euf {
for (enode* n : fresh_values)
n->unmark1();
TRACE("model",
TRACE(model,
for (auto * t : deps.deps()) {
auto* v = deps.get_dep(t);
if (v) {
@ -151,7 +151,7 @@ namespace euf {
void solver::dependencies2values(user_sort& us, deps_t& deps, model_ref& mdl) {
for (enode* n : deps.top_sorted()) {
TRACE("model", tout << bpp(n->get_root()) << "\n");
TRACE(model, tout << bpp(n->get_root()) << "\n");
unsigned id = n->get_root_id();
if (m_values.get(id, nullptr))
continue;
@ -228,7 +228,7 @@ namespace euf {
if (m.is_bool(e) && is_uninterp_const(e) && mdl->get_const_interp(f))
continue;
expr* v = m_values.get(n->get_root_id());
CTRACE("euf", !v, tout << "no value for " << mk_pp(e, m) << "\n";);
CTRACE(euf, !v, tout << "no value for " << mk_pp(e, m) << "\n";);
if (!v)
continue;
unsigned arity = f->get_arity();
@ -245,13 +245,13 @@ namespace euf {
enode* earg = get_enode(arg);
expr* val = m_values.get(earg->get_root_id());
args.push_back(val);
CTRACE("euf", !val, tout << "no value for " << bpp(earg) << "\n" << bpp(n) << "\n"; display(tout););
CTRACE(euf, !val, tout << "no value for " << bpp(earg) << "\n" << bpp(n) << "\n"; display(tout););
SASSERT(val);
}
SASSERT(args.size() == arity);
if (!fi->get_entry(args.data()))
fi->insert_new_entry(args.data(), v);
TRACE("euf", tout << bpp(n) << " " << f->get_name() << "\n";
TRACE(euf, tout << bpp(n) << " " << f->get_name() << "\n";
for (expr* arg : args) tout << mk_pp(arg, m) << " ";
tout << "\n -> " << mk_pp(v, m) << "\n";
for (euf::enode* arg : euf::enode_args(n)) tout << bpp(arg) << " ";
@ -279,7 +279,7 @@ namespace euf {
for (enode* n : m_egraph.nodes())
if (n->is_root() && m_values.get(n->get_expr_id()))
m_values2root.insert(m_values.get(n->get_expr_id()), n);
TRACE("model",
TRACE(model,
for (auto const& kv : m_values2root)
tout << mk_bounded_pp(kv.m_key, m) << "\n -> " << bpp(kv.m_value) << "\n";);
@ -337,7 +337,7 @@ namespace euf {
return;
model_evaluator ev(mdl);
ev.set_model_completion(true);
TRACE("model",
TRACE(model,
for (enode* n : m_egraph.nodes()) {
if (!is_relevant(n))
continue;
@ -365,8 +365,8 @@ namespace euf {
continue;
if (!tt && !mdl.is_true(e))
continue;
CTRACE("euf", first, display_validation_failure(tout, mdl, n););
CTRACE("euf", first, display(tout));
CTRACE(euf, first, display_validation_failure(tout, mdl, n););
CTRACE(euf, first, display(tout));
IF_VERBOSE(0, display_validation_failure(verbose_stream(), mdl, n););
(void)first;
first = false;

View file

@ -118,7 +118,7 @@ namespace euf {
void solver::log_antecedents(literal l, literal_vector const& r, th_proof_hint* hint) {
SASSERT(hint && use_drat());
TRACE("euf", log_antecedents(tout, l, r); tout << mk_pp(hint->get_hint(*this), m) << "\n");
TRACE(euf, log_antecedents(tout, l, r); tout << mk_pp(hint->get_hint(*this), m) << "\n");
literal_vector lits;
for (literal lit : r)
lits.push_back(~lit);
@ -368,7 +368,7 @@ namespace euf {
}
void solver::on_clause(unsigned n, literal const* lits, sat::status st) {
TRACE("euf_verbose", tout << "on-clause " << n << "\n");
TRACE(euf_verbose, tout << "on-clause " << n << "\n");
on_lemma(n, lits, st);
on_proof(n, lits, st);
on_check(n, lits, st);

View file

@ -73,7 +73,7 @@ namespace euf {
if (!m_enabled)
return;
flush();
TRACE("relevancy", tout << "root " << sat::literal_vector(n, lits) << "\n");
TRACE(relevancy, tout << "root " << sat::literal_vector(n, lits) << "\n");
sat::literal true_lit = sat::null_literal;
for (unsigned i = 0; i < n; ++i) {
if (ctx.s().value(lits[i]) == l_true) {
@ -102,7 +102,7 @@ namespace euf {
if (!m_enabled)
return;
flush();
TRACE("relevancy", tout << "def " << sat::literal_vector(n, lits) << "\n");
TRACE(relevancy, tout << "def " << sat::literal_vector(n, lits) << "\n");
for (unsigned i = 0; i < n; ++i) {
if (ctx.s().value(lits[i]) == l_false && is_relevant(lits[i])) {
add_root(n, lits);
@ -163,7 +163,7 @@ namespace euf {
}
void relevancy::asserted(sat::literal lit) {
TRACE("relevancy", tout << "asserted " << lit << " relevant " << is_relevant(lit) << "\n");
TRACE(relevancy, tout << "asserted " << lit << " relevant " << is_relevant(lit) << "\n");
if (!m_enabled)
return;
flush();
@ -210,7 +210,7 @@ namespace euf {
}
void relevancy::merge(euf::enode* root, euf::enode* other) {
TRACE("relevancy", tout << "merge #" << ctx.bpp(root) << " " << is_relevant(root) << " #" << ctx.bpp(other) << " " << is_relevant(other) << "\n");
TRACE(relevancy, tout << "merge #" << ctx.bpp(root) << " " << is_relevant(root) << " #" << ctx.bpp(other) << " " << is_relevant(other) << "\n");
if (is_relevant(root))
mark_relevant(other);
else if (is_relevant(other))
@ -223,13 +223,13 @@ namespace euf {
flush();
if (is_relevant(n))
return;
TRACE("relevancy", tout << "mark #" << ctx.bpp(n) << "\n");
TRACE(relevancy, tout << "mark #" << ctx.bpp(n) << "\n");
m_trail.push_back(std::make_pair(update::add_queue, 0));
m_queue.push_back(std::make_pair(sat::null_literal, n));
}
void relevancy::mark_relevant(sat::literal lit) {
TRACE("relevancy", tout << "mark " << lit << " " << is_relevant(lit) << " " << ctx.s().value(lit) << " lim: " << m_lim.size() << "\n");
TRACE(relevancy, tout << "mark " << lit << " " << is_relevant(lit) << " " << ctx.s().value(lit) << " lim: " << m_lim.size() << "\n");
if (!m_enabled)
return;
flush();
@ -250,7 +250,7 @@ namespace euf {
void relevancy::propagate_relevant(sat::literal lit) {
SASSERT(m_num_scopes == 0);
TRACE("relevancy", tout << "propagate " << lit << " lim: " << m_lim.size() << "\n");
TRACE(relevancy, tout << "propagate " << lit << " lim: " << m_lim.size() << "\n");
SASSERT(ctx.s().value(lit) == l_true);
SASSERT(is_relevant(lit));
euf::enode* n = ctx.bool_var2enode(lit.var());
@ -276,7 +276,7 @@ namespace euf {
m_roots[idx] = true;
}
next:
TRACE("relevancy", tout << "propagate " << lit << " " << true_lit << " " << m_roots[idx] << "\n");
TRACE(relevancy, tout << "propagate " << lit << " " << true_lit << " " << m_roots[idx] << "\n");
;
}
}
@ -286,7 +286,7 @@ namespace euf {
while (!m_todo.empty()) {
n = m_todo.back();
m_todo.pop_back();
TRACE("relevancy", tout << "propagate #" << ctx.bpp(n) << " lim: " << m_lim.size() << "\n");
TRACE(relevancy, tout << "propagate #" << ctx.bpp(n) << " lim: " << m_lim.size() << "\n");
if (n->is_relevant())
continue;
m_stack.push_back(n);

View file

@ -190,7 +190,7 @@ namespace euf {
void solver::init_search() {
if (get_config().m_sls_enable)
add_solver(alloc(sls::solver, *this));
TRACE("before_search", s().display(tout););
TRACE(before_search, s().display(tout););
m_reason_unknown.clear();
for (auto* s : m_solvers)
s->init_search();
@ -310,7 +310,7 @@ namespace euf {
}
m_egraph.end_explain();
CTRACE("euf", probing, tout << "explain " << l << " <- " << r << "\n");
CTRACE(euf, probing, tout << "explain " << l << " <- " << r << "\n");
unsigned j = 0;
for (auto lit : r)
if (s().lvl(lit) > 0)
@ -413,7 +413,7 @@ namespace euf {
lbool val = ante->value();
SASSERT(val != l_undef);
literal ante_lit(v, val == l_false);
TRACE("euf", tout << "explain " << bpp(n) << " by " << bpp(ante) << "\n");
TRACE(euf, tout << "explain " << bpp(n) << " by " << bpp(ante) << "\n");
m_explain.push_back(to_ptr(ante_lit));
}
break;
@ -448,7 +448,7 @@ namespace euf {
if (!m_relevancy.is_relevant(l))
return;
expr* e = m_bool_var2expr.get(l.var(), nullptr);
TRACE("euf", tout << "asserted: " << l << "@" << s().scope_lvl() << " := " << mk_bounded_pp(e, m) << "\n";);
TRACE(euf, tout << "asserted: " << l << "@" << s().scope_lvl() << " := " << mk_bounded_pp(e, m) << "\n";);
if (!e)
return;
euf::enode* n = m_egraph.find(e);
@ -571,7 +571,7 @@ namespace euf {
}
unsigned lvl = s().scope_lvl();
CTRACE("euf", s().value(lit) != l_true, tout << lit << " " << s().value(lit) << "@" << lvl << " " << mk_bounded_pp(a, m) << " = " << mk_bounded_pp(b, m) << "\n";);
CTRACE(euf, s().value(lit) != l_true, tout << lit << " " << s().value(lit) << "@" << lvl << " " << mk_bounded_pp(a, m) << " = " << mk_bounded_pp(b, m) << "\n";);
if (s().value(lit) == l_false && m_ackerman && a && b)
m_ackerman->cg_conflict_eh(a, b);
switch (s().value(lit)) {
@ -646,8 +646,8 @@ namespace euf {
sat::check_result solver::check() {
++m_stats.m_final_checks;
TRACE("euf", s().display(tout););
TRACE("final_check", s().display(tout););
TRACE(euf, s().display(tout););
TRACE(final_check, s().display(tout););
bool give_up = false;
bool cont = false;
@ -658,7 +658,7 @@ namespace euf {
auto apply_solver = [&](th_solver* e) {
switch (e->check()) {
case sat::check_result::CR_CONTINUE: cont = true; break;
case sat::check_result::CR_GIVEUP: m_reason_unknown = "incomplete theory " + e->name().str(); TRACE("euf", tout << "give up " << e->name() << "\n"); give_up = true; break;
case sat::check_result::CR_GIVEUP: m_reason_unknown = "incomplete theory " + e->name().str(); TRACE(euf, tout << "give up " << e->name() << "\n"); give_up = true; break;
default: break;
}
};
@ -688,7 +688,7 @@ namespace euf {
return sat::check_result::CR_CONTINUE;
if (cont)
return sat::check_result::CR_CONTINUE;
TRACE("after_search", s().display(tout););
TRACE(after_search, s().display(tout););
if (give_up)
return sat::check_result::CR_GIVEUP;
if (m_qsolver && m_config.m_arith_ignore_int)
@ -705,17 +705,17 @@ namespace euf {
if (!m.is_bool(n->get_expr()) || !is_shared(n))
continue;
if (n->value() == l_true && n->cgc_enabled() && !m.is_true(n->get_root()->get_expr())) {
TRACE("euf", tout << "merge " << bpp(n) << "\n");
TRACE(euf, tout << "merge " << bpp(n) << "\n");
m_egraph.merge(n, mk_true(), to_ptr(sat::literal(n->bool_var())));
merged = true;
}
if (n->value() == l_false && n->cgc_enabled() && !m.is_false(n->get_root()->get_expr())) {
TRACE("euf", tout << "merge " << bpp(n) << "\n");
TRACE(euf, tout << "merge " << bpp(n) << "\n");
m_egraph.merge(n, mk_false(), to_ptr(~sat::literal(n->bool_var())));
merged = true;
}
}
CTRACE("euf", merged, tout << "shared bools merged\n");
CTRACE(euf, merged, tout << "shared bools merged\n");
return merged;
}
@ -747,7 +747,7 @@ namespace euf {
m_var_trail.shrink(sc.m_var_lim);
m_scopes.shrink(m_scopes.size() - n);
SASSERT(m_egraph.num_scopes() == m_scopes.size());
TRACE("euf_verbose", display(tout << "pop to: " << m_scopes.size() << "\n"););
TRACE(euf_verbose, display(tout << "pop to: " << m_scopes.size() << "\n"););
}
void solver::user_push() {
@ -792,10 +792,10 @@ namespace euf {
for (auto const& [e, generation, v] : m_reinit)
replay.m.insert(e, v);
TRACE("euf", for (auto const& kv : replay.m) tout << "b" << kv.m_value << "\n";);
TRACE(euf, for (auto const& kv : replay.m) tout << "b" << kv.m_value << "\n";);
for (auto const& [e, generation, v] : m_reinit) {
scoped_generation _sg(*this, generation);
TRACE("euf", tout << "replay: b" << v << " #" << e->get_id() << " " << mk_bounded_pp(e, m) << " " << si.is_bool_op(e) << "\n";);
TRACE(euf, tout << "replay: b" << v << " #" << e->get_id() << " " << mk_bounded_pp(e, m) << " " << si.is_bool_op(e) << "\n";);
sat::literal lit;
if (si.is_bool_op(e))
lit = literal(replay.m[e], false);
@ -823,7 +823,7 @@ namespace euf {
for (auto const& [e, generation, v] : m_reinit)
if (si.is_bool_op(e))
relevancy_reinit(e);
TRACE("euf", display(tout << "replay done\n"););
TRACE(euf, display(tout << "replay done\n"););
}
/**
@ -832,7 +832,7 @@ namespace euf {
* is not supported, we just disable relevancy.
*/
void solver::relevancy_reinit(expr* e) {
TRACE("euf", tout << "internalize again " << mk_pp(e, m) << "\n";);
TRACE(euf, tout << "internalize again " << mk_pp(e, m) << "\n";);
if (to_app(e)->get_family_id() != m.get_basic_family_id()) {
disable_relevancy(e);
return;
@ -1040,7 +1040,7 @@ namespace euf {
ok = false;
(void)ok;
TRACE("euf", tout << ok << " " << l << " -> " << r << "\n";);
TRACE(euf, tout << ok << " " << l << " -> " << r << "\n";);
// roots cannot be eliminated as long as the egraph contains the expressions.
return false;
}

View file

@ -47,17 +47,17 @@ namespace fpa {
expr_ref solver::convert(expr* e) {
expr_ref res(m);
expr* ccnv;
TRACE("t_fpa", tout << "converting " << mk_ismt2_pp(e, m) << "\n";);
TRACE(t_fpa, tout << "converting " << mk_ismt2_pp(e, m) << "\n";);
if (m_conversions.find(e, ccnv)) {
res = ccnv;
TRACE("t_fpa_detail", tout << "cached:" << "\n";
TRACE(t_fpa_detail, tout << "cached:" << "\n";
tout << mk_ismt2_pp(e, m) << "\n" << " -> " << "\n" << mk_ismt2_pp(res, m) << "\n";);
}
else {
res = m_rw.convert(m_th_rw, e);
TRACE("t_fpa_detail", tout << "converted; caching:" << "\n";
TRACE(t_fpa_detail, tout << "converted; caching:" << "\n";
tout << mk_ismt2_pp(e, m) << "\n" << " -> " << "\n" << mk_ismt2_pp(res, m) << "\n";);
m_conversions.insert(e, res);
@ -92,7 +92,7 @@ namespace fpa {
void solver::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";);
}
sat::literal solver::internalize(expr* e, bool sign, bool root) {
@ -132,14 +132,14 @@ namespace fpa {
n = mk_enode(e, false);
SASSERT(!n->is_attached_to(get_id()));
attach_new_th_var(n);
TRACE("fp", tout << "post: " << mk_bounded_pp(e, m) << "\n";);
TRACE(fp, tout << "post: " << mk_bounded_pp(e, m) << "\n";);
m_nodes.push_back(std::tuple(n, sign, root));
ctx.push(push_back_trail(m_nodes));
return true;
}
void solver::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_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()));
@ -210,7 +210,7 @@ namespace fpa {
}
void solver::activate(expr* 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();
@ -264,13 +264,13 @@ namespace fpa {
if (fu.is_bvwrap(xe) || fu.is_bvwrap(ye))
return;
TRACE("t_fpa", tout << "new eq: " << x << " = " << y << "\n";
TRACE(t_fpa, tout << "new eq: " << x << " = " << y << "\n";
tout << mk_ismt2_pp(xe, m) << "\n" << " = " << "\n" << mk_ismt2_pp(ye, m) << "\n";);
expr_ref xc = convert(xe);
expr_ref yc = convert(ye);
TRACE("t_fpa_detail", tout << "xc = " << mk_ismt2_pp(xc, m) << "\n" <<
TRACE(t_fpa_detail, tout << "xc = " << mk_ismt2_pp(xc, m) << "\n" <<
"yc = " << mk_ismt2_pp(yc, m) << "\n";);
expr_ref c(m);
@ -300,7 +300,7 @@ namespace fpa {
void solver::asserted(sat::literal l) {
expr* e = ctx.bool_var2expr(l.var());
TRACE("t_fpa", tout << "assign_eh for: " << l << "\n" << mk_ismt2_pp(e, m) << "\n";);
TRACE(t_fpa, tout << "assign_eh for: " << l << "\n" << mk_ismt2_pp(e, m) << "\n";);
sat::literal c = mk_literal(convert(e));
sat::literal_vector conds = mk_side_conditions();
@ -354,7 +354,7 @@ namespace fpa {
value = m_fpa_util.mk_pzero(ebits, sbits);
}
values.set(n->get_root_id(), value);
TRACE("t_fpa", tout << ctx.bpp(n) << " := " << value << "\n";);
TRACE(t_fpa, tout << ctx.bpp(n) << " := " << value << "\n";);
}
bool solver::add_dep(euf::enode* n, top_sort<euf::enode>& dep) {

View file

@ -40,7 +40,7 @@ namespace intblast {
euf::theory_var solver::mk_var(euf::enode* n) {
auto r = euf::th_euf_solver::mk_var(n);
ctx.attach_th_var(n, this, r);
TRACE("bv", tout << "mk-var: v" << r << " " << ctx.bpp(n) << "\n";);
TRACE(bv, tout << "mk-var: v" << r << " " << ctx.bpp(n) << "\n";);
return r;
}
@ -52,7 +52,7 @@ namespace intblast {
sat::literal lit = expr2literal(e);
if (sign)
lit.neg();
TRACE("bv", tout << mk_pp(e, m) << " -> " << literal2expr(lit) << "\n");
TRACE(bv, tout << mk_pp(e, m) << " -> " << literal2expr(lit) << "\n");
return lit;
}
@ -365,7 +365,7 @@ namespace intblast {
for (expr* e : todo)
m_translator.translate_expr(e);
TRACE("bv",
TRACE(bv,
for (expr* e : es)
tout << mk_pp(e, m) << "\n->\n" << mk_pp(m_translator.translated(e), m) << "\n";
);
@ -500,7 +500,7 @@ namespace intblast {
value = bv.mk_numeral(r, bv.get_bv_size(n->get_expr()));
}
values.set(n->get_root_id(), value);
TRACE("model", tout << "add_value " << ctx.bpp(n) << " := " << value << "\n");
TRACE(model, tout << "add_value " << ctx.bpp(n) << " := " << value << "\n");
}
void solver::finalize_model(model& mdl) {

View file

@ -124,7 +124,7 @@ namespace pb {
if (!is_watched(s, root)) watch_literal(s, root);
if (!is_pure() && !is_watched(s, ~root)) watch_literal(s, ~root);
}
TRACE("ba", display(tout << "init watch: ", s, true););
TRACE(ba, display(tout << "init watch: ", s, true););
SASSERT(root == sat::null_literal || s.value(root) == l_true);
unsigned j = 0, sz = c.size(), bound = c.k();
// put the non-false literals into the head.

View file

@ -125,7 +125,7 @@ namespace pb {
bool_var v = s().add_var(true);
literal lit(v, sign);
add_pb_ge(v, false, wlits, k.get_unsigned());
TRACE("ba", tout << "root: " << root << " lit: " << lit << "\n";);
TRACE(ba, tout << "root: " << root << " lit: " << lit << "\n";);
return lit;
}
}
@ -152,7 +152,7 @@ namespace pb {
sat::bool_var v = s().add_var(true);
sat::literal lit(v, sign);
add_pb_ge(v, false, wlits, k.get_unsigned());
TRACE("goal2sat", tout << "root: " << root << " lit: " << lit << "\n";);
TRACE(goal2sat, tout << "root: " << root << " lit: " << lit << "\n";);
return lit;
}
}
@ -217,7 +217,7 @@ namespace pb {
add_at_least(v, lits, k.get_unsigned());
si.cache(t, lit);
if (sign) lit.neg();
TRACE("ba", tout << "root: " << root << " lit: " << lit << "\n";);
TRACE(ba, tout << "root: " << root << " lit: " << lit << "\n";);
return lit;
}
}

View file

@ -178,7 +178,7 @@ namespace pb {
// SASSERT(validate_watch(p, sat::null_literal));
TRACE("ba", display(tout << "init watch: ", s, true););
TRACE(ba, display(tout << "init watch: ", s, true););
// slack is tight:
@ -245,7 +245,7 @@ namespace pb {
return false;
unsigned sum = 0;
TRACE("ba", display(tout << "validate: " << alit << "\n", s, true););
TRACE(ba, display(tout << "validate: " << alit << "\n", s, true););
for (wliteral wl : *this) {
literal l = wl.second;
lbool val = s.value(l);

View file

@ -34,7 +34,7 @@ namespace pb {
void solver::set_conflict(constraint& c, literal lit) {
m_stats.m_num_conflicts++;
TRACE("pb", display(tout, c, true); );
TRACE(pb, display(tout, c, true); );
if (!validate_conflict(c)) {
IF_VERBOSE(0, display(verbose_stream(), c, true));
UNREACHABLE();
@ -56,7 +56,7 @@ namespace pb {
default:
m_stats.m_num_propagations++;
m_num_propagations_since_pop++;
//TRACE("pb", tout << "#prop: " << m_stats.m_num_propagations << " - " << c.lit() << " => " << lit << "\n";);
//TRACE(pb, tout << "#prop: " << m_stats.m_num_propagations << " - " << c.lit() << " => " << lit << "\n";);
SASSERT(validate_unit_propagation(c, lit));
assign(lit, sat::justification::mk_ext_justification(s().scope_lvl(), c.cindex()));
break;
@ -69,7 +69,7 @@ namespace pb {
void solver::simplify(constraint& p) {
SASSERT(s().at_base_lvl());
if (p.lit() != sat::null_literal && value(p.lit()) == l_false) {
TRACE("pb", tout << "pb: flip sign " << p << "\n";);
TRACE(pb, tout << "pb: flip sign " << p << "\n";);
IF_VERBOSE(2, verbose_stream() << "sign is flipped " << p << "\n";);
return;
}
@ -280,7 +280,7 @@ namespace pb {
*/
lbool solver::add_assign(pbc& p, literal alit) {
BADLOG(display(verbose_stream() << "assign: " << alit << " watch: " << p.num_watch() << " size: " << p.size(), p, true));
TRACE("pb", display(tout << "assign: " << alit << "\n", p, true););
TRACE(pb, display(tout << "assign: " << alit << "\n", p, true););
SASSERT(!inconsistent());
unsigned sz = p.size();
unsigned bound = p.k();
@ -348,7 +348,7 @@ namespace pb {
SASSERT(validate_watch(p, sat::null_literal));
BADLOG(display(verbose_stream() << "conflict: " << alit << " watch: " << p.num_watch() << " size: " << p.size(), p, true));
SASSERT(bound <= slack);
TRACE("pb", tout << "conflict " << alit << "\n";);
TRACE(pb, tout << "conflict " << alit << "\n";);
set_conflict(p, alit);
return l_false;
}
@ -372,7 +372,7 @@ namespace pb {
//
if (slack < bound + m_a_max) {
BADLOG(verbose_stream() << "slack " << slack << " " << bound << " " << m_a_max << "\n";);
TRACE("pb", tout << p << "\n"; for(auto j : m_pb_undef) tout << j << " "; tout << "\n";);
TRACE(pb, tout << p << "\n"; for(auto j : m_pb_undef) tout << j << " "; tout << "\n";);
for (unsigned index1 : m_pb_undef) {
if (index1 == num_watch) {
index1 = index;
@ -389,7 +389,7 @@ namespace pb {
SASSERT(validate_watch(p, alit)); // except that alit is still watched.
TRACE("pb", display(tout << "assign: " << alit << "\n", p, true););
TRACE(pb, display(tout << "assign: " << alit << "\n", p, true););
BADLOG(verbose_stream() << "unwatch " << alit << " watch: " << p.num_watch() << " size: " << p.size() << " slack: " << p.slack() << " " << inconsistent() << "\n");
@ -497,7 +497,7 @@ namespace pb {
bool_var v = l.var();
SASSERT(v != sat::null_bool_var);
m_coeffs.reserve(v + 1, 0);
TRACE("ba_verbose", tout << l << " " << offset << "\n";);
TRACE(ba_verbose, tout << l << " " << offset << "\n";);
int64_t coeff0 = m_coeffs[v];
if (coeff0 == 0) {
@ -547,7 +547,7 @@ namespace pb {
literal l = literal(v, c1 < 0);
c1 = std::abs(c1);
unsigned c = static_cast<unsigned>(c1);
// TRACE("pb", tout << l << " " << c << "\n";);
// TRACE(pb, tout << l << " " << c << "\n";);
m_overflow |= c != c1;
return wliteral(c, l);
}
@ -638,7 +638,7 @@ namespace pb {
m_bound = 0;
literal consequent = s().m_not_l;
sat::justification js = s().m_conflict;
TRACE("pb", tout << consequent << " " << js << "\n";);
TRACE(pb, tout << consequent << " " << js << "\n";);
bool unique_max;
m_conflict_lvl = s().get_max_lvl(consequent, js, unique_max);
if (m_conflict_lvl == 0) {
@ -666,8 +666,8 @@ namespace pb {
goto process_next_resolvent;
}
DEBUG_CODE(TRACE("sat_verbose", display(tout, m_A);););
TRACE("pb", tout << "process consequent: " << consequent << " : "; s().display_justification(tout, js) << "\n";);
DEBUG_CODE(TRACE(sat_verbose, display(tout, m_A);););
TRACE(pb, tout << "process consequent: " << consequent << " : "; s().display_justification(tout, js) << "\n";);
SASSERT(offset > 0);
if (_debug_conflict) {
@ -729,7 +729,7 @@ namespace pb {
inc_bound(offset);
inc_coeff(consequent, offset);
get_antecedents(consequent, p, m_lemma);
TRACE("pb", display(tout, p, true); tout << m_lemma << "\n";);
TRACE(pb, display(tout, p, true); tout << m_lemma << "\n";);
if (_debug_conflict) {
verbose_stream() << consequent << " ";
verbose_stream() << "antecedents: " << m_lemma << "\n";
@ -754,7 +754,7 @@ namespace pb {
active2pb(m_C);
VERIFY(validate_resolvent());
m_A = m_C;
TRACE("pb", display(tout << "conflict: ", m_A);););
TRACE(pb, display(tout << "conflict: ", m_A);););
cut();
@ -781,7 +781,7 @@ namespace pb {
SASSERT(lvl(v) == m_conflict_lvl);
s().reset_mark(v);
--idx;
TRACE("sat_verbose", tout << "Unmark: v" << v << "\n";);
TRACE(sat_verbose, tout << "Unmark: v" << v << "\n";);
--m_num_marks;
js = s().m_justification[v];
offset = get_abs_coeff(v);
@ -875,7 +875,7 @@ namespace pb {
}
}
ineq.divide(c);
TRACE("pb", display(tout << "var: " << v << " " << c << ": ", ineq, true););
TRACE(pb, display(tout << "var: " << v << " " << c << ": ", ineq, true););
}
void solver::round_to_one(bool_var w) {
@ -893,7 +893,7 @@ namespace pb {
SASSERT(validate_lemma());
divide(c);
SASSERT(validate_lemma());
TRACE("pb", active2pb(m_B); display(tout, m_B, true););
TRACE(pb, active2pb(m_B); display(tout, m_B, true););
}
void solver::divide(unsigned c) {
@ -923,14 +923,14 @@ namespace pb {
}
void solver::resolve_with(ineq const& ineq) {
TRACE("pb", display(tout, ineq, true););
TRACE(pb, display(tout, ineq, true););
inc_bound(ineq.m_k);
TRACE("pb", tout << "bound: " << m_bound << "\n";);
TRACE(pb, tout << "bound: " << m_bound << "\n";);
for (unsigned i = ineq.size(); i-- > 0; ) {
literal l = ineq.lit(i);
inc_coeff(l, static_cast<unsigned>(ineq.coeff(i)));
TRACE("pb", tout << "bound: " << m_bound << " lit: " << l << " coeff: " << ineq.coeff(i) << "\n";);
TRACE(pb, tout << "bound: " << m_bound << " lit: " << l << " coeff: " << ineq.coeff(i) << "\n";);
}
}
@ -983,11 +983,11 @@ namespace pb {
consequent.neg();
process_antecedent(consequent, 1);
}
TRACE("pb", tout << consequent << " " << js << "\n";);
TRACE(pb, tout << consequent << " " << js << "\n";);
unsigned idx = s().m_trail.size() - 1;
do {
TRACE("pb", s().display_justification(tout << "process consequent: " << consequent << " : ", js) << "\n";
TRACE(pb, s().display_justification(tout << "process consequent: " << consequent << " : ", js) << "\n";
if (consequent != sat::null_literal) { active2pb(m_A); display(tout, m_A, true); }
);
@ -1049,7 +1049,7 @@ namespace pb {
}
else {
SASSERT(k > c);
TRACE("pb", tout << "visited: " << l << "\n";);
TRACE(pb, tout << "visited: " << l << "\n";);
k -= c;
}
}
@ -1098,7 +1098,7 @@ namespace pb {
}
}
if (idx == 0) {
TRACE("pb", tout << "there is no consequent\n";);
TRACE(pb, tout << "there is no consequent\n";);
goto bail_out;
}
--idx;
@ -1111,7 +1111,7 @@ namespace pb {
js = s().m_justification[v];
}
while (m_num_marks > 0 && !m_overflow);
TRACE("pb", active2pb(m_A); display(tout, m_A, true););
TRACE(pb, active2pb(m_A); display(tout, m_A, true););
// TBD: check if this is useful
if (!m_overflow && consequent != sat::null_literal) {
@ -1123,7 +1123,7 @@ namespace pb {
}
bail_out:
TRACE("pb", tout << "bail " << m_overflow << "\n";);
TRACE(pb, tout << "bail " << m_overflow << "\n";);
if (m_overflow) {
++m_stats.m_num_overflow;
m_overflow = false;
@ -1179,23 +1179,23 @@ namespace pb {
}
}
if (slack >= 0) {
TRACE("pb", tout << "slack is non-negative\n";);
TRACE(pb, tout << "slack is non-negative\n";);
IF_VERBOSE(20, verbose_stream() << "(sat.card slack: " << slack << " skipped: " << num_skipped << ")\n";);
return false;
}
if (m_overflow) {
TRACE("pb", tout << "overflow\n";);
TRACE(pb, tout << "overflow\n";);
return false;
}
if (m_lemma[0] == sat::null_literal) {
if (m_lemma.size() == 1) {
s().set_conflict(sat::justification(0));
}
TRACE("pb", tout << "no asserting literal\n";);
TRACE(pb, tout << "no asserting literal\n";);
return false;
}
TRACE("pb", tout << m_lemma << "\n";);
TRACE(pb, tout << m_lemma << "\n";);
if (get_config().m_drat && m_solver) {
s().m_drat.add(m_lemma, sat::status::th(true, get_id()));
@ -1204,7 +1204,7 @@ namespace pb {
s().m_lemma.reset();
s().m_lemma.append(m_lemma);
for (unsigned i = 1; i < m_lemma.size(); ++i) {
CTRACE("pb", s().is_marked(m_lemma[i].var()), tout << "marked: " << m_lemma[i] << "\n";);
CTRACE(pb, s().is_marked(m_lemma[i].var()), tout << "marked: " << m_lemma[i] << "\n";);
s().mark(m_lemma[i].var());
}
return true;
@ -1550,7 +1550,7 @@ namespace pb {
}
void solver::get_antecedents(literal l, pbc const& p, literal_vector& r) {
TRACE("pb", display(tout << l << " level: " << s().scope_lvl() << " ", p, true););
TRACE(pb, display(tout << l << " level: " << s().scope_lvl() << " ", p, true););
SASSERT(p.lit() == sat::null_literal || value(p.lit()) == l_true);
if (p.lit() != sat::null_literal) {
@ -1602,7 +1602,7 @@ namespace pb {
if (j < p.num_watch()) {
j = p.num_watch();
}
CTRACE("pb", coeff == 0, display(tout << l << " coeff: " << coeff << "\n", p, true););
CTRACE(pb, coeff == 0, display(tout << l << " coeff: " << coeff << "\n", p, true););
if (_debug_conflict) {
IF_VERBOSE(0, verbose_stream() << "coeff " << coeff << "\n";);
@ -1653,7 +1653,7 @@ namespace pb {
for (unsigned i = 0; !found && i < c.k(); ++i) {
found = c[i] == l;
}
CTRACE("pb",!found, s().display(tout << l << ":" << c << "\n"););
CTRACE(pb,!found, s().display(tout << l << ":" << c << "\n"););
SASSERT(found););
VERIFY(c.lit() == sat::null_literal || value(c.lit()) != l_false);
@ -1693,7 +1693,7 @@ namespace pb {
}
void solver::remove_constraint(constraint& c, char const* reason) {
TRACE("pb", display(tout << "remove ", c, true) << " " << reason << "\n";);
TRACE(pb, display(tout << "remove ", c, true) << " " << reason << "\n";);
IF_VERBOSE(21, display(verbose_stream() << "remove " << reason << " ", c, true););
c.nullify_tracking_literal(*this);
clear_watch(c);
@ -1868,7 +1868,7 @@ namespace pb {
}
void solver::gc_half(char const* st_name) {
TRACE("pb", tout << "gc\n";);
TRACE(pb, tout << "gc\n";);
unsigned sz = m_learned.size();
unsigned new_sz = sz/2;
unsigned removed = 0;
@ -1915,7 +1915,7 @@ namespace pb {
// literal is assigned to false.
unsigned sz = c.size();
unsigned bound = c.k();
TRACE("pb", tout << "assign: " << c.lit() << ": " << ~alit << "@" << lvl(~alit) << " " << c << "\n";);
TRACE(pb, tout << "assign: " << c.lit() << ": " << ~alit << "@" << lvl(~alit) << " " << c << "\n";);
SASSERT(0 < bound && bound <= sz);
if (bound == sz) {
@ -1953,7 +1953,7 @@ namespace pb {
// conflict
if (bound != index && value(c[bound]) == l_false) {
TRACE("pb", tout << "conflict " << c[bound] << " " << alit << "\n";);
TRACE(pb, tout << "conflict " << c[bound] << " " << alit << "\n";);
if (c.lit() != sat::null_literal && value(c.lit()) == l_undef) {
if (index + 1 < bound) c.swap(index, bound - 1);
assign(c, ~c.lit());
@ -1967,7 +1967,7 @@ namespace pb {
c.swap(index, bound);
}
// 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
@ -2002,7 +2002,7 @@ namespace pb {
}
void solver::pop(unsigned n) {
TRACE("sat_verbose", tout << "pop:" << n << "\n";);
TRACE(sat_verbose, tout << "pop:" << n << "\n";);
unsigned new_lim = m_constraint_to_reinit_lim.size() - n;
m_constraint_to_reinit_last_sz = m_constraint_to_reinit_lim[new_lim];
m_constraint_to_reinit_lim.shrink(new_lim);
@ -2333,7 +2333,7 @@ namespace pb {
}
if (!all_units) {
TRACE("pb", tout << "replacing by pb: " << c << "\n";);
TRACE(pb, tout << "replacing by pb: " << c << "\n";);
m_wlits.reset();
for (unsigned i = 0; i < sz; ++i) {
m_wlits.push_back(wliteral(coeffs[i], c[i]));
@ -2898,13 +2898,13 @@ namespace pb {
SASSERT(&c1 != &c2);
if (subsumes(c1, c2, slit)) {
if (slit.empty()) {
TRACE("pb", tout << "subsume cardinality\n" << c1 << "\n" << c2 << "\n";);
TRACE(pb, tout << "subsume cardinality\n" << c1 << "\n" << c2 << "\n";);
remove_constraint(c2, "subsumed");
++m_stats.m_num_pb_subsumes;
set_non_learned(c1);
}
else {
TRACE("pb", tout << "self subsume cardinality\n";);
TRACE(pb, tout << "self subsume cardinality\n";);
IF_VERBOSE(11,
verbose_stream() << "self-subsume cardinality\n";
verbose_stream() << c1 << "\n";
@ -2936,7 +2936,7 @@ namespace pb {
// self-subsumption is TBD
}
else {
TRACE("pb", tout << "remove\n" << c1 << "\n" << c2 << "\n";);
TRACE(pb, tout << "remove\n" << c1 << "\n" << c2 << "\n";);
removed_clauses.push_back(&c2);
++m_stats.m_num_clause_subsumes;
set_non_learned(c1);
@ -3268,7 +3268,7 @@ namespace pb {
val += wl.first;
}
}
CTRACE("pb", val >= 0, active2pb(m_A); display(tout, m_A, true););
CTRACE(pb, val >= 0, active2pb(m_A); display(tout, m_A, true););
return val < 0;
}
@ -3281,7 +3281,7 @@ namespace pb {
if (!is_false(wl.second))
k += wl.first;
}
CTRACE("pb", k > 0, display(tout, ineq, true););
CTRACE(pb, k > 0, display(tout, ineq, true););
return k <= 0;
}
@ -3340,7 +3340,7 @@ namespace pb {
return nullptr;
}
constraint* c = add_pb_ge(sat::null_literal, m_wlits, m_bound, true);
TRACE("pb", if (c) display(tout, *c, true););
TRACE(pb, if (c) display(tout, *c, true););
++m_stats.m_num_lemmas;
return c;
}
@ -3528,7 +3528,7 @@ namespace pb {
s0.assign_scoped(l2);
s0.assign_scoped(l3);
lbool is_sat = s0.check();
TRACE("pb", s0.display(tout << "trying sat encoding"););
TRACE(pb, s0.display(tout << "trying sat encoding"););
if (is_sat == l_false) return true;
IF_VERBOSE(0,
@ -3639,11 +3639,11 @@ namespace pb {
bool solver::validate_conflict(literal_vector const& lits, ineq& p) {
for (literal l : lits) {
if (value(l) != l_false) {
TRACE("pb", tout << "literal " << l << " is not false\n";);
TRACE(pb, tout << "literal " << l << " is not false\n";);
return false;
}
if (!p.contains(l)) {
TRACE("pb", tout << "lemma contains literal " << l << " not in inequality\n";);
TRACE(pb, tout << "lemma contains literal " << l << " not in inequality\n";);
return false;
}
}
@ -3654,7 +3654,7 @@ namespace pb {
value += coeff;
}
}
CTRACE("pb", value >= p.m_k, tout << "slack: " << value << " bound " << p.m_k << "\n";
CTRACE(pb, value >= p.m_k, tout << "slack: " << value << " bound " << p.m_k << "\n";
display(tout, p);
tout << lits << "\n";);
return value < p.m_k;

View file

@ -157,7 +157,7 @@ namespace q {
SASSERT(is_forall(r));
for (expr* d : m_new_defs)
m_qs.add_unit(m_qs.mk_literal(d));
CTRACE("q", r != q, tout << mk_pp(q, m) << " -->\n" << r << "\n" << m_new_defs << "\n";);
CTRACE(q, r != q, tout << mk_pp(q, m) << " -->\n" << r << "\n" << m_new_defs << "\n";);
return quantifier_ref(to_quantifier(r), m);
}
@ -191,7 +191,7 @@ namespace q {
};
void ematch::on_merge(euf::enode* root, euf::enode* other) {
TRACE("q", tout << "on-merge " << ctx.bpp(root) << " " << ctx.bpp(other) << "\n";);
TRACE(q, tout << "on-merge " << ctx.bpp(root) << " " << ctx.bpp(other) << "\n";);
SASSERT(root->get_root() == other->get_root());
unsigned root_id = root->get_expr_id();
unsigned other_id = other->get_expr_id();
@ -331,7 +331,7 @@ namespace q {
binding* b = alloc_binding(c, pat, _binding, max_generation, min_gen, max_gen);
if (!b)
return;
TRACE("q", b->display(ctx, tout << "on-binding " << mk_pp(q, m) << "\n") << "\n";);
TRACE(q, b->display(ctx, tout << "on-binding " << mk_pp(q, m) << "\n") << "\n";);
if (propagate(false, _binding, max_generation, c, new_propagation))
@ -576,7 +576,7 @@ namespace q {
};
void ematch::add(quantifier* _q) {
TRACE("q", tout << "add " << mk_pp(_q, m) << "\n");
TRACE(q, tout << "add " << mk_pp(_q, m) << "\n");
scoped_ptr<clause> c = clausify(_q);
quantifier* q = c->q();
if (m_q2clauses.contains(q))
@ -598,9 +598,9 @@ namespace q {
app * mp = to_app(q->get_pattern(i));
SASSERT(m.is_pattern(mp));
bool unary = (mp->get_num_args() == 1);
TRACE("q", tout << "adding:\n" << expr_ref(mp, m) << "\n");
TRACE(q, tout << "adding:\n" << expr_ref(mp, m) << "\n");
if (!unary && j >= num_eager_multi_patterns) {
TRACE("q", tout << "delaying (too many multipatterns):\n" << mk_ismt2_pp(mp, m) << "\n";);
TRACE(q, tout << "delaying (too many multipatterns):\n" << mk_ismt2_pp(mp, m) << "\n";);
if (!m_lazy_mam)
m_lazy_mam = euf::mam::mk(ctx, *this);
m_lazy_mam->add_pattern(q, mp);
@ -675,7 +675,7 @@ namespace q {
}
bool ematch::operator()() {
TRACE("q", m_mam->display(tout););
TRACE(q, m_mam->display(tout););
if (propagate(false))
return true;
if (m_lazy_mam)
@ -692,11 +692,11 @@ namespace q {
for (unsigned i = 0; i < m_clauses.size(); ++i)
if (m_clauses[i]->m_bindings) {
IF_VERBOSE(0, verbose_stream() << "missed propagation " << i << "\n");
TRACE("q", display(tout << "missed propagation\n"));
TRACE(q, display(tout << "missed propagation\n"));
break;
}
TRACE("q", tout << "no more propagation\n";);
TRACE(q, tout << "no more propagation\n";);
return false;
}

View file

@ -47,7 +47,7 @@ namespace q {
unsigned lim = m_indirect_nodes.size();
lit l = c[i];
lbool cmp = compare(n, binding, l.lhs, l.rhs, evidence);
TRACE("q", tout << l.lhs << " ~~ " << l.rhs << " is " << cmp << "\n";);
TRACE(q, tout << l.lhs << " ~~ " << l.rhs << " is " << cmp << "\n";);
switch (cmp) {
case l_false:
m_indirect_nodes.shrink(lim);
@ -93,7 +93,7 @@ namespace q {
euf::enode* tr = tn ? tn->get_root() : tn;
if (sn != sr) evidence.push_back(euf::enode_pair(sn, sr)), sn = sr;
if (tn != tr) evidence.push_back(euf::enode_pair(tn, tr)), tn = tr;
TRACE("q", tout << mk_pp(s, m) << " ~~ " << mk_pp(t, m) << "\n";
TRACE(q, tout << mk_pp(s, m) << " ~~ " << mk_pp(t, m) << "\n";
tout << ctx.bpp(sn) << " " << ctx.bpp(tn) << "\n";);
lbool c;
@ -237,7 +237,7 @@ namespace q {
if (a->get_root() != b->get_root())
return nullptr;
TRACE("q", tout << "evidence " << ctx.bpp(a) << " " << ctx.bpp(b) << "\n");
TRACE(q, tout << "evidence " << ctx.bpp(a) << " " << ctx.bpp(b) << "\n");
evidence.push_back(euf::enode_pair(a, b));
}
m_indirect_nodes.push_back(n);

View file

@ -197,7 +197,7 @@ namespace q {
expr_ref_vector eqs(m);
add_domain_bounds(mdl, qb);
auto proj = solver_project(mdl, qb, eqs, false);
CTRACE("q", !proj, tout << "could not project " << qb.mbody << " " << eqs << "\n" << mdl);
CTRACE(q, !proj, tout << "could not project " << qb.mbody << " " << eqs << "\n" << mdl);
if (!proj)
return false;
add_instantiation(q, proj);
@ -234,7 +234,7 @@ namespace q {
if (is_exists(q))
qlit.neg();
ctx.rewrite(proj);
TRACE("q", tout << "project: " << proj << "\n";);
TRACE(q, tout << "project: " << proj << "\n";);
IF_VERBOSE(11, verbose_stream() << "mbi:\n" << mk_pp(q, m) << "\n" << proj << "\n");
++m_stats.m_num_instantiations;
unsigned generation = ctx.get_max_generation(proj);
@ -280,7 +280,7 @@ namespace q {
mbody = subst(mbody, result->vars);
if (is_forall(q))
mbody = mk_not(m, mbody);
TRACE("q", tout << "specialize " << mbody << "\n";);
TRACE(q, tout << "specialize " << mbody << "\n";);
return result;
}
@ -319,7 +319,7 @@ namespace q {
app_ref_vector vars(qb.vars);
bool fmls_extracted = false;
m_defs.reset();
TRACE("q",
TRACE(q,
tout << "Project\n";
tout << fmls << "\n";
tout << "model\n";
@ -337,13 +337,13 @@ namespace q {
app* v = vars.get(i);
auto* p = get_plugin(v);
if (p && !fmls_extracted) {
TRACE("q", tout << "domain eqs\n" << qb.domain_eqs << "\n";);
TRACE(q, tout << "domain eqs\n" << qb.domain_eqs << "\n";);
fmls.append(qb.domain_eqs);
eliminate_nested_vars(fmls, qb);
for (expr* e : fmls)
if (!m_model->is_true(e)) {
TRACE("q", tout << "not true: " << mk_pp(e, m) << " := " << (*m_model)(e) << "\n");
TRACE(q, tout << "not true: " << mk_pp(e, m) << " := " << (*m_model)(e) << "\n");
return expr_ref(nullptr, m);
}
mbp::project_plugin proj(m);
@ -357,21 +357,21 @@ namespace q {
return expr_ref(m);
}
else if (!(*p)(*m_model, vars, fmls)) {
TRACE("q", tout << "theory projection failed - use value\n");
TRACE(q, tout << "theory projection failed - use value\n");
}
}
for (app* v : vars) {
expr_ref term(m);
expr_ref val = (*m_model)(v);
term = replace_model_value(val);
TRACE("euf", tout << "replaced model value " << term << "\nfrom\n" << val << "\n");
TRACE(euf, tout << "replaced model value " << term << "\nfrom\n" << val << "\n");
rep.insert(v, term);
if (ctx.use_drat())
m_defs.push_back({expr_ref(v, m), term});
eqs.push_back(m.mk_eq(v, val));
}
rep(fmls);
TRACE("q", tout << "generated formulas\n" << fmls << "\ngenerated eqs:\n" << eqs << "\n";
TRACE(q, tout << "generated formulas\n" << fmls << "\ngenerated eqs:\n" << eqs << "\n";
for (auto const& [v,t] : m_defs) tout << v << " := " << t << "\n");
return mk_and(fmls);
}
@ -436,7 +436,7 @@ namespace q {
void mbqi::assert_expr(expr* e) {
expr_ref _e(e, m);
TRACE("q", tout << _e << "\n");
TRACE(q, tout << _e << "\n");
m_solver->assert_expr(e);
}

View file

@ -70,7 +70,7 @@ namespace q {
if (univ.empty())
return;
TRACE("q", tout << "start: " << mdl << "\n";);
TRACE(q, tout << "start: " << mdl << "\n";);
m_dependencies.reset();
m_projection_data.reset();
m_projection_pinned.reset();
@ -96,7 +96,7 @@ namespace q {
if (fi->is_partial())
fi->set_else(mdl.get_some_value(f->get_range()));
}
TRACE("q", tout << "end: " << mdl << "\n";);
TRACE(q, tout << "end: " << mdl << "\n";);
}
quantifier_macro_info* model_fixer::operator()(quantifier* q) {
@ -252,7 +252,7 @@ namespace q {
expr* model_fixer::invert_app(app* t, expr* value) {
euf::enode* r = nullptr;
auto& v2r = ctx.values2root();
TRACE("q",
TRACE(q,
tout << "invert-app " << mk_pp(t, m) << " =\n" << mk_pp(value, m) << "\n";
if (v2r.find(value, r))
tout << "inverse " << mk_pp(r->get_expr(), m) << "\n";
@ -273,7 +273,7 @@ namespace q {
*/
void model_fixer::invert_arg(app* t, unsigned i, expr* value, expr_ref_vector& lits) {
TRACE("q", tout << "invert-arg " << mk_pp(t, m) << " " << i << " " << mk_pp(value, m) << "\n";);
TRACE(q, tout << "invert-arg " << mk_pp(t, m) << " " << i << " " << mk_pp(value, m) << "\n";);
auto const* md = get_projection_data(t->get_decl(), i);
if (!md)
return;
@ -326,7 +326,7 @@ namespace q {
* restrict arg_i of t := f(...,arg_i,...) to be one of terms from the ground instantiations of f.
*/
expr_ref model_fixer::restrict_arg(app* t, unsigned i) {
TRACE("q", tout << "restrict-arg " << mk_pp(t, m) << " " << i << "\n";);
TRACE(q, tout << "restrict-arg " << mk_pp(t, m) << " " << i << "\n";);
auto const* md = get_projection_data(t->get_decl(), i);
if (!md)
return expr_ref(m.mk_true(), m);

View file

@ -41,7 +41,7 @@ namespace q {
}
void queue::setup() {
TRACE("q", tout << "qi_cost: " << m_params.m_qi_cost << "\n";);
TRACE(q, tout << "qi_cost: " << m_params.m_qi_cost << "\n";);
if (!m_parser.parse_string(m_params.m_qi_cost.c_str(), m_cost_function)) {
warning_msg("invalid cost function '%s', switching to default one", m_params.m_qi_cost.c_str());
VERIFY(m_parser.parse_string("(+ weight generation)", m_cost_function));
@ -105,7 +105,7 @@ namespace q {
m_vals[SCOPE] = static_cast<float>(ctx.s().num_scopes());
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("q_detail", for (unsigned i = 0; i < m_vals.size(); i++) { tout << m_vals[i] << " "; } tout << "\n";);
TRACE(q_detail, for (unsigned i = 0; i < m_vals.size(); i++) { tout << m_vals[i] << " "; } tout << "\n";);
}
float queue::get_cost(binding& f) {
@ -196,11 +196,11 @@ namespace q {
instantiate(curr);
else if (m_params.m_qi_promote_unsat && l_false == em.evaluate(f.nodes(), *f.c)) {
// do not delay instances that produce a conflict.
TRACE("q", tout << "promoting instance that produces a conflict\n" << mk_pp(f.q(), m) << "\n";);
TRACE(q, tout << "promoting instance that produces a conflict\n" << mk_pp(f.q(), m) << "\n";);
instantiate(curr);
}
else {
TRACE("q", tout << "delaying quantifier instantiation... " << f << "\n" << mk_pp(f.q(), m) << "\ncost: " << curr.m_cost << "\n";);
TRACE(q, tout << "delaying quantifier instantiation... " << f << "\n" << mk_pp(f.q(), m) << "\ncost: " << curr.m_cost << "\n";);
m_delayed_entries.push_back(curr);
ctx.push(push_back_vector<svector<entry>>(m_delayed_entries));
}
@ -227,7 +227,7 @@ namespace q {
bool init = false;
cost_limit = 0.0;
for (entry & e : m_delayed_entries) {
TRACE("q", tout << e.m_qb << ", cost: " << e.m_cost << ", instantiated: " << e.m_instantiated << "\n";);
TRACE(q, 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 < cost_limit)) {
init = true;
cost_limit = e.m_cost;

View file

@ -357,7 +357,7 @@ namespace q {
}
void solver::log_instantiation(unsigned n, sat::literal const* lits, justification* j) {
TRACE("q", for (unsigned i = 0; i < n; ++i) tout << literal2expr(lits[i]) << "\n";);
TRACE(q, for (unsigned i = 0; i < n; ++i) tout << literal2expr(lits[i]) << "\n";);
if (get_config().m_instantiations2console) {
ctx.on_instantiation(n, lits, j ? j->m_clause.num_decls() : 0, j ? j->m_binding : nullptr);
}

View file

@ -20,7 +20,7 @@ Author:
#include "sat/smt/euf_solver.h"
#define TRACEFN(x) TRACE("recfun", tout << x << '\n';)
#define TRACEFN(x) TRACE(recfun, tout << x << '\n';)
namespace recfun {
@ -236,7 +236,7 @@ namespace recfun {
force_push();
SASSERT(m.is_bool(e));
if (!visit_rec(m, e, sign, root)) {
TRACE("array", tout << mk_pp(e, m) << "\n";);
TRACE(array, tout << mk_pp(e, m) << "\n";);
return sat::null_literal;
}
auto lit = expr2literal(e);

View file

@ -198,7 +198,7 @@ namespace euf {
virtual void push_core();
virtual void pop_core(unsigned n);
void force_push() {
CTRACE("euf_verbose", m_num_scopes > 0, tout << "push-core " << m_num_scopes << "\n";);
CTRACE(euf_verbose, m_num_scopes > 0, tout << "push-core " << m_num_scopes << "\n";);
for (; m_num_scopes > 0; --m_num_scopes) push_core();
}

View file

@ -52,11 +52,11 @@ namespace specrel {
}
void solver::new_eq_eh(euf::th_eq const& eq) {
TRACE("specrel", tout << "new-eq\n");
TRACE(specrel, tout << "new-eq\n");
if (eq.is_eq()) {
auto* p = ctx.get_egraph().get_plugin(sp.get_family_id());
p->merge_eh(var2enode(eq.v1()), var2enode(eq.v2()));
TRACE("specrel", tout << eq.v1() << " " << eq.v2() << "\n");
TRACE(specrel, tout << eq.v1() << " " << eq.v2() << "\n");
}
}
@ -103,7 +103,7 @@ namespace specrel {
n = mk_enode(term);
SASSERT(!n->is_attached_to(get_id()));
mk_var(n);
TRACE("specrel", tout << ctx.bpp(n) << "\n");
TRACE(specrel, tout << ctx.bpp(n) << "\n");
return true;
}

View file

@ -325,7 +325,7 @@ namespace user_solver {
sat::literal solver::internalize(expr* e, bool sign, bool root) {
if (!visit_rec(m, e, sign, root)) {
TRACE("array", tout << mk_pp(e, m) << "\n";);
TRACE(array, tout << mk_pp(e, m) << "\n";);
return sat::null_literal;
}
sat::literal lit = ctx.expr2literal(e);

View file

@ -31,7 +31,7 @@ namespace sat {
lbool ba_solver::add_assign(xr& x, literal alit) {
// literal is assigned
unsigned sz = x.size();
TRACE("ba", tout << "assign: " << ~alit << "@" << lvl(~alit) << " " << x << "\n"; display(tout, x, true); );
TRACE(ba, tout << "assign: " << ~alit << "@" << lvl(~alit) << " " << x << "\n"; display(tout, x, true); );
VERIFY(x.lit() == null_literal);
SASSERT(value(alit) != l_undef);
@ -47,7 +47,7 @@ namespace sat {
// alit gets unwatched by propagate_core because we return l_undef
x.watch_literal(*this, lit);
x.watch_literal(*this, ~lit);
TRACE("ba", tout << "swap in: " << lit << " " << x << "\n";);
TRACE(ba, tout << "swap in: " << lit << " " << x << "\n";);
return l_undef;
}
}
@ -188,7 +188,7 @@ namespace sat {
unsigned level = lvl(l);
bool_var v = l.var();
SASSERT(js.get_kind() == justification::EXT_JUSTIFICATION);
TRACE("ba", tout << l << ": " << js << "\n";
TRACE(ba, tout << l << ": " << js << "\n";
for (unsigned i = 0; i <= index; ++i) tout << s().m_trail[i] << " "; tout << "\n";
s().display_units(tout);
);
@ -196,10 +196,10 @@ namespace sat {
unsigned num_marks = 0;
while (true) {
TRACE("ba", tout << "process: " << l << " " << js << "\n";);
TRACE(ba, tout << "process: " << l << " " << js << "\n";);
if (js.get_kind() == justification::EXT_JUSTIFICATION) {
constraint& c = index2constraint(js.get_ext_justification_idx());
TRACE("ba", tout << c << "\n";);
TRACE(ba, tout << c << "\n";);
if (!c.is_xr()) {
r.push_back(l);
}
@ -213,7 +213,7 @@ namespace sat {
literal lit(value(x[i]) == l_true ? x[i] : ~x[i]);
inc_parity(lit.var());
if (lvl(lit) == level) {
TRACE("ba", tout << "mark: " << lit << "\n";);
TRACE(ba, tout << "mark: " << lit << "\n";);
++num_marks;
}
else {
@ -259,7 +259,7 @@ namespace sat {
reset_parity(lit.var());
}
m_parity_trail.reset();
TRACE("ba", tout << r << "\n";);
TRACE(ba, tout << r << "\n";);
}
void ba_solver::pre_simplify() {
@ -290,7 +290,7 @@ namespace sat {
void ba_solver::get_antecedents(literal l, xr const& x, literal_vector& r) {
if (x.lit() != null_literal) r.push_back(x.lit());
// TRACE("ba", display(tout << l << " ", x, true););
// TRACE(ba, display(tout << l << " ", x, true););
SASSERT(x.lit() == null_literal || value(x.lit()) == l_true);
SASSERT(x[0].var() == l.var() || x[1].var() == l.var());
if (x[0].var() == l.var()) {

View file

@ -150,7 +150,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
}
void mk_clause(unsigned n, sat::literal * lits, euf::th_proof_hint* ph) {
TRACE("goal2sat", tout << "mk_clause: "; for (unsigned i = 0; i < n; i++) tout << lits[i] << " "; tout << "\n";);
TRACE(goal2sat, tout << "mk_clause: "; for (unsigned i = 0; i < n; i++) tout << lits[i] << " "; tout << "\n";);
if (relevancy_enabled())
ensure_euf()->add_aux(n, lits);
m_solver.add_clause(n, lits, mk_status(ph));
@ -172,7 +172,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
}
void mk_root_clause(unsigned n, sat::literal * lits, euf::th_proof_hint* ph = nullptr) {
TRACE("goal2sat", tout << "mk_root_clause: "; for (unsigned i = 0; i < n; i++) tout << lits[i] << " "; tout << "\n";);
TRACE(goal2sat, tout << "mk_root_clause: "; for (unsigned i = 0; i < n; i++) tout << lits[i] << " "; tout << "\n";);
if (relevancy_enabled())
ensure_euf()->add_root(n, lits);
m_solver.add_clause(n, lits, ph ? mk_status(ph) : sat::status::input());
@ -324,7 +324,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
bool ext = m_default_external || !is_uninterp_const(t) || m_interface_vars.contains(t);
if (ext)
m_solver.set_external(v);
TRACE("sat", tout << "new_var: " << v << ": " << mk_bounded_pp(t, m, 2) << " " << is_uninterp_const(t) << "\n";);
TRACE(sat, tout << "new_var: " << v << ": " << mk_bounded_pp(t, m, 2) << " " << is_uninterp_const(t) << "\n";);
}
}
else {
@ -396,7 +396,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
convert_euf(t, root, sign);
return true;
}
TRACE("goal2sat_not_handled", tout << mk_ismt2_pp(t, m) << "\n";);
TRACE(goal2sat_not_handled, tout << mk_ismt2_pp(t, m) << "\n";);
std::ostringstream strm;
strm << mk_ismt2_pp(t, m);
throw_op_not_handled(strm.str());
@ -408,7 +408,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
}
void convert_or(app * t, bool root, bool sign) {
TRACE("goal2sat", tout << "convert_or:\n" << mk_bounded_pp(t, m, 2) << " root " << root << " stack " << m_result_stack.size() << "\n";);
TRACE(goal2sat, tout << "convert_or:\n" << mk_bounded_pp(t, m, 2) << " root " << root << " stack " << m_result_stack.size() << "\n";);
unsigned num = t->get_num_args();
SASSERT(num <= m_result_stack.size());
unsigned old_sz = m_result_stack.size() - num;
@ -459,7 +459,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
}
void convert_and(app * t, bool root, bool sign) {
TRACE("goal2sat", tout << "convert_and:\n" << mk_bounded_pp(t, m, 2) << " root: " << root << " result stack: " << m_result_stack.size() << "\n";);
TRACE(goal2sat, tout << "convert_and:\n" << mk_bounded_pp(t, m, 2) << " root: " << root << " result stack: " << m_result_stack.size() << "\n";);
unsigned num = t->get_num_args();
unsigned old_sz = m_result_stack.size() - num;
@ -685,7 +685,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
void convert_euf(expr* e, bool root, bool sign) {
SASSERT(m_euf);
TRACE("goal2sat", tout << "convert-euf " << mk_bounded_pp(e, m, 2) << " root " << root << "\n";);
TRACE(goal2sat, tout << "convert-euf " << mk_bounded_pp(e, m, 2) << " root " << root << "\n";);
euf::solver* euf = ensure_euf();
sat::literal lit;
{
@ -783,7 +783,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
};
void process(expr* n, bool is_root) {
TRACE("goal2sat", tout << "process-begin " << mk_bounded_pp(n, m, 2)
TRACE(goal2sat, tout << "process-begin " << mk_bounded_pp(n, m, 2)
<< " root: " << is_root
<< " result-stack: " << m_result_stack.size()
<< " frame-stack: " << m_frame_stack.size() << "\n";);
@ -803,7 +803,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
app * t = _fr.m_t;
bool root = _fr.m_root;
bool sign = _fr.m_sign;
TRACE("goal2sat_bug", tout << "result stack\n";
TRACE(goal2sat_bug, tout << "result stack\n";
tout << "ref-count: " << t->get_ref_count() << "\n";
tout << mk_bounded_pp(t, m, 3) << " root: " << root << " sign: " << sign << "\n";
tout << m_result_stack << "\n";);
@ -822,16 +822,16 @@ struct goal2sat::imp : public sat::sat_internalizer {
m_frame_stack[fsz - 1].m_idx++;
if (!visit(arg, false, false))
goto loop;
TRACE("goal2sat_bug", tout << "visit " << mk_bounded_pp(arg, m, 2) << " result stack: " << m_result_stack.size() << "\n";);
TRACE(goal2sat_bug, tout << "visit " << mk_bounded_pp(arg, m, 2) << " result stack: " << m_result_stack.size() << "\n";);
}
TRACE("goal2sat_bug", tout << "converting\n";
TRACE(goal2sat_bug, tout << "converting\n";
tout << mk_bounded_pp(t, m, 2) << " root: " << root << " sign: " << sign << "\n";
tout << m_result_stack << "\n";);
SASSERT(m_frame_stack.size() > sz);
convert(t, root, sign);
m_frame_stack.pop_back();
}
TRACE("goal2sat", tout
TRACE(goal2sat, tout
<< "done process: " << mk_bounded_pp(n, m, 3)
<< " frame-stack: " << m_frame_stack.size()
<< " result-stack: " << m_result_stack.size() << "\n";);
@ -843,11 +843,11 @@ struct goal2sat::imp : public sat::sat_internalizer {
unsigned sz = m_result_stack.size();
(void)sz;
SASSERT(n->get_ref_count() > 0);
TRACE("goal2sat", tout << "internalize " << mk_bounded_pp(n, m, 2) << "\n";);
TRACE(goal2sat, tout << "internalize " << mk_bounded_pp(n, m, 2) << "\n";);
process(n, false);
SASSERT(m_result_stack.size() == sz + 1);
sat::literal result = m_result_stack.back();
TRACE("goal2sat", tout << "done internalize " << result << " " << mk_bounded_pp(n, m, 2) << "\n";);
TRACE(goal2sat, tout << "done internalize " << result << " " << mk_bounded_pp(n, m, 2) << "\n";);
m_result_stack.pop_back();
if (!result.sign() && m_map.to_bool_var(n) == sat::null_bool_var) {
force_push();
@ -889,9 +889,9 @@ struct goal2sat::imp : public sat::sat_internalizer {
void process(expr * n) {
flet<bool> _top(m_top_level, true);
VERIFY(m_result_stack.empty());
TRACE("goal2sat", tout << "assert: " << mk_bounded_pp(n, m, 3) << "\n";);
TRACE(goal2sat, tout << "assert: " << mk_bounded_pp(n, m, 3) << "\n";);
process(n, true);
CTRACE("goal2sat", !m_result_stack.empty(), tout << m_result_stack << "\n";);
CTRACE(goal2sat, !m_result_stack.empty(), tout << m_result_stack << "\n";);
SASSERT(m_result_stack.empty());
}
@ -980,7 +980,7 @@ struct goal2sat::imp : public sat::sat_internalizer {
}
f = m.mk_or(fmls);
}
TRACE("goal2sat", tout << mk_bounded_pp(f, m, 2) << "\n";);
TRACE(goal2sat, tout << mk_bounded_pp(f, m, 2) << "\n";);
process(f);
skip_dep:
;

View file

@ -140,9 +140,9 @@ void sat2goal::mc::operator()(sat::model& md) {
void sat2goal::mc::operator()(model_ref & md) {
// apply externalized model converter
CTRACE("sat_mc", m_gmc, m_gmc->display(tout << "before sat_mc\n"); model_v2_pp(tout, *md););
CTRACE(sat_mc, m_gmc, m_gmc->display(tout << "before sat_mc\n"); model_v2_pp(tout, *md););
if (m_gmc) (*m_gmc)(md);
CTRACE("sat_mc", m_gmc, m_gmc->display(tout << "after sat_mc\n"); model_v2_pp(tout, *md););
CTRACE(sat_mc, m_gmc, m_gmc->display(tout << "after sat_mc\n"); model_v2_pp(tout, *md););
}
@ -161,7 +161,7 @@ void sat2goal::mc::insert(sat::bool_var v, expr * atom, bool aux) {
if (is_uninterp_const(atom))
m_gmc->hide(to_app(atom)->get_decl());
}
TRACE("sat_mc", tout << "insert " << v << "\n";);
TRACE(sat_mc, tout << "insert " << v << "\n";);
}
expr_ref sat2goal::mc::lit2expr(sat::literal l) {

View file

@ -60,13 +60,13 @@ class sat_tactic : public tactic {
fail_if_proof_generation("sat", g);
bool produce_models = g->models_enabled();
bool produce_core = g->unsat_core_enabled();
TRACE("before_sat_solver", g->display(tout););
TRACE(before_sat_solver, g->display(tout););
g->elim_redundancies();
atom2bool_var map(m);
obj_map<expr, sat::literal> dep2asm;
sat::literal_vector assumptions;
m_goal2sat(*g, m_params, *m_solver, map, dep2asm);
TRACE("sat", tout << "interpreted_atoms: " << m_goal2sat.has_interpreted_funs() << "\n";
TRACE(sat, tout << "interpreted_atoms: " << m_goal2sat.has_interpreted_funs() << "\n";
func_decl_ref_vector funs(m);
m_goal2sat.get_interpreted_funs(funs);
for (func_decl* f : funs)
@ -85,10 +85,10 @@ class sat_tactic : public tactic {
CASSERT("sat_solver", m_solver->check_invariant());
IF_VERBOSE(TACTIC_VERBOSITY_LVL, m_solver->display_status(verbose_stream()););
TRACE("sat_dimacs", m_solver->display_dimacs(tout););
TRACE(sat_dimacs, m_solver->display_dimacs(tout););
dep2assumptions(dep2asm, assumptions);
lbool r = m_solver->check(assumptions.size(), assumptions.data());
TRACE("sat", tout << "result of checking: " << r << " ";
TRACE(sat, tout << "result of checking: " << r << " ";
if (r == l_undef) tout << m_solver->get_reason_unknown(); tout << "\n";
if (m_goal2sat.has_interpreted_funs()) tout << "has interpreted\n";);
if (r == l_undef)
@ -112,7 +112,7 @@ class sat_tactic : public tactic {
if (produce_models) {
model_ref md = alloc(model, m);
sat::model const & ll_m = m_solver->get_model();
TRACE("sat_tactic", for (unsigned i = 0; i < ll_m.size(); i++) tout << i << ":" << ll_m[i] << " "; tout << "\n";);
TRACE(sat_tactic, for (unsigned i = 0; i < ll_m.size(); i++) tout << i << ":" << ll_m[i] << " "; tout << "\n";);
for (auto const& kv : map) {
expr * n = kv.m_key;
sat::bool_var v = kv.m_value;
@ -121,7 +121,7 @@ class sat_tactic : public tactic {
app* a = to_app(n);
if (!is_uninterp_const(a))
continue;
TRACE("sat_tactic", tout << "extracting value of " << mk_ismt2_pp(n, m) << "\nvar: " << v << "\n";);
TRACE(sat_tactic, tout << "extracting value of " << mk_ismt2_pp(n, m) << "\nvar: " << v << "\n";);
switch (sat::value_at(v, ll_m)) {
case l_true:
md->register_decl(a->get_decl(), m.mk_true());
@ -141,7 +141,7 @@ class sat_tactic : public tactic {
IF_VERBOSE(0, verbose_stream() << "failed to validate: " << mk_pp(f, m) << "\n";);
m_goal2sat.update_model(md);
TRACE("sat_tactic", model_v2_pp(tout, *md););
TRACE(sat_tactic, model_v2_pp(tout, *md););
g->add(model2model_converter(md.get()));
}
}
@ -248,10 +248,10 @@ public:
catch (z3_exception& ex) {
(void)ex;
proc.m_solver->collect_statistics(m_stats);
TRACE("sat", tout << ex.what() << "\n";);
TRACE(sat, tout << ex.what() << "\n";);
throw;
}
TRACE("sat_stats", m_stats.display_smt2(tout););
TRACE(sat_stats, m_stats.display_smt2(tout););
}
void cleanup() override {