#include "theory/quantifiers/candidate_generator.h"
#include "theory/quantifiers_engine.h"
#include "theory/quantifiers/options.h"
+#include "util/datatype.h"
using namespace std;
using namespace CVC4;
}
}
}
+ }else if( d_match_pattern.getKind()==APPLY_SELECTOR_TOTAL && d_match_pattern[0].getKind()==INST_CONSTANT && options::purifyDtTriggers() ){
+ d_match_pattern = d_match_pattern[0];
}
d_match_pattern_type = d_match_pattern.getType();
Trace("inst-match-gen") << "Pattern is " << d_pattern << ", match pattern is " << d_match_pattern << std::endl;
//create candidate generator
if( d_match_pattern.getKind()==INST_CONSTANT ){
- d_cg = new CandidateGeneratorQEAll( qe, d_match_pattern );
+ if( d_pattern.getKind()==APPLY_SELECTOR_TOTAL ){
+ Expr selectorExpr = qe->getTermDatabase()->getOperator( d_pattern ).toExpr();
+ size_t selectorIndex = Datatype::cindexOf(selectorExpr);
+ const Datatype& dt = Datatype::datatypeOf(selectorExpr);
+ const DatatypeConstructor& c = dt[selectorIndex];
+ Node cOp = Node::fromExpr(c.getConstructor());
+ Trace("inst-match-gen") << "Purify dt trigger " << d_pattern << ", will match terms of op " << cOp << std::endl;
+ d_cg = new inst::CandidateGeneratorQE( qe, cOp );
+ }else{
+ d_cg = new CandidateGeneratorQEAll( qe, d_match_pattern );
+ }
}else if( d_match_pattern.getKind()==EQUAL || d_match_pattern.getKind()==IFF ){
//we will be producing candidates via literal matching heuristics
if( d_pattern.getKind()!=NOT ){
std::map< Node, std::vector< Node > > varContains;
d_quantEngine->getTermDatabase()->getVarContains( f, patTermsF, varContains );
for( std::map< Node, std::vector< Node > >::iterator it = varContains.begin(); it != varContains.end(); ++it ){
- if( it->second.size()==f[0].getNumChildren() && !Trigger::isPureTheoryTrigger( it->first ) ){
+ if( it->second.size()==f[0].getNumChildren() && ( options::pureThTriggers() || !Trigger::isPureTheoryTrigger( it->first ) ) ){
d_patTerms[0][f].push_back( it->first );
d_is_single_trigger[ it->first ] = true;
}else{
}
void InstStrategyFreeVariable::processResetInstantiationRound( Theory::Effort effort ){
-
+
}
int InstStrategyFreeVariable::process( Node f, Theory::Effort effort, int e ){
choose relational triggers such as x = f(y), x >= f(y)
option purifyTriggers --purify-triggers bool :default false :read-write
purify triggers, e.g. f( x+1 ) becomes f( y ), x mapsto y-1
+option purifyDtTriggers --purify-dt-triggers bool :default false :read-write
+ purify dt triggers, match all constructors of correct form instead of selectors
+option pureThTriggers --pure-th-triggers bool :default false :read-write
+ use pure theory terms as single triggers
option multiTriggerWhenSingle --multi-trigger-when-single bool :default true
never select multi-triggers when single triggers exist
option triggerSelMode --trigger-sel CVC4::theory::quantifiers::TriggerSelMode :default CVC4::theory::quantifiers::TRIGGER_SEL_DEFAULT :read-write :include "theory/quantifiers/modes.h" :handler CVC4::theory::quantifiers::stringToTriggerSelMode :handler-include "theory/quantifiers/options_handlers.h"
return false;
}
}
+ if( options::purifyDtTriggers() && n.getKind()==APPLY_SELECTOR_TOTAL ){
+ return false;
+ }
return true;
}else{
return false;
for( unsigned i=0; i<n.getNumChildren(); i++ ){
if( !isLocalTheoryExt( n[i], vars, patTerms ) ){
return false;
- }
+ }
}
}
return true;