std::stringstream ss;
options::ioutils::applyOutputLang(ss, Language::LANG_SMTLIB_V2_6);
tn.toStream(ss);
- if (tn.isUninterpretedSort() || (tn.isDatatype() && !tn.isTuple()))
+ if (tn.isUninterpretedSortConstructor())
{
- std::stringstream sss;
- sss << LfscNodeConverter::getNameForUserName(ss.str());
- tnn = getSymbolInternal(k, d_sortType, sss.str(), false);
- cur = nm->mkSort(sss.str());
+ std::string s = getNameForUserNameOfInternal(tn.getId(), ss.str());
+ tnn = getSymbolInternal(k, d_sortType, s, false);
+ cur =
+ nm->mkSortConstructor(s, tn.getUninterpretedSortConstructorArity());
+ }
+ else if (tn.isUninterpretedSort() || (tn.isDatatype() && !tn.isTuple()))
+ {
+ std::string s = getNameForUserNameOfInternal(tn.getId(), ss.str());
+ tnn = getSymbolInternal(k, d_sortType, s, false);
+ cur = nm->mkSort(s);
}
else
{
d_declTypes.insert(tn.getUninterpretedSortConstructor());
TypeNode ftype = nm->mkFunctionType(types, d_sortType);
std::string name;
- tn.getAttribute(expr::VarNameAttr(), name);
+ tn.getUninterpretedSortConstructor().getAttribute(expr::VarNameAttr(),
+ name);
op = getSymbolInternal(k, ftype, name, false);
}
else
{
std::string name;
v.getAttribute(expr::VarNameAttr(), name);
- std::vector<Node>& syms = d_userSymbolList[name];
+ return getNameForUserNameOfInternal(v.getId(), name);
+}
+
+std::string LfscNodeConverter::getNameForUserNameOfInternal(
+ uint64_t id, const std::string& name)
+{
+ std::vector<uint64_t>& syms = d_userSymbolList[name];
size_t variant = 0;
- std::vector<Node>::iterator itr = std::find(syms.begin(), syms.end(), v);
+ std::vector<uint64_t>::iterator itr =
+ std::find(syms.begin(), syms.end(), id);
if (itr != syms.cend())
{
variant = std::distance(syms.begin(), itr);
else
{
variant = syms.size();
- syms.push_back(v);
+ syms.push_back(id);
}
return getNameForUserName(name, variant);
}
const std::unordered_set<TypeNode>& getDeclaredTypes() const;
private:
+ /** get name for a Node/TypeNode whose id is id and whose name is name */
+ std::string getNameForUserNameOfInternal(uint64_t id,
+ const std::string& name);
/** Should we traverse n? */
bool shouldTraverse(Node n) override;
/**
std::unordered_set<Node> d_symbols;
/**
* Mapping from user symbols to the (list of) symbols with that name. This
- * is used to resolve symbol overloading, which is forbidden in LFSC.
+ * is used to resolve symbol overloading, which is forbidden in LFSC. We use
+ * Node identifiers, since this map is used for both Node and TypeNode.
*/
- std::map<std::string, std::vector<Node> > d_userSymbolList;
+ std::map<std::string, std::vector<uint64_t> > d_userSymbolList;
/** symbols to builtin kinds*/
std::map<Node, Kind> d_symbolToBuiltinKind;
/** arrow type constructor */