Ensure static-learning adds rewritten assertions. (#5982)
[cvc5.git] / src / preprocessing / preprocessing_pass_context.cpp
1 /********************* */
2 /*! \file preprocessing_pass_context.cpp
3 ** \verbatim
4 ** Top contributors (to current version):
5 ** Aina Niemetz, Andrew Reynolds, Mathias Preiner
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2020 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.\endverbatim
11 **
12 ** \brief The preprocessing pass context for passes
13 **
14 ** The preprocessing pass context for passes.
15 **/
16
17 #include "preprocessing/preprocessing_pass_context.h"
18
19 #include "expr/node_algorithm.h"
20
21 namespace CVC4 {
22 namespace preprocessing {
23
24 PreprocessingPassContext::PreprocessingPassContext(
25 SmtEngine* smt,
26 theory::booleans::CircuitPropagator* circuitPropagator,
27 ProofNodeManager* pnm)
28 : d_smt(smt),
29 d_resourceManager(smt->getResourceManager()),
30 d_topLevelSubstitutions(smt->getUserContext(), pnm),
31 d_circuitPropagator(circuitPropagator),
32 d_pnm(pnm),
33 d_symsInAssertions(smt->getUserContext())
34 {
35 }
36
37 void PreprocessingPassContext::widenLogic(theory::TheoryId id)
38 {
39 LogicRequest req(*d_smt);
40 req.widenLogic(id);
41 }
42
43 theory::TrustSubstitutionMap&
44 PreprocessingPassContext::getTopLevelSubstitutions()
45 {
46 return d_topLevelSubstitutions;
47 }
48
49 void PreprocessingPassContext::enableIntegers()
50 {
51 LogicRequest req(*d_smt);
52 req.enableIntegers();
53 }
54
55 void PreprocessingPassContext::recordSymbolsInAssertions(
56 const std::vector<Node>& assertions)
57 {
58 std::unordered_set<TNode, TNodeHashFunction> visited;
59 std::unordered_set<Node, NodeHashFunction> syms;
60 for (TNode cn : assertions)
61 {
62 expr::getSymbols(cn, syms, visited);
63 }
64 for (const Node& s : syms)
65 {
66 d_symsInAssertions.insert(s);
67 }
68 }
69
70 ProofNodeManager* PreprocessingPassContext::getProofNodeManager()
71 {
72 return d_pnm;
73 }
74
75 } // namespace preprocessing
76 } // namespace CVC4