3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-25 15:23:41 +00:00

track clause name for debugging

This commit is contained in:
Jakob Rath 2023-01-11 10:29:20 +01:00
parent 1d349fb0e6
commit fa036ae486
3 changed files with 15 additions and 4 deletions

View file

@ -37,6 +37,7 @@ namespace polysat {
out << " \\/ "; out << " \\/ ";
out << lit; out << lit;
} }
out << " (" << (name() ? name() : "<null>") << ")";
return out; return out;
} }

View file

@ -36,6 +36,7 @@ namespace polysat {
unsigned m_ref_count = 0; // TODO: remove refcount once we confirm it's not needed anymore unsigned m_ref_count = 0; // TODO: remove refcount once we confirm it's not needed anymore
bool m_redundant = redundant_default; bool m_redundant = redundant_default;
sat::literal_vector m_literals; sat::literal_vector m_literals;
char const* m_name = "";
/* TODO: embed literals to save an indirection? /* TODO: embed literals to save an indirection?
@ -64,6 +65,9 @@ namespace polysat {
sat::literal operator[](unsigned idx) const { return m_literals[idx]; } sat::literal operator[](unsigned idx) const { return m_literals[idx]; }
sat::literal& operator[](unsigned idx) { return m_literals[idx]; } sat::literal& operator[](unsigned idx) { return m_literals[idx]; }
sat::literal_vector& literals() { return m_literals; }
sat::literal_vector const& literals() const { return m_literals; }
using const_iterator = typename sat::literal_vector::const_iterator; using const_iterator = typename sat::literal_vector::const_iterator;
const_iterator begin() const { return m_literals.begin(); } const_iterator begin() const { return m_literals.begin(); }
const_iterator end() const { return m_literals.end(); } const_iterator end() const { return m_literals.end(); }
@ -72,6 +76,9 @@ namespace polysat {
void set_redundant(bool r) { m_redundant = r; } void set_redundant(bool r) { m_redundant = r; }
bool is_redundant() const { return m_redundant; } bool is_redundant() const { return m_redundant; }
void set_name(char const* name) { m_name = name; }
char const* name() const { return m_name; }
}; };
inline std::ostream& operator<<(std::ostream& out, clause const& c) { return c.display(out); } inline std::ostream& operator<<(std::ostream& out, clause const& c) { return c.display(out); }

View file

@ -308,10 +308,13 @@ namespace polysat {
if (s.m_bvars.is_true(lit)) if (s.m_bvars.is_true(lit))
verbose_stream() << "REDUNDANT lemma " << lit << " : " << show_deref(lemma) << "\n"; verbose_stream() << "REDUNDANT lemma " << lit << " : " << show_deref(lemma) << "\n";
LOG_H3("Lemma " << (name ? name : "<unknown>") << ": " << show_deref(lemma)); if (!name)
name = "<unknown>";
LOG_H3("Lemma " << name << ": " << show_deref(lemma));
SASSERT(lemma); SASSERT(lemma);
s.m_simplify_clause.apply(*lemma); s.m_simplify_clause.apply(*lemma);
lemma->set_redundant(true); lemma->set_redundant(true);
lemma->set_name(name);
for (sat::literal lit : *lemma) { for (sat::literal lit : *lemma) {
LOG(lit_pp(s, lit)); LOG(lit_pp(s, lit));
// NOTE: it can happen that the literal's bvalue is l_true at this point. // NOTE: it can happen that the literal's bvalue is l_true at this point.