3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-22 19:17:53 +00:00
z3/src/sat/smt/bv_ackerman.h
Nikolaj Bjorner b7ec4489a6
bv fixes and tuning (#4703)
* heap size information

* bv tuning

* fix #4701

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* throw on set-has-size #4700

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-09-21 19:54:53 -07:00

81 lines
1.9 KiB
C++

/*++
Copyright (c) 2020 Microsoft Corporation
Module Name:
euf_ackerman.h
Abstract:
Ackerman reduction plugin for EUF
Author:
Nikolaj Bjorner (nbjorner) 2020-08-25
--*/
#pragma once
#include "util/dlist.h"
#include "sat/smt/atom2bool_var.h"
#include "sat/smt/sat_th.h"
namespace bv {
class solver;
class ackerman {
struct vv : dll_base<vv> {
euf::theory_var v1, v2;
unsigned m_count{ 0 };
unsigned m_glue{ UINT_MAX };
vv():v1(euf::null_theory_var), v2(euf::null_theory_var) {}
vv(euf::theory_var v1, euf::theory_var v2):v1(v1), v2(v2) {}
void set_var(euf::theory_var x, euf::theory_var y) { v1 = x; v2 = y; m_count = 0; m_glue = UINT_MAX; }
};
struct vv_eq {
bool operator()(vv const* a, vv const* b) const {
return a->v1 == b->v1 && a->v2 == b->v2;
}
};
struct vv_hash {
unsigned operator()(vv const* a) const {
return mk_mix(a->v1, a->v2, 0);
}
};
typedef hashtable<vv*, vv_hash, vv_eq> table_t;
solver& s;
table_t m_table;
vv* m_queue { nullptr };
vv* m_tmp_vv { nullptr };
unsigned m_gc_threshold { 100 };
unsigned m_propagate_high_watermark { 10000 };
unsigned m_propagate_low_watermark { 10 };
unsigned m_num_propagations_since_last_gc { 0 };
bool_vector m_diff_levels;
void update_glue(vv& v);
void reset();
void new_tmp();
void remove(vv* inf);
void gc();
void add_cc(euf::theory_var v1, euf::theory_var v2);
public:
ackerman(solver& s);
~ackerman();
void used_eq_eh(euf::theory_var v1, euf::theory_var v2);
void used_diseq_eh(euf::theory_var v1, euf::theory_var v2);
void propagate();
};
};