3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-19 10:52:02 +00:00

working on card extension

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-01-30 17:22:06 -08:00
parent 92e2d920fd
commit 32b5e54c8d
2 changed files with 204 additions and 70 deletions

View file

@ -23,7 +23,7 @@ Revision History:
#include"sat_solver.h"
namespace sat {
class card_extension : public extension {
struct stats {
unsigned m_num_propagations;
@ -31,7 +31,7 @@ namespace sat {
stats() { reset(); }
void reset() { memset(this, 0, sizeof(*this)); }
};
class card {
unsigned m_index;
literal m_lit;
@ -49,6 +49,14 @@ namespace sat {
void negate();
};
struct ineq {
literal_vector m_lits;
unsigned_vector m_coeffs;
unsigned m_k;
void reset(unsigned k) { m_lits.reset(); m_coeffs.reset(); m_k = k; }
void push(literal l, unsigned c) { m_lits.push_back(l); m_coeffs.push_back(c); }
};
typedef ptr_vector<card> watch;
struct var_info {
watch* m_lit_watch[2];
@ -95,6 +103,10 @@ namespace sat {
void clear_watch(card& c);
void reset_coeffs();
inline lbool value(literal lit) const { return m_solver->value(lit); }
inline unsigned lvl(literal lit) const { return m_solver->lvl(lit); }
inline unsigned lvl(bool_var v) const { return m_solver->lvl(v); }
void unwatch_literal(literal w, card* c);
void remove(ptr_vector<card>& cards, card* c);
@ -105,7 +117,7 @@ namespace sat {
literal_vector& get_literals() { m_literals.reset(); return m_literals; }
literal get_asserting_literal(literal conseq);
bool resolve_conflict(card& c, literal_vector const& conflict_clause);
bool resolve_conflict(card& c, literal alit);
void process_antecedent(literal l, int offset);
void process_card(card& c, int offset);
void cut();
@ -117,6 +129,11 @@ namespace sat {
bool validate_unit_propagation(card const& c);
bool validate_conflict(literal_vector const& lits);
ineq m_A, m_B, m_C;
void active2pb(ineq& p);
void justification2pb(justification const& j, literal lit, unsigned offset, ineq& p);
bool validate_resolvent();
void display(std::ostream& out, card& c, bool values) const;
void display_watch(std::ostream& out, bool_var v, bool sign) const;
public: