48template <
bool ref_count>
57class TypeCheckingException;
58class TypeCheckingExceptionPrivate;
70struct ExprManagerMapCollection;
72struct ExprHashFunction;
75 class SmtEnginePrivate;
90class CVC4_PUBLIC TypeCheckingException :
public Exception {
92 friend class SmtEngine;
93 friend class smt::SmtEnginePrivate;
102 TypeCheckingException() throw() : Exception() {}
104 const TypeCheckingExceptionPrivate* exc)
throw();
108 TypeCheckingException(
const Expr& expr, std::string message)
throw();
111 TypeCheckingException(
const TypeCheckingException& t)
throw();
114 ~TypeCheckingException() throw();
121 Expr getExpression() const throw();
128 void toStream(
std::ostream& out) const throw();
136class
CVC4_PUBLIC ExportUnsupportedException : public Exception {
138 ExportUnsupportedException() throw():
139 Exception("export unsupported") {
141 ExportUnsupportedException(
const char* msg)
throw():
158struct ExprHashFunction {
169 NodeTemplate<true>* d_node;
234 bool operator<(
const Expr& e)
const;
246 bool operator>(
const Expr& e)
const;
258 bool operator<=(
const Expr& e)
const {
return !(*
this > e); }
270 bool operator>=(
const Expr& e)
const {
return !(*
this < e); }
278 unsigned long getId()
const;
285 Kind getKind()
const;
292 size_t getNumChildren()
const;
300 Expr operator[](
unsigned i)
const;
305 std::vector<Expr> getChildren()
const {
306 return std::vector<Expr>(begin(), end());
312 Expr notExpr()
const;
349 Expr iteExpr(
const Expr& then_e,
const Expr& else_e)
const;
354 class const_iterator :
public std::iterator<std::input_iterator_tag, Expr> {
364 const_iterator(
const const_iterator& it);
365 const_iterator& operator=(
const const_iterator& it);
367 bool operator==(
const const_iterator& it)
const;
368 bool operator!=(
const const_iterator& it)
const {
369 return !(*
this == it);
373 Expr operator*()
const;
379 const_iterator begin()
const;
384 const_iterator end()
const;
391 bool hasOperator()
const;
399 Expr getOperator()
const;
425 Type getType(
bool check =
false)
const throw (TypeCheckingException);
436 const
std::vector<
Expr>& replacements) const;
441 Expr substitute(const
std::hash_map<
Expr,
Expr, ExprHashFunction> map) const;
447 std::
string toString() const;
461 void toStream(
std::ostream& out,
int toDepth = -1,
bool types = false,
size_t dag = 1,
462 OutputLanguage language = language::output::LANG_AUTO) const;
476 bool isVariable() const;
483 bool isConst() const;
501 const T& getConst() const;
513 Expr exportTo(
ExprManager* exprManager, ExprManagerMapCollection& variableMap, uint32_t flags = 0) const;
529 typedef expr::ExprSetDepth setdepth;
544 typedef expr::ExprPrintTypes printtypes;
549 typedef expr::ExprDag dag;
554 typedef expr::ExprSetLanguage setlanguage;
562 void printAst(
std::ostream& out,
int indent = 0) const;
578 NodeTemplate<true> getNode() const throw();
584 NodeTemplate<false> getTNode() const throw();
587 friend class SmtEngine;
588 friend class smt::SmtEnginePrivate;
590 friend class NodeManager;
591 friend class TypeCheckingException;
592 friend class expr::pickle::Pickler;
593 friend class prop::TheoryProxy;
594 friend class expr::ExportPrivate;
595 friend
std::ostream&
CVC4::operator<<(
std::ostream& out, const
Expr& e);
596 template <
bool ref_count> friend class NodeTemplate;
625 static const int s_iosIndex;
631 static const int s_defaultPrintDepth = -1;
642 ExprSetDepth(
long depth) : d_depth(depth) {}
644 inline void applyDepth(std::ostream& out) {
645 out.iword(s_iosIndex) = d_depth;
648 static inline long getDepth(std::ostream& out) {
649 long& l =
out.iword(s_iosIndex);
652 if(&Options::current() != NULL) {
653 l = options::defaultExprDepth();
661 return s_defaultPrintDepth;
667 static inline void setDepth(std::ostream& out,
long depth) {
668 out.iword(s_iosIndex) = depth;
683 inline Scope(std::ostream& out,
long depth) :
685 d_oldDepth(ExprSetDepth::getDepth(
out)) {
686 ExprSetDepth::setDepth(out, depth);
690 ExprSetDepth::setDepth(d_out, d_oldDepth);
710 static const int s_iosIndex;
721 ExprPrintTypes(
bool printTypes) : d_printTypes(printTypes) {}
723 inline void applyPrintTypes(std::ostream& out) {
724 out.iword(s_iosIndex) = d_printTypes;
727 static inline bool getPrintTypes(std::ostream& out) {
728 return out.iword(s_iosIndex);
731 static inline void setPrintTypes(std::ostream& out,
bool printTypes) {
732 out.iword(s_iosIndex) = printTypes;
743 bool d_oldPrintTypes;
747 inline Scope(std::ostream& out,
bool printTypes) :
749 d_oldPrintTypes(ExprPrintTypes::getPrintTypes(
out)) {
750 ExprPrintTypes::setPrintTypes(out, printTypes);
754 ExprPrintTypes::setPrintTypes(d_out, d_oldPrintTypes);
768 static const int s_iosIndex;
774 static const size_t s_defaultDag = 1;
785 explicit ExprDag(
bool dag) : d_dag(dag ? 1 : 0) {}
792 explicit ExprDag(
int dag) : d_dag(dag < 0 ? 0 : dag) {}
794 inline void applyDag(std::ostream& out) {
796 out.iword(s_iosIndex) =
static_cast<long>(d_dag) + 1;
799 static inline size_t getDag(std::ostream& out) {
800 long& l =
out.iword(s_iosIndex);
804 if(&Options::current() != NULL) {
805 l = options::defaultDagThresh() + 1;
813 return s_defaultDag + 1;
816 return static_cast<size_t>(l - 1);
819 static inline void setDag(std::ostream& out,
size_t dag) {
821 out.iword(s_iosIndex) =
static_cast<long>(dag) + 1;
836 inline Scope(std::ostream& out,
size_t dag) :
838 d_oldDag(ExprDag::getDag(
out)) {
839 ExprDag::setDag(out, dag);
843 ExprDag::setDag(d_out, d_oldDag);
857 static const int s_iosIndex;
864 static const int s_defaultOutputLanguage = language::output::LANG_AUTO;
875 ExprSetLanguage(OutputLanguage l) : d_language(l) {}
877 inline void applyLanguage(std::ostream& out) {
879 out.iword(s_iosIndex) = int(d_language) + 1;
883 long& l =
out.iword(s_iosIndex);
887 if(&Options::current() != NULL) {
888 l = options::outputLanguage() + 1;
890 if(l <= 0 || l > language::output::LANG_MAX) {
902 static inline void setLanguage(std::ostream& out, OutputLanguage l) {
904 out.iword(s_iosIndex) = int(l) + 1;
919 inline Scope(std::ostream& out, OutputLanguage language) :
921 d_oldLanguage(ExprSetLanguage::getLanguage(
out)) {
922 ExprSetLanguage::setLanguage(out, language);
926 ExprSetLanguage::setLanguage(d_out, d_oldLanguage);
935${getConst_instantiations}
937#line 938 "${template}"
950inline std::ostream&
operator<<(std::ostream& out, ExprSetDepth sd) {
964inline std::ostream&
operator<<(std::ostream& out, ExprPrintTypes pt) {
965 pt.applyPrintTypes(out);
978inline std::ostream&
operator<<(std::ostream& out, ExprDag d) {
992inline std::ostream&
operator<<(std::ostream& out, ExprSetLanguage l) {
993 l.applyLanguage(out);
999inline size_t ExprHashFunction::operator()(
CVC4::Expr e)
const {
1000 return (
size_t) e.
getId();
Class encapsulating CVC4 expressions and methods for constructing new expressions.
unsigned long getId() const
Get the ID of this expression (used for the comparison operators).
Macros that should be defined everywhere during the building of the libraries and driver binary,...
CVC4's exception base class and some associated utilities.
[[ Add one-line brief description here ]]
Definition of input and output languages.
bool operator!=(const Cardinality &c, CVC3CardinalityKind d)
bool operator==(const Cardinality &c, CVC3CardinalityKind d)
@ $
marks the upper-bound of this enumeration
struct CVC4::options::out__option_t out
TheoryId & operator++(TheoryId &id)
::CVC4::kind::Kind_t Kind
language::output::Language OutputLanguage
std::ostream & operator<<(std::ostream &out, const TypeCheckingException &e)