mirror of
https://github.com/Z3Prover/z3
synced 2025-07-23 12:48:53 +00:00
working on cardinality tactic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
2f04918c39
commit
05b37b2f07
1 changed files with 7 additions and 6 deletions
|
@ -55,21 +55,21 @@ namespace smt {
|
||||||
TRACE("card", tout << "internalize: " << mk_pp(atom, m) << "\n";);
|
TRACE("card", tout << "internalize: " << mk_pp(atom, m) << "\n";);
|
||||||
|
|
||||||
SASSERT(!ctx.b_internalized(atom));
|
SASSERT(!ctx.b_internalized(atom));
|
||||||
bool_var bv = ctx.mk_bool_var(atom);
|
bool_var abv = ctx.mk_bool_var(atom);
|
||||||
|
|
||||||
if (k >= atom->get_num_args()) {
|
if (k >= atom->get_num_args()) {
|
||||||
literal lit(bv);
|
literal lit(abv);
|
||||||
ctx.mk_th_axiom(get_id(), 1, &lit);
|
ctx.mk_th_axiom(get_id(), 1, &lit);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
card* c = alloc(card, bv, k);
|
card* c = alloc(card, abv, k);
|
||||||
for (unsigned i = 0; i < num_args; ++i) {
|
for (unsigned i = 0; i < num_args; ++i) {
|
||||||
expr* arg = atom->get_arg(i);
|
expr* arg = atom->get_arg(i);
|
||||||
if (!ctx.b_internalized(arg)) {
|
if (!ctx.b_internalized(arg)) {
|
||||||
ctx.internalize(arg, false);
|
ctx.internalize(arg, false);
|
||||||
}
|
}
|
||||||
|
bool_var bv;
|
||||||
bool has_bv = false;
|
bool has_bv = false;
|
||||||
if (!m.is_not(arg) && ctx.b_internalized(arg)) {
|
if (!m.is_not(arg) && ctx.b_internalized(arg)) {
|
||||||
bv = ctx.get_bool_var(arg);
|
bv = ctx.get_bool_var(arg);
|
||||||
|
@ -108,12 +108,13 @@ namespace smt {
|
||||||
else {
|
else {
|
||||||
// bv <=> (and (not bv1) ... (not bv_n))
|
// bv <=> (and (not bv1) ... (not bv_n))
|
||||||
literal_vector& lits = get_lits();
|
literal_vector& lits = get_lits();
|
||||||
lits.push_back(literal(bv));
|
lits.push_back(literal(abv));
|
||||||
for (unsigned i = 0; i < c->m_args.size(); ++i) {
|
for (unsigned i = 0; i < c->m_args.size(); ++i) {
|
||||||
ctx.mk_th_axiom(get_id(), ~literal(bv), ~literal(c->m_args[i]));
|
ctx.mk_th_axiom(get_id(), ~literal(abv), ~literal(c->m_args[i]));
|
||||||
lits.push_back(literal(c->m_args[i]));
|
lits.push_back(literal(c->m_args[i]));
|
||||||
}
|
}
|
||||||
ctx.mk_th_axiom(get_id(), lits.size(), lits.c_ptr());
|
ctx.mk_th_axiom(get_id(), lits.size(), lits.c_ptr());
|
||||||
|
dealloc(c);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue