small change to equality assertions so that one doesn't get x = y and y = x
authorDejan Jovanović <dejan.jovanovic@gmail.com>
Sat, 16 Jun 2012 23:58:07 +0000 (23:58 +0000)
committerDejan Jovanović <dejan.jovanovic@gmail.com>
Sat, 16 Jun 2012 23:58:07 +0000 (23:58 +0000)
src/theory/theory_engine.cpp

index 92e4b17df45e7376ac6141444e4a65822fd9813e..161d0febde5a9a0b8a3fc07cde71b2fccdc4105b 100644 (file)
@@ -894,13 +894,17 @@ void TheoryEngine::assertToTheory(TNode assertion, theory::TheoryId toTheoryId,
     }
   }
 
-  // Normalize to lhs < rhs
+  // Normalize to lhs < rhs if not a sat literal
   Assert(atom.getKind() == kind::EQUAL);
   Assert(atom[0] != atom[1]);
+  
   Node normalizedAtom = atom;
-  if (atom[0] > atom[1]) {
-    normalizedAtom = atom[1].eqNode(atom[0]);
-  }
+  if (!d_propEngine->isSatLiteral(normalizedAtom)) {
+    Node reverse = atom[1].eqNode(atom[0]);
+    if (d_propEngine->isSatLiteral(reverse) || atom[0] > atom[1]) {
+      normalizedAtom = reverse;
+    }  
+  } 
   Node normalizedAssertion = polarity ? normalizedAtom : normalizedAtom.notNode();
 
   // Try and assert (note that we assert the non-normalized one)