}
void Smt2Printer::toStreamCmdDeclareOracleFun(std::ostream& out,
- Node fun,
+ const std::string& id,
+ TypeNode type,
const std::string& binName) const
{
- out << "(declare-oracle-fun " << fun << " ";
- toStreamDeclareType(out, fun.getType());
+ out << "(declare-oracle-fun " << cvc5::internal::quoteSymbol(id) << " ";
+ toStreamDeclareType(out, type);
out << " " << binName << ")" << std::endl;
}
/* class DeclareOracleFunCommand */
/* -------------------------------------------------------------------------- */
-DeclareOracleFunCommand::DeclareOracleFunCommand(Term func)
- : d_func(func), d_binName("")
+DeclareOracleFunCommand::DeclareOracleFunCommand(const std::string& id,
+ Sort sort)
+ : d_id(id), d_sort(sort), d_binName("")
{
}
-DeclareOracleFunCommand::DeclareOracleFunCommand(Term func,
+DeclareOracleFunCommand::DeclareOracleFunCommand(const std::string& id,
+ Sort sort,
const std::string& binName)
- : d_func(func), d_binName(binName)
+ : d_id(id), d_sort(sort), d_binName(binName)
{
}
-Term DeclareOracleFunCommand::getFunction() const { return d_func; }
+const std::string& DeclareOracleFunCommand::getIdentifier() const
+{
+ return d_id;
+}
+
+Sort DeclareOracleFunCommand::getSort() const { return d_sort; }
+
const std::string& DeclareOracleFunCommand::getBinaryName() const
{
return d_binName;
void DeclareOracleFunCommand::invoke(Solver* solver, SymbolManager* sm)
{
- // Notice that the oracle function is already declared by the parser so that
- // the symbol is bound eagerly.
- // mark that it will be printed in the model
- sm->addModelDeclarationTerm(d_func);
+ std::vector<Sort> args;
+ Sort ret;
+ if (d_sort.isFunction())
+ {
+ args = d_sort.getFunctionDomainSorts();
+ ret = d_sort.getFunctionCodomainSort();
+ }
+ else
+ {
+ ret = d_sort;
+ }
+ // will call solver declare oracle function when available in API
d_commandStatus = CommandSuccess::instance();
}
Command* DeclareOracleFunCommand::clone() const
{
- DeclareOracleFunCommand* dfc = new DeclareOracleFunCommand(d_func, d_binName);
+ DeclareOracleFunCommand* dfc =
+ new DeclareOracleFunCommand(d_id, d_sort, d_binName);
return dfc;
}
Language language) const
{
Printer::getPrinter(language)->toStreamCmdDeclareOracleFun(
- out, termToNode(d_func), d_binName);
+ out, d_id, sortToTypeNode(d_sort), d_binName);
}
/* -------------------------------------------------------------------------- */
class CVC5_EXPORT DeclareOracleFunCommand : public Command
{
public:
- DeclareOracleFunCommand(Term func);
- DeclareOracleFunCommand(Term func, const std::string& binName);
- Term getFunction() const;
+ DeclareOracleFunCommand(const std::string& id, Sort sort);
+ DeclareOracleFunCommand(const std::string& id,
+ Sort sort,
+ const std::string& binName);
+ const std::string& getIdentifier() const;
+ Sort getSort() const;
const std::string& getBinaryName() const;
void invoke(Solver* solver, SymbolManager* sm) override;
internal::Language::LANG_AUTO) const override;
protected:
- /** The oracle function */
- Term d_func;
+ /** The identifier */
+ std::string d_id;
+ /** The (possibly function) sort */
+ Sort d_sort;
/** The binary name, or "" if none is provided */
std::string d_binName;
};