3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-15 13:28:47 +00:00
This commit is contained in:
Nikolaj Bjorner 2016-07-20 12:18:16 -07:00
commit a59ed0fc2f
6 changed files with 28 additions and 24 deletions

View file

@ -964,8 +964,7 @@ extern "C" {
case PR_TH_LEMMA: return Z3_OP_PR_TH_LEMMA; case PR_TH_LEMMA: return Z3_OP_PR_TH_LEMMA;
case PR_HYPER_RESOLVE: return Z3_OP_PR_HYPER_RESOLVE; case PR_HYPER_RESOLVE: return Z3_OP_PR_HYPER_RESOLVE;
default: default:
UNREACHABLE(); return Z3_OP_INTERNAL;
return Z3_OP_UNINTERPRETED;
} }
} }
if (mk_c(c)->get_arith_fid() == _d->get_family_id()) { if (mk_c(c)->get_arith_fid() == _d->get_family_id()) {
@ -989,8 +988,7 @@ extern "C" {
case OP_TO_INT: return Z3_OP_TO_INT; case OP_TO_INT: return Z3_OP_TO_INT;
case OP_IS_INT: return Z3_OP_IS_INT; case OP_IS_INT: return Z3_OP_IS_INT;
default: default:
UNREACHABLE(); return Z3_OP_INTERNAL;
return Z3_OP_UNINTERPRETED;
} }
} }
if (mk_c(c)->get_array_fid() == _d->get_family_id()) { if (mk_c(c)->get_array_fid() == _d->get_family_id()) {
@ -1008,8 +1006,7 @@ extern "C" {
case OP_AS_ARRAY: return Z3_OP_AS_ARRAY; case OP_AS_ARRAY: return Z3_OP_AS_ARRAY;
case OP_ARRAY_EXT: return Z3_OP_ARRAY_EXT; case OP_ARRAY_EXT: return Z3_OP_ARRAY_EXT;
default: default:
UNREACHABLE(); return Z3_OP_INTERNAL;
return Z3_OP_UNINTERPRETED;
} }
} }
@ -1075,8 +1072,7 @@ extern "C" {
case OP_BUREM_I: return Z3_OP_BUREM_I; case OP_BUREM_I: return Z3_OP_BUREM_I;
case OP_BSMOD_I: return Z3_OP_BSMOD_I; case OP_BSMOD_I: return Z3_OP_BSMOD_I;
default: default:
UNREACHABLE(); return Z3_OP_INTERNAL;
return Z3_OP_UNINTERPRETED;
} }
} }
if (mk_c(c)->get_dt_fid() == _d->get_family_id()) { if (mk_c(c)->get_dt_fid() == _d->get_family_id()) {
@ -1086,8 +1082,7 @@ extern "C" {
case OP_DT_ACCESSOR: return Z3_OP_DT_ACCESSOR; case OP_DT_ACCESSOR: return Z3_OP_DT_ACCESSOR;
case OP_DT_UPDATE_FIELD: return Z3_OP_DT_UPDATE_FIELD; case OP_DT_UPDATE_FIELD: return Z3_OP_DT_UPDATE_FIELD;
default: default:
UNREACHABLE(); return Z3_OP_INTERNAL;
return Z3_OP_UNINTERPRETED;
} }
} }
if (mk_c(c)->get_datalog_fid() == _d->get_family_id()) { if (mk_c(c)->get_datalog_fid() == _d->get_family_id()) {
@ -1108,8 +1103,7 @@ extern "C" {
case datalog::OP_DL_CONSTANT: return Z3_OP_FD_CONSTANT; case datalog::OP_DL_CONSTANT: return Z3_OP_FD_CONSTANT;
case datalog::OP_DL_LT: return Z3_OP_FD_LT; case datalog::OP_DL_LT: return Z3_OP_FD_LT;
default: default:
UNREACHABLE(); return Z3_OP_INTERNAL;
return Z3_OP_UNINTERPRETED;
} }
} }
@ -1135,7 +1129,7 @@ extern "C" {
case Z3_OP_RE_CONCAT: return Z3_OP_RE_CONCAT; case Z3_OP_RE_CONCAT: return Z3_OP_RE_CONCAT;
case Z3_OP_RE_UNION: return Z3_OP_RE_UNION; case Z3_OP_RE_UNION: return Z3_OP_RE_UNION;
default: default:
return Z3_OP_UNINTERPRETED; return Z3_OP_INTERNAL;
} }
} }
@ -1195,8 +1189,7 @@ extern "C" {
case OP_FPA_INTERNAL_TO_IEEE_BV_UNSPECIFIED: case OP_FPA_INTERNAL_TO_IEEE_BV_UNSPECIFIED:
return Z3_OP_UNINTERPRETED; return Z3_OP_UNINTERPRETED;
default: default:
UNREACHABLE(); return Z3_OP_INTERNAL;
return Z3_OP_UNINTERPRETED;
} }
} }
@ -1205,8 +1198,7 @@ extern "C" {
case OP_LABEL: return Z3_OP_LABEL; case OP_LABEL: return Z3_OP_LABEL;
case OP_LABEL_LIT: return Z3_OP_LABEL_LIT; case OP_LABEL_LIT: return Z3_OP_LABEL_LIT;
default: default:
UNREACHABLE(); return Z3_OP_INTERNAL;
return Z3_OP_UNINTERPRETED;
} }
} }
@ -1215,7 +1207,7 @@ extern "C" {
case OP_PB_LE: return Z3_OP_PB_LE; case OP_PB_LE: return Z3_OP_PB_LE;
case OP_PB_GE: return Z3_OP_PB_GE; case OP_PB_GE: return Z3_OP_PB_GE;
case OP_AT_MOST_K: return Z3_OP_PB_AT_MOST; case OP_AT_MOST_K: return Z3_OP_PB_AT_MOST;
default: UNREACHABLE(); default: return Z3_OP_INTERNAL;
} }
} }

View file

@ -945,6 +945,8 @@ typedef enum
- Z3_OP_FPA_TO_IEEE_BV: Floating-point conversion to IEEE-754 bit-vector - Z3_OP_FPA_TO_IEEE_BV: Floating-point conversion to IEEE-754 bit-vector
- Z3_OP_INTERNAL: internal (often interpreted) symbol, but no additional information is exposed. Tools may use the string representation of the function declaration to obtain more information.
- Z3_OP_UNINTERPRETED: kind used for uninterpreted symbols. - Z3_OP_UNINTERPRETED: kind used for uninterpreted symbols.
*/ */
typedef enum { typedef enum {
@ -1217,6 +1219,8 @@ typedef enum {
Z3_OP_FPA_MIN_I, Z3_OP_FPA_MIN_I,
Z3_OP_FPA_MAX_I, Z3_OP_FPA_MAX_I,
Z3_OP_INTERNAL,
Z3_OP_UNINTERPRETED Z3_OP_UNINTERPRETED
} Z3_decl_kind; } Z3_decl_kind;

View file

@ -2991,7 +2991,10 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro
for (unsigned i = 0; i < num_proofs; i++) tout << mk_pp(get_fact(proofs[i]), *this) << "\n"; for (unsigned i = 0; i < num_proofs; i++) tout << mk_pp(get_fact(proofs[i]), *this) << "\n";
tout << "===>\n"; tout << "===>\n";
tout << mk_pp(new_fact, *this) << "\n";); tout << mk_pp(new_fact, *this) << "\n";);
SASSERT(num_proofs == cls_sz || (num_proofs == cls_sz + 1 && is_false(new_fact))); //
// typically: num_proofs == cls_sz || (num_proofs == cls_sz + 1 && is_false(new_fact))
// but formula could have repeated literals that are merged in the clausal representation.
//
unsigned num_matches = 0; unsigned num_matches = 0;
for (unsigned i = 0; i < cls_sz; i++) { for (unsigned i = 0; i < cls_sz; i++) {
expr * lit = cls->get_arg(i); expr * lit = cls->get_arg(i);

View file

@ -1045,15 +1045,13 @@ namespace smt {
bool context::simplify_aux_clause_literals(unsigned & num_lits, literal * lits, literal_buffer & simp_lits) { bool context::simplify_aux_clause_literals(unsigned & num_lits, literal * lits, literal_buffer & simp_lits) {
std::sort(lits, lits + num_lits); std::sort(lits, lits + num_lits);
literal prev = null_literal; literal prev = null_literal;
unsigned i = 0;
unsigned j = 0; unsigned j = 0;
for (; i < num_lits; i++) { for (unsigned i = 0; i < num_lits; i++) {
literal curr = lits[i]; literal curr = lits[i];
lbool val = get_assignment(curr); lbool val = get_assignment(curr);
if (val == l_false)
simp_lits.push_back(~curr);
switch(val) { switch(val) {
case l_false: case l_false:
simp_lits.push_back(~curr);
break; // ignore literal break; // ignore literal
case l_undef: case l_undef:
if (curr == ~prev) if (curr == ~prev)
@ -1295,8 +1293,9 @@ namespace smt {
SASSERT(get_assignment(simp_lits[i]) == l_true); SASSERT(get_assignment(simp_lits[i]) == l_true);
} }
}); });
if (old_num_lits != num_lits) if (!simp_lits.empty()) {
j = mk_justification(unit_resolution_justification(m_region, j, simp_lits.size(), simp_lits.c_ptr())); j = mk_justification(unit_resolution_justification(m_region, j, simp_lits.size(), simp_lits.c_ptr()));
}
break; break;
} }
case CLS_AUX_LEMMA: { case CLS_AUX_LEMMA: {

View file

@ -52,6 +52,7 @@ namespace smt {
tout << lits[i] << " "; tout << lits[i] << " ";
} }
tout << "\n";); tout << "\n";);
SASSERT(m_num_literals > 0);
} }
unit_resolution_justification::unit_resolution_justification(justification * js, unit_resolution_justification::unit_resolution_justification(justification * js,
@ -68,6 +69,7 @@ namespace smt {
tout << lits[i] << " "; tout << lits[i] << " ";
} }
tout << "\n";); tout << "\n";);
SASSERT(num_lits != 0);
} }
unit_resolution_justification::~unit_resolution_justification() { unit_resolution_justification::~unit_resolution_justification() {

View file

@ -312,6 +312,7 @@ namespace smt {
SASSERT(v != null_theory_var); SASSERT(v != null_theory_var);
unsigned sz = bits.size(); unsigned sz = bits.size();
SASSERT(get_bv_size(n) == sz); SASSERT(get_bv_size(n) == sz);
m_bits[v].reset();
for (unsigned i = 0; i < sz; i++) { for (unsigned i = 0; i < sz; i++) {
expr * bit = bits.get(i); expr * bit = bits.get(i);
expr_ref s_bit(m); expr_ref s_bit(m);
@ -809,6 +810,7 @@ namespace smt {
theory_var v = e->get_th_var(get_id()); theory_var v = e->get_th_var(get_id());
unsigned num_args = n->get_num_args(); unsigned num_args = n->get_num_args();
unsigned i = num_args; unsigned i = num_args;
m_bits[v].reset();
while (i > 0) { while (i > 0) {
i--; i--;
theory_var arg = get_arg_var(e, i); theory_var arg = get_arg_var(e, i);
@ -830,6 +832,7 @@ namespace smt {
unsigned end = n->get_decl()->get_parameter(0).get_int(); unsigned end = n->get_decl()->get_parameter(0).get_int();
SASSERT(start <= end); SASSERT(start <= end);
literal_vector & arg_bits = m_bits[arg]; literal_vector & arg_bits = m_bits[arg];
m_bits[v].reset();
for (unsigned i = start; i <= end; ++i) for (unsigned i = start; i <= end; ++i)
add_bit(v, arg_bits[i]); add_bit(v, arg_bits[i]);
find_wpos(v); find_wpos(v);
@ -1533,6 +1536,7 @@ namespace smt {
} }
void theory_bv::unmerge_eh(theory_var v1, theory_var v2) { void theory_bv::unmerge_eh(theory_var v1, theory_var v2) {
// v1 was the root of the equivalence class // v1 was the root of the equivalence class
// I must remove the zero_one_bits that are from v2. // I must remove the zero_one_bits that are from v2.