mirror of
https://github.com/Z3Prover/z3
synced 2025-08-04 18:30:24 +00:00
add card operator to bapa
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
aafb16e8ed
commit
7e2afca2c6
7 changed files with 70 additions and 20 deletions
|
@ -204,7 +204,7 @@ namespace smt {
|
|||
return l_true;
|
||||
}
|
||||
|
||||
lbool ensure_disjoint(app* sz1, app* sz2) {
|
||||
bool ensure_disjoint(app* sz1, app* sz2) {
|
||||
sz_info& i1 = *m_sizeof[sz1];
|
||||
sz_info& i2 = *m_sizeof[sz2];
|
||||
SASSERT(i1.m_is_leaf);
|
||||
|
@ -214,16 +214,16 @@ namespace smt {
|
|||
enode* r1 = get_root(s);
|
||||
enode* r2 = get_root(t);
|
||||
if (r1 == r2) {
|
||||
return l_true;
|
||||
return true;
|
||||
}
|
||||
if (!ctx().is_diseq(r1, r2) && ctx().assume_eq(r1, r2)) {
|
||||
return l_false;
|
||||
return false;
|
||||
}
|
||||
if (do_intersect(i1.m_selects, i2.m_selects)) {
|
||||
add_disjoint(sz1, sz2);
|
||||
return l_false;
|
||||
return false;
|
||||
}
|
||||
return l_true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool do_intersect(obj_map<enode, expr*> const& s, obj_map<enode, expr*> const& t) const {
|
||||
|
@ -436,6 +436,15 @@ namespace smt {
|
|||
reset();
|
||||
}
|
||||
|
||||
void internalize_term(app* term) {
|
||||
if (th.is_set_has_size(term)) {
|
||||
internalize_size(term);
|
||||
}
|
||||
else if (th.is_set_card(term)) {
|
||||
internalize_card(term);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Size(S, n) => n >= 0, default(S) = false
|
||||
*/
|
||||
|
@ -458,6 +467,17 @@ namespace smt {
|
|||
ctx().push_trail(remove_sz(m_sizeof, term));
|
||||
}
|
||||
|
||||
/**
|
||||
\brief whenever there is a cardinality function, it includes an axiom
|
||||
that entails the set is finite.
|
||||
*/
|
||||
void internalize_card(app* term) {
|
||||
SASSERT(ctx().e_internalized(term));
|
||||
app_ref has_size(m_autil.mk_has_size(term->get_arg(0), term), m);
|
||||
literal lit = mk_literal(has_size);
|
||||
ctx().assign(lit, nullptr);
|
||||
}
|
||||
|
||||
final_check_status final_check() {
|
||||
lbool r = ensure_functional();
|
||||
if (r == l_true) update_indices();
|
||||
|
@ -494,7 +514,7 @@ namespace smt {
|
|||
|
||||
theory_array_bapa::~theory_array_bapa() { dealloc(m_imp); }
|
||||
|
||||
void theory_array_bapa::internalize_size(app* term) { m_imp->internalize_size(term); }
|
||||
void theory_array_bapa::internalize_term(app* term) { m_imp->internalize_term(term); }
|
||||
|
||||
final_check_status theory_array_bapa::final_check() { return m_imp->final_check(); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue