mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
Merge branch 'unstable' into interp
This commit is contained in:
commit
a785a5a4b8
33 changed files with 1995 additions and 1628 deletions
|
@ -820,6 +820,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// Update the assignment of variable v, that is,
|
||||
// m_assignment[v] += inc
|
||||
// This method also stores the old value of v in the assignment stack.
|
||||
|
@ -829,6 +830,12 @@ public:
|
|||
m_assignment[v] += inc;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
void inc_assignment(dl_var v, numeral const& inc) {
|
||||
m_assignment[v] += inc;
|
||||
}
|
||||
|
||||
|
||||
struct every_var_proc {
|
||||
bool operator()(dl_var v) const {
|
||||
|
|
|
@ -189,11 +189,12 @@ public:
|
|||
max_size = Number(usz);
|
||||
has_max = true;
|
||||
}
|
||||
Number start = set->m_next;
|
||||
Number & next = set->m_next;
|
||||
while (!is_new) {
|
||||
result = mk_value(next, s, is_new);
|
||||
next++;
|
||||
if (has_max && next > max_size + set->m_next) {
|
||||
if (has_max && next > max_size + start) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -975,9 +975,11 @@ namespace smt {
|
|||
// Moreover, a model assigns an arbitrary intepretation to these sorts using "model_values" a model value.
|
||||
// If these module values "leak" inside the logical context, they may affect satisfiability.
|
||||
//
|
||||
// n->insert(m_model->get_some_value(n->get_sort()), 0);
|
||||
// TODO: we can use get_some_value if the sort n->get_sort() does not depend on any uninterpreted sorts.
|
||||
n->insert(m_manager.mk_fresh_const("elem", n->get_sort()), 0);
|
||||
sort * ns = n->get_sort();
|
||||
if (m_manager.is_fully_interp(ns))
|
||||
n->insert(m_model->get_some_value(ns), 0);
|
||||
else
|
||||
n->insert(m_manager.mk_fresh_const("elem", ns), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -581,10 +581,13 @@ namespace smt {
|
|||
void theory_bv::assert_int2bv_axiom(app* n) {
|
||||
//
|
||||
// create the axiom:
|
||||
// bv2int(n) = e mod 2^bit_width
|
||||
//
|
||||
// bv2int(n) = e mod 2^bit_width
|
||||
// where n = int2bv(e)
|
||||
//
|
||||
// Create the axioms:
|
||||
// bit2bool(i,n) == ((e div 2^i) mod 2 != 0)
|
||||
// for i = 0,.., sz-1
|
||||
//
|
||||
SASSERT(get_context().e_internalized(n));
|
||||
SASSERT(m_util.is_int2bv(n));
|
||||
ast_manager & m = get_manager();
|
||||
|
@ -592,10 +595,12 @@ namespace smt {
|
|||
|
||||
parameter param(m_autil.mk_int());
|
||||
expr* n_expr = n;
|
||||
expr* lhs = m.mk_app(get_id(), OP_BV2INT, 1, ¶m, 1, &n_expr);
|
||||
expr* e = n->get_arg(0);
|
||||
expr_ref lhs(m), rhs(m);
|
||||
lhs = m.mk_app(get_id(), OP_BV2INT, 1, ¶m, 1, &n_expr);
|
||||
unsigned sz = m_util.get_bv_size(n);
|
||||
numeral mod = power(numeral(2), sz);
|
||||
expr* rhs = m_autil.mk_mod(n->get_arg(0), m_autil.mk_numeral(mod, true));
|
||||
rhs = m_autil.mk_mod(e, m_autil.mk_numeral(mod, true));
|
||||
|
||||
literal l(mk_eq(lhs, rhs, false));
|
||||
ctx.mark_as_relevant(l);
|
||||
|
@ -605,6 +610,24 @@ namespace smt {
|
|||
tout << mk_pp(lhs, m) << " == \n";
|
||||
tout << mk_pp(rhs, m) << "\n";
|
||||
);
|
||||
|
||||
expr_ref_vector n_bits(m);
|
||||
enode * n_enode = mk_enode(n);
|
||||
get_bits(n_enode, n_bits);
|
||||
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
numeral div = power(numeral(2), i);
|
||||
mod = numeral(2);
|
||||
rhs = m_autil.mk_idiv(e, m_autil.mk_numeral(div,true));
|
||||
rhs = m_autil.mk_mod(rhs, m_autil.mk_numeral(mod, true));
|
||||
rhs = m.mk_eq(rhs, m_autil.mk_numeral(rational(1), true));
|
||||
lhs = n_bits.get(i);
|
||||
TRACE("bv", tout << mk_pp(lhs, m) << " == " << mk_pp(rhs, m) << "\n";);
|
||||
l = literal(mk_eq(lhs, rhs, false));
|
||||
ctx.mark_as_relevant(l);
|
||||
ctx.mk_th_axiom(get_id(), 1, &l);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -752,7 +752,8 @@ namespace smt {
|
|||
|
||||
for (unsigned j = 0; j < zero_v.size(); ++j) {
|
||||
int v = zero_v[j];
|
||||
m_graph.acc_assignment(v, numeral(-1));
|
||||
|
||||
m_graph.inc_assignment(v, numeral(-1));
|
||||
th_var k = from_var(v);
|
||||
if (!is_parity_ok(k)) {
|
||||
todo.push_back(k);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue