3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-12-02 13:20:55 -08:00
parent 89c9bb2e0e
commit 1eab774b91
7 changed files with 77 additions and 59 deletions

View file

@ -4312,9 +4312,12 @@ namespace smt {
theory_id th_id = l->get_th_id();
for (enode * parent : enode::parents(n)) {
family_id fid = parent->get_owner()->get_family_id();
app* p = parent->get_owner();
family_id fid = p->get_family_id();
if (fid != th_id && fid != m.get_basic_family_id()) {
TRACE("is_shared", tout << enode_pp(n, *this) << "\nis shared because of:\n" << enode_pp(parent, *this) << "\n";);
TRACE("is_shared", tout << enode_pp(n, *this)
<< "\nis shared because of:\n"
<< enode_pp(parent, *this) << "\n";);
return true;
}
}

View file

@ -789,7 +789,7 @@ namespace smt {
false /* CC is not enabled */);
internalize(c, true);
internalize(t, false);
internalize(e, false);
internalize(e, false);
internalize(eq1, true);
internalize(eq2, true);
literal c_lit = get_literal(c);

View file

@ -430,6 +430,10 @@ namespace smt {
tout << "#" << n->get_arg(i)->get_owner_id() << " ";
}
tout << "\n";
for (expr* arg : args) {
tout << mk_pp(arg, m) << " ";
}
tout << "\n";
tout << "value: #" << n->get_owner_id() << "\n" << mk_ismt2_pp(result, m) << "\n";);
if (fi->get_entry(args.c_ptr()) == nullptr)
fi->insert_new_entry(args.c_ptr(), result);

View file

@ -169,7 +169,7 @@ namespace smt {
arith_eq_adapter m_arith_eq_adapter;
theory_diff_logic_statistics m_stats;
Graph m_graph;
theory_var m_zero; // cache the variable representing the zero variable.
theory_var m_izero, m_rzero; // cache the variable representing the zero variable.
int_vector m_scc_id; // Cheap equality propagation
eq_prop_info_set m_eq_prop_info_set; // set of existing equality prop infos
ptr_vector<eq_prop_info> m_eq_prop_infos;
@ -226,7 +226,8 @@ namespace smt {
m_params(params),
m_util(m),
m_arith_eq_adapter(*this, params, m_util),
m_zero(null_theory_var),
m_izero(null_theory_var),
m_rzero(null_theory_var),
m_terms(m),
m_asserted_qhead(0),
m_num_core_conflicts(0),
@ -374,7 +375,7 @@ namespace smt {
void get_implied_bound_antecedents(edge_id bridge_edge, edge_id subsumed_edge, conflict_resolution & cr);
theory_var get_zero() const { return m_zero; }
theory_var get_zero(bool is_int) const { return is_int ? m_izero : m_rzero; }
void inc_conflicts();

View file

@ -71,7 +71,12 @@ void theory_diff_logic<Ext>::init(context * ctx) {
zero = m_util.mk_numeral(rational(0), true);
e = ctx->mk_enode(zero, false, false, true);
SASSERT(!is_attached_to_var(e));
m_zero = mk_var(e);
m_izero = mk_var(e);
zero = m_util.mk_numeral(rational(0), false);
e = ctx->mk_enode(zero, false, false, true);
SASSERT(!is_attached_to_var(e));
m_rzero = mk_var(e);
}
@ -207,7 +212,7 @@ bool theory_diff_logic<Ext>::internalize_atom(app * n, bool gate_ctx) {
}
else {
target = mk_var(lhs);
source = get_zero();
source = get_zero(m_util.is_int(lhs));
}
if (is_ge) {
@ -360,7 +365,8 @@ final_check_status theory_diff_logic<Ext>::final_check_eh() {
TRACE("arith_final", display(tout); );
// either will already be zero (as we don't do mixed constraints).
m_graph.set_to_zero(m_zero);
m_graph.set_to_zero(m_izero);
m_graph.set_to_zero(m_rzero);
SASSERT(is_consistent());
if (m_non_diff_logic_exprs) {
return FC_GIVEUP;
@ -751,22 +757,7 @@ theory_var theory_diff_logic<Ext>::mk_term(app* n) {
m_graph.enable_edge(m_graph.add_edge(target, source, -k, null_literal));
return target;
}
else if (m_util.is_add(n)) {
return null_theory_var;
}
else if (m_util.is_mul(n)) {
return null_theory_var;
}
else if (m_util.is_div(n)) {
return null_theory_var;
}
else if (m_util.is_idiv(n)) {
return null_theory_var;
}
else if (m_util.is_mod(n)) {
return null_theory_var;
}
else if (m_util.is_rem(n)) {
else if (m_util.is_arith_expr(n)) {
return null_theory_var;
}
else {
@ -781,7 +772,7 @@ theory_var theory_diff_logic<Ext>::mk_num(app* n, rational const& r) {
enode* e = nullptr;
context& ctx = get_context();
if (r.is_zero()) {
v = get_zero();
v = get_zero(m_util.is_int(n));
}
else if (ctx.e_internalized(n)) {
e = ctx.get_enode(n);
@ -789,7 +780,7 @@ theory_var theory_diff_logic<Ext>::mk_num(app* n, rational const& r) {
SASSERT(v != null_theory_var);
}
else {
theory_var zero = get_zero();
theory_var zero = get_zero(m_util.is_int(n));
SASSERT(n->get_num_args() == 0);
e = ctx.mk_enode(n, false, false, true);
v = mk_var(e);
@ -847,7 +838,8 @@ void theory_diff_logic<Ext>::reset_eh() {
dealloc(m_atoms[i]);
}
m_graph .reset();
m_zero = null_theory_var;
m_izero = null_theory_var;
m_rzero = null_theory_var;
m_atoms .reset();
m_asserted_atoms .reset();
m_stats .reset();
@ -1128,8 +1120,8 @@ void theory_diff_logic<Ext>::update_simplex(Simplex& S) {
S.set_value(node2simplex(i), q);
inf_mgr.del(q);
}
S.set_lower(node2simplex(get_zero()), mpq_inf(mpq(0), mpq(0)));
S.set_upper(node2simplex(get_zero()), mpq_inf(mpq(0), mpq(0)));
S.set_lower(node2simplex(get_zero(true)), mpq_inf(mpq(0), mpq(0)));
S.set_upper(node2simplex(get_zero(true)), mpq_inf(mpq(0), mpq(0)));
svector<unsigned> vars;
scoped_mpq_vector coeffs(mgr);
coeffs.push_back(mpq(1));