Fix issue 5513 (#5757)
authormudathirmahgoub <mudathirmahgoub@gmail.com>
Sat, 9 Jan 2021 14:10:07 +0000 (08:10 -0600)
committerGitHub <noreply@github.com>
Sat, 9 Jan 2021 14:10:07 +0000 (08:10 -0600)
Fix issue5513 by throwing an exception for unsupported bag operators

src/theory/bags/theory_bags.cpp
src/theory/bags/theory_bags.h

index b3251e464f2ee71b472fc2df1ec88917b544c430..21a9d0e53207085ebf8e86a52088ab29c2258d10 100644 (file)
@@ -182,7 +182,24 @@ TrustNode TheoryBags::explain(TNode node) { return d_im.explainLit(node); }
 
 Node TheoryBags::getModelValue(TNode node) { return Node::null(); }
 
-void TheoryBags::preRegisterTerm(TNode node) {}
+void TheoryBags::preRegisterTerm(TNode n)
+{
+  Trace("bags::TheoryBags::preRegisterTerm") << n << std::endl;
+  switch (n.getKind())
+  {
+    case BAG_CARD:
+    case BAG_FROM_SET:
+    case BAG_TO_SET:
+    case BAG_IS_SINGLETON:
+    case DUPLICATE_REMOVAL:
+    {
+      std::stringstream ss;
+      ss << "Term of kind " << n.getKind() << " is not supported yet";
+      throw LogicException(ss.str());
+    }
+    default: break;
+  }
+}
 
 TrustNode TheoryBags::expandDefinition(Node n)
 {
index 09784add9414ce30a31b1d17341791445d20064d..aeae3810e37b3d8c3402d48bcb9989e21d5e681b 100644 (file)
@@ -22,8 +22,8 @@
 #include "theory/bags/bag_solver.h"
 #include "theory/bags/bags_rewriter.h"
 #include "theory/bags/bags_statistics.h"
-#include "theory/bags/inference_manager.h"
 #include "theory/bags/inference_generator.h"
+#include "theory/bags/inference_manager.h"
 #include "theory/bags/solver_state.h"
 #include "theory/theory.h"
 #include "theory/theory_eq_notify.h"
@@ -70,7 +70,7 @@ class TheoryBags : public Theory
   TrustNode explain(TNode) override;
   Node getModelValue(TNode) override;
   std::string identify() const override { return "THEORY_BAGS"; }
-  void preRegisterTerm(TNode node) override;
+  void preRegisterTerm(TNode n) override;
   TrustNode expandDefinition(Node n) override;
   void presolve() override;