case kind::STRING_IN_REGEXP: {
d_out->requirePhase(n, true);
d_equalityEngine.addTriggerPredicate(n);
+ d_equalityEngine.addTerm(n[0]);
+ d_equalityEngine.addTerm(n[1]);
break;
}
//case kind::STRING_SUBSTR_TOTAL:
retNode = one.eqNode(NodeManager::currentNM()->mkNode(kind::STRING_LENGTH, x));
} else if(node[1].getKind() == kind::REGEXP_STAR && node[1][0].getKind() == kind::REGEXP_SIGMA) {
retNode = NodeManager::currentNM()->mkConst( true );
+ } else if(node[1].getKind() == kind::REGEXP_CONCAT) {
+ //opt
+ bool flag = true;
+ for(unsigned i=0; i<node[1].getNumChildren(); i++) {
+ if(node[1][i].getKind() != kind::REGEXP_SIGMA) {
+ flag = false;
+ break;
+ }
+ }
+ if(flag) {
+ Node num = NodeManager::currentNM()->mkConst( ::CVC4::Rational( node[1].getNumChildren() ) );
+ retNode = num.eqNode(NodeManager::currentNM()->mkNode(kind::STRING_LENGTH, x));
+ }
+ //
} else if(node[1].getKind() == kind::STRING_TO_REGEXP) {
retNode = x.eqNode(node[1][0]);
} else if(x != node[0]) {
retNode = prerewriteConcatRegExp(node);
} else if(node.getKind() == kind::REGEXP_UNION) {
retNode = prerewriteOrRegExp(node);
- }else if(node.getKind() == kind::REGEXP_INTER) {
+ } else if(node.getKind() == kind::REGEXP_INTER) {
retNode = prerewriteAndRegExp(node);
} else if(node.getKind() == kind::REGEXP_STAR) {
if(node[0].getKind() == kind::REGEXP_STAR) {
}
if (!d_equalityEngine->hasTerm(n)) {
- // Unknown term - return first enumerated value for this type
- TypeEnumerator te(n.getType());
- ret = *te;
+ if(n.getType().isRegExp()) {
+ ret = Rewriter::rewrite(ret);
+ } else {
+ // Unknown term - return first enumerated value for this type
+ TypeEnumerator te(n.getType());
+ ret = *te;
+ }
d_modelCache[n] = ret;
return ret;
}