}\r
\r
bool ConjectureGenerator::needsCheck( Theory::Effort e ) {\r
- return e==Theory::EFFORT_FULL;\r
+ // synchonized with instantiation engine\r
+ return d_quantEngine->getInstWhenNeedsCheck( e );\r
}\r
\r
bool ConjectureGenerator::hasEnumeratedUf( Node n ) {\r
//skip inst constant nodes
while( nv<maxs[index] && nv<=max_i &&
r==1 && quantifiers::TermDb::hasInstConstAttr( d_quantEngine->getTermDatabase()->d_type_map[f[0][index].getType()][nv] ) ){
- childIndex[index]++;
- nv = childIndex[index]+1;
+ nv++;
}
}
if( nv<maxs[index] && nv<=max_i ){
- childIndex[index]++;
+ childIndex[index] = nv;
index++;
}else{
childIndex.pop_back();
}
success = index>=0;
if( success ){
- Trace("inst-alg-rd") << "Try instantiation..." << std::endl;
- index--;
+ Trace("inst-alg-rd") << "Try instantiation { ";
+ for( unsigned j=0; j<childIndex.size(); j++ ){
+ Trace("inst-alg-rd") << childIndex[j] << " ";
+ }
+ Trace("inst-alg-rd") << "}" << std::endl;
//try instantiation
std::vector< Node > terms;
for( unsigned i=0; i<f[0].getNumChildren(); i++ ){
Trace("inst-alg-rd") << "Success!" << std::endl;
++(d_quantEngine->getInstantiationEngine()->d_statistics.d_instantiations_guess);
return STATUS_UNKNOWN;
+ }else{
+ index--;
}
}
}while( success );
using namespace CVC4::theory::inst;
InstantiationEngine::InstantiationEngine( QuantifiersEngine* qe, bool setIncomplete ) :
-QuantifiersModule( qe ), d_isup(NULL), d_i_ag(NULL), d_i_lte(NULL), d_i_fs(NULL), d_i_splx(NULL), d_setIncomplete( setIncomplete ), d_ierCounter( 0 ){
+QuantifiersModule( qe ), d_isup(NULL), d_i_ag(NULL), d_i_lte(NULL), d_i_fs(NULL), d_i_splx(NULL), d_setIncomplete( setIncomplete ){
}
}
bool InstantiationEngine::needsCheck( Theory::Effort e ){
- if( e==Theory::EFFORT_FULL ){
- d_ierCounter++;
- }
- //determine if we should perform check, based on instWhenMode
- bool performCheck = false;
- if( options::instWhenMode()==INST_WHEN_FULL ){
- performCheck = ( e >= Theory::EFFORT_FULL );
- }else if( options::instWhenMode()==INST_WHEN_FULL_DELAY ){
- performCheck = ( e >= Theory::EFFORT_FULL ) && !d_quantEngine->getTheoryEngine()->needCheck();
- }else if( options::instWhenMode()==INST_WHEN_FULL_LAST_CALL ){
- performCheck = ( ( e==Theory::EFFORT_FULL && d_ierCounter%2==0 ) || e==Theory::EFFORT_LAST_CALL );
- }else if( options::instWhenMode()==INST_WHEN_LAST_CALL ){
- performCheck = ( e >= Theory::EFFORT_LAST_CALL );
- }else{
- performCheck = true;
- }
- static int ierCounter2 = 0;
- if( e==Theory::EFFORT_LAST_CALL ){
- ierCounter2++;
- //with bounded integers, skip every other last call,
- // since matching loops may occur with infinite quantification
- if( ierCounter2%2==0 && options::fmfBoundInt() ){
- performCheck = false;
- }
- }
- return performCheck;
+ return d_quantEngine->getInstWhenNeedsCheck( e );
}
void InstantiationEngine::check( Theory::Effort e, unsigned quant_e ){
if( quant_e==QuantifiersEngine::QEFFORT_STANDARD ){
- Debug("inst-engine") << "IE: Check " << e << " " << d_ierCounter << std::endl;
double clSet = 0;
if( Trace.isOn("inst-engine") ){
clSet = double(clock())/double(CLOCKS_PER_SEC);
typedef context::CDHashMap< Node, bool, NodeHashFunction > BoolMap;
/** whether the instantiation engine should set incomplete if it cannot answer SAT */
bool d_setIncomplete;
- /** inst round counter */
- int d_ierCounter;
/** whether each quantifier is active */
std::map< Node, bool > d_quant_active;
/** whether we have added cbqi lemma */
d_builder = NULL;
}
- //options
d_total_inst_count_debug = 0;
+ d_ierCounter = 0;
+ d_ierCounter_lc = 0;
}
QuantifiersEngine::~QuantifiersEngine(){
Trace("quant-engine-debug") << "Master equality engine not consistent, return." << std::endl;
return;
}
+ if( e==Theory::EFFORT_FULL ){
+ d_ierCounter++;
+ }else if( e==Theory::EFFORT_LAST_CALL ){
+ d_ierCounter_lc++;
+ }
bool needsCheck = false;
bool needsModel = false;
bool needsFullModel = false;
return addSplit( fm );
}
+bool QuantifiersEngine::getInstWhenNeedsCheck( Theory::Effort e ) {
+ //determine if we should perform check, based on instWhenMode
+ bool performCheck = false;
+ if( options::instWhenMode()==quantifiers::INST_WHEN_FULL ){
+ performCheck = ( e >= Theory::EFFORT_FULL );
+ }else if( options::instWhenMode()==quantifiers::INST_WHEN_FULL_DELAY ){
+ performCheck = ( e >= Theory::EFFORT_FULL ) && !getTheoryEngine()->needCheck();
+ }else if( options::instWhenMode()==quantifiers::INST_WHEN_FULL_LAST_CALL ){
+ performCheck = ( ( e==Theory::EFFORT_FULL && d_ierCounter%2==0 ) || e==Theory::EFFORT_LAST_CALL );
+ }else if( options::instWhenMode()==quantifiers::INST_WHEN_LAST_CALL ){
+ performCheck = ( e >= Theory::EFFORT_LAST_CALL );
+ }else{
+ performCheck = true;
+ }
+ if( e==Theory::EFFORT_LAST_CALL ){
+ //with bounded integers, skip every other last call,
+ // since matching loops may occur with infinite quantification
+ if( d_ierCounter_lc%2==0 && options::fmfBoundInt() ){
+ performCheck = false;
+ }
+ }
+ return performCheck;
+}
+
void QuantifiersEngine::flushLemmas(){
if( !d_lemmas_waiting.empty() ){
//take default output channel if none is provided
std::map< Node, int > d_total_inst_debug;
std::map< Node, int > d_temp_inst_debug;
int d_total_inst_count_debug;
+ /** inst round counters */
+ int d_ierCounter;
+ int d_ierCounter_lc;
private:
KEEP_STATISTIC(TimerStat, d_time, "theory::QuantifiersEngine::time");
public:
bool hasAddedLemma() { return !d_lemmas_waiting.empty() || d_hasAddedLemma; }
/** get number of waiting lemmas */
int getNumLemmasWaiting() { return (int)d_lemmas_waiting.size(); }
+ /** get needs check */
+ bool getInstWhenNeedsCheck( Theory::Effort e );
/** set instantiation level attr */
static void setInstantiationLevelAttr( Node n, uint64_t level );
/** is term eligble for instantiation? */