mirror of
https://github.com/Z3Prover/z3
synced 2025-08-23 19:47:52 +00:00
fix #6623
This commit is contained in:
parent
e6ea81546e
commit
4a142b0f81
3 changed files with 15 additions and 4 deletions
|
@ -41,6 +41,11 @@ namespace pb {
|
||||||
SASSERT(m_pb.is_pb(e));
|
SASSERT(m_pb.is_pb(e));
|
||||||
app* t = to_app(e);
|
app* t = to_app(e);
|
||||||
rational k = m_pb.get_k(t);
|
rational k = m_pb.get_k(t);
|
||||||
|
if (!root && is_app(e)) {
|
||||||
|
sat::literal lit = si.get_cached(to_app(e));
|
||||||
|
if (lit != sat::null_literal)
|
||||||
|
return sign ? ~lit : lit;
|
||||||
|
}
|
||||||
switch (t->get_decl_kind()) {
|
switch (t->get_decl_kind()) {
|
||||||
case OP_AT_MOST_K:
|
case OP_AT_MOST_K:
|
||||||
return convert_at_most_k(t, k, root, sign);
|
return convert_at_most_k(t, k, root, sign);
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace sat {
|
||||||
virtual literal internalize(expr* e) = 0;
|
virtual literal internalize(expr* e) = 0;
|
||||||
virtual bool_var to_bool_var(expr* e) = 0;
|
virtual bool_var to_bool_var(expr* e) = 0;
|
||||||
virtual bool_var add_bool_var(expr* e) = 0;
|
virtual bool_var add_bool_var(expr* e) = 0;
|
||||||
|
virtual literal get_cached(app* t) const = 0;
|
||||||
virtual bool is_cached(app* t, literal l) const = 0;
|
virtual bool is_cached(app* t, literal l) const = 0;
|
||||||
virtual void cache(app* t, literal l) = 0;
|
virtual void cache(app* t, literal l) = 0;
|
||||||
virtual void uncache(literal l) = 0;
|
virtual void uncache(literal l) = 0;
|
||||||
|
|
|
@ -276,11 +276,16 @@ struct goal2sat::imp : public sat::sat_internalizer {
|
||||||
m_cache_trail.push_back(t);
|
m_cache_trail.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sat::literal get_cached(app* t) const override {
|
||||||
|
sat::literal lit = sat::null_literal;
|
||||||
|
m_app2lit.find(t, lit);
|
||||||
|
return lit;
|
||||||
|
}
|
||||||
|
|
||||||
bool is_cached(app* t, sat::literal l) const override {
|
bool is_cached(app* t, sat::literal l) const override {
|
||||||
if (!m_app2lit.contains(t))
|
sat::literal lit = get_cached(t);
|
||||||
return false;
|
SASSERT(lit == sat::null_literal || l == lit);
|
||||||
SASSERT(m_app2lit[t] == l);
|
return l == lit;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void convert_atom(expr * t, bool root, bool sign) {
|
void convert_atom(expr * t, bool root, bool sign) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue