3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00
* arrays

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

* arrays

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

* na

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

* arrays

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

* na

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

* fill

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

* update drat and fix euf bugs

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

* na

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

* na

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

* na

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

* const qualifiers

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

* na

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

* reorg ba

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

* reorg

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

* build warnings

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-09-13 19:29:59 -07:00 committed by GitHub
parent d56dd1db7b
commit 796e2fd9eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 2571 additions and 1850 deletions

View file

@ -375,7 +375,7 @@ namespace smt {
}
void dyn_ack_manager::propagate_eh() {
if (m_params.m_dack == DACK_DISABLED)
if (m_params.m_dack == dyn_ack_strategy::DACK_DISABLED)
return;
m_num_propagations_since_last_gc++;
if (m_num_propagations_since_last_gc > m_params.m_dack_gc) {
@ -407,7 +407,7 @@ namespace smt {
}
void dyn_ack_manager::instantiate(app * n1, app * n2) {
SASSERT(m_params.m_dack != DACK_DISABLED);
SASSERT(m_params.m_dack != dyn_ack_strategy::DACK_DISABLED);
SASSERT(n1->get_decl() == n2->get_decl());
SASSERT(n1->get_num_args() == n2->get_num_args());
SASSERT(n1 != n2);
@ -461,7 +461,7 @@ namespace smt {
void dyn_ack_manager::instantiate(app * n1, app * n2, app* r) {
context& ctx = m_context;
SASSERT(m_params.m_dack != DACK_DISABLED);
SASSERT(m_params.m_dack != dyn_ack_strategy::DACK_DISABLED);
SASSERT(n1 != n2 && n1 != r && n2 != r);
ctx.m_stats.m_num_dyn_ack++;
TRACE("dyn_ack_inst", tout << "dyn_ack: " << n1->get_id() << " " << n2->get_id() << " " << r->get_id() << "\n";);

View file

@ -97,7 +97,7 @@ namespace smt {
\brief This method is invoked when the congruence rule was used during conflict resolution.
*/
void used_cg_eh(app * n1, app * n2) {
if (m_params.m_dack == DACK_CR)
if (m_params.m_dack == dyn_ack_strategy::DACK_CR)
cg_eh(n1, n2);
}
@ -105,7 +105,7 @@ namespace smt {
\brief This method is invoked when the congruence rule is the root of a conflict.
*/
void cg_conflict_eh(app * n1, app * n2) {
if (m_params.m_dack == DACK_ROOT)
if (m_params.m_dack == dyn_ack_strategy::DACK_ROOT)
cg_eh(n1, n2);
}

View file

@ -25,11 +25,11 @@ namespace smt {
class fingerprint {
protected:
void * m_data;
unsigned m_data_hash;
expr* m_def;
unsigned m_num_args;
enode * * m_args;
void* m_data{ nullptr };
unsigned m_data_hash{ 0 };
expr* m_def{ nullptr };
unsigned m_num_args{ 0 };
enode** m_args{ nullptr };
friend class fingerprint_set;
fingerprint() {}

View file

@ -32,7 +32,7 @@ void dyn_ack_params::updt_params(params_ref const & _p) {
#define DISPLAY_PARAM(X) out << #X"=" << X << std::endl;
void dyn_ack_params::display(std::ostream & out) const {
DISPLAY_PARAM(m_dack);
DISPLAY_PARAM((unsigned)m_dack);
DISPLAY_PARAM(m_dack_eq);
DISPLAY_PARAM(m_dack_factor);
DISPLAY_PARAM(m_dack_threshold);

View file

@ -20,7 +20,7 @@ Revision History:
#include "util/params.h"
enum dyn_ack_strategy {
enum class dyn_ack_strategy {
DACK_DISABLED,
DACK_ROOT, // congruence is the root of the conflict
DACK_CR // congruence used during conflict resolution
@ -36,7 +36,7 @@ struct dyn_ack_params {
public:
dyn_ack_params(params_ref const & p = params_ref()) :
m_dack(DACK_ROOT),
m_dack(dyn_ack_strategy::DACK_ROOT),
m_dack_eq(false),
m_dack_factor(0.1),
m_dack_threshold(10),

View file

@ -250,8 +250,8 @@ struct smt_params : public preprocessor_params,
m_random_var_freq(0.01),
m_inv_decay(1.052),
m_clause_decay(1),
m_random_initial_activity(IA_RANDOM_WHEN_SEARCHING),
m_phase_selection(PS_CACHING_CONSERVATIVE),
m_random_initial_activity(initial_activity::IA_RANDOM_WHEN_SEARCHING),
m_phase_selection(phase_selection::PS_CACHING_CONSERVATIVE),
m_phase_caching_on(700),
m_phase_caching_off(100),
m_minimize_lemmas(true),
@ -267,7 +267,7 @@ struct smt_params : public preprocessor_params,
m_ematching(true),
m_induction(false),
m_clause_proof(false),
m_case_split_strategy(CS_ACTIVITY_DELAY_NEW),
m_case_split_strategy(case_split_strategy::CS_ACTIVITY_DELAY_NEW),
m_rel_case_split_order(0),
m_lookahead_diseq(false),
m_theory_case_split(false),
@ -275,13 +275,13 @@ struct smt_params : public preprocessor_params,
m_delay_units(false),
m_delay_units_threshold(32),
m_theory_resolve(false),
m_restart_strategy(RS_IN_OUT_GEOMETRIC),
m_restart_strategy(restart_strategy::RS_IN_OUT_GEOMETRIC),
m_restart_initial(100),
m_restart_factor(1.1),
m_restart_adaptive(true),
m_agility_factor(0.9999),
m_restart_agility_threshold(0.18),
m_lemma_gc_strategy(LGC_FIXED),
m_lemma_gc_strategy(lemma_gc_strategy::LGC_FIXED),
m_lemma_gc_half(false),
m_recent_lemmas_size(100),
m_lemma_gc_initial(5000),

View file

@ -50,11 +50,11 @@ void theory_arith_params::updt_params(params_ref const & _p) {
void theory_arith_params::display(std::ostream & out) const {
DISPLAY_PARAM(m_arith_eq2ineq);
DISPLAY_PARAM(m_arith_process_all_eqs);
DISPLAY_PARAM(m_arith_mode);
DISPLAY_PARAM((unsigned)m_arith_mode);
DISPLAY_PARAM(m_arith_auto_config_simplex); //!< force simplex solver in auto_config
DISPLAY_PARAM(m_arith_blands_rule_threshold);
DISPLAY_PARAM(m_arith_propagate_eqs);
DISPLAY_PARAM(m_arith_bound_prop);
DISPLAY_PARAM((unsigned)m_arith_bound_prop);
DISPLAY_PARAM(m_arith_stronger_lemmas);
DISPLAY_PARAM(m_arith_skip_rows_with_big_coeffs);
DISPLAY_PARAM(m_arith_max_lemma_size);
@ -81,7 +81,7 @@ void theory_arith_params::display(std::ostream & out) const {
DISPLAY_PARAM(m_arith_pivot_strategy);
DISPLAY_PARAM(m_arith_bounded_expansion);
DISPLAY_PARAM(m_arith_add_binary_bounds);
DISPLAY_PARAM(m_arith_propagation_strategy);
DISPLAY_PARAM((unsigned)m_arith_propagation_strategy);
DISPLAY_PARAM(m_arith_eq_bounds);
DISPLAY_PARAM(m_arith_lazy_adapter);
DISPLAY_PARAM(m_arith_fixnum);

View file

@ -21,7 +21,7 @@ Revision History:
#include<climits>
#include "util/params.h"
enum arith_solver_id {
enum class arith_solver_id {
AS_NO_ARITH, // 0
AS_DIFF_LOGIC, // 1
AS_OLD_ARITH, // 2
@ -31,13 +31,13 @@ enum arith_solver_id {
AS_NEW_ARITH // 6
};
enum bound_prop_mode {
enum class bound_prop_mode {
BP_NONE,
BP_SIMPLE, // only used for implying literals
BP_REFINE // adds new literals, but only refines finite bounds
};
enum arith_prop_strategy {
enum class arith_prop_strategy {
ARITH_PROP_AGILITY,
ARITH_PROP_PROPORTIONAL
};
@ -114,11 +114,11 @@ struct theory_arith_params {
theory_arith_params(params_ref const & p = params_ref()):
m_arith_eq2ineq(false),
m_arith_process_all_eqs(false),
m_arith_mode(AS_NEW_ARITH),
m_arith_mode(arith_solver_id::AS_NEW_ARITH),
m_arith_auto_config_simplex(false),
m_arith_blands_rule_threshold(1000),
m_arith_propagate_eqs(true),
m_arith_bound_prop(BP_REFINE),
m_arith_bound_prop(bound_prop_mode::BP_REFINE),
m_arith_stronger_lemmas(true),
m_arith_skip_rows_with_big_coeffs(true),
m_arith_max_lemma_size(128),
@ -145,7 +145,7 @@ struct theory_arith_params {
m_arith_bounded_expansion(false),
m_arith_pivot_strategy(arith_pivot_strategy::ARITH_PIVOT_SMALLEST),
m_arith_add_binary_bounds(false),
m_arith_propagation_strategy(ARITH_PROP_PROPORTIONAL),
m_arith_propagation_strategy(arith_prop_strategy::ARITH_PROP_PROPORTIONAL),
m_arith_eq_bounds(false),
m_arith_lazy_adapter(false),
m_arith_fixnum(false),

View file

@ -44,7 +44,7 @@ struct theory_array_params {
theory_array_params():
m_array_canonize_simplify(false),
m_array_simplify(true),
m_array_mode(AR_FULL),
m_array_mode(array_solver_id::AR_FULL),
m_array_weak(false),
m_array_extensional(true),
m_array_laziness(1),

View file

@ -36,7 +36,7 @@ struct theory_bv_params {
bool m_bv_enable_int2bv2int;
bool m_bv_watch_diseq;
theory_bv_params(params_ref const & p = params_ref()):
m_bv_mode(BS_BLASTER),
m_bv_mode(bv_solver_id::BS_BLASTER),
m_hi_div0(false),
m_bv_reflect(true),
m_bv_lazy_le(false),

View file

@ -111,9 +111,9 @@ namespace smt {
/*
state_graph for dead state detection, and associated methods
*/
state_graph m_state_graph;
ptr_addr_map<expr, unsigned> m_expr_to_state;
expr_ref_vector m_state_to_expr;
state_graph m_state_graph;
/* map from uninterpreted regex constants to assigned regex expressions by EQ */
// expr_map m_const_to_expr;
unsigned m_max_state_graph_size { 10000 };

View file

@ -313,8 +313,8 @@ namespace smt {
// }
}
else {
m_params.m_arith_bound_prop = BP_NONE;
m_params.m_arith_propagation_strategy = ARITH_PROP_AGILITY;
m_params.m_arith_bound_prop = bound_prop_mode::BP_NONE;
m_params.m_arith_propagation_strategy = arith_prop_strategy::ARITH_PROP_AGILITY;
m_params.m_arith_add_binary_bounds = true;
if (!st.m_has_rational && !m_params.m_model && st.arith_k_sum_is_small())
m_context.register_plugin(alloc(smt::theory_frdl, m_context));
@ -524,7 +524,7 @@ namespace smt {
m_params.m_restart_factor = 1.5;
}
if (st.m_num_bin_clauses + st.m_num_units == st.m_num_clauses && st.m_cnf && st.m_arith_k_sum > rational(100000)) {
m_params.m_arith_bound_prop = BP_NONE;
m_params.m_arith_bound_prop = bound_prop_mode::BP_NONE;
m_params.m_arith_stronger_lemmas = false;
}
setup_lra_arith();
@ -736,7 +736,7 @@ namespace smt {
}
void setup::setup_i_arith() {
if (AS_OLD_ARITH == m_params.m_arith_mode) {
if (arith_solver_id::AS_OLD_ARITH == m_params.m_arith_mode) {
m_context.register_plugin(alloc(smt::theory_i_arith, m_context));
}
else {
@ -745,7 +745,7 @@ namespace smt {
}
void setup::setup_lra_arith() {
if (m_params.m_arith_mode == AS_OLD_ARITH)
if (m_params.m_arith_mode == arith_solver_id::AS_OLD_ARITH)
m_context.register_plugin(alloc(smt::theory_mi_arith, m_context));
else
m_context.register_plugin(alloc(smt::theory_lra, m_context));
@ -753,10 +753,10 @@ namespace smt {
void setup::setup_mi_arith() {
switch (m_params.m_arith_mode) {
case AS_OPTINF:
case arith_solver_id::AS_OPTINF:
m_context.register_plugin(alloc(smt::theory_inf_arith, m_context));
break;
case AS_NEW_ARITH:
case arith_solver_id::AS_NEW_ARITH:
setup_lra_arith();
break;
default:
@ -778,13 +778,13 @@ namespace smt {
bool int_only = !st.m_has_rational && !st.m_has_real && m_params.m_arith_int_only;
auto mode = m_params.m_arith_mode;
if (m_logic == "QF_LIA") {
mode = AS_NEW_ARITH;
mode = arith_solver_id::AS_NEW_ARITH;
}
switch(mode) {
case AS_NO_ARITH:
case arith_solver_id::AS_NO_ARITH:
m_context.register_plugin(alloc(smt::theory_dummy, m_context, m_manager.mk_family_id("arith"), "no arithmetic"));
break;
case AS_DIFF_LOGIC:
case arith_solver_id::AS_DIFF_LOGIC:
m_params.m_arith_eq2ineq = true;
if (fixnum) {
if (int_only)
@ -799,7 +799,7 @@ namespace smt {
m_context.register_plugin(alloc(smt::theory_rdl, m_context));
}
break;
case AS_DENSE_DIFF_LOGIC:
case arith_solver_id::AS_DENSE_DIFF_LOGIC:
m_params.m_arith_eq2ineq = true;
if (fixnum) {
if (int_only)
@ -814,23 +814,23 @@ namespace smt {
m_context.register_plugin(alloc(smt::theory_dense_mi, m_context));
}
break;
case AS_UTVPI:
case arith_solver_id::AS_UTVPI:
m_params.m_arith_eq2ineq = true;
if (int_only)
m_context.register_plugin(alloc(smt::theory_iutvpi, m_context));
else
m_context.register_plugin(alloc(smt::theory_rutvpi, m_context));
break;
case AS_OPTINF:
case arith_solver_id::AS_OPTINF:
m_context.register_plugin(alloc(smt::theory_inf_arith, m_context));
break;
case AS_OLD_ARITH:
case arith_solver_id::AS_OLD_ARITH:
if (m_params.m_arith_int_only && int_only)
m_context.register_plugin(alloc(smt::theory_i_arith, m_context));
else
m_context.register_plugin(alloc(smt::theory_mi_arith, m_context));
break;
case AS_NEW_ARITH:
case arith_solver_id::AS_NEW_ARITH:
setup_lra_arith();
break;
default:

View file

@ -541,7 +541,7 @@ namespace smt {
int random_lower() const { return m_params.m_arith_random_lower; }
int random_upper() const { return m_params.m_arith_random_upper; }
unsigned blands_rule_threshold() const { return m_params.m_arith_blands_rule_threshold; }
bound_prop_mode propagation_mode() const { return m_num_conflicts < m_params.m_arith_propagation_threshold ? m_params.m_arith_bound_prop : BP_NONE; }
bound_prop_mode propagation_mode() const { return m_num_conflicts < m_params.m_arith_propagation_threshold ? m_params.m_arith_bound_prop : bound_prop_mode::BP_NONE; }
bool adaptive() const { return m_params.m_arith_adaptive; }
double adaptive_assertion_threshold() const { return m_params.m_arith_adaptive_assertion_threshold; }
unsigned max_lemma_size() const { return m_params.m_arith_max_lemma_size; }

View file

@ -1151,8 +1151,8 @@ namespace smt {
*/
template<typename Ext>
void theory_arith<Ext>::enable_record_conflict(expr* bound) {
m_params.m_arith_bound_prop = BP_NONE;
SASSERT(propagation_mode() == BP_NONE); // bound propagation rules are not (yet) handled.
m_params.m_arith_bound_prop = bound_prop_mode::BP_NONE;
SASSERT(propagation_mode() == bound_prop_mode::BP_NONE); // bound propagation rules are not (yet) handled.
if (bound) {
m_bound_watch = ctx.get_bool_var(bound);
}

View file

@ -852,7 +852,7 @@ namespace smt {
SASSERT(!has_var_kind(get_var_row(s), BASE));
}
TRACE("init_row_bug", tout << "after:\n"; display_row_info(tout, r););
if (propagation_mode() != BP_NONE)
if (propagation_mode() != bound_prop_mode::BP_NONE)
mark_row_for_bound_prop(r_id);
SASSERT(r.is_coeff_of(s, numeral::one()));
SASSERT(wf_row(r_id));
@ -1728,7 +1728,7 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::add_row(unsigned rid1, const numeral & coeff, unsigned rid2, bool apply_gcd_test) {
m_stats.m_add_rows++;
if (propagation_mode() != BP_NONE)
if (propagation_mode() != bound_prop_mode::BP_NONE)
mark_row_for_bound_prop(rid1);
row & r1 = m_rows[rid1];
row & r2 = m_rows[rid2];
@ -2442,7 +2442,7 @@ namespace smt {
push_bound_trail(v, l, false);
set_bound(b, false);
if (propagation_mode() != BP_NONE)
if (propagation_mode() != bound_prop_mode::BP_NONE)
mark_rows_for_bound_prop(v);
return true;
@ -2490,7 +2490,7 @@ namespace smt {
push_bound_trail(v, u, true);
set_bound(b, true);
if (propagation_mode() != BP_NONE)
if (propagation_mode() != bound_prop_mode::BP_NONE)
mark_rows_for_bound_prop(v);
return true;

View file

@ -512,7 +512,7 @@ void theory_diff_logic<Ext>::propagate() {
switch (m_params.m_arith_propagation_strategy) {
case ARITH_PROP_PROPORTIONAL: {
case arith_prop_strategy::ARITH_PROP_PROPORTIONAL: {
++m_num_propagation_calls;
if (m_num_propagation_calls * (m_stats.m_num_conflicts + 1) >
@ -526,7 +526,7 @@ void theory_diff_logic<Ext>::propagate() {
}
break;
}
case ARITH_PROP_AGILITY: {
case arith_prop_strategy::ARITH_PROP_AGILITY: {
// update agility with factor generated by other conflicts.
double g = m_params.m_arith_adaptive_propagation_threshold;

View file

@ -992,7 +992,7 @@ public:
smt_params_helper lpar(ctx().get_params());
lp().settings().set_resource_limit(m_resource_limit);
lp().settings().simplex_strategy() = static_cast<lp::simplex_strategy_enum>(lpar.arith_simplex_strategy());
lp().settings().bound_propagation() = BP_NONE != propagation_mode();
lp().settings().bound_propagation() = bound_prop_mode::BP_NONE != propagation_mode();
lp().settings().enable_hnf() = lpar.arith_enable_hnf();
lp().settings().print_external_var_name() = lpar.arith_print_ext_var_names();
lp().set_track_pivoted_rows(lpar.arith_bprop_on_pivoted_rows());
@ -2320,11 +2320,11 @@ public:
}
bool should_propagate() const {
return BP_NONE != propagation_mode();
return bound_prop_mode::BP_NONE != propagation_mode();
}
bool should_refine_bounds() const {
return BP_REFINE == propagation_mode() && ctx().at_search_level();
return bound_prop_mode::BP_REFINE == propagation_mode() && ctx().at_search_level();
}
void consume(rational const& v, lp::constraint_index j) {
@ -2807,7 +2807,7 @@ public:
// x <= hi -> ~(x >= hi')
void propagate_bound(bool_var bv, bool is_true, lp_api::bound& b) {
if (BP_NONE == propagation_mode()) {
if (bound_prop_mode::BP_NONE == propagation_mode()) {
return;
}
lp_api::bound_kind k = b.get_bound_kind();
@ -3113,7 +3113,7 @@ public:
bool propagate_eqs() const { return params().m_arith_propagate_eqs && m_num_conflicts < params().m_arith_propagation_threshold; }
bound_prop_mode propagation_mode() const { return m_num_conflicts < params().m_arith_propagation_threshold ? params().m_arith_bound_prop : BP_NONE; }
bound_prop_mode propagation_mode() const { return m_num_conflicts < params().m_arith_propagation_threshold ? params().m_arith_bound_prop : bound_prop_mode::BP_NONE; }
unsigned small_lemma_size() const { return params().m_arith_small_lemma_size; }
@ -3568,10 +3568,10 @@ public:
struct scoped_arith_mode {
smt_params& p;
scoped_arith_mode(smt_params& p) : p(p) {
p.m_arith_mode = AS_OLD_ARITH;
p.m_arith_mode = arith_solver_id::AS_OLD_ARITH;
}
~scoped_arith_mode() {
p.m_arith_mode = AS_NEW_ARITH;
p.m_arith_mode = arith_solver_id::AS_NEW_ARITH;
}
};
@ -3582,7 +3582,7 @@ public:
}
bool validate_conflict(literal_vector const& core, svector<enode_pair> const& eqs) {
if (params().m_arith_mode != AS_NEW_ARITH) return true;
if (params().m_arith_mode != arith_solver_id::AS_NEW_ARITH) return true;
scoped_arith_mode _sa(ctx().get_fparams());
context nctx(m, ctx().get_fparams(), ctx().get_params());
add_background(nctx);
@ -3601,7 +3601,7 @@ public:
}
bool validate_assign(literal lit, literal_vector const& core, svector<enode_pair> const& eqs) {
if (params().m_arith_mode != AS_NEW_ARITH) return true;
if (params().m_arith_mode != arith_solver_id::AS_NEW_ARITH) return true;
scoped_arith_mode _sa(ctx().get_fparams());
context nctx(m, ctx().get_fparams(), ctx().get_params());
m_core.push_back(~lit);
@ -3616,7 +3616,7 @@ public:
}
bool validate_eq(enode* x, enode* y) {
if (params().m_arith_mode == AS_NEW_ARITH) return true;
if (params().m_arith_mode == arith_solver_id::AS_NEW_ARITH) return true;
context nctx(m, ctx().get_fparams(), ctx().get_params());
add_background(nctx);
nctx.assert_expr(m.mk_not(m.mk_eq(x->get_owner(), y->get_owner())));

View file

@ -1791,7 +1791,7 @@ void theory_seq::collect_statistics(::statistics & st) const {
void theory_seq::init_search_eh() {
auto as = get_fparams().m_arith_mode;
if (m_has_seq && as != AS_OLD_ARITH && as != AS_NEW_ARITH) {
if (m_has_seq && as != arith_solver_id::AS_OLD_ARITH && as != arith_solver_id::AS_NEW_ARITH) {
throw default_exception("illegal arithmetic solver used with string solver");
}
}