Trace("ho-quant-trigger") << "addHoTypeMatchPredicateLemmas..." << std::endl;
unsigned numLemmas = 0;
// this forces expansion of APPLY_UF terms to curried HO_APPLY chains
- unsigned size = d_quantEngine->getTermDatabase()->getNumOperators();
- quantifiers::TermUtil* tutil = d_quantEngine->getTermUtil();
+ quantifiers::TermDb* tdb = d_quantEngine->getTermDatabase();
+ unsigned size = tdb->getNumOperators();
NodeManager* nm = NodeManager::currentNM();
for (unsigned j = 0; j < size; j++)
{
- Node f = d_quantEngine->getTermDatabase()->getOperator(j);
+ Node f = tdb->getOperator(j);
if (f.isVar())
{
TypeNode tn = f.getType();
// if a variable of this type occurs in this trigger
if (d_ho_var_types.find(stn) != d_ho_var_types.end())
{
- Node u = tutil->getHoTypeMatchPredicate(tn);
+ Node u = tdb->getHoTypeMatchPredicate(tn);
Node au = nm->mkNode(kind::APPLY_UF, u, f);
if (d_quantEngine->addLemma(au))
{
return d_func_map_trie[f].existsTerm( args );
}
+Node TermDb::getHoTypeMatchPredicate(TypeNode tn)
+{
+ std::map<TypeNode, Node>::iterator ithp = d_ho_type_match_pred.find(tn);
+ if (ithp != d_ho_type_match_pred.end())
+ {
+ return ithp->second;
+ }
+ NodeManager* nm = NodeManager::currentNM();
+ TypeNode ptn = nm->mkFunctionType(tn, nm->booleanType());
+ Node k = nm->mkSkolem("U", ptn, "predicate to force higher-order types");
+ d_ho_type_match_pred[tn] = k;
+ return k;
+}
+
}/* CVC4::theory::quantifiers namespace */
}/* CVC4::theory namespace */
}/* CVC4 namespace */
* Bansal et al., CAV 2015.
*/
bool isInstClosure(Node r);
+ /** get higher-order type match predicate
+ *
+ * This predicate is used to force certain functions f of type tn to appear as
+ * first-class representatives in the quantifier-free UF solver. For a typical
+ * use case, we call getHoTypeMatchPredicate which returns a fresh predicate
+ * P of type (tn -> Bool). Then, we add P( f ) as a lemma.
+ */
+ Node getHoTypeMatchPredicate(TypeNode tn);
private:
/** reference to the quantifiers engine */
/** has map */
std::map< Node, bool > d_has_map;
/** map from reps to a term in eqc in d_has_map */
- std::map< Node, Node > d_term_elig_eqc;
+ std::map<Node, Node> d_term_elig_eqc;
+ /**
+ * Dummy predicate that states terms should be considered first-class members
+ * of equality engine (for higher-order).
+ */
+ std::map<TypeNode, Node> d_ho_type_match_pred;
/** set has term */
void setHasTerm( Node n );
/** helper for evaluate term */
return false;
}
-Node TermUtil::getHoTypeMatchPredicate( TypeNode tn ) {
- std::map< TypeNode, Node >::iterator ithp = d_ho_type_match_pred.find( tn );
- if( ithp==d_ho_type_match_pred.end() ){
- TypeNode ptn = NodeManager::currentNM()->mkFunctionType( tn, NodeManager::currentNM()->booleanType() );
- Node k = NodeManager::currentNM()->mkSkolem( "U", ptn, "predicate to force higher-order types" );
- d_ho_type_match_pred[tn] = k;
- return k;
- }else{
- return ithp->second;
- }
-}
-
-
}/* CVC4::theory::quantifiers namespace */
}/* CVC4::theory namespace */
}/* CVC4 namespace */
* minimum and maximum elements, for example tn is Bool or BitVector.
*/
static Node mkTypeConst(TypeNode tn, bool pol);
-
- // for higher-order
- private:
- /** dummy predicate that states terms should be considered first-class members of equality engine */
- std::map< TypeNode, Node > d_ho_type_match_pred;
-public:
- /** get higher-order type match predicate
- * This predicate is used to force certain functions f of type tn to appear as first-class representatives in the
- * quantifier-free UF solver. For a typical use case, we call getHoTypeMatchPredicate which returns a fresh
- * predicate P of type (tn -> Bool). Then, we add P( f ) as a lemma.
- * TODO: we may eliminate this depending on how github issue #1115 is resolved.
- */
- Node getHoTypeMatchPredicate( TypeNode tn );
};/* class TermUtil */
}/* CVC4::theory::quantifiers namespace */
// add to pending list
apply_uf[rop].push_back(n);
}
- // arguments are also relevant operators FIXME (github issue #1115)
+ // Arguments are also relevant operators.
+ // It might be possible include fewer terms here, see #1115.
for (unsigned k = 0; k < n.getNumChildren(); k++)
{
if (n[k].getType().isFunction())