//[4] resort to using value in model
// do so if we are in effort=1, or if the variable is boolean, or if we are solving for a subfield of a datatype
- if( ( effort>0 || pvtn.isBoolean() || !curr_var.empty() ) && !pvtn.isSort() ){
+ if( ( effort>0 || pvtn.isBoolean() || !curr_var.empty() ) && d_qe->getTermDatabase()->isClosedEnumerableType( pvtn ) ){
Node mv = getModelValue( pv );
Node pv_coeff_m;
Trace("cbqi-inst-debug") << "[4] " << i << "...try model value " << mv << std::endl;
bool CegInstantiator::check() {
if( d_qe->getTheoryEngine()->needCheck() ){
- Trace("cegqi-engine") << " CEGQI instantiator : wait until all ground theories are finished." << std::endl;
+ Trace("cbqi-engine") << " CEGQI instantiator : wait until all ground theories are finished." << std::endl;
return false;
}
processAssertions();
return true;
}
}
- Trace("cegqi-engine") << " WARNING : unable to find CEGQI single invocation instantiation." << std::endl;
+ Trace("cbqi-engine") << " WARNING : unable to find CEGQI single invocation instantiation." << std::endl;
return false;
}
void InstStrategyCbqi::reset_round( Theory::Effort effort ) {
d_cbqi_set_quant_inactive = false;
+ d_incomplete_check = false;
//check if any cbqi lemma has not been added yet
for( int i=0; i<d_quantEngine->getModel()->getNumAssertedQuantifiers(); i++ ){
Node q = d_quantEngine->getModel()->getAssertedQuantifier( i );
}
bool InstStrategyCbqi::checkComplete() {
- if( !options::cbqiSat() && d_cbqi_set_quant_inactive ){
+ if( ( !options::cbqiSat() && d_cbqi_set_quant_inactive ) || d_incomplete_check ){
return false;
}else{
return true;
CegInstantiator * cinst = getInstantiator( f );
Trace("inst-alg") << "-> Run cegqi for " << f << std::endl;
d_curr_quant = f;
- cinst->check();
+ if( !cinst->check() ){
+ d_incomplete_check = true;
+ }
d_curr_quant = Node::null();
}else if( e==1 ){
//minimize the free delta heuristically on demand
typedef context::CDHashSet<Node, NodeHashFunction> NodeSet;
protected:
bool d_cbqi_set_quant_inactive;
+ bool d_incomplete_check;
/** whether we have added cbqi lemma */
NodeSet d_added_cbqi_lemma;
/** whether to do cbqi for this quantified formula */
- std::map< Node, bool > d_do_cbqi;
+ std::map< Node, bool > d_do_cbqi;
/** register ce lemma */
virtual void registerCounterexampleLemma( Node q, Node lem );
/** has added cbqi lemma */
void registerCounterexampleLemma( Node q, Node lem );
public:
InstStrategyCegqi( QuantifiersEngine * qe );
- ~InstStrategyCegqi() throw();
+ ~InstStrategyCegqi() throw();
bool addInstantiation( std::vector< Node >& subs );
bool isEligibleForInstantiation( Node n );
return getRemoveQuantifiers2( n, visited );
}
-//quantified simplify
+//quantified simplify
Node TermDb::getQuantSimplify( Node n ) {
std::vector< Node > bvs;
getBoundVars( n, bvs );
bool TermDb::isClosedEnumerableType( TypeNode tn ) {
std::map< TypeNode, bool >::iterator it = d_typ_closed_enum.find( tn );
if( it==d_typ_closed_enum.end() ){
+ d_typ_closed_enum[tn] = false;
bool ret = true;
if( tn.isArray() || tn.isSort() || tn.isCodatatype() ){
ret = false;
+ }else if( tn.isSet() ){
+ ret = isClosedEnumerableType( tn.getSetElementType() );
+ }else if( datatypes::DatatypesRewriter::isTypeDatatype(tn) ){
+ const Datatype& dt = ((DatatypeType)(tn).toType()).getDatatype();
+ for( unsigned i=0; i<dt.getNumConstructors(); i++ ){
+ for( unsigned j=0; j<dt[i].getNumArgs(); j++ ){
+ TypeNode ctn = TypeNode::fromType( ((SelectorType)dt[i][j].getSelector().getType()).getRangeType() );
+ if( tn!=ctn && !isClosedEnumerableType( ctn ) ){
+ ret = false;
+ break;
+ }
+ }
+ if( !ret ){
+ break;
+ }
+ }
}else{
- //TODO: all subfields must be closed enumerable?
+ //TODO: all subfields must be closed enumerable
}
d_typ_closed_enum[tn] = ret;
return ret;
--- /dev/null
+; cvc4 --lang smt\r
+\r
+; This problem returns "unsat", but it is in fact "sat", by interpreting "a" with a domain of\r
+; cardinality 1. The issue arises irrespective of the "--finite-model-find" option.\r
+\r
+(set-option :produce-models true)\r
+(set-option :interactive-mode true)\r
+(set-logic ALL_SUPPORTED)\r
+(declare-sort a 0)\r
+(declare-datatypes () ((w (Wrap (unw a)))))\r
+(declare-fun x () w)\r
+(assert (forall ((y w)) (= x y)))\r
+(check-sat)\r