return true;
}
-bool Datatype::isUFinite() const throw(IllegalArgumentException) {
+bool Datatype::isInterpretedFinite() const throw(IllegalArgumentException) {
PrettyCheckArgument(isResolved(), this, "this datatype is not yet resolved");
// we're using some internals, so we have to set up this library context
ExprManagerScope ems(d_self);
self.setAttribute(DatatypeUFiniteComputedAttr(), true);
self.setAttribute(DatatypeUFiniteAttr(), false);
for(const_iterator i = begin(), i_end = end(); i != i_end; ++i) {
- if(! (*i).isUFinite()) {
+ if(! (*i).isInterpretedFinite()) {
return false;
}
}
return true;
}
-bool DatatypeConstructor::isUFinite() const throw(IllegalArgumentException) {
+bool DatatypeConstructor::isInterpretedFinite() const throw(IllegalArgumentException) {
PrettyCheckArgument(isResolved(), this, "this datatype constructor is not yet resolved");
// we're using some internals, so we have to set up this library context
ExprManagerScope ems(d_constructor);
if(self.getAttribute(DatatypeUFiniteComputedAttr())) {
return self.getAttribute(DatatypeUFiniteAttr());
}
- bool success = true;
for(const_iterator i = begin(), i_end = end(); i != i_end; ++i) {
- Type t = (*i).getRangeType();
- if( t.isDatatype() ){
- const Datatype& dt = ((DatatypeType)t).getDatatype();
- if( !dt.isUFinite() ){
- success = false;
- }
- }else if(!t.isSort() && !t.getCardinality().isFinite()) {
- success = false;
- }
- if(!success ){
+ TypeNode t = TypeNode::fromType( (*i).getRangeType() );
+ if(!t.isInterpretedFinite()) {
self.setAttribute(DatatypeUFiniteComputedAttr(), true);
self.setAttribute(DatatypeUFiniteAttr(), false);
return false;
* uninterpreted sorts are finite. This function can
* only be called for resolved constructors.
*/
- bool isUFinite() const throw(IllegalArgumentException);
+ bool isInterpretedFinite() const throw(IllegalArgumentException);
/**
* Returns true iff this Datatype constructor has already been
* datatype is not well-founded, this function returns false. The
* Datatype must be resolved or an exception is thrown.
*/
- bool isUFinite() const throw(IllegalArgumentException);
+ bool isInterpretedFinite() const throw(IllegalArgumentException);
/**
* Return true iff this datatype is well-founded (there exist ground
#include "expr/type_properties.h"
#include "options/base_options.h"
#include "options/expr_options.h"
+#include "options/quantifiers_options.h"
using namespace std;
return kind::getCardinality(*this);
}
+bool TypeNode::isInterpretedFinite() const {
+ if( getCardinality().isFinite() ){
+ return true;
+ }else{
+ if( options::finiteModelFind() ){
+ if( isSort() ){
+ return true;
+ }else if( isDatatype() || isParametricDatatype() ){
+ const Datatype& dt = getDatatype();
+ return dt.isInterpretedFinite();
+ }else if( isArray() ){
+ return getArrayIndexType().isInterpretedFinite() && getArrayConstituentType().isInterpretedFinite();
+ }else if( isSet() ) {
+ return getSetElementType().isInterpretedFinite();
+ }
+ }
+ return false;
+ }
+}
+
bool TypeNode::isWellFounded() const {
return kind::isWellFounded(*this);
}
* @return a finite or infinite cardinality
*/
Cardinality getCardinality() const;
+
+ /**
+ * Is this type interpreted as being finite.
+ * If finite model finding is enabled, this assumes all uninterpreted sorts
+ * are interpreted as finite.
+ */
+ bool isInterpretedFinite() const;
/**
* Returns whether this type is well-founded.
if( !hasLabel( eqc, n ) ){
Trace("datatypes-debug") << "No constructor..." << std::endl;
const Datatype& dt = ((DatatypeType)(tn).toType()).getDatatype();
- Trace("datatypes-debug") << "Datatype " << dt << " is " << dt.isFinite() << " " << dt.isUFinite() << " " << dt.isRecursiveSingleton() << std::endl;
+ Trace("datatypes-debug") << "Datatype " << dt << " is " << dt.isFinite() << " " << dt.isInterpretedFinite() << " " << dt.isRecursiveSingleton() << std::endl;
bool continueProc = true;
if( dt.isRecursiveSingleton() ){
Trace("datatypes-debug") << "Check recursive singleton..." << std::endl;
if( consIndex==-1 ){
consIndex = j;
}
- if( options::finiteModelFind() ? !dt[ j ].isUFinite() : !dt[ j ].isFinite() ) {
+ if( !dt[ j ].isInterpretedFinite() ) {
if( !eqc || !eqc->d_selectors ){
needSplit = false;
}
if( neqc.isNull() ){
for( unsigned i=0; i<pcons.size(); i++ ){
//must try the infinite ones first
- bool cfinite = options::finiteModelFind() ? dt[ i ].isUFinite() : dt[ i ].isFinite();
+ bool cfinite = dt[ i ].isInterpretedFinite();
if( pcons[i] && (r==1)==cfinite ){
neqc = DatatypesRewriter::getInstCons( eqc, dt, i );
//for( unsigned j=0; j<neqc.getNumChildren(); j++ ){
Debug("dt-enum") << "datatype is " << d_type << std::endl;
Debug("dt-enum") << "properties : " << d_datatype.isCodatatype() << " " << d_datatype.isRecursiveSingleton();
Debug("dt-enum") << " " << d_datatype.isFinite() << std::endl;
- Debug("dt-enum") << " " << d_datatype.isUFinite() << std::endl;
+ Debug("dt-enum") << " " << d_datatype.isInterpretedFinite() << std::endl;
if( d_datatype.isCodatatype() && hasCyclesDt( d_datatype ) ){
//start with uninterpreted constant
}
if( d_ctor>=d_has_debruijn+d_datatype.getNumConstructors() ){
//try next size limit as long as new terms were generated at last size, or other cases
- if( prevSize==d_size_limit || ( d_size_limit==0 && d_datatype.isCodatatype() ) || ( options::finiteModelFind() ? !d_datatype.isUFinite() : !d_datatype.isFinite() ) ){
+ if( prevSize==d_size_limit || ( d_size_limit==0 && d_datatype.isCodatatype() ) || !d_datatype.isInterpretedFinite() ){
d_size_limit++;
d_ctor = d_zeroCtor;
for( unsigned i=0; i<d_sel_sum.size(); i++ ){
}else{
int score = -1;
if( options::quantDynamicSplit()==quantifiers::QUANT_DSPLIT_MODE_AGG ){
- score = dt.isUFinite() ? 1 : -1;
+ score = dt.isInterpretedFinite() ? 1 : -1;
}else if( options::quantDynamicSplit()==quantifiers::QUANT_DSPLIT_MODE_DEFAULT ){
- score = dt.isUFinite() ? 1 : -1;
+ score = dt.isInterpretedFinite() ? 1 : -1;
}
- Trace("quant-dsplit-debug") << "Datatype " << dt.getName() << " is score " << score << " (" << dt.isUFinite() << " " << dt.isFinite() << ")" << std::endl;
+ Trace("quant-dsplit-debug") << "Datatype " << dt.getName() << " is score " << score << " (" << dt.isInterpretedFinite() << " " << dt.isFinite() << ")" << std::endl;
if( score>max_score ){
max_index = i;
max_score = score;
TypeNode type = current.getType();
typeTheoryId = Theory::theoryOf(type);
if (typeTheoryId != currentTheoryId) {
- if (options::finiteModelFind() && type.isSort()) {
- // We're looking for finite models
+ if (type.isInterpretedFinite()) {
useType = true;
- } else {
- Cardinality card = type.getCardinality();
- if (card.isFinite()) {
- useType = true;
- }
}
}
}
TypeNode type = current.getType();
typeTheoryId = Theory::theoryOf(type);
if (typeTheoryId != currentTheoryId) {
- if (options::finiteModelFind() && type.isSort()) {
- // We're looking for finite models
+ if (type.isInterpretedFinite()) {
useType = true;
- } else {
- Cardinality card = type.getCardinality();
- if (card.isFinite()) {
- useType = true;
- }
}
}
}
TypeNode type = current.getType();
typeTheoryId = Theory::theoryOf(type);
if (typeTheoryId != currentTheoryId) {
- if (options::finiteModelFind() && type.isSort()) {
- // We're looking for finite models
+ if (type.isInterpretedFinite()) {
useType = true;
- } else {
- Cardinality card = type.getCardinality();
- if (card.isFinite()) {
- useType = true;
- }
}
}
}
TypeNode type = current.getType();
typeTheoryId = Theory::theoryOf(type);
if (typeTheoryId != currentTheoryId) {
- if (options::finiteModelFind() && type.isSort()) {
- // We're looking for finite models
+ if (type.isInterpretedFinite()) {
useType = true;
- } else {
- Cardinality card = type.getCardinality();
- if (card.isFinite()) {
- useType = true;
- }
}
}
}
TypeNode type = current.getType();
typeTheoryId = Theory::theoryOf(type);
if (typeTheoryId != currentTheoryId) {
- if (options::finiteModelFind() && type.isSort()) {
- // We're looking for finite models
+ if (type.isInterpretedFinite()) {
useType = true;
- } else {
- Cardinality card = type.getCardinality();
- if (card.isFinite()) {
- useType = true;
- }
}
}
}
Assert(!t.isBoolean() || (*i2).getKind() == kind::APPLY_UF);
Node n;
if (t.getCardinality().isInfinite()) {
+ // if (!t.isInterpretedFinite()) {
bool success;
do{
Trace("model-builder-debug") << "Enumerate term of type " << t << std::endl;
datatypes-ufinite-nested.smt2 \
ForElimination-scala-9.smt2 \
agree466.smt2 \
- LeftistHeap.scala-8-ncm.smt2
+ LeftistHeap.scala-8-ncm.smt2 \
+ sc-crash-052316.smt2
EXTRA_DIST = $(TESTS)
--- /dev/null
+; COMMAND-LINE: --finite-model-find
+; EXPECT: unsat
+ (set-logic ALL_SUPPORTED)
+ (set-info :status unsat)
+ (declare-sort g_ 0)
+ (declare-fun __nun_card_witness_0_ () g_)
+ (declare-sort f_ 0)
+ (declare-fun __nun_card_witness_1_ () f_)
+ (declare-sort e_ 0)
+ (declare-fun __nun_card_witness_2_ () e_)
+(declare-datatypes ()
+ ((prod1_ (Pair1_ (_select_Pair1__0 e_) (_select_Pair1__1 f_)))))
+ (declare-sort d_ 0)
+ (declare-fun __nun_card_witness_3_ () d_)
+ (declare-sort c_ 0)
+ (declare-fun __nun_card_witness_4_ () c_)
+ (declare-sort b_ 0)
+ (declare-fun __nun_card_witness_5_ () b_)
+ (declare-sort a_ 0)
+ (declare-fun __nun_card_witness_6_ () a_)
+(declare-datatypes ()
+ ((prod_ (Pair_ (_select_Pair__0 a_) (_select_Pair__1 b_)))))
+ (declare-fun f1_ (prod_ c_ d_ prod1_) g_)
+ (declare-fun g1_ (prod_) c_)
+ (declare-fun h_ (prod_ d_) prod1_)
+ (declare-fun nun_sk_0_ () prod_)
+(declare-fun nun_sk_1_ (c_) d_)
+ (assert
+ (not
+ (exists ((v/72 c_))
+ (exists ((x/73 prod1_))
+ (= (f1_ nun_sk_0_ v/72 (nun_sk_1_ v/72) x/73)
+ (f1_ nun_sk_0_ (g1_ nun_sk_0_) (nun_sk_1_ v/72)
+ (h_ nun_sk_0_ (nun_sk_1_ v/72))))))))
+(check-sat)