3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-14 04:48:45 +00:00

debug with magic_call

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2025-01-07 13:16:35 -10:00
parent f77f259542
commit a1f85989eb
6 changed files with 41 additions and 5 deletions

View file

@ -653,7 +653,7 @@ namespace sls {
return false; return false;
SASSERT(is_uninterp(t)); SASSERT(is_uninterp(t));
SASSERT(m_restore.empty()); // SASSERT(m_restore.empty());
if (bv.is_bv(t)) { if (bv.is_bv(t)) {
wval(t).eval = new_value; wval(t).eval = new_value;

View file

@ -25,6 +25,7 @@ void smt_params::updt_local_params(params_ref const & _p) {
smt_params_helper p(_p); smt_params_helper p(_p);
m_auto_config = p.auto_config() && gparams::get_value("auto_config") == "true"; // auto-config is not scoped by smt in gparams. m_auto_config = p.auto_config() && gparams::get_value("auto_config") == "true"; // auto-config is not scoped by smt in gparams.
m_random_seed = p.random_seed(); m_random_seed = p.random_seed();
m_magic_call = p.magic_call();
m_relevancy_lvl = p.relevancy(); m_relevancy_lvl = p.relevancy();
m_ematching = p.ematching(); m_ematching = p.ematching();
m_induction = p.induction(); m_induction = p.induction();

View file

@ -92,6 +92,7 @@ struct smt_params : public preprocessor_params,
unsigned m_relevancy_lvl = 2; unsigned m_relevancy_lvl = 2;
bool m_relevancy_lemma = false; bool m_relevancy_lemma = false;
unsigned m_random_seed = 0; unsigned m_random_seed = 0;
unsigned m_magic_call = 0;
double m_random_var_freq = 0.01; double m_random_var_freq = 0.01;
double m_inv_decay = 1.052; double m_inv_decay = 1.052;
unsigned m_clause_decay = 1; unsigned m_clause_decay = 1;

View file

@ -5,6 +5,7 @@ def_module_params(module_name='smt',
params=(('auto_config', BOOL, True, 'automatically configure solver'), params=(('auto_config', BOOL, True, 'automatically configure solver'),
('logic', SYMBOL, '', 'logic used to setup the SMT solver'), ('logic', SYMBOL, '', 'logic used to setup the SMT solver'),
('random_seed', UINT, 0, 'random seed for the smt solver'), ('random_seed', UINT, 0, 'random seed for the smt solver'),
('magic_call', UINT, 0, 'random magic call'),
('relevancy', UINT, 2, 'relevancy propagation heuristic: 0 - disabled, 1 - relevancy is tracked by only affects quantifier instantiation, 2 - relevancy is tracked, and an atom is only asserted if it is relevant'), ('relevancy', UINT, 2, 'relevancy propagation heuristic: 0 - disabled, 1 - relevancy is tracked by only affects quantifier instantiation, 2 - relevancy is tracked, and an atom is only asserted if it is relevant'),
('macro_finder', BOOL, False, 'try to find universally quantified formulas that can be viewed as macros'), ('macro_finder', BOOL, False, 'try to find universally quantified formulas that can be viewed as macros'),
('quasi_macros', BOOL, False, 'try to find universally quantified formulas that are quasi-macros'), ('quasi_macros', BOOL, False, 'try to find universally quantified formulas that are quasi-macros'),

View file

@ -60,8 +60,8 @@ namespace smt {
m_model_generator(alloc(model_generator, m)), m_model_generator(alloc(model_generator, m)),
m_relevancy_propagator(mk_relevancy_propagator(*this)), m_relevancy_propagator(mk_relevancy_propagator(*this)),
m_user_propagator(nullptr), m_user_propagator(nullptr),
m_random(p.m_random_seed), m_random(p.m_random_seed, p.m_magic_call),
m_flushing(false), m_flushing(false),
m_lemma_id(0), m_lemma_id(0),
m_progress_callback(nullptr), m_progress_callback(nullptr),
m_next_progress_sample(0), m_next_progress_sample(0),

View file

@ -336,10 +336,10 @@ public:
T const* end() const { return e; } T const* end() const { return e; }
}; };
class random_gen { class random_gen_orig {
unsigned m_data; unsigned m_data;
public: public:
random_gen(unsigned seed = 0): random_gen_orig(unsigned seed = 0):
m_data(seed) { m_data(seed) {
} }
@ -359,6 +359,39 @@ public:
} }
}; };
class random_gen {
unsigned m_data = 0;
unsigned m_calls = 0;
unsigned m_magic_call = 0;
public:
random_gen(unsigned seed = 0):
m_data(seed) {
}
random_gen(unsigned seed, unsigned magic_call):
m_data(seed), m_magic_call(magic_call) {
}
void set_seed(unsigned s) { m_data = s; }
int operator()() {
if (m_magic_call && ++m_calls == m_magic_call) {
m_data = m_data * 214013L + 2531011L;
return (int)m_magic_call;
}
return ((m_data = m_data * 214013L + 2531011L) >> 16) & 0x7fff;
}
unsigned operator()(unsigned u) {
unsigned r = static_cast<unsigned>((*this)());
return r % u;
}
static int max_value() {
return 0x7fff;
}
};
template<typename T> template<typename T>
void shuffle(unsigned sz, T * array, random_gen & gen) { void shuffle(unsigned sz, T * array, random_gen & gen) {
int n = sz; int n = sz;