}
bool InstMatchGenerator::getNextMatch( Node f, InstMatch& m, QuantifiersEngine* qe ){
- if( qe->inConflict() ){
- return false;
- }
if( d_needsReset ){
Trace("matching") << "Reset not done yet, must do the reset..." << std::endl;
reset( d_eq_class, qe );
m.add( baseMatch );
if( qe->addInstantiation( f, m, false ) ){
addedLemmas++;
+ if( qe->inConflict() ){
+ break;
+ }
}
}else{
addedLemmas++;
+ if( qe->inConflict() ){
+ break;
+ }
}
m.clear();
}
}
}
}else{
- for( int i=0; i<(int)d_children.size(); i++ ){
+ for( unsigned i=0; i<d_children.size(); i++ ){
d_children[i]->addTerm( f, t, qe );
}
}
/** reset instantiation round (call this whenever equivalence classes have changed) */
void InstMatchGeneratorMulti::resetInstantiationRound( QuantifiersEngine* qe ){
- for( int i=0; i<(int)d_children.size(); i++ ){
+ for( unsigned i=0; i<d_children.size(); i++ ){
d_children[i]->resetInstantiationRound( qe );
}
}
/** reset, eqc is the equivalence class to search in (any if eqc=null) */
void InstMatchGeneratorMulti::reset( Node eqc, QuantifiersEngine* qe ){
- for( int i=0; i<(int)d_children.size(); i++ ){
+ for( unsigned i=0; i<d_children.size(); i++ ){
d_children[i]->reset( eqc, qe );
}
}
int InstMatchGeneratorMulti::addInstantiations( Node q, InstMatch& baseMatch, QuantifiersEngine* qe ){
int addedLemmas = 0;
Debug("smart-multi-trigger") << "Process smart multi trigger" << std::endl;
- for( int i=0; i<(int)d_children.size(); i++ ){
+ for( unsigned i=0; i<d_children.size(); i++ ){
Debug("smart-multi-trigger") << "Calculate matches " << i << std::endl;
std::vector< InstMatch > newMatches;
InstMatch m( q );
m.clear();
}
Debug("smart-multi-trigger") << "Made " << newMatches.size() << " new matches for index " << i << std::endl;
- for( int j=0; j<(int)newMatches.size(); j++ ){
+ for( unsigned j=0; j<newMatches.size(); j++ ){
processNewMatch( qe, newMatches[j], i, addedLemmas );
+ if( qe->inConflict() ){
+ return addedLemmas;
+ }
}
}
return addedLemmas;
void InstMatchGeneratorMulti::processNewInstantiations( QuantifiersEngine* qe, InstMatch& m, int& addedLemmas, InstMatchTrie* tr,
std::vector< IndexedTrie >& unique_var_tries,
int trieIndex, int childIndex, int endChildIndex, bool modEq ){
+ Assert( !qe->inConflict() );
if( childIndex==endChildIndex ){
//now, process unique variables
processNewInstantiations2( qe, m, addedLemmas, unique_var_tries, 0 );
mn.setValue( curr_index, it->first);
processNewInstantiations( qe, mn, addedLemmas, &(it->second), unique_var_tries,
trieIndex+1, childIndex, endChildIndex, modEq );
+ if( qe->inConflict() ){
+ break;
+ }
}
//}
}else{
if( itc!=tr->d_data.end() ){
processNewInstantiations( qe, m, addedLemmas, &(itc->second), unique_var_tries,
trieIndex+1, childIndex, endChildIndex, modEq );
+ if( qe->inConflict() ){
+ break;
+ }
}
}
++eqc;
InstMatch mn( &m );
mn.setValue( curr_index, it->first);
processNewInstantiations2( qe, mn, addedLemmas, unique_var_tries, uvtIndex, &(it->second), trieIndex+1 );
+ if( qe->inConflict() ){
+ break;
+ }
}
}else{
processNewInstantiations2( qe, m, addedLemmas, unique_var_tries, uvtIndex+1 );
InstMatch m( q );
m.add( baseMatch );
addInstantiations( m, qe, addedLemmas, 0, &(it->second) );
+ if( qe->inConflict() ){
+ break;
+ }
}
}
tat = NULL;
InstMatch m( q );
m.add( baseMatch );
addInstantiations( m, qe, addedLemmas, 0, tat );
- return addedLemmas;
- }else{
- return 0;
}
+ return addedLemmas;
}
void InstMatchGeneratorSimple::addInstantiations( InstMatch& m, QuantifiersEngine* qe, int& addedLemmas, int argIndex, quantifiers::TermArgTrie* tat ){
}
return;
}
+ //inst constant from another quantified formula, treat as ground term TODO: remove this?
}
- if( !qe->inConflict() ){
- Node r = qe->getEqualityQuery()->getRepresentative( d_match_pattern[argIndex] );
- std::map< TNode, quantifiers::TermArgTrie >::iterator it = tat->d_data.find( r );
- if( it!=tat->d_data.end() ){
- addInstantiations( m, qe, addedLemmas, argIndex+1, &(it->second) );
- }
+ Node r = qe->getEqualityQuery()->getRepresentative( d_match_pattern[argIndex] );
+ std::map< TNode, quantifiers::TermArgTrie >::iterator it = tat->d_data.find( r );
+ if( it!=tat->d_data.end() ){
+ addInstantiations( m, qe, addedLemmas, argIndex+1, &(it->second) );
}
}
}
if( areDisequal( a, b ) ){
return true;
}else{
- //TODO?
- return false;
+ //Assert( getRepresentative( a )==a );
+ //Assert( getRepresentative( b )==b );
+ std::map< Node, std::vector< Node > >::iterator itd = d_diseq_list[a].find( b );
+ if( itd!=d_diseq_list[a].end() ){
+ exp.insert( exp.end(), itd->second.begin(), itd->second.end() );
+ return true;
+ }else{
+ return false;
+ }
}
}
Trace("qip-eq") << "EqualityQueryInstProp::setEqual : merge " << ar << " -> " << br << ", exp size = " << d_uf_exp[ar].size() << ", status = " << status << std::endl;
a = ar;
b = br;
+
+ //carry disequality list
+ std::map< Node, std::map< Node, std::vector< Node > > >::iterator itd = d_diseq_list.find( ar );
+ if( itd!=d_diseq_list.end() ){
+ for( std::map< Node, std::vector< Node > >::iterator itdd = itd->second.begin(); itdd != itd->second.end(); ++itdd ){
+ Node d = itdd->first;
+ if( d_diseq_list[br].find( d )==d_diseq_list[br].end() ){
+ merge_exp( d_diseq_list[br][d], itdd->second );
+ merge_exp( d_diseq_list[br][d], d_uf_exp[ar] );
+ }
+ }
+ }
+
return status;
}else{
- //TODO?
+ Trace("qip-eq") << "EqualityQueryInstProp::setEqual : disequal " << ar << " <> " << br << std::endl;
+ Assert( d_diseq_list[ar].find( br )==d_diseq_list[ar].end() );
+ Assert( d_diseq_list[br].find( ar )==d_diseq_list[br].end() );
+
+ merge_exp( d_diseq_list[ar][br], reason );
+ merge_exp( d_diseq_list[br][ar], reason );
return STATUS_NONE;
}
}
Trace("qip-prop") << "...finished notify instantiation." << std::endl;
return !d_conflict;
}else{
+ Assert( false );
return true;
}
}
addRelevantInstances( exp, "qip-propagate" );
//now, inform quantifiers engine which instances should be retracted
+ Trace("qip-prop-debug") << "...remove instantiation ids : ";
for( std::map< unsigned, InstInfo >::iterator it = d_ii.begin(); it != d_ii.end(); ++it ){
if( d_relevant_inst.find( it->first )==d_relevant_inst.end() ){
if( !d_qe->removeInstantiation( it->second.d_q, it->second.d_lem, it->second.d_terms ) ){
Trace("qip-warn") << "WARNING : did not remove instantiation id " << it->first << std::endl;
Assert( false );
+ }else{
+ Trace("qip-prop-debug") << it->first << " ";
}
}
}
+ Trace("qip-prop-debug") << std::endl;
//will interupt the quantifiers engine
Trace("quant-engine-conflict") << "-----> InstPropagator::conflict with " << exp.size() << " instances." << std::endl;
}