1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds, Gereon Kremer |
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 inference manager for the theory of sets. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_private.h" |
17 |
|
|
18 |
|
#ifndef CVC5__THEORY__SETS__INFERENCE_MANAGER_H |
19 |
|
#define CVC5__THEORY__SETS__INFERENCE_MANAGER_H |
20 |
|
|
21 |
|
#include "theory/inference_manager_buffered.h" |
22 |
|
#include "theory/sets/solver_state.h" |
23 |
|
|
24 |
|
namespace cvc5 { |
25 |
|
namespace theory { |
26 |
|
namespace sets { |
27 |
|
|
28 |
|
class TheorySetsPrivate; |
29 |
|
|
30 |
|
/** Inference manager |
31 |
|
* |
32 |
|
* This class manages inferences produced by the theory of sets. It manages |
33 |
|
* whether inferences are processed as external lemmas on the output channel |
34 |
|
* of theory of sets or internally as literals asserted to the equality engine |
35 |
|
* of theory of sets. The latter literals are referred to as "facts". |
36 |
|
*/ |
37 |
15268 |
class InferenceManager : public InferenceManagerBuffered |
38 |
|
{ |
39 |
|
typedef context::CDHashSet<Node> NodeSet; |
40 |
|
|
41 |
|
public: |
42 |
|
InferenceManager(Env& env, Theory& t, SolverState& s); |
43 |
|
/** |
44 |
|
* Add facts corresponding to ( exp => fact ) via calls to the assertFact |
45 |
|
* method of TheorySetsPrivate. |
46 |
|
* |
47 |
|
* The portions of fact that were unable to be processed as facts are added |
48 |
|
* to the data member d_pendingLemmas. |
49 |
|
* |
50 |
|
* The argument inferType is used for overriding the policy on whether |
51 |
|
* fact is processed as a lemma, where inferType=1 forces fact to be |
52 |
|
* set as a lemma, and inferType=-1 forces fact to be processed as a fact |
53 |
|
* (if possible). |
54 |
|
*/ |
55 |
|
void assertInference(Node fact, |
56 |
|
InferenceId id, |
57 |
|
Node exp, |
58 |
|
int inferType = 0); |
59 |
|
/** same as above, where exp is interpreted as a conjunction */ |
60 |
|
void assertInference(Node fact, |
61 |
|
InferenceId id, |
62 |
|
std::vector<Node>& exp, |
63 |
|
int inferType = 0); |
64 |
|
/** same as above, where conc is interpreted as a conjunction */ |
65 |
|
void assertInference(std::vector<Node>& conc, |
66 |
|
InferenceId id, |
67 |
|
Node exp, |
68 |
|
int inferType = 0); |
69 |
|
/** same as above, where both exp and conc are interpreted as conjunctions */ |
70 |
|
void assertInference(std::vector<Node>& conc, |
71 |
|
InferenceId id, |
72 |
|
std::vector<Node>& exp, |
73 |
|
int inferType = 0); |
74 |
|
/** |
75 |
|
* Immediately assert an internal fact with the default handling of proofs. |
76 |
|
*/ |
77 |
|
bool assertSetsFact(Node atom, bool polarity, InferenceId id, Node exp); |
78 |
|
|
79 |
|
/** flush the splitting lemma ( n OR (NOT n) ) |
80 |
|
* |
81 |
|
* If reqPol is not 0, then a phase requirement for n is requested with |
82 |
|
* polarity ( reqPol>0 ). |
83 |
|
*/ |
84 |
|
void split(Node n, InferenceId id, int reqPol = 0); |
85 |
|
|
86 |
|
private: |
87 |
|
/** constants */ |
88 |
|
Node d_true; |
89 |
|
Node d_false; |
90 |
|
/** |
91 |
|
* Reference to the state object for the theory of sets. We store the |
92 |
|
* (derived) state here, since it has additional methods required in this |
93 |
|
* class. |
94 |
|
*/ |
95 |
|
SolverState& d_state; |
96 |
|
/** Assert fact recursive |
97 |
|
* |
98 |
|
* This is a helper function for assertInference, which calls assertFact |
99 |
|
* in theory of sets and adds to d_pendingLemmas based on fact. |
100 |
|
* The argument inferType determines the policy on whether fact is processed |
101 |
|
* as a fact or as a lemma (see assertInference above). |
102 |
|
*/ |
103 |
|
bool assertFactRec(Node fact, InferenceId id, Node exp, int inferType = 0); |
104 |
|
}; |
105 |
|
|
106 |
|
} // namespace sets |
107 |
|
} // namespace theory |
108 |
|
} // namespace cvc5 |
109 |
|
|
110 |
|
#endif /* CVC5__THEORY__SETS__INFERENCE_MANAGER_H */ |