Skip to content

Commit f4eaa6f

Browse files
improve logging
Signed-off-by: Nikolaj Bjorner <[email protected]>
1 parent 683070a commit f4eaa6f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/nlsat/nlsat_solver.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -916,15 +916,20 @@ namespace nlsat {
916916
}
917917

918918
void log_lemma(std::ostream& out, unsigned n, literal const* cls, bool is_valid) {
919+
++m_lemma_count;
920+
out << "(set-logic NRA)\n";
919921
if (is_valid) {
920922
display_smt2_bool_decls(out);
921923
display_smt2_arith_decls(out);
922924
}
923925
else
924926
display_smt2(out);
925-
display_smt2(out << "(assert (not ", n, cls) << "))\n";
927+
for (unsigned i = 0; i < n; ++i)
928+
display_smt2(out << "(assert ", ~cls[i]) << ")\n";
926929
display(out << "(echo \"#" << m_lemma_count << " ", n, cls) << "\")\n";
927930
out << "(check-sat)\n(reset)\n";
931+
932+
TRACE("nlsat", display(tout << "(echo \"#" << m_lemma_count << " ", n, cls) << "\")\n");
928933
}
929934

930935
clause * mk_clause_core(unsigned num_lits, literal const * lits, bool learned, _assumption_set a) {
@@ -941,10 +946,9 @@ namespace nlsat {
941946
clause * mk_clause(unsigned num_lits, literal const * lits, bool learned, _assumption_set a) {
942947
SASSERT(num_lits > 0);
943948
clause * cls = mk_clause_core(num_lits, lits, learned, a);
944-
++m_lemma_count;
945949
TRACE("nlsat_sort", display(tout << "mk_clause:\n", *cls) << "\n";);
946950
std::sort(cls->begin(), cls->end(), lit_lt(*this));
947-
TRACE("nlsat_sort", display(tout << "#" << m_lemma_count << " after sort:\n", *cls) << "\n";);
951+
TRACE("nlsat", display(tout << " after sort:\n", *cls) << "\n";);
948952
if (learned && m_log_lemmas) {
949953
log_lemma(verbose_stream(), *cls);
950954
}
@@ -2100,6 +2104,9 @@ namespace nlsat {
21002104
if (m_check_lemmas) {
21012105
check_lemma(m_lemma.size(), m_lemma.data(), false, m_lemma_assumptions.get());
21022106
}
2107+
2108+
if (m_log_lemmas)
2109+
log_lemma(verbose_stream(), m_lemma.size(), m_lemma.data(), false);
21032110

21042111
// There are two possibilities:
21052112
// 1) m_lemma contains only literals from previous stages, and they

0 commit comments

Comments
 (0)