Remove a few static access to options in proof code (#7780)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Thu, 9 Dec 2021 18:34:31 +0000 (12:34 -0600)
committerGitHub <noreply@github.com>
Thu, 9 Dec 2021 18:34:31 +0000 (10:34 -0800)
src/proof/proof_node_manager.cpp
src/proof/proof_node_manager.h
src/smt/proof_manager.cpp

index e0a7f81c077db448e6de3d51a29ee28d8b9161ae..c832ac3fa7a3714366c7bcb8c2cd82901eb2586a 100644 (file)
@@ -28,8 +28,10 @@ using namespace cvc5::kind;
 
 namespace cvc5 {
 
-ProofNodeManager::ProofNodeManager(theory::Rewriter* rr, ProofChecker* pc)
-    : d_rewriter(rr), d_checker(pc)
+ProofNodeManager::ProofNodeManager(const Options& opts,
+                                   theory::Rewriter* rr,
+                                   ProofChecker* pc)
+    : d_opts(opts), d_rewriter(rr), d_checker(pc)
 {
   d_true = NodeManager::currentNM()->mkConst(true);
   // we always allocate a proof checker, regardless of the proof checking mode
@@ -329,8 +331,8 @@ Node ProofNodeManager::checkInternal(
   // a proof checking mode that does not eagerly check rule applications
   if (!expected.isNull())
   {
-    if (options::proofCheck() == options::ProofCheckMode::LAZY
-        || options::proofCheck() == options::ProofCheckMode::NONE)
+    if (d_opts.proof.proofCheck == options::ProofCheckMode::LAZY
+        || d_opts.proof.proofCheck == options::ProofCheckMode::NONE)
     {
       return expected;
     }
@@ -435,7 +437,7 @@ bool ProofNodeManager::updateNodeInternal(
 {
   Assert(pn != nullptr);
   // ---------------- check for cyclic
-  if (options::proofCheck() == options::ProofCheckMode::EAGER)
+  if (d_opts.proof.proofCheck == options::ProofCheckMode::EAGER)
   {
     std::unordered_set<const ProofNode*> visited;
     for (const std::shared_ptr<ProofNode>& cpc : children)
index 533f6d173982a908a4c6d834ac66fcc5c8f828a6..5926a5f2e2faa1be24f7e8fdca1615a2662a9ae0 100644 (file)
@@ -27,6 +27,7 @@ namespace cvc5 {
 
 class ProofChecker;
 class ProofNode;
+class Options;
 
 namespace theory {
 class Rewriter;
@@ -58,7 +59,9 @@ class Rewriter;
 class ProofNodeManager
 {
  public:
-  ProofNodeManager(theory::Rewriter* rr, ProofChecker* pc = nullptr);
+  ProofNodeManager(const Options& opts,
+                   theory::Rewriter* rr,
+                   ProofChecker* pc = nullptr);
   ~ProofNodeManager() {}
   /**
    * This constructs a ProofNode with the given arguments. The expected
@@ -188,6 +191,8 @@ class ProofNodeManager
   static ProofNode* cancelDoubleSymm(ProofNode* pn);
 
  private:
+  /** Reference to the options */
+  const Options& d_opts;
   /** The rewriter */
   theory::Rewriter* d_rewriter;
   /** The (optional) proof checker */
index e12d6fbe0452dc6774ca5e8a6c24ac607c25a63c..b8504112db346f4b2d216699218b80fe83a3a5b4 100644 (file)
@@ -41,7 +41,8 @@ PfManager::PfManager(Env& env)
       d_pchecker(new ProofChecker(
           options().proof.proofCheck == options::ProofCheckMode::EAGER,
           options().proof.proofPedantic)),
-      d_pnm(new ProofNodeManager(env.getRewriter(), d_pchecker.get())),
+      d_pnm(new ProofNodeManager(
+          env.getOptions(), env.getRewriter(), d_pchecker.get())),
       d_pppg(new PreprocessProofGenerator(
           d_pnm.get(), env.getUserContext(), "smt::PreprocessProofGenerator")),
       d_pfpp(nullptr),