Simplifies synth-fun printing to assume that the function-to-synthesize should be printed with the proper name and return type.
}
void Printer::toStreamCmdSynthFun(std::ostream& out,
- const std::string& sym,
+ Node f,
const std::vector<Node>& vars,
- TypeNode range,
bool isInv,
TypeNode sygusType) const
{
/** Print synth-fun command */
virtual void toStreamCmdSynthFun(std::ostream& out,
- const std::string& sym,
+ Node f,
const std::vector<Node>& vars,
- TypeNode range,
bool isInv,
TypeNode sygusType = TypeNode::null()) const;
}
void Smt2Printer::toStreamCmdSynthFun(std::ostream& out,
- const std::string& sym,
+ Node f,
const std::vector<Node>& vars,
- TypeNode range,
bool isInv,
TypeNode sygusType) const
{
- out << '(' << (isInv ? "synth-inv " : "synth-fun ") << CVC4::quoteSymbol(sym)
- << ' ';
+ std::stringstream sym;
+ sym << f;
+ out << '(' << (isInv ? "synth-inv " : "synth-fun ")
+ << CVC4::quoteSymbol(sym.str()) << ' ';
out << '(';
if (!vars.empty())
{
// if not invariant-to-synthesize, print return type
if (!isInv)
{
+ TypeNode ftn = f.getType();
+ TypeNode range = ftn.isFunction() ? ftn.getRangeType() : ftn;
out << ' ' << range;
}
out << '\n';
TypeNode type) const override;
/** Print synth-fun command */
- void toStreamCmdSynthFun(
- std::ostream& out,
- const std::string& sym,
- const std::vector<Node>& vars,
- TypeNode range,
- bool isInv,
- TypeNode sygusType = TypeNode::null()) const override;
+ void toStreamCmdSynthFun(std::ostream& out,
+ Node f,
+ const std::vector<Node>& vars,
+ bool isInv,
+ TypeNode sygusType = TypeNode::null()) const override;
/** Print constraint command */
void toStreamCmdConstraint(std::ostream& out, Node n) const override;
std::vector<Node> nodeVars = termVectorToNodes(d_vars);
Printer::getPrinter(language)->toStreamCmdSynthFun(
out,
- d_symbol,
+ d_fun.getNode(),
nodeVars,
- d_sort.getTypeNode(),
d_isInv,
d_grammar == nullptr ? TypeNode::null()
: d_grammar->resolve().getTypeNode());
if (Dump.isOn("raw-benchmark"))
{
getOutputManager().getPrinter().toStreamCmdDeclareVar(
- getOutputManager().getDumpOut(), var, type);
+ getOutputManager().getDumpOut(), var, var.getType());
}
// don't need to set that the conjecture is stale
}
if (Dump.isOn("raw-benchmark"))
{
getOutputManager().getPrinter().toStreamCmdSynthFun(
- getOutputManager().getDumpOut(),
- id,
- vars,
- func.getType().isFunction() ? func.getType().getRangeType()
- : func.getType(),
- isInv,
- sygusType);
+ getOutputManager().getDumpOut(), func, vars, isInv, sygusType);
}
}