while( getNextMatch( f, m, qe ) ){
if( !d_active_add ){
m.add( baseMatch );
- if( qe->addInstantiation( f, m ) ){
+ if( qe->addInstantiation( f, m, false ) ){
addedLemmas++;
}
}else{
if( !d_match_pattern.isNull() ){
InstMatch m( f );
if( getMatch( f, t, m, qe ) ){
- if( qe->addInstantiation( f, m ) ){
+ if( qe->addInstantiation( f, m, false ) ){
return 1;
}
}
}
}else{
//m is an instantiation
- if( qe->addInstantiation( d_f, m ) ){
+ if( qe->addInstantiation( d_f, m, false ) ){
addedLemmas++;
Debug("smart-multi-trigger") << "-> Produced instantiation " << m << std::endl;
}
return 0;
}
}
- return qe->addInstantiation( f, m ) ? 1 : 0;
+ return qe->addInstantiation( f, m, false ) ? 1 : 0;
}
}/* CVC4::theory::inst namespace */
}
}
//now, make sure that no other member of the class is an instance
- r_best = getInstance( r_best, eqc );
+ std::hash_map<TNode, Node, TNodeHashFunction> cache;
+ r_best = getInstance( r_best, eqc, cache );
//store that this representative was chosen at this point
if( d_rep_score.find( r_best )==d_rep_score.end() ){
d_rep_score[ r_best ] = d_reset_count;
//helper functions
-Node EqualityQueryQuantifiersEngine::getInstance( Node n, std::vector< Node >& eqc ){
+Node EqualityQueryQuantifiersEngine::getInstance( Node n, const std::vector< Node >& eqc, std::hash_map<TNode, Node, TNodeHashFunction>& cache ){
+ if(cache.find(n) != cache.end()) {
+ return cache[n];
+ }
for( size_t i=0; i<n.getNumChildren(); i++ ){
- Node nn = getInstance( n[i], eqc );
+ Node nn = getInstance( n[i], eqc, cache );
if( !nn.isNull() ){
- return nn;
+ return cache[n] = nn;
}
}
if( std::find( eqc.begin(), eqc.end(), n )!=eqc.end() ){
- return n;
+ return cache[n] = n;
}else{
- return Node::null();
+ return cache[n] = Node::null();
}
}
bool d_liberal;
private:
/** node contains */
- Node getInstance( Node n, std::vector< Node >& eqc );
+ Node getInstance( Node n, const std::vector< Node >& eqc, std::hash_map<TNode, Node, TNodeHashFunction>& cache );
/** get score */
int getRepScore( Node n, Node f, int index );
public: