reset-assertions: Remove all non-global symbols in the parser (#5229)
[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, Mathias Preiner, Andrew Reynolds
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_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 RemoveTermFormulas* iteRemover,
27 theory::booleans::CircuitPropagator* circuitPropagator)
28 : d_smt(smt),
29 d_resourceManager(smt->getResourceManager()),
30 d_iteRemover(iteRemover),
31 d_topLevelSubstitutions(smt->getUserContext()),
32 d_circuitPropagator(circuitPropagator),
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 void PreprocessingPassContext::enableIntegers()
44 {
45 LogicRequest req(*d_smt);
46 req.enableIntegers();
47 }
48
49 void PreprocessingPassContext::recordSymbolsInAssertions(
50 const std::vector<Node>& assertions)
51 {
52 std::unordered_set<TNode, TNodeHashFunction> visited;
53 std::unordered_set<Node, NodeHashFunction> syms;
54 for (TNode cn : assertions)
55 {
56 expr::getSymbols(cn, syms, visited);
57 }
58 for (const Node& s : syms)
59 {
60 d_symsInAssertions.insert(s);
61 }
62 }
63
64 } // namespace preprocessing
65 } // namespace CVC4