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

add handlers for dense difference logic

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-03-24 01:31:00 -07:00
parent 0313f52cf2
commit c56c7fd649
2 changed files with 28 additions and 1 deletions

View file

@ -358,6 +358,7 @@ namespace opt {
}
smt::theory_opt& opt = get_optimizer();
smt::theory_var v = m_objective_vars[var];
TRACE("opt", tout << "v" << var << " " << val << "\n";);
if (typeid(smt::theory_inf_arith) == typeid(opt)) {
smt::theory_inf_arith& th = dynamic_cast<smt::theory_inf_arith&>(opt);
@ -387,8 +388,32 @@ namespace opt {
smt::theory_rdl& th = dynamic_cast<smt::theory_rdl&>(opt);
return th.mk_ge(m_fm, v, val);
}
if (typeid(smt::theory_dense_i) == typeid(opt) &&
val.get_infinitesimal().is_zero()) {
smt::theory_dense_i& th = dynamic_cast<smt::theory_dense_i&>(opt);
return th.mk_ge(m_fm, v, val);
}
// difference logic?
if (typeid(smt::theory_dense_mi) == typeid(opt) &&
val.get_infinitesimal().is_zero()) {
smt::theory_dense_mi& th = dynamic_cast<smt::theory_dense_mi&>(opt);
return th.mk_ge(m_fm, v, val);
}
if (typeid(smt::theory_dense_si) == typeid(opt) &&
val.get_infinitesimal().is_zero()) {
smt::theory_dense_si& th = dynamic_cast<smt::theory_dense_si&>(opt);
return th.mk_ge(m_fm, v, val);
}
if (typeid(smt::theory_dense_smi) == typeid(opt) &&
val.get_infinitesimal().is_zero()) {
smt::theory_dense_smi& th = dynamic_cast<smt::theory_dense_smi&>(opt);
return th.mk_ge(m_fm, v, val);
}
IF_VERBOSE(0, verbose_stream() << "WARNING: unhandled theory " << typeid(opt).name() << "\n";);
return expr_ref(m.mk_true(), m);
}

View file

@ -1019,6 +1019,7 @@ namespace smt {
template<typename Ext>
theory_var theory_dense_diff_logic<Ext>::add_objective(app* term) {
TRACE("opt", tout << mk_pp(term, get_manager()) << "\n";);
objective_term objective;
theory_var result = m_objectives.size();
rational q(1), r(0);
@ -1053,6 +1054,7 @@ namespace smt {
ast_manager& m = get_manager();
objective_term const& t = m_objectives[v];
expr_ref e(m), f(m), f2(m);
TRACE("opt", tout << "mk_ineq " << v << " " << val << "\n";);
if (t.size() == 1 && t[0].second.is_one()) {
f = get_enode(t[0].first)->get_owner();
}