diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2021-05-07 14:09:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 19:09:58 +0000 |
commit | 89641ef6aae22610cf544f1e7545178ee6418597 (patch) | |
tree | 672e7991bbc1b7d2e1e5abf0a9b4a38c08b5baa2 /src/smt/smt_engine.cpp | |
parent | 50ff9213e6e6d36cea5a745e5c85ecbf1ca1ab62 (diff) |
Simplifications to expand definitions (#6487)
This removes the expandOnly flag from expandDefinitions.
The use of expandOnly = true is equivalent to applying top-level substitutions only, which should be done explicitly via Env::getTopLevelSubstitutions. It updates the trust substitutions utility to distinguish apply vs applyTrusted for convenience for this purpose.
This also breaks several dependencies in e.g. expand definitions module.
Diffstat (limited to 'src/smt/smt_engine.cpp')
-rw-r--r-- | src/smt/smt_engine.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp index cccb4f544..780ed78ce 100644 --- a/src/smt/smt_engine.cpp +++ b/src/smt/smt_engine.cpp @@ -243,7 +243,7 @@ void SmtEngine::finishInit() { d_model.reset(new Model(tm)); // make the check models utility - d_checkModels.reset(new CheckModels(*d_smtSolver.get())); + d_checkModels.reset(new CheckModels(*d_env.get())); } // global push/pop around everything, to ensure proper destruction @@ -1129,15 +1129,13 @@ Node SmtEngine::simplify(const Node& ex) return d_pp->simplify(ex); } -Node SmtEngine::expandDefinitions(const Node& ex, bool expandOnly) +Node SmtEngine::expandDefinitions(const Node& ex) { - getResourceManager()->spendResource( - Resource::PreprocessStep); - + getResourceManager()->spendResource(Resource::PreprocessStep); SmtScope smts(this); finishInit(); d_state->doPendingPops(); - return d_pp->expandDefinitions(ex, expandOnly); + return d_pp->expandDefinitions(ex); } // TODO(#1108): Simplify the error reporting of this method. @@ -1340,6 +1338,7 @@ std::vector<Node> SmtEngine::getExpandedAssertions() } return eassertsProc; } +Env& SmtEngine::getEnv() { return *d_env.get(); } void SmtEngine::declareSepHeap(TypeNode locT, TypeNode dataT) { @@ -1455,8 +1454,9 @@ void SmtEngine::checkUnsatCore() { Notice() << "SmtEngine::checkUnsatCore(): pushing core assertions" << std::endl; + theory::TrustSubstitutionMap& tls = d_env->getTopLevelSubstitutions(); for(UnsatCore::iterator i = core.begin(); i != core.end(); ++i) { - Node assertionAfterExpansion = expandDefinitions(*i); + Node assertionAfterExpansion = tls.apply(*i, false); Notice() << "SmtEngine::checkUnsatCore(): pushing core member " << *i << ", expanded to " << assertionAfterExpansion << "\n"; coreChecker->assertFormula(assertionAfterExpansion); @@ -1493,6 +1493,14 @@ void SmtEngine::checkModel(bool hardFailure) { Model* m = getAvailableModel("check model"); Assert(m != nullptr); + // check the model with the theory engine for debugging + if (options::debugCheckModels()) + { + TheoryEngine* te = getTheoryEngine(); + Assert(te != nullptr); + te->checkTheoryAssertionsWithModel(hardFailure); + } + // check the model with the check models utility Assert(d_checkModels != nullptr); d_checkModels->checkModel(m, al, hardFailure); |