* Make QEffort an enum.
* Format
* Minor
* Fix
QuantAntiSkolem::~QuantAntiSkolem() { delete d_sqc; }
/* Call during quantifier engine's check */
-void QuantAntiSkolem::check( Theory::Effort e, unsigned quant_e ) {
- if( quant_e==QuantifiersEngine::QEFFORT_STANDARD ){
+void QuantAntiSkolem::check(Theory::Effort e, QEffort quant_e)
+{
+ if (quant_e == QEFFORT_STANDARD)
+ {
d_sqtc.clear();
for( unsigned i=0; i<d_quantEngine->getModel()->getNumAssertedQuantifiers(); i++ ){
Node q = d_quantEngine->getModel()->getAssertedQuantifier( i );
bool pconnected = true );
/* Call during quantifier engine's check */
- void check( Theory::Effort e, unsigned quant_e );
+ void check(Theory::Effort e, QEffort quant_e);
/* Called for new quantifiers */
void registerQuantifier( Node q ) {}
void assertNode( Node n ) {}
return e==Theory::EFFORT_LAST_CALL;
}
-void BoundedIntegers::check( Theory::Effort e, unsigned quant_e ) {
- if( quant_e==QuantifiersEngine::QEFFORT_STANDARD ){
+void BoundedIntegers::check(Theory::Effort e, QEffort quant_e)
+{
+ if (quant_e == QEFFORT_STANDARD)
+ {
Trace("bint-engine") << "---Bounded Integers---" << std::endl;
bool addedLemma = false;
//make sure proxies are up-to-date with range
void presolve();
bool needsCheck( Theory::Effort e );
- void check( Theory::Effort e, unsigned quant_e );
+ void check(Theory::Effort e, QEffort quant_e);
void registerQuantifier( Node q );
void preRegisterQuantifier( Node q );
void assertNode( Node n );
return e>=Theory::EFFORT_LAST_CALL;
}
-unsigned CegInstantiation::needsModel( Theory::Effort e ) {
- return d_conj->isSingleInvocation() ? QuantifiersEngine::QEFFORT_STANDARD : QuantifiersEngine::QEFFORT_MODEL;
+QuantifiersModule::QEffort CegInstantiation::needsModel(Theory::Effort e)
+{
+ return d_conj->isSingleInvocation() ? QEFFORT_STANDARD : QEFFORT_MODEL;
}
-void CegInstantiation::check( Theory::Effort e, unsigned quant_e ) {
- unsigned echeck = d_conj->isSingleInvocation() ? QuantifiersEngine::QEFFORT_STANDARD : QuantifiersEngine::QEFFORT_MODEL;
+void CegInstantiation::check(Theory::Effort e, QEffort quant_e)
+{
+ unsigned echeck =
+ d_conj->isSingleInvocation() ? QEFFORT_STANDARD : QEFFORT_MODEL;
if( quant_e==echeck ){
Trace("cegqi-engine") << "---Counterexample Guided Instantiation Engine---" << std::endl;
Trace("cegqi-engine-debug") << std::endl;
~CegInstantiation();
public:
bool needsCheck( Theory::Effort e );
- unsigned needsModel( Theory::Effort e );
+ QEffort needsModel(Theory::Effort e);
/* Call during quantifier engine's check */
- void check( Theory::Effort e, unsigned quant_e );
+ void check(Theory::Effort e, QEffort quant_e);
/* Called for new quantifiers */
void registerQuantifier( Node q );
/** get the next decision request */
void ConjectureGenerator::reset_round( Theory::Effort e ) {
}
-
-void ConjectureGenerator::check( Theory::Effort e, unsigned quant_e ) {
- if( quant_e==QuantifiersEngine::QEFFORT_STANDARD ){
+void ConjectureGenerator::check(Theory::Effort e, QEffort quant_e)
+{
+ if (quant_e == QEFFORT_STANDARD)
+ {
d_fullEffortCount++;
if( d_fullEffortCount%optFullCheckFrequency()==0 ){
d_hasAddedLemma = false;
/* reset at a round */
void reset_round( Theory::Effort e );
/* Call during quantifier engine's check */
- void check( Theory::Effort e, unsigned quant_e );
+ void check(Theory::Effort e, QEffort quant_e);
/* Called for new quantifiers */
void registerQuantifier( Node q );
void assertNode( Node n );
}
/* Call during quantifier engine's check */
-void FunDefEngine::check( Theory::Effort e, unsigned quant_e ) {
+void FunDefEngine::check(Theory::Effort e, QEffort quant_e)
+{
//TODO
}
/* reset at a round */
void reset_round( Theory::Effort e );
/* Call during quantifier engine's check */
- void check( Theory::Effort e, unsigned quant_e );
+ void check(Theory::Effort e, QEffort quant_e);
/* Called for new quantifiers */
void registerQuantifier( Node q );
/** called for everything that gets asserted */
return d_qy.reset( e );
}
-bool InstPropagator::notifyInstantiation( unsigned quant_e, Node q, Node lem, std::vector< Node >& terms, Node body ) {
+bool InstPropagator::notifyInstantiation(QuantifiersModule::QEffort quant_e,
+ Node q,
+ Node lem,
+ std::vector<Node>& terms,
+ Node body)
+{
if( !d_conflict ){
if( Trace.isOn("qip-prop") ){
Trace("qip-prop") << "InstPropagator:: Notify instantiation " << q << " : " << std::endl;
InstPropagator& d_ip;
public:
InstantiationNotifyInstPropagator(InstPropagator& ip): d_ip(ip) {}
- virtual bool notifyInstantiation( unsigned quant_e, Node q, Node lem, std::vector< Node >& terms, Node body ) {
+ virtual bool notifyInstantiation(QuantifiersModule::QEffort quant_e,
+ Node q,
+ Node lem,
+ std::vector<Node>& terms,
+ Node body)
+ {
return d_ip.notifyInstantiation( quant_e, q, lem, terms, body );
}
virtual void filterInstantiations() { d_ip.filterInstantiations(); }
};
InstantiationNotifyInstPropagator d_notify;
/** notify instantiation method */
- bool notifyInstantiation( unsigned quant_e, Node q, Node lem, std::vector< Node >& terms, Node body );
+ bool notifyInstantiation(QuantifiersModule::QEffort quant_e,
+ Node q,
+ Node lem,
+ std::vector<Node>& terms,
+ Node body);
/** remove instance ids */
void filterInstantiations();
/** allocate instantiation */
return e>=Theory::EFFORT_LAST_CALL;
}
-unsigned InstStrategyCbqi::needsModel( Theory::Effort e ) {
+QuantifiersModule::QEffort InstStrategyCbqi::needsModel(Theory::Effort e)
+{
for( unsigned i=0; i<d_quantEngine->getModel()->getNumAssertedQuantifiers(); i++ ){
Node q = d_quantEngine->getModel()->getAssertedQuantifier( i );
if( doCbqi( q ) && d_quantEngine->getModel()->isQuantifierActive( q ) ){
- return QuantifiersEngine::QEFFORT_STANDARD;
+ return QEFFORT_STANDARD;
}
}
- return QuantifiersEngine::QEFFORT_NONE;
+ return QEFFORT_NONE;
}
bool InstStrategyCbqi::registerCbqiLemma( Node q ) {
processResetInstantiationRound( effort );
}
-void InstStrategyCbqi::check( Theory::Effort e, unsigned quant_e ) {
- if( quant_e==QuantifiersEngine::QEFFORT_STANDARD ){
+void InstStrategyCbqi::check(Theory::Effort e, QEffort quant_e)
+{
+ if (quant_e == QEFFORT_STANDARD)
+ {
Assert( !d_quantEngine->inConflict() );
double clSet = 0;
if( Trace.isOn("cbqi-engine") ){
bool doCbqi( Node q );
/** process functions */
bool needsCheck( Theory::Effort e );
- unsigned needsModel( Theory::Effort e );
+ QEffort needsModel(Theory::Effort e);
void reset_round( Theory::Effort e );
- void check( Theory::Effort e, unsigned quant_e );
+ void check(Theory::Effort e, QEffort quant_e);
bool checkComplete();
bool checkCompleteFor( Node q );
void preRegisterQuantifier( Node q );
}
void InstStrategyEnum::reset_round(Theory::Effort e) {}
-void InstStrategyEnum::check(Theory::Effort e, unsigned quant_e)
+void InstStrategyEnum::check(Theory::Effort e, QEffort quant_e)
{
bool doCheck = false;
bool fullEffort = false;
if (options::fullSaturateInterleave())
{
// we only add when interleaved with other strategies
- doCheck = quant_e == QuantifiersEngine::QEFFORT_STANDARD
- && d_quantEngine->hasAddedLemma();
+ doCheck = quant_e == QEFFORT_STANDARD && d_quantEngine->hasAddedLemma();
}
if (options::fullSaturateQuant() && !doCheck)
{
- doCheck = quant_e == QuantifiersEngine::QEFFORT_LAST_CALL;
+ doCheck = quant_e == QEFFORT_LAST_CALL;
fullEffort = !d_quantEngine->hasAddedLemma();
}
if (doCheck)
* Adds instantiations for all currently asserted
* quantified formulas via calls to process(...)
*/
- void check(Theory::Effort e, unsigned quant_e) override;
+ void check(Theory::Effort e, QEffort quant_e) override;
/** Register quantifier. */
void registerQuantifier(Node q) override;
/** Identify. */
}
}
-void InstantiationEngine::check( Theory::Effort e, unsigned quant_e ){
+void InstantiationEngine::check(Theory::Effort e, QEffort quant_e)
+{
CodeTimer codeTimer(d_quantEngine->d_statistics.d_ematching_time);
- if( quant_e==QuantifiersEngine::QEFFORT_STANDARD ){
+ if (quant_e == QEFFORT_STANDARD)
+ {
double clSet = 0;
if( Trace.isOn("inst-engine") ){
clSet = double(clock())/double(CLOCKS_PER_SEC);
void presolve();
bool needsCheck(Theory::Effort e);
void reset_round(Theory::Effort e);
- void check(Theory::Effort e, unsigned quant_e);
+ void check(Theory::Effort e, QEffort quant_e);
bool checkCompleteFor(Node q);
void preRegisterQuantifier(Node q);
void registerQuantifier(Node q);
return e>=Theory::EFFORT_FULL && d_needsCheck;
}
/* Call during quantifier engine's check */
-void LtePartialInst::check( Theory::Effort e, unsigned quant_e ) {
+void LtePartialInst::check(Theory::Effort e, QEffort quant_e)
+{
//flush lemmas ASAP (they are a reduction)
- if( quant_e==QuantifiersEngine::QEFFORT_CONFLICT && d_needsCheck ){
+ if (quant_e == QEFFORT_CONFLICT && d_needsCheck)
+ {
std::vector< Node > lemmas;
getInstantiations( lemmas );
//add lemmas to quantifiers engine
/* whether this module needs to check this round */
bool needsCheck( Theory::Effort e );
/* Call during quantifier engine's check */
- void check( Theory::Effort e, unsigned quant_e );
+ void check(Theory::Effort e, QEffort quant_e);
/* Called for new quantifiers */
void registerQuantifier( Node q ) {}
/* check complete */
return e==Theory::EFFORT_LAST_CALL;
}
-unsigned ModelEngine::needsModel( Theory::Effort e ) {
+QuantifiersModule::QEffort ModelEngine::needsModel(Theory::Effort e)
+{
if( options::mbqiInterleave() ){
- return QuantifiersEngine::QEFFORT_STANDARD;
+ return QEFFORT_STANDARD;
}else{
- return QuantifiersEngine::QEFFORT_MODEL;
+ return QEFFORT_MODEL;
}
}
void ModelEngine::reset_round( Theory::Effort e ) {
d_incomplete_check = true;
}
-
-void ModelEngine::check( Theory::Effort e, unsigned quant_e ){
+void ModelEngine::check(Theory::Effort e, QEffort quant_e)
+{
bool doCheck = false;
if( options::mbqiInterleave() ){
- doCheck = quant_e==QuantifiersEngine::QEFFORT_STANDARD && d_quantEngine->hasAddedLemma();
+ doCheck = quant_e == QEFFORT_STANDARD && d_quantEngine->hasAddedLemma();
}
if( !doCheck ){
- doCheck = quant_e==QuantifiersEngine::QEFFORT_MODEL;
+ doCheck = quant_e == QEFFORT_MODEL;
}
if( doCheck ){
Assert( !d_quantEngine->inConflict() );
virtual ~ModelEngine();
public:
bool needsCheck( Theory::Effort e );
- unsigned needsModel( Theory::Effort e );
+ QEffort needsModel(Theory::Effort e);
void reset_round( Theory::Effort e );
- void check( Theory::Effort e, unsigned quant_e );
+ void check(Theory::Effort e, QEffort quant_e);
bool checkComplete();
bool checkCompleteFor( Node q );
void registerQuantifier( Node f );
}
/** check */
-void QuantConflictFind::check( Theory::Effort level, unsigned quant_e ) {
+void QuantConflictFind::check(Theory::Effort level, QEffort quant_e)
+{
CodeTimer codeTimer(d_quantEngine->d_statistics.d_qcf_time);
- if( quant_e==QuantifiersEngine::QEFFORT_CONFLICT ){
+ if (quant_e == QEFFORT_CONFLICT)
+ {
Trace("qcf-check") << "QCF : check : " << level << std::endl;
if( d_conflict ){
Trace("qcf-check2") << "QCF : finished check : already in conflict." << std::endl;
/** reset round */
void reset_round( Theory::Effort level );
/** check */
- void check( Theory::Effort level, unsigned quant_e );
-private:
+ void check(Theory::Effort level, QEffort quant_e);
+
+ private:
bool d_needs_computeRelEqr;
public:
void computeRelevantEqr();
}
/* Call during quantifier engine's check */
-void QuantEqualityEngine::check( Theory::Effort e, unsigned quant_e ) {
+void QuantEqualityEngine::check(Theory::Effort e, QEffort quant_e)
+{
//TODO
}
/* reset at a round */
void reset_round( Theory::Effort e );
/* Call during quantifier engine's check */
- void check( Theory::Effort e, unsigned quant_e );
+ void check(Theory::Effort e, QEffort quant_e);
/* Called for new quantifiers */
void registerQuantifier( Node q );
/** called for everything that gets asserted */
}
/* Call during quantifier engine's check */
-void QuantDSplit::check( Theory::Effort e, unsigned quant_e ) {
+void QuantDSplit::check(Theory::Effort e, QEffort quant_e)
+{
//add lemmas ASAP (they are a reduction)
- if( quant_e==QuantifiersEngine::QEFFORT_CONFLICT ){
+ if (quant_e == QEFFORT_CONFLICT)
+ {
std::vector< Node > lemmas;
for(std::map< Node, int >::iterator it = d_quant_to_reduce.begin(); it != d_quant_to_reduce.end(); ++it) {
Node q = it->first;
/* whether this module needs to check this round */
bool needsCheck( Theory::Effort e );
/* Call during quantifier engine's check */
- void check( Theory::Effort e, unsigned quant_e );
+ void check(Theory::Effort e, QEffort quant_e);
/* Called for new quantifiers */
void registerQuantifier( Node q ) {}
void assertNode( Node n ) {}
namespace CVC4 {
namespace theory {
-unsigned QuantifiersModule::needsModel( Theory::Effort e ) {
- return QuantifiersEngine::QEFFORT_NONE;
+QuantifiersModule::QEffort QuantifiersModule::needsModel(Theory::Effort e)
+{
+ return QEFFORT_NONE;
}
eq::EqualityEngine * QuantifiersModule::getEqualityEngine() {
* It has a similar interface to a Theory object.
*/
class QuantifiersModule {
-public:
+ public:
+ /** effort levels for quantifiers modules check */
+ enum QEffort
+ {
+ // conflict effort, for conflict-based instantiation
+ QEFFORT_CONFLICT,
+ // standard effort, for heuristic instantiation
+ QEFFORT_STANDARD,
+ // model effort, for model-based instantiation
+ QEFFORT_MODEL,
+ // last call effort, for last resort techniques
+ QEFFORT_LAST_CALL,
+ // none
+ QEFFORT_NONE,
+ };
+
+ public:
QuantifiersModule( QuantifiersEngine* qe ) : d_quantEngine( qe ){}
virtual ~QuantifiersModule(){}
/** Presolve.
* which specifies the quantifiers effort in which it requires the model to
* be built.
*/
- virtual unsigned needsModel( Theory::Effort e );
+ virtual QEffort needsModel(Theory::Effort e);
/** Reset.
*
* Called at the beginning of QuantifiersEngine::check(e).
* Called during QuantifiersEngine::check(e) depending
* if needsCheck(e) returns true.
*/
- virtual void check( Theory::Effort e, unsigned quant_e ) = 0;
+ virtual void check(Theory::Effort e, QEffort quant_e) = 0;
/** Check complete?
*
* Returns false if the module's reasoning was globally incomplete
//return e>=Theory::EFFORT_LAST_CALL;
}
-void RewriteEngine::check( Theory::Effort e, unsigned quant_e ) {
- if( quant_e==QuantifiersEngine::QEFFORT_STANDARD ){
+void RewriteEngine::check(Theory::Effort e, QEffort quant_e)
+{
+ if (quant_e == QEFFORT_STANDARD)
+ {
Assert( !d_quantEngine->inConflict() );
Trace("rewrite-engine") << "---Rewrite Engine Round, effort = " << e << "---" << std::endl;
//if( e==Theory::EFFORT_LAST_CALL ){
~RewriteEngine() throw() {}
bool needsCheck( Theory::Effort e );
- void check( Theory::Effort e, unsigned quant_e );
+ void check(Theory::Effort e, QEffort quant_e);
void registerQuantifier( Node f );
void assertNode( Node n );
bool checkCompleteFor( Node q );
}
d_tr_trie = new inst::TriggerTrie;
- d_curr_effort_level = QEFFORT_NONE;
+ d_curr_effort_level = QuantifiersModule::QEFFORT_NONE;
d_conflict = false;
d_hasAddedLemma = false;
d_useModelEe = false;
return;
}
bool needsCheck = !d_lemmas_waiting.empty();
- unsigned needsModelE = QEFFORT_NONE;
+ QuantifiersModule::QEffort needsModelE = QuantifiersModule::QEFFORT_NONE;
std::vector< QuantifiersModule* > qm;
if( d_model->checkNeeded() ){
needsCheck = needsCheck || e>=Theory::EFFORT_LAST_CALL; //always need to check at or above last call
needsCheck = true;
//can only request model at last call since theory combination can find inconsistencies
if( e>=Theory::EFFORT_LAST_CALL ){
- unsigned me = d_modules[i]->needsModel( e );
+ QuantifiersModule::QEffort me = d_modules[i]->needsModel(e);
needsModelE = me<needsModelE ? me : needsModelE;
}
}
++(d_statistics.d_instantiation_rounds);
}
Trace("quant-engine-debug") << "Check modules that needed check..." << std::endl;
- for( unsigned quant_e = QEFFORT_CONFLICT; quant_e<=QEFFORT_LAST_CALL; quant_e++ ){
+ for (unsigned qef = QuantifiersModule::QEFFORT_CONFLICT;
+ qef <= QuantifiersModule::QEFFORT_LAST_CALL;
+ ++qef)
+ {
+ QuantifiersModule::QEffort quant_e =
+ static_cast<QuantifiersModule::QEffort>(qef);
d_curr_effort_level = quant_e;
//build the model if any module requested it
if( needsModelE==quant_e && !d_model->isBuilt() ){
break;
}else{
Assert( !d_conflict );
- if( quant_e==QEFFORT_CONFLICT ){
+ if (quant_e == QuantifiersModule::QEFFORT_CONFLICT)
+ {
if( e==Theory::EFFORT_FULL ){
//increment if a last call happened, we are not strictly enforcing interleaving, or already were in phase
if( d_ierCounterLastLc!=d_ierCounter_lc || !options::instWhenStrictInterleave() || d_ierCounter%d_inst_when_phase!=0 ){
}else if( e==Theory::EFFORT_LAST_CALL ){
d_ierCounter_lc = d_ierCounter_lc + 1;
}
- }else if( quant_e==QEFFORT_MODEL ){
+ }
+ else if (quant_e == QuantifiersModule::QEFFORT_MODEL)
+ {
if( e==Theory::EFFORT_LAST_CALL ){
//sources of incompleteness
if( !d_recorded_inst.empty() ){
}
}
}
- d_curr_effort_level = QEFFORT_NONE;
+ d_curr_effort_level = QuantifiersModule::QEFFORT_NONE;
Trace("quant-engine-debug") << "Done check modules that needed check." << std::endl;
if( d_hasAddedLemma ){
//debug information
setInstantiationLevelAttr( orig_body, q[1], maxInstLevel+1 );
}
}
- if( d_curr_effort_level>QEFFORT_CONFLICT && d_curr_effort_level<QEFFORT_NONE ){
+ if (d_curr_effort_level > QuantifiersModule::QEFFORT_CONFLICT
+ && d_curr_effort_level < QuantifiersModule::QEFFORT_NONE)
+ {
//notify listeners
for( unsigned j=0; j<d_inst_notify.size(); j++ ){
if( !d_inst_notify[j]->notifyInstantiation( d_curr_effort_level, q, lem, terms, body ) ){
public:
InstantiationNotify(){}
virtual ~InstantiationNotify() {}
- virtual bool notifyInstantiation( unsigned quant_e, Node q, Node lem, std::vector< Node >& terms, Node body ) = 0;
+ virtual bool notifyInstantiation(QuantifiersModule::QEffort quant_e,
+ Node q,
+ Node lem,
+ std::vector<Node>& terms,
+ Node body) = 0;
virtual void filterInstantiations() = 0;
};
std::unique_ptr<quantifiers::Skolemize> d_skolemize;
/** term enumeration utility */
std::unique_ptr<quantifiers::TermEnumeration> d_term_enum;
-
- private:
/** instantiation engine */
quantifiers::InstantiationEngine* d_inst_engine;
/** model engine */
/** quantifiers instantiation propagtor */
quantifiers::InstPropagator * d_inst_prop;
- public: // effort levels (TODO : make an enum and use everywhere #1293)
- enum {
- QEFFORT_CONFLICT,
- QEFFORT_STANDARD,
- QEFFORT_MODEL,
- QEFFORT_LAST_CALL,
- //none
- QEFFORT_NONE,
- };
-private: //this information is reset during check
- /** current effort level */
- unsigned d_curr_effort_level;
+ private: //this information is reset during check
+ /** current effort level */
+ QuantifiersModule::QEffort d_curr_effort_level;
/** are we in conflict */
bool d_conflict;
- context::CDO< bool > d_conflict_c;
+ context::CDO<bool> d_conflict_c;
/** has added lemma this round */
bool d_hasAddedLemma;
/** whether to use model equality engine */
bool d_useModelEe;
-private:
+ private:
/** list of all quantifiers seen */
std::map< Node, bool > d_quants;
/** quantifiers reduced */