From: Dejan Jovanović Date: Sun, 27 May 2012 16:59:01 +0000 (+0000) Subject: some reordering to keep invariants X-Git-Tag: cvc5-1.0.0~8139 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=21f9e53792ba5f94594fccb7bef880aa77b266cb;p=cvc5.git some reordering to keep invariants --- diff --git a/src/theory/uf/equality_engine.cpp b/src/theory/uf/equality_engine.cpp index 72966d0b3..5093e5a7b 100644 --- a/src/theory/uf/equality_engine.cpp +++ b/src/theory/uf/equality_engine.cpp @@ -414,17 +414,6 @@ bool EqualityEngine::merge(EqualityNode& class1, EqualityNode& class2, std::vect trigger.classId = class1Id; // If they became the same, call the trigger if (otherTrigger.classId == class1Id) { - const TriggerInfo& triggerInfo = d_equalityTriggersOriginal[currentTrigger]; - if (triggerInfo.trigger.getKind() == kind::EQUAL && !triggerInfo.polarity) { - TNode equality = triggerInfo.trigger; - EqualityNodeId original = getNodeId(equality); - d_deducedDisequalityReasons.push_back(EqualityPair(original, d_falseId)); - if (!storePropagatedDisequality(equality[0], equality[1], 1)) { - // Go to the next trigger - currentTrigger = trigger.nextTrigger; - continue; - } - } // Id of the real trigger is half the internal one triggersFired.push_back(currentTrigger); } @@ -492,6 +481,25 @@ bool EqualityEngine::merge(EqualityNode& class1, EqualityNode& class2, std::vect // Now merge the lists class1.merge(class2); + + // Go through the triggers and store the dis-equalities + unsigned i = 0, j = 0; + for (; i < triggersFired.size();) { + const TriggerInfo& triggerInfo = d_equalityTriggersOriginal[triggersFired[i]]; + if (triggerInfo.trigger.getKind() == kind::EQUAL && !triggerInfo.polarity) { + TNode equality = triggerInfo.trigger; + EqualityNodeId original = getNodeId(equality); + d_deducedDisequalityReasons.push_back(EqualityPair(original, d_falseId)); + if (!storePropagatedDisequality(equality[0], equality[1], 1)) { + // Already notified, go to the next trigger + ++ i; + continue; + } + } + // Copy + triggersFired[j++] = triggersFired[i++]; + } + triggersFired.resize(j); // Notify the trigger term merges TriggerTermSetRef class2triggerRef = d_nodeIndividualTrigger[class2Id];