SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
Expression.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <ostream>
4 #include <boost/variant.hpp>
5 
6 #include "../../Common.h"
7 #include "ExpressionTypes.h"
8 
9 namespace smtrat {
10 namespace expression {
11 
12  class Expression {
13  friend struct std::hash<smtrat::expression::Expression>;
14  friend class ExpressionPool;
15  friend class ExpressionModifier;
16  private:
18 
19  template<typename T>
20  bool isType() const;
21  template<typename T>
22  const T& type() const;
23 
24  explicit Expression(const ExpressionContent* _content): mContent(_content) {}
25 
26  public:
27 
28  explicit Expression(carl::Variable::Arg var);
29  explicit Expression(ITEType _type, Expression&& _if, Expression&& _then, Expression&& _else);
30  explicit Expression(QuantifierType _type, std::vector<carl::Variable>&& _variables, Expression&& _expression);
31  explicit Expression(UnaryType _type, Expression&& _expression);
32  explicit Expression(UnaryType _type, const Expression& _expression): Expression(_type, Expression(_expression)) {}
33  explicit Expression(BinaryType _type, Expression&& _lhs, Expression&& _rhs);
34  explicit Expression(NaryType _type, Expressions&& _expressions);
35  explicit Expression(NaryType _type, const std::initializer_list<Expression>& _expressions);
36 
37  const ExpressionContent& getContent() const {
38  return *mContent;
39  }
41  return mContent;
42  }
43 
45 
46  bool isITE() const;
47  const ITEExpression& getITE() const;
48 
49  bool isQuantifier() const;
51 
52  bool isUnary() const;
53  const UnaryExpression& getUnary() const;
54 
55  bool isBinary() const;
56  const BinaryExpression& getBinary() const;
57 
58  bool is_nary() const;
59  const NaryExpression& getNary() const;
60 
61  bool operator==(const Expression& expr) const;
62  bool operator<(const Expression& expr) const;
63  bool operator!=(const Expression& expr) const;
64  };
65 
66  std::ostream& operator<<(std::ostream& os, const Expression& expr);
67 
68 }
69 }
bool operator==(const Expression &expr) const
bool operator<(const Expression &expr) const
Expression(ITEType _type, Expression &&_if, Expression &&_then, Expression &&_else)
Expression(NaryType _type, Expressions &&_expressions)
bool operator!=(const Expression &expr) const
const ExpressionContent * mContent
Definition: Expression.h:17
const QuantifierExpression & getQuantifier() const
Expression(UnaryType _type, Expression &&_expression)
Expression(BinaryType _type, Expression &&_lhs, Expression &&_rhs)
const UnaryExpression & getUnary() const
Expression(UnaryType _type, const Expression &_expression)
Definition: Expression.h:32
const ExpressionContent * getContentPtr() const
Definition: Expression.h:40
Expression(NaryType _type, const std::initializer_list< Expression > &_expressions)
const BinaryExpression & getBinary() const
const NaryExpression & getNary() const
const ITEExpression & getITE() const
Expression(carl::Variable::Arg var)
const ExpressionContent * getNegationPtr() const
const ExpressionContent & getContent() const
Definition: Expression.h:37
Expression(QuantifierType _type, std::vector< carl::Variable > &&_variables, Expression &&_expression)
int var(Lit p)
Definition: SolverTypes.h:64
static uint32_t hash(uint32_t x)
Definition: Map.h:32
std::ostream & operator<<(std::ostream &os, const Expression &expr)
std::vector< Expression > Expressions
Class to create the formulas for axioms.