TypeNode tn = n.getType();
if( DatatypesRewriter::isTypeDatatype( tn ) ){
Trace("datatypes-debug") << "Process equivalence class " << n << std::endl;
- EqcInfo* eqc = getOrMakeEqcInfo( n, true );
+ EqcInfo* eqc = getOrMakeEqcInfo( n );
//if there are more than 1 possible constructors for eqc
- if( eqc->d_constructor.get().isNull() && !hasLabel( eqc, n ) ) {
+ if( !hasLabel( eqc, n ) ){
Trace("datatypes-debug") << "No constructor..." << std::endl;
const Datatype& dt = ((DatatypeType)(tn).toType()).getDatatype();
if( consIndex==-1 ){
consIndex = j;
}
- if( !dt[ j ].isFinite() && !eqc->d_selectors ) {
+ if( !dt[ j ].isFinite() && ( !eqc || !eqc->d_selectors ) ) {
needSplit = false;
}
}
}
bool TheoryDatatypes::hasLabel( EqcInfo* eqc, Node n ){
- return !eqc->d_constructor.get().isNull() || !getLabel( n ).isNull();
+ return ( eqc && !eqc->d_constructor.get().isNull() ) || !getLabel( n ).isNull();
}
Node TheoryDatatypes::getLabel( Node n ) {
}
int TheoryDatatypes::getLabelIndex( EqcInfo* eqc, Node n ){
- if( !eqc->d_constructor.get().isNull() ){
+ if( eqc && !eqc->d_constructor.get().isNull() ){
return Datatype::indexOf( eqc->d_constructor.get().getOperator().toExpr() );
}else{
return Datatype::indexOf( getLabel( n ).getOperator().toExpr() );
TNode x = f1[k];
TNode y = f2[k];
Assert(d_equalityEngine.hasTerm(x));
- Assert(d_equalityEngine.hasTerm(y));
+ Assert(d_equalityEngine.hasTerm(y));
if( areDisequal(x, y) ){
somePairIsDisequal = true;
break;
cons.push_back( c );
eqc_cons[ eqc ] = c;
}else{
- //if eqc contains a symbol known to datatypes (a selector), then we must assign
+ //if eqc contains a symbol known to datatypes (a selector), then we must assign
bool containsTSym = false;
eq::EqClassIterator eqc_i = eq::EqClassIterator( eqc, &d_equalityEngine );
while( !eqc_i.isFinished() ){
addLemma = true;
}
}
-
+
if( !addLemma ){
TypeNode tn = n[0].getType();
if( !DatatypesRewriter::isTypeDatatype( tn ) ){
//add terms to model
eq::EqClassIterator eqc_i = eq::EqClassIterator( eqc, &d_equalityEngine );
while( !eqc_i.isFinished() ){
- Trace( c ) << (*eqc_i) << " ";
+ if( (*eqc_i)!=eqc ){
+ Trace( c ) << (*eqc_i) << " ";
+ }
++eqc_i;
}
Trace( c ) << "}" << std::endl;
Node curr;
for( int i=(d_models[op]->d_cond.size()-1); i>=0; i--) {
Node v = d_models[op]->d_value[i];
+ Trace("fmc-model-func") << "Value is : " << v << std::endl;
if( !hasTerm( v ) ){
//can happen when the model basis term does not exist in ground assignment
TypeNode tn = v.getType();
- if( d_rep_set.d_type_reps.find( tn )!=d_rep_set.d_type_reps.end() && !d_rep_set.d_type_reps[ tn ].empty() ){
- //see full_model_check.cpp line 366
- v = d_rep_set.d_type_reps[tn][ d_rep_set.d_type_reps[tn].size()-1 ];
- }else{
- Assert( false );
+ //check if it is a constant introduced as a representative not existing in the model's equality engine
+ if( !d_rep_set.hasRep( tn, v ) ){
+ if( d_rep_set.d_type_reps.find( tn )!=d_rep_set.d_type_reps.end() && !d_rep_set.d_type_reps[ tn ].empty() ){
+ //see full_model_check.cpp line 366
+ v = d_rep_set.d_type_reps[tn][ d_rep_set.d_type_reps[tn].size()-1 ];
+ }else{
+ Assert( false );
+ }
+ Trace("fmc-model-func") << "No term, assign " << v << std::endl;
}
}
v = getRepresentative( v );
if( curr.isNull() ){
+ Trace("fmc-model-func") << "base : " << v << std::endl;
curr = v;
}else{
//make the condition
}
Assert( !children.empty() );
Node cc = children.size()==1 ? children[0] : NodeManager::currentNM()->mkNode( AND, children );
+
+ Trace("fmc-model-func") << "condition : " << cc << ", value : " << v << std::endl;
curr = NodeManager::currentNM()->mkNode( ITE, cc, v, curr );
}
}
d_tmap.clear();
}
+bool RepSet::hasRep( TypeNode tn, Node n ) {
+ std::map< TypeNode, std::vector< Node > >::iterator it = d_type_reps.find( tn );
+ if( it==d_type_reps.end() ){
+ return false;
+ }else{
+ return std::find( it->second.begin(), it->second.end(), n )!=it->second.end();
+ }
+}
+
int RepSet::getNumRepresentatives( TypeNode tn ) const{
std::map< TypeNode, std::vector< Node > >::const_iterator it = d_type_reps.find( tn );
if( it!=d_type_reps.end() ){
void clear();
/** has type */
bool hasType( TypeNode tn ) const { return d_type_reps.find( tn )!=d_type_reps.end(); }
+ /** has rep */
+ bool hasRep( TypeNode tn, Node n );
/** get cardinality for type */
int getNumRepresentatives( TypeNode tn ) const;
/** add representative for type */
if (n.getNumChildren() > 0 &&
n.getKind() != kind::BITVECTOR_ACKERMANIZE_UDIV &&
n.getKind() != kind::BITVECTOR_ACKERMANIZE_UREM) {
+ Debug("model-getvalue-debug") << "Get model value children " << n << std::endl;
std::vector<Node> children;
if (n.getKind() == APPLY_UF) {
Node op = getModelValue(n.getOperator(), hasBoundVars);
+ Debug("model-getvalue-debug") << " operator : " << op << std::endl;
children.push_back(op);
}
else if (n.getMetaKind() == kind::metakind::PARAMETERIZED) {
//evaluate the children
for (unsigned i = 0; i < n.getNumChildren(); ++i) {
ret = getModelValue(n[i], hasBoundVars);
+ Debug("model-getvalue-debug") << " " << n << "[" << i << "] is " << ret << std::endl;
children.push_back(ret);
}
ret = Rewriter::rewrite(NodeManager::currentNM()->mkNode(n.getKind(), children));