From: Tianyi Liang Date: Wed, 25 Feb 2015 16:49:14 +0000 (-0600) Subject: Switch back to eager loop temporarily. X-Git-Tag: cvc5-1.0.0~6385 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=92e4099d9d2b313a521d2a015e604645e24617f4;p=cvc5.git Switch back to eager loop temporarily. --- diff --git a/src/theory/strings/regexp_operation.cpp b/src/theory/strings/regexp_operation.cpp index 061b1adb5..8d107d36a 100644 --- a/src/theory/strings/regexp_operation.cpp +++ b/src/theory/strings/regexp_operation.cpp @@ -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().getFirstChar(); + unsigned char b = r[1].getConst().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); } /* diff --git a/src/theory/strings/theory_strings_rewriter.cpp b/src/theory/strings/theory_strings_rewriter.cpp index 3396cc1a9..5bf44dce8 100644 --- a/src/theory/strings/theory_strings_rewriter.cpp +++ b/src/theory/strings/theory_strings_rewriter.cpp @@ -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; }