GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/preprocessing_pass_context.h Lines: 6 6 100.0 %
Date: 2021-11-07 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 "theory/trust_substitutions.h"
30
#include "util/resource_manager.h"
31
32
namespace cvc5 {
33
34
class Env;
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
30818
class PreprocessingPassContext : protected EnvObj
48
{
49
 public:
50
  /** Constructor. */
51
  PreprocessingPassContext(
52
      Env& env,
53
      TheoryEngine* te,
54
      prop::PropEngine* pe,
55
      theory::booleans::CircuitPropagator* circuitPropagator);
56
57
  /** Get the associated Environment. */
58
521640
  Env& getEnv() { return d_env; }
59
  /** Get the associated TheoryEngine. */
60
  TheoryEngine* getTheoryEngine() const;
61
  /** Get the associated Propengine. */
62
  prop::PropEngine* getPropEngine() const;
63
64
  /** Get the associated circuit propagator. */
65
16315
  theory::booleans::CircuitPropagator* getCircuitPropagator() const
66
  {
67
16315
    return d_circuitPropagator;
68
  }
69
70
  /**
71
   * Get the (user-context-dependent) set of symbols that occur in at least one
72
   * assertion in the current user context.
73
   */
74
2646
  const context::CDHashSet<Node>& getSymsInAssertions() const
75
  {
76
2646
    return d_symsInAssertions;
77
  }
78
79
  /** Spend resource in the resource manager of the associated Env. */
80
  void spendResource(Resource r);
81
82
  /** Get a reference to the top-level substitution map */
83
  theory::TrustSubstitutionMap& getTopLevelSubstitutions() const;
84
85
  /** Record symbols in assertions
86
   *
87
   * This method is called when a set of assertions is finalized. It adds
88
   * the symbols to d_symsInAssertions that occur in assertions.
89
   */
90
  void recordSymbolsInAssertions(const std::vector<Node>& assertions);
91
92
  /**
93
   * Notify learned literal. This method is called when a literal is
94
   * entailed by the current set of assertions.
95
   *
96
   * It should be rewritten, and such that top level substitutions have
97
   * been applied to it.
98
   */
99
  void notifyLearnedLiteral(TNode lit);
100
  /**
101
   * Get the learned literals
102
   */
103
  std::vector<Node> getLearnedLiterals() const;
104
  /**
105
   * Add substitution to the top-level substitutions, which also as a
106
   * consequence is used by the theory model.
107
   * @param lhs The node replaced by node 'rhs'
108
   * @param rhs The node to substitute node 'lhs'
109
   * @param pg The proof generator that can provide a proof of lhs == rhs.
110
   */
111
  void addSubstitution(const Node& lhs,
112
                       const Node& rhs,
113
                       ProofGenerator* pg = nullptr);
114
  /** Same as above, with proof id */
115
  void addSubstitution(const Node& lhs,
116
                       const Node& rhs,
117
                       PfRule id,
118
                       const std::vector<Node>& args);
119
120
121
 private:
122
  /** Pointer to the theory engine associated with this context. */
123
  TheoryEngine* d_theoryEngine;
124
  /** Pointer to the prop engine associated with this context. */
125
  prop::PropEngine* d_propEngine;
126
  /** Instance of the circuit propagator */
127
  theory::booleans::CircuitPropagator* d_circuitPropagator;
128
  /**
129
   * The learned literal manager
130
   */
131
  LearnedLiteralManager d_llm;
132
133
  /**
134
   * The (user-context-dependent) set of symbols that occur in at least one
135
   * assertion in the current user context.
136
   */
137
  context::CDHashSet<Node> d_symsInAssertions;
138
139
};  // class PreprocessingPassContext
140
141
}  // namespace preprocessing
142
}  // namespace cvc5
143
144
#endif /* CVC5__PREPROCESSING__PREPROCESSING_PASS_CONTEXT_H */