1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds |
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 |
|
* Pool-based instantiation strategy |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_private.h" |
17 |
|
|
18 |
|
#ifndef CVC5__THEORY__QUANTIFIERS__INST_STRATEGY_POOL_H |
19 |
|
#define CVC5__THEORY__QUANTIFIERS__INST_STRATEGY_POOL_H |
20 |
|
|
21 |
|
#include "smt/env_obj.h" |
22 |
|
#include "theory/quantifiers/quant_module.h" |
23 |
|
|
24 |
|
namespace cvc5 { |
25 |
|
namespace theory { |
26 |
|
namespace quantifiers { |
27 |
|
|
28 |
|
/** |
29 |
|
* Pool-based instantiation. This implements a strategy for instantiating |
30 |
|
* quantifiers based on user-provided pool annotations. |
31 |
|
* |
32 |
|
* When check is invoked, this strategy considers each |
33 |
|
* INST_POOL annotation on quantified formulas. For each annotation, it |
34 |
|
* instantiates the associated quantified formula with the Cartesian |
35 |
|
* product of terms currently in the pool, using efficient techniques for |
36 |
|
* enumerating over tuples of terms, as implemented in the term tuple |
37 |
|
* enumerator utilities (see quantifiers/term_tuple_enumerator.h). |
38 |
|
*/ |
39 |
|
class InstStrategyPool : public QuantifiersModule |
40 |
|
{ |
41 |
|
public: |
42 |
|
InstStrategyPool(Env& env, |
43 |
|
QuantifiersState& qs, |
44 |
|
QuantifiersInferenceManager& qim, |
45 |
|
QuantifiersRegistry& qr, |
46 |
|
TermRegistry& tr); |
47 |
13646 |
~InstStrategyPool() {} |
48 |
|
/** Presolve */ |
49 |
|
void presolve() override; |
50 |
|
/** Needs check. */ |
51 |
|
bool needsCheck(Theory::Effort e) override; |
52 |
|
/** Reset round. */ |
53 |
|
void reset_round(Theory::Effort e) override; |
54 |
|
/** Register quantified formula q */ |
55 |
|
void registerQuantifier(Node q) override; |
56 |
|
/** Check. |
57 |
|
* Adds instantiations for all currently asserted |
58 |
|
* quantified formulas via calls to process(...) |
59 |
|
*/ |
60 |
|
void check(Theory::Effort e, QEffort quant_e) override; |
61 |
|
/** Identify. */ |
62 |
|
std::string identify() const override; |
63 |
|
|
64 |
|
private: |
65 |
|
/** Process quantified formula with user pool */ |
66 |
|
bool process(Node q, Node p, uint64_t& addedLemmas); |
67 |
|
/** Map from quantified formulas to user pools */ |
68 |
|
std::map<Node, std::vector<Node> > d_userPools; |
69 |
|
}; |
70 |
|
|
71 |
|
} // namespace quantifiers |
72 |
|
} // namespace theory |
73 |
|
} // namespace cvc5 |
74 |
|
|
75 |
|
#endif |