In preparation for eliminating options scopes.
default = "true"
help = "regression explanations for string lemmas"
-[[option]]
- name = "stringMinPrefixExplain"
- category = "expert"
- long = "strings-min-prefix-explain"
- type = "bool"
- default = "true"
- help = "minimize explanations for prefix of normal forms in strings"
-
[[option]]
name = "stringModelBasedReduction"
category = "regular"
}
} while (expanded);
// now we should be able to close it
- if (options::proofCheck() == options::ProofCheckMode::EAGER)
+ if (options().proof.proofCheck == options::ProofCheckMode::EAGER)
{
std::vector<Node> assumptionsVec;
for (const Node& a : d_assumptions)
namespace cvc5::internal {
namespace smt {
-AbstractValues::AbstractValues(NodeManager* nm)
- : d_nm(nm),
- d_fakeContext(),
- d_abstractValueMap(&d_fakeContext),
- d_abstractValues()
+AbstractValues::AbstractValues()
+ : d_fakeContext(), d_abstractValueMap(&d_fakeContext), d_abstractValues()
{
}
AbstractValues::~AbstractValues() {}
Node AbstractValues::mkAbstractValue(TNode n)
{
- Assert(options::abstractValues());
Node& val = d_abstractValues[n];
if (val.isNull())
{
- val = d_nm->getSkolemManager()->mkDummySkolem(
+ val = NodeManager::currentNM()->getSkolemManager()->mkDummySkolem(
"a",
n.getType(),
"an abstract value",
typedef std::unordered_map<Node, Node> NodeToNodeHashMap;
public:
- AbstractValues(NodeManager* nm);
+ AbstractValues();
~AbstractValues();
/**
* Substitute away all AbstractValues in a node, which replaces all
d_commandStatus = CommandSuccess::instance();
d_solution.clear();
// check whether we should print the status
- if (!d_result.hasSolution()
- || options::sygusOut() == options::SygusSolutionOutMode::STATUS_AND_DEF
- || options::sygusOut() == options::SygusSolutionOutMode::STATUS)
+ std::string sygusOut = solver->getOption("sygus-out");
+ if (!d_result.hasSolution() || sygusOut == "status-and-def"
+ || sygusOut == "status")
{
if (d_result.hasSolution())
{
}
}
// check whether we should print the solution
- if (d_result.hasSolution()
- && options::sygusOut() != options::SygusSolutionOutMode::STATUS)
+ if (d_result.hasSolution() && sygusOut != "status")
{
std::vector<cvc5::Term> synthFuns = sm->getFunctionsToSynthesize();
d_solution << "(" << std::endl;
/* class GetUnsatCoreCommand */
/* -------------------------------------------------------------------------- */
-GetUnsatCoreCommand::GetUnsatCoreCommand() : d_sm(nullptr) {}
+GetUnsatCoreCommand::GetUnsatCoreCommand() : d_solver(nullptr), d_sm(nullptr) {}
void GetUnsatCoreCommand::invoke(cvc5::Solver* solver, SymbolManager* sm)
{
try
{
d_sm = sm;
+ d_solver = solver;
d_result = solver->getUnsatCore();
d_commandStatus = CommandSuccess::instance();
}
else
{
- if (options::printUnsatCoresFull())
+ if (d_solver->getOption("print-unsat-cores-full") == "true")
{
// use the assertions
UnsatCore ucr(termVectorToNodes(d_result));
Command* GetUnsatCoreCommand::clone() const
{
GetUnsatCoreCommand* c = new GetUnsatCoreCommand;
+ c->d_solver = d_solver;
c->d_sm = d_sm;
c->d_result = d_result;
return c;
internal::Language::LANG_AUTO) const override;
protected:
+ /** The solver we were invoked with */
+ cvc5::Solver* d_solver;
/** The symbol manager we were invoked with */
SymbolManager* d_sm;
/** the result of the unsat core call */
void PreprocessProofGenerator::checkEagerPedantic(PfRule r)
{
- if (options::proofCheck() == options::ProofCheckMode::EAGER)
+ if (options().proof.proofCheck == options::ProofCheckMode::EAGER)
{
// catch a pedantic failure now, which otherwise would not be
// triggered since we are doing lazy proof generation
#include "options/proof_options.h"
#include "proof/proof_checker.h"
#include "proof/proof_node_manager.h"
+#include "smt/env.h"
#include "smt/smt_statistics_registry.h"
#include "theory/builtin/proof_checker.h"
#include "theory/theory_id.h"
namespace cvc5::internal {
namespace smt {
-ProofFinalCallback::ProofFinalCallback(ProofNodeManager* pnm)
- : d_ruleCount(smtStatisticsRegistry().registerHistogram<PfRule>(
+ProofFinalCallback::ProofFinalCallback(Env& env)
+ : EnvObj(env),
+ d_ruleCount(statisticsRegistry().registerHistogram<PfRule>(
"finalProof::ruleCount")),
- d_instRuleIds(
- smtStatisticsRegistry().registerHistogram<theory::InferenceId>(
- "finalProof::instRuleId")),
+ d_instRuleIds(statisticsRegistry().registerHistogram<theory::InferenceId>(
+ "finalProof::instRuleId")),
d_annotationRuleIds(
- smtStatisticsRegistry().registerHistogram<theory::InferenceId>(
+ statisticsRegistry().registerHistogram<theory::InferenceId>(
"finalProof::annotationRuleId")),
d_totalRuleCount(
- smtStatisticsRegistry().registerInt("finalProof::totalRuleCount")),
+ statisticsRegistry().registerInt("finalProof::totalRuleCount")),
d_minPedanticLevel(
- smtStatisticsRegistry().registerInt("finalProof::minPedanticLevel")),
+ statisticsRegistry().registerInt("finalProof::minPedanticLevel")),
d_numFinalProofs(
- smtStatisticsRegistry().registerInt("finalProofs::numFinalProofs")),
- d_pnm(pnm),
+ statisticsRegistry().registerInt("finalProofs::numFinalProofs")),
d_pedanticFailure(false)
{
d_minPedanticLevel += 10;
bool& continueUpdate)
{
PfRule r = pn->getRule();
+ ProofNodeManager* pnm = d_env.getProofNodeManager();
+ Assert(pnm != nullptr);
// if not doing eager pedantic checking, fail if below threshold
- if (options::proofCheck() != options::ProofCheckMode::EAGER)
+ if (options().proof.proofCheck != options::ProofCheckMode::EAGER)
{
if (!d_pedanticFailure)
{
Assert(d_pedanticFailureOut.str().empty());
- if (d_pnm->getChecker()->isPedanticFailure(r, d_pedanticFailureOut))
+ if (pnm->getChecker()->isPedanticFailure(r, d_pedanticFailureOut))
{
d_pedanticFailure = true;
}
}
}
- if (options::proofCheck() != options::ProofCheckMode::NONE)
+ if (options().proof.proofCheck != options::ProofCheckMode::NONE)
{
- d_pnm->ensureChecked(pn.get());
+ pnm->ensureChecked(pn.get());
}
- uint32_t plevel = d_pnm->getChecker()->getPedanticLevel(r);
+ uint32_t plevel = pnm->getChecker()->getPedanticLevel(r);
if (plevel != 0)
{
d_minPedanticLevel.minAssign(plevel);
#include <unordered_set>
#include "proof/proof_node_updater.h"
+#include "smt/env_obj.h"
#include "theory/inference_id.h"
#include "util/statistics_stats.h"
namespace smt {
/** Final callback class, for stats and pedantic checking */
-class ProofFinalCallback : public ProofNodeUpdaterCallback
+class ProofFinalCallback : protected EnvObj, public ProofNodeUpdaterCallback
{
public:
- ProofFinalCallback(ProofNodeManager* pnm);
+ ProofFinalCallback(Env& env);
/**
* Initialize, called once for each new ProofNode to process. This initializes
* static information to be used by successive calls to update.
IntStat d_minPedanticLevel;
/** The total number of final proofs */
IntStat d_numFinalProofs;
- /** Proof node manager (used for pedantic checking) */
- ProofNodeManager* d_pnm;
/** Was there a pedantic failure? */
bool d_pedanticFailure;
/** The pedantic failure string for debugging */
: EnvObj(env),
d_cb(env, pppg, rdb, updateScopedAssumptions),
// the update merges subproofs
- d_updater(
- env.getProofNodeManager(), d_cb, options().proof.proofPpMerge),
- d_finalCb(env.getProofNodeManager()),
+ d_updater(env.getProofNodeManager(), d_cb, options().proof.proofPpMerge),
+ d_finalCb(env),
d_finalizer(env.getProofNodeManager(), d_finalCb)
{
}
SolverEngine::SolverEngine(NodeManager* nm, const Options* optr)
: d_env(new Env(nm, optr)),
d_state(new SolverEngineState(*d_env.get(), *this)),
- d_absValues(new AbstractValues(getNodeManager())),
+ d_absValues(new AbstractValues),
d_asserts(new Assertions(*d_env.get(), *d_absValues.get())),
d_routListener(new ResourceOutListener(*this)),
d_smtSolver(nullptr),
bool DatatypesInference::mustCommunicateFact(Node n, Node exp)
{
Trace("dt-lemma-debug") << "Compute for " << exp << " => " << n << std::endl;
- // Force lemmas if option is set
- if (options::dtInferAsLemmas())
- {
- Trace("dt-lemma-debug")
- << "Communicate " << n << " due to option" << std::endl;
- return true;
- }
// Note that equalities due to instantiate are forced as lemmas if
// necessary as they are created. This ensures that terms are shared with
// external theories when necessary. We send the lemma here only if the
// conclusion has kind LEQ (for datatypes size) or OR. Notice that
// all equalities are kept internal, apart from those forced as lemmas
// via instantiate.
- else if (n.getKind() == LEQ || n.getKind() == OR)
+ if (n.getKind() == LEQ || n.getKind() == OR)
{
Trace("dt-lemma-debug")
<< "Communicate " << n << " due to kind" << std::endl;
Node exp,
bool forceLemma)
{
- // if we are forcing the inference to be processed as a lemma, or if the
- // inference must be sent as a lemma based on the policy in
- // mustCommunicateFact.
- if (forceLemma || DatatypesInference::mustCommunicateFact(conc, exp))
+ // if we are forcing the inference to be processed as a lemma, if the
+ // dtInferAsLemmas option is set, or if the inference must be sent as a lemma
+ // based on the policy in mustCommunicateFact.
+ if (forceLemma || options().datatypes.dtInferAsLemmas
+ || DatatypesInference::mustCommunicateFact(conc, exp))
{
d_pendingLem.emplace_back(new DatatypesInference(this, conc, exp, id));
}
return hmin;
}
-CegHandledStatus CegInstantiator::isCbqiQuant(Node q)
+CegHandledStatus CegInstantiator::isCbqiQuant(Node q, bool cegqiAll)
{
Assert(q.getKind() == FORALL);
// compute attributes
ret = CEG_PARTIALLY_HANDLED;
}
}
- if (ret == CEG_UNHANDLED && options::cegqiAll())
+ if (ret == CEG_UNHANDLED && cegqiAll)
{
// try but not exclusively
ret = CEG_PARTIALLY_HANDLED;
* returns CEG_PARTIALLY_HANDLED, then it may be worthwhile to handle the
* quantified formula using cegqi, however other strategies should also be
* tried.
+ *
+ * @param cegqiAll Whether we apply CEQGI to all quantifiers (option
+ * options::cegqiAll).
*/
- static CegHandledStatus isCbqiQuant(Node q);
+ static CegHandledStatus isCbqiQuant(Node q, bool cegqiAll);
//------------------------------------ end static queries
private:
/** The quantified formula of this instantiator */
{
std::map<Node, CegHandledStatus>::iterator it = d_do_cbqi.find(q);
if( it==d_do_cbqi.end() ){
- CegHandledStatus ret = CegInstantiator::isCbqiQuant(q);
+ CegHandledStatus ret =
+ CegInstantiator::isCbqiQuant(q, options().quantifiers.cegqiAll);
Trace("cegqi-quant") << "doCbqi " << q << " returned " << ret << std::endl;
d_do_cbqi[q] = ret;
return ret != CEG_UNHANDLED;
}
else
{
- status = CegInstantiator::isCbqiQuant(d_single_inv);
+ status = CegInstantiator::isCbqiQuant(d_single_inv,
+ options().quantifiers.cegqiAll);
}
}
Trace("sygus-si") << "CegHandledStatus is " << status << std::endl;
if (fo_body.getKind() == FORALL)
{
// must be a CBQI quantifier
- CegHandledStatus hstatus = CegInstantiator::isCbqiQuant(fo_body);
+ CegHandledStatus hstatus =
+ CegInstantiator::isCbqiQuant(fo_body, options().quantifiers.cegqiAll);
if (hstatus < CEG_HANDLED)
{
// abort if less than fully handled
void NormalForm::getExplanation(int index, std::vector<Node>& curr_exp)
{
- if (index == -1 || !options::stringMinPrefixExplain())
+ if (index == -1)
{
curr_exp.insert(curr_exp.end(), d_exp.begin(), d_exp.end());
return;