cvc4-1.4
expr_manager_template.h
Go to the documentation of this file.
1/********************* */
17#include "cvc4_public.h"
18
19#ifndef __CVC4__EXPR_MANAGER_H
20#define __CVC4__EXPR_MANAGER_H
21
22#include <vector>
23
24#include "expr/kind.h"
25#include "expr/type.h"
26#include "expr/expr.h"
27#include "util/subrange_bound.h"
28#include "util/statistics.h"
29#include "util/sexpr.h"
30
31${includes}
32
33// This is a hack, but an important one: if there's an error, the
34// compiler directs the user to the template file instead of the
35// generated one. We don't want the user to modify the generated one,
36// since it'll get overwritten on a later build.
37#line 38 "${template}"
38
39namespace CVC4 {
40
41class Expr;
42class SmtEngine;
43class NodeManager;
44class Options;
45class IntStat;
46struct ExprManagerMapCollection;
47class StatisticsRegistry;
48
49namespace expr {
50 namespace pickle {
51 class Pickler;
52 }/* CVC4::expr::pickle namespace */
53}/* CVC4::expr namespace */
54
55namespace context {
56 class Context;
57}/* CVC4::context namespace */
58
59namespace stats {
60 StatisticsRegistry* getStatisticsRegistry(ExprManager*);
61}/* CVC4::stats namespace */
62
64private:
66 context::Context* d_ctxt;
67
69 NodeManager* d_nodeManager;
70
72 IntStat* d_exprStatisticsVars[LAST_TYPE];
73 IntStat* d_exprStatistics[kind::LAST_KIND];
74
79 NodeManager* getNodeManager() const;
80
85 context::Context* getContext() const;
86
90 void checkResolvedDatatype(DatatypeType dtt) const;
91
96 friend class SmtEngine;
97
99 friend class ExprManagerScope;
100
102 friend class NodeManager;
103
105 friend ::CVC4::StatisticsRegistry* ::CVC4::stats::getStatisticsRegistry(ExprManager*);
106
108 StatisticsRegistry* getStatisticsRegistry() throw();
109
110 // undefined, private copy constructor and assignment op (disallow copy)
112 ExprManager& operator=(const ExprManager&) CVC4_UNDEFINED;
113
114public:
115
119 ExprManager();
120
127 explicit ExprManager(const Options& options);
128
134 ~ExprManager() throw();
135
137 const Options& getOptions() const;
138
140 BooleanType booleanType() const;
141
143 StringType stringType() const;
144
146 RealType realType() const;
147
149 IntegerType integerType() const;
150
157 Expr mkExpr(Kind kind, Expr child1);
158
166 Expr mkExpr(Kind kind, Expr child1, Expr child2);
167
176 Expr mkExpr(Kind kind, Expr child1, Expr child2, Expr child3);
177
187 Expr mkExpr(Kind kind, Expr child1, Expr child2, Expr child3, Expr child4);
188
199 Expr mkExpr(Kind kind, Expr child1, Expr child2, Expr child3, Expr child4,
200 Expr child5);
201
210 Expr mkExpr(Kind kind, const std::vector<Expr>& children);
211
223 Expr mkExpr(Kind kind, Expr child1, const std::vector<Expr>& otherChildren);
224
231 Expr mkExpr(Expr opExpr);
232
240 Expr mkExpr(Expr opExpr, Expr child1);
241
250 Expr mkExpr(Expr opExpr, Expr child1, Expr child2);
251
261 Expr mkExpr(Expr opExpr, Expr child1, Expr child2, Expr child3);
262
273 Expr mkExpr(Expr opExpr, Expr child1, Expr child2, Expr child3, Expr child4);
274
286 Expr mkExpr(Expr opExpr, Expr child1, Expr child2, Expr child3, Expr child4,
287 Expr child5);
288
297 Expr mkExpr(Expr opExpr, const std::vector<Expr>& children);
298
300 template <class T>
301 Expr mkConst(const T&);
302
314 Expr mkAssociative(Kind kind, const std::vector<Expr>& children);
315
320 static bool hasOperator(Kind k);
321
327 Expr operatorOf(Kind k);
328
330 FunctionType mkFunctionType(Type domain, Type range);
331
336 FunctionType mkFunctionType(const std::vector<Type>& argTypes, Type range);
337
344 FunctionType mkFunctionType(const std::vector<Type>& sorts);
345
352 FunctionType mkPredicateType(const std::vector<Type>& sorts);
353
359 TupleType mkTupleType(const std::vector<Type>& types);
360
364 RecordType mkRecordType(const Record& rec);
365
371 SExprType mkSExprType(const std::vector<Type>& types);
372
374 BitVectorType mkBitVectorType(unsigned size) const;
375
377 ArrayType mkArrayType(Type indexType, Type constituentType) const;
378
380 SetType mkSetType(Type elementType) const;
381
383 DatatypeType mkDatatypeType(const Datatype& datatype);
384
389 std::vector<DatatypeType>
390 mkMutualDatatypeTypes(const std::vector<Datatype>& datatypes);
391
421 std::vector<DatatypeType>
422 mkMutualDatatypeTypes(const std::vector<Datatype>& datatypes,
423 const std::set<Type>& unresolvedTypes);
424
428 ConstructorType mkConstructorType(const DatatypeConstructor& constructor, Type range) const;
429
431 SelectorType mkSelectorType(Type domain, Type range) const;
432
434 TesterType mkTesterType(Type domain) const;
435
437 enum {
438 SORT_FLAG_NONE = 0,
439 SORT_FLAG_PLACEHOLDER = 1
440 };/* enum */
441
443 SortType mkSort(const std::string& name, uint32_t flags = SORT_FLAG_NONE) const;
444
446 SortConstructorType mkSortConstructor(const std::string& name,
447 size_t arity) const;
448
455 // not in release 1.0
456 //Type mkPredicateSubtype(Expr lambda)
457 // throw(TypeCheckingException);
458
466 // not in release 1.0
467 //Type mkPredicateSubtype(Expr lambda, Expr witness)
468 // throw(TypeCheckingException);
469
473 Type mkSubrangeType(const SubrangeBounds& bounds)
474 throw(TypeCheckingException);
475
477 Type getType(Expr e, bool check = false)
478 throw(TypeCheckingException);
479
481 enum {
482 VAR_FLAG_NONE = 0,
483 VAR_FLAG_GLOBAL = 1,
484 VAR_FLAG_DEFINED = 2
485 };/* enum */
486
508 Expr mkVar(const std::string& name, Type type, uint32_t flags = VAR_FLAG_NONE);
509
522 Expr mkVar(Type type, uint32_t flags = VAR_FLAG_NONE);
523
541 Expr mkBoundVar(const std::string& name, Type type);
542
556 Expr mkBoundVar(Type type);
557
559 Statistics getStatistics() const throw();
560
562 SExpr getStatistic(const std::string& name) const throw();
563
565 //static Expr exportExpr(const Expr& e, ExprManager* em);
567 static Type exportType(const Type& t, ExprManager* em, ExprManagerMapCollection& vmap);
568
570 static unsigned minArity(Kind kind);
571
573 static unsigned maxArity(Kind kind);
574
575};/* class ExprManager */
576
577${mkConst_instantiations}
578
579}/* CVC4 namespace */
580
581#endif /* __CVC4__EXPR_MANAGER_H */
void * Context
void * Expr
void * Type
void * ExprManager
Macros that should be defined everywhere during the building of the libraries and driver binary,...
#define CVC4_PUBLIC
Definition cvc4_public.h:30
#define CVC4_UNDEFINED
Definition cvc4_public.h:52
CVC4::Statistics Statistics
@ $
marks the upper-bound of this enumeration
StatisticsRegistry * getStatisticsRegistry(ExprManager *)
Definition expr.h:106
@ LAST_TYPE
Definition kind.h:556
STL namespace.
Simple representation of S-expressions.
[[ Add one-line brief description here ]]
Representation of subrange bounds.
Interface for expression types.