summaryrefslogtreecommitdiff
path: root/src/theory/theory_engine.cpp
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2021-07-29 11:11:05 -0500
committerGitHub <noreply@github.com>2021-07-29 16:11:05 +0000
commitb685ed411b6814f0810ce8f61d07aa49bd75ea3b (patch)
tree75029fdd0b7b8d82f6296047c10818cb745c9cdb /src/theory/theory_engine.cpp
parentf2672e53fae29abe40fc69b004d1df5be0ce1e8b (diff)
Integrate central equality engine approach into theory engine, add option and regressions (#6943)
This commit makes TheoryEngine take into account whether theories are using the central equality engine. With this commit, the central equality engine can now be optionally enabled via `--ee-mode=central`.
Diffstat (limited to 'src/theory/theory_engine.cpp')
-rw-r--r--src/theory/theory_engine.cpp40
1 files changed, 30 insertions, 10 deletions
diff --git a/src/theory/theory_engine.cpp b/src/theory/theory_engine.cpp
index 58014b06b..63fd6d9b7 100644
--- a/src/theory/theory_engine.cpp
+++ b/src/theory/theory_engine.cpp
@@ -909,13 +909,16 @@ void TheoryEngine::assertToTheory(TNode assertion, TNode originalAssertion, theo
return;
}
- // If sending to the shared terms database, it's also simple
+ // determine the actual theory that will process/explain the fact, which is
+ // THEORY_BUILTIN if the theory uses the central equality engine
+ TheoryId toTheoryIdProp = (Theory::expUsingCentralEqualityEngine(toTheoryId))
+ ? THEORY_BUILTIN
+ : toTheoryId;
+ // If sending to the shared solver, it's also simple
if (toTheoryId == THEORY_BUILTIN) {
- Assert(assertion.getKind() == kind::EQUAL
- || (assertion.getKind() == kind::NOT
- && assertion[0].getKind() == kind::EQUAL))
- << "atom should be an EQUALity, not `" << assertion << "'";
- if (markPropagation(assertion, originalAssertion, toTheoryId, fromTheoryId)) {
+ if (markPropagation(
+ assertion, originalAssertion, toTheoryIdProp, fromTheoryId))
+ {
// assert to the shared solver
bool polarity = assertion.getKind() != kind::NOT;
TNode atom = polarity ? assertion : assertion[0];
@@ -928,7 +931,9 @@ void TheoryEngine::assertToTheory(TNode assertion, TNode originalAssertion, theo
// directly to the apropriate theory
if (fromTheoryId == THEORY_SAT_SOLVER) {
// We know that this is normalized, so just send it off to the theory
- if (markPropagation(assertion, originalAssertion, toTheoryId, fromTheoryId)) {
+ if (markPropagation(
+ assertion, originalAssertion, toTheoryIdProp, fromTheoryId))
+ {
// Is it preregistered
bool preregistered = d_propEngine->isSatLiteral(assertion) && Theory::theoryOf(assertion) == toTheoryId;
// We assert it
@@ -942,6 +947,7 @@ void TheoryEngine::assertToTheory(TNode assertion, TNode originalAssertion, theo
// Propagations to the SAT solver are just enqueued for pickup by
// the SAT solver later
if (toTheoryId == THEORY_SAT_SOLVER) {
+ Assert(toTheoryIdProp == toTheoryId);
if (markPropagation(assertion, originalAssertion, toTheoryId, fromTheoryId)) {
// Enqueue for propagation to the SAT solver
d_propagatedLiterals.push_back(assertion);
@@ -971,7 +977,11 @@ void TheoryEngine::assertToTheory(TNode assertion, TNode originalAssertion, theo
if (normalizedLiteral.isConst()) {
if (!normalizedLiteral.getConst<bool>()) {
// Mark the propagation for explanations
- if (markPropagation(normalizedLiteral, originalAssertion, toTheoryId, fromTheoryId)) {
+ if (markPropagation(normalizedLiteral,
+ originalAssertion,
+ toTheoryIdProp,
+ fromTheoryId))
+ {
// special case, trust node has no proof generator
TrustNode trnn = TrustNode::mkTrustConflict(normalizedLiteral);
// Get the explanation (conflict will figure out where it came from)
@@ -984,7 +994,9 @@ void TheoryEngine::assertToTheory(TNode assertion, TNode originalAssertion, theo
}
// Try and assert (note that we assert the non-normalized one)
- if (markPropagation(assertion, originalAssertion, toTheoryId, fromTheoryId)) {
+ if (markPropagation(
+ assertion, originalAssertion, toTheoryIdProp, fromTheoryId))
+ {
// Check if has been pre-registered with the theory
bool preregistered = d_propEngine->isSatLiteral(assertion) && Theory::theoryOf(assertion) == toTheoryId;
// Assert away
@@ -1509,6 +1521,12 @@ TrustNode TheoryEngine::getExplanation(
{
Assert(explanationVector.size() == 1);
Node conclusion = explanationVector[0].d_node;
+ // if the theory explains using the central equality engine, we always start
+ // with THEORY_BUILTIN.
+ if (Theory::expUsingCentralEqualityEngine(explanationVector[0].d_theory))
+ {
+ explanationVector[0].d_theory = THEORY_BUILTIN;
+ }
std::shared_ptr<LazyCDProof> lcp;
if (isProofEnabled())
{
@@ -1668,7 +1686,9 @@ TrustNode TheoryEngine::getExplanation(
<< "TheoryEngine::explain(): got explanation " << explanation
<< " got from " << toExplain.d_theory << endl;
Assert(explanation != toExplain.d_node)
- << "wasn't sent to you, so why are you explaining it trivially";
+ << "wasn't sent to you, so why are you explaining it trivially, for "
+ "fact "
+ << explanation;
// Mark the explanation
NodeTheoryPair newExplain(
explanation, toExplain.d_theory, toExplain.d_timestamp);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback