case InferenceId::STRINGS_RE_UNFOLD_POS:
case InferenceId::STRINGS_RE_UNFOLD_NEG:
{
- if (infer == InferenceId::STRINGS_RE_UNFOLD_POS)
+ Assert (!ps.d_children.empty());
+ size_t nchild = ps.d_children.size();
+ Node mem = ps.d_children[nchild-1];
+ if (nchild>1)
+ {
+ // if more than one, apply MACRO_SR_PRED_ELIM
+ std::vector<Node> tcs;
+ tcs.insert(tcs.end(),
+ ps.d_children.begin(),
+ ps.d_children.begin() + (nchild-1));
+ mem = psb.applyPredElim(mem, tcs);
+ useBuffer = true;
+ }
+ PfRule r = PfRule::UNKNOWN;
+ if (mem.isNull())
+ {
+ // failed to eliminate above
+ Assert(false) << "Failed to apply MACRO_SR_PRED_ELIM for RE unfold";
+ useBuffer = false;
+ }
+ else if (infer == InferenceId::STRINGS_RE_UNFOLD_POS)
{
- ps.d_rule = PfRule::RE_UNFOLD_POS;
+ r = PfRule::RE_UNFOLD_POS;
}
else
{
- ps.d_rule = PfRule::RE_UNFOLD_NEG;
+ r = PfRule::RE_UNFOLD_NEG;
// it may be an optimized form of concat simplification
- Assert(ps.d_children.size() == 1);
- Node mem = ps.d_children[0];
Assert(mem.getKind() == NOT && mem[0].getKind() == STRING_IN_REGEXP);
if (mem[0][1].getKind() == REGEXP_CONCAT)
{
// version
if (!reLen.isNull())
{
- ps.d_rule = PfRule::RE_UNFOLD_NEG_CONCAT_FIXED;
+ r = PfRule::RE_UNFOLD_NEG_CONCAT_FIXED;
}
}
}
+ if (useBuffer)
+ {
+ mem = psb.tryStep(r, {mem}, {});
+ // should match the conclusion
+ useBuffer = (mem==conc);
+ }
+ else
+ {
+ ps.d_rule = r;
+ }
}
break;
// ========================== Reduction