if (StringsEntail::stripSymbolicLength(
pfxv1, rpfxv1, 1, lenPfx0, true))
{
- std::vector<Node> sfxv0(v0.begin() + i, v0.end());
- pfxv1.insert(pfxv1.end(), v1.begin() + j, v1.end());
- Node ret = nm->mkNode(kind::AND,
- pfx0.eqNode(utils::mkConcat(rpfxv1, stype)),
- utils::mkConcat(sfxv0, stype)
- .eqNode(utils::mkConcat(pfxv1, stype)));
- return returnRewrite(node, ret, Rewrite::SPLIT_EQ_STRIP_R);
+ // The rewrite requires the full left-hand prefix length to be
+ // stripped (otherwise we would have to keep parts of the
+ // left-hand prefix).
+ if (lenPfx0.isConst() && lenPfx0.getConst<Rational>().isZero())
+ {
+ std::vector<Node> sfxv0(v0.begin() + i, v0.end());
+ pfxv1.insert(pfxv1.end(), v1.begin() + j, v1.end());
+ Node ret =
+ nm->mkNode(kind::AND,
+ pfx0.eqNode(utils::mkConcat(rpfxv1, stype)),
+ utils::mkConcat(sfxv0, stype)
+ .eqNode(utils::mkConcat(pfxv1, stype)));
+ return returnRewrite(node, ret, Rewrite::SPLIT_EQ_STRIP_R);
+ }
}
// If the prefix of the right-hand side is (strictly) longer than
if (StringsEntail::stripSymbolicLength(
pfxv0, rpfxv0, 1, lenPfx1, true))
{
- pfxv0.insert(pfxv0.end(), v0.begin() + i, v0.end());
- std::vector<Node> sfxv1(v1.begin() + j, v1.end());
- Node ret = nm->mkNode(kind::AND,
- utils::mkConcat(rpfxv0, stype).eqNode(pfx1),
- utils::mkConcat(pfxv0, stype)
- .eqNode(utils::mkConcat(sfxv1, stype)));
- return returnRewrite(node, ret, Rewrite::SPLIT_EQ_STRIP_L);
+ // The rewrite requires the full right-hand prefix length to be
+ // stripped (otherwise we would have to keep parts of the
+ // right-hand prefix).
+ if (lenPfx1.isConst() && lenPfx1.getConst<Rational>().isZero())
+ {
+ pfxv0.insert(pfxv0.end(), v0.begin() + i, v0.end());
+ std::vector<Node> sfxv1(v1.begin() + j, v1.end());
+ Node ret =
+ nm->mkNode(kind::AND,
+ utils::mkConcat(rpfxv0, stype).eqNode(pfx1),
+ utils::mkConcat(pfxv0, stype)
+ .eqNode(utils::mkConcat(sfxv1, stype)));
+ return returnRewrite(node, ret, Rewrite::SPLIT_EQ_STRIP_L);
+ }
}
// If the prefix of the left-hand side is (strictly) longer than