1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Aina Niemetz |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS |
8 |
|
* in the top-level source directory and their institutional affiliations. |
9 |
|
* All rights reserved. See the file COPYING in the top-level source |
10 |
|
* directory for licensing information. |
11 |
|
* **************************************************************************** |
12 |
|
* |
13 |
|
* The base class for everything that nees access to the environment (Env) |
14 |
|
* instance, which gives access to global utilities available to internal code. |
15 |
|
*/ |
16 |
|
|
17 |
|
#include "cvc5_private.h" |
18 |
|
|
19 |
|
#ifndef CVC5__SMT__ENV_OBJ_H |
20 |
|
#define CVC5__SMT__ENV_OBJ_H |
21 |
|
|
22 |
|
#include <memory> |
23 |
|
|
24 |
|
#include "expr/node.h" |
25 |
|
namespace cvc5 { |
26 |
|
|
27 |
|
class Env; |
28 |
|
class LogicInfo; |
29 |
|
class NodeManager; |
30 |
|
class Options; |
31 |
|
class StatisticsRegistry; |
32 |
|
|
33 |
|
namespace context { |
34 |
|
class Context; |
35 |
|
class UserContext; |
36 |
|
} // namespace context |
37 |
|
namespace options { |
38 |
|
enum class OutputTag; |
39 |
|
} |
40 |
|
using OutputTag = options::OutputTag; |
41 |
|
|
42 |
107 |
class EnvObj |
43 |
|
{ |
44 |
|
protected: |
45 |
|
/** Constructor. */ |
46 |
|
EnvObj(Env& env); |
47 |
|
EnvObj() = delete; |
48 |
|
/** Destructor. */ |
49 |
2735201 |
virtual ~EnvObj() {} |
50 |
|
|
51 |
|
/** |
52 |
|
* Rewrite a node. |
53 |
|
* This is a wrapper around theory::Rewriter::rewrite via Env. |
54 |
|
*/ |
55 |
|
Node rewrite(TNode node) const; |
56 |
|
/** |
57 |
|
* Extended rewrite a node. |
58 |
|
* This is a wrapper around theory::Rewriter::extendedRewrite via Env. |
59 |
|
*/ |
60 |
|
Node extendedRewrite(TNode node, bool aggr = true) const; |
61 |
|
/** |
62 |
|
* Evaluate node n under the substitution args -> vals. |
63 |
|
* This is a wrapper about theory::Rewriter::evaluate via Env. |
64 |
|
*/ |
65 |
|
Node evaluate(TNode n, |
66 |
|
const std::vector<Node>& args, |
67 |
|
const std::vector<Node>& vals, |
68 |
|
bool useRewriter = true) const; |
69 |
|
/** Same as above, with a visited cache. */ |
70 |
|
Node evaluate(TNode n, |
71 |
|
const std::vector<Node>& args, |
72 |
|
const std::vector<Node>& vals, |
73 |
|
const std::unordered_map<Node, Node>& visited, |
74 |
|
bool useRewriter = true) const; |
75 |
|
|
76 |
|
/** Get the options object (const version only) via Env. */ |
77 |
|
const Options& options() const; |
78 |
|
|
79 |
|
/** Get a pointer to the Context via Env. */ |
80 |
|
context::Context* context() const; |
81 |
|
|
82 |
|
/** Get a pointer to the UserContext via Env. */ |
83 |
|
context::UserContext* userContext() const; |
84 |
|
|
85 |
|
/** Get the resource manager owned by this Env. */ |
86 |
|
ResourceManager* resourceManager() const; |
87 |
|
|
88 |
|
/** Get the current logic information. */ |
89 |
|
const LogicInfo& logicInfo() const; |
90 |
|
|
91 |
|
/** Get the statistics registry via Env. */ |
92 |
|
StatisticsRegistry& statisticsRegistry() const; |
93 |
|
|
94 |
|
/** Convenience wrapper for Env::isOutputOn(). */ |
95 |
|
bool isOutputOn(OutputTag tag) const; |
96 |
|
|
97 |
|
/** Convenience wrapper for Env::output(). */ |
98 |
|
std::ostream& output(OutputTag tag) const; |
99 |
|
|
100 |
|
/** Convenience wrapper for Env::isVerboseOn(). */ |
101 |
|
bool isVerboseOn(int64_t level) const; |
102 |
|
|
103 |
|
/** Convenience wrapper for Env::verbose(). */ |
104 |
|
std::ostream& verbose(int64_t) const; |
105 |
|
|
106 |
|
/** Convenience wrapper for Env::verbose(0). */ |
107 |
|
std::ostream& warning() const; |
108 |
|
|
109 |
|
/** The associated environment. */ |
110 |
|
Env& d_env; |
111 |
|
}; |
112 |
|
|
113 |
|
} // namespace cvc5 |
114 |
|
#endif |