summaryrefslogtreecommitdiff
path: root/src/theory/strings
diff options
context:
space:
mode:
authorajreynol <andrew.j.reynolds@gmail.com>2016-07-15 09:39:09 -0500
committerajreynol <andrew.j.reynolds@gmail.com>2016-07-15 09:39:09 -0500
commitc0af8cf1c1e3edca35bb7ae4edf1831ebdee0abd (patch)
tree7a674542e85f58d06213e26b9fcddbf44d8e4323 /src/theory/strings
parente9381ce8e8b84039e148ede7af089ba27b9b32fe (diff)
Minor simplification to normal form explanations.
Diffstat (limited to 'src/theory/strings')
-rw-r--r--src/theory/strings/theory_strings.cpp55
-rw-r--r--src/theory/strings/theory_strings.h2
2 files changed, 3 insertions, 54 deletions
diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp
index 1f2fd694b..e8459133e 100644
--- a/src/theory/strings/theory_strings.cpp
+++ b/src/theory/strings/theory_strings.cpp
@@ -1956,16 +1956,8 @@ 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() );
- //nf_exp.insert( nf_exp.end(), normal_forms_exp[nf_index].begin(), normal_forms_exp[nf_index].end() );
- //Trace("strings-solve-debug2") << "take normal form ... done" << std::endl;
- //d_normal_forms_base[eqc] = normal_form_src[nf_index];
- ///*
std::vector< Node >::iterator itn = std::find( normal_form_src.begin(), normal_form_src.end(), eqc );
if( itn!=normal_form_src.end() ){
nf_index = itn - normal_form_src.begin();
@@ -1977,12 +1969,8 @@ bool TheoryStrings::normalizeEquivalenceClass( Node eqc ) {
}
d_normal_forms[eqc].insert( d_normal_forms[eqc].end(), normal_forms[nf_index].begin(), normal_forms[nf_index].end() );
d_normal_forms_exp[eqc].insert( d_normal_forms_exp[eqc].end(), normal_forms_exp[nf_index].begin(), normal_forms_exp[nf_index].end() );
- if( eqc!=normal_form_src[nf_index] ){
- d_normal_forms_exp[eqc].push_back( eqc.eqNode( normal_form_src[nf_index] ) );
- }
Trace("strings-solve-debug2") << "take normal form ... done" << std::endl;
d_normal_forms_base[eqc] = normal_form_src[nf_index];
- //*/
//track dependencies
for( unsigned i=0; i<normal_forms_exp[nf_index].size(); i++ ){
Node exp = normal_forms_exp[nf_index][i];
@@ -2050,8 +2038,9 @@ bool TheoryStrings::getNormalForms( Node &eqc, std::vector< std::vector< Node >
}
}
}
- if( nr!=n[i] ){
- Node eq = n[i].eqNode( nr );
+ if( d_normal_forms_base[nr]!=n[i] ){
+ Assert( d_normal_forms_base.find( nr )!=d_normal_forms_base.end() );
+ Node eq = n[i].eqNode( d_normal_forms_base[nr] );
nf_exp_n.push_back( eq );
//track depends
nf_exp_depend_n[eq][false] = orig_size;
@@ -3463,44 +3452,6 @@ void TheoryStrings::getEquivalenceClasses( std::vector< Node >& eqcs ) {
}
}
-void TheoryStrings::getFinalNormalForm( Node n, std::vector< Node >& nf, std::vector< Node >& exp ) {
- if( n!=d_emptyString ) {
- if( n.getKind()==kind::STRING_CONCAT ) {
- for( unsigned i=0; i<n.getNumChildren(); i++ ) {
- getFinalNormalForm( n[i], nf, exp );
- }
- } else {
- Trace("strings-debug") << "Get final normal form " << n << std::endl;
- Assert( d_equalityEngine.hasTerm( n ) );
- Node nr = d_equalityEngine.getRepresentative( n );
- EqcInfo *eqc_n = getOrMakeEqcInfo( nr, false );
- Node nc = eqc_n ? eqc_n->d_const_term.get() : Node::null();
- if( !nc.isNull() ) {
- nf.push_back( nc );
- if( n!=nc ) {
- exp.push_back( NodeManager::currentNM()->mkNode( kind::EQUAL, n, nc ) );
- }
- } else {
- Assert( d_normal_forms.find( nr )!=d_normal_forms.end() );
- if( d_normal_forms[nr][0]==nr ) {
- Assert( d_normal_forms[nr].size()==1 );
- nf.push_back( nr );
- if( n!=nr ) {
- exp.push_back( NodeManager::currentNM()->mkNode( kind::EQUAL, n, nr ) );
- }
- } else {
- for( unsigned i=0; i<d_normal_forms[nr].size(); i++ ) {
- Assert( d_normal_forms[nr][i]!=nr );
- getFinalNormalForm( d_normal_forms[nr][i], nf, exp );
- }
- exp.insert( exp.end(), d_normal_forms_exp[nr].begin(), d_normal_forms_exp[nr].end() );
- }
- }
- Trace("strings-ind-nf") << "The final normal form of " << n << " is " << nf << std::endl;
- }
- }
-}
-
void TheoryStrings::separateByLength(std::vector< Node >& n,
std::vector< std::vector< Node > >& cols,
std::vector< Node >& lts ) {
diff --git a/src/theory/strings/theory_strings.h b/src/theory/strings/theory_strings.h
index 2e0ac7224..c4a3e85cd 100644
--- a/src/theory/strings/theory_strings.h
+++ b/src/theory/strings/theory_strings.h
@@ -385,8 +385,6 @@ protected:
//get equivalence classes
void getEquivalenceClasses( std::vector< Node >& eqcs );
- //get final normal form
- void getFinalNormalForm( Node n, std::vector< Node >& nf, std::vector< Node >& exp );
//separate into collections with equal length
void separateByLength( std::vector< Node >& n, std::vector< std::vector< Node > >& col, std::vector< Node >& lts );
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback