--- /dev/null
+/******************************************************************************
+ * Top contributors (to current version):
+ * Andrew Reynolds
+ *
+ * This file is part of the cvc5 project.
+ *
+ * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
+ * in the top-level source directory and their institutional affiliations.
+ * All rights reserved. See the file COPYING in the top-level source
+ * directory for licensing information.
+ * ****************************************************************************
+ *
+ * Encapsulation of the result of a synthesis query.
+ */
+#include "util/synth_result.h"
+
+#include <sstream>
+#include "base/check.h"
+
+using namespace std;
+
+namespace cvc5 {
+
+SynthResult::SynthResult()
+ : d_status(NONE), d_unknownExplanation(Result::UNKNOWN_REASON)
+{
+}
+
+SynthResult::SynthResult(Status s,
+ Result::UnknownExplanation unknownExplanation)
+ : d_status(s), d_unknownExplanation(unknownExplanation)
+{
+}
+
+SynthResult::Status SynthResult::getStatus() const { return d_status; }
+
+Result::UnknownExplanation SynthResult::getUnknownExplanation() const
+{
+ return d_unknownExplanation;
+}
+
+std::string SynthResult::toString() const
+{
+ std::stringstream ss;
+ ss << "(" << d_status;
+ if (d_unknownExplanation != Result::UNKNOWN_REASON)
+ {
+ ss << " :unknown-explanation " << d_unknownExplanation;
+ }
+ ss << ")";
+ return ss.str();
+}
+
+std::ostream& operator<<(std::ostream& out, const SynthResult& r)
+{
+ out << r.toString();
+ return out;
+}
+
+ostream& operator<<(ostream& out, SynthResult::Status s)
+{
+ switch (s)
+ {
+ case SynthResult::NONE: out << "NONE"; break;
+ case SynthResult::SOLUTION: out << "SOLUTION"; break;
+ case SynthResult::NO_SOLUTION: out << "NO_SOLUTION"; break;
+ case SynthResult::UNKNOWN: out << "UNKNOWN"; break;
+ default: Unhandled() << s;
+ }
+ return out;
+}
+
+} // namespace cvc5
--- /dev/null
+/******************************************************************************
+ * Top contributors (to current version):
+ * Andrew Reynolds
+ *
+ * This file is part of the cvc5 project.
+ *
+ * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
+ * in the top-level source directory and their institutional affiliations.
+ * All rights reserved. See the file COPYING in the top-level source
+ * directory for licensing information.
+ * ****************************************************************************
+ *
+ * Encapsulation of the result of a synthesis query.
+ */
+
+#include "cvc5_public.h"
+
+#ifndef CVC5__EXPR__SYNTH_RESULT_H
+#define CVC5__EXPR__SYNTH_RESULT_H
+
+#include <iosfwd>
+#include <string>
+
+#include "util/result.h"
+
+namespace cvc5 {
+
+/**
+ * A result for a synthesis query. This can be used for synthesis, abduction,
+ * interpolation, and quantifier elimination.
+ */
+class SynthResult
+{
+ public:
+ enum Status
+ {
+ // the status has not been set
+ NONE,
+ // the synthesis query was successful, i.e. there is a solution
+ SOLUTION,
+ // the synthesis query resulted in failure, i.e. there is no solution
+ NO_SOLUTION,
+ // the synthesis query is unknown, i.e. it is not known whether there is a
+ // solution.
+ UNKNOWN
+ };
+
+ public:
+ /** Default constructor */
+ SynthResult();
+ /** Constructor when the solution is not successful */
+ SynthResult(
+ Status s,
+ Result::UnknownExplanation unknownExplanation = Result::UNKNOWN_REASON);
+
+ /** Get the status */
+ Status getStatus() const;
+
+ /** Get the unknown explanation */
+ Result::UnknownExplanation getUnknownExplanation() const;
+
+ /** Get the string representation */
+ std::string toString() const;
+
+ private:
+ /** The status */
+ Status d_status;
+ /** The unknown explanation */
+ Result::UnknownExplanation d_unknownExplanation;
+};
+
+std::ostream& operator<<(std::ostream& out, const SynthResult& r);
+std::ostream& operator<<(std::ostream& out, SynthResult::Status s);
+
+} // namespace cvc5
+
+#endif /* CVC5__RESULT_H */