mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
pull unstable
Signed-off-by: Nikolaj Bjorner <nbjorner@hotmail.com>
This commit is contained in:
commit
52619b9dbb
337 changed files with 24943 additions and 30606 deletions
|
@ -19,6 +19,7 @@ Revision History:
|
|||
#include<memory.h>
|
||||
#include"sat_clause.h"
|
||||
#include"z3_exception.h"
|
||||
#include"trace.h"
|
||||
|
||||
namespace sat {
|
||||
|
||||
|
@ -173,6 +174,7 @@ namespace sat {
|
|||
}
|
||||
|
||||
void clause_allocator::del_clause(clause * cls) {
|
||||
TRACE("sat", tout << "delete: " << cls->id() << " " << cls << " " << *cls << "\n";);
|
||||
m_id_gen.recycle(cls->id());
|
||||
size_t size = clause::get_obj_size(cls->m_capacity);
|
||||
#ifdef _AMD64_
|
||||
|
|
|
@ -128,6 +128,11 @@ namespace sat {
|
|||
if (j == 0) {
|
||||
// empty clause
|
||||
m_solver.set_conflict(justification());
|
||||
for (; it != end; ++it) {
|
||||
*it2 = *it;
|
||||
it2++;
|
||||
}
|
||||
cs.set_end(it2);
|
||||
return;
|
||||
}
|
||||
TRACE("elim_eqs", tout << "after removing duplicates: " << c << " j: " << j << "\n";);
|
||||
|
|
|
@ -207,6 +207,24 @@ namespace sat {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool integrity_checker::check_disjoint_clauses() const {
|
||||
uint_set ids;
|
||||
clause_vector::const_iterator it = s.m_clauses.begin();
|
||||
clause_vector::const_iterator end = s.m_clauses.end();
|
||||
for (; it != end; ++it) {
|
||||
ids.insert((*it)->id());
|
||||
}
|
||||
it = s.m_learned.begin();
|
||||
end = s.m_learned.end();
|
||||
for (; it != end; ++it) {
|
||||
if (ids.contains((*it)->id())) {
|
||||
TRACE("sat", tout << "Repeated clause: " << (*it)->id() << "\n";);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool integrity_checker::operator()() const {
|
||||
if (s.inconsistent())
|
||||
|
@ -216,6 +234,7 @@ namespace sat {
|
|||
SASSERT(check_watches());
|
||||
SASSERT(check_bool_vars());
|
||||
SASSERT(check_reinit_stack());
|
||||
SASSERT(check_disjoint_clauses());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace sat {
|
|||
bool check_bool_vars() const;
|
||||
bool check_watches() const;
|
||||
bool check_reinit_stack() const;
|
||||
bool check_disjoint_clauses() const;
|
||||
bool operator()() const;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -228,6 +228,7 @@ namespace sat {
|
|||
}
|
||||
|
||||
void simplifier::cleanup_clauses(clause_vector & cs, bool learned, bool vars_eliminated, bool in_use_lists) {
|
||||
TRACE("sat", tout << "cleanup_clauses\n";);
|
||||
clause_vector::iterator it = cs.begin();
|
||||
clause_vector::iterator it2 = it;
|
||||
clause_vector::iterator end = cs.end();
|
||||
|
|
|
@ -57,7 +57,10 @@ namespace sat {
|
|||
}
|
||||
|
||||
solver::~solver() {
|
||||
SASSERT(check_invariant());
|
||||
TRACE("sat", tout << "Delete clauses\n";);
|
||||
del_clauses(m_clauses.begin(), m_clauses.end());
|
||||
TRACE("sat", tout << "Delete learned\n";);
|
||||
del_clauses(m_learned.begin(), m_learned.end());
|
||||
}
|
||||
|
||||
|
@ -1305,6 +1308,7 @@ namespace sat {
|
|||
\brief GC (the second) half of the clauses in the database.
|
||||
*/
|
||||
void solver::gc_half(char const * st_name) {
|
||||
TRACE("sat", tout << "gc\n";);
|
||||
unsigned sz = m_learned.size();
|
||||
unsigned new_sz = sz/2;
|
||||
unsigned j = new_sz;
|
||||
|
@ -1329,6 +1333,7 @@ namespace sat {
|
|||
\brief Use gc based on dynamic psm. Clauses are initially frozen.
|
||||
*/
|
||||
void solver::gc_dyn_psm() {
|
||||
TRACE("sat", tout << "gc\n";);
|
||||
// To do gc at scope_lvl() > 0, I will need to use the reinitialization stack, or live with the fact
|
||||
// that I may miss some propagations for reactivated clauses.
|
||||
SASSERT(scope_lvl() == 0);
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace sat {
|
|||
clause_vector m_learned;
|
||||
unsigned m_num_frozen;
|
||||
vector<watch_list> m_watches;
|
||||
svector<lbool> m_assignment;
|
||||
char_vector m_assignment;
|
||||
svector<justification> m_justification;
|
||||
svector<char> m_decision;
|
||||
svector<char> m_mark;
|
||||
|
@ -213,8 +213,8 @@ namespace sat {
|
|||
bool is_external(bool_var v) const { return m_external[v] != 0; }
|
||||
bool was_eliminated(bool_var v) const { return m_eliminated[v] != 0; }
|
||||
unsigned scope_lvl() const { return m_scope_lvl; }
|
||||
lbool value(literal l) const { return m_assignment[l.index()]; }
|
||||
lbool value(bool_var v) const { return m_assignment[literal(v, false).index()]; }
|
||||
lbool value(literal l) const { return static_cast<lbool>(m_assignment[l.index()]); }
|
||||
lbool value(bool_var v) const { return static_cast<lbool>(m_assignment[literal(v, false).index()]); }
|
||||
unsigned lvl(bool_var v) const { return m_level[v]; }
|
||||
unsigned lvl(literal l) const { return m_level[l.var()]; }
|
||||
void assign(literal l, justification j) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue