mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
user propagator
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
ba4a218fc0
commit
eef05e00af
|
@ -468,7 +468,14 @@ namespace smt {
|
||||||
enode* n = get_enode(v);
|
enode* n = get_enode(v);
|
||||||
if (ctx.watches_fixed(n)) {
|
if (ctx.watches_fixed(n)) {
|
||||||
expr_ref num(m_util.mk_numeral(val, m.get_sort(n->get_owner())), m);
|
expr_ref num(m_util.mk_numeral(val, m.get_sort(n->get_owner())), m);
|
||||||
ctx.assign_fixed(n, num, m_bits[v]);
|
literal_vector& lits = m_tmp_literals;
|
||||||
|
lits.reset();
|
||||||
|
for (literal b : m_bits[v]) {
|
||||||
|
if (ctx.get_assignment(b) == l_false)
|
||||||
|
b.neg();
|
||||||
|
lits.push_back(b);
|
||||||
|
}
|
||||||
|
ctx.assign_fixed(n, num, lits);
|
||||||
}
|
}
|
||||||
unsigned sz = get_bv_size(v);
|
unsigned sz = get_bv_size(v);
|
||||||
value_sort_pair key(val, sz);
|
value_sort_pair key(val, sz);
|
||||||
|
|
|
@ -92,29 +92,24 @@ void user_propagator::propagate() {
|
||||||
return;
|
return;
|
||||||
force_push();
|
force_push();
|
||||||
unsigned qhead = m_qhead;
|
unsigned qhead = m_qhead;
|
||||||
literal_vector lits;
|
|
||||||
enode_pair_vector eqs;
|
enode_pair_vector eqs;
|
||||||
justification* js;
|
justification* js;
|
||||||
while (qhead < m_prop.size() && !ctx.inconsistent()) {
|
while (qhead < m_prop.size() && !ctx.inconsistent()) {
|
||||||
auto const& prop = m_prop[qhead];
|
auto const& prop = m_prop[qhead];
|
||||||
lits.reset();
|
m_lits.reset();
|
||||||
for (unsigned id : prop.m_ids)
|
for (unsigned id : prop.m_ids)
|
||||||
for (literal lit : m_id2justification[id]) {
|
m_lits.append(m_id2justification[id]);
|
||||||
if (ctx.get_assignment(lit) == l_false)
|
|
||||||
lit.neg();
|
|
||||||
lits.push_back(lit);
|
|
||||||
}
|
|
||||||
if (m.is_false(prop.m_conseq)) {
|
if (m.is_false(prop.m_conseq)) {
|
||||||
js = ctx.mk_justification(
|
js = ctx.mk_justification(
|
||||||
ext_theory_conflict_justification(
|
ext_theory_conflict_justification(
|
||||||
get_id(), ctx.get_region(), lits.size(), lits.c_ptr(), eqs.size(), eqs.c_ptr(), 0, nullptr));
|
get_id(), ctx.get_region(), m_lits.size(), m_lits.c_ptr(), eqs.size(), eqs.c_ptr(), 0, nullptr));
|
||||||
ctx.set_conflict(js);
|
ctx.set_conflict(js);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
literal lit = mk_literal(prop.m_conseq);
|
literal lit = mk_literal(prop.m_conseq);
|
||||||
js = ctx.mk_justification(
|
js = ctx.mk_justification(
|
||||||
ext_theory_propagation_justification(
|
ext_theory_propagation_justification(
|
||||||
get_id(), ctx.get_region(), lits.size(), lits.c_ptr(), eqs.size(), eqs.c_ptr(), lit));
|
get_id(), ctx.get_region(), m_lits.size(), m_lits.c_ptr(), eqs.size(), eqs.c_ptr(), lit));
|
||||||
ctx.assign(lit, js);
|
ctx.assign(lit, js);
|
||||||
}
|
}
|
||||||
++qhead;
|
++qhead;
|
||||||
|
|
|
@ -46,6 +46,7 @@ namespace smt {
|
||||||
unsigned_vector m_prop_lim;
|
unsigned_vector m_prop_lim;
|
||||||
vector<literal_vector> m_id2justification;
|
vector<literal_vector> m_id2justification;
|
||||||
unsigned m_num_scopes;
|
unsigned m_num_scopes;
|
||||||
|
literal_vector m_lits;
|
||||||
|
|
||||||
void force_push();
|
void force_push();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue