From: ajreynol Date: Wed, 7 Dec 2016 16:18:16 +0000 (-0600) Subject: Fix nf exp tracking for non-linear string equalities, fixes bug 768. X-Git-Tag: cvc5-1.0.0~5951 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0e956da9b32ce8a8fcf20ec65e5a2820b4e31324;p=cvc5.git Fix nf exp tracking for non-linear string equalities, fixes bug 768. --- diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp index 8b44b5cac..db07a0b51 100644 --- a/src/theory/strings/theory_strings.cpp +++ b/src/theory/strings/theory_strings.cpp @@ -2071,6 +2071,27 @@ void TheoryStrings::normalizeEquivalenceClass( Node eqc ) { } } +void trackNfExpDependency( std::vector< Node >& nf_exp_n, std::map< Node, std::map< bool, int > >& nf_exp_depend_n, Node exp, int new_val, int new_rev_val ){ + if( std::find( nf_exp_n.begin(), nf_exp_n.end(), exp )==nf_exp_n.end() ){ + nf_exp_n.push_back( exp ); + } + for( unsigned k=0; k<2; k++ ){ + int val = k==0 ? new_val : new_rev_val; + std::map< bool, int >::iterator itned = nf_exp_depend_n[exp].find( k==1 ); + if( itned==nf_exp_depend_n[exp].end() ){ + Trace("strings-process-debug") << "Deps : set dependency on " << exp << " to " << val << " isRev=" << (k==0) << std::endl; + nf_exp_depend_n[exp][k==1] = val; + }else{ + Trace("strings-process-debug") << "Deps : Multiple dependencies on " << exp << " : " << itned->second << " " << val << " isRev=" << (k==0) << std::endl; + //if we already have a dependency (in the case of non-linear string equalities), it is min/max + bool cmp = val > itned->second; + if( cmp==(k==1) ){ + nf_exp_depend_n[exp][k==1] = val; + } + } + } +} + void TheoryStrings::getNormalForms( Node &eqc, std::vector< std::vector< Node > > &normal_forms, std::vector< Node > &normal_form_src, std::vector< std::vector< Node > > &normal_forms_exp, std::vector< std::map< Node, std::map< bool, int > > >& normal_forms_exp_depend ) { //constant for equivalence class @@ -2115,25 +2136,16 @@ void TheoryStrings::getNormalForms( Node &eqc, std::vector< std::vector< Node > for( unsigned j=0; j