mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 20:18:18 +00:00
na
This commit is contained in:
parent
8de96009cd
commit
7edc99f807
|
@ -126,6 +126,8 @@ expr* theory_seq::expr2rep(expr* e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief
|
\brief
|
||||||
|
|
||||||
|
@ -158,7 +160,6 @@ expr* theory_seq::expr2rep(expr* e) {
|
||||||
TODO: propagate length offsets for last vars
|
TODO: propagate length offsets for last vars
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#if 0
|
|
||||||
bool theory_seq::find_better_rep(expr_ref_vector const& ls, expr_ref_vector const& rs, unsigned idx,
|
bool theory_seq::find_better_rep(expr_ref_vector const& ls, expr_ref_vector const& rs, unsigned idx,
|
||||||
dependency*& deps, expr_ref_vector & res) {
|
dependency*& deps, expr_ref_vector & res) {
|
||||||
|
|
||||||
|
@ -235,6 +236,32 @@ bool theory_seq::find_better_rep(expr_ref_vector const& ls, expr_ref_vector cons
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int theory_seq::find_fst_non_empty_idx(expr_ref_vector const& xs) {
|
||||||
|
for (unsigned i = 0; i < xs.size(); ++i) {
|
||||||
|
expr* x = xs[i];
|
||||||
|
if (!is_var(x))
|
||||||
|
return -1;
|
||||||
|
expr_ref e = mk_len(x);
|
||||||
|
if (ctx.e_internalized(e)) {
|
||||||
|
enode* root = ctx.get_enode(e)->get_root();
|
||||||
|
rational val;
|
||||||
|
if (m_autil.is_numeral(root->get_expr(), val) && val.is_zero()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
expr* theory_seq::find_fst_non_empty_var(expr_ref_vector const& x) {
|
||||||
|
int i = find_fst_non_empty_idx(x);
|
||||||
|
if (i >= 0)
|
||||||
|
return x[i];
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool theory_seq::has_len_offset(expr_ref_vector const& ls, expr_ref_vector const& rs, int & offset) {
|
bool theory_seq::has_len_offset(expr_ref_vector const& ls, expr_ref_vector const& rs, int & offset) {
|
||||||
|
@ -399,20 +426,17 @@ bool theory_seq::branch_variable_mb() {
|
||||||
rational l1, l2;
|
rational l1, l2;
|
||||||
for (const auto& elem : len1) l1 += elem;
|
for (const auto& elem : len1) l1 += elem;
|
||||||
for (const auto& elem : len2) l2 += elem;
|
for (const auto& elem : len2) l2 += elem;
|
||||||
if (l1 != l2) {
|
if (l1 == l2 && split_lengths(e.dep(), e.ls, e.rs, len1, len2)) {
|
||||||
expr_ref l = mk_concat(e.ls);
|
|
||||||
expr_ref r = mk_concat(e.rs);
|
|
||||||
expr_ref lnl = mk_len(l), lnr = mk_len(r);
|
|
||||||
if (propagate_eq(e.dep(), lnl, lnr, false)) {
|
|
||||||
change = true;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (split_lengths(e.dep(), e.ls, e.rs, len1, len2)) {
|
|
||||||
TRACE("seq", tout << "split lengths\n";);
|
TRACE("seq", tout << "split lengths\n";);
|
||||||
change = true;
|
change = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expr_ref l = mk_concat(e.ls);
|
||||||
|
expr_ref r = mk_concat(e.rs);
|
||||||
|
expr_ref lnl = mk_len(l), lnr = mk_len(r);
|
||||||
|
if (propagate_eq(e.dep(), lnl, lnr, false))
|
||||||
|
change = true;
|
||||||
}
|
}
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
@ -601,6 +625,14 @@ bool theory_seq::branch_binary_variable(depeq const& e) {
|
||||||
bool theory_seq::branch_unit_variable() {
|
bool theory_seq::branch_unit_variable() {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
for (auto const& e : m_eqs) {
|
for (auto const& e : m_eqs) {
|
||||||
|
#if 0
|
||||||
|
eqr er(e.ls, e.rs);
|
||||||
|
m_eq_deps = e.deps;
|
||||||
|
if (m_eq.branch(0, er)) {
|
||||||
|
result = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (is_unit_eq(e.ls, e.rs) &&
|
if (is_unit_eq(e.ls, e.rs) &&
|
||||||
branch_unit_variable(e.dep(), e.ls[0], e.rs)) {
|
branch_unit_variable(e.dep(), e.ls[0], e.rs)) {
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -611,6 +643,7 @@ bool theory_seq::branch_unit_variable() {
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
CTRACE("seq", result, tout << "branch unit variable\n";);
|
CTRACE("seq", result, tout << "branch unit variable\n";);
|
||||||
return result;
|
return result;
|
||||||
|
@ -842,7 +875,9 @@ bool theory_seq::branch_quat_variable(depeq const& e) {
|
||||||
else if (!can_align_from_lhs(xs, ys) && !can_align_from_rhs(xs, ys))
|
else if (!can_align_from_lhs(xs, ys) && !can_align_from_rhs(xs, ys))
|
||||||
cond = true;
|
cond = true;
|
||||||
|
|
||||||
if (cond) {
|
if (!cond)
|
||||||
|
return false;
|
||||||
|
|
||||||
literal_vector lits;
|
literal_vector lits;
|
||||||
if (xs == ys) {
|
if (xs == ys) {
|
||||||
literal lit = mk_eq(mk_len(x1), mk_len(y1), false);
|
literal lit = mk_eq(mk_len(x1), mk_len(y1), false);
|
||||||
|
@ -931,32 +966,7 @@ bool theory_seq::branch_quat_variable(depeq const& e) {
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int theory_seq::find_fst_non_empty_idx(expr_ref_vector const& xs) {
|
|
||||||
for (unsigned i = 0; i < xs.size(); ++i) {
|
|
||||||
expr* x = xs[i];
|
|
||||||
if (!is_var(x)) return -1;
|
|
||||||
expr_ref e = mk_len(x);
|
|
||||||
if (ctx.e_internalized(e)) {
|
|
||||||
enode* root = ctx.get_enode(e)->get_root();
|
|
||||||
rational val;
|
|
||||||
if (m_autil.is_numeral(root->get_expr(), val) && val.is_zero()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
expr* theory_seq::find_fst_non_empty_var(expr_ref_vector const& x) {
|
|
||||||
int i = find_fst_non_empty_idx(x);
|
|
||||||
if (i >= 0)
|
|
||||||
return x[i];
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool theory_seq::branch_variable_eq() {
|
bool theory_seq::branch_variable_eq() {
|
||||||
unsigned sz = m_eqs.size();
|
unsigned sz = m_eqs.size();
|
||||||
|
|
Loading…
Reference in a new issue