GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/preprocessing_pass_context.h Lines: 6 6 100.0 %
Date: 2021-09-29 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Aina Niemetz, 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
 * The preprocessing pass context for passes
14
 *
15
 * Implementation of the preprocessing pass context for passes. This context
16
 * allows preprocessing passes to retrieve information besides the assertions
17
 * from the solver and interact with it without getting full access.
18
 */
19
20
#include "cvc5_private.h"
21
22
#ifndef CVC5__PREPROCESSING__PREPROCESSING_PASS_CONTEXT_H
23
#define CVC5__PREPROCESSING__PREPROCESSING_PASS_CONTEXT_H
24
25
#include "context/cdhashset.h"
26
#include "preprocessing/learned_literal_manager.h"
27
#include "smt/env_obj.h"
28
#include "theory/logic_info.h"
29
#include "util/resource_manager.h"
30
31
namespace cvc5 {
32
33
class Env;
34
class SmtEngine;
35
class TheoryEngine;
36
37
namespace theory::booleans {
38
class CircuitPropagator;
39
}
40
41
namespace prop {
42
class PropEngine;
43
}
44
45
namespace preprocessing {
46
47
12684
class PreprocessingPassContext : protected EnvObj
48
{
49
 public:
50
  /** Constructor. */
51
  PreprocessingPassContext(
52
      SmtEngine* smt,
53
      Env& env,
54
      theory::booleans::CircuitPropagator* circuitPropagator);
55
56
  /** Get the associated Environment. */
57
219566
  Env& getEnv() { return d_env; }
58
  /** Get the associated TheoryEngine. */
59
  TheoryEngine* getTheoryEngine() const;
60
  /** Get the associated Propengine. */
61
  prop::PropEngine* getPropEngine() const;
62
63
  /** Get the associated circuit propagator. */
64
8963
  theory::booleans::CircuitPropagator* getCircuitPropagator() const
65
  {
66
8963
    return d_circuitPropagator;
67
  }
68
69
  /**
70
   * Get the (user-context-dependent) set of symbols that occur in at least one
71
   * assertion in the current user context.
72
   */
73
1905
  const context::CDHashSet<Node>& getSymsInAssertions() const
74
  {
75
1905
    return d_symsInAssertions;
76
  }
77
78
  /** Spend resource in the resource manager of the associated Env. */
79
  void spendResource(Resource r);
80
81
  /** Get a reference to the top-level substitution map */
82
  theory::TrustSubstitutionMap& getTopLevelSubstitutions() const;
83
84
  /** Record symbols in assertions
85
   *
86
   * This method is called when a set of assertions is finalized. It adds
87
   * the symbols to d_symsInAssertions that occur in assertions.
88
   */
89
  void recordSymbolsInAssertions(const std::vector<Node>& assertions);
90
91
  /**
92
   * Notify learned literal. This method is called when a literal is
93
   * entailed by the current set of assertions.
94
   *
95
   * It should be rewritten, and such that top level substitutions have
96
   * been applied to it.
97
   */
98
  void notifyLearnedLiteral(TNode lit);
99
  /**
100
   * Get the learned literals
101
   */
102
  std::vector<Node> getLearnedLiterals() const;
103
  /**
104
   * Add substitution to the top-level substitutions, which also as a
105
   * consequence is used by the theory model.
106
   * @param lhs The node replaced by node 'rhs'
107
   * @param rhs The node to substitute node 'lhs'
108
   * @param pg The proof generator that can provide a proof of lhs == rhs.
109
   */
110
  void addSubstitution(const Node& lhs,
111
                       const Node& rhs,
112
                       ProofGenerator* pg = nullptr);
113
  /** Same as above, with proof id */
114
  void addSubstitution(const Node& lhs,
115
                       const Node& rhs,
116
                       PfRule id,
117
                       const std::vector<Node>& args);
118
119
  /** The the proof node manager associated with this context, if it exists */
120
  ProofNodeManager* getProofNodeManager() const;
121
122
 private:
123
  /** Pointer to the SmtEngine that this context was created in. */
124
  SmtEngine* d_smt;
125
  /** Instance of the circuit propagator */
126
  theory::booleans::CircuitPropagator* d_circuitPropagator;
127
  /**
128
   * The learned literal manager
129
   */
130
  LearnedLiteralManager d_llm;
131
132
  /**
133
   * The (user-context-dependent) set of symbols that occur in at least one
134
   * assertion in the current user context.
135
   */
136
  context::CDHashSet<Node> d_symsInAssertions;
137
138
};  // class PreprocessingPassContext
139
140
}  // namespace preprocessing
141
}  // namespace cvc5
142
143
#endif /* CVC5__PREPROCESSING__PREPROCESSING_PASS_CONTEXT_H */