Switch back to eager loop temporarily.
authorTianyi Liang <tianyi-liang@uiowa.edu>
Wed, 25 Feb 2015 16:49:14 +0000 (10:49 -0600)
committerTianyi Liang <tianyi-liang@uiowa.edu>
Wed, 25 Feb 2015 16:49:14 +0000 (10:49 -0600)
src/theory/strings/regexp_operation.cpp
src/theory/strings/theory_strings_rewriter.cpp

index 061b1adb5904a22f2f5a89626376775ce419b95f..8d107d36a4e79a3e4afb5db52fb5bb691e5158c0 100644 (file)
@@ -1131,11 +1131,13 @@ void RegExpOpr::simplifyPRegExp( Node s, Node r, std::vector< Node > &new_nodes
         conc = s.eqNode( r[0] );
         if(r[0] != r[1]) {
           unsigned char a = r[0].getConst<String>().getFirstChar();
+          unsigned char b = r[1].getConst<String>().getFirstChar();
           a += 1;
-          Node tmp = NodeManager::currentNM()->mkNode(kind::STRING_IN_REGEXP, s,
+          Node tmp = a!=b? NodeManager::currentNM()->mkNode(kind::STRING_IN_REGEXP, s,
             NodeManager::currentNM()->mkNode(kind::REGEXP_RANGE,
               NodeManager::currentNM()->mkConst( CVC4::String(a) ),
-              r[1]));
+              r[1])) :
+            s.eqNode(r[1]);
           conc = NodeManager::currentNM()->mkNode(kind::OR, conc, tmp);
         }
         /*
index 3396cc1a9969bdbc538b736111dbc139b80d55ba..5bf44dce8d8623c2426a8306ce291a1e22a2c65a 100644 (file)
@@ -1199,6 +1199,7 @@ RewriteResponse TheoryStringsRewriter::preRewrite(TNode node) {
     if(r.getKind() == kind::REGEXP_STAR) {
       retNode = r;
     } else {
+      /* //lazy
       Node n1 = Rewriter::rewrite( node[1] );
       if(!n1.isConst()) {
         throw LogicException("re.loop contains non-constant integer (1).");
@@ -1239,8 +1240,9 @@ RewriteResponse TheoryStringsRewriter::preRewrite(TNode node) {
             NodeManager::currentNM()->mkNode(kind::REGEXP_LOOP, node[0], n1, n1), 
             NodeManager::currentNM()->mkNode(kind::REGEXP_STAR, node[0]));
       }
-    }
-    /*else {
+    }*/ //lazy
+    /*else {*/
+      // eager
       TNode n1 = Rewriter::rewrite( node[1] );
       //
       if(!n1.isConst()) {
@@ -1284,7 +1286,7 @@ RewriteResponse TheoryStringsRewriter::preRewrite(TNode node) {
                 :NodeManager::currentNM()->mkNode(kind::REGEXP_CONCAT,
                   NodeManager::currentNM()->mkNode(kind::REGEXP_CONCAT, vec_nodes), rest) );
       }
-    }*/
+    }
     Trace("strings-lp") << "Strings::lp " << node << " => " << retNode << std::endl;
   }