diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2020-03-16 10:37:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 10:37:19 -0700 |
commit | 33f77f7e95575cbaf5249042fa83d7b0d0650ce0 (patch) | |
tree | 985a074d0cec25a6eadbbb1c7621d1a9bacc1b4d /src | |
parent | 227cd8c26c508b7b444fbed6f2868f90c8281eed (diff) |
Create master equality engine at context level 0 (#4081)
Fixes #4077. The master equality engine in `TheoryEngine` was being
created at SAT context level 1. If the context was popped to level zero
by `(reset-assertions)`, `true` and `false` were removed from the master
equality engine, which lead for example to `(= ((_ extract 3 3) x) (_
bv1 1))` and `(_ bv1 4)` being merged (this can be gathered from looking
at `-t equality`). This commit fixes the issue by postponing the global
context pushes until after the theory engine has been initialized.
Diffstat (limited to 'src')
-rw-r--r-- | src/smt/smt_engine.cpp | 10 | ||||
-rw-r--r-- | src/theory/uf/equality_engine.cpp | 5 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp index 5fc0189c3..d2919143b 100644 --- a/src/smt/smt_engine.cpp +++ b/src/smt/smt_engine.cpp @@ -925,11 +925,6 @@ void SmtEngine::finishInit() d_private->addUseTheoryListListener(d_theoryEngine); - // global push/pop around everything, to ensure proper destruction - // of context-dependent data structures - d_userContext->push(); - d_context->push(); - // ensure that our heuristics are properly set up setDefaults(); @@ -951,6 +946,11 @@ void SmtEngine::finishInit() Trace("smt-debug") << "Finishing init for theory engine..." << std::endl; d_theoryEngine->finishInit(); + // global push/pop around everything, to ensure proper destruction + // of context-dependent data structures + d_userContext->push(); + d_context->push(); + Trace("smt-debug") << "Set up assertion list..." << std::endl; // [MGD 10/20/2011] keep around in incremental mode, due to a // cleanup ordering issue and Nodes/TNodes. If SAT is popped diff --git a/src/theory/uf/equality_engine.cpp b/src/theory/uf/equality_engine.cpp index 693b7bd66..b6896e45d 100644 --- a/src/theory/uf/equality_engine.cpp +++ b/src/theory/uf/equality_engine.cpp @@ -81,6 +81,11 @@ void EqualityEngine::init() { Debug("equality") << "EqualityEdge::EqualityEngine(): edge_null = " << +null_edge << std::endl; Debug("equality") << "EqualityEdge::EqualityEngine(): trigger_null = " << +null_trigger << std::endl; + // If we are not at level zero when we initialize this equality engine, we + // may remove true/false from the equality engine when we pop to level zero, + // which leads to issues. + Assert(d_context->getLevel() == 0); + d_true = NodeManager::currentNM()->mkConst<bool>(true); d_false = NodeManager::currentNM()->mkConst<bool>(false); |