3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-09 01:11:55 +00:00

model-add/del

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-11-01 22:32:22 -05:00
parent 3de8c193ea
commit caaf0ba33c
28 changed files with 271 additions and 251 deletions

View file

@ -39,39 +39,47 @@ namespace sat {
class solver;
static unsigned counter = 0;
class model_converter {
public:
typedef svector<std::pair<unsigned, literal>> elim_stackv;
class elim_stack {
unsigned m_refcount;
unsigned m_counter;
unsigned m_refcount;
elim_stackv m_stack;
elim_stack(elim_stack const& );
public:
elim_stack(elim_stackv const& stack):
m_counter(0),
m_refcount(0),
m_stack(stack) {
m_counter = ++counter;
}
~elim_stack() { }
void inc_ref() { ++m_refcount; }
void dec_ref() { if (0 == --m_refcount) dealloc(this); }
void dec_ref() { if (0 == --m_refcount) { dealloc(this); } }
elim_stackv const& stack() const { return m_stack; }
unsigned ref_count() const { return m_refcount; }
};
enum kind { ELIM_VAR = 0, BLOCK_LIT, CCE, ACCE };
class entry {
friend class model_converter;
unsigned m_var:30;
unsigned m_kind:2;
literal_vector m_clauses; // the different clauses are separated by null_literal
sref_vector<elim_stack> m_elim_stack;
entry(kind k, bool_var v):m_var(v), m_kind(k) {}
unsigned m_var:30;
unsigned m_kind:2;
literal_vector m_clauses; // the different clauses are separated by null_literal
sref_vector<elim_stack> m_elim_stack;
entry(kind k, bool_var v): m_var(v), m_kind(k) {}
public:
entry(entry const & src):
m_var(src.m_var),
m_kind(src.m_kind),
m_clauses(src.m_clauses),
m_elim_stack(src.m_elim_stack) {
m_clauses(src.m_clauses) {
m_elim_stack.append(src.m_elim_stack);
}
bool_var var() const { return m_var; }
kind get_kind() const { return static_cast<kind>(m_kind); }
@ -115,7 +123,7 @@ namespace sat {
* lit0 := lit0 or (~lit1 & ~lit2 & ... & ~lit_k)
*
*/
void expand(vector<literal_vector>& update_stack);
void expand(literal_vector& update_stack);
};
};