From 74f7773cda304b78417ecee22e8b9430725673c5 Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Thu, 9 Dec 2021 12:34:31 -0600 Subject: [PATCH] Remove a few static access to options in proof code (#7780) --- src/proof/proof_node_manager.cpp | 12 +++++++----- src/proof/proof_node_manager.h | 7 ++++++- src/smt/proof_manager.cpp | 3 ++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/proof/proof_node_manager.cpp b/src/proof/proof_node_manager.cpp index e0a7f81c0..c832ac3fa 100644 --- a/src/proof/proof_node_manager.cpp +++ b/src/proof/proof_node_manager.cpp @@ -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 visited; for (const std::shared_ptr& cpc : children) diff --git a/src/proof/proof_node_manager.h b/src/proof/proof_node_manager.h index 533f6d173..5926a5f2e 100644 --- a/src/proof/proof_node_manager.h +++ b/src/proof/proof_node_manager.h @@ -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 */ diff --git a/src/smt/proof_manager.cpp b/src/smt/proof_manager.cpp index e12d6fbe0..b8504112d 100644 --- a/src/smt/proof_manager.cpp +++ b/src/smt/proof_manager.cpp @@ -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), -- 2.30.2