Eliminate static options access in proof utilities (#8927)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Sat, 9 Jul 2022 03:42:48 +0000 (22:42 -0500)
committerGitHub <noreply@github.com>
Sat, 9 Jul 2022 03:42:48 +0000 (03:42 +0000)
This requires changing many of the proof interfaces to pass Env instead of ProofNodeManager. This is also work towards simplifying the initialization of our proof infrastructure.

118 files changed:
src/preprocessing/passes/miplib_trick.cpp
src/preprocessing/passes/non_clausal_simp.cpp
src/preprocessing/passes/non_clausal_simp.h
src/proof/alethe/alethe_post_processor.cpp
src/proof/alethe/alethe_post_processor.h
src/proof/buffered_proof_generator.cpp
src/proof/buffered_proof_generator.h
src/proof/conv_proof_generator.cpp
src/proof/conv_proof_generator.h
src/proof/eager_proof_generator.cpp
src/proof/eager_proof_generator.h
src/proof/lazy_proof.cpp
src/proof/lazy_proof.h
src/proof/lazy_proof_chain.cpp
src/proof/lazy_proof_chain.h
src/proof/lazy_tree_proof_generator.cpp
src/proof/lazy_tree_proof_generator.h
src/proof/lfsc/lfsc_post_processor.cpp
src/proof/lfsc/lfsc_post_processor.h
src/proof/proof.cpp
src/proof/proof.h
src/proof/proof_ensure_closed.cpp
src/proof/proof_ensure_closed.h
src/proof/proof_node_updater.cpp
src/proof/proof_node_updater.h
src/proof/proof_set.h
src/proof/trust_node.cpp
src/proof/trust_node.h
src/prop/proof_cnf_stream.cpp
src/prop/proof_post_processor.cpp
src/prop/proof_post_processor.h
src/prop/prop_engine.cpp
src/prop/prop_proof_manager.cpp
src/prop/prop_proof_manager.h
src/prop/sat_proof_manager.cpp
src/prop/zero_level_learner.cpp
src/smt/env.cpp
src/smt/env.h
src/smt/expand_definitions.cpp
src/smt/preprocess_proof_generator.cpp
src/smt/proof_manager.cpp
src/smt/proof_post_processor.cpp
src/smt/proof_post_processor.h
src/smt/solver_engine.cpp
src/smt/term_formula_removal.cpp
src/smt/witness_form.cpp
src/theory/arith/branch_and_bound.cpp
src/theory/arith/branch_and_bound.h
src/theory/arith/linear/congruence_manager.cpp
src/theory/arith/linear/theory_arith_private.cpp
src/theory/arith/nl/coverings/cdcac.cpp
src/theory/arith/nl/coverings/proof_generator.cpp
src/theory/arith/nl/coverings/proof_generator.h
src/theory/arith/nl/ext/ext_state.cpp
src/theory/arith/nl/ext/ext_state.h
src/theory/arith/nl/ext/factoring_check.h
src/theory/arith/nl/ext/monomial_bounds_check.cpp
src/theory/arith/nl/ext/monomial_bounds_check.h
src/theory/arith/nl/ext/monomial_check.h
src/theory/arith/nl/ext/split_zero_check.h
src/theory/arith/nl/ext/tangent_plane_check.h
src/theory/arith/nl/nonlinear_extension.cpp
src/theory/arith/nl/transcendental/transcendental_state.cpp
src/theory/arith/operator_elim.cpp
src/theory/arith/operator_elim.h
src/theory/arith/pp_rewrite_eq.cpp
src/theory/arith/theory_arith.cpp
src/theory/arrays/inference_manager.cpp
src/theory/arrays/theory_arrays.cpp
src/theory/arrays/theory_arrays_rewriter.cpp
src/theory/arrays/theory_arrays_rewriter.h
src/theory/booleans/circuit_propagator.cpp
src/theory/booleans/circuit_propagator.h
src/theory/bv/bitblast/bitblast_proof_generator.cpp
src/theory/bv/bitblast/bitblast_proof_generator.h
src/theory/bv/bitblast/proof_bitblaster.cpp
src/theory/bv/bitblast/proof_bitblaster.h
src/theory/bv/bv_solver_bitblast.cpp
src/theory/bv/bv_solver_bitblast.h
src/theory/bv/bv_solver_bitblast_internal.cpp
src/theory/bv/bv_solver_bitblast_internal.h
src/theory/bv/theory_bv.cpp
src/theory/combination_engine.cpp
src/theory/combination_engine.h
src/theory/datatypes/infer_proof_cons.cpp
src/theory/datatypes/infer_proof_cons.h
src/theory/datatypes/inference_manager.cpp
src/theory/quantifiers/alpha_equivalence.cpp
src/theory/quantifiers/alpha_equivalence.h
src/theory/quantifiers/instantiate.cpp
src/theory/quantifiers/skolemize.cpp
src/theory/rewriter.cpp
src/theory/rewriter.h
src/theory/sets/term_registry.cpp
src/theory/sets/term_registry.h
src/theory/sets/theory_sets.cpp
src/theory/sets/theory_sets_private.cpp
src/theory/sets/theory_sets_private.h
src/theory/strings/infer_proof_cons.cpp
src/theory/strings/infer_proof_cons.h
src/theory/strings/inference_manager.cpp
src/theory/strings/regexp_elim.cpp
src/theory/strings/regexp_elim.h
src/theory/strings/term_registry.cpp
src/theory/strings/term_registry.h
src/theory/strings/theory_strings.cpp
src/theory/theory_engine.cpp
src/theory/theory_engine.h
src/theory/theory_engine_proof_generator.cpp
src/theory/theory_engine_proof_generator.h
src/theory/theory_inference_manager.cpp
src/theory/theory_preprocessor.cpp
src/theory/trust_substitutions.cpp
src/theory/trust_substitutions.h
src/theory/uf/lambda_lift.cpp
src/theory/uf/proof_equality_engine.cpp
src/theory/uf/proof_equality_engine.h
test/unit/theory/theory_arith_coverings_white.cpp

index 372f70a218572a43c0dd1c779f9ea3f9c996fd6c..fcfce08758313d30b64efc8a036303ab844ee724 100644 (file)
@@ -537,7 +537,7 @@ PreprocessingPassResult MipLibTrick::applyInternal(
 
               Node n = rewrite(geq.andNode(leq));
               assertionsToPreprocess->push_back(n);
-              TrustSubstitutionMap tnullMap(&fakeContext, nullptr);
+              TrustSubstitutionMap tnullMap(d_env, &fakeContext);
               CVC5_UNUSED SubstitutionMap& nullMap = tnullMap.get();
               Theory::PPAssertStatus status CVC5_UNUSED;  // just for assertions
               status = te->solve(tgeq, tnullMap);
index cca0f72b9d70a9465f05db97c39b05149e9f5cc7..70f47641e0db4b85f39cdece6e0496048db7350e 100644 (file)
@@ -52,13 +52,12 @@ NonClausalSimp::Statistics::Statistics(StatisticsRegistry& reg)
 NonClausalSimp::NonClausalSimp(PreprocessingPassContext* preprocContext)
     : PreprocessingPass(preprocContext, "non-clausal-simp"),
       d_statistics(statisticsRegistry()),
-      d_pnm(d_env.getProofNodeManager()),
-      d_llpg(d_pnm ? new smt::PreprocessProofGenerator(
+      d_llpg(options().smt.produceProofs ? new smt::PreprocessProofGenerator(
                  d_env, userContext(), "NonClausalSimp::llpg")
-                   : nullptr),
-      d_llra(d_pnm ? new LazyCDProof(
-                 d_pnm, nullptr, userContext(), "NonClausalSimp::llra")
-                   : nullptr),
+                                         : nullptr),
+      d_llra(options().smt.produceProofs ? new LazyCDProof(
+                 d_env, nullptr, userContext(), "NonClausalSimp::llra")
+                                         : nullptr),
       d_tsubsList(userContext())
 {
 }
@@ -124,12 +123,12 @@ PreprocessingPassResult NonClausalSimp::applyInternal(
   // constant propagations
   std::shared_ptr<TrustSubstitutionMap> constantPropagations =
       std::make_shared<TrustSubstitutionMap>(
-          u, d_pnm, "NonClausalSimp::cprop", PfRule::PREPROCESS_LEMMA);
+          d_env, u, "NonClausalSimp::cprop", PfRule::PREPROCESS_LEMMA);
   SubstitutionMap& cps = constantPropagations->get();
   // new substitutions
   std::shared_ptr<TrustSubstitutionMap> newSubstitutions =
       std::make_shared<TrustSubstitutionMap>(
-          u, d_pnm, "NonClausalSimp::newSubs", PfRule::PREPROCESS_LEMMA);
+          d_env, u, "NonClausalSimp::newSubs", PfRule::PREPROCESS_LEMMA);
   SubstitutionMap& nss = newSubstitutions->get();
 
   size_t j = 0;
@@ -451,7 +450,10 @@ PreprocessingPassResult NonClausalSimp::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-bool NonClausalSimp::isProofEnabled() const { return d_pnm != nullptr; }
+bool NonClausalSimp::isProofEnabled() const
+{
+  return options().smt.produceProofs;
+}
 
 Node NonClausalSimp::processLearnedLit(Node lit,
                                        theory::TrustSubstitutionMap* subs,
index 5d988ec566371e5f6672daa58a92ed9123e307dd..e643c1364665b04178a79abe7005c7dd903657ff 100644 (file)
@@ -79,8 +79,6 @@ class NonClausalSimp : public PreprocessingPass
   Node processRewrittenLearnedLit(TrustNode trn);
   /** Is proof enabled? */
   bool isProofEnabled() const;
-  /** The proof node manager */
-  ProofNodeManager* d_pnm;
   /** the learned literal preprocess proof generator */
   std::unique_ptr<smt::PreprocessProofGenerator> d_llpg;
   /**
index 86c2ef11575d4275ce937139a7023e7a4f8991aa..db6cb7c1baa63e9d20228220fa342dea1a7a75ec 100644 (file)
@@ -21,6 +21,7 @@
 #include "proof/proof_checker.h"
 #include "proof/proof_node_algorithm.h"
 #include "proof/proof_node_manager.h"
+#include "smt/env.h"
 #include "theory/builtin/proof_checker.h"
 #include "util/rational.h"
 
@@ -31,8 +32,8 @@ namespace cvc5::internal {
 namespace proof {
 
 AletheProofPostprocessCallback::AletheProofPostprocessCallback(
-    ProofNodeManager* pnm, AletheNodeConverter& anc, bool resPivots)
-    : d_pnm(pnm), d_anc(anc), d_resPivots(resPivots)
+    Env& env, AletheNodeConverter& anc, bool resPivots)
+    : EnvObj(env), d_anc(anc), d_resPivots(resPivots)
 {
   NodeManager* nm = NodeManager::currentNM();
   d_cl = nm->mkBoundVar("cl", nm->sExprType());
@@ -1819,10 +1820,10 @@ bool AletheProofPostprocessCallback::addAletheStepFromOr(
   return addAletheStep(rule, res, conclusion, children, args, cdp);
 }
 
-AletheProofPostprocess::AletheProofPostprocess(ProofNodeManager* pnm,
+AletheProofPostprocess::AletheProofPostprocess(Env& env,
                                                AletheNodeConverter& anc,
                                                bool resPivots)
-    : d_pnm(pnm), d_cb(d_pnm, anc, resPivots)
+    : EnvObj(env), d_cb(env, anc, resPivots)
 {
 }
 
@@ -1831,7 +1832,7 @@ AletheProofPostprocess::~AletheProofPostprocess() {}
 void AletheProofPostprocess::process(std::shared_ptr<ProofNode> pf)
 {
   // Translate proof node
-  ProofNodeUpdater updater(d_pnm, d_cb, false, false);
+  ProofNodeUpdater updater(d_env, d_cb, false, false);
   updater.process(pf->getChildren()[0]);
 
   // In the Alethe proof format the final step has to be (cl). However, after
@@ -1839,7 +1840,7 @@ void AletheProofPostprocess::process(std::shared_ptr<ProofNode> pf)
   // required.
   // The function has the additional purpose of sanitizing the attributes of the
   // first SCOPE
-  CDProof cpf(d_pnm, nullptr, "ProofNodeUpdater::CDProof", true);
+  CDProof cpf(d_env, nullptr, "ProofNodeUpdater::CDProof", true);
   const std::vector<std::shared_ptr<ProofNode>>& cc = pf->getChildren();
   std::vector<Node> ccn;
   for (const std::shared_ptr<ProofNode>& cp : cc)
@@ -1856,7 +1857,7 @@ void AletheProofPostprocess::process(std::shared_ptr<ProofNode> pf)
 
     // then, update the original proof node based on this one
     Trace("pf-process-debug") << "Update node..." << std::endl;
-    d_pnm->updateNode(pf.get(), npn.get());
+    d_env.getProofNodeManager()->updateNode(pf.get(), npn.get());
     Trace("pf-process-debug") << "...update node finished." << std::endl;
   }
 }
index 62084612055826162c2c99b72bd727494cab3432..638d9c3acf8785f2c5e44e4b2d0fbad321f38624 100644 (file)
@@ -28,10 +28,11 @@ namespace proof {
  * A callback class used by the Alethe converter for post-processing proof nodes
  * by replacing internal rules by the rules in the Alethe calculus.
  */
-class AletheProofPostprocessCallback : public ProofNodeUpdaterCallback
+class AletheProofPostprocessCallback : protected EnvObj,
+                                       public ProofNodeUpdaterCallback
 {
  public:
-  AletheProofPostprocessCallback(ProofNodeManager* pnm,
+  AletheProofPostprocessCallback(Env& env,
                                  AletheNodeConverter& anc,
                                  bool resPivots);
   ~AletheProofPostprocessCallback() {}
@@ -88,8 +89,6 @@ class AletheProofPostprocessCallback : public ProofNodeUpdaterCallback
                  CDProof* cdp);
 
  private:
-  /** The proof node manager */
-  ProofNodeManager* d_pnm;
   /** The Alethe node converter */
   AletheNodeConverter& d_anc;
   /** Whether to keep the pivots in the alguments of the resolution rule */
@@ -145,19 +144,15 @@ class AletheProofPostprocessCallback : public ProofNodeUpdaterCallback
  * The proof postprocessor module. This postprocesses a proof node into one
  * using the rules from the Alethe calculus.
  */
-class AletheProofPostprocess
+class AletheProofPostprocess : protected EnvObj
 {
  public:
-  AletheProofPostprocess(ProofNodeManager* pnm,
-                         AletheNodeConverter& anc,
-                         bool resPivots);
+  AletheProofPostprocess(Env& env, AletheNodeConverter& anc, bool resPivots);
   ~AletheProofPostprocess();
   /** post-process */
   void process(std::shared_ptr<ProofNode> pf);
 
  private:
-  /** The proof node manager */
-  ProofNodeManager* d_pnm;
   /** The post process callback */
   AletheProofPostprocessCallback d_cb;
 };
index 0a7e634042f5f36ebb18fccd6510574d5e828976..7fa49f089a7eda081db952b17a8cd2ce83553a58 100644 (file)
@@ -20,9 +20,8 @@
 
 namespace cvc5::internal {
 
-BufferedProofGenerator::BufferedProofGenerator(context::Context* c,
-                                               ProofNodeManager* pnm)
-    : ProofGenerator(), d_facts(c), d_pnm(pnm)
+BufferedProofGenerator::BufferedProofGenerator(Env& env, context::Context* c)
+    : EnvObj(env), ProofGenerator(), d_facts(c)
 {
 }
 
@@ -76,7 +75,7 @@ std::shared_ptr<ProofNode> BufferedProofGenerator::getProofFor(Node fact)
     }
   }
   Trace("pfee-fact-gen") << "...return via step " << *(*it).second << std::endl;
-  CDProof cdp(d_pnm);
+  CDProof cdp(d_env);
   cdp.addStep(fact, *(*it).second);
   return cdp.getProofFor(fact);
 }
index 418f130a3e7df6ba7fdb59b477534489626ff531..7c72547f78a7b8304d3596bb33d56253b435cdb3 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "context/cdhashmap.h"
 #include "proof/proof_generator.h"
+#include "smt/env_obj.h"
 
 namespace cvc5::internal {
 
@@ -31,12 +32,12 @@ class ProofStep;
  * mapping from formulas to proof steps. It does not generate ProofNodes until
  * it is asked to provide a proof for a given fact.
  */
-class BufferedProofGenerator : public ProofGenerator
+class BufferedProofGenerator : protected EnvObj, public ProofGenerator
 {
   typedef context::CDHashMap<Node, std::shared_ptr<ProofStep>> NodeProofStepMap;
 
  public:
-  BufferedProofGenerator(context::Context* c, ProofNodeManager* pnm);
+  BufferedProofGenerator(Env& env, context::Context* c);
   ~BufferedProofGenerator() {}
   /** add step
    * Unless the overwrite policy is ALWAYS it does not replace previously
@@ -55,8 +56,6 @@ class BufferedProofGenerator : public ProofGenerator
  private:
   /** maps expected to ProofStep */
   NodeProofStepMap d_facts;
-  /** the proof node manager */
-  ProofNodeManager* d_pnm;
 };
 
 }  // namespace cvc5::internal
index a4bd399bf0d579700216448d9f562a74be3edd71..790cd4a4bdc844c303cb6d6d2c57ae865686043f 100644 (file)
@@ -50,14 +50,15 @@ std::ostream& operator<<(std::ostream& out, TConvCachePolicy tcpol)
   return out;
 }
 
-TConvProofGenerator::TConvProofGenerator(ProofNodeManager* pnm,
+TConvProofGenerator::TConvProofGenerator(Env& env,
                                          context::Context* c,
                                          TConvPolicy pol,
                                          TConvCachePolicy cpol,
                                          std::string name,
                                          TermContext* tccb,
                                          bool rewriteOps)
-    : d_proof(pnm, nullptr, c, name + "::LazyCDProof"),
+    : EnvObj(env),
+      d_proof(env, nullptr, c, name + "::LazyCDProof"),
       d_preRewriteMap(c ? c : &d_context),
       d_postRewriteMap(c ? c : &d_context),
       d_policy(pol),
@@ -183,8 +184,7 @@ std::shared_ptr<ProofNode> TConvProofGenerator::getProofFor(Node f)
     return nullptr;
   }
   // we use the existing proofs
-  LazyCDProof lpf(
-      d_proof.getManager(), &d_proof, nullptr, d_name + "::LazyCDProof");
+  LazyCDProof lpf(d_env, &d_proof, nullptr, d_name + "::LazyCDProof");
   if (f[0] == f[1])
   {
     // assertion failure in debug
@@ -239,8 +239,7 @@ std::shared_ptr<ProofNode> TConvProofGenerator::getProofFor(Node f)
 
 std::shared_ptr<ProofNode> TConvProofGenerator::getProofForRewriting(Node n)
 {
-  LazyCDProof lpf(
-      d_proof.getManager(), &d_proof, nullptr, d_name + "::LazyCDProofRew");
+  LazyCDProof lpf(d_env, &d_proof, nullptr, d_name + "::LazyCDProofRew");
   Node conc = getProofForRewriting(n, lpf, d_tcontext);
   if (conc[1] == n)
   {
index 60aa4333a63ad3e89a9bb0b22d07efe85d5844cd..ee4429384207a2bb1fa0fdd04cf654120f4268ef 100644 (file)
@@ -114,14 +114,14 @@ std::ostream& operator<<(std::ostream& out, TConvCachePolicy tcpol);
  * replayed in the expected way, e.g. the occurrence of (and A B) that is not
  * in term position is not rewritten.
  */
-class TConvProofGenerator : public ProofGenerator
+class TConvProofGenerator : protected EnvObj, public ProofGenerator
 {
  public:
   /**
    * Constructor, which notice does fixpoint rewriting (since this is the
    * most common use case) and never caches.
    *
-   * @param pnm The proof node manager for constructing ProofNode objects.
+   * @param env Reference to the environment.
    * @param c The context that this class depends on. If none is provided,
    * this class is context-independent.
    * @param tpol The policy for applying rewrite steps of this class. For
@@ -132,7 +132,7 @@ class TConvProofGenerator : public ProofGenerator
    * is non-null, then this class stores a term-context-sensitive rewrite
    * system. The rewrite steps should be given term context identifiers.
    */
-  TConvProofGenerator(ProofNodeManager* pnm,
+  TConvProofGenerator(Env& env,
                       context::Context* c = nullptr,
                       TConvPolicy pol = TConvPolicy::FIXPOINT,
                       TConvCachePolicy cpol = TConvCachePolicy::NEVER,
index 52432fb025c6fd79b595153e514f29a30673741f..289daf620133c9ed4e93e00c567702c7b4a7f81d 100644 (file)
 #include "proof/proof.h"
 #include "proof/proof_node.h"
 #include "proof/proof_node_manager.h"
+#include "smt/env.h"
 
 namespace cvc5::internal {
 
-EagerProofGenerator::EagerProofGenerator(ProofNodeManager* pnm,
+EagerProofGenerator::EagerProofGenerator(Env& env,
                                          context::Context* c,
                                          std::string name)
-    : d_pnm(pnm), d_name(name), d_proofs(c == nullptr ? &d_context : c)
+    : EnvObj(env), d_name(name), d_proofs(c == nullptr ? &d_context : c)
 {
 }
 
@@ -104,20 +105,21 @@ TrustNode EagerProofGenerator::mkTrustNode(Node conc,
                                            const std::vector<Node>& args,
                                            bool isConflict)
 {
+  ProofNodeManager* pnm = d_env.getProofNodeManager();
   // if no children, its easy
   if (exp.empty())
   {
-    std::shared_ptr<ProofNode> pf = d_pnm->mkNode(id, {}, args, conc);
+    std::shared_ptr<ProofNode> pf = pnm->mkNode(id, {}, args, conc);
     return mkTrustNode(conc, pf, isConflict);
   }
   // otherwise, we use CDProof + SCOPE
-  CDProof cdp(d_pnm);
+  CDProof cdp(d_env);
   cdp.addStep(conc, id, exp, args);
   std::shared_ptr<ProofNode> pf = cdp.getProofFor(conc);
   // We use mkNode instead of mkScope, since there is no reason to check
   // whether the free assumptions of pf are in exp, since they are by the
   // construction above.
-  std::shared_ptr<ProofNode> pfs = d_pnm->mkNode(PfRule::SCOPE, {pf}, exp);
+  std::shared_ptr<ProofNode> pfs = pnm->mkNode(PfRule::SCOPE, {pf}, exp);
   return mkTrustNode(pfs->getResult(), pfs, isConflict);
 }
 
@@ -140,7 +142,7 @@ TrustNode EagerProofGenerator::mkTrustedRewrite(Node a,
                                                 const std::vector<Node>& args)
 {
   Node eq = a.eqNode(b);
-  CDProof cdp(d_pnm);
+  CDProof cdp(d_env);
   cdp.addStep(eq, id, {}, args);
   std::shared_ptr<ProofNode> pf = cdp.getProofFor(eq);
   return mkTrustedRewrite(a, b, pf);
index aba4ec11ee9c0228b154585a00a9a86f3d40d189..a0c0db25789333c6bc8aa2474a36e288e12fcf86 100644 (file)
@@ -23,6 +23,7 @@
 #include "proof/proof_generator.h"
 #include "proof/proof_rule.h"
 #include "proof/trust_node.h"
+#include "smt/env_obj.h"
 
 namespace cvc5::internal {
 
@@ -83,12 +84,12 @@ class ProofNodeManager;
  * storing the proof internally, and the proof output channel is responsible for
  * maintaining the map that epg is who to ask for the proof of the conflict.
  */
-class EagerProofGenerator : public ProofGenerator
+class EagerProofGenerator : protected EnvObj, public ProofGenerator
 {
   typedef context::CDHashMap<Node, std::shared_ptr<ProofNode>> NodeProofNodeMap;
 
  public:
-  EagerProofGenerator(ProofNodeManager* pnm,
+  EagerProofGenerator(Env& env,
                       context::Context* c = nullptr,
                       std::string name = "EagerProofGenerator");
   ~EagerProofGenerator() {}
@@ -191,8 +192,6 @@ class EagerProofGenerator : public ProofGenerator
   void setProofForLemma(Node lem, std::shared_ptr<ProofNode> pf);
   /** Set that pf is the proof for explained propagation */
   void setProofForPropExp(TNode lit, Node exp, std::shared_ptr<ProofNode> pf);
-  /** The proof node manager */
-  ProofNodeManager* d_pnm;
   /** Name identifier */
   std::string d_name;
   /** A dummy context used by this class if none is provided */
index 01cd5645269ea841fd42b54505fa91b152d1a62e..ec4a80c56b70d7f67032590154fbbdc31004e42f 100644 (file)
@@ -23,13 +23,13 @@ using namespace cvc5::internal::kind;
 
 namespace cvc5::internal {
 
-LazyCDProof::LazyCDProof(ProofNodeManager* pnm,
+LazyCDProof::LazyCDProof(Env& env,
                          ProofGenerator* dpg,
                          context::Context* c,
                          const std::string& name,
                          bool autoSym,
                          bool doCache)
-    : CDProof(pnm, c, name, autoSym),
+    : CDProof(env, c, name, autoSym),
       d_gens(c ? c : &d_context),
       d_defaultGen(dpg),
       d_doCache(doCache),
@@ -122,16 +122,16 @@ std::shared_ptr<ProofNode> LazyCDProof::getProofFor(Node fact)
             {
               if (pgc->getRule() == PfRule::SYMM)
               {
-                d_manager->updateNode(cur, pgc->getChildren()[0].get());
+                getManager()->updateNode(cur, pgc->getChildren()[0].get());
               }
               else
               {
-                d_manager->updateNode(cur, PfRule::SYMM, {pgc}, {});
+                getManager()->updateNode(cur, PfRule::SYMM, {pgc}, {});
               }
             }
             else
             {
-              d_manager->updateNode(cur, pgc.get());
+              getManager()->updateNode(cur, pgc.get());
             }
             Trace("lazy-cdproof") << "LazyCDProof: Successfully added fact for "
                                   << cfactGen << std::endl;
@@ -201,7 +201,7 @@ void LazyCDProof::addLazyStep(Node expected,
   if (isClosed)
   {
     Trace("lazy-cdproof-debug") << "Checking closed..." << std::endl;
-    pfgEnsureClosed(expected, pg, "lazy-cdproof-debug", ctx);
+    pfgEnsureClosed(options(), expected, pg, "lazy-cdproof-debug", ctx);
   }
 }
 
index 027f90c50104085083e98b6d3d3b92ea752f0e97..877cc14945386fa5dbbc049bda015fca92139328 100644 (file)
@@ -51,7 +51,7 @@ class LazyCDProof : public CDProof
    * to getProofFor, even if new steps are provided to this class in the
    * meantime.
    */
-  LazyCDProof(ProofNodeManager* pnm,
+  LazyCDProof(Env& env,
               ProofGenerator* dpg = nullptr,
               context::Context* c = nullptr,
               const std::string& name = "LazyCDProof",
index c8dc842e2f8c7677b4e521878e13ec249301c945..46a071e9cb06418dac16c8a588b3b2716e645016 100644 (file)
 
 namespace cvc5::internal {
 
-LazyCDProofChain::LazyCDProofChain(ProofNodeManager* pnm,
+LazyCDProofChain::LazyCDProofChain(Env& env,
                                    bool cyclic,
                                    context::Context* c,
                                    ProofGenerator* defGen,
                                    bool defRec,
                                    const std::string& name)
-    : CDProof(pnm, c, name, false),
-      d_manager(pnm),
+    : CDProof(env, c, name, false),
       d_cyclic(cyclic),
       d_defRec(defRec),
       d_context(),
@@ -255,6 +254,7 @@ std::shared_ptr<ProofNode> LazyCDProofChain::getProofFor(Node fact)
           << "\n";
     }
   } while (!visit.empty());
+  ProofNodeManager* pnm = getManager();
   // expand all assumptions marked to be connected
   for (const std::pair<const Node, std::shared_ptr<ProofNode>>& npfn :
        toConnect)
@@ -275,7 +275,7 @@ std::shared_ptr<ProofNode> LazyCDProofChain::getProofFor(Node fact)
     // update each assumption proof node
     for (std::shared_ptr<ProofNode> pfn : it->second)
     {
-      d_manager->updateNode(pfn.get(), npfn.second.get());
+      pnm->updateNode(pfn.get(), npfn.second.get());
     }
   }
   Trace("lazy-cdproofchain") << "===========\n";
@@ -328,7 +328,8 @@ void LazyCDProofChain::addLazyStep(Node expected,
       }
       Trace("lazy-cdproofchain") << "\n";
     }
-    pfnEnsureClosedWrt(pfn.get(), allowedLeaves, "lazy-cdproofchain", ctx);
+    pfnEnsureClosedWrt(
+        options(), pfn.get(), allowedLeaves, "lazy-cdproofchain", ctx);
   }
 }
 
index 88d51c94a225c88370c5f12af92a86ebdf7c1db1..fe3011157b5cdfc2ce2c217ae887a4e35c1ed1c3 100644 (file)
@@ -40,7 +40,7 @@ class LazyCDProofChain : public CDProof
  public:
   /** Constructor
    *
-   * @param pnm The proof node manager for constructing ProofNode objects.
+   * @param env Reference to the environment
    * @param cyclic Whether this instance is robust to cycles in the chain.
    * @param c The context that this class depends on. If none is provided,
    * this class is context-independent.
@@ -48,7 +48,7 @@ class LazyCDProofChain : public CDProof
    * for a step.
    * @param defRec Whether this instance expands proofs from defGen recursively.
    */
-  LazyCDProofChain(ProofNodeManager* pnm,
+  LazyCDProofChain(Env& env,
                    bool cyclic = true,
                    context::Context* c = nullptr,
                    ProofGenerator* defGen = nullptr,
@@ -147,9 +147,6 @@ class LazyCDProofChain : public CDProof
    * Returns a nullptr when no internal proof stored.
    */
   std::shared_ptr<ProofNode> getProofForInternal(Node fact, bool& rec);
-
-  /** The proof manager, used for allocating new ProofNode objects */
-  ProofNodeManager* d_manager;
   /** Whether this instance is robust to cycles in the chain. */
   bool d_cyclic;
   /** Whether we expand recursively (for the default generator) */
index f231cd5b0be47eaec551683df7bd488384a1179a..591e6ae16809b15e9211ce30d5b6acfcfaddcd9a 100644 (file)
 #include "proof/proof_generator.h"
 #include "proof/proof_node.h"
 #include "proof/proof_node_manager.h"
+#include "smt/env.h"
 
 namespace cvc5::internal {
 
-LazyTreeProofGenerator::LazyTreeProofGenerator(ProofNodeManager* pnm,
+LazyTreeProofGenerator::LazyTreeProofGenerator(Env& env,
                                                const std::string& name)
-    : d_pnm(pnm), d_name(name)
+    : EnvObj(env), d_name(name)
 {
   d_stack.emplace_back(&d_proof);
 }
@@ -90,6 +91,7 @@ std::shared_ptr<ProofNode> LazyTreeProofGenerator::getProof(
     std::vector<std::shared_ptr<ProofNode>>& scope,
     const detail::TreeProofNode& pn) const
 {
+  ProofNodeManager* pnm = d_env.getProofNodeManager();
   // Store scope size to reset scope afterwards
   std::size_t before = scope.size();
   std::vector<std::shared_ptr<ProofNode>> children;
@@ -100,7 +102,7 @@ std::shared_ptr<ProofNode> LazyTreeProofGenerator::getProof(
     {
       for (const auto& a : pn.d_args)
       {
-        scope.emplace_back(d_pnm->mkAssume(a));
+        scope.emplace_back(pnm->mkAssume(a));
       }
     }
   }
@@ -117,11 +119,11 @@ std::shared_ptr<ProofNode> LazyTreeProofGenerator::getProof(
   for (const auto& p : pn.d_premise)
   {
     // Add premises as assumptions
-    children.emplace_back(d_pnm->mkAssume(p));
+    children.emplace_back(pnm->mkAssume(p));
   }
   // Reset scope
   scope.resize(before);
-  return d_pnm->mkNode(pn.d_rule, children, pn.d_args);
+  return pnm->mkNode(pn.d_rule, children, pn.d_args);
 }
 
 void LazyTreeProofGenerator::print(std::ostream& os,
index 3e90c2c67a31db3b42f4177e4a615e121ca31ee6..0e84c5c159b44a00053c65b60758e28b975bac8f 100644 (file)
@@ -23,6 +23,7 @@
 #include "expr/node.h"
 #include "proof/proof_generator.h"
 #include "proof/proof_node_manager.h"
+#include "smt/env_obj.h"
 
 namespace cvc5::internal {
 namespace detail {
@@ -124,13 +125,13 @@ struct TreeProofNode
  * To explicitly finish proof construction, we need to call closeChild() one
  * additional time.
  */
-class LazyTreeProofGenerator : public ProofGenerator
+class LazyTreeProofGenerator : protected EnvObj, public ProofGenerator
 {
  public:
   friend std::ostream& operator<<(std::ostream& os,
                                   const LazyTreeProofGenerator& ltpg);
 
-  LazyTreeProofGenerator(ProofNodeManager* pnm,
+  LazyTreeProofGenerator(Env& env,
                          const std::string& name = "LazyTreeProofGenerator");
 
   std::string identify() const override { return d_name; }
@@ -192,8 +193,6 @@ class LazyTreeProofGenerator : public ProofGenerator
              const std::string& prefix,
              const detail::TreeProofNode& pn) const;
 
-  /** The ProofNodeManager used for constructing ProofNodes */
-  ProofNodeManager* d_pnm;
   /** The trace to the current node */
   std::vector<detail::TreeProofNode*> d_stack;
   /** The root node of the proof tree */
index 9fe57823053510de60481eacb1aff485d803d6a0..a24db91d5bffe571f63d10b31274efa411b06a2f 100644 (file)
@@ -22,6 +22,7 @@
 #include "proof/proof_node_algorithm.h"
 #include "proof/proof_node_manager.h"
 #include "proof/proof_node_updater.h"
+#include "smt/env.h"
 #include "theory/strings/theory_strings_utils.h"
 
 using namespace cvc5::internal::kind;
@@ -30,8 +31,11 @@ namespace cvc5::internal {
 namespace proof {
 
 LfscProofPostprocessCallback::LfscProofPostprocessCallback(
-    LfscNodeConverter& ltp, ProofNodeManager* pnm)
-    : d_pnm(pnm), d_pc(pnm->getChecker()), d_tproc(ltp), d_firstTime(false)
+    Env& env, LfscNodeConverter& ltp)
+    : EnvObj(env),
+      d_pc(env.getProofNodeManager()->getChecker()),
+      d_tproc(ltp),
+      d_firstTime(false)
 {
 }
 
@@ -427,9 +431,8 @@ Node LfscProofPostprocessCallback::mkDummyPredicate()
   return nm->mkBoundVar(nm->booleanType());
 }
 
-LfscProofPostprocess::LfscProofPostprocess(LfscNodeConverter& ltp,
-                                           ProofNodeManager* pnm)
-    : d_cb(new proof::LfscProofPostprocessCallback(ltp, pnm)), d_pnm(pnm)
+LfscProofPostprocess::LfscProofPostprocess(Env& env, LfscNodeConverter& ltp)
+    : EnvObj(env), d_cb(new proof::LfscProofPostprocessCallback(env, ltp))
 {
 }
 
@@ -438,7 +441,7 @@ void LfscProofPostprocess::process(std::shared_ptr<ProofNode> pf)
   d_cb->initializeUpdate();
   // do not automatically add symmetry steps, since this leads to
   // non-termination for example on policy_variable.smt2
-  ProofNodeUpdater updater(d_pnm, *(d_cb.get()), false, false);
+  ProofNodeUpdater updater(d_env, *(d_cb.get()), false, false);
   updater.process(pf);
 }
 
index 72cdca8c3532c3993fa5e3169d66cf43aa9fd91b..b1e8f51033510639439a80160cbb9f7dc63a681b 100644 (file)
@@ -24,6 +24,7 @@
 #include "proof/lfsc/lfsc_node_converter.h"
 #include "proof/lfsc/lfsc_util.h"
 #include "proof/proof_node_updater.h"
+#include "smt/env_obj.h"
 
 namespace cvc5::internal {
 
@@ -35,10 +36,11 @@ namespace proof {
  * A callback class used by the Lfsc convereter for post-processing proof nodes
  * by replacing internal rules by the rules in the Lfsc calculus.
  */
-class LfscProofPostprocessCallback : public ProofNodeUpdaterCallback
+class LfscProofPostprocessCallback : protected EnvObj,
+                                     public ProofNodeUpdaterCallback
 {
  public:
-  LfscProofPostprocessCallback(LfscNodeConverter& ltp, ProofNodeManager* pnm);
+  LfscProofPostprocessCallback(Env& env, LfscNodeConverter& ltp);
   /**
    * Initialize, called once for each new ProofNode to process. This initializes
    * static information to be used by successive calls to update.
@@ -57,8 +59,6 @@ class LfscProofPostprocessCallback : public ProofNodeUpdaterCallback
               bool& continueUpdate) override;
 
  private:
-  /** The proof node manager */
-  ProofNodeManager* d_pnm;
   /** The proof checker of d_pnm **/
   ProofChecker* d_pc;
   /** The term processor */
@@ -84,18 +84,16 @@ class LfscProofPostprocessCallback : public ProofNodeUpdaterCallback
  * The proof postprocessor module. This postprocesses a proof node into one
  * using the rules from the Lfsc calculus.
  */
-class LfscProofPostprocess
+class LfscProofPostprocess : protected EnvObj
 {
  public:
-  LfscProofPostprocess(LfscNodeConverter& ltp, ProofNodeManager* pnm);
+  LfscProofPostprocess(Env& env, LfscNodeConverter& ltp);
   /** post-process */
   void process(std::shared_ptr<ProofNode> pf);
 
  private:
   /** The post process callback */
   std::unique_ptr<LfscProofPostprocessCallback> d_cb;
-  /** The proof node manager */
-  ProofNodeManager* d_pnm;
 };
 
 }  // namespace proof
index 4b2107bae548ffc8749e4a662db2670ad0b70222..97d448a8a493cab9cc2d770b1bc4a7eb6948f556 100644 (file)
 #include "proof/proof_checker.h"
 #include "proof/proof_node.h"
 #include "proof/proof_node_manager.h"
+#include "smt/env.h"
 
 using namespace cvc5::internal::kind;
 
 namespace cvc5::internal {
 
-CDProof::CDProof(ProofNodeManager* pnm,
+CDProof::CDProof(Env& env,
                  context::Context* c,
                  const std::string& name,
                  bool autoSymm)
-    : d_manager(pnm),
+    : EnvObj(env),
       d_context(),
       d_nodes(c ? c : &d_context),
       d_name(name),
@@ -47,8 +48,9 @@ std::shared_ptr<ProofNode> CDProof::getProofFor(Node fact)
   // add as assumption
   std::vector<Node> pargs = {fact};
   std::vector<std::shared_ptr<ProofNode>> passume;
+  ProofNodeManager* pnm = getManager();
   std::shared_ptr<ProofNode> pfa =
-      d_manager->mkNode(PfRule::ASSUME, passume, pargs, fact);
+      pnm->mkNode(PfRule::ASSUME, passume, pargs, fact);
   d_nodes.insert(fact, pfa);
   return pfa;
 }
@@ -94,10 +96,11 @@ std::shared_ptr<ProofNode> CDProof::getProofSymm(Node fact)
     std::vector<std::shared_ptr<ProofNode>> pschild;
     pschild.push_back(pfs);
     std::vector<Node> args;
+    ProofNodeManager* pnm = getManager();
     if (pf == nullptr)
     {
       Trace("cdproof") << "...fresh make symm" << std::endl;
-      std::shared_ptr<ProofNode> psym = d_manager->mkSymm(pfs, fact);
+      std::shared_ptr<ProofNode> psym = pnm->mkSymm(pfs, fact);
       Assert(psym != nullptr);
       d_nodes.insert(fact, psym);
       return psym;
@@ -107,7 +110,7 @@ std::shared_ptr<ProofNode> CDProof::getProofSymm(Node fact)
       // if its not an assumption, make the connection
       Trace("cdproof") << "...update symm" << std::endl;
       // update pf
-      bool sret = d_manager->updateNode(pf.get(), PfRule::SYMM, pschild, args);
+      bool sret = pnm->updateNode(pf.get(), PfRule::SYMM, pschild, args);
       AlwaysAssert(sret);
     }
   }
@@ -151,6 +154,7 @@ bool CDProof::addStep(Node expected,
     // we will overwrite the existing proof node by updating its contents below
   }
   // collect the child proofs, for each premise
+  ProofNodeManager* pnm = getManager();
   std::vector<std::shared_ptr<ProofNode>> pchildren;
   for (const Node& c : children)
   {
@@ -168,7 +172,7 @@ bool CDProof::addStep(Node expected,
       // otherwise, we initialize it as an assumption
       std::vector<Node> pcargs = {c};
       std::vector<std::shared_ptr<ProofNode>> pcassume;
-      pc = d_manager->mkNode(PfRule::ASSUME, pcassume, pcargs, c);
+      pc = pnm->mkNode(PfRule::ASSUME, pcassume, pcargs, c);
       // assumptions never fail to check
       Assert(pc != nullptr);
       d_nodes.insert(c, pc);
@@ -194,7 +198,7 @@ bool CDProof::addStep(Node expected,
   if (pprev == nullptr)
   {
     Trace("cdproof") << "  new node " << expected << "..." << std::endl;
-    pthis = d_manager->mkNode(id, pchildren, args, expected);
+    pthis = pnm->mkNode(id, pchildren, args, expected);
     if (pthis == nullptr)
     {
       // failed to construct the node, perhaps due to a proof checking failure
@@ -211,7 +215,7 @@ bool CDProof::addStep(Node expected,
     // We return the value of updateNode here. This means this method may return
     // false if this call failed, regardless of whether we already have a proof
     // step for expected.
-    ret = d_manager->updateNode(pthis.get(), id, pchildren, args);
+    ret = pnm->updateNode(pthis.get(), id, pchildren, args);
   }
   if (ret)
   {
@@ -316,8 +320,9 @@ bool CDProof::addProof(std::shared_ptr<ProofNode> pn,
       // checker than the one of the manager in this class, then it is double
       // checked here, so that this class maintains the invariant that all of
       // its nodes in d_nodes have been checked by the underlying checker.
-      Assert(d_manager->getChecker() == nullptr
-             || d_manager->getChecker()->check(pn.get(), curFact) == curFact);
+      Assert(getManager()->getChecker() == nullptr
+             || getManager()->getChecker()->check(pn.get(), curFact)
+                    == curFact);
       // just store the proof for fact
       d_nodes.insert(curFact, pn);
     }
@@ -326,7 +331,7 @@ bool CDProof::addProof(std::shared_ptr<ProofNode> pn,
       // We update cur to have the structure of the top node of pn. Notice that
       // the interface to update this node will ensure that the proof apf is a
       // proof of the assumption. If it does not, then pn was wrong.
-      if (!d_manager->updateNode(
+      if (!getManager()->updateNode(
               cur.get(), pn->getRule(), pn->getChildren(), pn->getArguments()))
       {
         return false;
@@ -410,7 +415,12 @@ bool CDProof::hasStep(Node fact)
 
 size_t CDProof::getNumProofNodes() const { return d_nodes.size(); }
 
-ProofNodeManager* CDProof::getManager() const { return d_manager; }
+ProofNodeManager* CDProof::getManager() const
+{
+  ProofNodeManager* pnm = d_env.getProofNodeManager();
+  Assert(pnm != nullptr);
+  return pnm;
+}
 
 bool CDProof::shouldOverwrite(ProofNode* pn, PfRule newId, CDPOverwrite opol)
 {
index 4335858ba39d9bf5145abf82c0c8ebd7d5e3c05f..72de97c87d3e19212b814122bd90f029b145699e 100644 (file)
@@ -24,6 +24,7 @@
 #include "expr/node.h"
 #include "proof/proof_generator.h"
 #include "proof/proof_step_buffer.h"
+#include "smt/env_obj.h"
 
 namespace cvc5::internal {
 
@@ -132,7 +133,7 @@ class ProofNodeManager;
  * of ID_2. More generally, CDProof::isSame(F,G) returns true if F and G are
  * essentially the same formula according to this class.
  */
-class CDProof : public ProofGenerator
+class CDProof : protected EnvObj, public ProofGenerator
 {
  public:
   /**
@@ -142,7 +143,7 @@ class CDProof : public ProofGenerator
    * @param autoSymm Whether this proof automatically adds symmetry steps based
    * on policy documented above.
    */
-  CDProof(ProofNodeManager* pnm,
+  CDProof(Env& env,
           context::Context* c = nullptr,
           const std::string& name = "CDProof",
           bool autoSymm = true);
@@ -249,8 +250,6 @@ class CDProof : public ProofGenerator
 
  protected:
   typedef context::CDHashMap<Node, std::shared_ptr<ProofNode>> NodeProofNodeMap;
-  /** The proof manager, used for allocating new ProofNode objects */
-  ProofNodeManager* d_manager;
   /** A dummy context used by this class if none is provided */
   context::Context d_context;
   /** The nodes of the proof */
index 329bbb4029b3d8d2e8f5921704445045d6bce636..398b115b0a4af40384df5aff94d98a97771675d2 100644 (file)
@@ -29,7 +29,8 @@ namespace cvc5::internal {
  * Ensure closed with respect to assumptions, internal version, which
  * generalizes the check for a proof generator or a proof node.
  */
-void ensureClosedWrtInternal(Node proven,
+void ensureClosedWrtInternal(const Options& opts,
+                             Node proven,
                              ProofGenerator* pg,
                              ProofNode* pnp,
                              const std::vector<Node>& assumps,
@@ -37,13 +38,13 @@ void ensureClosedWrtInternal(Node proven,
                              const char* ctx,
                              bool reqGen)
 {
-  if (!options::produceProofs())
+  if (!opts.smt.produceProofs)
   {
     // proofs not enabled, do not do check
     return;
   }
   bool isTraceDebug = TraceIsOn(c);
-  if (options::proofCheck() != options::ProofCheckMode::EAGER && !isTraceDebug)
+  if (opts.proof.proofCheck != options::ProofCheckMode::EAGER && !isTraceDebug)
   {
     // trace is off and proof new eager checking is off, do not do check
     return;
@@ -143,7 +144,8 @@ void ensureClosedWrtInternal(Node proven,
   Trace(c) << "====" << std::endl;
 }
 
-void pfgEnsureClosed(Node proven,
+void pfgEnsureClosed(const Options& opts,
+                     Node proven,
                      ProofGenerator* pg,
                      const char* c,
                      const char* ctx,
@@ -152,10 +154,11 @@ void pfgEnsureClosed(Node proven,
   Assert(!proven.isNull());
   // proof generator may be null
   std::vector<Node> assumps;
-  ensureClosedWrtInternal(proven, pg, nullptr, assumps, c, ctx, reqGen);
+  ensureClosedWrtInternal(opts, proven, pg, nullptr, assumps, c, ctx, reqGen);
 }
 
-void pfgEnsureClosedWrt(Node proven,
+void pfgEnsureClosedWrt(const Options& opts,
+                        Node proven,
                         ProofGenerator* pg,
                         const std::vector<Node>& assumps,
                         const char* c,
@@ -164,20 +167,25 @@ void pfgEnsureClosedWrt(Node proven,
 {
   Assert(!proven.isNull());
   // proof generator may be null
-  ensureClosedWrtInternal(proven, pg, nullptr, assumps, c, ctx, reqGen);
+  ensureClosedWrtInternal(opts, proven, pg, nullptr, assumps, c, ctx, reqGen);
 }
 
-void pfnEnsureClosed(ProofNode* pn, const char* c, const char* ctx)
+void pfnEnsureClosed(const Options& opts,
+                     ProofNode* pn,
+                     const char* c,
+                     const char* ctx)
 {
-  ensureClosedWrtInternal(Node::null(), nullptr, pn, {}, c, ctx, false);
+  ensureClosedWrtInternal(opts, Node::null(), nullptr, pn, {}, c, ctx, false);
 }
 
-void pfnEnsureClosedWrt(ProofNode* pn,
+void pfnEnsureClosedWrt(const Options& opts,
+                        ProofNode* pn,
                         const std::vector<Node>& assumps,
                         const char* c,
                         const char* ctx)
 {
-  ensureClosedWrtInternal(Node::null(), nullptr, pn, assumps, c, ctx, false);
+  ensureClosedWrtInternal(
+      opts, Node::null(), nullptr, pn, assumps, c, ctx, false);
 }
 
 }  // namespace cvc5::internal
index 84b23087257ca44f8919c35257183868453dda0e..0e683660b24a13c04c8661b237a1ce81ad9cf1af 100644 (file)
@@ -22,6 +22,7 @@
 
 namespace cvc5::internal {
 
+class Options;
 class ProofGenerator;
 class ProofNode;
 
@@ -33,7 +34,8 @@ class ProofNode;
  *
  * @param reqGen Whether we consider a null generator to be a failure.
  */
-void pfgEnsureClosed(Node proven,
+void pfgEnsureClosed(const Options& opts,
+                     Node proven,
                      ProofGenerator* pg,
                      const char* c,
                      const char* ctx,
@@ -47,7 +49,8 @@ void pfgEnsureClosed(Node proven,
  *
  * @param reqGen Whether we consider a null generator to be a failure.
  */
-void pfgEnsureClosedWrt(Node proven,
+void pfgEnsureClosedWrt(const Options& opts,
+                        Node proven,
                         ProofGenerator* pg,
                         const std::vector<Node>& assumps,
                         const char* c,
@@ -59,12 +62,16 @@ void pfgEnsureClosedWrt(Node proven,
  * assertion failure if pn is not closed. Detailed information is printed
  * on trace c. Context ctx is a string used for debugging.
  */
-void pfnEnsureClosed(ProofNode* pn, const char* c, const char* ctx);
+void pfnEnsureClosed(const Options& opts,
+                     ProofNode* pn,
+                     const char* c,
+                     const char* ctx);
 /**
  * Same as above, but throws an assertion failure only if the free assumptions
  * of pn are not contained in assumps.
  */
-void pfnEnsureClosedWrt(ProofNode* pn,
+void pfnEnsureClosedWrt(const Options& opts,
+                        ProofNode* pn,
                         const std::vector<Node>& assumps,
                         const char* c,
                         const char* ctx);
index 464b3030abe1e32fc8411ea26a0304343ec21054..e9c4fa82fc35964b39abca68f9bef989ba6575ba 100644 (file)
@@ -19,6 +19,7 @@
 #include "proof/proof_ensure_closed.h"
 #include "proof/proof_node_algorithm.h"
 #include "proof/proof_node_manager.h"
+#include "smt/env.h"
 
 namespace cvc5::internal {
 
@@ -50,11 +51,11 @@ bool ProofNodeUpdaterCallback::updatePost(Node res,
   return false;
 }
 
-ProofNodeUpdater::ProofNodeUpdater(ProofNodeManager* pnm,
+ProofNodeUpdater::ProofNodeUpdater(Env& env,
                                    ProofNodeUpdaterCallback& cb,
                                    bool mergeSubproofs,
                                    bool autoSym)
-    : d_pnm(pnm),
+    : EnvObj(env),
       d_cb(cb),
       d_debugFreeAssumps(false),
       d_mergeSubproofs(mergeSubproofs),
@@ -111,6 +112,8 @@ void ProofNodeUpdater::processInternal(std::shared_ptr<ProofNode> pf,
   visit.push_back(pf);
   std::map<Node, std::shared_ptr<ProofNode>>::iterator itc;
   Node res;
+  ProofNodeManager* pnm = d_env.getProofNodeManager();
+  Assert(pnm != nullptr);
   do
   {
     cur = visit.back();
@@ -126,7 +129,7 @@ void ProofNodeUpdater::processInternal(std::shared_ptr<ProofNode> pf,
         {
           // already have a proof, merge it into this one
           visited[cur] = true;
-          d_pnm->updateNode(cur.get(), itc->second.get());
+          pnm->updateNode(cur.get(), itc->second.get());
           // does not contain free assumptions since the range of resCache does
           // not contain free assumptions
           cfaMap[cur.get()] = false;
@@ -200,7 +203,7 @@ bool ProofNodeUpdater::updateProofNode(std::shared_ptr<ProofNode> cur,
 {
   PfRule id = cur->getRule();
   // use CDProof to open a scope for which the callback updates
-  CDProof cpf(d_pnm, nullptr, "ProofNodeUpdater::CDProof", d_autoSym);
+  CDProof cpf(d_env, nullptr, "ProofNodeUpdater::CDProof", d_autoSym);
   const std::vector<std::shared_ptr<ProofNode>>& cc = cur->getChildren();
   std::vector<Node> ccn;
   for (const std::shared_ptr<ProofNode>& cp : cc)
@@ -227,7 +230,7 @@ bool ProofNodeUpdater::updateProofNode(std::shared_ptr<ProofNode> cur,
     }
     // then, update the original proof node based on this one
     Trace("pf-process-debug") << "Update node..." << std::endl;
-    d_pnm->updateNode(cur.get(), npn.get());
+    d_env.getProofNodeManager()->updateNode(cur.get(), npn.get());
     Trace("pf-process-debug") << "...update node finished." << std::endl;
     if (d_debugFreeAssumps)
     {
@@ -236,8 +239,11 @@ bool ProofNodeUpdater::updateProofNode(std::shared_ptr<ProofNode> cur,
       // the proof. We can now debug based on the expected set of free
       // assumptions.
       Trace("pfnu-debug") << "Ensure updated closed..." << std::endl;
-      pfnEnsureClosedWrt(
-          npn.get(), fullFa, "pfnu-debug", "ProofNodeUpdater:postupdate");
+      pfnEnsureClosedWrt(options(),
+                         npn.get(),
+                         fullFa,
+                         "pfnu-debug",
+                         "ProofNodeUpdater:postupdate");
     }
     Trace("pf-process-debug") << "..finished" << std::endl;
     return true;
@@ -286,9 +292,10 @@ void ProofNodeUpdater::runFinalize(
           resCacheNcWaiting.find(res);
       if (itnw != resCacheNcWaiting.end())
       {
+        ProofNodeManager* pnm = d_env.getProofNodeManager();
         for (std::shared_ptr<ProofNode>& ncp : itnw->second)
         {
-          d_pnm->updateNode(ncp.get(), cur.get());
+          pnm->updateNode(ncp.get(), cur.get());
         }
         resCacheNcWaiting.erase(res);
       }
@@ -305,7 +312,7 @@ void ProofNodeUpdater::runFinalize(
     // assumptions.
     Trace("pfnu-debug") << "Ensure update closed..." << std::endl;
     pfnEnsureClosedWrt(
-        cur.get(), fa, "pfnu-debug", "ProofNodeUpdater:finalize");
+        options(), cur.get(), fa, "pfnu-debug", "ProofNodeUpdater:finalize");
   }
 }
 
index 690ccabfa64f7a8dca7cb379242d1ddd2780c733..2724bcb29474aa1392c146b34fca396c43695d81 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "expr/node.h"
 #include "proof/proof_node.h"
+#include "smt/env_obj.h"
 
 namespace cvc5::internal {
 
@@ -94,18 +95,18 @@ class ProofNodeUpdaterCallback
  * should be filled in the callback for each ProofNode to update. This update
  * process is applied in a *pre-order* traversal.
  */
-class ProofNodeUpdater
+class ProofNodeUpdater : protected EnvObj
 {
  public:
   /**
-   * @param pnm The proof node manager we are using
+   * @param env Reference to the environment
    * @param cb The callback to apply to each node
    * @param mergeSubproofs Whether to automatically merge subproofs within
    * the same SCOPE that prove the same fact.
    * @param autoSym Whether intermediate CDProof objects passed to updater
    * callbacks automatically introduce SYMM steps.
    */
-  ProofNodeUpdater(ProofNodeManager* pnm,
+  ProofNodeUpdater(Env& env,
                    ProofNodeUpdaterCallback& cb,
                    bool mergeSubproofs = false,
                    bool autoSym = true);
@@ -125,8 +126,6 @@ class ProofNodeUpdater
   void setDebugFreeAssumptions(const std::vector<Node>& freeAssumps);
 
  private:
-  /** The proof node manager */
-  ProofNodeManager* d_pnm;
   /** The callback */
   ProofNodeUpdaterCallback& d_cb;
   /**
index b54e82eb160c2bc65dea9bc6cb9c029215076dbd..3a4796bfa9ff355fb3feef0b5bab182847d5c72d 100644 (file)
 
 #include "context/cdlist.h"
 #include "context/context.h"
-#include "proof/proof_node_manager.h"
 
 namespace cvc5::internal {
 
+class Env;
+
 /**
  * A (context-dependent) set of proofs, which is used for memory
  * management purposes.
@@ -34,10 +35,8 @@ template <typename T>
 class CDProofSet
 {
  public:
-  CDProofSet(ProofNodeManager* pnm,
-             context::Context* c,
-             std::string namePrefix = "Proof")
-      : d_pnm(pnm), d_proofs(c), d_namePrefix(namePrefix)
+  CDProofSet(Env& env, context::Context* c, std::string namePrefix = "Proof")
+      : d_env(env), d_proofs(c), d_namePrefix(namePrefix)
   {
   }
   /**
@@ -56,15 +55,15 @@ class CDProofSet
   T* allocateProof(Args&&... args)
   {
     d_proofs.push_back(std::make_shared<T>(
-        d_pnm,
+        d_env,
         std::forward<Args>(args)...,
         d_namePrefix + "_" + std::to_string(d_proofs.size())));
     return d_proofs.back().get();
   }
 
  protected:
-  /** The proof node manager */
-  ProofNodeManager* d_pnm;
+  /** Reference to env */
+  Env& d_env;
   /** A context-dependent list of lazy proofs. */
   context::CDList<std::shared_ptr<T>> d_proofs;
   /** The name prefix of the lazy proofs */
index d32ce1107259692dcc440e5c3e371c8c1976b8f9..56cab5ce5d8bb3ca59b3df0c6cba993e816172da 100644 (file)
@@ -128,11 +128,12 @@ Node TrustNode::getPropExpProven(TNode lit, Node exp)
 
 Node TrustNode::getRewriteProven(TNode n, Node nr) { return n.eqNode(nr); }
 
-void TrustNode::debugCheckClosed(const char* c,
+void TrustNode::debugCheckClosed(const Options& opts,
+                                 const char* c,
                                  const char* ctx,
                                  bool reqNullGen)
 {
-  pfgEnsureClosed(d_proven, d_gen, c, ctx, reqNullGen);
+  pfgEnsureClosed(opts, d_proven, d_gen, c, ctx, reqNullGen);
 }
 
 std::string TrustNode::identifyGenerator() const
index 86c69832be60d1b196c72756bb430941148d333b..0a72cb8e7a1637d6ff64f618e9ccb04195bdca46 100644 (file)
@@ -22,6 +22,7 @@
 
 namespace cvc5::internal {
 
+class Options;
 class ProofGenerator;
 class ProofNode;
 
@@ -152,7 +153,10 @@ class TrustNode
    *
    * @param reqNullGen Whether we consider a null generator to be a failure.
    */
-  void debugCheckClosed(const char* c, const char* ctx, bool reqNullGen = true);
+  void debugCheckClosed(const Options& opts,
+                        const char* c,
+                        const char* ctx,
+                        bool reqNullGen = true);
 
  private:
   TrustNode(TrustNodeKind tnk, Node p, ProofGenerator* g = nullptr);
index 939e78f34f29e5b0650af93a7d2a89ee1a467b37..3457ca9cc2446d0f1a0e27963fd288c6680dc42b 100644 (file)
@@ -29,10 +29,7 @@ ProofCnfStream::ProofCnfStream(Env& env,
     : EnvObj(env),
       d_cnfStream(cnfStream),
       d_satPM(satPM),
-      d_proof(env.getProofNodeManager(),
-              nullptr,
-              userContext(),
-              "ProofCnfStream::LazyCDProof"),
+      d_proof(env, nullptr, userContext(), "ProofCnfStream::LazyCDProof"),
       d_blocked(userContext()),
       d_optClausesManager(userContext(), &d_proof, d_optClausesPfs)
 {
index 4d3def85dcad712dd2d7053734f6efb54990bb0c..d6a2b1894c219156810a0a8a6a8d135bbe9da12b 100644 (file)
@@ -21,8 +21,8 @@ namespace cvc5::internal {
 namespace prop {
 
 ProofPostprocessCallback::ProofPostprocessCallback(
-    ProofNodeManager* pnm, ProofCnfStream* proofCnfStream)
-    : d_pnm(pnm), d_proofCnfStream(proofCnfStream)
+    Env& env, ProofCnfStream* proofCnfStream)
+    : EnvObj(env), d_proofCnfStream(proofCnfStream)
 {
 }
 
@@ -94,9 +94,8 @@ bool ProofPostprocessCallback::update(Node res,
   return true;
 }
 
-ProofPostproccess::ProofPostproccess(ProofNodeManager* pnm,
-                                     ProofCnfStream* proofCnfStream)
-    : d_cb(pnm, proofCnfStream), d_pnm(pnm)
+ProofPostproccess::ProofPostproccess(Env& env, ProofCnfStream* proofCnfStream)
+    : EnvObj(env), d_cb(env, proofCnfStream)
 {
 }
 
@@ -108,7 +107,7 @@ void ProofPostproccess::process(std::shared_ptr<ProofNode> pf)
   // how to process, including how to process assumptions in pf.
   d_cb.initializeUpdate();
   // now, process
-  ProofNodeUpdater updater(d_pnm, d_cb);
+  ProofNodeUpdater updater(d_env, d_cb);
   updater.process(pf);
 }
 
index a649ec25687affce2c89c98405f0cf39bffd36f8..ee0858376ea1e26454359a63f878385889b21761 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "proof/proof_node_updater.h"
 #include "prop/proof_cnf_stream.h"
+#include "smt/env_obj.h"
 
 namespace cvc5::internal {
 
@@ -34,11 +35,11 @@ namespace prop {
  * assertions and lemmas, with the CNF transformation of these formulas, while
  * expanding the generators of lemmas.
  */
-class ProofPostprocessCallback : public ProofNodeUpdaterCallback
+class ProofPostprocessCallback : protected EnvObj,
+                                 public ProofNodeUpdaterCallback
 {
  public:
-  ProofPostprocessCallback(ProofNodeManager* pnm,
-                           ProofCnfStream* proofCnfStream);
+  ProofPostprocessCallback(Env& env, ProofCnfStream* proofCnfStream);
   ~ProofPostprocessCallback() {}
   /**
    * Initialize, called once for each new ProofNode to process. This initializes
@@ -74,8 +75,6 @@ class ProofPostprocessCallback : public ProofNodeUpdaterCallback
               bool& continueUpdate) override;
 
  private:
-  /** The proof node manager */
-  ProofNodeManager* d_pnm;
   /** The cnf stream proof generator */
   ProofCnfStream* d_proofCnfStream;
   //---------------------------------reset at the begining of each update
@@ -89,10 +88,10 @@ class ProofPostprocessCallback : public ProofNodeUpdaterCallback
  * produced by the SAT solver. Its main task is to connect the refutation's
  * assumptions to the CNF transformation proof in ProofCnfStream.
  */
-class ProofPostproccess
+class ProofPostproccess : protected EnvObj
 {
  public:
-  ProofPostproccess(ProofNodeManager* pnm, ProofCnfStream* proofCnfStream);
+  ProofPostproccess(Env& env, ProofCnfStream* proofCnfStream);
   ~ProofPostproccess();
   /** post-process
    *
@@ -104,8 +103,6 @@ class ProofPostproccess
  private:
   /** The post process callback */
   ProofPostprocessCallback d_cb;
-  /** The proof node manager */
-  ProofNodeManager* d_pnm;
 };
 
 }  // namespace prop
index 74e78d14d5fdfb6b56759a4492e33e991ff7596e..c0cfe866c276daf0521b2336064929aba03d868d 100644 (file)
@@ -74,9 +74,7 @@ PropEngine::PropEngine(Env& env, TheoryEngine* te)
       d_satSolver(nullptr),
       d_cnfStream(nullptr),
       d_pfCnfStream(nullptr),
-      d_theoryLemmaPg(d_env.getProofNodeManager(),
-                      d_env.getUserContext(),
-                      "PropEngine::ThLemmaPg"),
+      d_theoryLemmaPg(d_env, d_env.getUserContext(), "PropEngine::ThLemmaPg"),
       d_ppm(nullptr),
       d_interrupted(false),
       d_assumptions(d_env.getUserContext())
@@ -127,7 +125,7 @@ PropEngine::PropEngine(Env& env, TheoryEngine* te)
         *d_cnfStream,
         static_cast<MinisatSatSolver*>(d_satSolver)->getProofManager()));
     d_ppm.reset(
-        new PropPfManager(userContext, pnm, d_satSolver, d_pfCnfStream.get()));
+        new PropPfManager(env, userContext, d_satSolver, d_pfCnfStream.get()));
   }
 }
 
@@ -207,11 +205,13 @@ void PropEngine::assertLemma(TrustNode tlemma, theory::LemmaProperty p)
   {
     Assert(tplemma.getGenerator() != nullptr);
     // ensure closed, make the proof node eagerly here to debug
-    tplemma.debugCheckClosed("te-proof-debug", "TheoryEngine::lemma");
+    tplemma.debugCheckClosed(
+        options(), "te-proof-debug", "TheoryEngine::lemma");
     for (theory::SkolemLemma& lem : ppLemmas)
     {
       Assert(lem.d_lemma.getGenerator() != nullptr);
-      lem.d_lemma.debugCheckClosed("te-proof-debug", "TheoryEngine::lemma_new");
+      lem.d_lemma.debugCheckClosed(
+          options(), "te-proof-debug", "TheoryEngine::lemma_new");
     }
   }
 
@@ -726,7 +726,7 @@ std::shared_ptr<ProofNode> PropEngine::getRefutation()
   Assert(options().smt.unsatCoresMode == options::UnsatCoresMode::ASSUMPTIONS);
   std::vector<Node> core;
   getUnsatCore(core);
-  CDProof cdp(d_env.getProofNodeManager());
+  CDProof cdp(d_env);
   Node fnode = NodeManager::currentNM()->mkConst(false);
   cdp.addStep(fnode, PfRule::SAT_REFUTATION, core, {});
   return cdp.getProofFor(fnode);
index 1ec69f784e8e7a2a73277a6522b5404a62148028..1d4ef77249395d57f3a8530a9d90499d2a0eaa0a 100644 (file)
 #include "proof/proof_node_algorithm.h"
 #include "prop/prop_proof_manager.h"
 #include "prop/sat_solver.h"
+#include "smt/env.h"
 
 namespace cvc5::internal {
 namespace prop {
 
-PropPfManager::PropPfManager(context::UserContext* userContext,
-                             ProofNodeManager* pnm,
+PropPfManager::PropPfManager(Env& env,
+                             context::UserContext* userContext,
                              CDCLTSatSolverInterface* satSolver,
                              ProofCnfStream* cnfProof)
-    : d_pnm(pnm),
-      d_pfpp(new ProofPostproccess(pnm, cnfProof)),
+    : EnvObj(env),
+      d_pfpp(new ProofPostproccess(env, cnfProof)),
       d_satSolver(satSolver),
       d_assertions(userContext)
 {
@@ -60,8 +61,11 @@ void PropPfManager::checkProof(const context::CDList<Node>& assertions)
     d_assertions.push_back(assertion);
   }
   std::vector<Node> avec{d_assertions.begin(), d_assertions.end()};
-  pfnEnsureClosedWrt(
-      conflictProof.get(), avec, "sat-proof", "PropPfManager::checkProof");
+  pfnEnsureClosedWrt(options(),
+                     conflictProof.get(),
+                     avec,
+                     "sat-proof",
+                     "PropPfManager::checkProof");
 }
 
 std::shared_ptr<ProofNode> PropPfManager::getProof()
index dfde1d00e710b989ba935b8d6f9ec5c07a455192..b51a4f53b7fa268a5ef866f0cdf7415327a1d145 100644 (file)
@@ -23,6 +23,7 @@
 #include "proof/proof_node_manager.h"
 #include "prop/proof_post_processor.h"
 #include "prop/sat_proof_manager.h"
+#include "smt/env_obj.h"
 
 namespace cvc5::internal {
 
@@ -37,11 +38,11 @@ class CDCLTSatSolverInterface;
  * The expected proof to be built is a refutation proof with preprocessed
  * assertions as free assumptions.
  */
-class PropPfManager
+class PropPfManager : protected EnvObj
 {
  public:
-  PropPfManager(context::UserContext* userContext,
-                ProofNodeManager* pnm,
+  PropPfManager(Env& env,
+                context::UserContext* userContext,
                 CDCLTSatSolverInterface* satSolver,
                 ProofCnfStream* cnfProof);
 
@@ -76,8 +77,6 @@ class PropPfManager
   void checkProof(const context::CDList<Node>& assertions);
 
  private:
-  /** A node manager */
-  ProofNodeManager* d_pnm;
   /** The proof post-processor */
   std::unique_ptr<prop::ProofPostproccess> d_pfpp;
   /**
index c567c319071af1b3ce23f810fbfcc08d35b20156..9d3e89fb54f6b2cf927bad667ba361e214b98394 100644 (file)
@@ -30,8 +30,8 @@ SatProofManager::SatProofManager(Env& env,
     : EnvObj(env),
       d_solver(solver),
       d_cnfStream(cnfStream),
-      d_resChains(d_env.getProofNodeManager(), true, userContext()),
-      d_resChainPg(userContext(), d_env.getProofNodeManager()),
+      d_resChains(d_env, true, userContext()),
+      d_resChainPg(d_env, userContext()),
       d_assumptions(userContext()),
       d_conflictLit(undefSatVariable),
       d_optResLevels(userContext()),
index 9f2d79b632da9628c87a1c812a294db75df5ac0d..13d60b672bc1d360ceb743bfc67128ff46a7de63 100644 (file)
@@ -351,7 +351,7 @@ bool ZeroLevelLearner::isLearnable(modes::LearnedLitType ltype) const
 bool ZeroLevelLearner::getSolved(const Node& lit, Subs& subs)
 {
   context::Context dummyContext;
-  theory::TrustSubstitutionMap subsOut(&dummyContext);
+  theory::TrustSubstitutionMap subsOut(d_env, &dummyContext);
   TrustNode tlit = TrustNode::mkTrustLemma(lit);
   theory::Theory::PPAssertStatus status = d_theoryEngine->solve(tlit, subsOut);
   if (status == theory::Theory::PP_ASSERT_STATUS_SOLVED)
index 00a7a959c3441efd8b5da3d1ba0e637428a0f5fe..1586d8ad52207bbdb4492dfe848745f9df275d9e 100644 (file)
@@ -45,7 +45,7 @@ Env::Env(NodeManager* nm, const Options* opts)
       d_rewriter(new theory::Rewriter()),
       d_evalRew(nullptr),
       d_eval(nullptr),
-      d_topLevelSubs(new theory::TrustSubstitutionMap(d_userContext.get())),
+      d_topLevelSubs(nullptr),
       d_logic(),
       d_statisticsRegistry(std::make_unique<StatisticsRegistry>(*this)),
       d_options(),
@@ -69,13 +69,16 @@ Env::Env(NodeManager* nm, const Options* opts)
 
 Env::~Env() {}
 
-void Env::setProofNodeManager(ProofNodeManager* pnm)
+void Env::finishInit(ProofNodeManager* pnm)
 {
-  Assert(pnm != nullptr);
-  Assert(d_proofNodeManager == nullptr);
-  d_proofNodeManager = pnm;
-  d_rewriter->setProofNodeManager(pnm);
-  d_topLevelSubs->setProofNodeManager(pnm);
+  if (pnm != nullptr)
+  {
+    Assert(d_proofNodeManager == nullptr);
+    d_proofNodeManager = pnm;
+    d_rewriter->finishInit(*this);
+  }
+  d_topLevelSubs.reset(
+      new theory::TrustSubstitutionMap(*this, d_userContext.get()));
 }
 
 void Env::shutdown()
index 260407161fc3c5968f8a83151d12ef58d1341d04..a42ad03411be22988f6e422bb84a6b10f7a1d35c 100644 (file)
@@ -267,7 +267,7 @@ class Env
   /* Private initialization ------------------------------------------------- */
 
   /** Set proof node manager if it exists */
-  void setProofNodeManager(ProofNodeManager* pnm);
+  void finishInit(ProofNodeManager* pnm);
 
   /* Private shutdown ------------------------------------------------------- */
   /**
index d9a61b73fa4ed7c2fab20bac01dc7d9cf3b92737..dcd390601bafb41eafed9a87cff0991c8bfb38b9 100644 (file)
@@ -169,8 +169,7 @@ void ExpandDefs::enableProofs()
   // initialize if not done already
   if (d_tpg == nullptr)
   {
-    Assert(d_env.getProofNodeManager() != nullptr);
-    d_tpg.reset(new TConvProofGenerator(d_env.getProofNodeManager(),
+    d_tpg.reset(new TConvProofGenerator(d_env,
                                         d_env.getUserContext(),
                                         TConvPolicy::FIXPOINT,
                                         TConvCachePolicy::NEVER,
index 2893ccb23cd1cae4548d2a48a17ed27dd144aaee..062c6a9dd26a2dbc681d23b1bf4b5503aa3f5e21 100644 (file)
@@ -23,6 +23,7 @@
 #include "proof/proof.h"
 #include "proof/proof_checker.h"
 #include "proof/proof_node.h"
+#include "proof/proof_node_manager.h"
 #include "smt/env.h"
 #include "theory/quantifiers/extended_rewrite.h"
 
@@ -34,8 +35,8 @@ PreprocessProofGenerator::PreprocessProofGenerator(
     : EnvObj(env),
       d_ctx(c ? c : &d_context),
       d_src(d_ctx),
-      d_helperProofs(env.getProofNodeManager(), d_ctx),
-      d_inputPf(env.getProofNodeManager(), c, "InputProof"),
+      d_helperProofs(env, d_ctx),
+      d_inputPf(env, c, "InputProof"),
       d_name(name),
       d_ra(ra),
       d_rpp(rpp)
@@ -128,7 +129,7 @@ std::shared_ptr<ProofNode> PreprocessProofGenerator::getProofFor(Node f)
     return nullptr;
   }
   // make CDProof to construct the proof below
-  CDProof cdp(d_env.getProofNodeManager());
+  CDProof cdp(d_env);
 
   Node curr = f;
   std::vector<Node> transChildren;
index 4099df7715f3b57ad3ae5b0dd7cb17a7edcbc505..482239a4d81357a8bc4dc5550584c2031e83e03f 100644 (file)
@@ -48,8 +48,6 @@ PfManager::PfManager(Env& env)
       d_pfpp(nullptr),
       d_finalProof(nullptr)
 {
-  // enable proof support in the environment/rewriter
-  d_env.setProofNodeManager(d_pnm.get());
   // now construct preprocess proof generator
   d_pppg = std::make_unique<PreprocessProofGenerator>(
       env, env.getUserContext(), "smt::PreprocessProofGenerator");
@@ -185,7 +183,7 @@ void PfManager::printProof(std::ostream& out,
   {
     proof::AletheNodeConverter anc;
     proof::AletheProofPostprocess vpfpp(
-        d_pnm.get(), anc, options().proof.proofAletheResPivots);
+        d_env, anc, options().proof.proofAletheResPivots);
     vpfpp.process(fp);
     proof::AletheProofPrinter vpp;
     vpp.print(out, fp);
@@ -195,7 +193,7 @@ void PfManager::printProof(std::ostream& out,
     std::vector<Node> assertions;
     getAssertions(as, assertions);
     proof::LfscNodeConverter ltp;
-    proof::LfscProofPostprocess lpp(ltp, d_pnm.get());
+    proof::LfscProofPostprocess lpp(d_env, ltp);
     lpp.process(fp);
     proof::LfscPrinter lp(ltp);
     lp.print(out, assertions, fp.get());
@@ -250,7 +248,7 @@ void PfManager::translateDifficultyMap(std::map<Node, Node>& dmap,
   Trace("difficulty-proc") << "Make SAT refutation" << std::endl;
   // assume a SAT refutation from all input assertions that were marked
   // as having a difficulty
-  CDProof cdp(d_pnm.get());
+  CDProof cdp(d_env);
   Node fnode = NodeManager::currentNM()->mkConst(false);
   cdp.addStep(fnode, PfRule::SAT_REFUTATION, ppAsserts, {});
   std::shared_ptr<ProofNode> pf = cdp.getProofFor(fnode);
@@ -263,7 +261,7 @@ void PfManager::translateDifficultyMap(std::map<Node, Node>& dmap,
   Assert(fpf->getRule() == PfRule::SAT_REFUTATION);
   const std::vector<std::shared_ptr<ProofNode>>& children = fpf->getChildren();
   DifficultyPostprocessCallback dpc;
-  ProofNodeUpdater dpnu(d_pnm.get(), dpc);
+  ProofNodeUpdater dpnu(d_env, dpc);
   Trace("difficulty-proc") << "Compute accumulated difficulty" << std::endl;
   // For each child of SAT_REFUTATION, we increment the difficulty on all
   // "source" free assumptions (see DifficultyPostprocessCallback) by the
index 029bfdfcd0450564de4ddf3650e827b993ecd99d..ca5cd2277ec0f9dc3065faecbc9c21f8e6538bff 100644 (file)
@@ -41,7 +41,6 @@ ProofPostprocessCallback::ProofPostprocessCallback(Env& env,
                                                    rewriter::RewriteDb* rdb,
                                                    bool updateScopedAssumptions)
     : EnvObj(env),
-      d_pnm(env.getProofNodeManager()),
       d_pppg(pppg),
       d_wfpm(env),
       d_updateScopedAssumptions(updateScopedAssumptions)
@@ -316,6 +315,7 @@ Node ProofPostprocessCallback::eliminateCrowdingLits(
   std::vector<Node> childrenResArgs;
   Node resPlaceHolder;
   size_t nextGuardedElimPos = eliminators[0];
+  ProofNodeManager* pnm = d_env.getProofNodeManager();
   do
   {
     size_t start = lastElim + 1;
@@ -333,11 +333,11 @@ Node ProofPostprocessCallback::eliminateCrowdingLits(
                            args.begin() + (2 * end) + 1);
     Trace("smt-proof-pp-debug2") << "\tres children: " << childrenRes << "\n";
     Trace("smt-proof-pp-debug2") << "\tres args: " << childrenResArgs << "\n";
-    resPlaceHolder = d_pnm->getChecker()->checkDebug(PfRule::CHAIN_RESOLUTION,
-                                                     childrenRes,
-                                                     childrenResArgs,
-                                                     Node::null(),
-                                                     "");
+    resPlaceHolder = pnm->getChecker()->checkDebug(PfRule::CHAIN_RESOLUTION,
+                                                   childrenRes,
+                                                   childrenResArgs,
+                                                   Node::null(),
+                                                   "");
     Trace("smt-proof-pp-debug2")
         << "resPlaceHorder: " << resPlaceHolder << "\n";
     Trace("smt-proof-pp-debug2") << "-------\n";
@@ -347,7 +347,7 @@ Node ProofPostprocessCallback::eliminateCrowdingLits(
     // to be handled by the caller
     if (end < children.size() - 1)
     {
-      lastClause = d_pnm->getChecker()->checkDebug(
+      lastClause = pnm->getChecker()->checkDebug(
           PfRule::FACTORING, {resPlaceHolder}, {}, Node::null(), "");
       if (!lastClause.isNull())
       {
@@ -666,9 +666,10 @@ Node ProofPostprocessCallback::expandMacros(PfRule id,
   else if (id == PfRule::MACRO_RESOLUTION
            || id == PfRule::MACRO_RESOLUTION_TRUST)
   {
+    ProofNodeManager* pnm = d_env.getProofNodeManager();
     // first generate the naive chain_resolution
     std::vector<Node> chainResArgs{args.begin() + 1, args.end()};
-    Node chainConclusion = d_pnm->getChecker()->checkDebug(
+    Node chainConclusion = pnm->getChecker()->checkDebug(
         PfRule::CHAIN_RESOLUTION, children, chainResArgs, Node::null(), "");
     Trace("smt-proof-pp-debug") << "Original conclusion: " << args[0] << "\n";
     Trace("smt-proof-pp-debug")
@@ -886,10 +887,10 @@ Node ProofPostprocessCallback::expandMacros(PfRule id,
               << "......updated to " << var << " -> " << ss
               << " based on previous substitution" << std::endl;
           // make the proof for the tranitivity step
-          std::shared_ptr<CDProof> pf = std::make_shared<CDProof>(d_pnm);
+          std::shared_ptr<CDProof> pf = std::make_shared<CDProof>(d_env);
           pfs.push_back(pf);
           // prove the updated substitution
-          TConvProofGenerator tcg(d_pnm,
+          TConvProofGenerator tcg(d_env,
                                   nullptr,
                                   TConvPolicy::ONCE,
                                   TConvCachePolicy::NEVER,
@@ -934,7 +935,7 @@ Node ProofPostprocessCallback::expandMacros(PfRule id,
     // should be implied by the substitution now
     TConvPolicy tcpolicy = ida == MethodId::SBA_FIXPOINT ? TConvPolicy::FIXPOINT
                                                          : TConvPolicy::ONCE;
-    TConvProofGenerator tcpg(d_pnm,
+    TConvProofGenerator tcpg(d_env,
                              nullptr,
                              tcpolicy,
                              TConvCachePolicy::NEVER,
@@ -1082,9 +1083,10 @@ Node ProofPostprocessCallback::expandMacros(PfRule id,
     Assert(!args.empty());
     Node eq = args[0];
     Assert(eq.getKind() == EQUAL);
+    ProofNodeManager* pnm = d_env.getProofNodeManager();
     // try to replay theory rewrite
     // first, check that maybe its just an evaluation step
-    ProofChecker* pc = d_pnm->getChecker();
+    ProofChecker* pc = pnm->getChecker();
     Node ceval =
         pc->checkDebug(PfRule::EVALUATE, {}, {eq[0]}, eq, "smt-proof-pp-debug");
     if (!ceval.isNull() && ceval == eq)
@@ -1107,8 +1109,9 @@ Node ProofPostprocessCallback::expandMacros(PfRule id,
       Trace("macro::arith") << "   args: " << args << std::endl;
     }
     Assert(args.size() == children.size());
+    ProofNodeManager* pnm = d_env.getProofNodeManager();
     NodeManager* nm = NodeManager::currentNM();
-    ProofStepBuffer steps{d_pnm->getChecker()};
+    ProofStepBuffer steps{pnm->getChecker()};
 
     // Scale all children, accumulating
     std::vector<Node> scaledRels;
@@ -1164,7 +1167,7 @@ Node ProofPostprocessCallback::expandMacros(PfRule id,
   }
   else if (id == PfRule::BV_BITBLAST)
   {
-    bv::BBProof bb(d_env, nullptr, d_pnm, true);
+    bv::BBProof bb(d_env, nullptr, true);
     Node eq = args[0];
     Assert(eq.getKind() == EQUAL);
     bb.bbAtom(eq[0]);
@@ -1267,9 +1270,9 @@ ProofPostproccess::ProofPostproccess(Env& env,
     : EnvObj(env),
       d_cb(env, pppg, rdb, updateScopedAssumptions),
       // the update merges subproofs
-      d_updater(env.getProofNodeManager(), d_cb, options().proof.proofPpMerge),
+      d_updater(env, d_cb, options().proof.proofPpMerge),
       d_finalCb(env),
-      d_finalizer(env.getProofNodeManager(), d_finalCb)
+      d_finalizer(env, d_finalCb)
 {
 }
 
index 0ee7c31fa488882ce5bc9f26eea0e14610518aea..4337b377e4804347c6dce08613fc4a4e3cf97ffb 100644 (file)
@@ -76,8 +76,6 @@ class ProofPostprocessCallback : public ProofNodeUpdaterCallback, protected EnvO
  private:
   /** Common constants */
   Node d_true;
-  /** Pointer to the proof node manager */
-  ProofNodeManager* d_pnm;
   /** The preprocessing proof generator */
   ProofGenerator* d_pppg;
   /** The witness form proof generator */
index 876f475ff80bd65090e6a9a5a8f277bf4ccef375..e6a8046530e61ca299980f49098326b84a67c9e5 100644 (file)
@@ -188,6 +188,7 @@ void SolverEngine::finishInit()
   SetDefaults sdefaults(*d_env, d_isInternalSubsolver);
   sdefaults.setDefaults(d_env->d_logic, getOptions());
 
+  ProofNodeManager* pnm = nullptr;
   if (d_env->getOptions().smt.produceProofs)
   {
     // ensure bound variable uses canonical bound variables
@@ -201,7 +202,10 @@ void SolverEngine::finishInit()
     d_asserts->enableProofs(pppg);
     // enabled proofs in the preprocessor
     d_smtSolver->getPreprocessor()->enableProofs(pppg);
+    pnm = d_pfManager->getProofNodeManager();
   }
+  // enable proof support in the environment/rewriter
+  d_env->finishInit(pnm);
 
   Trace("smt-debug") << "SolverEngine::finishInit" << std::endl;
   d_smtSolver->finishInit();
index 967c1fcf9cfa48affcba8578a0a556b87f2610c3..f4f15f8e30700194566163ccbe687b13b011c349 100644 (file)
@@ -42,20 +42,20 @@ RemoveTermFormulas::RemoveTermFormulas(Env& env)
   if (pnm != nullptr)
   {
     d_tpg.reset(
-        new TConvProofGenerator(pnm,
+        new TConvProofGenerator(env,
                                 nullptr,
                                 TConvPolicy::FIXPOINT,
                                 TConvCachePolicy::NEVER,
                                 "RemoveTermFormulas::TConvProofGenerator",
                                 &d_rtfc));
     d_tpgi.reset(
-        new TConvProofGenerator(pnm,
+        new TConvProofGenerator(env,
                                 nullptr,
                                 TConvPolicy::ONCE,
                                 TConvCachePolicy::NEVER,
                                 "RemoveTermFormulas::TConvProofGenerator"));
     d_lp.reset(new LazyCDProof(
-        pnm, nullptr, nullptr, "RemoveTermFormulas::LazyCDProof"));
+        env, nullptr, nullptr, "RemoveTermFormulas::LazyCDProof"));
   }
 }
 
@@ -475,8 +475,8 @@ Node RemoveTermFormulas::runCurrentInternal(TNode node,
       newLem = TrustNode::mkTrustLemma(newAssertion, d_lp.get());
 
       Trace("rtf-proof-debug") << "Checking closed..." << std::endl;
-      newLem.debugCheckClosed("rtf-proof-debug",
-                              "RemoveTermFormulas::run:new_assert");
+      newLem.debugCheckClosed(
+          options(), "rtf-proof-debug", "RemoveTermFormulas::run:new_assert");
     }
 
     // The representation is now the skolem
index 36dc798cf8cf6ebe0fff56ff9bbc5c06a9ae51b3..172a9d8efd8cbf77b12434f1591417deea4c9fa9 100644 (file)
@@ -24,19 +24,15 @@ namespace smt {
 
 WitnessFormGenerator::WitnessFormGenerator(Env& env)
     : d_rewriter(env.getRewriter()),
-      d_tcpg(env.getProofNodeManager(),
+      d_tcpg(env,
              nullptr,
              TConvPolicy::FIXPOINT,
              TConvCachePolicy::NEVER,
              "WfGenerator::TConvProofGenerator",
              nullptr,
              true),
-      d_wintroPf(env.getProofNodeManager(),
-                 nullptr,
-                 nullptr,
-                 "WfGenerator::LazyCDProof"),
-      d_pskPf(
-          env.getProofNodeManager(), nullptr, "WfGenerator::PurifySkolemProof")
+      d_wintroPf(env, nullptr, nullptr, "WfGenerator::LazyCDProof"),
+      d_pskPf(env, nullptr, "WfGenerator::PurifySkolemProof")
 {
 }
 
index d51652e8f9ff5e83fe4b2ddf73d61669c0a69415..77bb2a958684d7d41a5c9474b020ee747f58c234 100644 (file)
@@ -31,14 +31,12 @@ namespace arith {
 BranchAndBound::BranchAndBound(Env& env,
                                ArithState& s,
                                InferenceManager& im,
-                               PreprocessRewriteEq& ppre,
-                               ProofNodeManager* pnm)
+                               PreprocessRewriteEq& ppre)
     : EnvObj(env),
       d_astate(s),
       d_im(im),
       d_ppre(ppre),
-      d_pfGen(new EagerProofGenerator(pnm, userContext())),
-      d_pnm(pnm)
+      d_pfGen(new EagerProofGenerator(env, userContext()))
 {
 }
 
@@ -78,6 +76,7 @@ TrustNode BranchAndBound::branchIntegerVariable(TNode var, Rational value)
     Trace("integers") << "l: " << l << std::endl;
     if (proofsEnabled())
     {
+      ProofNodeManager* pnm = d_env.getProofNodeManager();
       Node less = nm->mkNode(LT, var, nm->mkConstInt(nearest));
       Node greater = nm->mkNode(GT, var, nm->mkConstInt(nearest));
       // TODO (project #37): justify. Thread proofs through *ensureLiteral*.
@@ -86,30 +85,29 @@ TrustNode BranchAndBound::branchIntegerVariable(TNode var, Rational value)
       Trace("integers::pf") << "literal: " << literal << std::endl;
       Trace("integers::pf") << "eq: " << eq << std::endl;
       Trace("integers::pf") << "rawEq: " << rawEq << std::endl;
-      Pf pfNotLit = d_pnm->mkAssume(literal.negate());
+      Pf pfNotLit = pnm->mkAssume(literal.negate());
       // rewrite notLiteral to notRawEq, using teq.
       Pf pfNotRawEq =
           literal == rawEq
               ? pfNotLit
-              : d_pnm->mkNode(
-                    PfRule::MACRO_SR_PRED_TRANSFORM,
-                    {pfNotLit,
-                     teq.getGenerator()->getProofFor(teq.getProven())},
-                    {rawEq.negate()});
-      Pf pfBot = d_pnm->mkNode(
-          PfRule::CONTRA,
-          {d_pnm->mkNode(PfRule::ARITH_TRICHOTOMY,
-                         {d_pnm->mkAssume(less.negate()), pfNotRawEq},
-                         {greater}),
-           d_pnm->mkAssume(greater.negate())},
-          {});
+              : pnm->mkNode(
+                  PfRule::MACRO_SR_PRED_TRANSFORM,
+                  {pfNotLit, teq.getGenerator()->getProofFor(teq.getProven())},
+                  {rawEq.negate()});
+      Pf pfBot =
+          pnm->mkNode(PfRule::CONTRA,
+                      {pnm->mkNode(PfRule::ARITH_TRICHOTOMY,
+                                   {pnm->mkAssume(less.negate()), pfNotRawEq},
+                                   {greater}),
+                       pnm->mkAssume(greater.negate())},
+                      {});
       std::vector<Node> assumptions = {
           literal.negate(), less.negate(), greater.negate()};
       // Proof of (not (and (not (= v i)) (not (< v i)) (not (> v i))))
-      Pf pfNotAnd = d_pnm->mkScope(pfBot, assumptions);
-      Pf pfL = d_pnm->mkNode(PfRule::MACRO_SR_PRED_TRANSFORM,
-                             {d_pnm->mkNode(PfRule::NOT_AND, {pfNotAnd}, {})},
-                             {l});
+      Pf pfNotAnd = pnm->mkScope(pfBot, assumptions);
+      Pf pfL = pnm->mkNode(PfRule::MACRO_SR_PRED_TRANSFORM,
+                           {pnm->mkNode(PfRule::NOT_AND, {pfNotAnd}, {})},
+                           {l});
       lem = d_pfGen->mkTrustNode(l, pfL);
     }
     else
@@ -136,7 +134,10 @@ TrustNode BranchAndBound::branchIntegerVariable(TNode var, Rational value)
   return lem;
 }
 
-bool BranchAndBound::proofsEnabled() const { return d_pnm != nullptr; }
+bool BranchAndBound::proofsEnabled() const
+{
+  return d_env.isTheoryProofProducing();
+}
 
 }  // namespace arith
 }  // namespace theory
index bb7e2140a541e1ff908b53bfb6aef45e20df65d9..8c7859d93253fff56240c45940a43b960b33dcff 100644 (file)
@@ -44,8 +44,7 @@ class BranchAndBound : protected EnvObj
   BranchAndBound(Env& env,
                  ArithState& s,
                  InferenceManager& im,
-                 PreprocessRewriteEq& ppre,
-                 ProofNodeManager* pnm);
+                 PreprocessRewriteEq& ppre);
   ~BranchAndBound() {}
   /**
    * Branch variable, called when integer var has given value
@@ -64,8 +63,6 @@ class BranchAndBound : protected EnvObj
   PreprocessRewriteEq& d_ppre;
   /** Proof generator. */
   std::unique_ptr<EagerProofGenerator> d_pfGen;
-  /** Proof node manager */
-  ProofNodeManager* d_pnm;
 };
 
 }  // namespace arith
index bcceb37d0b1dfbf31f4fe8b829d067579ee051db..a360485c4273cbd0f67051723affe91a4644586c 100644 (file)
@@ -59,10 +59,10 @@ ArithCongruenceManager::ArithCongruenceManager(
       // Construct d_pfGenEe with the SAT context, since its proof include
       // unclosed assumptions of theory literals.
       d_pfGenEe(new EagerProofGenerator(
-          d_pnm, context(), "ArithCongruenceManager::pfGenEe")),
+          d_env, context(), "ArithCongruenceManager::pfGenEe")),
       // Construct d_pfGenEe with the USER context, since its proofs are closed.
       d_pfGenExplain(new EagerProofGenerator(
-          d_pnm, userContext(), "ArithCongruenceManager::pfGenExplain")),
+          d_env, userContext(), "ArithCongruenceManager::pfGenExplain")),
       d_pfee(nullptr)
 {
 }
index 697267f7af7731fe09a29f69f1d3f738d1e4607d..8412eda193c3088e15b42e186cff6776bc428ce2 100644 (file)
@@ -95,7 +95,7 @@ TheoryArithPrivate::TheoryArithPrivate(TheoryArith& containing,
       d_pnm(d_env.isTheoryProofProducing() ? d_env.getProofNodeManager()
                                            : nullptr),
       d_checker(),
-      d_pfGen(new EagerProofGenerator(d_pnm, userContext())),
+      d_pfGen(new EagerProofGenerator(env, userContext())),
       d_constraintDatabase(d_env,
                            d_partialModel,
                            d_congruenceManager,
index 24171c8a3dc28840f97953a70d5f3c46950db732..14fbe2f763c856314338ada75b5b9563428dc144 100644 (file)
@@ -49,8 +49,7 @@ CDCAC::CDCAC(Env& env, const std::vector<poly::Variable>& ordering)
 {
   if (d_env.isTheoryProofProducing())
   {
-    d_proof.reset(
-        new CoveringsProofGenerator(userContext(), d_env.getProofNodeManager()));
+    d_proof.reset(new CoveringsProofGenerator(env, userContext()));
   }
 }
 
index 53a9f0c912267f1ed459ee104bccb7bd6e698708..9931e71fc36fd708827311c29a1a6b38ae9962f1 100644 (file)
@@ -92,9 +92,9 @@ Node mkIRP(const Node& var,
 
 }  // namespace
 
-CoveringsProofGenerator::CoveringsProofGenerator(context::Context* ctx,
-                                                 ProofNodeManager* pnm)
-    : d_pnm(pnm), d_proofs(pnm, ctx), d_current(nullptr)
+CoveringsProofGenerator::CoveringsProofGenerator(Env& env,
+                                                 context::Context* ctx)
+    : EnvObj(env), d_proofs(env, ctx), d_current(nullptr)
 {
   d_false = NodeManager::currentNM()->mkConst(false);
   d_zero = NodeManager::currentNM()->mkConstReal(Rational(0));
index f40136b142aa17725560aabe5a68482e167778aa..35c2c98284cc75c87b754f76ffb27546f10dfaa4 100644 (file)
@@ -27,6 +27,7 @@
 #include "expr/node.h"
 #include "proof/lazy_tree_proof_generator.h"
 #include "proof/proof_set.h"
+#include "smt/env_obj.h"
 #include "theory/arith/nl/coverings/cdcac_utils.h"
 
 namespace cvc5::internal {
@@ -50,12 +51,12 @@ namespace coverings {
  * It uses a LazyTreeProofGenerator internally to manage the tree-based proof
  * construction.
  */
-class CoveringsProofGenerator
+class CoveringsProofGenerator : protected EnvObj
 {
  public:
   friend std::ostream& operator<<(std::ostream& os,
                                   const CoveringsProofGenerator& proof);
-  CoveringsProofGenerator(context::Context* ctx, ProofNodeManager* pnm);
+  CoveringsProofGenerator(Env& env, context::Context* ctx);
 
   /** Start a new proof in this proof generator */
   void startNewProof();
@@ -130,8 +131,6 @@ class CoveringsProofGenerator
                                   VariableMapper& vm);
 
  private:
-  /** The proof node manager used for the proofs */
-  ProofNodeManager* d_pnm;
   /** The list of generated proofs */
   CDProofSet<LazyTreeProofGenerator> d_proofs;
   /** The current proof */
index 1ef35b66a5177da0f30e6c19d0c8ef01ad66db5e..5cb837de6a8b91af2ba13234e8c1ab57c5763809 100644 (file)
@@ -32,18 +32,17 @@ namespace theory {
 namespace arith {
 namespace nl {
 
-ExtState::ExtState(InferenceManager& im, NlModel& model, Env& env)
-    : d_im(im), d_model(model), d_env(env)
+ExtState::ExtState(Env& env, InferenceManager& im, NlModel& model)
+    : EnvObj(env), d_im(im), d_model(model)
 {
   d_false = NodeManager::currentNM()->mkConst(false);
   d_true = NodeManager::currentNM()->mkConst(true);
   d_zero = NodeManager::currentNM()->mkConstInt(Rational(0));
   d_one = NodeManager::currentNM()->mkConstInt(Rational(1));
   d_neg_one = NodeManager::currentNM()->mkConstInt(Rational(-1));
-  if (d_env.isTheoryProofProducing())
+  if (env.isTheoryProofProducing())
   {
-    d_proof.reset(new CDProofSet<CDProof>(
-        d_env.getProofNodeManager(), d_env.getUserContext(), "nl-ext"));
+    d_proof.reset(new CDProofSet<CDProof>(env, env.getUserContext(), "nl-ext"));
   }
 }
 
index 7014aa3e41eb9a7c311b079b749cd7e3266965fc..1e438a9d5f1f2463f49ca65b5ce5b99d4513f17a 100644 (file)
@@ -36,9 +36,10 @@ namespace nl {
 
 class NlModel;
 
-struct ExtState
+class ExtState : protected EnvObj
 {
-  ExtState(InferenceManager& im, NlModel& model, Env& env);
+ public:
+  ExtState(Env& env, InferenceManager& im, NlModel& model);
 
   void init(const std::vector<Node>& xts);
 
@@ -61,8 +62,6 @@ struct ExtState
   InferenceManager& d_im;
   /** Reference to the non-linear model object */
   NlModel& d_model;
-  /** Reference to the environment */
-  Env& d_env;
   /**
    * A CDProofSet that hands out CDProof objects for lemmas.
    */
index 1220010e44028ef76de11cb2c3517030206e7214..63e30bf99bdfe9191ee62c8500cbab854696a1fe 100644 (file)
@@ -29,7 +29,7 @@ namespace theory {
 namespace arith {
 namespace nl {
 
-struct ExtState;
+class ExtState;
 
 class FactoringCheck : protected EnvObj
 {
index 352f1e884088d1e11eb058b5c513b9d4eeb702b1..311119953d737e47f254e1f9294b38a83dddcbf6 100644 (file)
@@ -209,7 +209,7 @@ void MonomialBoundsCheck::checkBounds(const std::vector<Node>& asserts,
       }
       // compute if bound is not satisfied, and store what is required
       // for a possible refinement
-      if (d_data->d_env.getOptions().arith.nlExtTangentPlanes)
+      if (options().arith.nlExtTangentPlanes)
       {
         if (is_false_lit)
         {
@@ -346,9 +346,7 @@ void MonomialBoundsCheck::checkBounds(const std::vector<Node>& asserts,
                                            : PfRule::ARITH_MULT_NEG,
                              {},
                              {mult, simpleeq});
-              theory::Rewriter* rew = d_data->d_env.getRewriter();
-              if (type == Kind::EQUAL
-                  && (rew->rewrite(simpleeq) != rew->rewrite(exp[1])))
+              if (type == Kind::EQUAL && (rewrite(simpleeq) != rewrite(exp[1])))
               {
                 // it is not identical under rewriting and we need to do some work here
                 // The proof looks like this:
@@ -379,7 +377,7 @@ void MonomialBoundsCheck::checkBounds(const std::vector<Node>& asserts,
                                {nm->mkConstInt(Rational(1))});
                 Node lb = nm->mkNode(Kind::GEQ, simpleeq[0], simpleeq[1]);
                 Node rb = nm->mkNode(Kind::LEQ, simpleeq[0], simpleeq[1]);
-                if (rew->rewrite(lb) == rew->rewrite(exp[1][0]))
+                if (rewrite(lb) == rewrite(exp[1][0]))
                 {
                   proof->addStep(
                       lb, PfRule::MACRO_SR_PRED_TRANSFORM, {exp[1][0]}, {lb});
index 6e9f3456eb7d0c599c915f2cafa00df6517bbb1e..ed2ab732cb3b3e7ab9a4dcbe7147b19dbd77b3bf 100644 (file)
@@ -25,7 +25,7 @@ namespace theory {
 namespace arith {
 namespace nl {
 
-struct ExtState;
+class ExtState;
 
 class MonomialBoundsCheck : protected EnvObj
 {
index 9929a8d36e2c0266e22ed2407acf5d61a93e82c3..6bf4f72ad50610d8705023935af73f199ddd6508 100644 (file)
@@ -26,7 +26,7 @@ namespace theory {
 namespace arith {
 namespace nl {
 
-struct ExtState;
+class ExtState;
 
 class MonomialCheck : protected EnvObj
 {
index 398c322bf230340240c4c63f6db10d2dfe40a6aa..e8e0fb7a1fdd0de28d8fc06572f8d5df8f8a4d4b 100644 (file)
@@ -25,7 +25,7 @@ namespace theory {
 namespace arith {
 namespace nl {
 
-struct ExtState;
+class ExtState;
 
 class SplitZeroCheck : protected EnvObj
 {
index 6c77e21adc940c0c56c2312221cb3541255cab49..a256658b72813d15a2bf5f0fc3ca53525188a560 100644 (file)
@@ -26,7 +26,7 @@ namespace theory {
 namespace arith {
 namespace nl {
 
-struct ExtState;
+class ExtState;
 
 class TangentPlaneCheck : protected EnvObj
 {
index 611cb6e813b3ea72d357c1e94fa92bf04b66e828..0855f5a3ba27517892b1a66bf07a3bcd3e31423c 100644 (file)
@@ -51,7 +51,7 @@ NonlinearExtension::NonlinearExtension(Env& env,
       d_extTheory(env, d_extTheoryCb, d_im),
       d_model(env),
       d_trSlv(d_env, d_astate, d_im, d_model),
-      d_extState(d_im, d_model, d_env),
+      d_extState(d_env, d_im, d_model),
       d_factoringSlv(d_env, &d_extState),
       d_monomialBoundsSlv(d_env, &d_extState),
       d_monomialSlv(d_env, &d_extState),
index dfb011c4b66721fef08b3f4f54e69ae1eaabd5a6..67f0366ea2fa31f91c27b29d328712fd64b0f01d 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "expr/skolem_manager.h"
 #include "proof/proof.h"
+#include "proof/proof_node_manager.h"
 #include "theory/arith/arith_utilities.h"
 #include "theory/arith/inference_manager.h"
 #include "theory/arith/nl/nl_model.h"
@@ -48,8 +49,8 @@ TranscendentalState::TranscendentalState(Env& env,
   d_neg_one = NodeManager::currentNM()->mkConstInt(Rational(-1));
   if (d_env.isTheoryProofProducing())
   {
-    d_proof.reset(new CDProofSet<CDProof>(
-        d_env.getProofNodeManager(), d_env.getUserContext(), "nl-trans"));
+    d_proof.reset(
+        new CDProofSet<CDProof>(d_env, d_env.getUserContext(), "nl-trans"));
     d_proofChecker.reset(new TranscendentalProofRuleChecker());
     d_proofChecker->registerTo(d_env.getProofNodeManager()->getChecker());
   }
index 7981c4fbaf1c93036440472e88b79dcf55be5364..65caeb3d3f4b527031f6ea6a279d89e186269d6d 100644 (file)
@@ -33,10 +33,7 @@ namespace cvc5::internal {
 namespace theory {
 namespace arith {
 
-OperatorElim::OperatorElim(Env& env)
-    : EnvObj(env), EagerProofGenerator(d_env.getProofNodeManager())
-{
-}
+OperatorElim::OperatorElim(Env& env) : EagerProofGenerator(env) {}
 
 void OperatorElim::checkNonLinearLogic(Node term)
 {
@@ -462,7 +459,7 @@ bool OperatorElim::usePartialFunction(SkolemFunId id) const
 SkolemLemma OperatorElim::mkSkolemLemma(Node lem, Node k)
 {
   TrustNode tlem;
-  if (d_pnm != nullptr)
+  if (d_env.isTheoryProofProducing())
   {
     tlem = mkTrustNode(lem, PfRule::THEORY_PREPROCESS_LEMMA, {}, {lem});
   }
index 45bc899c28e49d07b1ab421f786752f45bc124ec..e91e8d1a99ca41a5db97fff66892a01153ee30ff 100644 (file)
@@ -31,7 +31,7 @@ class TConvProofGenerator;
 namespace theory {
 namespace arith {
 
-class OperatorElim : protected EnvObj, public EagerProofGenerator
+class OperatorElim : public EagerProofGenerator
 {
  public:
   OperatorElim(Env& env);
index 6bb4b180d87fce6a9d18a5258be0f1695f69566b..0e0d10a1618eadc4338ee2c2035b57812475a963 100644 (file)
@@ -25,8 +25,7 @@ namespace theory {
 namespace arith {
 
 PreprocessRewriteEq::PreprocessRewriteEq(Env& env)
-    : EnvObj(env),
-      d_ppPfGen(d_env.getProofNodeManager(), context(), "Arith::ppRewrite")
+    : EnvObj(env), d_ppPfGen(env, context(), "Arith::ppRewrite")
 {
 }
 
index e47abdac799630912859609bda1ea6f6be7a7f8d..b206322384f33bcbf26ca5298ba4958a2a721181 100644 (file)
@@ -44,7 +44,7 @@ TheoryArith::TheoryArith(Env& env, OutputChannel& out, Valuation valuation)
       d_astate(env, valuation),
       d_im(env, *this, d_astate),
       d_ppre(d_env),
-      d_bab(env, d_astate, d_im, d_ppre, d_pnm),
+      d_bab(env, d_astate, d_im, d_ppre),
       d_eqSolver(nullptr),
       d_internal(new linear::TheoryArithPrivate(*this, env, d_bab)),
       d_nonlinearExtension(nullptr),
index 2e44598c71e7d7c8245fb3e4090b84969d269c7c..8901832b808ca2720a4371576068cfe24635af74 100644 (file)
@@ -29,11 +29,9 @@ namespace arrays {
 
 InferenceManager::InferenceManager(Env& env, Theory& t, TheoryState& state)
     : TheoryInferenceManager(env, t, state, "theory::arrays::", false),
-      d_lemmaPg(isProofEnabled()
-                    ? new EagerProofGenerator(env.getProofNodeManager(),
-                                              userContext(),
-                                              "ArrayLemmaProofGenerator")
-                    : nullptr)
+      d_lemmaPg(isProofEnabled() ? new EagerProofGenerator(
+                    env, userContext(), "ArrayLemmaProofGenerator")
+                                 : nullptr)
 {
 }
 
index bed9031c78644c93e13dad6bac08338f6dbfa78c..02f375a0701b46c42eca5b4f955db5550477618d 100644 (file)
@@ -79,7 +79,7 @@ TheoryArrays::TheoryArrays(Env& env,
           name + "number of setModelVal conflicts")),
       d_ppEqualityEngine(d_env, userContext(), name + "pp", true),
       d_ppFacts(userContext()),
-      d_rewriter(env.getRewriter(), d_pnm),
+      d_rewriter(env),
       d_state(env, valuation),
       d_im(env, *this, d_state),
       d_literalsToPropagate(context()),
index 4aad2bf9a43485be9c4ce41ab5bce6add04b59ad..7af0af62d11d2d2619fed47ec10b9f1af88bf653 100644 (file)
@@ -22,6 +22,7 @@
 #include "expr/attribute.h"
 #include "proof/conv_proof_generator.h"
 #include "proof/eager_proof_generator.h"
+#include "smt/env.h"
 #include "theory/arrays/skolem_cache.h"
 #include "theory/type_enumerator.h"
 #include "util/cardinality.h"
@@ -58,9 +59,10 @@ void setMostFrequentValueCount(TNode store, uint64_t count) {
   return store.setAttribute(ArrayConstantMostFrequentValueCountAttr(), count);
 }
 
-TheoryArraysRewriter::TheoryArraysRewriter(Rewriter* rewriter,
-                                           ProofNodeManager* pnm)
-    : d_rewriter(rewriter), d_epg(pnm ? new EagerProofGenerator(pnm) : nullptr)
+TheoryArraysRewriter::TheoryArraysRewriter(Env& env)
+    : d_rewriter(env.getRewriter()),
+      d_epg(env.isTheoryProofProducing() ? new EagerProofGenerator(env)
+                                         : nullptr)
 {
 }
 
index 9c179eca9e4c490c762ea043c036725690bbbbf9..48a4319f72a5843f3f27facdaf93cde686409f69 100644 (file)
 namespace cvc5::internal {
 
 class EagerProofGenerator;
+class Env;
 
 namespace theory {
 
-class Rewriter;
-
 namespace arrays {
 
 Node getMostFrequentValue(TNode store);
@@ -49,7 +48,7 @@ static inline Node mkEqNode(Node a, Node b) {
 class TheoryArraysRewriter : public TheoryRewriter
 {
  public:
-  TheoryArraysRewriter(Rewriter* rewriter, ProofNodeManager* pnm);
+  TheoryArraysRewriter(Env& env);
 
   /** Normalize a constant whose index type has cardinality indexCard */
   static Node normalizeConstant(TNode node, Cardinality indexCard);
index df3e63d242fd8506c71642cf079a426f7093b0cb..22dd3da8b5c69f066e526b51c83a24a9d1cf3a2d 100644 (file)
@@ -49,7 +49,6 @@ CircuitPropagator::CircuitPropagator(Env& env, bool enableForward, bool enableBa
       d_forwardPropagation(enableForward),
       d_backwardPropagation(enableBackward),
       d_needsFinish(false),
-      d_pnm(nullptr),
       d_epg(nullptr),
       d_proofInternal(nullptr),
       d_proofExternal(nullptr)
@@ -75,7 +74,8 @@ void CircuitPropagator::assertTrue(TNode assertion)
   }
   else if (assertion.getKind() == kind::AND)
   {
-    ProofCircuitPropagatorBackward prover{d_pnm, assertion, true};
+    ProofCircuitPropagatorBackward prover{
+        d_env.getProofNodeManager(), assertion, true};
     if (isProofEnabled())
     {
       addProof(assertion, prover.assume(assertion));
@@ -93,7 +93,9 @@ void CircuitPropagator::assertTrue(TNode assertion)
     // Assign the given assertion to true
     assignAndEnqueue(assertion,
                      true,
-                     isProofEnabled() ? d_pnm->mkAssume(assertion) : nullptr);
+                     isProofEnabled()
+                         ? d_env.getProofNodeManager()->mkAssume(assertion)
+                         : nullptr);
   }
 }
 
@@ -165,7 +167,7 @@ void CircuitPropagator::makeConflict(Node n)
     {
       return;
     }
-    ProofCircuitPropagator pcp(d_pnm);
+    ProofCircuitPropagator pcp(d_env.getProofNodeManager());
     if (n == bfalse)
     {
       d_epg->setProofFor(bfalse, pcp.assume(bfalse));
@@ -237,7 +239,8 @@ void CircuitPropagator::propagateBackward(TNode parent, bool parentAssignment)
 {
   Trace("circuit-prop") << "CircuitPropagator::propagateBackward(" << parent
                         << ", " << parentAssignment << ")" << endl;
-  ProofCircuitPropagatorBackward prover{d_pnm, parent, parentAssignment};
+  ProofCircuitPropagatorBackward prover{
+      d_env.getProofNodeManager(), parent, parentAssignment};
 
   // backward rules
   switch (parent.getKind())
@@ -449,7 +452,8 @@ void CircuitPropagator::propagateForward(TNode child, bool childAssignment)
     Trace("circuit-prop") << "Parent: " << parent << endl;
     Assert(expr::hasSubterm(parent, child));
 
-    ProofCircuitPropagatorForward prover{d_pnm, child, childAssignment, parent};
+    ProofCircuitPropagatorForward prover{
+        d_env.getProofNodeManager(), child, childAssignment, parent};
 
     // Forward rules
     switch (parent.getKind())
@@ -774,18 +778,16 @@ TrustNode CircuitPropagator::propagate()
 void CircuitPropagator::enableProofs(context::Context* ctx,
                                      ProofGenerator* defParent)
 {
-  d_pnm = d_env.getProofNodeManager();
-  Assert(d_pnm != nullptr);
-  d_epg.reset(new EagerProofGenerator(d_pnm, ctx));
+  d_epg.reset(new EagerProofGenerator(d_env, ctx));
   d_proofInternal.reset(new LazyCDProofChain(
-      d_pnm, true, ctx, d_epg.get(), true, "CircuitPropInternalLazyChain"));
+      d_env, true, ctx, d_epg.get(), true, "CircuitPropInternalLazyChain"));
   if (defParent != nullptr)
   {
     // If we provide a parent proof generator (defParent), we want the ASSUME
     // leafs of proofs provided by this class to call the getProofFor method on
     // the parent. To do this, we use a LazyCDProofChain.
     d_proofExternal.reset(new LazyCDProofChain(
-        d_pnm, true, ctx, defParent, false, "CircuitPropExternalLazyChain"));
+        d_env, true, ctx, defParent, false, "CircuitPropExternalLazyChain"));
   }
 }
 
index 4c872955cfb55d2cd1197a1f246fe8a53457c90a..5a93fd651261139a23f0ab221ee3a50072ed0b4e 100644 (file)
@@ -249,8 +249,6 @@ class CircuitPropagator : protected EnvObj
   /** Adds a new proof for f, or drops it if we already have a proof */
   void addProof(TNode f, std::shared_ptr<ProofNode> pf);
 
-  /** A pointer to the proof manager */
-  ProofNodeManager* d_pnm;
   /** Eager proof generator that actually stores the proofs */
   std::unique_ptr<EagerProofGenerator> d_epg;
   /** Connects the proofs to subproofs internally */
index 08fac0fc579b9cd32f03bb42fde70db21d285ef6..dc4119f9640b24df389338efd827d5e13d4e839c 100644 (file)
@@ -22,9 +22,8 @@ namespace theory {
 namespace bv {
 
 BitblastProofGenerator::BitblastProofGenerator(Env& env,
-                                               ProofNodeManager* pnm,
                                                TConvProofGenerator* tcpg)
-    : EnvObj(env), d_pnm(pnm), d_tcpg(tcpg)
+    : EnvObj(env), d_tcpg(tcpg)
 {
 }
 
@@ -32,7 +31,7 @@ std::shared_ptr<ProofNode> BitblastProofGenerator::getProofFor(Node eq)
 {
   const auto& [t, bbt] = d_cache.at(eq);
 
-  CDProof cdp(d_pnm);
+  CDProof cdp(d_env);
   /* Coarse-grained bit-blast step. */
   if (t.isNull())
   {
index 3a73210f76dfb62106b227404eb14a6c2c4ce30b..b042697c2776c083ae0875dd428726a590fc7517 100644 (file)
@@ -33,7 +33,6 @@ class BitblastProofGenerator : public ProofGenerator, protected EnvObj
 {
  public:
   BitblastProofGenerator(Env& env,
-                         ProofNodeManager* pnm,
                          TConvProofGenerator* tcpg);
   ~BitblastProofGenerator(){};
 
@@ -57,8 +56,6 @@ class BitblastProofGenerator : public ProofGenerator, protected EnvObj
   void addBitblastStep(TNode t, TNode bbt, TNode eq);
 
  private:
-  /** The associated proof node manager. */
-  ProofNodeManager* d_pnm;
   /**
    * The associated term conversion proof generator, which tracks the
    * individual bit-blast steps.
index c300a757be114802bcbb037b58675f3b03ae3e36..5e5972bc053c0237ec566d74016851f43180c213 100644 (file)
@@ -24,29 +24,23 @@ namespace cvc5::internal {
 namespace theory {
 namespace bv {
 
-BBProof::BBProof(Env& env,
-                 TheoryState* state,
-                 ProofNodeManager* pnm,
-                 bool fineGrained)
+BBProof::BBProof(Env& env, TheoryState* state, bool fineGrained)
     : EnvObj(env),
       d_bb(new NodeBitblaster(env, state)),
-      d_pnm(pnm),
       d_tcontext(new TheoryLeafTermContext(theory::THEORY_BV)),
-      d_tcpg(pnm ? new TConvProofGenerator(
-                 pnm,
-                 nullptr,
-                 /* ONCE to visit each term only once, post-order.  FIXPOINT
-                  * could lead to infinite loops due to terms being rewritten
-                  * to terms that contain themselves */
-                 TConvPolicy::ONCE,
-                 /* STATIC to get the same ProofNode for a shared subterm. */
-                 TConvCachePolicy::STATIC,
-                 "BBProof::TConvProofGenerator",
-                 d_tcontext.get(),
-                 false)
-                 : nullptr),
-      d_bbpg(pnm ? new BitblastProofGenerator(env, pnm, d_tcpg.get())
-                 : nullptr),
+      d_tcpg(new TConvProofGenerator(
+          env,
+          nullptr,
+          /* ONCE to visit each term only once, post-order.  FIXPOINT
+           * could lead to infinite loops due to terms being rewritten
+           * to terms that contain themselves */
+          TConvPolicy::ONCE,
+          /* STATIC to get the same ProofNode for a shared subterm. */
+          TConvCachePolicy::STATIC,
+          "BBProof::TConvProofGenerator",
+          d_tcontext.get(),
+          false)),
+      d_bbpg(new BitblastProofGenerator(env, d_tcpg.get())),
       d_recordFineGrainedProofs(fineGrained)
 {
 }
@@ -210,7 +204,7 @@ bool BBProof::collectModelValues(TheoryModel* m,
 
 BitblastProofGenerator* BBProof::getProofGenerator() { return d_bbpg.get(); }
 
-bool BBProof::isProofsEnabled() const { return d_pnm != nullptr; }
+bool BBProof::isProofsEnabled() const { return d_env.isTheoryProofProducing(); }
 
 }  // namespace bv
 }  // namespace theory
index fc80f1e993bedbee469a03c110b03abe7868f53e..60191a1371923c4b23e9ac58a3c27223402053c9 100644 (file)
@@ -36,7 +36,6 @@ class BBProof : protected EnvObj
  public:
   BBProof(Env& env,
           TheoryState* state,
-          ProofNodeManager* pnm,
           bool fineGrained);
   ~BBProof();
 
@@ -64,8 +63,6 @@ class BBProof : protected EnvObj
 
   /** The associated simple bit-blaster. */
   std::unique_ptr<NodeBitblaster> d_bb;
-  /** The associated proof node manager. */
-  ProofNodeManager* d_pnm;
   /** Term context for d_tcpg to not rewrite below BV leafs. */
   std::unique_ptr<TermContext> d_tcontext;
   /** Term conversion proof generator for bit-blast steps. */
index a95dfce9b40222da78348c0821cebeefbf317d85..5049558b727d009d60dbcf296231e2cc3f843175 100644 (file)
@@ -110,8 +110,7 @@ class BBRegistrar : public prop::Registrar
 
 BVSolverBitblast::BVSolverBitblast(Env& env,
                                    TheoryState* s,
-                                   TheoryInferenceManager& inferMgr,
-                                   ProofNodeManager* pnm)
+                                   TheoryInferenceManager& inferMgr)
     : BVSolver(env, *s, inferMgr),
       d_bitblaster(new NodeBitblaster(env, s)),
       d_bbRegistrar(new BBRegistrar(d_bitblaster.get())),
@@ -120,15 +119,17 @@ BVSolverBitblast::BVSolverBitblast(Env& env,
       d_bbInputFacts(context()),
       d_assumptions(context()),
       d_assertions(context()),
-      d_epg(pnm ? new EagerProofGenerator(pnm, userContext(), "") : nullptr),
+      d_epg(env.isTheoryProofProducing()
+                ? new EagerProofGenerator(env, userContext(), "")
+                : nullptr),
       d_factLiteralCache(context()),
       d_literalFactCache(context()),
       d_propagate(options().bv.bitvectorPropagate),
       d_resetNotify(new NotifyResetAssertions(userContext()))
 {
-  if (pnm != nullptr)
+  if (env.isTheoryProofProducing())
   {
-    d_bvProofChecker.registerTo(pnm->getChecker());
+    d_bvProofChecker.registerTo(env.getProofNodeManager()->getChecker());
   }
 
   initSatSolver();
index 401b9a312b5f46d1d09f65aa89e5f079e71664a7..519b5693ff9289a0ed7215fd9dfd33cfe5a184d4 100644 (file)
@@ -45,8 +45,7 @@ class BVSolverBitblast : public BVSolver
  public:
   BVSolverBitblast(Env& env,
                    TheoryState* state,
-                   TheoryInferenceManager& inferMgr,
-                   ProofNodeManager* pnm);
+                   TheoryInferenceManager& inferMgr);
   ~BVSolverBitblast() = default;
 
   bool needsEqualityEngine(EeSetupInfo& esi) override { return true; }
index a00019eadfc66b60db0de4c9de129c385fd732db..eb8ce16e5f76e1403665f7af532b44e95c57eb05 100644 (file)
@@ -70,14 +70,10 @@ void collectBVAtoms(TNode n, std::unordered_set<Node>& atoms)
 }  // namespace
 
 BVSolverBitblastInternal::BVSolverBitblastInternal(
-    Env& env,
-    TheoryState* s,
-    TheoryInferenceManager& inferMgr,
-    ProofNodeManager* pnm)
+    Env& env, TheoryState* s, TheoryInferenceManager& inferMgr)
     : BVSolver(env, *s, inferMgr),
-      d_pnm(pnm),
-      d_bitblaster(new BBProof(env, s, pnm, false)),
-      d_epg(pnm ? new EagerProofGenerator(pnm) : nullptr)
+      d_bitblaster(new BBProof(env, s, false)),
+      d_epg(new EagerProofGenerator(d_env))
 {
 }
 
@@ -92,7 +88,7 @@ void BVSolverBitblastInternal::addBBLemma(TNode fact)
   Node atom_bb = d_bitblaster->getStoredBBAtom(fact);
   Node lemma = nm->mkNode(kind::EQUAL, fact, atom_bb);
 
-  if (d_pnm == nullptr)
+  if (!d_env.isTheoryProofProducing())
   {
     d_im.lemma(lemma, InferenceId::BV_BITBLAST_INTERNAL_BITBLAST_LEMMA);
   }
@@ -129,7 +125,7 @@ bool BVSolverBitblastInternal::preNotifyFact(
     NodeManager* nm = NodeManager::currentNM();
     Node lemma = nm->mkNode(kind::EQUAL, fact, n);
 
-    if (d_pnm == nullptr)
+    if (!d_env.isTheoryProofProducing())
     {
       d_im.lemma(lemma, InferenceId::BV_BITBLAST_INTERNAL_EAGER_LEMMA);
     }
index 8ac9fb7578c64a3a33d9ebc248319ca489fd4b84..5694324ff64b5247d9d20e1cca6454d4e80ac3bb 100644 (file)
@@ -40,8 +40,7 @@ class BVSolverBitblastInternal : public BVSolver
  public:
   BVSolverBitblastInternal(Env& env,
                            TheoryState* state,
-                           TheoryInferenceManager& inferMgr,
-                           ProofNodeManager* pnm);
+                           TheoryInferenceManager& inferMgr);
   ~BVSolverBitblastInternal() = default;
 
   bool needsEqualityEngine(EeSetupInfo& esi) override;
@@ -73,8 +72,6 @@ class BVSolverBitblastInternal : public BVSolver
    */
   void addBBLemma(TNode fact);
 
-  /** Proof node manager. */
-  ProofNodeManager* d_pnm;
   /** Bit-blaster used to bit-blast atoms/terms. */
   std::unique_ptr<BBProof> d_bitblaster;
   /** Proof rule checker */
index ab87b7fdb1fa5219db59cc5fbf6dbc1cd2c9a9a9..9e3d262cab9366bca77e86f116a6aa8a2bc4148e 100644 (file)
@@ -48,13 +48,12 @@ TheoryBV::TheoryBV(Env& env,
   switch (options().bv.bvSolver)
   {
     case options::BVSolver::BITBLAST:
-      d_internal.reset(new BVSolverBitblast(env, &d_state, d_im, d_pnm));
+      d_internal.reset(new BVSolverBitblast(env, &d_state, d_im));
       break;
 
     default:
       AlwaysAssert(options().bv.bvSolver == options::BVSolver::BITBLAST_INTERNAL);
-      d_internal.reset(
-          new BVSolverBitblastInternal(d_env, &d_state, d_im, d_pnm));
+      d_internal.reset(new BVSolverBitblastInternal(d_env, &d_state, d_im));
   }
   d_theoryState = &d_state;
   d_inferManager = &d_im;
index 07755344f371f656072d948022279dd4b7c23680..a23bd7a90efd2e2fbea1d9845d9c6219dc8e2cda 100644 (file)
@@ -34,14 +34,14 @@ CombinationEngine::CombinationEngine(Env& env,
     : EnvObj(env),
       d_te(te),
       d_valuation(&te),
-      d_pnm(env.isTheoryProofProducing() ? env.getProofNodeManager() : nullptr),
       d_logicInfo(env.getLogicInfo()),
       d_paraTheories(paraTheories),
       d_eemanager(nullptr),
       d_mmanager(nullptr),
       d_sharedSolver(nullptr),
-      d_cmbsPg(d_pnm ? new EagerProofGenerator(d_pnm, env.getUserContext())
-                     : nullptr)
+      d_cmbsPg(env.isTheoryProofProducing()
+                   ? new EagerProofGenerator(env, env.getUserContext())
+                   : nullptr)
 {
   // create the equality engine, model manager, and shared solver
   if (options().theory.eeMode == options::EqEngineMode::DISTRIBUTED)
index 0e1c3ef92cc1279567f9b8f2e451fe9b71179aac..ab10c48bd06c27785bbd2bb8542e32585a3db7a3 100644 (file)
@@ -109,8 +109,6 @@ class CombinationEngine : protected EnvObj
   TheoryEngine& d_te;
   /** Valuation for the engine */
   Valuation d_valuation;
-  /** The proof node manager */
-  ProofNodeManager* d_pnm;
   /** Logic info of theory engine (cached) */
   const LogicInfo& d_logicInfo;
   /** List of parametric theories of theory engine */
index 7ff1c70337ed289a581c44d05b5d2ec6b12050bb..ab12ba6d7ed03af235e4458698877f5db0260506 100644 (file)
@@ -29,10 +29,9 @@ namespace cvc5::internal {
 namespace theory {
 namespace datatypes {
 
-InferProofCons::InferProofCons(context::Context* c, ProofNodeManager* pnm)
-    : d_pnm(pnm), d_lazyFactMap(c == nullptr ? &d_context : c)
+InferProofCons::InferProofCons(Env& env, context::Context* c)
+    : EnvObj(env), d_lazyFactMap(c == nullptr ? &d_context : c)
 {
-  Assert(d_pnm != nullptr);
 }
 
 void InferProofCons::notifyFact(const std::shared_ptr<DatatypesInference>& di)
@@ -267,7 +266,7 @@ std::shared_ptr<ProofNode> InferProofCons::getProofFor(Node fact)
 {
   Trace("dt-ipc") << "dt-ipc: Ask proof for " << fact << std::endl;
   // temporary proof
-  CDProof pf(d_pnm);
+  CDProof pf(d_env);
   // get the inference
   NodeDatatypesInferenceMap::iterator it = d_lazyFactMap.find(fact);
   if (it == d_lazyFactMap.end())
index 66f2ba62856dd52250744fe2f4036ab2a583a417..109ed71e2e6589fd71e57c617182fcbdb16316a3 100644 (file)
 #include "context/cdhashmap.h"
 #include "expr/node.h"
 #include "proof/proof_generator.h"
+#include "smt/env_obj.h"
 #include "theory/datatypes/inference.h"
 
 namespace cvc5::internal {
-
-class ProofNodeManager;
-
 namespace theory {
 namespace datatypes {
 
@@ -40,13 +38,13 @@ namespace datatypes {
  * The main (private) method of this class is convert below, which is
  * called when we need to construct a proof node from an InferInfo.
  */
-class InferProofCons : public ProofGenerator
+class InferProofCons : protected EnvObj, public ProofGenerator
 {
   typedef context::CDHashMap<Node, std::shared_ptr<DatatypesInference>>
       NodeDatatypesInferenceMap;
 
  public:
-  InferProofCons(context::Context* c, ProofNodeManager* pnm);
+  InferProofCons(Env& env, context::Context* c);
   ~InferProofCons() {}
   /**
    * This is called to notify that di is an inference that may need a proof
@@ -87,8 +85,6 @@ class InferProofCons : public ProofGenerator
   void convert(InferenceId infer, TNode conc, TNode exp, CDProof* cdp);
   /** A dummy context used by this class if none is provided */
   context::Context d_context;
-  /** the proof node manager */
-  ProofNodeManager* d_pnm;
   /** The lazy fact map */
   NodeDatatypesInferenceMap d_lazyFactMap;
 };
index 755c545f0218da388d7bf0168f98258aee330101..0ebd85bc13c5d54182856f943f4f053d6fbf65f9 100644 (file)
@@ -32,14 +32,10 @@ namespace datatypes {
 
 InferenceManager::InferenceManager(Env& env, Theory& t, TheoryState& state)
     : InferenceManagerBuffered(env, t, state, "theory::datatypes::"),
-      d_ipc(isProofEnabled()
-                ? new InferProofCons(context(), env.getProofNodeManager())
-                : nullptr),
-      d_lemPg(isProofEnabled()
-                  ? new EagerProofGenerator(env.getProofNodeManager(),
-                                            userContext(),
-                                            "datatypes::lemPg")
-                  : nullptr)
+      d_ipc(isProofEnabled() ? new InferProofCons(env, context()) : nullptr),
+      d_lemPg(isProofEnabled() ? new EagerProofGenerator(
+                  env, userContext(), "datatypes::lemPg")
+                               : nullptr)
 {
   d_false = NodeManager::currentNM()->mkConst(false);
 }
@@ -110,8 +106,7 @@ TrustNode InferenceManager::processDtLemma(Node conc, Node exp, InferenceId id)
   std::shared_ptr<InferProofCons> ipcl;
   if (isProofEnabled())
   {
-    ipcl =
-        std::make_shared<InferProofCons>(nullptr, d_env.getProofNodeManager());
+    ipcl = std::make_shared<InferProofCons>(d_env, nullptr);
   }
   conc = prepareDtInference(conc, exp, id, ipcl.get());
   // send it as a lemma
index 422c163d467dcfa49663e2a68d2b7961dea03a58..8e71239d454611273f63510c8d4b097cce472006 100644 (file)
@@ -166,8 +166,8 @@ AlphaEquivalence::AlphaEquivalence(Env& env)
     : EnvObj(env),
       d_termCanon(),
       d_aedb(userContext(), &d_termCanon, true),
-      d_pnm(env.getProofNodeManager()),
-      d_pfAlpha(d_pnm ? new EagerProofGenerator(d_pnm) : nullptr)
+      d_pfAlpha(env.isTheoryProofProducing() ? new EagerProofGenerator(env)
+                                             : nullptr)
 {
 }
 
@@ -215,7 +215,7 @@ TrustNode AlphaEquivalence::reduceQuantifier(Node q)
       Trace("alpha-eq") << "subs: " << vars[i] << " -> " << subs[i]
                         << std::endl;
     }
-    CDProof cdp(d_pnm);
+    CDProof cdp(d_env);
     Node sret =
         ret.substitute(vars.begin(), vars.end(), subs.begin(), subs.end());
     std::vector<Node> transEq;
index 3d6fdd43e23a7a39888687dd2b99553f48789f46..a78aa98b2060247712fd96f2472a9ff1ed39cbbc 100644 (file)
@@ -131,8 +131,6 @@ class AlphaEquivalence : protected EnvObj
   expr::TermCanonize d_termCanon;
   /** the database of quantified formulas registered to this class */
   AlphaEquivalenceDb d_aedb;
-  /** Pointer to the proof node manager */
-  ProofNodeManager* d_pnm;
   /** An eager proof generator storing alpha equivalence proofs.*/
   std::unique_ptr<EagerProofGenerator> d_pfAlpha;
   /** Are proofs enabled for this object? */
index d7beb12c80e3c791168f1c10c930b60ac02ac4f8..5602f64ad309e3b543868e5fb9fa011e78f53863 100644 (file)
@@ -53,10 +53,9 @@ Instantiate::Instantiate(Env& env,
       d_treg(tr),
       d_insts(userContext()),
       d_c_inst_match_trie_dom(userContext()),
-      d_pfInst(isProofEnabled() ? new CDProof(env.getProofNodeManager(),
-                                              userContext(),
-                                              "Instantiate::pfInst")
-                                : nullptr)
+      d_pfInst(isProofEnabled()
+                   ? new CDProof(env, userContext(), "Instantiate::pfInst")
+                   : nullptr)
 {
 }
 
@@ -248,10 +247,8 @@ bool Instantiate::addInstantiation(Node q,
   std::shared_ptr<LazyCDProof> pfTmp;
   if (isProofEnabled())
   {
-    pfTmp.reset(new LazyCDProof(d_env.getProofNodeManager(),
-                                nullptr,
-                                nullptr,
-                                "Instantiate::LazyCDProof::tmp"));
+    pfTmp.reset(new LazyCDProof(
+        d_env, nullptr, nullptr, "Instantiate::LazyCDProof::tmp"));
   }
 
   // construct the instantiation
index 8de2085137aebd6bfca11c3e667659b92982137a..2af247e5107e16be9d5bdeb455fcd301d4b26c4d 100644 (file)
@@ -43,9 +43,7 @@ Skolemize::Skolemize(Env& env, QuantifiersState& qs, TermRegistry& tr)
       d_skolemized(userContext()),
       d_epg(!isProofEnabled()
                 ? nullptr
-                : new EagerProofGenerator(env.getProofNodeManager(),
-                                          userContext(),
-                                          "Skolemize::epg"))
+                : new EagerProofGenerator(env, userContext(), "Skolemize::epg"))
 {
 }
 
@@ -72,7 +70,7 @@ TrustNode Skolemize::process(Node q)
     Node existsq = nm->mkNode(EXISTS, echildren);
     Node res = skm->mkSkolemize(existsq, d_skolem_constants[q], "skv");
     Node qnot = q.notNode();
-    CDProof cdp(pnm);
+    CDProof cdp(d_env);
     cdp.addStep(res, PfRule::SKOLEMIZE, {qnot}, {});
     std::shared_ptr<ProofNode> pf = cdp.getProofFor(res);
     std::vector<Node> assumps;
index af9869dd6f423a81eae8b843a9ad13f2d2cab6ff..fbba1386cc704a4d3d339b9608b042df15326191 100644 (file)
@@ -118,15 +118,15 @@ TrustNode Rewriter::rewriteWithProof(TNode node,
   return TrustNode::mkTrustRewrite(node, ret, d_tpg.get());
 }
 
-void Rewriter::setProofNodeManager(ProofNodeManager* pnm)
+void Rewriter::finishInit(Env& env)
 {
   // if not already initialized with proof support
   if (d_tpg == nullptr)
   {
-    Trace("rewriter") << "Rewriter::setProofNodeManager" << std::endl;
+    Trace("rewriter") << "Rewriter::finishInit" << std::endl;
     // the rewriter is staticly determinstic, thus use static cache policy
     // for the term conversion proof generator
-    d_tpg.reset(new TConvProofGenerator(pnm,
+    d_tpg.reset(new TConvProofGenerator(env,
                                         nullptr,
                                         TConvPolicy::FIXPOINT,
                                         TConvCachePolicy::STATIC,
index 0fc50e64023477bee54f33d523870131c7813788..695dbf3b4346442bcdbcfd0c88bd0fe9c7505296 100644 (file)
@@ -84,8 +84,8 @@ class Rewriter {
   TrustNode rewriteWithProof(TNode node,
                              bool isExtEq = false);
 
-  /** Set proof node manager */
-  void setProofNodeManager(ProofNodeManager* pnm);
+  /** Finish init, which sets up the proof manager if applicable */
+  void finishInit(Env& env);
 
   /**
    * Registers a theory rewriter with this rewriter. The rewriter does not own
index 3f5bc414d0afe5530920be61d1bb6ca4aa071659..5f91fc97e7a27910598eca594a31328e695c6ef9 100644 (file)
@@ -28,16 +28,15 @@ namespace sets {
 TermRegistry::TermRegistry(Env& env,
                            SolverState& state,
                            InferenceManager& im,
-                           SkolemCache& skc,
-                           ProofNodeManager* pnm)
+                           SkolemCache& skc)
     : EnvObj(env),
       d_im(im),
       d_skCache(skc),
       d_proxy(userContext()),
       d_proxy_to_term(userContext()),
-      d_epg(
-          pnm ? new EagerProofGenerator(pnm, nullptr, "sets::TermRegistry::epg")
-              : nullptr)
+      d_epg(env.isTheoryProofProducing() ? new EagerProofGenerator(
+                env, nullptr, "sets::TermRegistry::epg")
+                                         : nullptr)
 {
 }
 
index d15ae401d25cea54f861773b77503d193b679c01..1a9e3a63954987b3bcaa06b209169c350880bf8f 100644 (file)
@@ -44,8 +44,7 @@ class TermRegistry : protected EnvObj
   TermRegistry(Env& env,
                SolverState& state,
                InferenceManager& im,
-               SkolemCache& skc,
-               ProofNodeManager* pnm);
+               SkolemCache& skc);
   /** get the proxy variable for set n
    *
    * Proxy variables are used to communicate information that otherwise would
index b1ae7a8eb7a7d97f1288f4062e03580dc186546c..5841dd92a9eecb0a368f75c088e9531a7c2daf46 100644 (file)
@@ -34,8 +34,8 @@ TheorySets::TheorySets(Env& env, OutputChannel& out, Valuation valuation)
       d_state(env, valuation, d_skCache),
       d_im(env, *this, d_state),
       d_cpacb(*this),
-      d_internal(new TheorySetsPrivate(
-          env, *this, d_state, d_im, d_skCache, d_pnm, d_cpacb)),
+      d_internal(
+          new TheorySetsPrivate(env, *this, d_state, d_im, d_skCache, d_cpacb)),
       d_notify(*d_internal.get(), d_im)
 {
   // use the official theory state and inference manager objects
index 5794f8a904f155cd2d850bd9e73937ebf4b93f0b..485ccb5d019fe0f7c854defe0d92604f527c8545 100644 (file)
@@ -44,7 +44,6 @@ TheorySetsPrivate::TheorySetsPrivate(Env& env,
                                      SolverState& state,
                                      InferenceManager& im,
                                      SkolemCache& skc,
-                                     ProofNodeManager* pnm,
                                      CarePairArgumentCallback& cpacb)
     : EnvObj(env),
       d_deq(context()),
@@ -55,7 +54,7 @@ TheorySetsPrivate::TheorySetsPrivate(Env& env,
       d_state(state),
       d_im(im),
       d_skCache(skc),
-      d_treg(d_env, state, im, skc, pnm),
+      d_treg(d_env, state, im, skc),
       d_rels(new TheorySetsRels(d_env, state, im, skc, d_treg)),
       d_cardSolver(new CardinalityExtension(d_env, state, im, d_treg)),
       d_rels_enabled(false),
index e80aa7012a23ae6e9b69529f5f5ea148d38bc3af..281ae77502f7d2787777f187fa906c17563b1eae 100644 (file)
@@ -328,7 +328,6 @@ class TheorySetsPrivate : protected EnvObj
                     SolverState& state,
                     InferenceManager& im,
                     SkolemCache& skc,
-                    ProofNodeManager* pnm,
                     CarePairArgumentCallback& cpacb);
 
   ~TheorySetsPrivate();
index 567f61f2699137b1d6a56897af35dfb04bf18aa7..791944d9bb8a32d068333c711ce3a1eb5975733d 100644 (file)
@@ -31,12 +31,11 @@ namespace cvc5::internal {
 namespace theory {
 namespace strings {
 
-InferProofCons::InferProofCons(context::Context* c,
-                               ProofNodeManager* pnm,
+InferProofCons::InferProofCons(Env& env,
+                               context::Context* c,
                                SequencesStatistics& statistics)
-    : d_pnm(pnm), d_lazyFactMap(c), d_statistics(statistics)
+    : EnvObj(env), d_lazyFactMap(c), d_statistics(statistics)
 {
-  Assert(d_pnm != nullptr);
 }
 
 void InferProofCons::notifyFact(const InferInfo& ii)
@@ -1170,7 +1169,7 @@ std::shared_ptr<ProofNode> InferProofCons::getProofFor(Node fact)
   Assert(ii->d_conc == fact);
   // make a placeholder proof using STRINGS_INFERENCE, which is reconstructed
   // during post-process
-  CDProof pf(d_pnm);
+  CDProof pf(d_env);
   std::vector<Node> args;
   packArgs(ii->d_conc, ii->getId(), ii->d_idRev, ii->d_premises, args);
   // must flatten
index 3210308dc1b90fb46693514901aadbec366360e6..f603d9d15617ecdb642a30de160d046baa5f7868 100644 (file)
@@ -24,6 +24,7 @@
 #include "proof/proof_checker.h"
 #include "proof/proof_rule.h"
 #include "proof/theory_proof_step_buffer.h"
+#include "smt/env_obj.h"
 #include "theory/builtin/proof_checker.h"
 #include "theory/strings/infer_info.h"
 #include "theory/strings/sequences_stats.h"
@@ -47,13 +48,13 @@ namespace strings {
  * returns applications of the rule STRING_INFERENCE, which store the arguments
  * to the proof conversion routine "convert" below.
  */
-class InferProofCons : public ProofGenerator
+class InferProofCons : protected EnvObj, public ProofGenerator
 {
   typedef context::CDHashMap<Node, std::shared_ptr<InferInfo>> NodeInferInfoMap;
 
  public:
-  InferProofCons(context::Context* c,
-                 ProofNodeManager* pnm,
+  InferProofCons(Env& env,
+                 context::Context* c,
                  SequencesStatistics& statistics);
   ~InferProofCons() {}
   /**
@@ -269,8 +270,6 @@ class InferProofCons : public ProofGenerator
    * in termsToPurify.
    */
   static Node maybePurifyTerm(Node n, std::unordered_set<Node>& termsToPurify);
-  /** the proof node manager */
-  ProofNodeManager* d_pnm;
   /** The lazy fact map */
   NodeInferInfoMap d_lazyFactMap;
   /** Reference to the statistics for the theory of strings/sequences. */
index b4eada12f705fca341c5a81e00a4a0fbf5e76a6e..ceb27ef4d6f4567b006991ac24940ebe5b271d4a 100644 (file)
@@ -41,14 +41,10 @@ InferenceManager::InferenceManager(Env& env,
       d_termReg(tr),
       d_extt(e),
       d_statistics(statistics),
-      d_ipc(isProofEnabled()
-                ? new InferProofCons(
-                      context(), env.getProofNodeManager(), d_statistics)
-                : nullptr),
-      d_ipcl(isProofEnabled()
-                 ? new InferProofCons(
-                       context(), env.getProofNodeManager(), d_statistics)
-                 : nullptr)
+      d_ipc(isProofEnabled() ? new InferProofCons(env, context(), d_statistics)
+                             : nullptr),
+      d_ipcl(isProofEnabled() ? new InferProofCons(env, context(), d_statistics)
+                              : nullptr)
 {
   NodeManager* nm = NodeManager::currentNM();
   d_zero = nm->mkConstInt(Rational(0));
index 7ba65bebd222887a3ce6e3788466f70ccf58c39e..4915dfa571c22c0ba320d58a452604367722ec54 100644 (file)
@@ -18,6 +18,7 @@
 #include "expr/bound_var_manager.h"
 #include "options/strings_options.h"
 #include "proof/proof_node_manager.h"
+#include "smt/env.h"
 #include "theory/rewriter.h"
 #include "theory/strings/regexp_entail.h"
 #include "theory/strings/theory_strings_utils.h"
@@ -47,14 +48,12 @@ struct ReElimStarIndexAttributeId
 typedef expr::Attribute<ReElimStarIndexAttributeId, Node>
     ReElimStarIndexAttribute;
 
-RegExpElimination::RegExpElimination(bool isAgg,
-                                     ProofNodeManager* pnm,
-                                     context::Context* c)
-    : d_isAggressive(isAgg),
-      d_pnm(pnm),
-      d_epg(pnm == nullptr
+RegExpElimination::RegExpElimination(Env& env, bool isAgg, context::Context* c)
+    : EnvObj(env),
+      d_isAggressive(isAgg),
+      d_epg(!env.isTheoryProofProducing()
                 ? nullptr
-                : new EagerProofGenerator(pnm, c, "RegExpElimination::epg"))
+                : new EagerProofGenerator(env, c, "RegExpElimination::epg"))
 {
 }
 
@@ -80,10 +79,11 @@ TrustNode RegExpElimination::eliminateTrusted(Node atom)
     // Currently aggressive doesnt work due to fresh bound variables
     if (isProofEnabled() && !d_isAggressive)
     {
+      ProofNodeManager* pnm = d_env.getProofNodeManager();
       Node eq = atom.eqNode(eatom);
       Node aggn = NodeManager::currentNM()->mkConst(d_isAggressive);
       std::shared_ptr<ProofNode> pn =
-          d_pnm->mkNode(PfRule::RE_ELIM, {}, {atom, aggn}, eq);
+          pnm->mkNode(PfRule::RE_ELIM, {}, {atom, aggn}, eq);
       d_epg->setProofFor(eq, pn);
       return TrustNode::mkTrustRewrite(atom, eatom, d_epg.get());
     }
@@ -647,7 +647,10 @@ Node RegExpElimination::returnElim(Node atom, Node atomElim, const char* id)
                    << "." << std::endl;
   return atomElim;
 }
-bool RegExpElimination::isProofEnabled() const { return d_pnm != nullptr; }
+bool RegExpElimination::isProofEnabled() const
+{
+  return d_env.isTheoryProofProducing();
+}
 
 }  // namespace strings
 }  // namespace theory
index 466c4f882ec8bcfdaec22153d70cd9fc791e56df..a3b2946681a706b3f6e97165f8aa53bd0839f282 100644 (file)
@@ -20,6 +20,7 @@
 #include "expr/node.h"
 #include "proof/eager_proof_generator.h"
 #include "proof/trust_node.h"
+#include "smt/env_obj.h"
 
 namespace cvc5::internal {
 namespace theory {
@@ -32,7 +33,7 @@ namespace strings {
  *
  * It is used by TheoryStrings during ppRewrite.
  */
-class RegExpElimination
+class RegExpElimination : protected EnvObj
 {
  public:
   /**
@@ -40,8 +41,8 @@ class RegExpElimination
    * @param pnm The proof node manager to use (for proofs)
    * @param c The context to use (for proofs)
    */
-  RegExpElimination(bool isAgg = false,
-                    ProofNodeManager* pnm = nullptr,
+  RegExpElimination(Env& env,
+                    bool isAgg = false,
                     context::Context* c = nullptr);
   /** eliminate membership
    *
@@ -77,8 +78,6 @@ class RegExpElimination
   bool isProofEnabled() const;
   /** Are aggressive eliminations enabled? */
   bool d_isAggressive;
-  /** Pointer to the proof node manager */
-  ProofNodeManager* d_pnm;
   /** An eager proof generator for storing proofs in eliminate trusted above */
   std::unique_ptr<EagerProofGenerator> d_epg;
 }; /* class RegExpElimination */
index 4ca2ac5f7627343abf67eeaa0c7cd2bcdda1e41c..0fed748dcfde51fb003a97b23068962dee199a3d 100644 (file)
@@ -38,8 +38,7 @@ namespace strings {
 TermRegistry::TermRegistry(Env& env,
                            Theory& t,
                            SolverState& s,
-                           SequencesStatistics& statistics,
-                           ProofNodeManager* pnm)
+                           SequencesStatistics& statistics)
     : EnvObj(env),
       d_theory(t),
       d_state(s),
@@ -57,11 +56,10 @@ TermRegistry::TermRegistry(Env& env,
       d_proxyVar(userContext()),
       d_proxyVarToLength(userContext()),
       d_lengthLemmaTermsCache(userContext()),
-      d_epg(pnm ? new EagerProofGenerator(
-                      pnm,
-                      userContext(),
-                      "strings::TermRegistry::EagerProofGenerator")
-                : nullptr)
+      d_epg(
+          env.isTheoryProofProducing() ? new EagerProofGenerator(
+              env, userContext(), "strings::TermRegistry::EagerProofGenerator")
+                                       : nullptr)
 {
   NodeManager* nm = NodeManager::currentNM();
   d_zero = nm->mkConstInt(Rational(0));
index 8092b1b0aa1f01af40d0abcb71b3ba949292520d..210621113a2987b459e60fa81645504d56612268 100644 (file)
@@ -59,8 +59,7 @@ class TermRegistry : protected EnvObj
   TermRegistry(Env& env,
                Theory& t,
                SolverState& s,
-               SequencesStatistics& statistics,
-               ProofNodeManager* pnm);
+               SequencesStatistics& statistics);
   ~TermRegistry();
   /** get the cardinality of the alphabet used, based on the options */
   uint32_t getAlphabetCardinality() const;
index e015e108437d68897c9ccdd321794488278e030b..a2ff8181e19aa7c2d113a599e0dcb3ce56de4a2e 100644 (file)
@@ -55,7 +55,7 @@ TheoryStrings::TheoryStrings(Env& env, OutputChannel& out, Valuation valuation)
       d_notify(*this),
       d_statistics(),
       d_state(env, d_valuation),
-      d_termReg(env, *this, d_state, d_statistics, d_pnm),
+      d_termReg(env, *this, d_state, d_statistics),
       d_rewriter(env.getRewriter(),
                  &d_statistics.d_rewrites,
                  d_termReg.getAlphabetCardinality()),
@@ -83,8 +83,8 @@ TheoryStrings::TheoryStrings(Env& env, OutputChannel& out, Valuation valuation)
       d_rsolver(
           env, d_state, d_im, d_termReg, d_csolver, d_esolver, d_statistics),
       d_regexp_elim(
+          env,
           options().strings.regExpElim == options::RegExpElimMode::AGG,
-          d_pnm,
           userContext()),
       d_stringsFmf(env, valuation, d_termReg),
       d_strat(d_env),
index a99f07d06cb9831c828c9be7eab9ce40bcc590c3..b554a377cf14f019524dd182b7c9656fcb42a613 100644 (file)
@@ -215,13 +215,10 @@ void TheoryEngine::finishInit()
 TheoryEngine::TheoryEngine(Env& env)
     : EnvObj(env),
       d_propEngine(nullptr),
-      d_pnm(d_env.isTheoryProofProducing() ? d_env.getProofNodeManager()
-                                           : nullptr),
-      d_lazyProof(
-          d_pnm != nullptr ? new LazyCDProof(
-              d_pnm, nullptr, userContext(), "TheoryEngine::LazyCDProof")
-                           : nullptr),
-      d_tepg(new TheoryEngineProofGenerator(d_pnm, userContext())),
+      d_lazyProof(env.isTheoryProofProducing() ? new LazyCDProof(
+                      env, nullptr, userContext(), "TheoryEngine::LazyCDProof")
+                                               : nullptr),
+      d_tepg(new TheoryEngineProofGenerator(env, userContext())),
       d_tc(nullptr),
       d_sharedSolver(nullptr),
       d_quantEngine(nullptr),
@@ -1145,7 +1142,7 @@ TrustNode TheoryEngine::getExplanation(TNode node)
     if (isProofEnabled())
     {
       texplanation.debugCheckClosed(
-          "te-proof-exp", "texplanation no share", false);
+          options(), "te-proof-exp", "texplanation no share", false);
       // check if no generator, if so, add THEORY_LEMMA
       if (texplanation.getGenerator() == nullptr)
       {
@@ -1321,7 +1318,8 @@ void TheoryEngine::lemma(TrustNode tlemma,
       tlemma = TrustNode::mkTrustLemma(lemma, d_lazyProof.get());
     }
     // ensure closed
-    tlemma.debugCheckClosed("te-proof-debug", "TheoryEngine::lemma_initial");
+    tlemma.debugCheckClosed(
+        options(), "te-proof-debug", "TheoryEngine::lemma_initial");
   }
 
   // assert the lemma
@@ -1369,7 +1367,7 @@ void TheoryEngine::conflict(TrustNode tconflict, TheoryId theoryId)
   Trace("te-proof-debug") << "Check closed conflict" << std::endl;
   // doesn't require proof generator, yet, since THEORY_LEMMA is added below
   tconflict.debugCheckClosed(
-      "te-proof-debug", "TheoryEngine::conflict_initial", false);
+      options(), "te-proof-debug", "TheoryEngine::conflict_initial", false);
 
   Trace("dtview::conflict") << ":THEORY-CONFLICT: " << conflict << std::endl;
 
@@ -1392,7 +1390,8 @@ void TheoryEngine::conflict(TrustNode tconflict, TheoryId theoryId)
     {
       Trace("te-proof-debug")
           << "Check closed conflict explained with sharing" << std::endl;
-      tncExp.debugCheckClosed("te-proof-debug",
+      tncExp.debugCheckClosed(options(),
+                              "te-proof-debug",
                               "TheoryEngine::conflict_explained_sharing");
       Trace("te-proof-debug") << "Process conflict: " << conflict << std::endl;
       Trace("te-proof-debug") << "Conflict " << tconflict << " from "
@@ -1419,7 +1418,8 @@ void TheoryEngine::conflict(TrustNode tconflict, TheoryId theoryId)
       Trace("te-proof-debug") << "add lazy step " << tncExp.identifyGenerator()
                               << " for " << proven << std::endl;
       d_lazyProof->addLazyStep(proven, tncExp.getGenerator());
-      pfgEnsureClosed(proven,
+      pfgEnsureClosed(options(),
+                      proven,
                       d_lazyProof.get(),
                       "te-proof-debug",
                       "TheoryEngine::conflict_during");
@@ -1458,7 +1458,8 @@ void TheoryEngine::conflict(TrustNode tconflict, TheoryId theoryId)
         << "Check closed conflict with sharing" << std::endl;
     if (isProofEnabled())
     {
-      tconf.debugCheckClosed("te-proof-debug", "TheoryEngine::conflict:sharing");
+      tconf.debugCheckClosed(
+          options(), "te-proof-debug", "TheoryEngine::conflict:sharing");
     }
     lemma(tconf, LemmaProperty::REMOVABLE);
   }
@@ -1508,7 +1509,7 @@ TrustNode TheoryEngine::getExplanation(
     // communicating arrangements between shared terms, and the rewriter
     // for arithmetic equalities does not preserve terms, e.g. x=y may become
     // x+-1*y=0.
-    lcp.reset(new LazyCDProof(d_pnm,
+    lcp.reset(new LazyCDProof(d_env,
                               nullptr,
                               nullptr,
                               "TheoryEngine::LazyCDProof::getExplanation",
@@ -1640,7 +1641,8 @@ TrustNode TheoryEngine::getExplanation(
         d_sharedSolver->explain(toExplain.d_node, toExplain.d_theory);
     if (lcp != nullptr)
     {
-      texplanation.debugCheckClosed("te-proof-exp", "texplanation", false);
+      texplanation.debugCheckClosed(
+          options(), "te-proof-exp", "texplanation", false);
       Trace("te-proof-exp")
           << "- t-explained[" << toExplain.d_theory << "]: " << toExplain.d_node
           << " by " << texplanation.getNode() << std::endl;
index 13e3785850c62978a91d8cc38fe89b1fd73c8af0..54535631201158eacaa9f5c889ac6317ada73005 100644 (file)
@@ -498,9 +498,7 @@ class TheoryEngine : protected EnvObj
    */
   theory::Theory* d_theoryTable[theory::THEORY_LAST];
 
-  //--------------------------------- new proofs
-  /** Proof node manager used by this theory engine, if proofs are enabled */
-  ProofNodeManager* d_pnm;
+  //--------------------------------- proofs
   /** The lazy proof object
    *
    * This stores instructions for how to construct proofs for all theory lemmas.
@@ -508,7 +506,7 @@ class TheoryEngine : protected EnvObj
   std::shared_ptr<LazyCDProof> d_lazyProof;
   /** The proof generator */
   std::shared_ptr<TheoryEngineProofGenerator> d_tepg;
-  //--------------------------------- end new proofs
+  //--------------------------------- end proofs
   /** The combination manager we are using */
   std::unique_ptr<theory::CombinationEngine> d_tc;
   /** The shared solver of the above combination engine. */
index fa28f3f1b9530efca181a17f50f4a57a01a60dc1..868413bf880b4619873f86fa4c6ea0acd45f1f0d 100644 (file)
 #include <sstream>
 
 #include "proof/proof_node.h"
+#include "smt/env.h"
 
 using namespace cvc5::internal::kind;
 
 namespace cvc5::internal {
 
-TheoryEngineProofGenerator::TheoryEngineProofGenerator(ProofNodeManager* pnm,
+TheoryEngineProofGenerator::TheoryEngineProofGenerator(Env& env,
                                                        context::Context* c)
-    : d_pnm(pnm), d_proofs(c)
+    : EnvObj(env), d_proofs(c)
 {
   d_false = NodeManager::currentNM()->mkConst(false);
 }
@@ -107,7 +108,8 @@ std::shared_ptr<ProofNode> TheoryEngineProofGenerator::getProofFor(Node f)
   std::shared_ptr<ProofNode> pfb = lcp->getProofFor(conclusion);
   Trace("tepg-debug") << "...mkScope" << std::endl;
   // call the scope method of proof node manager
-  std::shared_ptr<ProofNode> pf = d_pnm->mkScope(pfb, scopeAssumps);
+  ProofNodeManager* pnm = d_env.getProofNodeManager();
+  std::shared_ptr<ProofNode> pf = pnm->mkScope(pfb, scopeAssumps);
 
   if (pf->getResult() != f)
   {
index 7ef10b6ded0f12a3363899e96701d711f1cdc59e..5ba1f17f4714dab3de4fa4e1c8544d28a6bdd63d 100644 (file)
@@ -26,6 +26,7 @@
 #include "proof/proof_generator.h"
 #include "proof/proof_node_manager.h"
 #include "proof/trust_node.h"
+#include "smt/env_obj.h"
 
 namespace cvc5::internal {
 
@@ -36,13 +37,13 @@ namespace cvc5::internal {
  * Notice that this class could be made general purpose. Its main feature is
  * storing lazy proofs for facts in a context-dependent manner.
  */
-class TheoryEngineProofGenerator : public ProofGenerator
+class TheoryEngineProofGenerator : protected EnvObj, public ProofGenerator
 {
   typedef context::CDHashMap<Node, std::shared_ptr<LazyCDProof>>
       NodeLazyCDProofMap;
 
  public:
-  TheoryEngineProofGenerator(ProofNodeManager* pnm, context::Context* c);
+  TheoryEngineProofGenerator(Env& env, context::Context* c);
   ~TheoryEngineProofGenerator() {}
   /**
    * Make trust explanation. Called when lpf has a proof of lit from free
@@ -67,8 +68,6 @@ class TheoryEngineProofGenerator : public ProofGenerator
   std::string identify() const override;
 
  private:
-  /** The proof manager, used for allocating new ProofNode objects */
-  ProofNodeManager* d_pnm;
   /** Map from formulas to lazy CD proofs */
   NodeLazyCDProofMap d_proofs;
   /** The false node */
index ce532bbb03bb11eedc3fbbb19cda3f3686d60872..e9df32f9cf5b1e14d9e662924fe18e0df42c353a 100644 (file)
@@ -68,7 +68,7 @@ TheoryInferenceManager::TheoryInferenceManager(Env& env,
     context::UserContext* u = userContext();
     ProofNodeManager* pnm = env.getProofNodeManager();
     d_defaultPg.reset(
-        new EagerProofGenerator(pnm, u, statsName + "EagerProofGenerator"));
+        new EagerProofGenerator(env, u, statsName + "EagerProofGenerator"));
     if (options().proof.proofAnnotate)
     {
       d_iipa.reset(new InferenceIdProofAnnotator(pnm, u));
index 0f099239ca90aa886f4d98ab56035e6b32b0a3f2..81a226b2e1517e6ce9815a283786dcbe55332f0e 100644 (file)
@@ -44,19 +44,19 @@ TheoryPreprocessor::TheoryPreprocessor(Env& env, TheoryEngine& engine)
   {
     context::Context* u = userContext();
     d_tpg.reset(
-        new TConvProofGenerator(pnm,
+        new TConvProofGenerator(env,
                                 u,
                                 TConvPolicy::FIXPOINT,
                                 TConvCachePolicy::NEVER,
                                 "TheoryPreprocessor::preprocess_rewrite",
                                 &d_rtfc));
-    d_tpgRew.reset(new TConvProofGenerator(pnm,
+    d_tpgRew.reset(new TConvProofGenerator(env,
                                            u,
                                            TConvPolicy::ONCE,
                                            TConvCachePolicy::NEVER,
                                            "TheoryPreprocessor::pprew"));
     d_lp.reset(
-        new LazyCDProof(pnm, nullptr, u, "TheoryPreprocessor::LazyCDProof"));
+        new LazyCDProof(env, nullptr, u, "TheoryPreprocessor::LazyCDProof"));
     // Make the main term conversion sequence generator, which tracks up to
     // three conversions made in succession:
     // (1) rewriting
@@ -147,7 +147,8 @@ TrustNode TheoryPreprocessor::preprocessInternal(
     // node -> irNode via rewriting
     // irNode -> ppNode via theory-preprocessing + rewriting + tf removal
     tret = d_tspg->mkTrustRewriteSequence(cterms);
-    tret.debugCheckClosed("tpp-debug", "TheoryPreprocessor::lemma_ret");
+    tret.debugCheckClosed(
+        options(), "tpp-debug", "TheoryPreprocessor::lemma_ret");
   }
   else
   {
@@ -479,8 +480,8 @@ void TheoryPreprocessor::registerTrustedRewrite(TrustNode trn,
   {
     Trace("tpp-debug") << "TheoryPreprocessor: addRewriteStep (generator) "
                        << term << " -> " << termr << std::endl;
-    trn.debugCheckClosed("tpp-debug",
-                         "TheoryPreprocessor::preprocessWithProof");
+    trn.debugCheckClosed(
+        options(), "tpp-debug", "TheoryPreprocessor::preprocessWithProof");
     // always use term context hash 0 (default)
     pg->addRewriteStep(
         term, termr, trn.getGenerator(), isPre, PfRule::ASSUME, true, tctx);
index f46e6399e589d568f8867da6f88c73241e4f857c..68cf05de7907205ca9d891466579ca5f2051d89a 100644 (file)
 
 #include "theory/trust_substitutions.h"
 
+#include "smt/env.h"
 #include "theory/rewriter.h"
 
 namespace cvc5::internal {
 namespace theory {
 
-TrustSubstitutionMap::TrustSubstitutionMap(context::Context* c,
-                                           ProofNodeManager* pnm,
+TrustSubstitutionMap::TrustSubstitutionMap(Env& env,
+                                           context::Context* c,
                                            std::string name,
                                            PfRule trustId,
                                            MethodId ids)
-    : d_ctx(c),
+    : EnvObj(env),
+      d_ctx(c),
       d_subs(c),
       d_tsubs(c),
       d_tspb(nullptr),
@@ -37,21 +39,15 @@ TrustSubstitutionMap::TrustSubstitutionMap(context::Context* c,
       d_ids(ids),
       d_eqtIndex(c)
 {
-  setProofNodeManager(pnm);
-}
-
-void TrustSubstitutionMap::setProofNodeManager(ProofNodeManager* pnm)
-{
+  ProofNodeManager* pnm = d_env.getProofNodeManager();
   if (pnm != nullptr)
   {
-    // should not set the proof node manager more than once
-    Assert(d_tspb == nullptr);
-    d_tspb.reset(new TheoryProofStepBuffer(pnm->getChecker())),
-        d_subsPg.reset(new LazyCDProof(
-            pnm, nullptr, d_ctx, "TrustSubstitutionMap::subsPg"));
+    d_tspb.reset(new TheoryProofStepBuffer(pnm->getChecker()));
+    d_subsPg.reset(
+        new LazyCDProof(env, nullptr, d_ctx, "TrustSubstitutionMap::subsPg"));
     d_applyPg.reset(
-        new LazyCDProof(pnm, nullptr, d_ctx, "TrustSubstitutionMap::applyPg"));
-    d_helperPf.reset(new CDProofSet<LazyCDProof>(pnm, d_ctx));
+        new LazyCDProof(env, nullptr, d_ctx, "TrustSubstitutionMap::applyPg"));
+    d_helperPf.reset(new CDProofSet<LazyCDProof>(env, d_ctx));
   }
 }
 
index 1428b93918f04353ae47d0e25b0981a4e672f815..98b28df39f83d29e0e7d44e0d932760af0d9f597 100644 (file)
@@ -36,18 +36,16 @@ namespace theory {
 /**
  * A layer on top of SubstitutionMap that tracks proofs.
  */
-class TrustSubstitutionMap : public ProofGenerator
+class TrustSubstitutionMap : protected EnvObj, public ProofGenerator
 {
   using NodeUIntMap = context::CDHashMap<Node, size_t>;
 
  public:
-  TrustSubstitutionMap(context::Context* c,
-                       ProofNodeManager* pnm = nullptr,
+  TrustSubstitutionMap(Env& env,
+                       context::Context* c,
                        std::string name = "TrustSubstitutionMap",
                        PfRule trustId = PfRule::PREPROCESS_LEMMA,
                        MethodId ids = MethodId::SB_DEFAULT);
-  /** Set proof node manager */
-  void setProofNodeManager(ProofNodeManager* pnm);
   /** Gets a reference to the underlying substitution map */
   SubstitutionMap& get();
   /**
index 7e1823dfc93c330f01b68df735e6004df8e0b128..3188e3e83f22a1dbda25b426a23994083794a0f6 100644 (file)
@@ -31,9 +31,9 @@ LambdaLift::LambdaLift(Env& env)
     : EnvObj(env),
       d_lifted(userContext()),
       d_lambdaMap(userContext()),
-      d_epg(env.isTheoryProofProducing() ? new EagerProofGenerator(
-                env.getProofNodeManager(), userContext(), "LambdaLift::epg")
-                                         : nullptr)
+      d_epg(env.isTheoryProofProducing()
+                ? new EagerProofGenerator(env, userContext(), "LambdaLift::epg")
+                : nullptr)
 {
 }
 
index b7d265a8a3444b7789c71c92c0a2d90d767b05fa..6993bc2429c3351cdeb29d21cda302581e298b06 100644 (file)
@@ -31,15 +31,11 @@ namespace theory {
 namespace eq {
 
 ProofEqEngine::ProofEqEngine(Env& env, EqualityEngine& ee)
-    : EnvObj(env),
-      EagerProofGenerator(env.getProofNodeManager(),
-                          env.getUserContext(),
-                          "pfee::" + ee.identify()),
+    : EagerProofGenerator(env, env.getUserContext(), "pfee::" + ee.identify()),
       d_ee(ee),
-      d_factPg(env.getContext(), env.getProofNodeManager()),
+      d_factPg(env, env.getContext()),
       d_assumpPg(env.getProofNodeManager()),
-      d_pnm(env.getProofNodeManager()),
-      d_proof(env.getProofNodeManager(),
+      d_proof(env,
               nullptr,
               env.getContext(),
               "pfee::LazyCDProof::" + ee.identify()),
@@ -226,7 +222,7 @@ TrustNode ProofEqEngine::assertLemma(Node conc,
                 << ", exp = " << exp << ", noExplain = " << noExplain
                 << ", args = " << args << std::endl;
   Assert(conc != d_true);
-  LazyCDProof tmpProof(d_pnm, &d_proof);
+  LazyCDProof tmpProof(d_env, &d_proof);
   LazyCDProof* curr;
   TrustNodeKind tnk;
   // same policy as above: for conflicts, use existing lazy proof
@@ -245,7 +241,7 @@ TrustNode ProofEqEngine::assertLemma(Node conc,
   explainVecWithProof(tnk, assumps, exp, noExplain, curr);
   // Register the proof step. We use a separate lazy CDProof which will make
   // calls to curr above for the proofs of the literals in exp.
-  LazyCDProof outer(d_pnm, curr);
+  LazyCDProof outer(d_env, curr);
   if (!outer.addStep(conc, id, exp, args))
   {
     // a step went wrong, e.g. during checking
@@ -265,7 +261,7 @@ TrustNode ProofEqEngine::assertLemma(Node conc,
   Trace("pfee") << "pfee::assertLemma " << conc << ", exp = " << exp
                 << ", noExplain = " << noExplain << " via generator"
                 << std::endl;
-  LazyCDProof tmpProof(d_pnm, &d_proof);
+  LazyCDProof tmpProof(d_env, &d_proof);
   LazyCDProof* curr;
   TrustNodeKind tnk;
   // same policy as above: for conflicts, use existing lazy proof
@@ -286,7 +282,7 @@ TrustNode ProofEqEngine::assertLemma(Node conc,
   // "skeleton" that is the base of the proof we are constructing. The call to
   // LazyCDProofChain::getProofFor will expand the leaves of this proof via
   // calls to curr.
-  LazyCDProofChain outer(d_pnm, true, nullptr, curr, false);
+  LazyCDProofChain outer(d_env, true, nullptr, curr, false);
   outer.addLazyStep(conc, pg);
   return ensureProofForFact(conc, assumps, tnk, &outer);
 }
@@ -294,7 +290,7 @@ TrustNode ProofEqEngine::assertLemma(Node conc,
 TrustNode ProofEqEngine::explain(Node conc)
 {
   Trace("pfee") << "pfee::explain " << conc << std::endl;
-  LazyCDProof tmpProof(d_pnm, &d_proof);
+  LazyCDProof tmpProof(d_env, &d_proof);
   std::vector<TNode> assumps;
   explainWithProof(conc, assumps, &tmpProof);
   return ensureProofForFact(conc, assumps, TrustNodeKind::PROP_EXP, &tmpProof);
@@ -357,7 +353,8 @@ TrustNode ProofEqEngine::ensureProofForFact(Node conc,
     return TrustNode::null();
   }
   // clone it so that we have a fresh copy
-  pfBody = d_pnm->clone(pfBody);
+  ProofNodeManager* pnm = d_env.getProofNodeManager();
+  pfBody = pnm->clone(pfBody);
   Trace("pfee-proof") << "pfee::ensureProofForFact: add scope" << std::endl;
   // The free assumptions must be closed by assumps, which should be passed
   // as arguments of SCOPE. However, some of the free assumptions may not
@@ -381,7 +378,7 @@ TrustNode ProofEqEngine::ensureProofForFact(Node conc,
   }
   // Scope the proof constructed above, and connect the formula with the proof
   // minimize the assumptions.
-  pf = d_pnm->mkScope(pfBody, scopeAssumps, true, true);
+  pf = pnm->mkScope(pfBody, scopeAssumps, true, true);
   // If we have no assumptions, and are proving an explanation for propagation
   if (scopeAssumps.empty() && tnk == TrustNodeKind::PROP_EXP)
   {
@@ -391,7 +388,7 @@ TrustNode ProofEqEngine::ensureProofForFact(Node conc,
     // minimize here, since we already ensured the proof was closed above, and
     // we do not want to minimize, or else "true" would be omitted.
     scopeAssumps.push_back(nm->mkConst(true));
-    pf = d_pnm->mkScope(pf, scopeAssumps, false);
+    pf = pnm->mkScope(pf, scopeAssumps, false);
   }
   exp = nm->mkAnd(scopeAssumps);
   // Make the lemma or conflict node. This must exactly match the conclusion
index 52e9c18e81495d721180e522d066ed0816aa4e81..78f23ee22e87855da72945ec5fa3d3285daff180 100644 (file)
@@ -81,7 +81,7 @@ class EqualityEngine;
  * - explain, for explaining why a literal is true in the current state.
  * Details on these methods can be found below.
  */
-class ProofEqEngine : protected EnvObj, public EagerProofGenerator
+class ProofEqEngine : public EagerProofGenerator
 {
   typedef context::CDHashSet<Node> NodeSet;
   typedef context::CDHashMap<Node, std::shared_ptr<ProofNode>> NodeProofMap;
@@ -287,8 +287,6 @@ class ProofEqEngine : protected EnvObj, public EagerProofGenerator
   /** common nodes */
   Node d_true;
   Node d_false;
-  /** the proof node manager */
-  ProofNodeManager* d_pnm;
   /** The SAT-context-dependent proof object */
   LazyCDProof d_proof;
   /**
index 7349aff5cb5a864af18a4ea8f3706253dd2403bd..e0a5914726008558d1aadaf05d636112541a5ad6 100644 (file)
@@ -387,6 +387,7 @@ TEST_F(TestTheoryWhiteArithCoverings, test_cdcac_proof_1)
   opts.writeSmt().produceProofs = true;
   Env env(NodeManager::currentNM(), &opts);
   smt::PfManager pfm(env);
+  env.finishInit(pfm.getProofNodeManager());
   EXPECT_TRUE(env.isTheoryProofProducing());
   // register checkers that we need
   builtin::BuiltinProofRuleChecker btchecker(env);