OK, now the rewrite issues are fixed
authorClark Barrett <barrett@cs.nyu.edu>
Mon, 11 Jun 2012 17:31:13 +0000 (17:31 +0000)
committerClark Barrett <barrett@cs.nyu.edu>
Mon, 11 Jun 2012 17:31:13 +0000 (17:31 +0000)
src/theory/bv/theory_bv_rewrite_rules_normalization.h
src/theory/bv/theory_bv_rewriter.cpp
src/theory/rewriter.cpp

index f5577e2ed908dea4b3cc45daa8e761c9342773b7..6ac9da7cbf933aad60717ac0d4028047da9f3a66 100644 (file)
@@ -300,10 +300,10 @@ Node RewriteRule<MultSimplify>::apply(TNode node) {
     TNode current = node[i];
     if (current.getKind() == kind::CONST_BITVECTOR) {
       BitVector value = current.getConst<BitVector>();
-      if(value == BitVector(size, (unsigned) 0)) {
+      constant = constant * value;
+      if(constant == BitVector(size, (unsigned) 0)) {
         return utils::mkConst(size, 0); 
       }
-      constant = constant * current.getConst<BitVector>();
     } else {
       children.push_back(current); 
     }
@@ -543,8 +543,8 @@ Node RewriteRule<SolveEq>::apply(TNode node) {
     newRight = utils::mkSortedNode(kind::BITVECTOR_PLUS, childrenRight);
   }
 
-  Assert(newLeft == Rewriter::rewrite(newLeft));
-  Assert(newRight == Rewriter::rewrite(newRight));
+  //  Assert(newLeft == Rewriter::rewrite(newLeft));
+  //  Assert(newRight == Rewriter::rewrite(newRight));
 
   if (newLeft == newRight) {
     Assert (newLeft == utils::mkConst(size, (unsigned)0));
index 85ccbc787fd788940603269fabbe86602aa3f6a8..25cbae68cec76f10a6d430801f055884308c2e67 100644 (file)
@@ -525,13 +525,21 @@ RewriteResponse TheoryBVRewriter::RewriteEqual(TNode node, bool preregister) {
     Node resultNode = LinearRewriteStrategy
       < RewriteRule<FailEq>,
         RewriteRule<SimplifyEq>,
-        RewriteRule<ReflexivityEq>,
-        RewriteRule<SolveEq>
+        RewriteRule<ReflexivityEq>
         >::apply(node);
 
+    if(RewriteRule<SolveEq>::applies(resultNode)) {
+      resultNode = RewriteRule<SolveEq>::run<false>(resultNode);
+      if (resultNode != node) {
+        return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+      }
+    }
+
     if(RewriteRule<BitwiseEq>::applies(resultNode)) {
       resultNode = RewriteRule<BitwiseEq>::run<false>(resultNode);
-      return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+      if (resultNode != node) {
+        return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+      }
     }
 
     return RewriteResponse(REWRITE_DONE, resultNode); 
index 7d5f541c03854b22b684e03cadbdafc4bcc05f6d..0c5cada09f193a96348df1aef599ab86077d0cb9 100644 (file)
@@ -163,6 +163,7 @@ Node Rewriter::rewriteTo(theory::TheoryId theoryId, Node node) {
         TheoryId newTheoryId = Theory::theoryOf(response.node);
         if (newTheoryId != (TheoryId) rewriteStackTop.theoryId || response.status == REWRITE_AGAIN_FULL) {
           // In the post rewrite if we've changed theories, we must do a full rewrite
+          Assert(response.node != rewriteStackTop.node);
           rewriteStackTop.node = rewriteTo(newTheoryId, response.node);
           break;
         } else if (response.status == REWRITE_DONE) {
@@ -173,7 +174,8 @@ Node Rewriter::rewriteTo(theory::TheoryId theoryId, Node node) {
          rewriteStackTop.node = response.node;
           break;
         }
-        // Check for trivial rewrite loop of size 2
+        // Check for trivial rewrite loops of size 1 or 2
+        Assert(response.node != rewriteStackTop.node);
         Assert(Rewriter::callPostRewrite((TheoryId) rewriteStackTop.theoryId, response.node).node != rewriteStackTop.node);
        rewriteStackTop.node = response.node;
       }