In preparation for adding declare-oracle-fun to the API/parser.
printUnknownCommand(out, "declare-pool");
}
+void Printer::toStreamCmdDeclareOracleFun(std::ostream& out,
+ Node fun,
+ const std::string& binName) const
+{
+ printUnknownCommand(out, "declare-oracle-fun");
+}
+
void Printer::toStreamCmdDeclareType(std::ostream& out,
TypeNode type) const
{
const std::string& id,
TypeNode type,
const std::vector<Node>& initValue) const;
+ /** Print declare-oracle-fun command */
+ virtual void toStreamCmdDeclareOracleFun(std::ostream& out,
+ Node fun,
+ const std::string& binName) const;
/** Print declare-sort command */
virtual void toStreamCmdDeclareType(std::ostream& out,
out << ')' << std::endl;
}
+void Smt2Printer::toStreamCmdDeclareOracleFun(std::ostream& out,
+ Node fun,
+ const std::string& binName) const
+{
+ out << "(declare-oracle-fun " << fun << " ";
+ toStreamDeclareType(out, fun.getType());
+ out << " " << binName << ")" << std::endl;
+}
+
void Smt2Printer::toStreamCmdDeclarePool(
std::ostream& out,
const std::string& id,
void toStreamCmdDeclareFunction(std::ostream& out,
const std::string& id,
TypeNode type) const override;
+
+ /** Print declare-oracle-fun command */
+ void toStreamCmdDeclareOracleFun(std::ostream& out,
+ Node fun,
+ const std::string& binName) const override;
+
/** Print declare-pool command */
void toStreamCmdDeclarePool(std::ostream& out,
const std::string& id,
}
/* -------------------------------------------------------------------------- */
-/* class DeclareFunctionCommand */
+/* class DeclarePoolCommand */
/* -------------------------------------------------------------------------- */
DeclarePoolCommand::DeclarePoolCommand(const std::string& id,
termVectorToNodes(d_initValue));
}
+/* -------------------------------------------------------------------------- */
+/* class DeclareOracleFunCommand */
+/* -------------------------------------------------------------------------- */
+
+DeclareOracleFunCommand::DeclareOracleFunCommand(Term func)
+ : d_func(func), d_binName("")
+{
+}
+DeclareOracleFunCommand::DeclareOracleFunCommand(Term func,
+ const std::string& binName)
+ : d_func(func), d_binName(binName)
+{
+}
+
+Term DeclareOracleFunCommand::getFunction() const { return d_func; }
+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);
+ d_commandStatus = CommandSuccess::instance();
+}
+
+Command* DeclareOracleFunCommand::clone() const
+{
+ DeclareOracleFunCommand* dfc = new DeclareOracleFunCommand(d_func, d_binName);
+ return dfc;
+}
+
+std::string DeclareOracleFunCommand::getCommandName() const
+{
+ return "declare-oracle-fun";
+}
+
+void DeclareOracleFunCommand::toStream(std::ostream& out,
+ int toDepth,
+ size_t dag,
+ Language language) const
+{
+ Printer::getPrinter(language)->toStreamCmdDeclareOracleFun(
+ out, termToNode(d_func), d_binName);
+}
+
/* -------------------------------------------------------------------------- */
/* class DeclareSortCommand */
/* -------------------------------------------------------------------------- */
internal::Language::LANG_AUTO) const override;
}; /* class DeclarePoolCommand */
+class CVC5_EXPORT DeclareOracleFunCommand : public Command
+{
+ public:
+ DeclareOracleFunCommand(Term func);
+ DeclareOracleFunCommand(Term func, const std::string& binName);
+ Term getFunction() const;
+ const std::string& getBinaryName() const;
+
+ void invoke(Solver* solver, SymbolManager* sm) override;
+ Command* clone() const override;
+ std::string getCommandName() const override;
+ void toStream(std::ostream& out,
+ int toDepth = -1,
+ size_t dag = 1,
+ internal::Language language =
+ internal::Language::LANG_AUTO) const override;
+
+ protected:
+ /** The oracle function */
+ Term d_func;
+ /** The binary name, or "" if none is provided */
+ std::string d_binName;
+};
+
class CVC5_EXPORT DeclareSortCommand : public DeclarationDefinitionCommand
{
protected: