GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/preprocessing_pass_context.h Lines: 8 8 100.0 %
Date: 2021-05-22 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 "smt/smt_engine.h"
27
#include "theory/trust_substitutions.h"
28
#include "util/resource_manager.h"
29
30
namespace cvc5 {
31
class SmtEngine;
32
class TheoryEngine;
33
namespace theory::booleans {
34
class CircuitPropagator;
35
}
36
namespace prop {
37
class PropEngine;
38
}
39
namespace preprocessing {
40
41
9459
class PreprocessingPassContext
42
{
43
 public:
44
  PreprocessingPassContext(
45
      SmtEngine* smt,
46
      Env& env,
47
      theory::booleans::CircuitPropagator* circuitPropagator);
48
49
1
  SmtEngine* getSmt() { return d_smt; }
50
321727
  TheoryEngine* getTheoryEngine() { return d_smt->getTheoryEngine(); }
51
12883
  prop::PropEngine* getPropEngine() { return d_smt->getPropEngine(); }
52
  context::Context* getUserContext();
53
  context::Context* getDecisionContext();
54
55
10285
  theory::booleans::CircuitPropagator* getCircuitPropagator()
56
  {
57
10285
    return d_circuitPropagator;
58
  }
59
60
2724
  context::CDHashSet<Node>& getSymsInAssertions() { return d_symsInAssertions; }
61
62
  void spendResource(Resource r);
63
64
  /** Get the current logic info of the SmtEngine */
65
9521
  const LogicInfo& getLogicInfo() { return d_smt->getLogicInfo(); }
66
67
  /** Gets a reference to the top-level substitution map */
68
  theory::TrustSubstitutionMap& getTopLevelSubstitutions();
69
70
  /** Record symbols in assertions
71
   *
72
   * This method is called when a set of assertions is finalized. It adds
73
   * the symbols to d_symsInAssertions that occur in assertions.
74
   */
75
  void recordSymbolsInAssertions(const std::vector<Node>& assertions);
76
77
  /**
78
   * Add substitution to the top-level substitutions, which also as a
79
   * consequence is used by the theory model.
80
   * @param lhs The node replaced by node 'rhs'
81
   * @param rhs The node to substitute node 'lhs'
82
   * @param pg The proof generator that can provide a proof of lhs == rhs.
83
   */
84
  void addSubstitution(const Node& lhs,
85
                       const Node& rhs,
86
                       ProofGenerator* pg = nullptr);
87
  /** Same as above, with proof id */
88
  void addSubstitution(const Node& lhs,
89
                       const Node& rhs,
90
                       PfRule id,
91
                       const std::vector<Node>& args);
92
93
  /** The the proof node manager associated with this context, if it exists */
94
  ProofNodeManager* getProofNodeManager();
95
96
 private:
97
  /** Pointer to the SmtEngine that this context was created in. */
98
  SmtEngine* d_smt;
99
  /** Reference to the environment. */
100
  Env& d_env;
101
  /** Instance of the circuit propagator */
102
  theory::booleans::CircuitPropagator* d_circuitPropagator;
103
  /**
104
   * The (user-context-dependent) set of symbols that occur in at least one
105
   * assertion in the current user context.
106
   */
107
  context::CDHashSet<Node> d_symsInAssertions;
108
109
};  // class PreprocessingPassContext
110
111
}  // namespace preprocessing
112
}  // namespace cvc5
113
114
#endif /* CVC5__PREPROCESSING__PREPROCESSING_PASS_CONTEXT_H */