mirror of
https://github.com/Z3Prover/z3
synced 2025-10-07 00:11:55 +00:00
Centralize and document TRACE tags using X-macros (#7657)
* Introduce X-macro-based trace tag definition - Created trace_tags.def to centralize TRACE tag definitions - Each tag includes a symbolic name and description - Set up enum class TraceTag for type-safe usage in TRACE macros * Add script to generate Markdown documentation from trace_tags.def - Python script parses trace_tags.def and outputs trace_tags.md * Refactor TRACE_NEW to prepend TraceTag and pass enum to is_trace_enabled * trace: improve trace tag handling system with hierarchical tagging - Introduce hierarchical tag-class structure: enabling a tag class activates all child tags - Unify TRACE, STRACE, SCTRACE, and CTRACE under enum TraceTag - Implement initial version of trace_tag.def using X(tag, tag_class, description) (class names and descriptions to be refined in a future update) * trace: replace all string-based TRACE tags with enum TraceTag - Migrated all TRACE, STRACE, SCTRACE, and CTRACE macros to use enum TraceTag values instead of raw string literals * trace : add cstring header * trace : Add Markdown documentation generation from trace_tags.def via mk_api_doc.py * trace : rename macro parameter 'class' to 'tag_class' and remove Unicode comment in trace_tags.h. * trace : Add TODO comment for future implementation of tag_class activation * trace : Disable code related to tag_class until implementation is ready (#7663).
This commit is contained in:
parent
d766292dab
commit
0a93ff515d
583 changed files with 8698 additions and 7299 deletions
|
@ -160,7 +160,7 @@ namespace qel {
|
|||
case AST_VAR:
|
||||
vidx = to_var(t)->get_idx();
|
||||
if (fr.second == 0) {
|
||||
CTRACE("der_bug", vidx >= definitions.size(), tout << "vidx: " << vidx << "\n";);
|
||||
CTRACE(der_bug, vidx >= definitions.size(), tout << "vidx: " << vidx << "\n";);
|
||||
// Remark: The size of definitions may be smaller than the number of variables occurring in the quantified formula.
|
||||
if (definitions.get(vidx, nullptr) != nullptr) {
|
||||
if (visiting.is_marked(t)) {
|
||||
|
@ -264,7 +264,7 @@ namespace qel {
|
|||
}
|
||||
vs.push_back(to_var(lhs));
|
||||
ts.push_back(rhs);
|
||||
TRACE("qe_lite", tout << mk_pp(eq, m) << "\n";);
|
||||
TRACE(qe_lite, tout << mk_pp(eq, m) << "\n";);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ namespace qel {
|
|||
|
||||
bool is_var_eq(expr * e, ptr_vector<var>& vs, expr_ref_vector & ts) {
|
||||
expr* lhs = nullptr, *rhs = nullptr;
|
||||
TRACE("qe_lite", tout << mk_pp(e, m) << "\n";);
|
||||
TRACE(qe_lite, tout << mk_pp(e, m) << "\n";);
|
||||
|
||||
// (= VAR t), (iff VAR t), (iff (not VAR) t), (iff t (not VAR)) cases
|
||||
if (m.is_eq(e, lhs, rhs) && trivial_solve(lhs, rhs, e, vs, ts)) {
|
||||
|
@ -303,7 +303,7 @@ namespace qel {
|
|||
if (res != e && m.is_eq(res, lhs, rhs) && is_variable(lhs)) {
|
||||
vs.push_back(to_var(lhs));
|
||||
ts.push_back(rhs);
|
||||
TRACE("qe_lite", tout << res << "\n";);
|
||||
TRACE(qe_lite, tout << res << "\n";);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ namespace qel {
|
|||
}
|
||||
|
||||
void get_elimination_order() {
|
||||
TRACE("top_sort",
|
||||
TRACE(top_sort,
|
||||
tout << "DEFINITIONS: " << std::endl;
|
||||
for(unsigned i = 0; i < m_map.size(); i++)
|
||||
if(m_map[i]) tout << "VAR " << i << " = " << mk_pp(m_map[i], m) << std::endl;
|
||||
|
@ -329,7 +329,7 @@ namespace qel {
|
|||
|
||||
der_sort_vars(m_inx2var, m_map, m_order);
|
||||
|
||||
TRACE("qe_lite",
|
||||
TRACE(qe_lite,
|
||||
tout << "Elimination m_order:" << std::endl;
|
||||
tout << m_order << std::endl;
|
||||
);
|
||||
|
@ -346,8 +346,8 @@ namespace qel {
|
|||
expr_ref r(m);
|
||||
if (is_ground(cur)) r = cur; else m_subst(cur, r);
|
||||
unsigned inx = sz - idx - 1;
|
||||
TRACE("qe_lite", tout << idx << " |-> " << r << "\n";);
|
||||
CTRACE("top_sort", m_subst_map.get(inx) != nullptr,
|
||||
TRACE(qe_lite, tout << idx << " |-> " << r << "\n";);
|
||||
CTRACE(top_sort, m_subst_map.get(inx) != nullptr,
|
||||
tout << "inx is " << inx << "\n"
|
||||
<< "idx is " << idx << "\n"
|
||||
<< "sz is " << sz << "\n"
|
||||
|
@ -401,7 +401,7 @@ namespace qel {
|
|||
break;
|
||||
}
|
||||
expr_ref new_e = m_subst(t, m_subst_map.size(), m_subst_map.data());
|
||||
TRACE("qe_lite", tout << new_e << "\n";);
|
||||
TRACE(qe_lite, tout << new_e << "\n";);
|
||||
|
||||
// don't forget to update the quantifier patterns
|
||||
expr_ref_buffer new_patterns(m);
|
||||
|
@ -451,7 +451,7 @@ namespace qel {
|
|||
}
|
||||
}
|
||||
else {
|
||||
TRACE("der_bug", tout << "Did not find any diseq\n" << mk_pp(q, m) << "\n";);
|
||||
TRACE(der_bug, tout << "Did not find any diseq\n" << mk_pp(q, m) << "\n";);
|
||||
r = q;
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ namespace qel {
|
|||
m_map[idx] = t;
|
||||
m_new_exprs.push_back(std::move(t));
|
||||
}
|
||||
TRACE ("qe_def",
|
||||
TRACE(qe_def,
|
||||
tout << "Replacing definition of VAR " << idx << " from "
|
||||
<< mk_pp(old_def, m) << " to " << mk_pp(t, m)
|
||||
<< " inferred from: " << mk_pp(args[i], m) << "\n";);
|
||||
|
@ -548,7 +548,7 @@ namespace qel {
|
|||
}
|
||||
|
||||
void flatten_definitions(expr_ref_vector& conjs) {
|
||||
TRACE("qe_lite",
|
||||
TRACE(qe_lite,
|
||||
expr_ref tmp(m);
|
||||
tmp = m.mk_and(conjs.size(), conjs.data());
|
||||
tout << mk_pp(tmp, m) << "\n";);
|
||||
|
@ -584,7 +584,7 @@ namespace qel {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
TRACE("qe_lite",
|
||||
TRACE(qe_lite,
|
||||
expr_ref tmp(m);
|
||||
tmp = m.mk_and(conjs.size(), conjs.data());
|
||||
tout << "after flatten\n" << mk_pp(tmp, m) << "\n";);
|
||||
|
@ -633,7 +633,7 @@ namespace qel {
|
|||
change = false;
|
||||
for (unsigned i = 0; i < conjs.size(); ++i) {
|
||||
if (m.is_not(conjs[i].get(), ne) && m.is_eq(ne, l, r)) {
|
||||
TRACE("qe_lite", tout << mk_pp(conjs[i].get(), m) << " " << is_variable(l) << " " << is_variable(r) << "\n";);
|
||||
TRACE(qe_lite, tout << mk_pp(conjs[i].get(), m) << " " << is_variable(l) << " " << is_variable(r) << "\n";);
|
||||
if (is_variable(l) && ::is_var(l) && is_unconstrained(::to_var(l), r, i, conjs)) {
|
||||
conjs[i] = m.mk_true();
|
||||
reduced = true;
|
||||
|
@ -710,7 +710,7 @@ namespace qel {
|
|||
}
|
||||
|
||||
void operator()(quantifier * q, expr_ref & r, proof_ref & pr) {
|
||||
TRACE("qe_lite", tout << mk_pp(q, m) << "\n";);
|
||||
TRACE(qe_lite, tout << mk_pp(q, m) << "\n";);
|
||||
pr = nullptr;
|
||||
r = q;
|
||||
reduce_quantifier(q, r, pr);
|
||||
|
@ -808,7 +808,7 @@ namespace qel {
|
|||
expr_safe_replace rep(m);
|
||||
rep.insert(A, B);
|
||||
expr_ref tmp(m);
|
||||
TRACE("qe_lite",
|
||||
TRACE(qe_lite,
|
||||
tout << mk_pp(e1, m) << " = " << mk_pp(e2, m) << "\n";);
|
||||
for (unsigned j = 0; j < conjs.size(); ++j) {
|
||||
if (i == j) {
|
||||
|
@ -1099,7 +1099,7 @@ namespace fm {
|
|||
if (m_util.is_le(t, lhs, rhs) || m_util.is_ge(t, lhs, rhs)) {
|
||||
result = m_util.is_numeral(rhs) && is_linear_pol(lhs);
|
||||
}
|
||||
TRACE("qe_lite", tout << mk_pp(t, m) << " " << (result?"true":"false") << "\n";);
|
||||
TRACE(qe_lite, tout << mk_pp(t, m) << " " << (result?"true":"false") << "\n";);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1171,7 +1171,7 @@ namespace fm {
|
|||
cnstr->m_xs = reinterpret_cast<var*>(mem_xs);
|
||||
cnstr->m_as = reinterpret_cast<rational*>(mem_as);
|
||||
for (unsigned i = 0; i < num_vars; i++) {
|
||||
TRACE("qe_lite", tout << "xs[" << i << "]: " << xs[i] << "\n";);
|
||||
TRACE(qe_lite, tout << "xs[" << i << "]: " << xs[i] << "\n";);
|
||||
cnstr->m_xs[i] = xs[i];
|
||||
new (cnstr->m_as + i) rational(as[i]);
|
||||
}
|
||||
|
@ -1363,7 +1363,7 @@ namespace fm {
|
|||
if (c2->m_dead)
|
||||
continue;
|
||||
if (subsumes(c, *c2)) {
|
||||
TRACE("qe_lite", display(tout, c); tout << "\nsubsumed:\n"; display(tout, *c2); tout << "\n";);
|
||||
TRACE(qe_lite, display(tout, c); tout << "\nsubsumed:\n"; display(tout, *c2); tout << "\n";);
|
||||
c2->m_dead = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -1439,10 +1439,10 @@ namespace fm {
|
|||
for (unsigned i = 0; i < sz; i++) {
|
||||
expr * f = g[i];
|
||||
if (is_occ(f)) {
|
||||
TRACE("qe_lite", tout << "OCC: " << mk_ismt2_pp(f, m) << "\n";);
|
||||
TRACE(qe_lite, tout << "OCC: " << mk_ismt2_pp(f, m) << "\n";);
|
||||
continue;
|
||||
}
|
||||
TRACE("qe_lite", tout << "not OCC:\n" << mk_ismt2_pp(f, m) << "\n";);
|
||||
TRACE(qe_lite, tout << "not OCC:\n" << mk_ismt2_pp(f, m) << "\n";);
|
||||
quick_for_each_expr(proc, visited, f);
|
||||
}
|
||||
}
|
||||
|
@ -1571,7 +1571,7 @@ namespace fm {
|
|||
SASSERT(m_uppers.size() == m_is_int.size());
|
||||
SASSERT(m_forbidden.size() == m_is_int.size());
|
||||
SASSERT(m_var2pos.size() == m_is_int.size());
|
||||
TRACE("qe_lite", tout << mk_pp(t,m) << " |-> " << x << " forbidden: " << forbidden << "\n";);
|
||||
TRACE(qe_lite, tout << mk_pp(t,m) << " |-> " << x << " forbidden: " << forbidden << "\n";);
|
||||
return x;
|
||||
}
|
||||
|
||||
|
@ -1593,7 +1593,7 @@ namespace fm {
|
|||
x = mk_var(t);
|
||||
SASSERT(m_expr2var.contains(t));
|
||||
SASSERT(m_var2expr.get(x) == t);
|
||||
TRACE("qe_lite", tout << mk_ismt2_pp(t, m) << " --> " << x << "\n";);
|
||||
TRACE(qe_lite, tout << mk_ismt2_pp(t, m) << " --> " << x << "\n";);
|
||||
return x;
|
||||
}
|
||||
|
||||
|
@ -1613,7 +1613,7 @@ namespace fm {
|
|||
|
||||
|
||||
void add_constraint(expr * f, expr_dependency * dep) {
|
||||
TRACE("qe_lite", tout << mk_pp(f, m) << "\n";);
|
||||
TRACE(qe_lite, tout << mk_pp(f, m) << "\n";);
|
||||
SASSERT(!m.is_or(f) || m_fm_occ);
|
||||
sbuffer<literal> lits;
|
||||
sbuffer<var> xs;
|
||||
|
@ -1693,7 +1693,7 @@ namespace fm {
|
|||
}
|
||||
}
|
||||
|
||||
TRACE("qe_lite", tout << "before mk_constraint: "; for (unsigned i = 0; i < xs.size(); i++) tout << " " << xs[i]; tout << "\n";);
|
||||
TRACE(qe_lite, tout << "before mk_constraint: "; for (unsigned i = 0; i < xs.size(); i++) tout << " " << xs[i]; tout << "\n";);
|
||||
|
||||
constraint * new_c = mk_constraint(lits.size(),
|
||||
lits.data(),
|
||||
|
@ -1704,7 +1704,7 @@ namespace fm {
|
|||
strict,
|
||||
dep);
|
||||
|
||||
TRACE("qe_lite", tout << "add_constraint: "; display(tout, *new_c); tout << "\n";);
|
||||
TRACE(qe_lite, tout << "add_constraint: "; display(tout, *new_c); tout << "\n";);
|
||||
VERIFY(register_constraint(new_c));
|
||||
}
|
||||
|
||||
|
@ -1717,7 +1717,7 @@ namespace fm {
|
|||
if (is_false(*c)) {
|
||||
del_constraint(c);
|
||||
m_inconsistent = true;
|
||||
TRACE("qe_lite", tout << "is false "; display(tout, *c); tout << "\n";);
|
||||
TRACE(qe_lite, tout << "is false "; display(tout, *c); tout << "\n";);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1740,7 +1740,7 @@ namespace fm {
|
|||
return true;
|
||||
}
|
||||
else {
|
||||
TRACE("qe_lite", tout << "all variables are forbidden "; display(tout, *c); tout << "\n";);
|
||||
TRACE(qe_lite, tout << "all variables are forbidden "; display(tout, *c); tout << "\n";);
|
||||
m_new_fmls.push_back(to_expr(*c));
|
||||
del_constraint(c);
|
||||
return false;
|
||||
|
@ -1794,7 +1794,7 @@ namespace fm {
|
|||
}
|
||||
// x_cost_lt is not a total order on variables
|
||||
std::stable_sort(x_cost_vector.begin(), x_cost_vector.end(), x_cost_lt(m_is_int));
|
||||
TRACE("qe_lite",
|
||||
TRACE(qe_lite,
|
||||
for (auto const& kv : x_cost_vector) {
|
||||
tout << "(" << mk_ismt2_pp(m_var2expr.get(kv.first), m) << " " << kv.second << ") ";
|
||||
}
|
||||
|
@ -1970,7 +1970,7 @@ namespace fm {
|
|||
|
||||
if (new_xs.empty() && (new_c.is_pos() || (!new_strict && new_c.is_zero()))) {
|
||||
// literal is true
|
||||
TRACE("qe_lite", tout << "resolution " << x << " consequent literal is always true: \n";
|
||||
TRACE(qe_lite, tout << "resolution " << x << " consequent literal is always true: \n";
|
||||
display(tout, l);
|
||||
tout << "\n";
|
||||
display(tout, u); tout << "\n";);
|
||||
|
@ -2014,7 +2014,7 @@ namespace fm {
|
|||
}
|
||||
|
||||
if (tautology) {
|
||||
TRACE("qe_lite", tout << "resolution " << x << " tautology: \n";
|
||||
TRACE(qe_lite, tout << "resolution " << x << " tautology: \n";
|
||||
display(tout, l);
|
||||
tout << "\n";
|
||||
display(tout, u); tout << "\n";);
|
||||
|
@ -2024,7 +2024,7 @@ namespace fm {
|
|||
expr_dependency * new_dep = m.mk_join(l.m_dep, u.m_dep);
|
||||
|
||||
if (new_lits.empty() && new_xs.empty() && (new_c.is_neg() || (new_strict && new_c.is_zero()))) {
|
||||
TRACE("qe_lite", tout << "resolution " << x << " inconsistent: \n";
|
||||
TRACE(qe_lite, tout << "resolution " << x << " inconsistent: \n";
|
||||
display(tout, l);
|
||||
tout << "\n";
|
||||
display(tout, u); tout << "\n";);
|
||||
|
@ -2042,7 +2042,7 @@ namespace fm {
|
|||
new_strict,
|
||||
new_dep);
|
||||
|
||||
TRACE("qe_lite", tout << "resolution " << x << "\n";
|
||||
TRACE(qe_lite, tout << "resolution " << x << "\n";
|
||||
display(tout, l);
|
||||
tout << "\n";
|
||||
display(tout, u);
|
||||
|
@ -2065,7 +2065,7 @@ namespace fm {
|
|||
if (l.empty() || u.empty()) {
|
||||
// easy case
|
||||
mark_constraints_dead(x);
|
||||
TRACE("qe_lite", tout << "variable was eliminated (trivial case)\n";);
|
||||
TRACE(qe_lite, tout << "variable was eliminated (trivial case)\n";);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2083,7 +2083,7 @@ namespace fm {
|
|||
|
||||
m_counter += num_lowers * num_uppers;
|
||||
|
||||
TRACE("qe_lite", tout << "eliminating " << mk_ismt2_pp(m_var2expr.get(x), m) << "\nlowers:\n";
|
||||
TRACE(qe_lite, tout << "eliminating " << mk_ismt2_pp(m_var2expr.get(x), m) << "\nlowers:\n";
|
||||
display_constraints(tout, l); tout << "uppers:\n"; display_constraints(tout, u););
|
||||
|
||||
unsigned num_old_cnstrs = num_uppers + num_lowers;
|
||||
|
@ -2093,7 +2093,7 @@ namespace fm {
|
|||
for (unsigned i = 0; i < num_lowers; i++) {
|
||||
for (unsigned j = 0; j < num_uppers; j++) {
|
||||
if (m_inconsistent || num_new_cnstrs > limit) {
|
||||
TRACE("qe_lite", tout << "too many new constraints: " << num_new_cnstrs << "\n";);
|
||||
TRACE(qe_lite, tout << "too many new constraints: " << num_new_cnstrs << "\n";);
|
||||
del_constraints(new_constraints.size(), new_constraints.data());
|
||||
return false;
|
||||
}
|
||||
|
@ -2118,7 +2118,7 @@ namespace fm {
|
|||
backward_subsumption(*c);
|
||||
register_constraint(c);
|
||||
}
|
||||
TRACE("qe_lite", tout << "variables was eliminated old: " << num_old_cnstrs << " new_constraints: " << sz << "\n";);
|
||||
TRACE(qe_lite, tout << "variables was eliminated old: " << num_old_cnstrs << " new_constraints: " << sz << "\n";);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2128,7 +2128,7 @@ namespace fm {
|
|||
if (!c->m_dead) {
|
||||
c->m_dead = true;
|
||||
expr * new_f = to_expr(*c);
|
||||
TRACE("qe_lite", tout << "asserting...\n" << mk_ismt2_pp(new_f, m) << "\nnew_dep: " << c->m_dep << "\n";);
|
||||
TRACE(qe_lite, tout << "asserting...\n" << mk_ismt2_pp(new_f, m) << "\nnew_dep: " << c->m_dep << "\n";);
|
||||
m_new_fmls.push_back(new_f);
|
||||
}
|
||||
}
|
||||
|
@ -2160,7 +2160,7 @@ namespace fm {
|
|||
m_new_fmls.push_back(m.mk_false());
|
||||
}
|
||||
else {
|
||||
TRACE("qe_lite", display(tout););
|
||||
TRACE(qe_lite, display(tout););
|
||||
|
||||
subsume();
|
||||
var_vector candidates;
|
||||
|
@ -2369,7 +2369,7 @@ public:
|
|||
fmls[index] = fml;
|
||||
return;
|
||||
}
|
||||
TRACE("qe_lite", tout << fmls << "\n";);
|
||||
TRACE(qe_lite, tout << fmls << "\n";);
|
||||
is_variable_test is_var(index_set, index_of_bound);
|
||||
m_der.set_is_variable_proc(is_var);
|
||||
m_fm.set_is_variable_proc(is_var);
|
||||
|
@ -2378,7 +2378,7 @@ public:
|
|||
m_fm(fmls);
|
||||
// AG: disable m_array_der() since it interferes with other array handling
|
||||
if (m_use_array_der) m_array_der(fmls);
|
||||
TRACE("qe_lite", for (unsigned i = 0; i < fmls.size(); ++i) tout << mk_pp(fmls[i].get(), m) << "\n";);
|
||||
TRACE(qe_lite, for (unsigned i = 0; i < fmls.size(); ++i) tout << mk_pp(fmls[i].get(), m) << "\n";);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace mbp {
|
|||
expr* e1, * e2;
|
||||
DEBUG_CODE(expr_ref val(m);
|
||||
eval(lit, val);
|
||||
CTRACE("qe", !m.is_true(val), tout << mk_pp(lit, m) << " := " << val << "\n";);
|
||||
CTRACE(qe, !m.is_true(val), tout << mk_pp(lit, m) << " := " << val << "\n";);
|
||||
if (m.is_false(val))
|
||||
return false;
|
||||
SASSERT(m.limit().is_canceled() || !m.is_false(val)););
|
||||
|
@ -72,7 +72,7 @@ namespace mbp {
|
|||
if (!m.inc())
|
||||
return false;
|
||||
|
||||
TRACE("opt", tout << mk_pp(lit, m) << " " << a.is_lt(lit) << " " << a.is_gt(lit) << "\n";);
|
||||
TRACE(opt, tout << mk_pp(lit, m) << " " << a.is_lt(lit) << " " << a.is_gt(lit) << "\n";);
|
||||
bool is_not = m.is_not(lit, lit);
|
||||
if (is_not) {
|
||||
mul.neg();
|
||||
|
@ -115,7 +115,7 @@ namespace mbp {
|
|||
vector<std::pair<expr*, rational> > nums;
|
||||
for (expr* arg : *alit) {
|
||||
val = eval(arg);
|
||||
TRACE("qe", tout << mk_pp(arg, m) << " " << val << "\n";);
|
||||
TRACE(qe, tout << mk_pp(arg, m) << " " << val << "\n";);
|
||||
if (!a.is_numeral(val, r)) return false;
|
||||
nums.push_back(std::make_pair(arg, r));
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ namespace mbp {
|
|||
expr* arg1 = to_app(lit)->get_arg(i), * arg2 = nullptr;
|
||||
rational r;
|
||||
expr_ref val = eval(arg1);
|
||||
TRACE("qe", tout << mk_pp(arg1, m) << " " << val << "\n";);
|
||||
TRACE(qe, tout << mk_pp(arg1, m) << " " << val << "\n";);
|
||||
if (!a.is_numeral(val, r)) return false;
|
||||
if (values.find(r, arg2)) {
|
||||
ty = opt::t_eq;
|
||||
|
@ -168,7 +168,7 @@ namespace mbp {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
TRACE("qe", tout << "Skipping " << mk_pp(lit, m) << "\n";);
|
||||
TRACE(qe, tout << "Skipping " << mk_pp(lit, m) << "\n";);
|
||||
return false;
|
||||
}
|
||||
else if (m.is_and(lit) && is_not) {
|
||||
|
@ -178,11 +178,11 @@ namespace mbp {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
TRACE("qe", tout << "Skipping " << mk_pp(lit, m) << "\n";);
|
||||
TRACE(qe, tout << "Skipping " << mk_pp(lit, m) << "\n";);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
TRACE("qe", tout << "Skipping " << mk_pp(lit, m) << "\n";);
|
||||
TRACE(qe, tout << "Skipping " << mk_pp(lit, m) << "\n";);
|
||||
return false;
|
||||
}
|
||||
vars coeffs;
|
||||
|
@ -230,7 +230,7 @@ namespace mbp {
|
|||
|
||||
else if (m.is_ite(t, t1, t2, t3)) {
|
||||
val = eval(t1);
|
||||
TRACE("qe", tout << mk_pp(t1, m) << " := " << val << "\n";);
|
||||
TRACE(qe, tout << mk_pp(t1, m) << " := " << val << "\n";);
|
||||
if (m.is_true(val)) {
|
||||
linearize(mbo, eval, mul, t2, c, fmls, ts, tids);
|
||||
fmls.push_back(t1);
|
||||
|
@ -275,7 +275,7 @@ namespace mbp {
|
|||
mbo.add_divides(coeffs, c0, mul1);
|
||||
}
|
||||
else {
|
||||
TRACE("qe", tout << "insert mul " << mk_pp(t, m) << "\n");
|
||||
TRACE(qe, tout << "insert mul " << mk_pp(t, m) << "\n");
|
||||
insert_mul(t, mul, ts);
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ namespace mbp {
|
|||
if (!has_arith)
|
||||
return true;
|
||||
model_evaluator eval(model);
|
||||
TRACE("qe", tout << model;);
|
||||
TRACE(qe, tout << model;);
|
||||
eval.set_model_completion(true);
|
||||
model.set_inline();
|
||||
compute_def |= m_apply_projection;
|
||||
|
@ -333,12 +333,12 @@ namespace mbp {
|
|||
obj_map<expr, unsigned> tids;
|
||||
expr_ref_vector pinned(m);
|
||||
unsigned j = 0;
|
||||
TRACE("qe", tout << "vars: " << vars << "\n";
|
||||
TRACE(qe, tout << "vars: " << vars << "\n";
|
||||
for (expr* f : fmls) tout << mk_pp(f, m) << " := " << model(f) << "\n";);
|
||||
for (unsigned i = 0; i < fmls.size(); ++i) {
|
||||
expr* fml = fmls.get(i);
|
||||
if (!linearize(mbo, eval, fml, fmls, tids)) {
|
||||
TRACE("qe", tout << "could not linearize: " << mk_pp(fml, m) << "\n";);
|
||||
TRACE(qe, tout << "could not linearize: " << mk_pp(fml, m) << "\n";);
|
||||
fmls[j++] = fml;
|
||||
}
|
||||
else {
|
||||
|
@ -346,7 +346,7 @@ namespace mbp {
|
|||
}
|
||||
}
|
||||
fmls.shrink(j);
|
||||
TRACE("qe", tout << "formulas\n" << fmls << "\n";
|
||||
TRACE(qe, tout << "formulas\n" << fmls << "\n";
|
||||
for (auto const& [e, id] : tids)
|
||||
tout << mk_pp(e, m) << " -> " << id << "\n";);
|
||||
|
||||
|
@ -370,7 +370,7 @@ namespace mbp {
|
|||
IF_VERBOSE(1, verbose_stream() << "mbp failed on " << mk_pp(v, m) << " := " << val << "\n");
|
||||
throw default_exception("evaluation did not produce a numeral");
|
||||
}
|
||||
TRACE("qe", tout << mk_pp(v, m) << " " << val << "\n";);
|
||||
TRACE(qe, tout << mk_pp(v, m) << " " << val << "\n";);
|
||||
tids.insert(v, mbo.add_var(r, a.is_int(v)));
|
||||
}
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ namespace mbp {
|
|||
}
|
||||
vars.shrink(j);
|
||||
|
||||
TRACE("qe", tout << "remaining vars: " << vars << "\n";
|
||||
TRACE(qe, tout << "remaining vars: " << vars << "\n";
|
||||
for (unsigned v : real_vars) tout << "v" << v << " " << mk_pp(index2expr[v], m) << "\n";
|
||||
mbo.display(tout););
|
||||
vector<opt::model_based_opt::def_ref> defs = mbo.project(real_vars.size(), real_vars.data(), compute_def);
|
||||
|
@ -430,7 +430,7 @@ namespace mbp {
|
|||
def_vars.insert(r.m_id, r);
|
||||
}
|
||||
rows2fmls(def_vars, rows, index2expr, fmls);
|
||||
TRACE("qe", mbo.display(tout << "mbo result\n");
|
||||
TRACE(qe, mbo.display(tout << "mbo result\n");
|
||||
for (auto const& d : defs) if (d) tout << "def: " << *d << "\n";
|
||||
tout << fmls << "\n";);
|
||||
|
||||
|
@ -439,7 +439,7 @@ namespace mbp {
|
|||
if (m_apply_projection && !apply_projection(eval, result, fmls))
|
||||
return false;
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
for (auto const& [v, t] : result)
|
||||
tout << v << " := " << t << "\n";
|
||||
for (auto* f : fmls)
|
||||
|
@ -629,7 +629,7 @@ namespace mbp {
|
|||
mdl.register_decl(f, val);
|
||||
}
|
||||
else {
|
||||
TRACE("qe", tout << "omitting model update for non-uninterpreted constant " << mk_pp(e, m) << "\n";);
|
||||
TRACE(qe, tout << "omitting model update for non-uninterpreted constant " << mk_pp(e, m) << "\n";);
|
||||
}
|
||||
}
|
||||
expr_ref val(a.mk_numeral(value.get_rational(), false), m);
|
||||
|
@ -660,7 +660,7 @@ namespace mbp {
|
|||
expr_ref val = eval(fml);
|
||||
if (!m.is_true(val)) {
|
||||
valid = false;
|
||||
TRACE("qe", tout << mk_pp(fml, m) << " := " << val << "\n";);
|
||||
TRACE(qe, tout << mk_pp(fml, m) << " := " << val << "\n";);
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
|
@ -676,14 +676,14 @@ namespace mbp {
|
|||
rational r;
|
||||
expr_ref val = eval(v);
|
||||
if (!a.is_numeral(val, r)) {
|
||||
TRACE("qe", tout << eval.get_model() << "\n";);
|
||||
TRACE(qe, tout << eval.get_model() << "\n";);
|
||||
IF_VERBOSE(1, verbose_stream() << "mbp failed on " << mk_pp(v, m) << " := " << val << "\n");
|
||||
throw default_exception("mbp evaluation was only partial");
|
||||
}
|
||||
id = mbo.add_var(r, a.is_int(v));
|
||||
tids.insert(v, id);
|
||||
}
|
||||
CTRACE("qe", kv.m_value.is_zero(), tout << mk_pp(v, m) << " has coefficient 0\n";);
|
||||
CTRACE(qe, kv.m_value.is_zero(), tout << mk_pp(v, m) << " has coefficient 0\n";);
|
||||
if (!kv.m_value.is_zero()) {
|
||||
coeffs.push_back(var(id, kv.m_value));
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace mbp {
|
|||
(m_arr_u.is_store (a) && (a->get_arg (0) == m_v))) {
|
||||
m_has_stores_v.mark (a, true);
|
||||
|
||||
TRACE ("qe",
|
||||
TRACE(qe,
|
||||
tout << "has stores:\n";
|
||||
tout << mk_pp (a, m) << "\n";
|
||||
);
|
||||
|
@ -248,7 +248,7 @@ namespace mbp {
|
|||
app_ref p_exp = mk_peq (eq->get_arg (0), eq->get_arg (1), empty, m);
|
||||
bool subst_eq_found = false;
|
||||
while (true) {
|
||||
TRACE ("qe", tout << "processing peq:\n" << p_exp << "\n";);
|
||||
TRACE(qe, tout << "processing peq:\n" << p_exp << "\n";);
|
||||
|
||||
peq p (p_exp, m);
|
||||
expr_ref lhs = p.lhs(), rhs = p.rhs();
|
||||
|
@ -294,7 +294,7 @@ namespace mbp {
|
|||
}
|
||||
}
|
||||
if (idx_in_I) {
|
||||
TRACE ("qe",
|
||||
TRACE(qe,
|
||||
tout << "store index in diff indices:\n";
|
||||
tout << mk_pp (m_idx_lits_v.back (), m) << "\n";
|
||||
);
|
||||
|
@ -302,7 +302,7 @@ namespace mbp {
|
|||
// arr0 ==I arr1
|
||||
p_exp = mk_peq (arr0, arr1, I, m);
|
||||
|
||||
TRACE ("qe",
|
||||
TRACE(qe,
|
||||
tout << "new peq:\n";
|
||||
tout << mk_pp (p_exp, m) << "\n";
|
||||
);
|
||||
|
@ -313,7 +313,7 @@ namespace mbp {
|
|||
I.push_back (idxs);
|
||||
p_exp = mk_peq (arr0, arr1, I, m);
|
||||
|
||||
TRACE ("qe", tout << "new peq:\n" << p_exp << "\n"; );
|
||||
TRACE(qe, tout << "new peq:\n" << p_exp << "\n"; );
|
||||
|
||||
// arr1[idx] == x
|
||||
ptr_vector<expr> sel_args;
|
||||
|
@ -323,7 +323,7 @@ namespace mbp {
|
|||
expr_ref eq (m.mk_eq (arr1_idx, x), m);
|
||||
m_aux_lits_v.push_back (eq);
|
||||
|
||||
TRACE ("qe",
|
||||
TRACE(qe,
|
||||
tout << "new eq:\n";
|
||||
tout << mk_pp (eq, m) << "\n";
|
||||
);
|
||||
|
@ -334,7 +334,7 @@ namespace mbp {
|
|||
}
|
||||
else if (lhs == m_v || rhs == m_v) {
|
||||
subst_eq_found = true;
|
||||
TRACE ("qe",
|
||||
TRACE(qe,
|
||||
tout << "subst eq found!\n";
|
||||
);
|
||||
break;
|
||||
|
@ -348,7 +348,7 @@ namespace mbp {
|
|||
if (subst_eq_found) {
|
||||
factor_selects (p_exp);
|
||||
|
||||
TRACE ("qe",
|
||||
TRACE(qe,
|
||||
tout << "after factoring selects:\n";
|
||||
tout << mk_pp (p_exp, m) << "\n";
|
||||
for (unsigned i = m_aux_lits_v.size () - m_aux_vars.size (); i < m_aux_lits_v.size (); i++) {
|
||||
|
@ -366,7 +366,7 @@ namespace mbp {
|
|||
convert_peq_to_eq (p_exp, eq, stores_on_rhs);
|
||||
m_subst_term_v = eq->get_arg (1);
|
||||
|
||||
TRACE ("qe",
|
||||
TRACE(qe,
|
||||
tout << "subst term found:\n";
|
||||
tout << mk_pp (m_subst_term_v, m) << "\n";
|
||||
);
|
||||
|
@ -406,7 +406,7 @@ namespace mbp {
|
|||
/* empty */ ;
|
||||
}
|
||||
if (store != m_v) {
|
||||
TRACE("qe", tout << "not a store " << mk_pp(eq, m) << " " << lhs_has_v << " " << rhs_has_v << " " << mk_pp(m_v, m) << "\n";);
|
||||
TRACE(qe, tout << "not a store " << mk_pp(eq, m) << " " << lhs_has_v << " " << rhs_has_v << " " << mk_pp(m_v, m) << "\n";);
|
||||
return UINT_MAX;
|
||||
}
|
||||
return nd;
|
||||
|
@ -428,11 +428,11 @@ namespace mbp {
|
|||
svector<std::pair<unsigned, app*> > true_eqs;
|
||||
|
||||
find_arr_eqs (fml, eqs);
|
||||
TRACE ("qe", tout << "array equalities:\n" << eqs << "\n";);
|
||||
TRACE(qe, tout << "array equalities:\n" << eqs << "\n";);
|
||||
|
||||
// evaluate eqs in M
|
||||
for (app * eq : eqs) {
|
||||
TRACE ("qe", tout << "array equality:\n" << mk_pp (eq, m) << "\n"; );
|
||||
TRACE(qe, tout << "array equality:\n" << mk_pp (eq, m) << "\n"; );
|
||||
|
||||
if (m_mev->is_false(eq)) {
|
||||
m_false_sub_v.insert (eq, m.mk_false());
|
||||
|
@ -506,13 +506,13 @@ namespace mbp {
|
|||
reset_v ();
|
||||
m_v = arr_vars.get (i);
|
||||
if (!m_arr_u.is_array (m_v)) {
|
||||
TRACE ("qe",
|
||||
TRACE(qe,
|
||||
tout << "not an array variable: " << m_v << "\n";
|
||||
);
|
||||
aux_vars.push_back (m_v);
|
||||
continue;
|
||||
}
|
||||
TRACE ("qe", tout << "projecting equalities on variable: " << m_v << "\n"; );
|
||||
TRACE(qe, tout << "projecting equalities on variable: " << m_v << "\n"; );
|
||||
|
||||
if (project (fml)) {
|
||||
mk_result (fml);
|
||||
|
@ -521,11 +521,11 @@ namespace mbp {
|
|||
if (!m_subst_term_v || contains_v (m_subst_term_v)) {
|
||||
arr_vars[j++] = m_v;
|
||||
}
|
||||
TRACE ("qe", tout << "after projection: \n" << fml << "\n";);
|
||||
TRACE(qe, tout << "after projection: \n" << fml << "\n";);
|
||||
}
|
||||
else {
|
||||
IF_VERBOSE(2, verbose_stream() << "can't project:" << m_v << "\n";);
|
||||
TRACE ("qe", tout << "Failed to project: " << m_v << "\n";);
|
||||
TRACE(qe, tout << "Failed to project: " << m_v << "\n";);
|
||||
arr_vars[j++] = m_v;
|
||||
}
|
||||
}
|
||||
|
@ -705,7 +705,7 @@ namespace mbp {
|
|||
fml = mk_and(lits);
|
||||
// simplify all trivial expressions introduced
|
||||
m_rw (fml);
|
||||
TRACE ("qe", tout << "after reducing selects:\n" << fml << "\n";);
|
||||
TRACE(qe, tout << "after reducing selects:\n" << fml << "\n";);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -741,7 +741,7 @@ namespace mbp {
|
|||
}
|
||||
else {
|
||||
IF_VERBOSE(2, verbose_stream() << "can't project arrays:" << "\n";);
|
||||
TRACE ("qe", tout << "Failed to project arrays\n";);
|
||||
TRACE(qe, tout << "Failed to project arrays\n";);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -888,7 +888,7 @@ namespace mbp {
|
|||
for (unsigned i = 0; i < arity && is_numeric; ++i) {
|
||||
sort* srt = get_array_domain(v_sort, i);
|
||||
if (!m_ari_u.is_real(srt) && !m_ari_u.is_int(srt) && !m_bv_u.is_bv_sort(srt)) {
|
||||
TRACE("qe", tout << "non-numeric index sort for Ackerman" << mk_pp(srt, m) << "\n";);
|
||||
TRACE(qe, tout << "non-numeric index sort for Ackerman" << mk_pp(srt, m) << "\n";);
|
||||
is_numeric = false;
|
||||
}
|
||||
}
|
||||
|
@ -973,7 +973,7 @@ namespace mbp {
|
|||
// substitute for sel terms
|
||||
m_sub (fml);
|
||||
|
||||
TRACE ("qe", tout << "after projection of selects:\n" << fml << "\n";);
|
||||
TRACE(qe, tout << "after projection of selects:\n" << fml << "\n";);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -985,10 +985,10 @@ namespace mbp {
|
|||
collect_selects (fml);
|
||||
// model based ackermannization
|
||||
for (auto & kv : m_sel_terms) {
|
||||
TRACE ("qe",tout << "ackermann for var: " << mk_pp (kv.m_key, m) << "\n";);
|
||||
TRACE(qe,tout << "ackermann for var: " << mk_pp (kv.m_key, m) << "\n";);
|
||||
ackermann (*(kv.m_value));
|
||||
}
|
||||
TRACE ("qe", tout << "idx lits:\n" << m_idx_lits; );
|
||||
TRACE(qe, tout << "idx lits:\n" << m_idx_lits; );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1028,7 +1028,7 @@ namespace mbp {
|
|||
}
|
||||
else {
|
||||
IF_VERBOSE(2, verbose_stream() << "can't project arrays:" << "\n";);
|
||||
TRACE ("qe", tout << "Failed to project arrays\n";);
|
||||
TRACE(qe, tout << "Failed to project arrays\n";);
|
||||
}
|
||||
|
||||
// dealloc
|
||||
|
@ -1239,7 +1239,7 @@ namespace mbp {
|
|||
collect_store_expressions(tg, lits);
|
||||
collect_index_expressions(tg, lits);
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "indices\n";
|
||||
for (auto& kv : m_indices) {
|
||||
tout << sort_ref(kv.m_key, m) << " |-> " << *kv.m_value << "\n";
|
||||
|
@ -1253,7 +1253,7 @@ namespace mbp {
|
|||
assert_extensionality(model, tg, lits);
|
||||
assert_store_select(model, tg, lits);
|
||||
|
||||
TRACE("qe", tout << lits << "\n";);
|
||||
TRACE(qe, tout << lits << "\n";);
|
||||
|
||||
for (auto& kv : m_indices) {
|
||||
dealloc(kv.m_value);
|
||||
|
@ -1265,7 +1265,7 @@ namespace mbp {
|
|||
m_indices.reset();
|
||||
m_arrays.reset();
|
||||
|
||||
TRACE("qe", tout << "done: " << lits << "\n";);
|
||||
TRACE(qe, tout << "done: " << lits << "\n";);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1467,7 +1467,7 @@ namespace mbp {
|
|||
ast_manager& m = fml.get_manager();
|
||||
array_project_eqs_util pe (m);
|
||||
pe (mdl, arr_vars, fml, aux_vars);
|
||||
TRACE ("qe",
|
||||
TRACE(qe,
|
||||
tout << "Projected array eqs: " << fml << "\n";
|
||||
tout << "Remaining array vars: " << arr_vars << "\n";
|
||||
tout << "Aux vars: " << aux_vars << "\n";
|
||||
|
@ -1477,13 +1477,13 @@ namespace mbp {
|
|||
array_select_reducer rs (m);
|
||||
rs (mdl, arr_vars, fml, reduce_all_selects);
|
||||
|
||||
TRACE ("qe", tout << "Reduced selects:\n" << fml << "\n"; );
|
||||
TRACE(qe, tout << "Reduced selects:\n" << fml << "\n"; );
|
||||
|
||||
// 3. project selects using model based ackermannization
|
||||
array_project_selects_util ps (m);
|
||||
ps (mdl, arr_vars, fml, aux_vars);
|
||||
|
||||
TRACE ("qe",
|
||||
TRACE(qe,
|
||||
tout << "Projected array selects: " << fml << "\n";
|
||||
tout << "All aux vars: " << aux_vars << "\n";
|
||||
);
|
||||
|
|
|
@ -179,7 +179,7 @@ struct mbp_array_tg::impl {
|
|||
auto js = array_store_indices(to_app(p.lhs()));
|
||||
auto elem = array_store_elem(to_app(p.lhs()));
|
||||
|
||||
TRACE("mbp_tg",
|
||||
TRACE(mbp_tg,
|
||||
tout << "applying elimwreq on " << expr_ref(p.mk_peq(), m) << " is neg: " << is_neg << "\n");
|
||||
vector<expr_ref_vector> indices;
|
||||
bool in = false;
|
||||
|
@ -251,7 +251,7 @@ struct mbp_array_tg::impl {
|
|||
void add_rdVar(expr *rd) {
|
||||
// do not assign new variable if rd is already equal to a value
|
||||
if (m_tg.has_val_in_class(rd)) return;
|
||||
TRACE("mbp_tg", tout << "applying add_rdVar on " << expr_ref(rd, m););
|
||||
TRACE(mbp_tg, tout << "applying add_rdVar on " << expr_ref(rd, m););
|
||||
app_ref u = new_var(to_app(rd)->get_sort(), m);
|
||||
m_new_vars.push_back(u);
|
||||
m_tg.add_var(u);
|
||||
|
@ -262,7 +262,7 @@ struct mbp_array_tg::impl {
|
|||
// given a \peq_{indices} t, where a is a variable, merge equivalence class
|
||||
// of a with store(t, indices, elems) where elems are fresh constants
|
||||
void elimeq(peq p) {
|
||||
TRACE("mbp_tg",
|
||||
TRACE(mbp_tg,
|
||||
tout << "applying elimeq on " << expr_ref(p.mk_peq(), m););
|
||||
app_ref_vector aux_consts(m);
|
||||
expr_ref eq(m);
|
||||
|
@ -283,12 +283,12 @@ struct mbp_array_tg::impl {
|
|||
}
|
||||
m_tg.add_lit(eq);
|
||||
m_tg.add_eq(p.mk_peq(), m.mk_true());
|
||||
TRACE("mbp_tg", tout << "added lit " << eq;);
|
||||
TRACE(mbp_tg, tout << "added lit " << eq;);
|
||||
}
|
||||
|
||||
// rewrite select(store(a, i, k), j) into either select(a, j) or k
|
||||
void elimrdwr(app *term) {
|
||||
TRACE("mbp_tg", tout << "applying elimrdwr on " << expr_ref(term, m););
|
||||
TRACE(mbp_tg, tout << "applying elimrdwr on " << expr_ref(term, m););
|
||||
auto rd_indices = array_select_indices(term);
|
||||
auto store_term = to_app(term->get_arg(0));
|
||||
auto wr_indices = array_store_indices(store_term);
|
||||
|
@ -321,7 +321,7 @@ struct mbp_array_tg::impl {
|
|||
// iterate through all terms in m_tg and apply all array MBP rules once
|
||||
// returns true if any rules were applied
|
||||
bool apply() {
|
||||
TRACE("mbp_tg", tout << "Iterating over terms of tg\n");
|
||||
TRACE(mbp_tg, tout << "Iterating over terms of tg\n");
|
||||
indices.reset();
|
||||
rdTerms.reset();
|
||||
m_new_vars.reset();
|
||||
|
@ -336,7 +336,7 @@ struct mbp_array_tg::impl {
|
|||
continue;
|
||||
if (m_tg.is_cgr(term))
|
||||
continue;
|
||||
TRACE("mbp_tg", tout << "processing " << expr_ref(term, m) << "\n");
|
||||
TRACE(mbp_tg, tout << "processing " << expr_ref(term, m) << "\n");
|
||||
expr* a, *b;
|
||||
if (is_implicit_peq(term, a, b) || is_neg_peq(term, a, b)) {
|
||||
// rewrite array eq as peq
|
||||
|
|
|
@ -64,12 +64,12 @@ struct mbp_basic_tg::impl {
|
|||
expr *c, *th, *el;
|
||||
expr_ref nterm(m);
|
||||
bool progress = false;
|
||||
TRACE("mbp_tg", tout << "Iterating over terms of tg";);
|
||||
TRACE(mbp_tg, tout << "Iterating over terms of tg";);
|
||||
// Not resetting terms because get_terms calls resize on terms
|
||||
m_tg.get_terms(terms, false);
|
||||
for (expr *term : terms) {
|
||||
if (is_seen(term)) continue;
|
||||
TRACE("mbp_tg", tout << "Processing " << expr_ref(term, m) << "\n";);
|
||||
TRACE(mbp_tg, tout << "Processing " << expr_ref(term, m) << "\n";);
|
||||
if (m.is_ite(term, c, th, el) && should_split(c)) {
|
||||
mark_seen(term);
|
||||
progress = true;
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace mbp {
|
|||
bool project1(model& model, app* var, app_ref_vector& vars, expr_ref_vector& lits) {
|
||||
expr_ref val = model(var);
|
||||
SASSERT(is_app(val));
|
||||
TRACE("qe", tout << mk_pp(var, m) << " := " << val << "\n";);
|
||||
TRACE(qe, tout << mk_pp(var, m) << " := " << val << "\n";);
|
||||
m_val = to_app(val);
|
||||
if (!dt.is_constructor(m_val)) {
|
||||
// assert: var does not occur in lits.
|
||||
|
@ -61,7 +61,7 @@ namespace mbp {
|
|||
}
|
||||
}
|
||||
catch (const cant_project &) {
|
||||
TRACE("qe", tout << "can't project:" << mk_pp(var, m) << "\n";);
|
||||
TRACE(qe, tout << "can't project:" << mk_pp(var, m) << "\n";);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -82,7 +82,7 @@ namespace mbp {
|
|||
args.push_back(arg);
|
||||
}
|
||||
val = m.mk_app(f, args.size(), args.data());
|
||||
TRACE("qe", tout << mk_pp(m_var->x(), m) << " |-> " << val << "\n";);
|
||||
TRACE(qe, tout << mk_pp(m_var->x(), m) << " |-> " << val << "\n";);
|
||||
reduce(val, lits);
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ namespace mbp {
|
|||
th_rewriter rw(m);
|
||||
expr_ref tmp(m);
|
||||
sub.insert(m_var->x(), val);
|
||||
TRACE("qe", tout << mk_pp(m_var->x(), m) << " = " << mk_pp(val, m) << "\n";
|
||||
TRACE(qe, tout << mk_pp(m_var->x(), m) << " = " << mk_pp(val, m) << "\n";
|
||||
tout << lits << "\n";);
|
||||
for (unsigned i = 0; i < lits.size(); ++i) {
|
||||
sub(lits[i].get(), tmp);
|
||||
|
@ -211,7 +211,7 @@ namespace mbp {
|
|||
reduced = true;
|
||||
}
|
||||
}
|
||||
CTRACE("qe", reduced, tout << vars << "\n" << lits << "\n";);
|
||||
CTRACE(qe, reduced, tout << vars << "\n" << lits << "\n";);
|
||||
}
|
||||
return reduced;
|
||||
}
|
||||
|
@ -274,10 +274,10 @@ namespace mbp {
|
|||
if (has_v) {
|
||||
has_var.mark(f);
|
||||
}
|
||||
TRACE("qe", tout << "contains: " << mk_pp(f, m) << " " << has_var.is_marked(f) << "\n";);
|
||||
TRACE(qe, tout << "contains: " << mk_pp(f, m) << " " << has_var.is_marked(f) << "\n";);
|
||||
visited.mark(f);
|
||||
}
|
||||
TRACE("qe", tout << "contains: " << mk_pp(e, m) << " " << has_var.is_marked(e) << "\n";);
|
||||
TRACE(qe, tout << "contains: " << mk_pp(e, m) << " " << has_var.is_marked(e) << "\n";);
|
||||
return has_var.is_marked(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ struct mbp_dt_tg::impl {
|
|||
SASSERT(is_app(term) &&
|
||||
m_dt_util.is_accessor(to_app(term)->get_decl()) &&
|
||||
has_var(to_app(term)->get_arg(0)));
|
||||
TRACE("mbp_tg", tout << "applying rm_accessor on " << expr_ref(term, m););
|
||||
TRACE(mbp_tg, tout << "applying rm_accessor on " << expr_ref(term, m););
|
||||
expr *v = to_app(term)->get_arg(0);
|
||||
expr_ref sel(m);
|
||||
app_ref u(m);
|
||||
|
@ -107,7 +107,7 @@ struct mbp_dt_tg::impl {
|
|||
// rewrite cons(v, u) = x with v = head(x) and u = tail(x)
|
||||
// where u or v contain variables
|
||||
void deconstruct_eq(expr *cons, expr *rhs) {
|
||||
TRACE("mbp_tg",
|
||||
TRACE(mbp_tg,
|
||||
tout << "applying deconstruct_eq on " << expr_ref(cons, m););
|
||||
ptr_vector<func_decl> const *accessors =
|
||||
m_dt_util.get_constructor_accessors(to_app(cons)->get_decl());
|
||||
|
@ -125,7 +125,7 @@ struct mbp_dt_tg::impl {
|
|||
// rewrite cons(v, u) != x into one of !cons(x) or v != head(x) or u !=
|
||||
// tail(x) where u or v contain variables
|
||||
void deconstruct_neq(expr *cons, expr *rhs) {
|
||||
TRACE("mbp_tg",
|
||||
TRACE(mbp_tg,
|
||||
tout << "applying deconstruct_neq on " << expr_ref(cons, m););
|
||||
ptr_vector<func_decl> const *accessors =
|
||||
m_dt_util.get_constructor_accessors(to_app(cons)->get_decl());
|
||||
|
@ -153,7 +153,7 @@ struct mbp_dt_tg::impl {
|
|||
expr *cons, *rhs, *f, *term;
|
||||
bool progress = false;
|
||||
m_new_vars.reset();
|
||||
TRACE("mbp_tg", tout << "Iterating over terms of tg";);
|
||||
TRACE(mbp_tg, tout << "Iterating over terms of tg";);
|
||||
// Not resetting terms because get_terms calls resize on terms
|
||||
m_tg.get_terms(terms, false);
|
||||
for (unsigned i = 0; i < terms.size(); i++) {
|
||||
|
|
|
@ -256,7 +256,7 @@ namespace mbp {
|
|||
todo.push_back({ ax->get_arg(i), ay->get_arg(i) });
|
||||
}
|
||||
|
||||
TRACE("qe", tout << "unification attempt\n";
|
||||
TRACE(qe, tout << "unification attempt\n";
|
||||
for (auto [a, b] : todo)
|
||||
tout << mk_pp(a, m) << " == " << mk_pp(b, m) << "\n";
|
||||
for (auto [key, value] : soln)
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace mbp {
|
|||
for (expr* e1 : *alit) {
|
||||
expr* e2;
|
||||
val = model(e1);
|
||||
TRACE("qe", tout << mk_pp(e1, m) << " |-> " << val << "\n";);
|
||||
TRACE(qe, tout << mk_pp(e1, m) << " |-> " << val << "\n";);
|
||||
if (val2expr.find(val, e2)) {
|
||||
return expr_ref(m.mk_eq(e1, e2), m);
|
||||
}
|
||||
|
@ -193,8 +193,8 @@ namespace mbp {
|
|||
expr_ref val(m);
|
||||
model_evaluator eval(model);
|
||||
eval.set_expand_array_equalities(true);
|
||||
TRACE("qe", tout << fmls << "\n";);
|
||||
DEBUG_CODE(for (expr* fml : fmls) { CTRACE("qe", m.is_false(eval(fml)), tout << mk_pp(fml, m) << " is false\n" << model;); SASSERT(!m.is_false(eval(fml))); });
|
||||
TRACE(qe, tout << fmls << "\n";);
|
||||
DEBUG_CODE(for (expr* fml : fmls) { CTRACE(qe, m.is_false(eval(fml)), tout << mk_pp(fml, m) << " is false\n" << model;); SASSERT(!m.is_false(eval(fml))); });
|
||||
|
||||
for (unsigned i = 0; i < fmls.size(); ++i) {
|
||||
expr* nfml, * fml = fmls.get(i);
|
||||
|
@ -205,11 +205,11 @@ namespace mbp {
|
|||
else
|
||||
extract_bools(eval, fmls, i, fml, true);
|
||||
}
|
||||
TRACE("qe", tout << "fmls: " << fmls << "\n";);
|
||||
TRACE(qe, tout << "fmls: " << fmls << "\n";);
|
||||
}
|
||||
|
||||
void project_plugin::extract_bools(model_evaluator& eval, expr_ref_vector& fmls, unsigned idx, expr* fml, bool is_true) {
|
||||
TRACE("qe", tout << "extract bools: " << mk_pp(fml, m) << "\n";);
|
||||
TRACE(qe, tout << "extract bools: " << mk_pp(fml, m) << "\n";);
|
||||
if (!is_app(fml))
|
||||
return;
|
||||
m_to_visit.reset();
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
init(vars, fml, mdl);
|
||||
// Apply MBP rules till saturation
|
||||
|
||||
TRACE("mbp_tg",
|
||||
TRACE(mbp_tg,
|
||||
tout << "mbp tg " << m_tg.get_lits() << "\nand vars " << vars << "\n";);
|
||||
|
||||
// First, apply rules without splitting on model
|
||||
|
@ -137,9 +137,9 @@ public:
|
|||
// Do complete mbp
|
||||
saturate(vars);
|
||||
|
||||
TRACE("mbp_tg",
|
||||
TRACE(mbp_tg,
|
||||
tout << "mbp tg " << m_tg.get_lits() << " and vars " << vars << "\n";);
|
||||
TRACE("mbp_tg_verbose", obj_hashtable<app> vars_tmp;
|
||||
TRACE(mbp_tg_verbose, obj_hashtable<app> vars_tmp;
|
||||
collect_uninterp_consts(mk_and(m_tg.get_lits()), vars_tmp);
|
||||
for (auto a : vars_tmp)
|
||||
tout << mk_pp(a->get_decl(), m) << "\n";
|
||||
|
@ -173,7 +173,7 @@ public:
|
|||
for (auto v : vars)
|
||||
if (is_red(v))
|
||||
red_vars.mark(v);
|
||||
CTRACE("mbp_tg", !core_vars.empty(), tout << "vars not redundant ";
|
||||
CTRACE(mbp_tg, !core_vars.empty(), tout << "vars not redundant ";
|
||||
for (auto v : core_vars) tout << " " << app_ref(v, m);
|
||||
tout << "\n";);
|
||||
|
||||
|
@ -188,14 +188,14 @@ public:
|
|||
// Step 3.
|
||||
m_tg.qel(vars, fml, &non_core);
|
||||
|
||||
CTRACE("mbp_tg", !vars.empty(),
|
||||
CTRACE(mbp_tg, !vars.empty(),
|
||||
tout << "before substitution " << fml << "\n";);
|
||||
// for all remaining non-cgr bool, dt, array variables, add v = mdl(v)
|
||||
expr_sparse_mark s_vars;
|
||||
for (auto v : vars) {
|
||||
if (m_dt_util.is_datatype(v->get_sort()) ||
|
||||
m_array_util.is_array(v) || m.is_bool(v)) {
|
||||
CTRACE("mbp_tg",
|
||||
CTRACE(mbp_tg,
|
||||
m_array_util.is_array(v) ||
|
||||
m_dt_util.is_datatype(v->get_sort()),
|
||||
tout << "Could not eliminate " << v->get_name()
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace mbp {
|
|||
v = e;
|
||||
a_val = rational(1)/a_val;
|
||||
t = mk_term(is_int, a_val, sign, done);
|
||||
TRACE("qe", tout << mk_pp(e, m) << " := " << t << "\n";);
|
||||
TRACE(qe, tout << mk_pp(e, m) << " := " << t << "\n";);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -390,7 +390,7 @@ void term_graph::add_deq_proc::inc_count() {
|
|||
bool term_graph::is_variable_proc::operator()(const expr *e) const {
|
||||
if (!is_app(e)) return false;
|
||||
const app *a = ::to_app(e);
|
||||
TRACE("qe_verbose", tout << a->get_family_id() << " "
|
||||
TRACE(qe_verbose, tout << a->get_family_id() << " "
|
||||
<< m_solved.contains(a->get_decl()) << " "
|
||||
<< m_decls.contains(a->get_decl()) << "\n";);
|
||||
return a->get_family_id() == null_family_id &&
|
||||
|
@ -773,7 +773,7 @@ void term_graph::mk_qe_lite_equalities(term &t, expr_ref_vector &out,
|
|||
rep = mk_app(t);
|
||||
if (contains_nc(rep)) {
|
||||
TRACE(
|
||||
"qe_debug", tout << "repr not in core " << t;
|
||||
qe_debug, tout << "repr not in core " << t;
|
||||
for (term *it = &t.get_next(); it != &t;
|
||||
it = &it->get_next()) { tout << *it << "\n"; };);
|
||||
DEBUG_CODE(
|
||||
|
@ -1091,7 +1091,7 @@ class term_graph::projector {
|
|||
expr_ref_vector m_pinned; // tracks expr in the maps
|
||||
|
||||
expr *mk_pure(term const &t) {
|
||||
TRACE("qe", t.display(tout));
|
||||
TRACE(qe, t.display(tout));
|
||||
expr *e = nullptr;
|
||||
if (find_term2app(t, e))
|
||||
return e;
|
||||
|
@ -1109,7 +1109,7 @@ class term_graph::projector {
|
|||
kids.push_back(e);
|
||||
else
|
||||
return nullptr;
|
||||
TRACE("qe_verbose", tout << *ch << " -> " << mk_pp(e, m) << "\n";);
|
||||
TRACE(qe_verbose, tout << *ch << " -> " << mk_pp(e, m) << "\n";);
|
||||
}
|
||||
expr_ref pure = m_rewriter.mk_app(a->get_decl(), kids.size(), kids.data());
|
||||
m_pinned.push_back(pure);
|
||||
|
@ -1183,7 +1183,7 @@ class term_graph::projector {
|
|||
for (auto *lit : m_tg.m_lits)
|
||||
if (!m.is_eq(lit) && find_app(lit, e))
|
||||
res.push_back(e);
|
||||
TRACE("qe", tout << "literals: " << res << "\n";);
|
||||
TRACE(qe, tout << "literals: " << res << "\n";);
|
||||
}
|
||||
|
||||
void lits2pure(expr_ref_vector &res) {
|
||||
|
@ -1194,14 +1194,14 @@ class term_graph::projector {
|
|||
if (p1 != p2) res.push_back(m.mk_eq(p1, p2));
|
||||
}
|
||||
else
|
||||
TRACE("qe", tout << "skipping " << mk_pp(lit, m) << "\n";);
|
||||
TRACE(qe, tout << "skipping " << mk_pp(lit, m) << "\n";);
|
||||
}
|
||||
else if (m.is_not(lit, e) && m.is_eq(e, e1, e2)) {
|
||||
if (find_app(e1, p1) && find_app(e2, p2)) {
|
||||
res.push_back(mk_neq(m, p1, p2));
|
||||
}
|
||||
else
|
||||
TRACE("qe", tout << "skipping " << mk_pp(lit, m) << "\n";);
|
||||
TRACE(qe, tout << "skipping " << mk_pp(lit, m) << "\n";);
|
||||
}
|
||||
else if (m.is_distinct(lit)) {
|
||||
ptr_buffer<expr> diff;
|
||||
|
@ -1210,15 +1210,15 @@ class term_graph::projector {
|
|||
if (diff.size() > 1)
|
||||
res.push_back(m.mk_distinct(diff.size(), diff.data()));
|
||||
else
|
||||
TRACE("qe", tout << "skipping " << mk_pp(lit, m) << "\n";);
|
||||
TRACE(qe, tout << "skipping " << mk_pp(lit, m) << "\n";);
|
||||
}
|
||||
else if (find_app(lit, p1))
|
||||
res.push_back(p1);
|
||||
else
|
||||
TRACE("qe", tout << "skipping " << mk_pp(lit, m) << "\n";);
|
||||
TRACE(qe, tout << "skipping " << mk_pp(lit, m) << "\n";);
|
||||
}
|
||||
remove_duplicates(res);
|
||||
TRACE("qe", tout << "literals: " << res << "\n";);
|
||||
TRACE(qe, tout << "literals: " << res << "\n";);
|
||||
}
|
||||
|
||||
void remove_duplicates(expr_ref_vector &v) {
|
||||
|
@ -1291,7 +1291,7 @@ class term_graph::projector {
|
|||
if (roots.size() > 1) {
|
||||
ptr_buffer<expr> args;
|
||||
for (expr *r : roots) { args.push_back(r); }
|
||||
TRACE("qe", tout << "function: " << d->get_name() << "\n";);
|
||||
TRACE(qe, tout << "function: " << d->get_name() << "\n";);
|
||||
res.push_back(m.mk_distinct(args.size(), args.data()));
|
||||
}
|
||||
}
|
||||
|
@ -1301,7 +1301,7 @@ class term_graph::projector {
|
|||
void mk_distinct(expr_ref_vector &res) {
|
||||
collect_decl2terms();
|
||||
args_are_distinct(res);
|
||||
TRACE("qe", tout << res << "\n";);
|
||||
TRACE(qe, tout << res << "\n";);
|
||||
}
|
||||
|
||||
void mk_pure_equalities(const term &t, expr_ref_vector &res) {
|
||||
|
@ -1353,7 +1353,7 @@ class term_graph::projector {
|
|||
else
|
||||
mk_unpure_equalities(*t, res);
|
||||
}
|
||||
TRACE("qe", tout << "literals: " << res << "\n";);
|
||||
TRACE(qe, tout << "literals: " << res << "\n";);
|
||||
}
|
||||
|
||||
void mk_pure_equalities(expr_ref_vector &res) { mk_equalities<true>(res); }
|
||||
|
@ -1412,7 +1412,7 @@ class term_graph::projector {
|
|||
res.push_back(m.mk_distinct(j - i, reps.data() + i));
|
||||
i = j;
|
||||
}
|
||||
TRACE("qe", tout << "after distinct: " << res << "\n";);
|
||||
TRACE(qe, tout << "after distinct: " << res << "\n";);
|
||||
}
|
||||
|
||||
std::ostream &display(std::ostream &out) const {
|
||||
|
@ -1567,7 +1567,7 @@ public:
|
|||
if (!pure) continue;
|
||||
|
||||
add_term2app(*t, pure);
|
||||
TRACE("qe_verbose",
|
||||
TRACE(qe_verbose,
|
||||
tout << "purified " << *t << " " << mk_pp(pure, m) << "\n";);
|
||||
expr *rep = nullptr; // ensure that the root has a representative
|
||||
m_root2rep.find(t->get_root().get_id(), rep);
|
||||
|
@ -1592,7 +1592,7 @@ public:
|
|||
// and can be mined using other means, such as theory
|
||||
// aware core minimization
|
||||
m_tg.reset_marks();
|
||||
TRACE("qe", display(tout << "after purify\n"););
|
||||
TRACE(qe, display(tout << "after purify\n"););
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1689,7 +1689,7 @@ void term_graph::add_model_based_terms(model &mdl,
|
|||
}
|
||||
}
|
||||
TRACE(
|
||||
"qe", for (auto &es
|
||||
qe, for (auto &es
|
||||
: equivs) {
|
||||
tout << "equiv: ";
|
||||
for (expr *t : es) tout << expr_ref(t, m) << " ";
|
||||
|
@ -1708,7 +1708,7 @@ expr* term_graph::rep_of(expr *e) {
|
|||
}
|
||||
|
||||
expr_ref_vector term_graph::dcert(model &mdl, expr_ref_vector const &lits) {
|
||||
TRACE("qe", tout << "dcert " << lits << "\n";);
|
||||
TRACE(qe, tout << "dcert " << lits << "\n";);
|
||||
struct pair_t {
|
||||
expr *a, *b;
|
||||
pair_t() : a(nullptr), b(nullptr) {}
|
||||
|
@ -1806,7 +1806,7 @@ expr_ref_vector term_graph::dcert(model &mdl, expr_ref_vector const &lits) {
|
|||
}
|
||||
}
|
||||
}
|
||||
TRACE("qe", tout << result << "\n";);
|
||||
TRACE(qe, tout << result << "\n";);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace nlarith {
|
|||
}
|
||||
|
||||
if (!get_polys(contains_x, num_lits, lits, polys, comps, &branch_conds, nullptr)) {
|
||||
TRACE("nlarith",
|
||||
TRACE(nlarith,
|
||||
tout << "could not extract polynomials " << mk_pp(x, m()) << "\n";
|
||||
for (unsigned i = 0; i < num_lits; ++i) {
|
||||
tout << mk_pp(lits[i], m()) << " ";
|
||||
|
@ -137,7 +137,7 @@ namespace nlarith {
|
|||
return false;
|
||||
}
|
||||
if (!m_enable_linear && is_linear(polys)) {
|
||||
TRACE("nlarith", tout << "this is a linear problem " << mk_pp(x,m()) << "\n"; display(tout, polys););
|
||||
TRACE(nlarith, tout << "this is a linear problem " << mk_pp(x,m()) << "\n"; display(tout, polys););
|
||||
return false;
|
||||
}
|
||||
unsigned idx;
|
||||
|
@ -152,7 +152,7 @@ namespace nlarith {
|
|||
}
|
||||
}
|
||||
inf_branch(polys, comps, branch_conds);
|
||||
TRACE("nlarith",
|
||||
TRACE(nlarith,
|
||||
for (unsigned i = 0; i < num_lits; ++i) {
|
||||
tout << mk_pp(lits[i], m()) << " ";
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ namespace nlarith {
|
|||
}
|
||||
}
|
||||
|
||||
TRACE("nlarith",
|
||||
TRACE(nlarith,
|
||||
tout << "Non-linear variables: ";
|
||||
for (unsigned i = 0; i < nl_vars.size(); ++i) {
|
||||
tout << mk_pp(nl_vars[i], m()) << " ";
|
||||
|
@ -522,12 +522,12 @@ namespace nlarith {
|
|||
apply_subst(sub, comps[j], polys[j], t1);
|
||||
es.push_back(m().mk_implies(bc.preds(j), t1));
|
||||
subst.push_back(t1);
|
||||
TRACE("nlarith_verbose",
|
||||
TRACE(nlarith_verbose,
|
||||
display(tout << "inf", polys[j]);
|
||||
display(tout, comps[j]);
|
||||
tout << " 0 [-oo] --> " << mk_pp(t1.get(), m()) << "\n";);
|
||||
}
|
||||
TRACE("nlarith", tout << "inf-branch\n";);
|
||||
TRACE(nlarith, tout << "inf-branch\n";);
|
||||
bc.add_branch(mk_and(es.size(), es.data()), m().mk_true(), subst, mk_inf(bc), z(), z(), z());
|
||||
}
|
||||
|
||||
|
@ -545,7 +545,7 @@ namespace nlarith {
|
|||
if (b != z()) {
|
||||
sqrt_form e0(*this, mk_uminus(c), 0, z(), b);
|
||||
// a_i = 0 /\ b_i != 0 /\ phi[e_i/x]
|
||||
TRACE("nlarith", display(tout << "a_i != 0 & b_i != 0 & hi[e_i / x]", p);tout<<"\n";);
|
||||
TRACE(nlarith, display(tout << "a_i != 0 & b_i != 0 & hi[e_i / x]", p);tout<<"\n";);
|
||||
scoped_ptr<expr_replacer> rp = mk_default_expr_replacer(m(), false);
|
||||
expr_substitution sub(m());
|
||||
sub.insert(a, z());
|
||||
|
@ -565,7 +565,7 @@ namespace nlarith {
|
|||
|
||||
if (i == j && a != z()) {
|
||||
// a != 0 & phi[-b/(2a)/x]
|
||||
TRACE("nlarith", display(tout << "a != 0 & phi[-b/2a / x]", p);tout<<"\n";);
|
||||
TRACE(nlarith, display(tout << "a != 0 & phi[-b/2a / x]", p);tout<<"\n";);
|
||||
app* a2 = mk_mul(num(2), a);
|
||||
sqrt_form e1(*this, mk_uminus(b), 0, z(), a2);
|
||||
es.reset();
|
||||
|
@ -594,7 +594,7 @@ namespace nlarith {
|
|||
d = mk_sub(mk_mul(b,b), mk_mul(num(4), a, c));
|
||||
a2 = mk_mul(a, num(2));
|
||||
|
||||
TRACE("nlarith",
|
||||
TRACE(nlarith,
|
||||
display(tout, p); tout << "\n";
|
||||
tout << "a:" << mk_pp(a, m()) << "\n";
|
||||
tout << "b:" << mk_pp(b,m()) << "\n";
|
||||
|
@ -644,9 +644,9 @@ namespace nlarith {
|
|||
}
|
||||
branch = mk_and(es.size(), es.data());
|
||||
bc.add_branch(branch, cond, subst, mk_def(cmp, abc_poly(*this, a, b, c), e1), a, b, c);
|
||||
TRACE("nlarith", tout << mk_pp(branch,m()) << "\n";);
|
||||
TRACE(nlarith, tout << mk_pp(branch,m()) << "\n";);
|
||||
|
||||
TRACE("nlarith",
|
||||
TRACE(nlarith,
|
||||
tout << "0 <= " << mk_pp(d,m()) << "\n";
|
||||
tout << mk_pp(mk_ge(d), m()) << "\n";);
|
||||
|
||||
|
@ -659,7 +659,7 @@ namespace nlarith {
|
|||
}
|
||||
branch = mk_and(es.size(), es.data());
|
||||
bc.add_branch(branch, cond, subst, mk_def(cmp, abc_poly(*this, a, b, c), e2), a, b, c);
|
||||
TRACE("nlarith", tout << mk_pp(branch,m()) << "\n";);
|
||||
TRACE(nlarith, tout << mk_pp(branch,m()) << "\n";);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -675,7 +675,7 @@ namespace nlarith {
|
|||
else {
|
||||
apply_subst(sub, c, p, r);
|
||||
}
|
||||
TRACE("nlarith_verbose",
|
||||
TRACE(nlarith_verbose,
|
||||
display(tout, p);
|
||||
display(tout, c);
|
||||
e.display(tout << " 0 ");
|
||||
|
@ -700,7 +700,7 @@ namespace nlarith {
|
|||
bool is_degree_two_plus(polys const& ps) {
|
||||
for (unsigned i = 0; i < ps.size(); ++i) {
|
||||
if (ps[i].size() > 3) {
|
||||
TRACE("nlarith", tout << "not second-degree: ";
|
||||
TRACE(nlarith, tout << "not second-degree: ";
|
||||
display(tout, ps[i]); tout <<"\n"; );
|
||||
return true;
|
||||
}
|
||||
|
@ -796,7 +796,7 @@ namespace nlarith {
|
|||
if (literals) {
|
||||
literals->push_back(to_app(lits[i]));
|
||||
}
|
||||
TRACE("nlarith_verbose",
|
||||
TRACE(nlarith_verbose,
|
||||
tout << mk_pp(lits[i], m()) << " -> ";
|
||||
display(tout, p); tout << "\n"; );
|
||||
}
|
||||
|
@ -904,7 +904,7 @@ namespace nlarith {
|
|||
mk_uminus(result);
|
||||
return true;
|
||||
default:
|
||||
TRACE("nlarith", tout << "Cannot decompose " << mk_pp(f, m()) << "\n" << mk_pp(e, m()) << "\n";);
|
||||
TRACE(nlarith, tout << "Cannot decompose " << mk_pp(f, m()) << "\n" << mk_pp(e, m()) << "\n";);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -951,7 +951,7 @@ namespace nlarith {
|
|||
}
|
||||
result.push_back(t);
|
||||
}
|
||||
TRACE("nlarith_verbose", display(tout, r); display(tout <<" * ", other); display(tout << " = ", result); tout <<"\n";);
|
||||
TRACE(nlarith_verbose, display(tout, r); display(tout <<" * ", other); display(tout << " = ", result); tout <<"\n";);
|
||||
r.reset();
|
||||
r.append(result.size(), result.data());
|
||||
}
|
||||
|
@ -1316,7 +1316,7 @@ namespace nlarith {
|
|||
dr = mk_mul(d, dr);
|
||||
ar = tmp1;
|
||||
}
|
||||
TRACE("nlarith_verbose",
|
||||
TRACE(nlarith_verbose,
|
||||
display(tout, p);
|
||||
s.display(tout << " ");
|
||||
tout << " " << mk_pp(ar, m()) << " " << mk_pp(br, m()) << " " << mk_pp(dr, m()) << "\n";);
|
||||
|
@ -1453,7 +1453,7 @@ namespace nlarith {
|
|||
mk_sub(q1, u);
|
||||
for (unsigned i = 0; i < q1.size(); ++i) {
|
||||
if (z() != q1[i].get()) {
|
||||
TRACE("nlarith", display(tout, q1););
|
||||
TRACE(nlarith, display(tout, q1););
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ namespace qe {
|
|||
check_cancel();
|
||||
init_assumptions();
|
||||
lbool res = s.m_solver.check(s.m_asms);
|
||||
TRACE("qe", s.display(tout << res << "\n"); );
|
||||
TRACE(qe, s.display(tout << res << "\n"); );
|
||||
switch (res) {
|
||||
case l_true:
|
||||
s.save_model(is_exists(level()));
|
||||
|
@ -290,7 +290,7 @@ namespace qe {
|
|||
s.m_asms.reset();
|
||||
s.m_asms.push_back(is_exists()?s.m_is_true:~s.m_is_true);
|
||||
s.m_asms.append(s.m_assumptions);
|
||||
TRACE("qe", tout << "model valid: " << s.m_valid_model << " level: " << lvl << " ";
|
||||
TRACE(qe, tout << "model valid: " << s.m_valid_model << " level: " << lvl << " ";
|
||||
s.display_assumptions(tout);
|
||||
s.m_solver.display(tout););
|
||||
|
||||
|
@ -322,7 +322,7 @@ namespace qe {
|
|||
}
|
||||
}
|
||||
}
|
||||
TRACE("qe", s.display(tout);
|
||||
TRACE(qe, s.display(tout);
|
||||
tout << "assumptions\n";
|
||||
for (nlsat::literal a : s.m_asms) {
|
||||
s.m_solver.display(tout, a) << "\n";
|
||||
|
@ -380,14 +380,14 @@ namespace qe {
|
|||
result.push_back(lit);
|
||||
}
|
||||
}
|
||||
TRACE("qe", s.m_solver.display(tout, result.size(), result.data()); tout << "\n";);
|
||||
TRACE(qe, s.m_solver.display(tout, result.size(), result.data()); tout << "\n";);
|
||||
// project quantified real variables.
|
||||
// They are sorted by size, so we project the largest variables first to avoid
|
||||
// renaming variables.
|
||||
for (unsigned i = vars.size(); i-- > 0;) {
|
||||
new_result.reset();
|
||||
ex.project(vars[i], result.size(), result.data(), new_result);
|
||||
TRACE("qe", display_project(tout, vars[i], result, new_result););
|
||||
TRACE(qe, display_project(tout, vars[i], result, new_result););
|
||||
result.swap(new_result);
|
||||
}
|
||||
negate_clause(result);
|
||||
|
@ -435,7 +435,7 @@ namespace qe {
|
|||
}
|
||||
nlsat::var_vector vs;
|
||||
s.m_solver.vars(l, vs);
|
||||
TRACE("qe", s.m_solver.display(tout << vs << " ", l) << "\n";);
|
||||
TRACE(qe, s.m_solver.display(tout << vs << " ", l) << "\n";);
|
||||
for (unsigned v : vs) {
|
||||
level.merge(s.m_rvar2level.get(v, max_level()));
|
||||
}
|
||||
|
@ -454,11 +454,11 @@ namespace qe {
|
|||
s.m_preds[k]->push_back(l);
|
||||
s.m_solver.inc_ref(v);
|
||||
s.m_bvar2level.insert(v, level);
|
||||
TRACE("qe", s.m_solver.display(tout, l); tout << ": " << level << "\n";);
|
||||
TRACE(qe, s.m_solver.display(tout, l); tout << ": " << level << "\n";);
|
||||
}
|
||||
|
||||
void project() {
|
||||
TRACE("qe", s.display_assumptions(tout););
|
||||
TRACE(qe, s.display_assumptions(tout););
|
||||
if (!s.m_valid_model) {
|
||||
pop(1);
|
||||
return;
|
||||
|
@ -487,7 +487,7 @@ namespace qe {
|
|||
SASSERT(num_scopes >= 2);
|
||||
}
|
||||
|
||||
TRACE("qe", tout << "backtrack: " << num_scopes << "\n";);
|
||||
TRACE(qe, tout << "backtrack: " << num_scopes << "\n";);
|
||||
pop(num_scopes);
|
||||
}
|
||||
|
||||
|
@ -497,7 +497,7 @@ namespace qe {
|
|||
mbp(std::max(1u, level()-1), cl);
|
||||
|
||||
expr_ref fml = s.clause2fml(cl);
|
||||
TRACE("qe", tout << level() << ": " << fml << "\n";);
|
||||
TRACE(qe, tout << level() << ": " << fml << "\n";);
|
||||
max_level clevel = get_level(cl);
|
||||
if (level() == 1 || clevel.max() == 0) {
|
||||
add_assumption_literal(cl, fml);
|
||||
|
@ -621,7 +621,7 @@ namespace qe {
|
|||
m_has_divs = true;
|
||||
return;
|
||||
}
|
||||
TRACE("qe", tout << "not NRA: " << mk_pp(n, s.m) << "\n";);
|
||||
TRACE(qe, tout << "not NRA: " << mk_pp(n, s.m) << "\n";);
|
||||
throw tactic_exception("not NRA");
|
||||
}
|
||||
void operator()(quantifier * n) {}
|
||||
|
@ -740,7 +740,7 @@ namespace qe {
|
|||
goal_ref_buffer result;
|
||||
(*m_nftactic)(g, result);
|
||||
SASSERT(result.size() == 1);
|
||||
TRACE("qe", result[0]->display(tout););
|
||||
TRACE(qe, result[0]->display(tout););
|
||||
s.g2s(*result[0]);
|
||||
|
||||
// insert variables and their levels.
|
||||
|
@ -753,18 +753,18 @@ namespace qe {
|
|||
if (s.m_a2b.is_var(v)) {
|
||||
SASSERT(m.is_bool(v));
|
||||
nlsat::bool_var b = s.m_a2b.to_var(v);
|
||||
TRACE("qe", tout << mk_pp(v, m) << " |-> b" << b << "\n";);
|
||||
TRACE(qe, tout << mk_pp(v, m) << " |-> b" << b << "\n";);
|
||||
s.m_bound_bvars.back().push_back(b);
|
||||
set_level(b, lvl);
|
||||
}
|
||||
else if (s.m_t2x.is_var(v)) {
|
||||
nlsat::var w = s.m_t2x.to_var(v);
|
||||
TRACE("qe", tout << mk_pp(v, m) << " |-> x" << w << "\n";);
|
||||
TRACE(qe, tout << mk_pp(v, m) << " |-> x" << w << "\n";);
|
||||
s.m_bound_rvars.back().push_back(w);
|
||||
s.m_rvar2level.setx(w, lvl, max_level());
|
||||
}
|
||||
else {
|
||||
TRACE("qe", tout << mk_pp(v, m) << " not found\n";);
|
||||
TRACE(qe, tout << mk_pp(v, m) << " not found\n";);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -772,13 +772,13 @@ namespace qe {
|
|||
s.m_is_true = nlsat::literal(s.m_a2b.to_var(is_true), false);
|
||||
// insert literals from arithmetical sub-formulas
|
||||
nlsat::atom_vector const& atoms = s.m_solver.get_atoms();
|
||||
TRACE("qe", s.m_solver.display(tout););
|
||||
TRACE(qe, s.m_solver.display(tout););
|
||||
for (unsigned i = 0; i < atoms.size(); ++i) {
|
||||
if (atoms[i]) {
|
||||
get_level(nlsat::literal(i, false));
|
||||
}
|
||||
}
|
||||
TRACE("qe", tout << fml << "\n";);
|
||||
TRACE(qe, tout << fml << "\n";);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -864,12 +864,12 @@ namespace qe {
|
|||
fml = m.mk_not(fml);
|
||||
}
|
||||
reset();
|
||||
TRACE("qe", tout << fml << "\n";);
|
||||
TRACE(qe, tout << fml << "\n";);
|
||||
if (!hoist(fml)) {
|
||||
result.push_back(in.get());
|
||||
return;
|
||||
}
|
||||
TRACE("qe", tout << "ex: " << fml << "\n";);
|
||||
TRACE(qe, tout << "ex: " << fml << "\n";);
|
||||
lbool is_sat = check_sat();
|
||||
|
||||
switch (is_sat) {
|
||||
|
|
|
@ -148,7 +148,7 @@ namespace qe {
|
|||
rewriter.mk_and(conjs_mixed.size(), conjs_mixed.data(), fml_mixed);
|
||||
rewriter.mk_and(conjs_open.size(), conjs_open.data(), fml_open);
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "closed\n" << mk_ismt2_pp(fml_closed, m) << "\n";
|
||||
tout << "open\n" << mk_ismt2_pp(fml_open, m) << "\n";
|
||||
tout << "mixed\n" << mk_ismt2_pp(fml_mixed, m) << "\n";
|
||||
|
@ -182,7 +182,7 @@ namespace qe {
|
|||
for (unsigned i = 0; i < num_args; ++i) {
|
||||
if (contains_x(args[i])) {
|
||||
contains_index.push_back(i);
|
||||
TRACE("qe_verbose", tout << "var " << v << " in " << i << "\n";);
|
||||
TRACE(qe_verbose, tout << "var " << v << " in " << i << "\n";);
|
||||
}
|
||||
}
|
||||
//
|
||||
|
@ -194,7 +194,7 @@ namespace qe {
|
|||
partition.push_back(unsigned_vector());
|
||||
}
|
||||
partition.back().push_back(v);
|
||||
TRACE("qe_verbose", tout << "majority " << v << "\n";);
|
||||
TRACE(qe_verbose, tout << "majority " << v << "\n";);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
|
@ -242,7 +242,7 @@ namespace qe {
|
|||
for (unsigned idx = 0; idx < non_shared_vars.size(); ++idx) {
|
||||
unsigned x = non_shared_vars[idx];
|
||||
unsigned r = non_shared_vars[uf.find(idx)];
|
||||
TRACE("qe_verbose", tout << "x: " << x << " r: " << r << "\n";);
|
||||
TRACE(qe_verbose, tout << "x: " << x << " r: " << r << "\n";);
|
||||
bool found = false;
|
||||
for (unsigned i = 0; !found && i < roots.size(); ++i) {
|
||||
if (roots[i] == r) {
|
||||
|
@ -257,7 +257,7 @@ namespace qe {
|
|||
}
|
||||
}
|
||||
|
||||
TRACE("qe_verbose",
|
||||
TRACE(qe_verbose,
|
||||
for (unsigned i = 0; i < partition.size(); ++i) {
|
||||
for (unsigned j = 0; j < partition[i].size(); ++j) {
|
||||
tout << " " << mk_ismt2_pp(vars[partition[i][j]]->x(), m);;
|
||||
|
@ -327,12 +327,12 @@ namespace qe {
|
|||
|
||||
if (leqs.contains(tmp2)) {
|
||||
eqs.push_back(tmp1);
|
||||
TRACE("qe", tout << "found: " << mk_ismt2_pp(tmp1, m) << "\n";);
|
||||
TRACE(qe, tout << "found: " << mk_ismt2_pp(tmp1, m) << "\n";);
|
||||
}
|
||||
else {
|
||||
trail.push_back(tmp1);
|
||||
leqs.insert(tmp1);
|
||||
TRACE("qe_verbose", tout << "insert: " << mk_ismt2_pp(tmp1, m) << "\n";);
|
||||
TRACE(qe_verbose, tout << "insert: " << mk_ismt2_pp(tmp1, m) << "\n";);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -466,7 +466,7 @@ namespace qe {
|
|||
else {
|
||||
m_neg.insert(e, r);
|
||||
}
|
||||
TRACE("nnf",
|
||||
TRACE(nnf,
|
||||
tout << mk_ismt2_pp(e, m) << " " << p << "\n";
|
||||
tout << mk_ismt2_pp(r, m) << "\n";);
|
||||
|
||||
|
@ -516,7 +516,7 @@ namespace qe {
|
|||
m_rewriter.mk_and(r1, th, tmp1);
|
||||
m_rewriter.mk_and(r2, el, tmp2);
|
||||
m_rewriter.mk_or(tmp1, tmp2, tmp);
|
||||
TRACE("nnf",
|
||||
TRACE(nnf,
|
||||
tout << mk_ismt2_pp(a, m) << "\n";
|
||||
tout << mk_ismt2_pp(tmp, m) << "\n";);
|
||||
insert(a, p, tmp);
|
||||
|
@ -572,7 +572,7 @@ namespace qe {
|
|||
}
|
||||
|
||||
bool get_nnf(expr_ref& fml, bool p0) {
|
||||
TRACE("nnf", tout << mk_ismt2_pp(fml.get(), m) << "\n";);
|
||||
TRACE(nnf, tout << mk_ismt2_pp(fml.get(), m) << "\n";);
|
||||
bool p = p0;
|
||||
unsigned sz = m_todo.size();
|
||||
expr_ref tmp(m);
|
||||
|
@ -855,7 +855,7 @@ namespace qe {
|
|||
m_nnf_core(fml);
|
||||
m_normalize_literals(fml);
|
||||
m_collect_atoms(fml, pos, neg);
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
ast_manager& m = fml.get_manager();
|
||||
tout << mk_ismt2_pp(orig, m) << "\n-->\n" << mk_ismt2_pp(fml, m) << "\n";);
|
||||
}
|
||||
|
@ -916,7 +916,7 @@ namespace qe {
|
|||
// - assigned formula, but unassigned variable for branching
|
||||
// - assigned variable and formula with 0 or more branches.
|
||||
//
|
||||
#define CHECK_COND(_cond_) if (!(_cond_)) { TRACE("qe", tout << "violated: " << #_cond_ << "\n";); return false; }
|
||||
#define CHECK_COND(_cond_) if (!(_cond_)) { TRACE(qe, tout << "violated: " << #_cond_ << "\n";); return false; }
|
||||
bool invariant() const {
|
||||
CHECK_COND(assignment());
|
||||
CHECK_COND(m_children.empty() || fml());
|
||||
|
@ -979,7 +979,7 @@ namespace qe {
|
|||
todo.pop_back();
|
||||
if (st->m_children.empty() && st->fml() &&
|
||||
st->m_vars.empty() && !st->has_var()) {
|
||||
TRACE("qe", st->display(tout << "appending leaf\n"););
|
||||
TRACE(qe, st->display(tout << "appending leaf\n"););
|
||||
result.push_back(st->fml());
|
||||
}
|
||||
for (auto * ch : st->m_children)
|
||||
|
@ -1009,7 +1009,7 @@ namespace qe {
|
|||
}
|
||||
|
||||
void reset() {
|
||||
TRACE("qe",tout << "resetting\n";);
|
||||
TRACE(qe,tout << "resetting\n";);
|
||||
for (auto* ch : m_children) dealloc(ch);
|
||||
m_pos.reset();
|
||||
m_neg.reset();
|
||||
|
@ -1037,7 +1037,7 @@ namespace qe {
|
|||
// app* const* free_vars() const { return m_vars.c_ptr(); }
|
||||
app_ref_vector const& free_vars() const { return m_vars; }
|
||||
app* free_var(unsigned i) const { return m_vars[i]; }
|
||||
void reset_free_vars() { TRACE("qe", tout << m_vars << "\n";); m_vars.reset(); }
|
||||
void reset_free_vars() { TRACE(qe, tout << m_vars << "\n";); m_vars.reset(); }
|
||||
|
||||
atom_set const& pos_atoms() const { return m_pos; }
|
||||
atom_set const& neg_atoms() const { return m_neg; }
|
||||
|
@ -1107,7 +1107,7 @@ namespace qe {
|
|||
st->init(fml);
|
||||
st->m_vars.append(m_vars.size(), m_vars.data());
|
||||
SASSERT(invariant());
|
||||
TRACE("qe", display_node(tout); st->display_node(tout););
|
||||
TRACE(qe, display_node(tout); st->display_node(tout););
|
||||
return st;
|
||||
}
|
||||
|
||||
|
@ -1121,7 +1121,7 @@ namespace qe {
|
|||
m_branch_index.insert(branch_id, index);
|
||||
st->m_vars.append(m_vars.size(), m_vars.data());
|
||||
SASSERT(invariant());
|
||||
TRACE("qe", display_node(tout); st->display_node(tout););
|
||||
TRACE(qe, display_node(tout); st->display_node(tout););
|
||||
return st;
|
||||
}
|
||||
|
||||
|
@ -1245,7 +1245,7 @@ namespace qe {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
TRACE("qe_verbose", tout << "Not relevant: " << mk_ismt2_pp(e, m_s.get_manager()) << "\n";);
|
||||
TRACE(qe_verbose, tout << "Not relevant: " << mk_ismt2_pp(e, m_s.get_manager()) << "\n";);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1285,14 +1285,14 @@ namespace qe {
|
|||
|
||||
void i_solver_context::mk_atom(expr* e, bool p, expr_ref& result) {
|
||||
ast_manager& m = get_manager();
|
||||
TRACE("qe_verbose", tout << mk_ismt2_pp(e, m) << "\n";);
|
||||
TRACE(qe_verbose, tout << mk_ismt2_pp(e, m) << "\n";);
|
||||
for (unsigned i = 0; i < m_plugins.size(); ++i) {
|
||||
qe_solver_plugin* pl = m_plugins[i];
|
||||
if (pl && pl->mk_atom(e, p, result)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
TRACE("qe_verbose", tout << "No plugin for " << mk_ismt2_pp(e, m) << "\n";);
|
||||
TRACE(qe_verbose, tout << "No plugin for " << mk_ismt2_pp(e, m) << "\n";);
|
||||
result = p?e:mk_not(m, e);
|
||||
}
|
||||
|
||||
|
@ -1425,7 +1425,7 @@ namespace qe {
|
|||
m_solver.assert_expr(f);
|
||||
}
|
||||
m_root.init(f);
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
for (unsigned i = 0; i < num_vars; ++i) tout << mk_ismt2_pp(vars[i], m) << "\n";
|
||||
tout << mk_ismt2_pp(f, m) << "\n";);
|
||||
|
||||
|
@ -1474,7 +1474,7 @@ namespace qe {
|
|||
defs->project(num_vars, vars);
|
||||
}
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "result:" << mk_ismt2_pp(fml, m) << "\n";
|
||||
tout << "input: " << mk_ismt2_pp(m_fml, m) << "\n";
|
||||
tout << "subformula: " << mk_ismt2_pp(m_subfml, m) << "\n";
|
||||
|
@ -1508,7 +1508,7 @@ namespace qe {
|
|||
scoped_ptr<model_evaluator> model_eval = alloc(model_evaluator, *model);
|
||||
|
||||
while (m.inc()) {
|
||||
TRACE("qe", model_v2_pp(tout, *model););
|
||||
TRACE(qe, model_v2_pp(tout, *model););
|
||||
while (can_propagate_assignment(*model_eval))
|
||||
propagate_assignment(*model_eval);
|
||||
VERIFY(CHOOSE_VAR == update_current(*model_eval, true));
|
||||
|
@ -1550,7 +1550,7 @@ namespace qe {
|
|||
void elim_var(unsigned idx, expr* _fml, expr* def) override {
|
||||
app* x = get_var(idx);
|
||||
expr_ref fml(_fml, m);
|
||||
TRACE("qe", tout << mk_pp(x,m) << " " << mk_pp(def, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(x,m) << " " << mk_pp(def, m) << "\n";);
|
||||
m_current->set_var(x, rational(1));
|
||||
m_current = m_current->add_child(fml);
|
||||
m_current->add_def(x, def);
|
||||
|
@ -1573,7 +1573,7 @@ namespace qe {
|
|||
bv = m.mk_fresh_const("b", m_bv.mk_sort(20));
|
||||
m_trail.push_back(bv);
|
||||
}
|
||||
TRACE("qe", tout << "Add branch var: " << mk_ismt2_pp(x, m) << " " << mk_ismt2_pp(bv, m) << "\n";);
|
||||
TRACE(qe, tout << "Add branch var: " << mk_ismt2_pp(x, m) << " " << mk_ismt2_pp(bv, m) << "\n";);
|
||||
m_var2branch.insert(x, bv);
|
||||
}
|
||||
|
||||
|
@ -1593,7 +1593,7 @@ namespace qe {
|
|||
add_literal(l3);
|
||||
expr_ref fml(m);
|
||||
fml = m.mk_or(m_literals);
|
||||
TRACE("qe", tout << fml << "\n";);
|
||||
TRACE(qe, tout << fml << "\n";);
|
||||
m_solver.assert_expr(fml);
|
||||
}
|
||||
|
||||
|
@ -1685,7 +1685,7 @@ namespace qe {
|
|||
nb = m_current->get_num_branches();
|
||||
expr_ref fml(m_current->fml(), m);
|
||||
if (!eval(model_eval, b, branch) || branch >= nb) {
|
||||
TRACE("qe", tout << "evaluation failed: setting branch to 0\n";);
|
||||
TRACE(qe, tout << "evaluation failed: setting branch to 0\n";);
|
||||
branch = rational::zero();
|
||||
}
|
||||
SASSERT(!branch.is_neg());
|
||||
|
@ -1769,7 +1769,7 @@ namespace qe {
|
|||
model_eval2.set_model_completion(true);
|
||||
model_eval2(x, val);
|
||||
}
|
||||
TRACE("qe", tout << mk_pp(x,m) << " " << mk_pp(val, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(x,m) << " " << mk_pp(val, m) << "\n";);
|
||||
m_current->add_def(x, val);
|
||||
}
|
||||
m_current->reset_free_vars();
|
||||
|
@ -1796,9 +1796,9 @@ namespace qe {
|
|||
simplified = pl && pl->simplify(result);
|
||||
}
|
||||
}
|
||||
TRACE("qe_verbose", tout << "simp: " << mk_ismt2_pp(result.get(), m) << "\n";);
|
||||
TRACE(qe_verbose, tout << "simp: " << mk_ismt2_pp(result.get(), m) << "\n";);
|
||||
m_nnf(result, pos, neg);
|
||||
TRACE("qe", tout << "nnf: " << mk_ismt2_pp(result.get(), m) << "\n";);
|
||||
TRACE(qe, tout << "nnf: " << mk_ismt2_pp(result.get(), m) << "\n";);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1888,7 +1888,7 @@ namespace qe {
|
|||
// all bound decisions have been made.
|
||||
//
|
||||
void block_assignment() {
|
||||
TRACE("qe_verbose", m_solver.display(tout););
|
||||
TRACE(qe_verbose, m_solver.display(tout););
|
||||
add_constraint(true);
|
||||
}
|
||||
|
||||
|
@ -1904,7 +1904,7 @@ namespace qe {
|
|||
}
|
||||
|
||||
m_current->set_var(x, k);
|
||||
TRACE("qe", tout << mk_pp(x, m) << " := " << k << "\n";);
|
||||
TRACE(qe, tout << mk_pp(x, m) << " := " << k << "\n";);
|
||||
if (m_bv.is_bv(x)) {
|
||||
return;
|
||||
}
|
||||
|
@ -1945,7 +1945,7 @@ namespace qe {
|
|||
vars.reset();
|
||||
closed = closed && (r != l_undef);
|
||||
}
|
||||
TRACE("qe", tout << fml << " free: " << m_current->free_vars() << "\n";);
|
||||
TRACE(qe, tout << fml << " free: " << m_current->free_vars() << "\n";);
|
||||
m_current->add_child(fml)->reset_free_vars();
|
||||
block_assignment();
|
||||
}
|
||||
|
@ -1979,7 +1979,7 @@ namespace qe {
|
|||
plugin(x).get_num_branches(contains(x), fml, num_branches)) {
|
||||
return true;
|
||||
}
|
||||
TRACE("qe", tout << "setting variable " << mk_pp(x, m) << " free\n";);
|
||||
TRACE(qe, tout << "setting variable " << mk_pp(x, m) << " free\n";);
|
||||
m_free_vars.push_back(x);
|
||||
m_current->del_var(x);
|
||||
}
|
||||
|
@ -1994,7 +1994,7 @@ namespace qe {
|
|||
bool solved = true;
|
||||
while (solved) {
|
||||
expr_ref fml(m_current->fml(), m);
|
||||
TRACE("qe", tout << fml << "\n";);
|
||||
TRACE(qe, tout << fml << "\n";);
|
||||
conj_enum conjs(m, fml);
|
||||
solved = false;
|
||||
for (unsigned i = 0; !solved && i < m_plugins.size(); ++i) {
|
||||
|
@ -2132,7 +2132,7 @@ namespace qe {
|
|||
flet<bool> fl4(m_fparams.m_bv_enable_int2bv2int, true);
|
||||
flet<bool> fl5(m_fparams.m_array_canonize_simplify, true);
|
||||
flet<unsigned> fl6(m_fparams.m_relevancy_lvl, 0);
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
for (unsigned i = 0; i < num_vars; ++i) {
|
||||
tout << mk_ismt2_pp(vars[i], m) << " ";
|
||||
}
|
||||
|
@ -2148,7 +2148,7 @@ namespace qe {
|
|||
th->check(num_vars, vars, m_assumption, fml, get_first, free_vars, defs);
|
||||
|
||||
push_context(th.detach());
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
for (unsigned i = 0; i < num_vars; ++i) {
|
||||
tout << mk_ismt2_pp(vars[i], m) << " ";
|
||||
}
|
||||
|
@ -2221,7 +2221,7 @@ namespace qe {
|
|||
}
|
||||
|
||||
void expr_quant_elim::operator()(expr* assumption, expr* fml, expr_ref& result) {
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
if (assumption) tout << "elim assumption\n" << mk_ismt2_pp(assumption, m) << "\n";
|
||||
tout << "elim input\n" << mk_ismt2_pp(fml, m) << "\n";);
|
||||
expr_ref_vector bound(m);
|
||||
|
@ -2232,7 +2232,7 @@ namespace qe {
|
|||
m_trail.reset();
|
||||
m_visited.reset();
|
||||
abstract_expr(bound.size(), bound.data(), result);
|
||||
TRACE("qe", tout << "elim result\n" << mk_ismt2_pp(result, m) << "\n";);
|
||||
TRACE(qe, tout << "elim result\n" << mk_ismt2_pp(result, m) << "\n";);
|
||||
}
|
||||
|
||||
void expr_quant_elim::updt_params(params_ref const& p) {
|
||||
|
@ -2380,7 +2380,7 @@ namespace qe {
|
|||
bool expr_quant_elim::solve_for_vars(unsigned num_vars, app* const* vars, expr* _fml, guarded_defs& defs) {
|
||||
app_ref_vector fvs(m);
|
||||
expr_ref fml(_fml, m);
|
||||
TRACE("qe", tout << mk_pp(fml, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(fml, m) << "\n";);
|
||||
init_qe();
|
||||
lbool is_sat = m_qe->eliminate_exists(num_vars, vars, fml, fvs, false, &defs);
|
||||
return is_sat != l_undef;
|
||||
|
@ -2512,7 +2512,7 @@ namespace qe {
|
|||
qe_solver_plugin* p = m_plugins[i];
|
||||
solved = p && p->solve(conjs, fml);
|
||||
}
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << (solved?"solved":"not solved") << "\n";
|
||||
if (solved) tout << mk_ismt2_pp(fml, m) << "\n";
|
||||
tout << *m_vars << "\n";
|
||||
|
@ -2547,7 +2547,7 @@ namespace qe {
|
|||
|
||||
// callback to replace variable at index 'idx' with definition 'def' and updated formula 'fml'
|
||||
void elim_var(unsigned idx, expr* fml, expr* def) override {
|
||||
TRACE("qe", tout << idx << ": " << mk_pp(m_vars->get(idx), m) << " " << mk_pp(fml, m) << " " << m_contains.size() << "\n";);
|
||||
TRACE(qe, tout << idx << ": " << mk_pp(m_vars->get(idx), m) << " " << mk_pp(fml, m) << " " << m_contains.size() << "\n";);
|
||||
*m_fml = fml;
|
||||
m_vars->set(idx, m_vars->get(m_vars->size()-1));
|
||||
m_vars->pop_back();
|
||||
|
@ -2558,7 +2558,7 @@ namespace qe {
|
|||
|
||||
// callback to add new variable to branch.
|
||||
void add_var(app* x) override {
|
||||
TRACE("qe", tout << "add var: " << mk_pp(x, m) << "\n";);
|
||||
TRACE(qe, tout << "add var: " << mk_pp(x, m) << "\n";);
|
||||
m_vars->push_back(x);
|
||||
m_contains.push_back(alloc(contains_app, m, x));
|
||||
}
|
||||
|
@ -2583,7 +2583,7 @@ namespace qe {
|
|||
reset();
|
||||
m_fml = &fml;
|
||||
m_vars = &vars;
|
||||
TRACE("qe", tout << "Vars: " << vars << "\n";);
|
||||
TRACE(qe, tout << "Vars: " << vars << "\n";);
|
||||
for (auto* v : vars) {
|
||||
m_contains.push_back(alloc(contains_app, m, v));
|
||||
}
|
||||
|
@ -2619,10 +2619,10 @@ namespace qe {
|
|||
}
|
||||
// bool is_forall = old_q->is_forall();
|
||||
app_ref_vector vars(m);
|
||||
TRACE("qe", tout << "simplifying" << mk_pp(new_body, m) << "\n";);
|
||||
TRACE(qe, tout << "simplifying" << mk_pp(new_body, m) << "\n";);
|
||||
result = new_body;
|
||||
extract_vars(old_q, result, vars);
|
||||
TRACE("qe", tout << "variables extracted" << mk_pp(result, m) << "\n";);
|
||||
TRACE(qe, tout << "variables extracted" << mk_pp(result, m) << "\n";);
|
||||
|
||||
if (is_forall(old_q)) {
|
||||
result = mk_not(m, result);
|
||||
|
@ -2635,7 +2635,7 @@ namespace qe {
|
|||
var_shifter shift(m);
|
||||
shift(result, vars.size(), result);
|
||||
result = expr_abstract(vars, result);
|
||||
TRACE("qe", tout << "abstracted" << mk_pp(result, m) << "\n";);
|
||||
TRACE(qe, tout << "abstracted" << mk_pp(result, m) << "\n";);
|
||||
ptr_vector<sort> sorts;
|
||||
svector<symbol> names;
|
||||
for (app* v : vars) {
|
||||
|
|
|
@ -182,7 +182,7 @@ namespace qe {
|
|||
}
|
||||
}
|
||||
if (!found) {
|
||||
TRACE("qe_verbose",
|
||||
TRACE(qe_verbose,
|
||||
tout
|
||||
<< "Did not find: "
|
||||
<< mk_pp(x, m) << " in "
|
||||
|
@ -205,7 +205,7 @@ namespace qe {
|
|||
if (contains_x(rest)) {
|
||||
return false;
|
||||
}
|
||||
TRACE("qe_verbose",
|
||||
TRACE(qe_verbose,
|
||||
tout
|
||||
<< mk_pp(p, m) << " = "
|
||||
<< "(+ (* " << k << " "
|
||||
|
@ -463,7 +463,7 @@ namespace qe {
|
|||
result = m.mk_not(m_arith.mk_le(mk_zero(e), e));
|
||||
}
|
||||
simplify(result);
|
||||
TRACE("qe_verbose", tout << "mk_lt " << mk_pp(result, m) << "\n";);
|
||||
TRACE(qe_verbose, tout << "mk_lt " << mk_pp(result, m) << "\n";);
|
||||
}
|
||||
|
||||
// ax + t = 0
|
||||
|
@ -583,7 +583,7 @@ namespace qe {
|
|||
mk_divides(abs_b, sz, b_divides_sz);
|
||||
mk_and(b_divides_sz, asz_bt_le_0, tmp4);
|
||||
mk_big_or(abs_b - numeral(2), x, tmp4, tmp2);
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "b | s + z: " << mk_pp(b_divides_sz, m) << "\n";
|
||||
tout << "a(s+z) + bt <= 0: " << mk_pp(asz_bt_le_0, m) << "\n";
|
||||
);
|
||||
|
@ -597,7 +597,7 @@ namespace qe {
|
|||
// or exists z in [0 .. |b|-2] . |b| | (z + s) && a*n_sign(b)(s + z) + |b|t <= 0
|
||||
}
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
{
|
||||
tout << (is_strict?"strict":"non-strict") << "\n";
|
||||
bound(m, a, t, false).pp(tout, x);
|
||||
|
@ -714,7 +714,7 @@ namespace qe {
|
|||
else {
|
||||
return false;
|
||||
}
|
||||
TRACE("qe_verbose", tout << "Atom: " << mk_pp(result, m) << "\n";);
|
||||
TRACE(qe_verbose, tout << "Atom: " << mk_pp(result, m) << "\n";);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -772,12 +772,12 @@ namespace qe {
|
|||
normalize_sum(tmp2);
|
||||
if (leqs.contains(tmp2)) {
|
||||
eqs.push_back(tmp1);
|
||||
TRACE("qe", tout << "found: " << mk_pp(tmp1, m) << "\n";);
|
||||
TRACE(qe, tout << "found: " << mk_pp(tmp1, m) << "\n";);
|
||||
}
|
||||
else {
|
||||
trail.push_back(tmp1);
|
||||
leqs.insert(tmp1);
|
||||
TRACE("qe_verbose", tout << "insert: " << mk_pp(tmp1, m) << "\n";);
|
||||
TRACE(qe_verbose, tout << "insert: " << mk_pp(tmp1, m) << "\n";);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -827,7 +827,7 @@ namespace qe {
|
|||
}
|
||||
|
||||
void mk_big_or(numeral up, app* x, expr* body, expr_ref& result) {
|
||||
TRACE("qe", tout << mk_pp(x, m) << " " << mk_pp(body, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(x, m) << " " << mk_pp(body, m) << "\n";);
|
||||
if (numeral(1) >= up) {
|
||||
mk_big_or_blast(up, x, body, result);
|
||||
}
|
||||
|
@ -847,7 +847,7 @@ namespace qe {
|
|||
++index;
|
||||
}
|
||||
mk_or(ors.size(), ors.data(), result);
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout
|
||||
<< "[0 " << up << "] "
|
||||
<< mk_pp(x, m) << "\n"
|
||||
|
@ -974,7 +974,7 @@ namespace qe {
|
|||
tmp = m_arith.mk_add(p, tmp);
|
||||
e = m_arith.mk_div(tmp, ke);
|
||||
}
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "is singular:\n"
|
||||
<< mk_pp(p, m) << "\n"
|
||||
<< mk_pp(fml, m) << "\n"
|
||||
|
@ -984,7 +984,7 @@ namespace qe {
|
|||
expr_ref result(fml, m);
|
||||
m_replace.apply_substitution(x, e, result);
|
||||
simplify(result);
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "singular solved:\n"
|
||||
<< mk_pp(result, m) << "\n";
|
||||
);
|
||||
|
@ -1019,7 +1019,7 @@ namespace qe {
|
|||
return false;
|
||||
}
|
||||
|
||||
TRACE("qe", tout << "is linear: " << mk_pp(p, m) << "\n";);
|
||||
TRACE(qe, tout << "is linear: " << mk_pp(p, m) << "\n";);
|
||||
SASSERT(values.size() == num_vars + 1);
|
||||
SASSERT(num_vars > 0);
|
||||
|
||||
|
@ -1059,7 +1059,7 @@ namespace qe {
|
|||
}
|
||||
p1 = m_arith.mk_add(p1, m_arith.mk_numeral(values[0], s));
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "is linear:\n"
|
||||
<< mk_pp(fml, m) << "\n"
|
||||
<< mk_pp(p, m) << "\n"
|
||||
|
@ -1075,7 +1075,7 @@ namespace qe {
|
|||
m_replace.apply_substitution(x, p1, result);
|
||||
simplify(result);
|
||||
m_ctx.elim_var(index-1, result, p1);
|
||||
TRACE("qe", tout << "Reduced " << index-1 << " : " << result << "\n";);
|
||||
TRACE(qe, tout << "Reduced " << index-1 << " : " << result << "\n";);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1141,7 +1141,7 @@ namespace qe {
|
|||
values[0] += k;
|
||||
}
|
||||
else {
|
||||
TRACE("qe_verbose", tout << "non-linear " << mk_pp(p, m) << "\n";);
|
||||
TRACE(qe_verbose, tout << "non-linear " << mk_pp(p, m) << "\n";);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1200,7 +1200,7 @@ namespace qe {
|
|||
if (has_bound) {
|
||||
m_mark.mark(a, true);
|
||||
}
|
||||
TRACE("qe_verbose",
|
||||
TRACE(qe_verbose,
|
||||
ast_manager& m = m_util.get_manager();
|
||||
app* x = contains_x.x();
|
||||
tout << has_bound << " bound for " << mk_pp(x, m) << " within " << mk_pp(a, m) << "\n";);
|
||||
|
@ -1583,7 +1583,7 @@ public:
|
|||
mk_non_resolve(bounds, false, is_lower, result);
|
||||
m_util.simplify(result);
|
||||
add_cache(x, fml, v, result, x_t.get_coeff(), x_t.get_term());
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << vl << " " << mk_pp(x, m) << " infinite case\n";
|
||||
tout << mk_pp(fml, m) << "\n";
|
||||
tout << mk_pp(result, m) << "\n";);
|
||||
|
@ -1596,7 +1596,7 @@ public:
|
|||
SASSERT(index < t_size + e_size);
|
||||
if (is_strict) {
|
||||
index -= e_size;
|
||||
TRACE("qe_verbose", bounds.display(tout); );
|
||||
TRACE(qe_verbose, bounds.display(tout); );
|
||||
}
|
||||
else if (m_util.is_real(x)) {
|
||||
SASSERT(0 == (e_size & 0x1));
|
||||
|
@ -1630,7 +1630,7 @@ public:
|
|||
mk_resolve(bounds, x, x_t, false, is_eq, is_strict, is_lower, index, a, t, result);
|
||||
m_util.simplify(result);
|
||||
add_cache(x, fml, v, result, x_t.get_coeff(), x_t.get_term());
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
{
|
||||
tout << vl << " " << mk_pp(bounds.atoms(is_strict, is_lower)[index],m) << "\n";
|
||||
tout << mk_pp(fml, m) << "\n";
|
||||
|
@ -1658,12 +1658,12 @@ public:
|
|||
get_def(contains_x, vl.get_unsigned(), fml, *def);
|
||||
}
|
||||
VERIFY(get_cache(contains_x.x(), fml, vl.get_unsigned(), fml));
|
||||
TRACE("qe", tout << mk_pp(contains_x.x(), m) << " " << vl << "\n" << mk_pp(fml, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(contains_x.x(), m) << " " << vl << "\n" << mk_pp(fml, m) << "\n";);
|
||||
}
|
||||
|
||||
bool project(contains_app& x, model_ref& model, expr_ref& fml) override {
|
||||
if (!update_bounds(x, fml)) {
|
||||
TRACE("qe", tout << mk_pp(x.x(), m) << " failed to update bounds\n";);
|
||||
TRACE(qe, tout << mk_pp(x.x(), m) << " failed to update bounds\n";);
|
||||
return false;
|
||||
}
|
||||
if (m_util.m_arith.is_real(x.x())) {
|
||||
|
@ -1762,7 +1762,7 @@ public:
|
|||
x_t.set_coeff(bf.m_coeff);
|
||||
|
||||
// x is of the form: x_t.get_coeff()*x' + x_t.get_term()
|
||||
CTRACE("qe", x_t.get_term(), tout << x_t.get_coeff() << " " << mk_pp(x_t.get_term(), m) << "\n";);
|
||||
CTRACE(qe, x_t.get_term(), tout << x_t.get_coeff() << " " << mk_pp(x_t.get_term(), m) << "\n";);
|
||||
//
|
||||
// a*x + t <= 0
|
||||
// a*(c*x' + s) + t <= 0
|
||||
|
@ -1788,14 +1788,14 @@ public:
|
|||
// x := coeff * x' + s
|
||||
// solve instead for
|
||||
// a*coeff*x' + term + a*s <= 0
|
||||
TRACE("qe", tout << x_t.get_coeff() << "* " << mk_pp(x,m) << " + "
|
||||
TRACE(qe, tout << x_t.get_coeff() << "* " << mk_pp(x,m) << " + "
|
||||
<< mk_pp(x_t.get_term(), m) << "\n";);
|
||||
SASSERT(x_t.get_coeff().is_pos());
|
||||
term = m_util.mk_add(term, m_util.mk_mul(a, x_t.get_term()));
|
||||
a = a * x_t.get_coeff();
|
||||
}
|
||||
|
||||
TRACE("qe", tout << a << "* " << mk_pp(x,m) << " + " << mk_pp(term, m) << " <= 0\n";);
|
||||
TRACE(qe, tout << a << "* " << mk_pp(x,m) << " + " << mk_pp(term, m) << " <= 0\n";);
|
||||
SASSERT(a.is_int());
|
||||
SASSERT(is_lower == a.is_pos());
|
||||
|
||||
|
@ -1806,7 +1806,7 @@ public:
|
|||
term = m_util.mk_uminus(term);
|
||||
term = mk_idiv(term, a);
|
||||
terms.push_back(term);
|
||||
TRACE("qe", tout << "a: " << a << " term: " << mk_pp(term, m) << "\n";);
|
||||
TRACE(qe, tout << "a: " << a << " term: " << mk_pp(term, m) << "\n";);
|
||||
}
|
||||
is_strict = true;
|
||||
sz = bounds.size(is_strict, !is_lower);
|
||||
|
@ -1837,7 +1837,7 @@ public:
|
|||
|
||||
if (x_t.get_term()) {
|
||||
// x := coeff * x + s
|
||||
TRACE("qe", tout << x_t.get_coeff() << "* " << mk_pp(x,m) << " + "
|
||||
TRACE(qe, tout << x_t.get_coeff() << "* " << mk_pp(x,m) << " + "
|
||||
<< mk_pp(x_t.get_term(), m) << "\n";);
|
||||
def = m_util.mk_add(m_util.mk_mul(x_t.get_coeff(), def), x_t.get_term());
|
||||
}
|
||||
|
@ -1850,7 +1850,7 @@ public:
|
|||
SASSERT(v < t_size + e_size);
|
||||
if (is_strict) {
|
||||
v -= e_size;
|
||||
TRACE("qe_verbose", bounds.display(tout); );
|
||||
TRACE(qe_verbose, bounds.display(tout); );
|
||||
}
|
||||
else if (m_util.is_real(x)) {
|
||||
SASSERT(0 == (e_size & 0x1));
|
||||
|
@ -1872,7 +1872,7 @@ public:
|
|||
// x := coeff * x' + s
|
||||
// solve instead for
|
||||
// a*coeff*x' + term + a*s <= 0
|
||||
TRACE("qe", tout << x_t.get_coeff() << "* " << mk_pp(x,m) << " + "
|
||||
TRACE(qe, tout << x_t.get_coeff() << "* " << mk_pp(x,m) << " + "
|
||||
<< mk_pp(x_t.get_term(), m) << "\n";);
|
||||
SASSERT(x_t.get_coeff().is_pos());
|
||||
def = m_util.mk_add(def, m_util.mk_mul(a, x_t.get_term()));
|
||||
|
@ -1904,7 +1904,7 @@ public:
|
|||
m_util.simplify(def);
|
||||
|
||||
|
||||
TRACE("qe", tout << "TBD (for Real): " << a << " " << mk_pp(def, m) << "\n";);
|
||||
TRACE(qe, tout << "TBD (for Real): " << a << " " << mk_pp(def, m) << "\n";);
|
||||
}
|
||||
|
||||
expr_ref mk_not(expr* e) {
|
||||
|
@ -1957,7 +1957,7 @@ public:
|
|||
}
|
||||
assign(x, fml, vl);
|
||||
subst(x, vl, fml, nullptr);
|
||||
TRACE("qe", tout << mk_pp(fml, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(fml, m) << "\n";);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1980,7 +1980,7 @@ public:
|
|||
}
|
||||
assign(x, fml, vl);
|
||||
subst(x, vl, fml, nullptr);
|
||||
TRACE("qe", tout << mk_pp(fml, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(fml, m) << "\n";);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2075,7 +2075,7 @@ public:
|
|||
// z < d
|
||||
expr* z_lt_d = m_util.m_arith.mk_le(z, m_util.m_arith.mk_numeral(d-rational(1), true));
|
||||
m_ctx.add_constraint(false, z_lt_d);
|
||||
TRACE("qe", tout << mk_pp(z_lt_d, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(z_lt_d, m) << "\n";);
|
||||
|
||||
// result <- result & z <= d - 1
|
||||
SASSERT(!abs(d).is_one());
|
||||
|
@ -2089,11 +2089,11 @@ public:
|
|||
t1 = m_util.mk_sub(x, z);
|
||||
m_util.mk_divides(d, t1, new_atom);
|
||||
m_ctx.add_constraint(false, new_atom);
|
||||
TRACE("qe", tout << mk_pp(new_atom, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(new_atom, m) << "\n";);
|
||||
|
||||
// (c | ax + t <-> c | az + t) for each divisor.
|
||||
mk_div_equivs(bounds, z, result);
|
||||
TRACE("qe", tout << mk_pp(result, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(result, m) << "\n";);
|
||||
|
||||
// update x_t to map x |-> dx + z
|
||||
x_t.set_term(z);
|
||||
|
@ -2173,7 +2173,7 @@ public:
|
|||
m_util.simplify(mod_eq);
|
||||
result = m.mk_and(result, mod_eq);
|
||||
|
||||
TRACE("qe", tout << mk_pp(mod_eq, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(mod_eq, m) << "\n";);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2260,7 +2260,7 @@ public:
|
|||
}
|
||||
}
|
||||
m_util.simplify(result);
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << (is_strict?"strict":"non-strict") << "\n";
|
||||
tout << (is_lower?"is-lower":"is-upper") << "\n";
|
||||
tout << "a: " << a << " " << mk_pp(t, m) << "\n";
|
||||
|
@ -2291,7 +2291,7 @@ public:
|
|||
rational const& a, expr* t,
|
||||
expr_ref& result)
|
||||
{
|
||||
TRACE("qe", tout << mk_pp(t, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(t, m) << "\n";);
|
||||
SASSERT(!is_eq_ctx || !is_strict_ctx);
|
||||
unsigned sz = bounds.size(is_strict, is_lower);
|
||||
expr_ref tmp(m), eq(m);
|
||||
|
@ -2307,7 +2307,7 @@ public:
|
|||
if (same_strict && i == index) {
|
||||
if (non_strict_real) {
|
||||
m_util.mk_eq(a, x, t, eq);
|
||||
TRACE("qe", tout << "a:" << a << " x: " << mk_pp(x, m) << "t: " <<
|
||||
TRACE(qe, tout << "a:" << a << " x: " << mk_pp(x, m) << "t: " <<
|
||||
mk_pp(t, m) << " eq: " << mk_pp(eq, m) << "\n";);
|
||||
if (is_eq_ctx) {
|
||||
m_ctx.add_constraint(true, eq);
|
||||
|
@ -2340,7 +2340,7 @@ public:
|
|||
mk_bound(result_is_strict, is_lower, a, t, b, s, tmp);
|
||||
m_util.m_replace.apply_substitution(e, tmp.get(), result);
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << (result_is_strict?"strict result":"non-strict result") << "\n";
|
||||
tout << (is_strict?"strict":"non-strict") << "\n";
|
||||
tout << mk_pp(atm, m) << " & ";
|
||||
|
@ -2379,7 +2379,7 @@ public:
|
|||
|
||||
m_ctx.add_constraint(true, mk_not(e), tmp);
|
||||
|
||||
TRACE("qe_verbose",
|
||||
TRACE(qe_verbose,
|
||||
app* atm = bounds.atoms(is_strict_ctx, is_lower)[index];
|
||||
tout << mk_pp(atm, m) << " ";
|
||||
tout << mk_pp(e, m) << " ==>\n";
|
||||
|
@ -2454,7 +2454,7 @@ public:
|
|||
m_trail(m),
|
||||
m_factor_rw(m),
|
||||
m_produce_models(produce_models) {
|
||||
TRACE("qe", tout << "produce models: " << produce_models << "\n";);
|
||||
TRACE(qe, tout << "produce models: " << produce_models << "\n";);
|
||||
m_util.set_enable_linear(true); // (produce_models);
|
||||
}
|
||||
|
||||
|
@ -2485,7 +2485,7 @@ public:
|
|||
expr_ref result(m), tmp(m);
|
||||
m_factor_rw(branch_fml, tmp);
|
||||
m_rewriter(tmp, result);
|
||||
TRACE("qe", tout << vl << " " << mk_pp(result.get(), m) << "\n";);
|
||||
TRACE(qe, tout << vl << " " << mk_pp(result.get(), m) << "\n";);
|
||||
m_ctx.add_constraint(true, result);
|
||||
}
|
||||
|
||||
|
@ -2502,9 +2502,9 @@ public:
|
|||
|
||||
brs = alloc(nlarith::branch_conditions, m);
|
||||
|
||||
TRACE("nlarith", tout << mk_pp(fml, m) << "\n";);
|
||||
TRACE(nlarith, tout << mk_pp(fml, m) << "\n";);
|
||||
if (!m_util.create_branches(x.x(), lits.size(), lits.data(), *brs)) {
|
||||
TRACE("nlarith", tout << "no branches for " << mk_pp(x.x(), m) << "\n";);
|
||||
TRACE(nlarith, tout << "no branches for " << mk_pp(x.x(), m) << "\n";);
|
||||
dealloc(brs);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace qe {
|
|||
expr_ref_vector eqs(m);
|
||||
conjs.extract_equalities(eqs);
|
||||
for (unsigned i = 0; i < eqs.size(); ++i) {
|
||||
TRACE("qe_verbose",
|
||||
TRACE(qe_verbose,
|
||||
tout << mk_pp(eqs[i].get(), m) << "\n";);
|
||||
expr* e = eqs[i].get();
|
||||
if (solve_eq_zero(e, fml)) {
|
||||
|
@ -114,7 +114,7 @@ namespace qe {
|
|||
return false;
|
||||
}
|
||||
|
||||
TRACE("qe_verbose",
|
||||
TRACE(qe_verbose,
|
||||
tout << mk_pp(lhs, m) <<
|
||||
" == " << mk_pp(rhs, m) << "\n";);
|
||||
expr_ref tmp(m);
|
||||
|
@ -172,7 +172,7 @@ namespace qe {
|
|||
|
||||
store_B_i_t = m.mk_app(m_fid, OP_STORE, args2.size(), args2.data());
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "fml: " << mk_pp(fml, m) << "\n";
|
||||
tout << "solved form: " << mk_pp(store_B_i_t, m) << "\n";
|
||||
tout << "eq: " << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << "\n";
|
||||
|
@ -244,7 +244,7 @@ namespace qe {
|
|||
m_ctx.add_var(w);
|
||||
}
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "Variable: " << mk_pp(A, m) << "\n";
|
||||
tout << "fml: " << mk_pp(fml, m) << "\n";
|
||||
tout << "solved form: " << mk_pp(store_t, m) << "\n";
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace qe {
|
|||
expr_ref val_x(m);
|
||||
rational val;
|
||||
model_eval(x.x(), val_x);
|
||||
CTRACE("qe", (!m.is_true(val_x) && !m.is_false(val_x)),
|
||||
CTRACE(qe, (!m.is_true(val_x) && !m.is_false(val_x)),
|
||||
tout << "Boolean is a don't care: " << mk_pp(x.x(), m) << "\n";);
|
||||
val = m.is_true(val_x)?rational::one():rational::zero();
|
||||
subst(x, val, fml, nullptr);
|
||||
|
@ -131,7 +131,7 @@ namespace qe {
|
|||
app* x = contains_x.x();
|
||||
bool p = m_ctx.pos_atoms().contains(x);
|
||||
bool n = m_ctx.neg_atoms().contains(x);
|
||||
TRACE("quant_elim", tout << mk_pp(x, m) << " " << mk_pp(fml, m) << "\n";);
|
||||
TRACE(quant_elim, tout << mk_pp(x, m) << " " << mk_pp(fml, m) << "\n";);
|
||||
if (p && n) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace qe {
|
|||
func_decl* f = a->get_decl();
|
||||
if (m_util.is_recognizer(f) && a->get_arg(0) == x) {
|
||||
m_recognizers.push_back(a);
|
||||
TRACE("qe", tout << "add recognizer:" << mk_pp(a, m) << "\n";);
|
||||
TRACE(qe, tout << "add recognizer:" << mk_pp(a, m) << "\n";);
|
||||
return true;
|
||||
}
|
||||
if (!m.is_eq(a)) {
|
||||
|
@ -222,7 +222,7 @@ namespace qe {
|
|||
}
|
||||
|
||||
void add_atom(app* a, bool is_pos) {
|
||||
TRACE("qe", tout << "add atom:" << mk_pp(a, m) << " " << (is_pos?"pos":"neg") << "\n";);
|
||||
TRACE(qe, tout << "add atom:" << mk_pp(a, m) << " " << (is_pos?"pos":"neg") << "\n";);
|
||||
if (is_pos) {
|
||||
m_eq_atoms.push_back(a);
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ namespace qe {
|
|||
for_each_expr(*this, fml.get());
|
||||
if (m_change) {
|
||||
fml = get_expr(fml.get());
|
||||
TRACE("qe", tout << "lift:\n" << mk_pp(fml.get(), m) << "\n";);
|
||||
TRACE(qe, tout << "lift:\n" << mk_pp(fml.get(), m) << "\n";);
|
||||
}
|
||||
return m_change;
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ namespace qe {
|
|||
}
|
||||
expr* e = m.mk_and(conj.size(), conj.data());
|
||||
m_map.insert(a, e, nullptr);
|
||||
TRACE("qe", tout << "replace: " << mk_pp(a, m) << " ==> \n" << mk_pp(e, m) << "\n";);
|
||||
TRACE(qe, tout << "replace: " << mk_pp(a, m) << " ==> \n" << mk_pp(e, m) << "\n";);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -466,7 +466,7 @@ namespace qe {
|
|||
void assign(contains_app& x, expr* fml, rational const& vl) override {
|
||||
sort* s = x.x()->get_decl()->get_range();
|
||||
SASSERT(m_datatype_util.is_datatype(s));
|
||||
TRACE("qe", tout << mk_pp(x.x(), m) << " " << vl << "\n";);
|
||||
TRACE(qe, tout << mk_pp(x.x(), m) << " " << vl << "\n";);
|
||||
if (m_datatype_util.is_recursive(s)) {
|
||||
assign_rec(x, fml, vl);
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ namespace qe {
|
|||
void subst(contains_app& x, rational const& vl, expr_ref& fml, expr_ref* def) override {
|
||||
sort* s = x.x()->get_decl()->get_range();
|
||||
SASSERT(m_datatype_util.is_datatype(s));
|
||||
TRACE("qe", tout << mk_pp(x.x(), m) << " " << vl << "\n";);
|
||||
TRACE(qe, tout << mk_pp(x.x(), m) << " " << vl << "\n";);
|
||||
if (m_datatype_util.is_recursive(s)) {
|
||||
subst_rec(x, vl, fml, def);
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ namespace qe {
|
|||
num_branches = rational(eqs.num_eqs() + 1);
|
||||
return true;
|
||||
}
|
||||
TRACE("qe", tout << "could not get number of branches " << mk_pp(x.x(), m) << "\n";);
|
||||
TRACE(qe, tout << "could not get number of branches " << mk_pp(x.x(), m) << "\n";);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -667,7 +667,7 @@ namespace qe {
|
|||
SASSERT(m_datatype_util.is_datatype(s));
|
||||
func_decl* c = nullptr, *r = nullptr;
|
||||
|
||||
TRACE("qe", tout << mk_pp(x, m) << " " << vl << " " << mk_pp(fml, m) << " " << (def != 0) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(x, m) << " " << vl << " " << mk_pp(fml, m) << " " << (def != 0) << "\n";);
|
||||
//
|
||||
// Add recognizer to formula.
|
||||
// Introduce auxiliary variable to eliminate.
|
||||
|
@ -681,13 +681,13 @@ namespace qe {
|
|||
m_ctx.add_var(fresh_x);
|
||||
m_replace.apply_substitution(x, fresh_x, fml);
|
||||
add_def(fresh_x, def);
|
||||
TRACE("qe", tout << "Add recognizer " << mk_pp(is_c, m) << "\n";);
|
||||
TRACE(qe, tout << "Add recognizer " << mk_pp(is_c, m) << "\n";);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (has_selector(contains_x, fml, c)) {
|
||||
TRACE("qe", tout << "Eliminate selector " << mk_ll_pp(c, m) << "\n";);
|
||||
TRACE(qe, tout << "Eliminate selector " << mk_ll_pp(c, m) << "\n";);
|
||||
subst_constructor(contains_x, c, fml, def);
|
||||
return;
|
||||
}
|
||||
|
@ -741,7 +741,7 @@ namespace qe {
|
|||
add_def(t, def);
|
||||
}
|
||||
}
|
||||
TRACE("qe", tout << "reduced " << mk_pp(fml.get(), m) << "\n";);
|
||||
TRACE(qe, tout << "reduced " << mk_pp(fml.get(), m) << "\n";);
|
||||
}
|
||||
|
||||
bool get_num_branches_nonrec( contains_app& x, expr* fml, rational& num_branches) {
|
||||
|
@ -751,10 +751,10 @@ namespace qe {
|
|||
func_decl* c = nullptr, *r = nullptr;
|
||||
|
||||
if (sz != 1 && has_recognizer(x.x(), fml, r, c)) {
|
||||
TRACE("qe", tout << mk_pp(x.x(), m) << " has a recognizer\n";);
|
||||
TRACE(qe, tout << mk_pp(x.x(), m) << " has a recognizer\n";);
|
||||
num_branches = rational(1);
|
||||
}
|
||||
TRACE("qe", tout << mk_pp(x.x(), m) << " branches: " << sz << "\n";);
|
||||
TRACE(qe, tout << mk_pp(x.x(), m) << " branches: " << sz << "\n";);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -770,7 +770,7 @@ namespace qe {
|
|||
}
|
||||
func_decl* c = nullptr, *r = nullptr;
|
||||
if (has_recognizer(x, fml, r, c)) {
|
||||
TRACE("qe", tout << mk_pp(x, m) << " has a recognizer\n";);
|
||||
TRACE(qe, tout << mk_pp(x, m) << " has a recognizer\n";);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -789,7 +789,7 @@ namespace qe {
|
|||
SASSERT(!m_datatype_util.is_recursive(s));
|
||||
func_decl* c = nullptr, *r = nullptr;
|
||||
if (has_recognizer(x.x(), fml, r, c)) {
|
||||
TRACE("qe", tout << mk_pp(x.x(), m) << " has a recognizer\n";);
|
||||
TRACE(qe, tout << mk_pp(x.x(), m) << " has a recognizer\n";);
|
||||
}
|
||||
else {
|
||||
SASSERT(vl.is_unsigned());
|
||||
|
|
|
@ -209,14 +209,14 @@ namespace qe {
|
|||
}
|
||||
expr* e1, *e2;
|
||||
if (!m.is_eq(e, e1, e2)) {
|
||||
TRACE("quant_elim", tout << "Cannot handle: " << mk_pp(e, m) << "\n";);
|
||||
TRACE(quant_elim, tout << "Cannot handle: " << mk_pp(e, m) << "\n";);
|
||||
return false;
|
||||
}
|
||||
if (x == e2) {
|
||||
std::swap(e1, e2);
|
||||
}
|
||||
if (contains_x(e2) || x != e1) {
|
||||
TRACE("quant_elim", tout << "Cannot handle: " << mk_pp(e, m) << "\n";);
|
||||
TRACE(quant_elim, tout << "Cannot handle: " << mk_pp(e, m) << "\n";);
|
||||
return false;
|
||||
}
|
||||
if (is_pos) {
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace qe {
|
|||
};
|
||||
intersect_proc symbols_in_b(*this, symbols_in_a.s);
|
||||
quick_for_each_expr(symbols_in_b, marks, b);
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << mk_pp(a, m) << "\n" << mk_pp(b, m) << "\n";
|
||||
for (func_decl* f : m_shared) tout << f->get_name() << " "; tout << "\n";);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ namespace qe {
|
|||
|
||||
mbi_result prop_mbi_plugin::operator()(expr_ref_vector& lits, model_ref& mdl) {
|
||||
lbool r = m_solver->check_sat(lits);
|
||||
TRACE("qe", tout << r << " " << lits << "\n");
|
||||
TRACE(qe, tout << r << " " << lits << "\n");
|
||||
switch (r) {
|
||||
case l_false:
|
||||
lits.reset();
|
||||
|
@ -221,11 +221,11 @@ namespace qe {
|
|||
else if (mdl->is_false(e))
|
||||
lits.push_back(m.mk_not(e));
|
||||
}
|
||||
TRACE("qe", tout << "atoms from model: " << lits << "\n";);
|
||||
TRACE(qe, tout << "atoms from model: " << lits << "\n";);
|
||||
solver_ref dual = m_dual_solver->translate(m, m_dual_solver->get_params());
|
||||
dual->assert_expr(mk_not(mk_and(m_fmls)));
|
||||
lbool r = dual->check_sat(lits);
|
||||
TRACE("qe", dual->display(tout << "dual result " << r << "\n"););
|
||||
TRACE(qe, dual->display(tout << "dual result " << r << "\n"););
|
||||
if (l_false == r) {
|
||||
// use the dual solver to find a 'small' implicant
|
||||
lits.reset();
|
||||
|
@ -263,7 +263,7 @@ namespace qe {
|
|||
}
|
||||
}
|
||||
order_avars(avars);
|
||||
TRACE("qe", tout << "vars: " << avars << " from " << lits << "\n";);
|
||||
TRACE(qe, tout << "vars: " << avars << " from " << lits << "\n";);
|
||||
return avars;
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,7 @@ namespace qe {
|
|||
vector<mbp::def> defs;
|
||||
bool ok = ap.project(*mdl.get(), avars, lits, defs);
|
||||
(void)ok;
|
||||
CTRACE("qe", !ok, tout << "projection failure ignored!!!!\n");
|
||||
CTRACE(qe, !ok, tout << "projection failure ignored!!!!\n");
|
||||
fix_non_shared(*mdl, lits);
|
||||
return defs;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ namespace qe {
|
|||
case l_false:
|
||||
lits.reset();
|
||||
m_solver->get_unsat_core(lits);
|
||||
TRACE("qe", tout << "unsat core: " << lits << "\n";);
|
||||
TRACE(qe, tout << "unsat core: " << lits << "\n";);
|
||||
// optionally minimize core using superposition.
|
||||
return mbi_unsat;
|
||||
case l_true:
|
||||
|
@ -367,7 +367,7 @@ namespace qe {
|
|||
\brief main projection routine
|
||||
*/
|
||||
void uflia_mbi::project(model_ref& mdl, expr_ref_vector& lits) {
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "project literals: " << lits << "\n" << *mdl << "\n";
|
||||
tout << m_solver->get_assertions() << "\n";);
|
||||
|
||||
|
@ -377,13 +377,13 @@ namespace qe {
|
|||
auto avars = get_arith_vars(lits);
|
||||
vector<mbp::def> defs = arith_project(mdl, avars, alits);
|
||||
for (auto const& d : defs) uflits.push_back(m.mk_eq(d.var, d.term));
|
||||
TRACE("qe", tout << "uflits: " << uflits << "\n";);
|
||||
TRACE(qe, tout << "uflits: " << uflits << "\n";);
|
||||
project_euf(mdl, uflits);
|
||||
lits.reset();
|
||||
lits.append(alits);
|
||||
lits.append(uflits);
|
||||
IF_VERBOSE(10, verbose_stream() << "projection : " << lits << "\n");
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "projection: " << lits << "\n";
|
||||
tout << "avars: " << avars << "\n";
|
||||
tout << "alits: " << lits << "\n";
|
||||
|
@ -410,7 +410,7 @@ namespace qe {
|
|||
uflits.push_back(lit);
|
||||
}
|
||||
}
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "alits: " << alits << "\n";
|
||||
tout << "uflits: " << uflits << "\n";);
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ namespace qe {
|
|||
func_decl_ref_vector shared(m_shared_trail);
|
||||
tg.set_vars(shared, false);
|
||||
lits.append(tg.dcert(*mdl.get(), lits));
|
||||
TRACE("qe", tout << "project: " << lits << "\n";);
|
||||
TRACE(qe, tout << "project: " << lits << "\n";);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -479,7 +479,7 @@ namespace qe {
|
|||
tg.add_lits(lits);
|
||||
lits.reset();
|
||||
lits.append(tg.project(*mdl.get()));
|
||||
TRACE("qe", tout << "project: " << lits << "\n";);
|
||||
TRACE(qe, tout << "project: " << lits << "\n";);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -496,14 +496,14 @@ namespace qe {
|
|||
(x->get_depth() == y->get_depth() && x->get_id() > y->get_id());
|
||||
};
|
||||
std::sort(avars.data(), avars.data() + avars.size(), compare_depth);
|
||||
TRACE("qe", tout << "avars:" << avars << "\n";);
|
||||
TRACE(qe, tout << "avars:" << avars << "\n";);
|
||||
}
|
||||
|
||||
void uflia_mbi::block(expr_ref_vector const& lits) {
|
||||
expr_ref clause(mk_not(mk_and(lits)), m);
|
||||
collect_atoms(lits);
|
||||
m_fmls.push_back(clause);
|
||||
TRACE("qe", tout << "block " << lits << "\n";);
|
||||
TRACE(qe, tout << "block " << lits << "\n";);
|
||||
m_solver->assert_expr(clause);
|
||||
}
|
||||
|
||||
|
@ -533,7 +533,7 @@ namespace qe {
|
|||
itp = nullptr;
|
||||
return l_true;
|
||||
}
|
||||
TRACE("mbi", tout << "new lits " << lits << "\n";);
|
||||
TRACE(mbi, tout << "new lits " << lits << "\n";);
|
||||
break; // continue
|
||||
case mbi_unsat: {
|
||||
if (lits.empty()) {
|
||||
|
@ -544,7 +544,7 @@ namespace qe {
|
|||
}
|
||||
t2->block(lits);
|
||||
expr_ref lemma(mk_not(mk_and(lits)));
|
||||
TRACE("mbi", tout << lemma << "\n";);
|
||||
TRACE(mbi, tout << lemma << "\n";);
|
||||
blocks[turn].push_back(lemma);
|
||||
itp = m.mk_implies(mk_and(blocks[!turn]), lemma);
|
||||
// TBD: compute closure over variables not in vars
|
||||
|
@ -600,7 +600,7 @@ namespace qe {
|
|||
th_rewriter rewrite(m);
|
||||
rewrite(a);
|
||||
rewrite(b);
|
||||
TRACE("interpolator", tout << a << " " << b << "\n");
|
||||
TRACE(interpolator, tout << a << " " << b << "\n");
|
||||
solver_ref sA = sf(m, p, false /* no proofs */, true, true, symbol::null);
|
||||
solver_ref sB = sf(m, p, false /* no proofs */, true, true, symbol::null);
|
||||
solver_ref sNotA = sf(m, p, false /* no proofs */, true, true, symbol::null);
|
||||
|
|
|
@ -249,7 +249,7 @@ class mbproj::impl {
|
|||
sub(fml, val);
|
||||
m_rw(val);
|
||||
if (!m.is_true(val)) {
|
||||
TRACE("qe", tout << mk_pp(fml, m) << " -> " << val << "\n";);
|
||||
TRACE(qe, tout << mk_pp(fml, m) << " -> " << val << "\n";);
|
||||
fmls[j++] = val;
|
||||
}
|
||||
}
|
||||
|
@ -295,22 +295,22 @@ class mbproj::impl {
|
|||
bool project_var(model_evaluator& eval, app* var, expr_ref& fml) {
|
||||
expr_ref val = eval(var);
|
||||
|
||||
TRACE("mbqi_project_verbose", tout << "MBQI: var: " << mk_pp(var, m) << "\n" << "fml: " << fml << "\n";);
|
||||
TRACE(mbqi_project_verbose, tout << "MBQI: var: " << mk_pp(var, m) << "\n" << "fml: " << fml << "\n";);
|
||||
expr_ref_vector terms(m);
|
||||
index_term_finder finder(m, var, terms);
|
||||
for_each_expr(finder, fml);
|
||||
|
||||
TRACE("mbqi_project_verbose", tout << "terms:\n" << terms;);
|
||||
TRACE(mbqi_project_verbose, tout << "terms:\n" << terms;);
|
||||
|
||||
for (expr* term : terms) {
|
||||
expr_ref tval = eval(term);
|
||||
|
||||
TRACE("mbqi_project_verbose", tout << "term: " << mk_pp(term, m) << " tval: " << tval << " val: " << val << "\n";);
|
||||
TRACE(mbqi_project_verbose, tout << "term: " << mk_pp(term, m) << " tval: " << tval << " val: " << val << "\n";);
|
||||
|
||||
// -- if the term does not contain an occurrence of var
|
||||
// -- and is in the same equivalence class in the model
|
||||
if (tval == val && !occurs(var, term)) {
|
||||
TRACE("mbqi_project",
|
||||
TRACE(mbqi_project,
|
||||
tout << "MBQI: replacing " << mk_pp(var, m) << " with " << mk_pp(term, m) << "\n";);
|
||||
expr_safe_replace sub(m);
|
||||
sub.insert(var, term);
|
||||
|
@ -319,7 +319,7 @@ class mbproj::impl {
|
|||
}
|
||||
}
|
||||
|
||||
TRACE("mbqi_project",
|
||||
TRACE(mbqi_project,
|
||||
tout << "MBQI: failed to eliminate " << mk_pp(var, m) << " from " << fml << "\n";);
|
||||
|
||||
return false;
|
||||
|
@ -434,11 +434,11 @@ public:
|
|||
fmls.reset();
|
||||
flatten_and(fml, fmls);
|
||||
m_dont_sub = dsub;
|
||||
TRACE("qe", tout << "spacer-qel " << vars << " " << fml << "\n");
|
||||
TRACE(qe, tout << "spacer-qel " << vars << " " << fml << "\n");
|
||||
}
|
||||
else {
|
||||
mbp(force_elim, vars, model, fmls, defs);
|
||||
TRACE("qe", tout << "mbp " << vars << " " << fmls << "\n";
|
||||
TRACE(qe, tout << "mbp " << vars << " " << fmls << "\n";
|
||||
if (defs) { tout << "defs: "; for (auto const& d : *defs) tout << d << "\n"; tout << "\n";});
|
||||
}
|
||||
}
|
||||
|
@ -449,12 +449,12 @@ public:
|
|||
app_ref var(m);
|
||||
expr_ref_vector unused_fmls(m);
|
||||
bool progress = true;
|
||||
TRACE("qe", tout << "eliminate vars: " << vars << "fmls: " << fmls << "\n");
|
||||
TRACE(qe, tout << "eliminate vars: " << vars << "fmls: " << fmls << "\n");
|
||||
if (!defs)
|
||||
preprocess_solve(model, vars, fmls);
|
||||
filter_variables(model, vars, fmls, unused_fmls);
|
||||
project_bools(model, vars, fmls);
|
||||
TRACE("qe", tout << "eliminate vars: " << vars << "\nfmls: " << fmls << "\nunused: " << unused_fmls <<"\n");
|
||||
TRACE(qe, tout << "eliminate vars: " << vars << "\nfmls: " << fmls << "\nunused: " << unused_fmls <<"\n");
|
||||
while (progress && !vars.empty() && !fmls.empty() && m.limit().inc()) {
|
||||
app_ref_vector new_vars(m);
|
||||
progress = false;
|
||||
|
@ -463,12 +463,12 @@ public:
|
|||
unsigned sz = defs->size();
|
||||
p->project(model, vars, fmls, *defs);
|
||||
progress |= sz < defs->size();
|
||||
TRACE("qe", tout << "after project " << m.get_family_name(p->get_family_id()) << ": " << vars << "\n");
|
||||
TRACE(qe, tout << "after project " << m.get_family_name(p->get_family_id()) << ": " << vars << "\n");
|
||||
}
|
||||
else if (p)
|
||||
(*p)(model, vars, fmls);
|
||||
}
|
||||
TRACE("qe", tout << "projecting " << vars << "\n");
|
||||
TRACE(qe, tout << "projecting " << vars << "\n");
|
||||
while (!vars.empty() && !fmls.empty() && !defs && m.limit().inc()) {
|
||||
var = vars.back();
|
||||
vars.pop_back();
|
||||
|
@ -503,7 +503,7 @@ public:
|
|||
vars.append(new_vars);
|
||||
if (progress && !defs)
|
||||
preprocess_solve(model, vars, fmls);
|
||||
TRACE("qe", tout << "looping " << vars << "\n");
|
||||
TRACE(qe, tout << "looping " << vars << "\n");
|
||||
|
||||
}
|
||||
if (fmls.empty()) {
|
||||
|
@ -511,14 +511,14 @@ public:
|
|||
}
|
||||
fmls.append(unused_fmls);
|
||||
SASSERT(validate_model(model, fmls));
|
||||
TRACE("qe", tout << "vars: " << vars << "\nfmls: " << fmls << "\n";);
|
||||
TRACE(qe, tout << "vars: " << vars << "\nfmls: " << fmls << "\n";);
|
||||
}
|
||||
|
||||
void do_qe_lite(app_ref_vector& vars, expr_ref& fml) {
|
||||
qe_lite qe(m, m_params, false);
|
||||
qe(vars, fml);
|
||||
m_rw(fml);
|
||||
TRACE("qe", tout << "After qe_lite:\n" << fml << "\n" << "Vars: " << vars << "\n";);
|
||||
TRACE(qe, tout << "After qe_lite:\n" << fml << "\n" << "Vars: " << vars << "\n";);
|
||||
SASSERT(!m.is_false(fml));
|
||||
}
|
||||
|
||||
|
@ -527,7 +527,7 @@ public:
|
|||
qel qe(m, m_params);
|
||||
qe(vars, fml);
|
||||
m_rw(fml);
|
||||
TRACE("qe", tout << "After qel:\n"
|
||||
TRACE(qe, tout << "After qel:\n"
|
||||
<< fml << "\n"
|
||||
<< "Vars: " << vars << "\n";);
|
||||
SASSERT(!m.is_false(fml));
|
||||
|
@ -546,13 +546,13 @@ public:
|
|||
mbptg(vars, fml, mdl);
|
||||
if (reduce_all_selects) rewrite_read_over_write(fml, mdl, fml);
|
||||
m_rw(fml);
|
||||
TRACE("qe", tout << "After mbp_tg:\n"
|
||||
TRACE(qe, tout << "After mbp_tg:\n"
|
||||
<< fml << " models " << mdl.is_true(fml) << "\n"
|
||||
<< "Vars: " << vars << "\n";);
|
||||
}
|
||||
|
||||
void spacer_qel(app_ref_vector& vars, model& mdl, expr_ref& fml) {
|
||||
TRACE("qe", tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";);
|
||||
TRACE(qe, tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";);
|
||||
|
||||
model_evaluator eval(mdl, m_params);
|
||||
eval.set_model_completion(true);
|
||||
|
@ -575,7 +575,7 @@ public:
|
|||
|
||||
// project reals, ints and other variables.
|
||||
if (!other_vars.empty()) {
|
||||
TRACE("qe", tout << "Other vars: " << other_vars << "\n" << mdl;);
|
||||
TRACE(qe, tout << "Other vars: " << other_vars << "\n" << mdl;);
|
||||
|
||||
expr_ref_vector fmls(m);
|
||||
flatten_and(fml, fmls);
|
||||
|
@ -584,7 +584,7 @@ public:
|
|||
fml = mk_and(fmls);
|
||||
m_rw(fml);
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "Projected other vars:\n" << fml << "\n";
|
||||
tout << "Remaining other vars:\n" << other_vars << "\n";);
|
||||
SASSERT(!m.is_false(fml));
|
||||
|
@ -598,7 +598,7 @@ public:
|
|||
// substitute any remaining other vars
|
||||
if (!m_dont_sub && !other_vars.empty()) {
|
||||
subst_vars(eval, other_vars, fml);
|
||||
TRACE("qe", tout << "After substituting remaining other vars:\n" << fml << "\n";);
|
||||
TRACE(qe, tout << "After substituting remaining other vars:\n" << fml << "\n";);
|
||||
// an extra round of simplification because subst_vars is not simplifying
|
||||
m_rw(fml);
|
||||
other_vars.reset();
|
||||
|
@ -611,7 +611,7 @@ public:
|
|||
}
|
||||
|
||||
void spacer(app_ref_vector& vars, model& mdl, expr_ref& fml) {
|
||||
TRACE("qe", tout << "spacer " << m_use_qel << " " << fml << " " << vars << "\n");
|
||||
TRACE(qe, tout << "spacer " << m_use_qel << " " << fml << " " << vars << "\n");
|
||||
if (m_use_qel)
|
||||
spacer_qel(vars, mdl, fml);
|
||||
else
|
||||
|
@ -619,7 +619,7 @@ public:
|
|||
}
|
||||
|
||||
void spacer_qe_lite(app_ref_vector& vars, model& mdl, expr_ref& fml) {
|
||||
TRACE("qe", tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";);
|
||||
TRACE(qe, tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";);
|
||||
|
||||
model_evaluator eval(mdl, m_params);
|
||||
eval.set_model_completion(true);
|
||||
|
@ -646,7 +646,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
TRACE("qe", tout << "Array vars: " << array_vars << "\n";);
|
||||
TRACE(qe, tout << "Array vars: " << array_vars << "\n";);
|
||||
|
||||
vars.reset();
|
||||
|
||||
|
@ -657,14 +657,14 @@ public:
|
|||
m_rw(fml);
|
||||
SASSERT(!m.is_false(fml));
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "extended model:\n" << mdl;
|
||||
tout << "Vars: " << vars << "\n";);
|
||||
}
|
||||
|
||||
// project reals, ints and other variables.
|
||||
if (!other_vars.empty()) {
|
||||
TRACE("qe", tout << "Other vars: " << other_vars << "\n" << mdl;);
|
||||
TRACE(qe, tout << "Other vars: " << other_vars << "\n" << mdl;);
|
||||
|
||||
expr_ref_vector fmls(m);
|
||||
flatten_and(fml, fmls);
|
||||
|
@ -673,7 +673,7 @@ public:
|
|||
fml = mk_and(fmls);
|
||||
m_rw(fml);
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "Projected other vars:\n" << fml << "\n";
|
||||
tout << "Remaining other vars:\n" << other_vars << "\n";);
|
||||
SASSERT(!m.is_false(fml));
|
||||
|
@ -687,7 +687,7 @@ public:
|
|||
// substitute any remaining other vars
|
||||
if (!m_dont_sub && !other_vars.empty()) {
|
||||
subst_vars(eval, other_vars, fml);
|
||||
TRACE("qe", tout << "After substituting remaining other vars:\n" << fml << "\n";);
|
||||
TRACE(qe, tout << "After substituting remaining other vars:\n" << fml << "\n";);
|
||||
// an extra round of simplification because subst_vars is not simplifying
|
||||
m_rw(fml);
|
||||
other_vars.reset();
|
||||
|
|
|
@ -164,7 +164,7 @@ namespace qe {
|
|||
}
|
||||
model_evaluator eval(*mdl);
|
||||
eval.set_model_completion(true);
|
||||
TRACE("qe_assumptions", model_v2_pp(tout, *mdl););
|
||||
TRACE(qe_assumptions, model_v2_pp(tout, *mdl););
|
||||
|
||||
expr_ref val(m);
|
||||
for (unsigned i = 0; i <= level-1; ++i) {
|
||||
|
@ -204,7 +204,7 @@ namespace qe {
|
|||
}
|
||||
}
|
||||
}
|
||||
TRACE("qe_assumptions", tout << "level: " << level << "\n";
|
||||
TRACE(qe_assumptions, tout << "level: " << level << "\n";
|
||||
model_v2_pp(tout, *mdl);
|
||||
display(tout, asms););
|
||||
}
|
||||
|
@ -251,13 +251,13 @@ namespace qe {
|
|||
|
||||
mark.mark(a);
|
||||
if (m_lit2pred.find(a, p)) {
|
||||
TRACE("qe", tout << mk_pp(a, m) << " " << mk_pp(p, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(a, m) << " " << mk_pp(p, m) << "\n";);
|
||||
level.merge(m_elevel.find(p));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_uninterp_const(a) && m.is_bool(a)) {
|
||||
TRACE("qe", tout << mk_pp(a, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(a, m) << "\n";);
|
||||
l = m_elevel.find(a);
|
||||
level.merge(l);
|
||||
if (!m_pred2lit.contains(a)) {
|
||||
|
@ -277,7 +277,7 @@ namespace qe {
|
|||
(!m.is_distinct(a) || a->get_num_args() == 0 || m.is_bool(a->get_arg(0)));
|
||||
|
||||
if (!is_boolop && m.is_bool(a)) {
|
||||
TRACE("qe", tout << mk_pp(a, m) << "\n";);
|
||||
TRACE(qe, tout << mk_pp(a, m) << "\n";);
|
||||
r = fresh_bool("p");
|
||||
max_level l = compute_level(a);
|
||||
add_pred(r, a);
|
||||
|
@ -356,7 +356,7 @@ namespace qe {
|
|||
app *b;
|
||||
expr *c, *d;
|
||||
max_level lvl2;
|
||||
TRACE("qe", tout << mk_pp(a, m) << " " << lvl << "\n";);
|
||||
TRACE(qe, tout << mk_pp(a, m) << " " << lvl << "\n";);
|
||||
if (m_asm2pred.find(a, b))
|
||||
q = b;
|
||||
else if (m.is_not(a, c) && m_asm2pred.find(c, b))
|
||||
|
@ -384,7 +384,7 @@ namespace qe {
|
|||
fml = mk_abstract(fml);
|
||||
defs.push_back(m.mk_eq(p, fml));
|
||||
add_asm(p, a);
|
||||
TRACE("qe", tout << mk_pp(a, m) << " |-> " << p << "\n";);
|
||||
TRACE(qe, tout << mk_pp(a, m) << " |-> " << p << "\n";);
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ namespace qe {
|
|||
val_b = model(b);
|
||||
if ((m.is_true(val_a) && m.is_false(val_b)) ||
|
||||
(m.is_false(val_a) && m.is_true(val_b))) {
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << model << "\n";
|
||||
tout << mk_pp(a, m) << " := " << val_a << "\n";
|
||||
tout << mk_pp(b, m) << " := " << val_b << "\n";
|
||||
|
@ -585,7 +585,7 @@ namespace qe {
|
|||
void get_core(expr_ref_vector& core) {
|
||||
core.reset();
|
||||
m_solver->get_unsat_core(core);
|
||||
TRACE("qe_core", m_solver->display(tout << "core: " << core << "\n") << "\n";);
|
||||
TRACE(qe_core, m_solver->display(tout << "core: " << core << "\n") << "\n";);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -636,26 +636,26 @@ namespace qe {
|
|||
while (true) {
|
||||
++m_stats.m_num_rounds;
|
||||
IF_VERBOSE(1, verbose_stream() << "(check-qsat level: " << m_level << " round: " << m_stats.m_num_rounds << ")\n";);
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "level: " << m_level << " round: " << m_stats.m_num_rounds << "\n");
|
||||
check_cancel();
|
||||
expr_ref_vector asms(m_asms);
|
||||
m_pred_abs.get_assumptions(m_model.get(), asms);
|
||||
if (m_model.get())
|
||||
validate_assumptions(*m_model.get(), asms);
|
||||
TRACE("qe", tout << asms << "\n";);
|
||||
TRACE(qe, tout << asms << "\n";);
|
||||
solver& s = get_kernel(m_level).s();
|
||||
lbool res = s.check_sat(asms);
|
||||
switch (res) {
|
||||
case l_true:
|
||||
s.get_model(m_model);
|
||||
CTRACE("qe", !m_model, tout << "no model\n");
|
||||
CTRACE(qe, !m_model, tout << "no model\n");
|
||||
if (!m_model)
|
||||
return l_undef;
|
||||
SASSERT(validate_defs("check_sat"));
|
||||
SASSERT(!m_model.get() || validate_assumptions(*m_model.get(), asms));
|
||||
SASSERT(validate_model(asms));
|
||||
TRACE("qe", s.display(tout); display(tout << "\n", *m_model.get()); display(tout, asms); );
|
||||
TRACE(qe, s.display(tout); display(tout << "\n", *m_model.get()); display(tout, asms); );
|
||||
if (m_level == 0)
|
||||
m_model_save = m_model;
|
||||
push();
|
||||
|
@ -689,7 +689,7 @@ namespace qe {
|
|||
}
|
||||
break;
|
||||
case l_undef:
|
||||
TRACE("qe", tout << "check-sat is undef\n");
|
||||
TRACE(qe, tout << "check-sat is undef\n");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ namespace qe {
|
|||
while (!vars.empty());
|
||||
SASSERT(m_vars.back().empty());
|
||||
initialize_levels();
|
||||
TRACE("qe", tout << fml << "\n";);
|
||||
TRACE(qe, tout << fml << "\n";);
|
||||
}
|
||||
|
||||
void check_sort(sort* s) {
|
||||
|
@ -817,7 +817,7 @@ namespace qe {
|
|||
|
||||
bool validate_defs(char const* msg) {
|
||||
if (m_model.get() && !m_pred_abs.validate_defs(*m_model.get())) {
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << msg << "\n";
|
||||
display(tout);
|
||||
if (m_level > 0) {
|
||||
|
@ -843,7 +843,7 @@ namespace qe {
|
|||
|
||||
bool minimize_core(expr_ref_vector& core, unsigned level) {
|
||||
expr_ref_vector core1(m), core2(m), dels(m);
|
||||
TRACE("qe", tout << core.size() << "\n";);
|
||||
TRACE(qe, tout << core.size() << "\n";);
|
||||
mus mus(get_kernel(level).s());
|
||||
for (expr* arg : core) {
|
||||
app* a = to_app(arg);
|
||||
|
@ -857,12 +857,12 @@ namespace qe {
|
|||
mus.add_assumption(a);
|
||||
}
|
||||
}
|
||||
TRACE("qe", tout << core1.size() << " " << core2.size() << "\n";);
|
||||
TRACE(qe, tout << core1.size() << " " << core2.size() << "\n";);
|
||||
if (core1.size() > 8) {
|
||||
if (l_true != mus.get_mus(core2)) {
|
||||
return false;
|
||||
}
|
||||
TRACE("qe", tout << core1.size() << " -> " << core2.size() << "\n";);
|
||||
TRACE(qe, tout << core1.size() << " -> " << core2.size() << "\n";);
|
||||
core.reset();
|
||||
core.append(core2);
|
||||
}
|
||||
|
@ -927,7 +927,7 @@ namespace qe {
|
|||
|
||||
bool project(expr_ref_vector& core) {
|
||||
get_core(core, m_level);
|
||||
TRACE("qe", display(tout); display(tout << "core\n", core););
|
||||
TRACE(qe, display(tout); display(tout << "core\n", core););
|
||||
SASSERT(m_level >= 2);
|
||||
expr_ref fml(m);
|
||||
expr_ref_vector defs(m), core_save(m);
|
||||
|
@ -937,7 +937,7 @@ namespace qe {
|
|||
SASSERT(validate_project(mdl, core));
|
||||
mdl.set_inline();
|
||||
m_mbp(force_elim(), m_avars, mdl, core);
|
||||
TRACE("qe", tout << "aux vars: " << m_avars << "\n";);
|
||||
TRACE(qe, tout << "aux vars: " << m_avars << "\n";);
|
||||
for (app* v : m_avars) m_pred_abs.ensure_expr_level(v, m_level-1);
|
||||
m_free_vars.append(m_avars);
|
||||
fml = negate_core(core);
|
||||
|
@ -952,7 +952,7 @@ namespace qe {
|
|||
}
|
||||
else if (level.max() + 2 > m_level) {
|
||||
// fishy - this can happen.
|
||||
TRACE("qe", tout << "max-level: " << level.max() << " level: " << m_level << "\n");
|
||||
TRACE(qe, tout << "max-level: " << level.max() << " level: " << m_level << "\n");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
@ -964,13 +964,13 @@ namespace qe {
|
|||
}
|
||||
|
||||
pop(num_scopes);
|
||||
TRACE("qe", tout << "backtrack: " << num_scopes << " new level: " << m_level << "\nproject:\n" << core << "\n|->\n" << fml << "\n";);
|
||||
TRACE(qe, tout << "backtrack: " << num_scopes << " new level: " << m_level << "\nproject:\n" << core << "\n|->\n" << fml << "\n";);
|
||||
if (m_level == 0 && m_mode != qsat_sat) {
|
||||
add_assumption(fml);
|
||||
}
|
||||
else {
|
||||
fml = m_pred_abs.mk_abstract(fml);
|
||||
TRACE("qe_block", tout << "Blocking fml at level: " << m_level << "\n" << fml << "\n";);
|
||||
TRACE(qe_block, tout << "Blocking fml at level: " << m_level << "\n" << fml << "\n";);
|
||||
get_kernel(m_level).assert_blocking_fml(fml);
|
||||
}
|
||||
SASSERT(!m_model.get());
|
||||
|
@ -1044,13 +1044,13 @@ namespace qe {
|
|||
bool is_fa = ::is_forall(q);
|
||||
tmp = q->get_expr();
|
||||
extract_vars(q, tmp, vars);
|
||||
TRACE("qe", tout << vars << " " << mk_pp(q, m) << " " << tmp << "\n";);
|
||||
TRACE(qe, tout << vars << " " << mk_pp(q, m) << " " << tmp << "\n";);
|
||||
tmp = elim_rec(tmp);
|
||||
if (is_fa) {
|
||||
tmp = ::push_not(tmp);
|
||||
}
|
||||
|
||||
TRACE("qe", tout << "elim-rec " << tmp << "\n";);
|
||||
TRACE(qe, tout << "elim-rec " << tmp << "\n";);
|
||||
tmp = elim(vars, tmp);
|
||||
if (!tmp) {
|
||||
visited.insert(e, e);
|
||||
|
@ -1061,7 +1061,7 @@ namespace qe {
|
|||
tmp = ::push_not(tmp);
|
||||
}
|
||||
trail.push_back(tmp);
|
||||
TRACE("qe", tout << tmp << "\n";);
|
||||
TRACE(qe, tout << tmp << "\n";);
|
||||
visited.insert(e, tmp);
|
||||
todo.pop_back();
|
||||
break;
|
||||
|
@ -1080,7 +1080,7 @@ namespace qe {
|
|||
*/
|
||||
expr_ref elim(app_ref_vector& vars, expr* _fml) {
|
||||
expr_ref fml(_fml, m);
|
||||
TRACE("qe", tout << vars << ": " << fml << "\n";);
|
||||
TRACE(qe, tout << vars << ": " << fml << "\n";);
|
||||
expr_ref_vector defs(m);
|
||||
if (has_quantifiers(fml)) {
|
||||
return expr_ref(m);
|
||||
|
@ -1098,7 +1098,7 @@ namespace qe {
|
|||
m_fa.assert_expr(mk_and(defs));
|
||||
m_ex.assert_expr(fml);
|
||||
m_fa.assert_expr(m.mk_not(fml));
|
||||
TRACE("qe", tout << "ex: " << fml << "\n";);
|
||||
TRACE(qe, tout << "ex: " << fml << "\n";);
|
||||
lbool is_sat = check_sat();
|
||||
|
||||
unsigned j = 0;
|
||||
|
@ -1121,7 +1121,7 @@ namespace qe {
|
|||
bool validate_assumptions(model& mdl, expr_ref_vector const& core) {
|
||||
for (expr* c : core) {
|
||||
if (!mdl.is_true(c)) {
|
||||
TRACE("qe", tout << "component of core is not true: " << mk_pp(c, m) << "\n";
|
||||
TRACE(qe, tout << "component of core is not true: " << mk_pp(c, m) << "\n";
|
||||
tout << mdl << "\n";);
|
||||
if (mdl.is_false(c)) {
|
||||
return false;
|
||||
|
@ -1134,7 +1134,7 @@ namespace qe {
|
|||
bool validate_core(model& mdl, expr_ref_vector const& core) {
|
||||
return true;
|
||||
#if 0
|
||||
TRACE("qe", tout << "Validate core\n";);
|
||||
TRACE(qe, tout << "Validate core\n";);
|
||||
solver& s = get_kernel(m_level).s();
|
||||
expr_ref_vector fmls(m);
|
||||
fmls.append(core.size(), core.c_ptr());
|
||||
|
@ -1150,7 +1150,7 @@ namespace qe {
|
|||
solver.assert_expr(fmls[i]);
|
||||
}
|
||||
lbool is_sat = solver.check();
|
||||
CTRACE("qe", is_sat != l_false,
|
||||
CTRACE(qe, is_sat != l_false,
|
||||
tout << fmls << "\nare not unsat\n";);
|
||||
return (is_sat == l_false) || !m.inc();
|
||||
}
|
||||
|
@ -1158,7 +1158,7 @@ namespace qe {
|
|||
bool validate_model(expr_ref_vector const& asms) {
|
||||
return true;
|
||||
#if 0
|
||||
TRACE("qe", tout << "Validate model\n";);
|
||||
TRACE(qe, tout << "Validate model\n";);
|
||||
solver& s = get_kernel(m_level).s();
|
||||
expr_ref_vector fmls(m);
|
||||
s.get_assertions(fmls);
|
||||
|
@ -1172,7 +1172,7 @@ namespace qe {
|
|||
expr_ref val(m);
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
if (!m_model->is_true(fmls[i]) && m.inc()) {
|
||||
TRACE("qe", tout << "Formula does not evaluate to true in model: " << mk_pp(fmls[i], m) << "\n";);
|
||||
TRACE(qe, tout << "Formula does not evaluate to true in model: " << mk_pp(fmls[i], m) << "\n";);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1189,18 +1189,18 @@ namespace qe {
|
|||
bool validate_project(model& mdl, expr_ref_vector const& core) {
|
||||
return true;
|
||||
#if 0
|
||||
TRACE("qe", tout << "Validate projection\n";);
|
||||
TRACE(qe, tout << "Validate projection\n";);
|
||||
if (!validate_model(mdl, core.size(), core.c_ptr())) return false;
|
||||
|
||||
expr_ref_vector proj(core);
|
||||
app_ref_vector vars(m_avars);
|
||||
m_mbp(false, vars, mdl, proj);
|
||||
if (!vars.empty()) {
|
||||
TRACE("qe", tout << "Not validating partial projection\n";);
|
||||
TRACE(qe, tout << "Not validating partial projection\n";);
|
||||
return true;
|
||||
}
|
||||
if (!validate_model(mdl, proj.size(), proj.c_ptr())) {
|
||||
TRACE("qe", tout << "Projection is false in model\n";);
|
||||
TRACE(qe, tout << "Projection is false in model\n";);
|
||||
return false;
|
||||
}
|
||||
if (!m.inc()) {
|
||||
|
@ -1209,7 +1209,7 @@ namespace qe {
|
|||
for (unsigned i = 0; i < m_avars.size(); ++i) {
|
||||
contains_app cont(m, m_avars.get(i));
|
||||
if (cont(proj)) {
|
||||
TRACE("qe", tout << "Projection contains free variable: " << mk_pp(m_avars.get(i), m) << "\n";);
|
||||
TRACE(qe, tout << "Projection contains free variable: " << mk_pp(m_avars.get(i), m) << "\n";);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1229,7 +1229,7 @@ namespace qe {
|
|||
}
|
||||
fmls.push_back(m.mk_not(mk_and(proj)));
|
||||
if (!check_fmls(fmls)) {
|
||||
TRACE("qe", tout << "implication check failed, could be due to turning != into >\n";);
|
||||
TRACE(qe, tout << "implication check failed, could be due to turning != into >\n";);
|
||||
}
|
||||
return true;
|
||||
#endif
|
||||
|
@ -1288,7 +1288,7 @@ namespace qe {
|
|||
// fail if cores. (TBD)
|
||||
// fail if proofs. (TBD)
|
||||
|
||||
TRACE("qe", tout << fml << "\n";);
|
||||
TRACE(qe, tout << fml << "\n";);
|
||||
|
||||
if (m_mode == qsat_qe_rec) {
|
||||
fml = elim_rec(fml);
|
||||
|
@ -1313,7 +1313,7 @@ namespace qe {
|
|||
m_fa.assert_expr(mk_and(defs));
|
||||
m_ex.assert_expr(fml);
|
||||
m_fa.assert_expr(m.mk_not(fml));
|
||||
TRACE("qe", tout << "ex: " << fml << "\n";);
|
||||
TRACE(qe, tout << "ex: " << fml << "\n";);
|
||||
lbool is_sat = check_sat();
|
||||
switch (is_sat) {
|
||||
case l_false:
|
||||
|
@ -1421,7 +1421,7 @@ namespace qe {
|
|||
void maximize_core(expr_ref_vector const& core, model& mdl) {
|
||||
SASSERT(m_value);
|
||||
SASSERT(m_objective);
|
||||
TRACE("qe", tout << "maximize: " << core << "\n";);
|
||||
TRACE(qe, tout << "maximize: " << core << "\n";);
|
||||
m_was_sat |= !core.empty();
|
||||
expr_ref bound(m);
|
||||
*m_value = m_value_save;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue