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 |
|
* Learned literal manager |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_private.h" |
17 |
|
|
18 |
|
#ifndef CVC5__PREPROCESSING__LEARNED_LITERAL_MANAGER_H |
19 |
|
#define CVC5__PREPROCESSING__LEARNED_LITERAL_MANAGER_H |
20 |
|
|
21 |
|
#include "context/cdhashset.h" |
22 |
|
#include "expr/node.h" |
23 |
|
#include "theory/trust_substitutions.h" |
24 |
|
|
25 |
|
namespace cvc5 { |
26 |
|
namespace preprocessing { |
27 |
|
|
28 |
|
/** |
29 |
|
* This class maintains the list of learned literals that have been inferred |
30 |
|
* during preprocessing but we have not fully processed e.g. via substitutions. |
31 |
|
* |
32 |
|
* In particular, notice that if an equality (= x t) is learned at top level, |
33 |
|
* we may add x -> t to top level substitutions if t does not contain x; we can |
34 |
|
* henceforth forget that (= x t) is a learned literal. On the other hand, if |
35 |
|
* a literal like (> x t) is learned at top-level, it may be useful to remember |
36 |
|
* this information. This class is concerned with the latter kind of literals. |
37 |
|
*/ |
38 |
9853 |
class LearnedLiteralManager |
39 |
|
{ |
40 |
|
public: |
41 |
|
LearnedLiteralManager(theory::TrustSubstitutionMap& tls, |
42 |
|
context::UserContext* u, |
43 |
|
ProofNodeManager* pnm); |
44 |
|
/** |
45 |
|
* Notify learned literal. This method is called when a literal is |
46 |
|
* entailed by the current set of assertions. |
47 |
|
* |
48 |
|
* It should be rewritten, and such that top level substitutions have |
49 |
|
* been applied to it. |
50 |
|
*/ |
51 |
|
void notifyLearnedLiteral(TNode lit); |
52 |
|
/** |
53 |
|
* Get learned literals, which returns the current set of learned literals |
54 |
|
* provided to this class. These literals are refreshed so that the current |
55 |
|
* top-level substitutions are applied to them, and then are rewritten. |
56 |
|
*/ |
57 |
|
std::vector<Node> getLearnedLiterals() const; |
58 |
|
|
59 |
|
private: |
60 |
|
/** Learned literal map */ |
61 |
|
typedef context::CDHashSet<Node> NodeSet; |
62 |
|
/* The top level substitutions */ |
63 |
|
theory::TrustSubstitutionMap& d_topLevelSubs; |
64 |
|
/** Learned literals */ |
65 |
|
NodeSet d_learnedLits; |
66 |
|
}; |
67 |
|
|
68 |
|
} // namespace preprocessing |
69 |
|
} // namespace cvc5 |
70 |
|
|
71 |
|
#endif /* CVC5__PREPROCESSING__LEARNED_LITERAL_MANAGER_H */ |