mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 20:18:18 +00:00
parent
37a4dd68d0
commit
28cb13fb96
|
@ -138,14 +138,12 @@ namespace smt {
|
||||||
m_coeff_map.insert_if_not_there2(e, rational(0))->get_data().m_value += mul;
|
m_coeff_map.insert_if_not_there2(e, rational(0))->get_data().m_value += mul;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
obj_map<expr, rational>::iterator it = m_coeff_map.begin();
|
for (auto const& kv : m_coeff_map) {
|
||||||
obj_map<expr, rational>::iterator end = m_coeff_map.end();
|
rational r = kv.m_value;
|
||||||
for (; it != end; ++it) {
|
|
||||||
rational r = it->m_value;
|
|
||||||
if (r.is_zero()) {
|
if (r.is_zero()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m_terms.push_back(std::make_pair(it->m_key, r));
|
m_terms.push_back(std::make_pair(kv.m_key, r));
|
||||||
if (m_terms.size() > 2) {
|
if (m_terms.size() > 2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ namespace smt {
|
||||||
smt_params m_params;
|
smt_params m_params;
|
||||||
arith_util a;
|
arith_util a;
|
||||||
arith_eq_adapter m_arith_eq_adapter;
|
arith_eq_adapter m_arith_eq_adapter;
|
||||||
th_var m_zero; //cache the variable representing the zero variable.
|
th_var m_izero, m_rzero; //cache the variable representing the zero variable.
|
||||||
|
|
||||||
dl_graph<GExt> m_graph;
|
dl_graph<GExt> m_graph;
|
||||||
nc_functor m_nc_functor;
|
nc_functor m_nc_functor;
|
||||||
|
@ -299,7 +299,7 @@ namespace smt {
|
||||||
|
|
||||||
void new_eq_or_diseq(bool is_eq, th_var v1, th_var v2, justification& eq_just);
|
void new_eq_or_diseq(bool is_eq, th_var v1, th_var v2, justification& eq_just);
|
||||||
|
|
||||||
th_var get_zero(sort* s) { init_zero(); return m_zero; }
|
th_var get_zero(sort* s) { init_zero(); return a.is_int(s) ? m_izero : m_rzero; }
|
||||||
|
|
||||||
th_var get_zero(expr* e) { return get_zero(get_manager().get_sort(e)); }
|
th_var get_zero(expr* e) { return get_zero(get_manager().get_sort(e)); }
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,8 @@ namespace smt {
|
||||||
theory(m.mk_family_id("arith")),
|
theory(m.mk_family_id("arith")),
|
||||||
a(m),
|
a(m),
|
||||||
m_arith_eq_adapter(*this, m_params, a),
|
m_arith_eq_adapter(*this, m_params, a),
|
||||||
m_zero(null_theory_var),
|
m_izero(null_theory_var),
|
||||||
|
m_rzero(null_theory_var),
|
||||||
m_nc_functor(*this),
|
m_nc_functor(*this),
|
||||||
m_asserted_qhead(0),
|
m_asserted_qhead(0),
|
||||||
m_agility(0.5),
|
m_agility(0.5),
|
||||||
|
@ -133,7 +134,8 @@ namespace smt {
|
||||||
template<typename Ext>
|
template<typename Ext>
|
||||||
void theory_utvpi<Ext>::reset_eh() {
|
void theory_utvpi<Ext>::reset_eh() {
|
||||||
m_graph .reset();
|
m_graph .reset();
|
||||||
m_zero = null_theory_var;
|
m_izero = null_theory_var;
|
||||||
|
m_rzero = null_theory_var;
|
||||||
m_atoms .reset();
|
m_atoms .reset();
|
||||||
m_asserted_atoms .reset();
|
m_asserted_atoms .reset();
|
||||||
m_stats .reset();
|
m_stats .reset();
|
||||||
|
@ -259,13 +261,13 @@ namespace smt {
|
||||||
template<typename Ext>
|
template<typename Ext>
|
||||||
void theory_utvpi<Ext>::init(context* ctx) {
|
void theory_utvpi<Ext>::init(context* ctx) {
|
||||||
theory::init(ctx);
|
theory::init(ctx);
|
||||||
m_zero = null_theory_var;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Ext>
|
template<typename Ext>
|
||||||
void theory_utvpi<Ext>::init_zero() {
|
void theory_utvpi<Ext>::init_zero() {
|
||||||
if (m_zero == null_theory_var) {
|
if (m_izero == null_theory_var) {
|
||||||
m_zero = mk_var(get_context().mk_enode(a.mk_numeral(rational(0), true), false, false, true));
|
m_izero = mk_var(get_context().mk_enode(a.mk_numeral(rational(0), true), false, false, true));
|
||||||
|
m_rzero = mk_var(get_context().mk_enode(a.mk_numeral(rational(0), false), false, false, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,7 +785,8 @@ namespace smt {
|
||||||
m.register_factory(m_factory);
|
m.register_factory(m_factory);
|
||||||
enforce_parity();
|
enforce_parity();
|
||||||
init_zero();
|
init_zero();
|
||||||
m_graph.set_to_zero(to_var(m_zero), neg(to_var(m_zero)));
|
m_graph.set_to_zero(to_var(m_izero), neg(to_var(m_izero)));
|
||||||
|
m_graph.set_to_zero(to_var(m_rzero), neg(to_var(m_rzero)));
|
||||||
compute_delta();
|
compute_delta();
|
||||||
DEBUG_CODE(model_validate(););
|
DEBUG_CODE(model_validate(););
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue