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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
/******************************************************************************
* Top contributors (to current version):
* Andrew Reynolds
*
* 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.
* ****************************************************************************
*
* Utilities for term enumeration.
*/
#include "cvc5_private.h"
#ifndef CVC5__THEORY__QUANTIFIERS__TERM_POOLS_H
#define CVC5__THEORY__QUANTIFIERS__TERM_POOLS_H
#include <unordered_set>
#include <vector>
#include "expr/node.h"
#include "theory/quantifiers/quant_util.h"
namespace cvc5 {
namespace theory {
namespace quantifiers {
class QuantifiersState;
/**
* Information concerning a pool variable.
*/
class TermPoolDomain
{
public:
/** initialize, which clears the data below */
void initialize();
/** add node to this pool */
void add(Node n);
/** The list in this pool */
std::vector<Node> d_terms;
/**
* The list of terms on this round. This is cleared at the beginning of an
* instantiation round. The members are unique modulo equality.
*/
std::vector<Node> d_currTerms;
};
/**
* Contains all annotations that pertain to pools for a given quantified
* formula.
*/
class TermPoolQuantInfo
{
public:
/** initialize, which clears the data below */
void initialize();
/** Annotations of kind INST_ADD_TO_POOL */
std::vector<Node> d_instAddToPool;
/** Annotations of kind SKOLEM_ADD_TO_POOL */
std::vector<Node> d_skolemAddToPool;
};
/**
* Term pools, which tracks the values of "pools", which are used for
* pool-based instantiation.
*/
class TermPools : public QuantifiersUtil
{
public:
TermPools(QuantifiersState& qs);
~TermPools() {}
/** reset, which resets the current values of pools */
bool reset(Theory::Effort e) override;
/** Called for new quantifiers, which computes TermPoolQuantInfo above */
void registerQuantifier(Node q) override;
/** Identify this module (for debugging, dynamic configuration, etc..) */
std::string identify() const override;
/** Register pool p with initial value initValue. */
void registerPool(Node p, const std::vector<Node>& initValue);
/** Get terms for pool p, adds them to the vector terms. */
void getTermsForPool(Node p, std::vector<Node>& terms);
/**
* Process instantiation, called at the moment we successfully instantiate
* q with terms. This adds terms to pools based on INST_ADD_TO_POOL
* annotations.
*/
void processInstantiation(Node q, const std::vector<Node>& terms);
/** Same as above, for SKOLEM_ADD_TO_POOL. */
void processSkolemization(Node q, const std::vector<Node>& skolems);
private:
void processInternal(Node q, const std::vector<Node>& ts, bool isInst);
/** reference to the quantifiers state */
QuantifiersState& d_qs;
/** Maps pools to a domain */
std::map<Node, TermPoolDomain> d_pools;
/** Maps quantifiers to info */
std::map<Node, TermPoolQuantInfo> d_qinfo;
};
} // namespace quantifiers
} // namespace theory
} // namespace cvc5
#endif /* CVC5__THEORY__QUANTIFIERS__TERM_POOLS_H */
|