3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00
This commit is contained in:
Nikolaj Bjorner 2025-01-27 10:51:12 -08:00
parent b6e7b80704
commit 15ee879602
3 changed files with 14 additions and 9 deletions

View file

@ -22,6 +22,16 @@ Revision History:
#include "util/trace.h"
namespace sat {
// move to util.h
template<typename S, typename P>
unsigned num_true(S const& set, P const& p) {
unsigned r = 0;
for (auto const& e : set)
if (p(e))
r++;
return r;
}
integrity_checker::integrity_checker(solver const & _s):
s(_s) {
@ -101,13 +111,7 @@ namespace sat {
}
bool integrity_checker::check_learned_clauses() const {
unsigned num_frozen = 0;
clause * const * end = s.end_clauses();
for (clause * const * it = s.begin_clauses(); it != end; ++it) {
clause & c = *(*it);
if (c.frozen())
num_frozen++;
}
unsigned num_frozen = num_true(s.learned(), [&](clause const* c) { return c->frozen(); });
VERIFY(num_frozen == s.m_num_frozen);
return check_clauses(s.begin_learned(), s.end_learned());
}

View file

@ -66,7 +66,7 @@ namespace sat {
svector<bin_clause> m_sub_bin_todo;
unsigned m_last_sub_trail_sz; // size of the trail since last cleanup
bool_var_set m_elim_todo;
bool m_need_cleanup;
bool m_need_cleanup = false;
tmp_clause m_dummy;
// simplifier extra variable fields.

View file

@ -3871,7 +3871,8 @@ namespace sat {
//
// -----------------------
bool solver::check_invariant() const {
if (!m_rlimit.inc()) return true;
if (!m_rlimit.inc())
return true;
if (m_simplifier.need_cleanup())
return true;
integrity_checker checker(*this);