result.h
Go to the documentation of this file.
/********************* */
#include "cvc4_public.h"
#ifndef __CVC4__RESULT_H
#define __CVC4__RESULT_H
#include <iostream>
#include <string>
#include "util/exception.h"
namespace CVC4 {
class Result;
std::ostream& operator<<(std::ostream& out, const Result& r) CVC4_PUBLIC;
class CVC4_PUBLIC Result {
public:
enum Sat {
UNSAT = 0,
SAT = 1,
SAT_UNKNOWN = 2
};
enum Validity {
INVALID = 0,
VALID = 1,
VALIDITY_UNKNOWN = 2
};
enum Type {
TYPE_SAT,
TYPE_VALIDITY,
TYPE_NONE
};
enum UnknownExplanation {
REQUIRES_FULL_CHECK,
INCOMPLETE,
TIMEOUT,
RESOURCEOUT,
MEMOUT,
INTERRUPTED,
NO_STATUS,
UNSUPPORTED,
OTHER,
UNKNOWN_REASON
};
private:
enum Sat d_sat;
enum Validity d_validity;
enum Type d_which;
enum UnknownExplanation d_unknownExplanation;
std::string d_inputName;
public:
Result() :
d_sat(SAT_UNKNOWN),
d_validity(VALIDITY_UNKNOWN),
d_which(TYPE_NONE),
d_unknownExplanation(UNKNOWN_REASON),
d_inputName("") {
}
Result(enum Sat s, std::string inputName = "") :
d_sat(s),
d_validity(VALIDITY_UNKNOWN),
d_which(TYPE_SAT),
d_unknownExplanation(UNKNOWN_REASON),
d_inputName(inputName) {
CheckArgument(s != SAT_UNKNOWN,
"Must provide a reason for satisfiability being unknown");
}
Result(enum Validity v, std::string inputName = "") :
d_sat(SAT_UNKNOWN),
d_validity(v),
d_which(TYPE_VALIDITY),
d_unknownExplanation(UNKNOWN_REASON),
d_inputName(inputName) {
CheckArgument(v != VALIDITY_UNKNOWN,
"Must provide a reason for validity being unknown");
}
Result(enum Sat s, enum UnknownExplanation unknownExplanation, std::string inputName = "") :
d_sat(s),
d_validity(VALIDITY_UNKNOWN),
d_which(TYPE_SAT),
d_unknownExplanation(unknownExplanation),
d_inputName(inputName) {
CheckArgument(s == SAT_UNKNOWN,
"improper use of unknown-result constructor");
}
Result(enum Validity v, enum UnknownExplanation unknownExplanation, std::string inputName = "") :
d_sat(SAT_UNKNOWN),
d_validity(v),
d_which(TYPE_VALIDITY),
d_unknownExplanation(unknownExplanation),
d_inputName(inputName) {
CheckArgument(v == VALIDITY_UNKNOWN,
"improper use of unknown-result constructor");
}
Result(const std::string& s, std::string inputName = "");
Result(const Result& r, std::string inputName) {
*this = r;
d_inputName = inputName;
}
enum Sat isSat() const {
return d_which == TYPE_SAT ? d_sat : SAT_UNKNOWN;
}
enum Validity isValid() const {
return d_which == TYPE_VALIDITY ? d_validity : VALIDITY_UNKNOWN;
}
bool isUnknown() const {
return isSat() == SAT_UNKNOWN && isValid() == VALIDITY_UNKNOWN;
}
Type getType() const {
return d_which;
}
bool isNull() const {
return d_which == TYPE_NONE;
}
enum UnknownExplanation whyUnknown() const {
CheckArgument( isUnknown(), this,
"This result is not unknown, so the reason for "
"being unknown cannot be inquired of it" );
return d_unknownExplanation;
}
bool operator==(const Result& r) const throw();
inline bool operator!=(const Result& r) const throw();
Result asSatisfiabilityResult() const throw();
Result asValidityResult() const throw();
std::string toString() const;
std::string getInputName() const { return d_inputName; }
};/* class Result */
inline bool Result::operator!=(const Result& r) const throw() {
return !(*this == r);
}
std::ostream& operator<<(std::ostream& out,
enum Result::Sat s) CVC4_PUBLIC;
std::ostream& operator<<(std::ostream& out,
enum Result::Validity v) CVC4_PUBLIC;
std::ostream& operator<<(std::ostream& out,
enum Result::UnknownExplanation e) CVC4_PUBLIC;
bool operator==(enum Result::Sat s, const Result& r) throw() CVC4_PUBLIC;
bool operator==(enum Result::Validity v, const Result& r) throw() CVC4_PUBLIC;
bool operator!=(enum Result::Sat s, const Result& r) throw() CVC4_PUBLIC;
bool operator!=(enum Result::Validity v, const Result& r) throw() CVC4_PUBLIC;
}/* CVC4 namespace */
#endif /* __CVC4__RESULT_H */
CVC4::Result
Three-valued SMT result, with optional explanation.
Definition result.h:36
CVC4::Result::getType
Type getType() const
Definition result.h:136
CVC4::Result::whyUnknown
enum UnknownExplanation whyUnknown() const
Definition result.h:142
CVC4::Result::isNull
bool isNull() const
Definition result.h:139
CVC4::Result::isValid
enum Validity isValid() const
Definition result.h:130
CVC4::Result::Result
Result(enum Sat s, std::string inputName="")
Definition result.h:84
CVC4::Result::isSat
enum Sat isSat() const
Definition result.h:127
CVC4::Result::Type
Type
Definition result.h:50
CVC4::Result::TYPE_SAT
@ TYPE_SAT
Definition result.h:51
CVC4::Result::TYPE_VALIDITY
@ TYPE_VALIDITY
Definition result.h:52
CVC4::Result::asSatisfiabilityResult
Result asSatisfiabilityResult() const
CVC4::Result::operator==
bool operator==(const Result &r) const
CVC4::Result::Result
Result(enum Sat s, enum UnknownExplanation unknownExplanation, std::string inputName="")
Definition result.h:102
CVC4::Result::Validity
Validity
Definition result.h:44
CVC4::Result::Result
Result(const Result &r, std::string inputName)
Definition result.h:122
CVC4::Result::operator!=
bool operator!=(const Result &r) const
Definition result.h:160
CVC4::Result::Result
Result(enum Validity v, std::string inputName="")
Definition result.h:93
CVC4::Result::Result
Result(const std::string &s, std::string inputName="")
CVC4::Result::Result
Result(enum Validity v, enum UnknownExplanation unknownExplanation, std::string inputName="")
Definition result.h:111
CVC4::Result::Sat
Sat
Definition result.h:38
CVC4::Result::UnknownExplanation
UnknownExplanation
Definition result.h:56
CVC4::Result::MEMOUT
@ MEMOUT
Definition result.h:61
CVC4::Result::OTHER
@ OTHER
Definition result.h:65
CVC4::Result::TIMEOUT
@ TIMEOUT
Definition result.h:59
CVC4::Result::INCOMPLETE
@ INCOMPLETE
Definition result.h:58
CVC4::Result::NO_STATUS
@ NO_STATUS
Definition result.h:63
CVC4::Result::UNSUPPORTED
@ UNSUPPORTED
Definition result.h:64
CVC4::Result::REQUIRES_FULL_CHECK
@ REQUIRES_FULL_CHECK
Definition result.h:57
CVC4::Result::INTERRUPTED
@ INTERRUPTED
Definition result.h:62
CVC4::Result::RESOURCEOUT
@ RESOURCEOUT
Definition result.h:60
CVC4::Result::Result
Result()
Definition result.h:77
CVC4::Result::isUnknown
bool isUnknown() const
Definition result.h:133
CVC4::Type
Class encapsulating CVC4 expression types.
Definition type.h:89
cvc4_public.h
Macros that should be defined everywhere during the building of the libraries and driver binary,...
CVC4_PUBLIC
#define CVC4_PUBLIC
Definition cvc4_public.h:30
exception.h
CVC4's exception base class and some associated utilities.
CVC4
Definition expr.h:106
CVC4::operator==
bool operator==(enum Result::Sat s, const Result &r)
CVC4::operator!=
bool operator!=(enum Result::Sat s, const Result &r)
CVC4::operator<<
std::ostream & operator<<(std::ostream &out, const TypeCheckingException &e)
CVC4::CheckArgument
void CheckArgument(bool cond, const T &arg, const char *fmt,...)
Definition exception.h:140
std
STL namespace.