summaryrefslogtreecommitdiff
path: root/src/theory/substitutions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/theory/substitutions.cpp')
-rw-r--r--src/theory/substitutions.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/theory/substitutions.cpp b/src/theory/substitutions.cpp
index caf7566b9..b7ad1d174 100644
--- a/src/theory/substitutions.cpp
+++ b/src/theory/substitutions.cpp
@@ -71,6 +71,10 @@ Node SubstitutionMap::internalSubstitute(TNode t, NodeCache& substitutionCache)
}
// Mark the substitution and continue
Node result = builder;
+ find = substitutionCache.find(result);
+ if (find != substitutionCache.end()) {
+ result = find->second;
+ }
Debug("substitution::internal") << "SubstitutionMap::internalSubstitute(" << t << "): setting " << current << " -> " << result << std::endl;
substitutionCache[current] = result;
toVisit.pop_back();
@@ -114,13 +118,16 @@ void SubstitutionMap::addSubstitution(TNode x, TNode t, bool invalidateCache) {
d_substitutions[(*it).first] = internalSubstitute((*it).second, tempCache);
}
- // Put the new substitution in
- d_substitutions[x] = t;
+ // Put the new substitution in, but apply existing substitutions to rhs first
+ d_substitutions[x] = apply(t);
// Also invalidate the cache
if (invalidateCache) {
d_cacheInvalidated = true;
}
+ else {
+ d_substitutionCache[x] = d_substitutions[x];
+ }
}
static bool check(TNode node, const SubstitutionMap::NodeMap& substitutions) CVC4_UNUSED;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback