]> git.unchartedbackwaters.co.uk Git - francis/stp.git/commitdiff
Bugfix. Terrible! STP r1149 to here will sometimes return the wrong answer. I was...
authortrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Sat, 26 Feb 2011 02:54:10 +0000 (02:54 +0000)
committertrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Sat, 26 Feb 2011 02:54:10 +0000 (02:54 +0000)
git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@1169 e59a4935-1847-0410-ae03-e826735625c1

src/simplifier/FindPureLiterals.h

index fd0a769831342dddfa0123d6400c104350b96811..61fd505321b598bb49d9dd2cab92a5ab447d2913 100644 (file)
@@ -60,7 +60,7 @@ public:
     stp->GetRunTimes()->start(RunTimes::PureLiterals);
 
     build(n , truePolarity);
-    bool changed;
+    bool changed = false;
 
     map<ASTNode, int>::const_iterator it = nodeToPolarity.begin();
     while (it != nodeToPolarity.end())
@@ -69,11 +69,13 @@ public:
         const int polarity = it->second;
         if (n.GetType() == BOOLEAN_TYPE && n.GetKind() == SYMBOL && polarity != bothPolarity)
           {
-            //cerr << "--> Pure Literal" << n.GetName() << " " << polarity << endl;
-            if (polarity == truePolarity)
-              simplifier->UpdateSubstitutionMap(n,n.GetSTPMgr()->ASTTrue);
-            if (polarity == falsePolarity)
-              simplifier->UpdateSubstitutionMap(n,n.GetSTPMgr()->ASTFalse);
+              if (polarity == truePolarity)
+                simplifier->UpdateSubstitutionMap(n,n.GetSTPMgr()->ASTTrue);
+              else
+              {
+                assert (polarity == falsePolarity);
+                simplifier->UpdateSubstitutionMap(n,n.GetSTPMgr()->ASTFalse);
+              }
             changed = true;
           }
         it++;
@@ -88,14 +90,15 @@ public:
     if (n.isConstant())
       return;
 
-    map<ASTNode, int>::const_iterator it = nodeToPolarity.find(n);
+    map<ASTNode, int>::iterator it = nodeToPolarity.find(n);
     if (it != nodeToPolarity.end())
       {
         int lookupPolarity = it->second;
-        if (polarity & lookupPolarity !=0 )
+        if ((polarity & lookupPolarity) !=0 )
           return; // already traversed.
+
         lookupPolarity |= polarity;
-        nodeToPolarity.insert(make_pair(n,lookupPolarity));
+        it->second = lookupPolarity;
       }
     else
       {