3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-23 03:27:52 +00:00

add validation to aig_simplifier, start BIG-based masking

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-01-11 20:47:38 -08:00
parent 41a00707e1
commit e0a41a18c3
14 changed files with 741 additions and 167 deletions

View file

@ -31,19 +31,64 @@ namespace sat {
stats() { reset(); }
void reset() { memset(this, 0, sizeof(*this)); }
};
struct config {
bool m_full;
config():m_full(false) {}
};
private:
struct report;
struct validator;
solver& s;
stats m_stats;
config m_config;
aig_cuts m_aig_cuts;
unsigned m_trail_size;
literal_vector m_lits;
validator* m_validator;
struct report;
void clauses2aig();
void aig2clauses();
void ensure_validator();
void validate_unit(literal lit);
void validate_eq(literal a, literal b);
void certify_equivalence(literal u, literal v, cut const& c);
/**
* collect pairs of literal combinations that are impossible
* base on binary implication graph queries.
* Apply the masks on cut sets so to allow detecting
* equivalences modulo implications.
*/
struct var_pair {
unsigned u, v;
uint64_t masks[35];
static unsigned size() { return sizeof(uint64_t)*35; }
var_pair(unsigned u, unsigned v): u(u), v(v) {
if (u > v) std::swap(u, v);
}
var_pair(): u(UINT_MAX), v(UINT_MAX) {}
struct hash {
unsigned operator()(var_pair const& p) const {
return mk_mix(p.u, p.v, 1);
}
};
struct eq {
bool operator()(var_pair const& a, var_pair const& b) const {
return a.u == b.u && a.v == b.v;
}
};
};
hashtable<var_pair, var_pair::hash, var_pair::eq> m_pairs;
void collect_pairs(vector<cut_set> const& cuts);
void add_mask(literal u, literal v, var_pair& p);
void add_masks_to_pairs();
void apply_masks();
public:
aig_simplifier(solver& s);
~aig_simplifier() {}
~aig_simplifier();
void operator()();
void collect_statistics(statistics& st) const;