summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorajreynol <andrew.j.reynolds@gmail.com>2016-11-08 10:35:46 -0600
committerajreynol <andrew.j.reynolds@gmail.com>2016-11-08 10:35:46 -0600
commit55499c51c818ce1488c63e8e42841eb1293db922 (patch)
treea41d6d812181858ac9fc9f10c7cd48d1412fddc2
parent2f2e9fcf1fbb27f8e799aeac2372c0a9113f01aa (diff)
Minor fixes related to ExtTheory + incremental, fixes bug760.
-rw-r--r--src/theory/strings/theory_strings.cpp2
-rw-r--r--src/theory/theory.cpp17
-rw-r--r--src/theory/theory.h1
3 files changed, 15 insertions, 5 deletions
diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp
index ade5428ca..26e6908da 100644
--- a/src/theory/strings/theory_strings.cpp
+++ b/src/theory/strings/theory_strings.cpp
@@ -1133,7 +1133,7 @@ void TheoryStrings::checkInit() {
}
//infer the equality
sendInference( exp, n.eqNode( nc ), "I_Norm" );
- }else{
+ }else if( d_extt->hasFunctionKind( n.getKind() ) ){
//mark as congruent : only process if neither has been reduced
d_extt->markCongruent( nc, n );
}
diff --git a/src/theory/theory.cpp b/src/theory/theory.cpp
index 1c0a03e9c..2d8ea9fa8 100644
--- a/src/theory/theory.cpp
+++ b/src/theory/theory.cpp
@@ -324,7 +324,8 @@ void ExtTheory::collectVars( Node n, std::vector< Node >& vars, std::map< Node,
if( !n.isConst() ){
if( visited.find( n )==visited.end() ){
visited[n] = true;
- //treat terms not belonging to this theory as leaf
+ //treat terms not belonging to this theory as leaf
+ // AJR TODO : should include terms not belonging to this theory (commented below)
if( n.getNumChildren()>0 ){//&& Theory::theoryOf(n)==d_parent->getId() ){
for( unsigned i=0; i<n.getNumChildren(); i++ ){
collectVars( n[i], vars, visited );
@@ -349,6 +350,7 @@ void ExtTheory::getSubstitutedTerms( int effort, std::vector< Node >& terms, std
//do substitution, rewrite
Node n = terms[i];
std::map< Node, ExtfInfo >::iterator iti = d_extf_info.find( n );
+ Trace("extt-debug") << "Check extf : " << n << std::endl;
Assert( iti!=d_extf_info.end() );
for( unsigned i=0; i<iti->second.d_vars.size(); i++ ){
if( std::find( vars.begin(), vars.end(), iti->second.d_vars[i] )==vars.end() ){
@@ -544,6 +546,8 @@ void ExtTheory::registerTermRec( Node n, std::map< Node, bool >& visited ) {
//mark reduced
void ExtTheory::markReduced( Node n, bool contextDepend ) {
+ registerTerm( n );
+ Assert( d_ext_func_terms.find( n )!=d_ext_func_terms.end() );
d_ext_func_terms[n] = false;
if( !contextDepend ){
d_ci_inactive.insert( n );
@@ -563,14 +567,19 @@ void ExtTheory::markReduced( Node n, bool contextDepend ) {
//mark congruent
void ExtTheory::markCongruent( Node a, Node b ) {
+ Trace("extt-debug") << "Mark congruent : " << a << " " << b << std::endl;
+ registerTerm( a );
+ registerTerm( b );
NodeBoolMap::const_iterator it = d_ext_func_terms.find( b );
if( it!=d_ext_func_terms.end() ){
- if( d_ext_func_terms.find( a )==d_ext_func_terms.end() ){
- d_ext_func_terms[a] = (*it).second;
- }else{
+ if( d_ext_func_terms.find( a )!=d_ext_func_terms.end() ){
d_ext_func_terms[a] = d_ext_func_terms[a] && (*it).second;
+ }else{
+ Assert( false );
}
d_ext_func_terms[b] = false;
+ }else{
+ Assert( false );
}
}
diff --git a/src/theory/theory.h b/src/theory/theory.h
index ffcec7c0c..fd8cffa9f 100644
--- a/src/theory/theory.h
+++ b/src/theory/theory.h
@@ -1027,6 +1027,7 @@ public:
virtual ~ExtTheory(){}
//add extf kind
void addFunctionKind( Kind k ) { d_extf_kind[k] = true; }
+ bool hasFunctionKind( Kind k ) { return d_extf_kind.find( k )!=d_extf_kind.end(); }
//register term
// adds n to d_ext_func_terms if addFunctionKind( n.getKind() ) was called
void registerTerm( Node n );
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback