using namespace CVC4::theory::strings;
Node TheoryStringsRewriter::simpleRegexpConsume( std::vector< Node >& mchildren, std::vector< Node >& children, int dir ){
+ NodeManager* nm = NodeManager::currentNM();
unsigned tmin = dir<0 ? 0 : dir;
unsigned tmax = dir<0 ? 1 : dir;
//try to remove off front and back
if( index==0 ){
mchildren.push_back( s );
}else{
- children.push_back( s );
+ children.push_back(nm->mkNode(STRING_TO_REGEXP, s));
}
}
do_next = true;
namespace strings {
class TheoryStringsRewriter {
-private:
+ private:
+ /** simple regular expression consume
+ *
+ * This method is called when we are rewriting a membership of the form
+ * s1 ++ ... ++ sn in r1 ++ ... ++ rm
+ * We have that mchildren consists of the strings s1...sn, and children
+ * consists of the regular expressions r1...rm.
+ *
+ * This method tries to strip off parts of the concatenation terms. It updates
+ * the vectors such that the resulting vectors are such that the membership
+ * mchildren[n'...n''] in children[m'...m''] is equivalent to the input
+ * membership. The argument dir indicates the direction to consider, where
+ * 0 means strip off the front, 1 off the back, and < 0 off of both.
+ *
+ * If this method returns the false node, then we have inferred that the input
+ * membership is equivalent to false. Otherwise, it returns the null node.
+ *
+ * For example, given input
+ * mchildren = { "ab", x }, children = { [["a"]], ([["cd"]])* } and dir = 0,
+ * this method updates:
+ * mchildren = { "b", x }, children = { ("cd")* }
+ * and returns null.
+ *
+ * For example, given input
+ * { x, "abb", x }, { [[x]], ["a"..."b"], allchar, [[y]], [[x]]} and dir=-1,
+ * this method updates:
+ * { "b" }, { [[y]] }
+ * where [[.]] denotes str.to.re, and returns null.
+ */
static Node simpleRegexpConsume( std::vector< Node >& mchildren, std::vector< Node >& children, int dir = -1 );
static bool isConstRegExp( TNode t );
static bool testConstStringInRegExp( CVC4::String &s, unsigned int index_start, TNode r );
regress1/strings/idof-triv.smt2 \
regress1/strings/ilc-l-nt.smt2 \
regress1/strings/issue1105.smt2 \
+ regress1/strings/issue2060.smt2 \
regress1/strings/kaluza-fl.smt2 \
regress1/strings/loop002.smt2 \
regress1/strings/loop003.smt2 \
--- /dev/null
+(set-logic QF_S)
+(set-info :status sat)
+
+(declare-const action String)
+(declare-const example_key String)
+
+(assert (str.in.re action (re.++
+ (str.to.re "foobar:ab")
+ (re.* re.allchar)
+ )))
+
+(declare-const action_1 String)
+(declare-const action_2 String)
+
+(assert (and
+ (= action (str.++ action_1 example_key action_2))
+ (= action_1 "foobar:a")
+ ))
+
+(check-sat)