本文整理汇总了C++中NodeManager::mkFunctionType方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeManager::mkFunctionType方法的具体用法?C++ NodeManager::mkFunctionType怎么用?C++ NodeManager::mkFunctionType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeManager
的用法示例。
在下文中一共展示了NodeManager::mkFunctionType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: finalizeSignatures
void AbstractionModule::finalizeSignatures() {
NodeManager* nm = NodeManager::currentNM();
Debug("bv-abstraction") << "AbstractionModule::finalizeSignatures num signatures = " << d_signatures.size() <<"\n";
TNodeSet new_signatures;
// "unify" signatures
for (SignatureMap::const_iterator ss = d_signatures.begin(); ss != d_signatures.end(); ++ss) {
for (SignatureMap::const_iterator tt = ss; tt != d_signatures.end(); ++tt) {
TNode t = getGeneralization(tt->first);
TNode s = getGeneralization(ss->first);
if (t != s) {
int status = comparePatterns(s, t);
Assert (status);
if (status < 0)
continue;
if (status == 1) {
storeGeneralization(t, s);
} else {
storeGeneralization(s, t);
}
}
}
}
// keep only most general signatures
for (SignatureMap::iterator it = d_signatures.begin(); it != d_signatures.end(); ) {
TNode sig = it->first;
TNode gen = getGeneralization(sig);
if (sig != gen) {
Assert (d_signatures.find(gen) != d_signatures.end());
// update the count
d_signatures[gen]+= d_signatures[sig];
d_signatures.erase(it++);
} else {
++it;
}
}
// remove signatures that are not frequent enough
for (SignatureMap::iterator it = d_signatures.begin(); it != d_signatures.end(); ) {
if (it->second <= 7) {
d_signatures.erase(it++);
} else {
++it;
}
}
for (SignatureMap::const_iterator it = d_signatures.begin(); it != d_signatures.end(); ++it) {
TNode signature = it->first;
// we already processed this signature
Assert (d_signatureToFunc.find(signature) == d_signatureToFunc.end());
Debug("bv-abstraction") << "Processing signature " << signature << " count " << it->second << "\n";
std::vector<TypeNode> arg_types;
TNodeSet seen;
collectArgumentTypes(signature, arg_types, seen);
Assert (signature.getType().isBoolean());
// make function return a bitvector of size 1
//Node bv_function = utils::mkNode(kind::ITE, signature, utils::mkConst(1, 1u), utils::mkConst(1, 0u));
TypeNode range = NodeManager::currentNM()->mkBitVectorType(1);
TypeNode abs_type = nm->mkFunctionType(arg_types, range);
Node abs_func = nm->mkSkolem("abs_$$", abs_type, "abstraction function for bv theory");
Debug("bv-abstraction") << " abstracted by function " << abs_func << "\n";
// NOTE: signature expression type is BOOLEAN
d_signatureToFunc[signature] = abs_func;
d_funcToSignature[abs_func] = signature;
}
d_statistics.d_numFunctionsAbstracted.setData(d_signatureToFunc.size());
Debug("bv-abstraction") << "AbstractionModule::finalizeSignatures abstracted " << d_signatureToFunc.size() << " signatures. \n";
}