void Command::invoke(cvc5::Solver* solver, SymbolManager* sm, std::ostream& out)
{
invoke(solver, sm);
- if (!(isMuted() && ok()))
+ if (!ok())
+ {
+ out << *d_commandStatus;
+ }
+ else if (!isMuted())
{
printResult(out);
}
void CheckSatCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else
- {
- Trace("dtview::command") << "* RESULT: " << d_result << std::endl;
- out << d_result << endl;
- }
+ out << d_result << endl;
}
Command* CheckSatCommand::clone() const
void CheckSatAssumingCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else
- {
- out << d_result << endl;
- }
+ out << d_result << endl;
}
Command* CheckSatAssumingCommand::clone() const
cvc5::SynthResult CheckSynthCommand::getResult() const { return d_result; }
void CheckSynthCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else
- {
- out << d_solution.str();
- }
+ out << d_solution.str();
}
Command* CheckSynthCommand::clone() const { return new CheckSynthCommand(); }
cvc5::Term SimplifyCommand::getResult() const { return d_result; }
void SimplifyCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else
- {
- out << d_result << endl;
- }
+ out << d_result << endl;
}
Command* SimplifyCommand::clone() const
cvc5::Term GetValueCommand::getResult() const { return d_result; }
void GetValueCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else
- {
- options::ioutils::Scope scope(out);
- options::ioutils::applyDagThresh(out, 0);
- out << d_result << endl;
- }
+ options::ioutils::Scope scope(out);
+ options::ioutils::applyDagThresh(out, 0);
+ out << d_result << endl;
}
Command* GetValueCommand::clone() const
cvc5::Term GetAssignmentCommand::getResult() const { return d_result; }
void GetAssignmentCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else
- {
- out << d_result << endl;
- }
+ out << d_result << endl;
}
Command* GetAssignmentCommand::clone() const
}
}
-void GetModelCommand::printResult(std::ostream& out) const
-{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else
- {
- out << d_result;
- }
-}
+void GetModelCommand::printResult(std::ostream& out) const { out << d_result; }
Command* GetModelCommand::clone() const
{
}
}
-void GetProofCommand::printResult(std::ostream& out) const
-{
- if (ok())
- {
- out << d_result;
- }
- else
- {
- this->Command::printResult(out);
- }
-}
+void GetProofCommand::printResult(std::ostream& out) const { out << d_result; }
Command* GetProofCommand::clone() const
{
void GetInstantiationsCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else
- {
- out << d_solver->getInstantiations();
- }
+ out << d_solver->getInstantiations();
}
Command* GetInstantiationsCommand::clone() const
void GetInterpolantCommand::printResult(std::ostream& out) const
{
- if (!ok())
+ options::ioutils::Scope scope(out);
+ options::ioutils::applyDagThresh(out, 0);
+ if (!d_result.isNull())
{
- this->Command::printResult(out);
+ out << "(define-fun " << d_name << " () Bool " << d_result << ")"
+ << std::endl;
}
else
{
- options::ioutils::Scope scope(out);
- options::ioutils::applyDagThresh(out, 0);
- if (!d_result.isNull())
- {
- out << "(define-fun " << d_name << " () Bool " << d_result << ")"
- << std::endl;
- }
- else
- {
- out << "fail" << std::endl;
- }
+ out << "fail" << std::endl;
}
}
void GetInterpolantNextCommand::printResult(std::ostream& out) const
{
- if (!ok())
+ options::ioutils::Scope scope(out);
+ options::ioutils::applyDagThresh(out, 0);
+ if (!d_result.isNull())
{
- this->Command::printResult(out);
+ out << "(define-fun " << d_name << " () Bool " << d_result << ")"
+ << std::endl;
}
else
{
- options::ioutils::Scope scope(out);
- options::ioutils::applyDagThresh(out, 0);
- if (!d_result.isNull())
- {
- out << "(define-fun " << d_name << " () Bool " << d_result << ")"
- << std::endl;
- }
- else
- {
- out << "fail" << std::endl;
- }
+ out << "fail" << std::endl;
}
}
void GetAbductCommand::printResult(std::ostream& out) const
{
- if (!ok())
+ options::ioutils::Scope scope(out);
+ options::ioutils::applyDagThresh(out, 0);
+ if (!d_result.isNull())
{
- this->Command::printResult(out);
+ out << "(define-fun " << d_name << " () Bool " << d_result << ")"
+ << std::endl;
}
else
{
- options::ioutils::Scope scope(out);
- options::ioutils::applyDagThresh(out, 0);
- if (!d_result.isNull())
- {
- out << "(define-fun " << d_name << " () Bool " << d_result << ")"
- << std::endl;
- }
- else
- {
- out << "fail" << std::endl;
- }
+ out << "fail" << std::endl;
}
}
void GetAbductNextCommand::printResult(std::ostream& out) const
{
- if (!ok())
+ options::ioutils::Scope scope(out);
+ options::ioutils::applyDagThresh(out, 0);
+ if (!d_result.isNull())
{
- this->Command::printResult(out);
+ out << "(define-fun " << d_name << " () Bool " << d_result << ")"
+ << std::endl;
}
else
{
- options::ioutils::Scope scope(out);
- options::ioutils::applyDagThresh(out, 0);
- if (!d_result.isNull())
- {
- out << "(define-fun " << d_name << " () Bool " << d_result << ")"
- << std::endl;
- }
- else
- {
- out << "fail" << std::endl;
- }
+ out << "fail" << std::endl;
}
}
}
void GetQuantifierEliminationCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else
- {
- out << d_result << endl;
- }
+ out << d_result << endl;
}
Command* GetQuantifierEliminationCommand::clone() const
void GetUnsatAssumptionsCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else
- {
- container_to_stream(out, d_result, "(", ")\n", " ");
- }
+ container_to_stream(out, d_result, "(", ")\n", " ");
}
Command* GetUnsatAssumptionsCommand::clone() const
void GetUnsatCoreCommand::printResult(std::ostream& out) const
{
- if (!ok())
+ if (d_solver->getOption("print-unsat-cores-full") == "true")
{
- this->Command::printResult(out);
+ // use the assertions
+ UnsatCore ucr(termVectorToNodes(d_result));
+ ucr.toStream(out);
}
else
{
- if (d_solver->getOption("print-unsat-cores-full") == "true")
- {
- // use the assertions
- UnsatCore ucr(termVectorToNodes(d_result));
- ucr.toStream(out);
- }
- else
- {
- // otherwise, use the names
- std::vector<std::string> names;
- d_sm->getExpressionNames(d_result, names, true);
- UnsatCore ucr(names);
- ucr.toStream(out);
- }
+ // otherwise, use the names
+ std::vector<std::string> names;
+ d_sm->getExpressionNames(d_result, names, true);
+ UnsatCore ucr(names);
+ ucr.toStream(out);
}
}
void GetDifficultyCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else
+ out << "(" << std::endl;
+ for (const std::pair<const cvc5::Term, cvc5::Term>& d : d_result)
{
- out << "(" << std::endl;
- for (const std::pair<const cvc5::Term, cvc5::Term>& d : d_result)
+ out << "(";
+ // use name if it has one
+ std::string name;
+ if (d_sm->getExpressionName(d.first, name, true))
{
- out << "(";
- // use name if it has one
- std::string name;
- if (d_sm->getExpressionName(d.first, name, true))
- {
- out << name;
- }
- else
- {
- out << d.first;
- }
- out << " " << d.second << ")" << std::endl;
+ out << name;
}
- out << ")" << std::endl;
+ else
+ {
+ out << d.first;
+ }
+ out << " " << d.second << ")" << std::endl;
}
+ out << ")" << std::endl;
}
const std::map<cvc5::Term, cvc5::Term>& GetDifficultyCommand::getDifficultyMap()
void GetLearnedLiteralsCommand::printResult(std::ostream& out) const
{
- if (!ok())
+ out << "(" << std::endl;
+ for (const cvc5::Term& lit : d_result)
{
- this->Command::printResult(out);
- }
- else
- {
- out << "(" << std::endl;
- for (const cvc5::Term& lit : d_result)
- {
- out << lit << std::endl;
- }
- out << ")" << std::endl;
+ out << lit << std::endl;
}
+ out << ")" << std::endl;
}
const std::vector<cvc5::Term>& GetLearnedLiteralsCommand::getLearnedLiterals()
std::string GetAssertionsCommand::getResult() const { return d_result; }
void GetAssertionsCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else
- {
- out << d_result;
- }
+ out << d_result;
}
Command* GetAssertionsCommand::clone() const
std::string GetInfoCommand::getResult() const { return d_result; }
void GetInfoCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else if (d_result != "")
+ if (d_result != "")
{
out << d_result << endl;
}
std::string GetOptionCommand::getResult() const { return d_result; }
void GetOptionCommand::printResult(std::ostream& out) const
{
- if (!ok())
- {
- this->Command::printResult(out);
- }
- else if (d_result != "")
+ if (d_result != "")
{
out << d_result << endl;
}