From: ajreynol Date: Fri, 8 Jul 2016 11:49:24 +0000 (-0500) Subject: Minor fix to last commit. X-Git-Tag: cvc5-1.0.0~6040^2~48 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e9381ce8e8b84039e148ede7af089ba27b9b32fe;p=cvc5.git Minor fix to last commit. --- diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp index f6be72241..1f2fd694b 100644 --- a/src/theory/strings/theory_strings.cpp +++ b/src/theory/strings/theory_strings.cpp @@ -1847,6 +1847,7 @@ void TheoryStrings::checkNormalForms(){ d_normal_forms.clear(); d_normal_forms_exp.clear(); std::map< Node, Node > nf_to_eqc; + std::map< Node, Node > eqc_to_nf; std::map< Node, Node > eqc_to_exp; for( unsigned i=0; i::iterator it = nf_to_eqc.begin(); it != nf_to_eqc.end(); ++it ){ - Trace("strings-nf") << " N[" << it->second << "] = " << it->first << std::endl; - Trace("strings-nf") << " exp: " << eqc_to_exp[it->first] << std::endl; + for( std::map< Node, Node >::iterator it = eqc_to_exp.begin(); it != eqc_to_exp.end(); ++it ){ + Trace("strings-nf") << " N[" << it->first << "] (base " << d_normal_forms_base[it->first] << ") = " << eqc_to_nf[it->first] << std::endl; + Trace("strings-nf") << " exp: " << it->second << std::endl; } Trace("strings-nf") << std::endl; } @@ -1954,6 +1956,9 @@ bool TheoryStrings::normalizeEquivalenceClass( Node eqc ) { } getConcatVec( eqc_c, d_normal_forms[eqc] ); d_normal_forms_base[eqc] = eqc_c; + if( eqc_c!=eqc ){ + d_normal_forms_exp[eqc].push_back( eqc_c.eqNode( eqc ) ); + } }else{ int nf_index = 0; //nf.insert( nf.end(), normal_forms[nf_index].begin(), normal_forms[nf_index].end() ); diff --git a/test/regress/regress0/strings/Makefile.am b/test/regress/regress0/strings/Makefile.am index bb9b61d8e..adfc29f01 100644 --- a/test/regress/regress0/strings/Makefile.am +++ b/test/regress/regress0/strings/Makefile.am @@ -80,7 +80,8 @@ TESTS = \ cmu-2db2-extf-reg.smt2 \ norn-nel-bug-052116.smt2 \ cmu-disagree-0707-dd.smt2 \ - cmu-5042-0707-2.smt2 + cmu-5042-0707-2.smt2 \ + cmu-dis-0707-3.smt2 FAILING_TESTS = @@ -89,6 +90,8 @@ EXTRA_DIST = $(TESTS) # and make sure to distribute it EXTRA_DIST += +#norn-dis-0707-3.smt2 + # synonyms for "check" .PHONY: regress regress0 test regress regress0 test: check diff --git a/test/regress/regress0/strings/cmu-dis-0707-3.smt2 b/test/regress/regress0/strings/cmu-dis-0707-3.smt2 new file mode 100644 index 000000000..209cbb3f9 --- /dev/null +++ b/test/regress/regress0/strings/cmu-dis-0707-3.smt2 @@ -0,0 +1,24 @@ +(set-logic ALL_SUPPORTED) +(set-info :status sat) +(set-option :strings-exp true) +(declare-fun value () String) +(declare-fun name () String) +(assert (not (not (not (= (ite (str.contains value "?") 1 0) 0))))) +(assert (not (not (= (ite (str.contains value "#") 1 0) 0)))) +(assert (not (not (= (ite (= (str.substr value 0 (- 2 0)) "//") 1 0) 0)))) +(assert (not (not (= (ite (> (str.indexof value ":" 0) 0) 1 0) 0)))) +(assert (not (= (ite (not (= (str.len value) 0)) 1 0) 0))) +(assert (not (not (= (ite (str.contains value "'") 1 0) 0)))) +(assert (not (not (= (ite (str.contains value "\"") 1 0) 0)))) +(assert (not (not (= (ite (str.contains value ">") 1 0) 0)))) +(assert (not (not (= (ite (str.contains value "<") 1 0) 0)))) +(assert (not (not (= (ite (str.contains value "&") 1 0) 0)))) +(assert (not (not (= (ite (str.contains name "'") 1 0) 0)))) +(assert (not (not (= (ite (str.contains name "\"") 1 0) 0)))) +(assert (not (not (= (ite (str.contains name ">") 1 0) 0)))) +(assert (not (not (= (ite (str.contains name "<") 1 0) 0)))) +(assert (not (not (= (ite (str.contains name "&") 1 0) 0)))) +(assert (not (= (ite (not (= value "")) 1 0) 0))) +(assert (not (= (ite (str.contains value "javascript:alert(1);") 1 0) 0))) +(assert (not (not (= (ite (str.contains name "javascript:alert(1);") 1 0) 0)))) +(check-sat) diff --git a/test/regress/regress0/strings/norn-dis-0707-3.smt2 b/test/regress/regress0/strings/norn-dis-0707-3.smt2 new file mode 100644 index 000000000..bc0f877ad --- /dev/null +++ b/test/regress/regress0/strings/norn-dis-0707-3.smt2 @@ -0,0 +1,26 @@ +(set-logic QF_S) +(set-info :status sat) +(set-option :strings-exp true) + +(declare-fun var_0 () String) +(declare-fun var_1 () String) +(declare-fun var_2 () String) +(declare-fun var_3 () String) +(declare-fun var_4 () String) +(declare-fun var_5 () String) +(declare-fun var_6 () String) +(declare-fun var_7 () String) +(declare-fun var_8 () String) +(declare-fun var_9 () String) +(declare-fun var_10 () String) +(declare-fun var_11 () String) +(declare-fun var_12 () String) + +(assert (str.in.re (str.++ var_8 "z" var_9 ) (re.++ (re.* (re.union (str.to.re "a") (re.++ (str.to.re "b") (re.++ (re.* (re.union (str.to.re "b") (str.to.re "a"))) (str.to.re "z"))))) (re.++ (str.to.re "b") (re.* (re.union (str.to.re "b") (str.to.re "a"))))))) +(assert (str.in.re (str.++ var_8 "z" var_9 ) (re.++ (re.* (re.union (re.union (str.to.re "z") (str.to.re "a")) (re.++ (str.to.re "b") (re.++ (re.* (str.to.re "b")) (re.union (str.to.re "z") (str.to.re "a")))))) (re.++ (str.to.re "b") (re.* (str.to.re "b")))))) +(assert (str.in.re (str.++ var_8 "z" var_9 ) (re.++ (re.* (re.union (str.to.re "a") (re.++ (str.to.re "b") (re.++ (re.* (re.union (str.to.re "z") (str.to.re "a"))) (str.to.re "b"))))) (re.++ (str.to.re "b") (re.* (re.union (str.to.re "z") (str.to.re "a"))))))) +(assert (str.in.re (str.++ var_8 "z" var_9 ) (re.* (re.++ (re.union (str.to.re "b") (str.to.re "a")) (re.++ (re.* (str.to.re "a")) (re.union (str.to.re "z") (str.to.re "b"))))))) +(assert (str.in.re var_9 (re.* (re.range "a" "u")))) +(assert (str.in.re var_8 (re.* (re.range "a" "u")))) +(assert (not (str.in.re (str.++ "b" var_8 "z" "b" var_9 ) (re.++ (re.* (re.++ (str.to.re "b") (str.to.re "z"))) (str.to.re "b"))))) +(check-sat)