1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds, Mathias Preiner |
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 |
|
* dynamic quantifiers splitting |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_private.h" |
17 |
|
|
18 |
|
#ifndef CVC5__THEORY__QUANT_SPLIT_H |
19 |
|
#define CVC5__THEORY__QUANT_SPLIT_H |
20 |
|
|
21 |
|
#include "context/cdo.h" |
22 |
|
#include "theory/quantifiers/quant_module.h" |
23 |
|
|
24 |
|
namespace cvc5 { |
25 |
|
namespace theory { |
26 |
|
|
27 |
|
class QuantifiersEngine; |
28 |
|
|
29 |
|
namespace quantifiers { |
30 |
|
|
31 |
|
/** Quantifiers dynamic splitting |
32 |
|
* |
33 |
|
* This module identifies quantified formulas that should be "split", e.g. |
34 |
|
* based on datatype constructor case splitting. |
35 |
|
* |
36 |
|
* An example of a quantified formula that we may split is the following. Let: |
37 |
|
* optionPair := mkPair( U, U ) | none |
38 |
|
* where U is an uninterpreted sort. The quantified formula: |
39 |
|
* forall x : optionPair. P( x ) |
40 |
|
* may be "split" via the lemma: |
41 |
|
* forall x : optionPair. P( x ) <=> |
42 |
|
* ( forall xy : U. P( mkPair( x, y ) ) OR P( none ) ) |
43 |
|
* |
44 |
|
* Notice that such splitting may lead to exponential behavior, say if we |
45 |
|
* quantify over 32 variables of type optionPair above gives 2^32 disjuncts. |
46 |
|
* This class is used to compute this splitting dynamically, by splitting |
47 |
|
* one variable per quantified formula at a time. |
48 |
|
*/ |
49 |
10830 |
class QuantDSplit : public QuantifiersModule { |
50 |
|
typedef context::CDHashSet<Node> NodeSet; |
51 |
|
|
52 |
|
public: |
53 |
|
QuantDSplit(QuantifiersState& qs, |
54 |
|
QuantifiersInferenceManager& qim, |
55 |
|
QuantifiersRegistry& qr, |
56 |
|
TermRegistry& tr); |
57 |
|
/** determine whether this quantified formula will be reduced */ |
58 |
|
void checkOwnership(Node q) override; |
59 |
|
/* whether this module needs to check this round */ |
60 |
|
bool needsCheck(Theory::Effort e) override; |
61 |
|
/* Call during quantifier engine's check */ |
62 |
|
void check(Theory::Effort e, QEffort quant_e) override; |
63 |
|
/** check complete for */ |
64 |
|
bool checkCompleteFor(Node q) override; |
65 |
|
/** Identify this module (for debugging, dynamic configuration, etc..) */ |
66 |
55938 |
std::string identify() const override { return "QuantDSplit"; } |
67 |
|
|
68 |
|
private: |
69 |
|
/** list of relevant quantifiers asserted in the current context */ |
70 |
|
std::map<Node, int> d_quant_to_reduce; |
71 |
|
/** whether we have instantiated quantified formulas */ |
72 |
|
NodeSet d_added_split; |
73 |
|
}; |
74 |
|
|
75 |
|
} |
76 |
|
} |
77 |
|
} // namespace cvc5 |
78 |
|
|
79 |
|
#endif |