3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-29 09:28:45 +00:00

improve parser error message over API, streamline names of statistics for arithmetic solver

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2016-12-25 17:27:56 -08:00
parent c44dd01292
commit 2bd29548da
8 changed files with 54 additions and 25 deletions

View file

@ -44,6 +44,7 @@ namespace smt {
SASSERT(lower_bound(v).is_rational());
numeral const & val = lower_bound(v).get_rational();
value_sort_pair key(val, is_int_src(v));
TRACE("arith_eq", tout << mk_pp(get_enode(v)->get_owner(), get_manager()) << " = " << val << "\n";);
theory_var v2;
if (m_fixed_var_table.find(key, v2)) {
if (v2 < static_cast<int>(get_num_vars()) && is_fixed(v2) && lower_bound(v2).get_rational() == val) {
@ -247,6 +248,7 @@ namespace smt {
//
// x1 <= k1 x1 >= k1, x2 <= x1 + k2 x2 >= x1 + k2
//
TRACE("arith_eq_propagation", tout << "fixed\n";);
lower(x2)->push_justification(ante, numeral::zero(), proofs_enabled());
upper(x2)->push_justification(ante, numeral::zero(), proofs_enabled());
m_stats.m_fixed_eqs++;
@ -324,28 +326,42 @@ namespace smt {
template<typename Ext>
void theory_arith<Ext>::propagate_eq_to_core(theory_var x, theory_var y, antecedents& antecedents) {
// Ignore equality if variables are already known to be equal.
ast_manager& m = get_manager();
if (is_equal(x, y))
return;
// I doesn't make sense to propagate an equality (to the core) of variables of different sort.
if (get_manager().get_sort(var2expr(x)) != get_manager().get_sort(var2expr(y))) {
TRACE("arith", tout << mk_pp(var2expr(x), get_manager()) << " = " << mk_pp(var2expr(y), get_manager()) << "\n";);
if (m.get_sort(var2expr(x)) != m.get_sort(var2expr(y))) {
TRACE("arith", tout << mk_pp(var2expr(x), m) << " = " << mk_pp(var2expr(y), m) << "\n";);
return;
}
context & ctx = get_context();
region & r = ctx.get_region();
enode * _x = get_enode(x);
enode * _y = get_enode(y);
eq_vector const& eqs = antecedents.eqs();
literal_vector const& lits = antecedents.lits();
justification * js =
ctx.mk_justification(
ext_theory_eq_propagation_justification(
get_id(), r,
antecedents.lits().size(), antecedents.lits().c_ptr(),
antecedents.eqs().size(), antecedents.eqs().c_ptr(),
lits.size(), lits.c_ptr(),
eqs.size(), eqs.c_ptr(),
_x, _y,
antecedents.num_params(), antecedents.params("eq-propagate")));
TRACE("arith_eq", tout << "detected equality: #" << _x->get_owner_id() << " = #" << _y->get_owner_id() << "\n";
display_var(tout, x);
display_var(tout, y););
TRACE("arith_eq_propagation",
for (unsigned i = 0; i < lits.size(); ++i) {
ctx.display_detailed_literal(tout, lits[i]);
tout << "\n";
}
for (unsigned i = 0; i < eqs.size(); ++i) {
tout << mk_pp(eqs[i].first->get_owner(), m) << " = " << mk_pp(eqs[i].second->get_owner(), m) << "\n";
}
tout << " ==> ";
tout << mk_pp(_x->get_owner(), m) << " = " << mk_pp(_y->get_owner(), m) << "\n";
);
ctx.assign_eq(_x, _y, eq_justification(js));
}
};