Solve equalities between Boolean variables in presolve. (#2390)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Tue, 28 Aug 2018 20:25:12 +0000 (15:25 -0500)
committerGitHub <noreply@github.com>
Tue, 28 Aug 2018 20:25:12 +0000 (15:25 -0500)
src/theory/booleans/circuit_propagator.cpp
src/theory/booleans/theory_bool.cpp

index d04b71ee18dda91c51e526b55bce675ee87b9140..2548cf5c39ac652e3a8a2ad1a53228549e62450b 100644 (file)
@@ -368,7 +368,9 @@ bool CircuitPropagator::propagate() {
     Debug("circuit-prop") << "CircuitPropagator::propagate(): assigned to " << (assignment ? "true" : "false") << std::endl;
 
     // Is this an atom
-    bool atom = Theory::theoryOf(current) != THEORY_BOOL || current.isVar();
+    bool atom = Theory::theoryOf(current) != THEORY_BOOL || current.isVar()
+                || (current.getKind() == kind::EQUAL
+                    && (current[0].isVar() && current[1].isVar()));
 
     // If an atom, add to the list for simplification
     if (atom) {
index 3c6801f28639a9d636aba049c4fc7eb4164733c1..d025c49661bb76fb2328d875c700bd035777fcf9 100644 (file)
@@ -40,20 +40,20 @@ Theory::PPAssertStatus TheoryBool::ppAssert(TNode in, SubstitutionMap& outSubsti
 
   // Add the substitution from the variable to its value
   if (in.getKind() == kind::NOT) {
-    if (in[0].getKind() == kind::VARIABLE) {
+    if (in[0].isVar())
+    {
       outSubstitutions.addSubstitution(in[0], NodeManager::currentNM()->mkConst<bool>(false));
-    } else {
-      return PP_ASSERT_STATUS_UNSOLVED;
+      return PP_ASSERT_STATUS_SOLVED;
     }
   } else {
-    if (in.getKind() == kind::VARIABLE) {
+    if (in.isVar())
+    {
       outSubstitutions.addSubstitution(in, NodeManager::currentNM()->mkConst<bool>(true));
-    } else {
-      return PP_ASSERT_STATUS_UNSOLVED;
+      return PP_ASSERT_STATUS_SOLVED;
     }
   }
 
-  return PP_ASSERT_STATUS_SOLVED;
+  return Theory::ppAssert(in, outSubstitutions);
 }
 
 /*