SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
TheoryTypes.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Common.h"
4 
5 #include <carl-common/util/mpl_utils.h>
6 
7 #include <boost/mpl/vector.hpp>
8 #include <boost/spirit/include/support_unused.hpp>
9 
10 #define PARSER_ENABLE_ARITHMETIC
11 #define PARSER_ENABLE_BITVECTOR
12 #define PARSER_ENABLE_UNINTERPRETED
13 
14 namespace smtrat {
15 namespace parser {
16  namespace mpl = boost::mpl;
17 
18 #ifdef PARSER_ENABLE_ARITHMETIC
19  #define ARITHMETIC(...) __VA_ARGS__
20 #else
21  #define ARITHMETIC(...)
22 #endif
23 #ifdef PARSER_ENABLE_BITVECTOR
24  #define BITVECTOR(...) __VA_ARGS__
25 #else
26  #define BITVECTOR(...)
27 #endif
28 #ifdef PARSER_ENABLE_UNINTERPRETED
29  #define UNINTERPRETED(...) __VA_ARGS__
30 #else
31  #define UNINTERPRETED(...)
32 #endif
33 
34 /**
35  * Represents a constant of a fixed width.
36  */
37 template<typename T>
39  T value;
40  std::size_t width;
42  FixedWidthConstant(const T& value, std::size_t width): value(value), width(width) {}
43  bool operator<(const FixedWidthConstant& fwc) const {
44  return value < fwc.value;
45  }
46 };
47 template<typename T>
48 inline std::ostream& operator<<(std::ostream& os, const FixedWidthConstant<T>& fwc) {
49  return os << fwc.value << "_" << fwc.width;
50 }
51 
52 namespace types {
53  /**
54  * Types of the core theory.
55  */
56  struct CoreTheory {
57  typedef mpl::vector<FormulaT, std::string> ConstTypes;
58  typedef mpl::vector<carl::Variable> VariableTypes;
59  typedef mpl::vector<FormulaT, std::string> ExpressionTypes;
60  typedef mpl::vector<FormulaT, std::string> TermTypes;
62  };
63 #ifdef PARSER_ENABLE_ARITHMETIC
64  /**
65  * Types of the arithmetic theory.
66  */
68  typedef mpl::vector<Rational, FixedWidthConstant<Integer>> ConstTypes;
69  typedef mpl::vector<carl::Variable> VariableTypes;
70  typedef mpl::vector<carl::Variable, Rational, FixedWidthConstant<Integer>, Poly, carl::MultivariateRoot<Poly>> ExpressionTypes;
71  typedef mpl::vector<carl::Variable, Rational, FixedWidthConstant<Integer>, Poly, carl::MultivariateRoot<Poly>> TermTypes;
73  };
74 #endif
75 #ifdef PARSER_ENABLE_BITVECTOR
76  /// Typedef for bitvector term.
79  /// Typedef for bitvector constraint.
81  /**
82  * Types of the theory of bitvectors.
83  */
84  struct BitvectorTheory {
85  typedef mpl::vector<BVVariable, FixedWidthConstant<Integer>, BVTerm> ConstTypes;
86  typedef mpl::vector<BVVariable> VariableTypes;
87  typedef mpl::vector<BVVariable, FixedWidthConstant<Integer>, BVTerm, BVConstraint> ExpressionTypes;
88  typedef mpl::vector<BVVariable, FixedWidthConstant<Integer>, BVTerm, BVConstraint> TermTypes;
90  };
91 #endif
92 #ifdef PARSER_ENABLE_UNINTERPRETED
93  using UTerm = carl::UTerm;
94  /**
95  * Types of the theory of equalities and uninterpreted functions.
96  */
98  typedef mpl::vector<carl::UTerm> ConstTypes;
99  typedef mpl::vector<carl::UVariable> VariableTypes;
100  typedef mpl::vector<carl::UTerm> ExpressionTypes;
101  typedef mpl::vector<carl::UTerm, carl::UVariable> TermTypes;
103  };
104 #endif
105 
106  /**
107  * List of all types of constants.
108  */
109  typedef carl::mpl_concatenate<
115  /**
116  * Variant type for all constants.
117  */
118  typedef carl::mpl_variant_of<ConstTypes>::type ConstType;
119 
120  /**
121  * List of all types of variables.
122  */
123  typedef carl::mpl_concatenate<
129  /**
130  * Variant type for all variables.
131  */
132  typedef carl::mpl_variant_of<VariableTypes>::type VariableType;
133 
134  /**
135  * List of all types of expressions.
136  */
137  typedef carl::mpl_concatenate<
143  /**
144  * Variant type for all expressions.
145  */
146  typedef carl::mpl_variant_of<ExpressionTypes>::type ExpressionType;
147 
148  /**
149  * List of all types of terms.
150  */
151  typedef carl::mpl_concatenate<
157  /**
158  * Variant type for all terms.
159  */
160  typedef carl::mpl_variant_of<TermTypes>::type TermType;
161 
162  /**
163  * List of all types of attributes.
164  */
165  typedef carl::mpl_concatenate<
166  TermTypes,
167  boost::mpl::vector<
169  std::string,
170  bool,
171  boost::spirit::unused_type
172  >
174  /**
175  * Variant type for all attributes.
176  */
177  typedef carl::mpl_variant_of<AttributeTypes>::type AttributeValue;
178 }
179 
180 }
181 }
#define BITVECTOR(...)
Definition: TheoryTypes.h:24
#define ARITHMETIC(...)
Definition: TheoryTypes.h:19
#define UNINTERPRETED(...)
Definition: TheoryTypes.h:29
carl::mpl_concatenate< CoreTheory::ConstTypes, >::type ConstTypes
List of all types of constants.
Definition: TheoryTypes.h:114
carl::BVVariable BVVariable
Definition: TheoryTypes.h:78
carl::mpl_variant_of< AttributeTypes >::type AttributeValue
Variant type for all attributes.
Definition: TheoryTypes.h:177
carl::mpl_variant_of< TermTypes >::type TermType
Variant type for all terms.
Definition: TheoryTypes.h:160
carl::mpl_concatenate< CoreTheory::VariableTypes, >::type VariableTypes
List of all types of variables.
Definition: TheoryTypes.h:128
carl::mpl_variant_of< ConstTypes >::type ConstType
Variant type for all constants.
Definition: TheoryTypes.h:118
carl::mpl_concatenate< TermTypes, boost::mpl::vector< SExpressionSequence< types::ConstType >, std::string, bool, boost::spirit::unused_type > >::type AttributeTypes
List of all types of attributes.
Definition: TheoryTypes.h:173
carl::BVConstraint BVConstraint
Typedef for bitvector constraint.
Definition: TheoryTypes.h:80
carl::mpl_concatenate< CoreTheory::ExpressionTypes, >::type ExpressionTypes
List of all types of expressions.
Definition: TheoryTypes.h:142
carl::BVTerm BVTerm
Typedef for bitvector term.
Definition: TheoryTypes.h:77
carl::mpl_variant_of< VariableTypes >::type VariableType
Variant type for all variables.
Definition: TheoryTypes.h:132
carl::mpl_concatenate< CoreTheory::TermTypes, >::type TermTypes
List of all types of terms.
Definition: TheoryTypes.h:156
carl::mpl_variant_of< ExpressionTypes >::type ExpressionType
Variant type for all expressions.
Definition: TheoryTypes.h:146
std::ostream & operator<<(std::ostream &os, OptimizationType ot)
QuantifierType type(const std::pair< QuantifierType, std::vector< carl::Variable >> &p)
Definition: QEQuery.h:39
Class to create the formulas for axioms.
carl::MultivariatePolynomial< Rational > Poly
Definition: types.h:25
Represents a constant of a fixed width.
Definition: TheoryTypes.h:38
bool operator<(const FixedWidthConstant &fwc) const
Definition: TheoryTypes.h:43
FixedWidthConstant(const T &value, std::size_t width)
Definition: TheoryTypes.h:42
Types of the arithmetic theory.
Definition: TheoryTypes.h:67
mpl::vector< carl::Variable > VariableTypes
Definition: TheoryTypes.h:69
mpl::vector< Rational, FixedWidthConstant< Integer > > ConstTypes
Definition: TheoryTypes.h:68
carl::mpl_variant_of< TermTypes >::type TermType
Definition: TheoryTypes.h:72
mpl::vector< carl::Variable, Rational, FixedWidthConstant< Integer >, Poly, carl::MultivariateRoot< Poly > > TermTypes
Definition: TheoryTypes.h:71
mpl::vector< carl::Variable, Rational, FixedWidthConstant< Integer >, Poly, carl::MultivariateRoot< Poly > > ExpressionTypes
Definition: TheoryTypes.h:70
Types of the theory of bitvectors.
Definition: TheoryTypes.h:84
mpl::vector< BVVariable > VariableTypes
Definition: TheoryTypes.h:86
mpl::vector< BVVariable, FixedWidthConstant< Integer >, BVTerm, BVConstraint > ExpressionTypes
Definition: TheoryTypes.h:87
carl::mpl_variant_of< TermTypes >::type TermType
Definition: TheoryTypes.h:89
mpl::vector< BVVariable, FixedWidthConstant< Integer >, BVTerm > ConstTypes
Definition: TheoryTypes.h:85
mpl::vector< BVVariable, FixedWidthConstant< Integer >, BVTerm, BVConstraint > TermTypes
Definition: TheoryTypes.h:88
Types of the core theory.
Definition: TheoryTypes.h:56
carl::mpl_variant_of< TermTypes >::type TermType
Definition: TheoryTypes.h:61
mpl::vector< FormulaT, std::string > ConstTypes
Definition: TheoryTypes.h:57
mpl::vector< FormulaT, std::string > TermTypes
Definition: TheoryTypes.h:60
mpl::vector< FormulaT, std::string > ExpressionTypes
Definition: TheoryTypes.h:59
mpl::vector< carl::Variable > VariableTypes
Definition: TheoryTypes.h:58
Types of the theory of equalities and uninterpreted functions.
Definition: TheoryTypes.h:97
mpl::vector< carl::UVariable > VariableTypes
Definition: TheoryTypes.h:99
mpl::vector< carl::UTerm > ConstTypes
Definition: TheoryTypes.h:98
carl::mpl_variant_of< TermTypes >::type TermType
Definition: TheoryTypes.h:102
mpl::vector< carl::UTerm, carl::UVariable > TermTypes
Definition: TheoryTypes.h:101
mpl::vector< carl::UTerm > ExpressionTypes
Definition: TheoryTypes.h:100