From: Tianyi Liang Date: Tue, 15 Oct 2013 19:23:08 +0000 (-0500) Subject: removes some junks X-Git-Tag: cvc5-1.0.0~7275^2~15^2~2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8378d5ed6b692cd6d0e1a970d958a0d17c531746;p=cvc5.git removes some junks --- diff --git a/src/theory/strings/theory_strings_preprocess.cpp b/src/theory/strings/theory_strings_preprocess.cpp index 378fa3428..c54cbb3b2 100644 --- a/src/theory/strings/theory_strings_preprocess.cpp +++ b/src/theory/strings/theory_strings_preprocess.cpp @@ -34,9 +34,13 @@ void StringsPreprocess::simplifyRegExp( Node s, Node r, std::vector< Node > &ret { std::vector< Node > cc; for(unsigned i=0; imkSkolem( "recsym_$$", s.getType(), "created for regular expression concat" ); - simplifyRegExp( sk, r[i], ret, nn ); - cc.push_back( sk ); + if(r[i].getKind() == kind::STRING_TO_REGEXP) { + cc.push_back( r[i][0] ); + } else { + Node sk = NodeManager::currentNM()->mkSkolem( "recsym_$$", s.getType(), "created for regular expression concat" ); + simplifyRegExp( sk, r[i], ret, nn ); + cc.push_back( sk ); + } } Node cc_eq = NodeManager::currentNM()->mkNode( kind::EQUAL, s, NodeManager::currentNM()->mkNode( kind::STRING_CONCAT, cc ) ); diff --git a/src/theory/strings/theory_strings_rewriter.cpp b/src/theory/strings/theory_strings_rewriter.cpp index 7b74a95ac..5ba67c25f 100644 --- a/src/theory/strings/theory_strings_rewriter.cpp +++ b/src/theory/strings/theory_strings_rewriter.cpp @@ -145,56 +145,6 @@ Node TheoryStringsRewriter::prerewriteConcatRegExp( TNode node ) { return retNode; } -void TheoryStringsRewriter::simplifyRegExp( Node s, Node r, std::vector< Node > &ret ) { - int k = r.getKind(); - switch( k ) { - case kind::STRING_TO_REGEXP: - { - Node eq = NodeManager::currentNM()->mkNode( kind::EQUAL, s, r[0] ); - ret.push_back( eq ); - } - break; - case kind::REGEXP_CONCAT: - { - std::vector< Node > cc; - for(unsigned i=0; imkSkolem( "recsym_$$", s.getType(), "created for regular expression concat" ); - simplifyRegExp( sk, r[i], ret ); - cc.push_back( sk ); - } - Node cc_eq = NodeManager::currentNM()->mkNode( kind::EQUAL, s, - NodeManager::currentNM()->mkNode( kind::STRING_CONCAT, cc ) ); - ret.push_back( cc_eq ); - } - break; - case kind::REGEXP_OR: - { - std::vector< Node > c_or; - for(unsigned i=0; imkNode( kind::OR, c_or ); - ret.push_back( eq ); - } - break; - case kind::REGEXP_INTER: - for(unsigned i=0; imkNode( kind::STRING_IN_REGEXP, s, r ); - ret.push_back( eq ); - } - break; - default: - //TODO: special sym: sigma, none, all - Trace("strings-prerewrite") << "Unsupported term: " << r << " in simplifyRegExp." << std::endl; - Assert( false ); - break; - } -} bool TheoryStringsRewriter::checkConstRegExp( TNode t ) { if( t.getKind() != kind::STRING_TO_REGEXP ) { for( unsigned i = 0; i(); retNode = NodeManager::currentNM()->mkConst( testConstStringInRegExp( s, 0, node[1] ) ); } else { - //if( node[1].getKind() == kind::REGEXP_STAR ) { - if( x == node[0] ) { - retNode = node; - } else { - retNode = NodeManager::currentNM()->mkNode( kind::STRING_IN_REGEXP, x, node[1] ); - } - /* - } else { - std::vector node_vec; - simplifyRegExp( x, node[1], node_vec ); - - if(node_vec.size() > 1) { - retNode = NodeManager::currentNM()->mkNode(kind::AND, node_vec); - } else { - retNode = node_vec[0]; - } + if( x != node[0] ) { + retNode = NodeManager::currentNM()->mkNode( kind::STRING_IN_REGEXP, x, node[1] ); } - */ } - //Trace("strings-prerewrite") << "Strings::rewriteMembership end " << retNode << std::endl; return retNode; } diff --git a/src/theory/strings/theory_strings_rewriter.h b/src/theory/strings/theory_strings_rewriter.h index c416abd69..e7d7eccb5 100644 --- a/src/theory/strings/theory_strings_rewriter.h +++ b/src/theory/strings/theory_strings_rewriter.h @@ -32,7 +32,6 @@ class TheoryStringsRewriter { public: static bool checkConstRegExp( TNode t ); static bool testConstStringInRegExp( CVC4::String &s, unsigned int index_start, TNode r ); - static void simplifyRegExp( Node s, Node r, std::vector< Node > &ret ); static Node rewriteConcatString(TNode node); static Node prerewriteConcatRegExp(TNode node);