blob: 32cff93788a4d7be48f81cf114a412d56104d6cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/******************************************************************************
* Top contributors (to current version):
* Andrew Reynolds, Morgan Deters, Tim King
*
* This file is part of the cvc5 project.
*
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
* in the top-level source directory and their institutional affiliations.
* All rights reserved. See the file COPYING in the top-level source
* directory for licensing information.
* ****************************************************************************
*
* Utility for constructing and maintaining abstract values.
*/
#include "cvc5_private.h"
#ifndef CVC5__SMT__ABSTRACT_VALUES_H
#define CVC5__SMT__ABSTRACT_VALUES_H
#include <unordered_map>
#include "context/context.h"
#include "expr/node.h"
#include "theory/substitutions.h"
namespace cvc5 {
namespace smt {
/**
* This utility is responsible for constructing and maintaining abstract
* values, which are used in some responses to e.g. get-value / get-model
* commands. See SMT-LIB standard 2.6 page 65 for details.
*/
class AbstractValues
{
typedef std::unordered_map<Node, Node> NodeToNodeHashMap;
public:
AbstractValues(NodeManager* nm);
~AbstractValues();
/**
* Substitute away all AbstractValues in a node, which replaces all
* abstract values with their original definition. For example, if `@a` was
* introduced for term t, then applying this method on f(`@a`) returns f(t).
*/
Node substituteAbstractValues(TNode n);
/**
* Make a new (or return an existing) abstract value for a node.
* Can only use this if options::abstractValues() is on.
*/
Node mkAbstractValue(TNode n);
private:
/** Pointer to the used node manager */
NodeManager* d_nm;
/**
* A context that never pushes/pops, for use by CD structures (like
* SubstitutionMaps) that should be "global".
*/
context::Context d_fakeContext;
/**
* A map of AbsractValues to their actual constants. Only used if
* options::abstractValues() is on.
*/
theory::SubstitutionMap d_abstractValueMap;
/**
* A mapping of all abstract values (actual value |-> abstract) that
* we've handed out. This is necessary to ensure that we give the
* same AbstractValues for the same real constants. Only used if
* options::abstractValues() is on.
*/
NodeToNodeHashMap d_abstractValues;
};
} // namespace smt
} // namespace cvc5
#endif
|