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 |
|
|
26 |
|
namespace cvc5 { |
27 |
|
|
28 |
|
class Env; |
29 |
|
class LogicInfo; |
30 |
|
class NodeManager; |
31 |
|
class Options; |
32 |
|
class StatisticsRegistry; |
33 |
|
|
34 |
|
namespace context { |
35 |
|
class Context; |
36 |
|
class UserContext; |
37 |
|
} // namespace context |
38 |
|
|
39 |
61 |
class EnvObj |
40 |
|
{ |
41 |
|
protected: |
42 |
|
/** Constructor. */ |
43 |
|
EnvObj(Env& env); |
44 |
|
EnvObj() = delete; |
45 |
|
/** Destructor. */ |
46 |
778425 |
virtual ~EnvObj() {} |
47 |
|
|
48 |
|
/** |
49 |
|
* Rewrite a node. |
50 |
|
* This is a wrapper around theory::Rewriter::rewrite via Env. |
51 |
|
*/ |
52 |
|
Node rewrite(TNode node) const; |
53 |
|
/** |
54 |
|
* Extended rewrite a node. |
55 |
|
* This is a wrapper around theory::Rewriter::extendedRewrite via Env. |
56 |
|
*/ |
57 |
|
Node extendedRewrite(TNode node, bool aggr = true) const; |
58 |
|
/** |
59 |
|
* Evaluate node n under the substitution args -> vals. |
60 |
|
* This is a wrapper about theory::Rewriter::evaluate via Env. |
61 |
|
*/ |
62 |
|
Node evaluate(TNode n, |
63 |
|
const std::vector<Node>& args, |
64 |
|
const std::vector<Node>& vals, |
65 |
|
bool useRewriter = true) const; |
66 |
|
/** Same as above, with a visited cache. */ |
67 |
|
Node evaluate(TNode n, |
68 |
|
const std::vector<Node>& args, |
69 |
|
const std::vector<Node>& vals, |
70 |
|
const std::unordered_map<Node, Node>& visited, |
71 |
|
bool useRewriter = true) const; |
72 |
|
|
73 |
|
/** Get the current logic information. */ |
74 |
|
const LogicInfo& logicInfo() 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 statistics registry via Env. */ |
86 |
|
StatisticsRegistry& statisticsRegistry() const; |
87 |
|
|
88 |
|
/** The associated environment. */ |
89 |
|
Env& d_env; |
90 |
|
}; |
91 |
|
|
92 |
|
} // namespace cvc5 |
93 |
|
#endif |