Avoid trivial equalities in explanation of SETS_CARD_CYCLE (#8635)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Tue, 19 Apr 2022 20:36:54 +0000 (15:36 -0500)
committerGitHub <noreply@github.com>
Tue, 19 Apr 2022 20:36:54 +0000 (20:36 +0000)
This was the root cause of cvc5/cvc5-projects#178.

src/theory/sets/cardinality_extension.cpp

index eed014ea5e3f656b6f5f66bfcf14273f3fbc32c5..78658f7bd41b1bf053fac25feb8ac78c39110f1d 100644 (file)
@@ -639,7 +639,11 @@ void CardinalityExtension::checkCardCyclesRec(Node eqc,
     }
     // now recurse on parents (to ensure their normal will be computed after
     // this eqc)
-    exp.push_back(eqc.eqNode(n));
+    bool needExp = (eqc != n);
+    if (needExp)
+    {
+      exp.push_back(eqc.eqNode(n));
+    }
     for (const std::pair<Node, Node>& cpnc : d_cardParent[n])
     {
       Trace("sets-cycle-debug") << "Traverse card parent " << eqc << " -> "
@@ -650,7 +654,10 @@ void CardinalityExtension::checkCardCyclesRec(Node eqc,
         return;
       }
     }
-    exp.pop_back();
+    if (needExp)
+    {
+      exp.pop_back();
+    }
   }
   curr.pop_back();
   // parents now processed, can add to ordered list