Assert( d_equalityEngine.hasTerm(x) );
Assert( d_equalityEngine.hasTerm(y) );
Assert( !areDisequal( x, y ) );
+ Assert( !areCareDisequal( x, y ) );
if( !d_equalityEngine.areEqual( x, y ) ){
Trace("dt-cg") << "Arg #" << k << " is " << x << " " << y << std::endl;
if( d_equalityEngine.isTriggerTerm(x, THEORY_DATATYPES) && d_equalityEngine.isTriggerTerm(y, THEORY_DATATYPES) ){
TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x, THEORY_DATATYPES);
TNode y_shared = d_equalityEngine.getTriggerTermRepresentative(y, THEORY_DATATYPES);
- Trace("dt-cg") << "Arg #" << k << " shared term is " << x_shared << " " << y_shared << std::endl;
- EqualityStatus eqStatus = d_valuation.getEqualityStatus(x_shared, y_shared);
- Trace("dt-cg") << "...eq status is " << eqStatus << std::endl;
- if( eqStatus==EQUALITY_FALSE_AND_PROPAGATED || eqStatus==EQUALITY_FALSE || eqStatus==EQUALITY_FALSE_IN_MODEL ){
- //an argument is disequal, we are done
- return;
- }else{
- currentPairs.push_back(make_pair(x_shared, y_shared));
- }
+ currentPairs.push_back(make_pair(x_shared, y_shared));
}
}
}
std::map< TNode, quantifiers::TermArgTrie >::iterator it2 = it;
++it2;
for( ; it2 != t1->d_data.end(); ++it2 ){
- if( !areDisequal(it->first, it2->first) ){
- addCarePairs( &it->second, &it2->second, arity, depth+1, n_pairs );
+ if( !d_equalityEngine.areDisequal(it->first, it2->first, false) ){
+ if( !areCareDisequal(it->first, it2->first) ){
+ addCarePairs( &it->second, &it2->second, arity, depth+1, n_pairs );
+ }
}
}
}
//add care pairs based on product of indices, non-disequal arguments
for( std::map< TNode, quantifiers::TermArgTrie >::iterator it = t1->d_data.begin(); it != t1->d_data.end(); ++it ){
for( std::map< TNode, quantifiers::TermArgTrie >::iterator it2 = t2->d_data.begin(); it2 != t2->d_data.end(); ++it2 ){
- if( !areDisequal(it->first, it2->first) ){
- addCarePairs( &it->second, &it2->second, arity, depth+1, n_pairs );
+ if( !d_equalityEngine.areDisequal(it->first, it2->first, false) ){
+ if( !areCareDisequal(it->first, it2->first) ){
+ addCarePairs( &it->second, &it2->second, arity, depth+1, n_pairs );
+ }
}
}
}
}else if( hasTerm( a ) && hasTerm( b ) ){
return d_equalityEngine.areDisequal( a, b, false );
}else{
+ //TODO : constants here?
return false;
}
}
+bool TheoryDatatypes::areCareDisequal( TNode x, TNode y ) {
+ Assert( d_equalityEngine.hasTerm( x ) );
+ Assert( d_equalityEngine.hasTerm( y ) );
+ if( d_equalityEngine.isTriggerTerm(x, THEORY_DATATYPES) && d_equalityEngine.isTriggerTerm(y, THEORY_DATATYPES) ){
+ TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x, THEORY_DATATYPES);
+ TNode y_shared = d_equalityEngine.getTriggerTermRepresentative(y, THEORY_DATATYPES);
+ EqualityStatus eqStatus = d_valuation.getEqualityStatus(x_shared, y_shared);
+ if( eqStatus==EQUALITY_FALSE_AND_PROPAGATED || eqStatus==EQUALITY_FALSE || eqStatus==EQUALITY_FALSE_IN_MODEL ){
+ return true;
+ }
+ }
+ return false;
+}
+
TNode TheoryDatatypes::getRepresentative( TNode a ){
if( hasTerm( a ) ){
return d_equalityEngine.getRepresentative( a );
bool hasTerm( TNode a );
bool areEqual( TNode a, TNode b );
bool areDisequal( TNode a, TNode b );
+ bool areCareDisequal( TNode x, TNode y );
TNode getRepresentative( TNode a );
};/* class TheoryDatatypes */
}
}
+bool TheorySetsPrivate::ee_areCareDisequal( Node a, Node b ) {
+ if( d_equalityEngine.isTriggerTerm(a, THEORY_SETS) && d_equalityEngine.isTriggerTerm(b, THEORY_SETS) ){
+ TNode a_shared = d_equalityEngine.getTriggerTermRepresentative(a, THEORY_SETS);
+ TNode b_shared = d_equalityEngine.getTriggerTermRepresentative(b, THEORY_SETS);
+ EqualityStatus eqStatus = d_external.d_valuation.getEqualityStatus(a_shared, b_shared);
+ if( eqStatus==EQUALITY_FALSE_AND_PROPAGATED || eqStatus==EQUALITY_FALSE || eqStatus==EQUALITY_FALSE_IN_MODEL ){
+ return true;
+ }
+ }
+ return false;
+}
+
bool TheorySetsPrivate::isEntailed( Node n, bool polarity ) {
if( n.getKind()==kind::NOT ){
return isEntailed( n[0], !polarity );
break;
}
}
- //TODO: this can be generalized : maintain map to abstract domain ( set -> cardinality )
+ //TODO: this can be generalized : maintain map to abstract domain ( set -> cardinality )
//if a has positive member that is negative member in b
}else if( itpmb!=d_pol_mems[1].end() ){
for( std::map< Node, Node >::iterator itnm = itpmb->second.begin(); itnm != itpmb->second.end(); ++itnm ){
Assert( d_equalityEngine.hasTerm(x) );
Assert( d_equalityEngine.hasTerm(y) );
Assert( !ee_areDisequal( x, y ) );
+ Assert( !ee_areCareDisequal( x, y ) );
if( !d_equalityEngine.areEqual( x, y ) ){
Trace("sets-cg") << "Arg #" << k << " is " << x << " " << y << std::endl;
if( d_equalityEngine.isTriggerTerm(x, THEORY_SETS) && d_equalityEngine.isTriggerTerm(y, THEORY_SETS) ){
TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x, THEORY_SETS);
TNode y_shared = d_equalityEngine.getTriggerTermRepresentative(y, THEORY_SETS);
- Trace("sets-cg") << "Arg #" << k << " shared term is " << x_shared << " " << y_shared << std::endl;
- EqualityStatus eqStatus = d_external.d_valuation.getEqualityStatus(x_shared, y_shared);
- Trace("sets-cg") << "...eq status is " << eqStatus << std::endl;
- if( eqStatus==EQUALITY_FALSE_AND_PROPAGATED || eqStatus==EQUALITY_FALSE || eqStatus==EQUALITY_FALSE_IN_MODEL ){
- //an argument is disequal, we are done
- return;
- }else{
- currentPairs.push_back(make_pair(x_shared, y_shared));
- }
+ currentPairs.push_back(make_pair(x_shared, y_shared));
}else if( isCareArg( f1, k ) && isCareArg( f2, k ) ){
//splitting on sets (necessary for handling set of sets properly)
if( x.getType().isSet() ){
std::map< TNode, quantifiers::TermArgTrie >::iterator it2 = it;
++it2;
for( ; it2 != t1->d_data.end(); ++it2 ){
- if( !ee_areDisequal(it->first, it2->first) ){
- addCarePairs( &it->second, &it2->second, arity, depth+1, n_pairs );
+ if( !d_equalityEngine.areDisequal(it->first, it2->first, false) ){
+ if( !ee_areCareDisequal(it->first, it2->first) ){
+ addCarePairs( &it->second, &it2->second, arity, depth+1, n_pairs );
+ }
}
}
}
//add care pairs based on product of indices, non-disequal arguments
for( std::map< TNode, quantifiers::TermArgTrie >::iterator it = t1->d_data.begin(); it != t1->d_data.end(); ++it ){
for( std::map< TNode, quantifiers::TermArgTrie >::iterator it2 = t2->d_data.begin(); it2 != t2->d_data.end(); ++it2 ){
- if( !ee_areDisequal(it->first, it2->first) ){
- addCarePairs( &it->second, &it2->second, arity, depth+1, n_pairs );
+ if( !d_equalityEngine.areDisequal(it->first, it2->first, false) ){
+ if( !ee_areCareDisequal(it->first, it2->first) ){
+ addCarePairs( &it->second, &it2->second, arity, depth+1, n_pairs );
+ }
}
}
}
private:
bool ee_areEqual( Node a, Node b );
bool ee_areDisequal( Node a, Node b );
+ bool ee_areCareDisequal( Node a, Node b );
NodeIntMap d_members;
std::map< Node, std::vector< Node > > d_members_data;
bool assertFact( Node fact, Node exp );
}
}
+bool TheoryStrings::areCareDisequal( TNode x, TNode y ) {
+ Assert( d_equalityEngine.hasTerm(x) );
+ Assert( d_equalityEngine.hasTerm(y) );
+ if( d_equalityEngine.isTriggerTerm(x, THEORY_STRINGS) && d_equalityEngine.isTriggerTerm(y, THEORY_STRINGS) ){
+ TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x, THEORY_STRINGS);
+ TNode y_shared = d_equalityEngine.getTriggerTermRepresentative(y, THEORY_STRINGS);
+ EqualityStatus eqStatus = d_valuation.getEqualityStatus(x_shared, y_shared);
+ if( eqStatus==EQUALITY_FALSE_AND_PROPAGATED || eqStatus==EQUALITY_FALSE || eqStatus==EQUALITY_FALSE_IN_MODEL ){
+ return true;
+ }
+ }
+ return false;
+}
+
Node TheoryStrings::getLengthExp( Node t, std::vector< Node >& exp, Node te ){
Assert( areEqual( t, te ) );
Node lt = mkLength( te );
Assert( d_equalityEngine.hasTerm(x) );
Assert( d_equalityEngine.hasTerm(y) );
Assert( !d_equalityEngine.areDisequal( x, y, false ) );
+ Assert( !areCareDisequal( x, y ) );
if( !d_equalityEngine.areEqual( x, y ) ){
if( d_equalityEngine.isTriggerTerm(x, THEORY_STRINGS) && d_equalityEngine.isTriggerTerm(y, THEORY_STRINGS) ){
TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x, THEORY_STRINGS);
TNode y_shared = d_equalityEngine.getTriggerTermRepresentative(y, THEORY_STRINGS);
- EqualityStatus eqStatus = d_valuation.getEqualityStatus(x_shared, y_shared);
- if( eqStatus==EQUALITY_FALSE_AND_PROPAGATED || eqStatus==EQUALITY_FALSE || eqStatus==EQUALITY_FALSE_IN_MODEL ){
- //an argument is disequal, we are done
- return;
- }else{
- currentPairs.push_back(make_pair(x_shared, y_shared));
- }
+ currentPairs.push_back(make_pair(x_shared, y_shared));
}
}
}
++it2;
for( ; it2 != t1->d_data.end(); ++it2 ){
if( !d_equalityEngine.areDisequal(it->first, it2->first, false) ){
- addCarePairs( &it->second, &it2->second, arity, depth+1 );
+ if( !areCareDisequal(it->first, it2->first) ){
+ addCarePairs( &it->second, &it2->second, arity, depth+1 );
+ }
}
}
}
for( std::map< TNode, quantifiers::TermArgTrie >::iterator it = t1->d_data.begin(); it != t1->d_data.end(); ++it ){
for( std::map< TNode, quantifiers::TermArgTrie >::iterator it2 = t2->d_data.begin(); it2 != t2->d_data.end(); ++it2 ){
if( !d_equalityEngine.areDisequal(it->first, it2->first, false) ){
- addCarePairs( &it->second, &it2->second, arity, depth+1 );
+ if( !areCareDisequal(it->first, it2->first) ){
+ addCarePairs( &it->second, &it2->second, arity, depth+1 );
+ }
}
}
}
bool hasTerm( Node a );
bool areEqual( Node a, Node b );
bool areDisequal( Node a, Node b );
+ bool areCareDisequal( TNode x, TNode y );
// t is representative, te = t, add lt = te to explanation exp
Node getLengthExp( Node t, std::vector< Node >& exp, Node te );
Node getLength( Node t, std::vector< Node >& exp );
d_equalityEngine.addTriggerTerm(t, THEORY_UF);
}
+bool TheoryUF::areCareDisequal(TNode x, TNode y){
+ Assert( d_equalityEngine.hasTerm(x) );
+ Assert( d_equalityEngine.hasTerm(y) );
+ if( d_equalityEngine.isTriggerTerm(x, THEORY_UF) && d_equalityEngine.isTriggerTerm(y, THEORY_UF) ){
+ TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x, THEORY_UF);
+ TNode y_shared = d_equalityEngine.getTriggerTermRepresentative(y, THEORY_UF);
+ EqualityStatus eqStatus = d_valuation.getEqualityStatus(x_shared, y_shared);
+ if( eqStatus==EQUALITY_FALSE_AND_PROPAGATED || eqStatus==EQUALITY_FALSE || eqStatus==EQUALITY_FALSE_IN_MODEL ){
+ return true;
+ }
+ }
+ return false;
+}
+
//TODO: move quantifiers::TermArgTrie to src/theory/
void TheoryUF::addCarePairs( quantifiers::TermArgTrie * t1, quantifiers::TermArgTrie * t2, unsigned arity, unsigned depth ){
if( depth==arity ){
Assert( d_equalityEngine.hasTerm(x) );
Assert( d_equalityEngine.hasTerm(y) );
Assert( !d_equalityEngine.areDisequal( x, y, false ) );
+ Assert( !areCareDisequal( x, y ) );
if( !d_equalityEngine.areEqual( x, y ) ){
if( d_equalityEngine.isTriggerTerm(x, THEORY_UF) && d_equalityEngine.isTriggerTerm(y, THEORY_UF) ){
TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x, THEORY_UF);
TNode y_shared = d_equalityEngine.getTriggerTermRepresentative(y, THEORY_UF);
- EqualityStatus eqStatus = d_valuation.getEqualityStatus(x_shared, y_shared);
- if( eqStatus==EQUALITY_FALSE_AND_PROPAGATED || eqStatus==EQUALITY_FALSE || eqStatus==EQUALITY_FALSE_IN_MODEL ){
- //an argument is disequal, we are done
- return;
- }else{
- currentPairs.push_back(make_pair(x_shared, y_shared));
- }
+ currentPairs.push_back(make_pair(x_shared, y_shared));
}
}
}
++it2;
for( ; it2 != t1->d_data.end(); ++it2 ){
if( !d_equalityEngine.areDisequal(it->first, it2->first, false) ){
- addCarePairs( &it->second, &it2->second, arity, depth+1 );
+ if( !areCareDisequal(it->first, it2->first) ){
+ addCarePairs( &it->second, &it2->second, arity, depth+1 );
+ }
}
}
}
for( std::map< TNode, quantifiers::TermArgTrie >::iterator it = t1->d_data.begin(); it != t1->d_data.end(); ++it ){
for( std::map< TNode, quantifiers::TermArgTrie >::iterator it2 = t2->d_data.begin(); it2 != t2->d_data.end(); ++it2 ){
if( !d_equalityEngine.areDisequal(it->first, it2->first, false) ){
- addCarePairs( &it->second, &it2->second, arity, depth+1 );
+ if( !areCareDisequal(it->first, it2->first) ){
+ addCarePairs( &it->second, &it2->second, arity, depth+1 );
+ }
}
}
}
return d_thss;
}
private:
+ bool areCareDisequal(TNode x, TNode y);
void addCarePairs( quantifiers::TermArgTrie * t1, quantifiers::TermArgTrie * t2, unsigned arity, unsigned depth );
};/* class TheoryUF */