3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00

streamline unicode/ascii toggling. Fix bit-width for unicode to 18

This commit is contained in:
Nikolaj Bjorner 2021-01-23 11:11:44 -08:00
parent 90eb4de526
commit 03fd251ccb
6 changed files with 36 additions and 22 deletions

View file

@ -811,7 +811,7 @@ void seq_axioms::add_str_to_code_axiom(expr* n) {
VERIFY(seq.str.is_to_code(n, e));
literal len_is1 = mk_eq(mk_len(e), a.mk_int(1));
add_axiom(~len_is1, mk_ge(n, 0));
add_axiom(~len_is1, mk_le(n, zstring::max_char()));
add_axiom(~len_is1, mk_le(n, seq.max_char()));
add_axiom(len_is1, mk_eq(n, a.mk_int(-1)));
}
@ -824,7 +824,7 @@ void seq_axioms::add_str_from_code_axiom(expr* n) {
expr* e = nullptr;
VERIFY(seq.str.is_from_code(n, e));
literal ge = mk_ge(e, 0);
literal le = mk_le(e, zstring::max_char());
literal le = mk_le(e, seq.max_char());
literal emp = mk_literal(seq.str.mk_is_empty(n));
add_axiom(~ge, ~le, mk_eq(mk_len(n), a.mk_int(1)));
add_axiom(~ge, ~le, mk_eq(seq.str.mk_to_code(n), e));

View file

@ -81,7 +81,7 @@ namespace smt {
}
}
else {
for (unsigned i = 0; i < zstring::num_bits(); ++i)
for (unsigned i = 0; i < seq.num_bits(); ++i)
ebits.push_back(seq.mk_char_bit(e, i));
ctx().internalize(ebits.c_ptr(), ebits.size(), true);
for (expr* arg : ebits)
@ -92,7 +92,9 @@ namespace smt {
ctx().mark_as_relevant(bits2char);
enode* n1 = th.ensure_enode(e);
enode* n2 = th.ensure_enode(bits2char);
justification* j = ctx().mk_justification(ext_theory_eq_propagation_justification(th.get_id(), ctx().get_region(), 0, nullptr, 0, nullptr, n1, n2));
justification* j =
ctx().mk_justification(
ext_theory_eq_propagation_justification(th.get_id(), ctx().get_region(), n1, n2));
ctx().assign_eq(n1, n2, eq_justification(j));
}
++m_stats.m_num_blast;
@ -206,7 +208,7 @@ namespace smt {
enforce_ackerman(u, v);
return false;
}
if (c >= zstring::max_char()) {
if (c >= seq.max_char()) {
enforce_value_bound(v);
return false;
}
@ -232,7 +234,7 @@ namespace smt {
if (seq.is_char(e) && m_var2value[v] == UINT_MAX) {
d = c;
while (values.contains(c)) {
c = (c + 1) % zstring::max_char();
c = (c + 1) % seq.max_char();
if (d == c) {
enforce_bits();
return false;
@ -260,7 +262,7 @@ namespace smt {
void seq_unicode::enforce_value_bound(theory_var v) {
TRACE("seq", tout << "enforce bound " << v << "\n";);
enode* n = th.ensure_enode(seq.mk_char(zstring::max_char()));
enode* n = th.ensure_enode(seq.mk_char(seq.max_char()));
theory_var w = n->get_th_var(th.get_id());
SASSERT(has_bits(w));
init_bits(v);
@ -317,7 +319,7 @@ namespace smt {
void seq_unicode::collect_statistics(::statistics& st) const {
st.update("seq char ackerman", m_stats.m_num_ackerman);
st.update("seq char bounds", m_stats.m_num_bounds);
st.update("seq char2bit", m_stats.m_num_blast);
st.update("seq char2bit", m_stats.m_num_blast);
}
}

View file

@ -373,6 +373,12 @@ namespace smt {
unsigned num_params = 0, parameter* params = nullptr):
ext_theory_simple_justification(fid, r, num_lits, lits, num_eqs, eqs, num_params, params), m_lhs(lhs), m_rhs(rhs) {}
ext_theory_eq_propagation_justification(
family_id fid, region & r,
enode * lhs, enode * rhs):
ext_theory_simple_justification(fid, r, 0, nullptr, 0, nullptr, 0, nullptr), m_lhs(lhs), m_rhs(rhs) {}
proof * mk_proof(conflict_resolution & cr) override;
char const * get_name() const override { return "ext-theory-eq-propagation"; }