From: ajreynol Date: Mon, 30 Jan 2017 17:20:29 +0000 (-0600) Subject: Fix regexp cache issue in strings, add regression. X-Git-Tag: cvc5-1.0.0~5911 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0dd2aa21f35b221ea96d277e9ea7cbc816ffe83c;p=cvc5.git Fix regexp cache issue in strings, add regression. --- diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp index bf999806f..2bce8beea 100644 --- a/src/theory/strings/theory_strings.cpp +++ b/src/theory/strings/theory_strings.cpp @@ -4356,6 +4356,7 @@ void TheoryStrings::checkMemberships() { for( unsigned i=0; i > vec_can; @@ -4591,17 +4592,18 @@ void TheoryStrings::checkMemberships() { if( addedLemma ) { if( !d_conflict ){ for( unsigned i=0; i &processed, std::vector< Node > &cprocessed, std::vector< Node > &nf_exp) { +bool TheoryStrings::checkPDerivative( Node x, Node r, Node atom, bool &addedLemma, std::vector< Node > &nf_exp ) { Node antnf = mkExplain(nf_exp); @@ -4654,7 +4656,7 @@ bool TheoryStrings::checkPDerivative(Node x, Node r, Node atom, bool &addedLemma sREant = Rewriter::rewrite(NodeManager::currentNM()->mkNode(kind::AND, sREant, antnf)); if(deriveRegExp( x, r, sREant )) { addedLemma = true; - processed.push_back( atom ); + d_regexp_ccached.insert(atom); return false; } } diff --git a/src/theory/strings/theory_strings.h b/src/theory/strings/theory_strings.h index 457afb15a..0294c3884 100644 --- a/src/theory/strings/theory_strings.h +++ b/src/theory/strings/theory_strings.h @@ -359,9 +359,7 @@ private: std::map< Node, std::vector< Node > > &XinR_with_exps); void checkMemberships(); bool checkMemberships2(); - bool checkPDerivative( Node x, Node r, Node atom, bool &addedLemma, - std::vector< Node > &processed, std::vector< Node > &cprocessed, - std::vector< Node > &nf_exp); + bool checkPDerivative( Node x, Node r, Node atom, bool &addedLemma, std::vector< Node > &nf_exp); //check contains void checkPosContains( std::vector< Node >& posContains ); void checkNegContains( std::vector< Node >& negContains ); diff --git a/test/regress/regress0/strings/Makefile.am b/test/regress/regress0/strings/Makefile.am index a77c2bd6c..f4dc8ebf7 100644 --- a/test/regress/regress0/strings/Makefile.am +++ b/test/regress/regress0/strings/Makefile.am @@ -85,7 +85,8 @@ TESTS = \ gm-inc-071516-2.smt2 \ cmu-inc-nlpp-071516.smt2 \ strings-index-empty.smt2 \ - bug768.smt2 + bug768.smt2 \ + username_checker_min.smt2 FAILING_TESTS = diff --git a/test/regress/regress0/strings/username_checker_min.smt2 b/test/regress/regress0/strings/username_checker_min.smt2 new file mode 100644 index 000000000..2f1c35844 --- /dev/null +++ b/test/regress/regress0/strings/username_checker_min.smt2 @@ -0,0 +1,14 @@ +(set-logic QF_S) +(set-option :strings-exp true) +(set-info :status unsat) + +(declare-const buff String) +(declare-const pass_mem String) +(assert (= (str.len buff) 4)) +(assert (= (str.len pass_mem) 1)) + +(assert (str.in.re (str.++ buff pass_mem) (re.+ (str.to.re "A")))) + +(assert (str.contains buff "<")) + +(check-sat)