From: trevor_hansen Date: Thu, 14 Apr 2011 05:31:06 +0000 (+0000) Subject: Extra BVXOR simplification rules. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=61c4e7478adbe11f767484a8538be22499653c77;p=francis%2Fstp.git Extra BVXOR simplification rules. git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@1275 e59a4935-1847-0410-ae03-e826735625c1 --- diff --git a/src/AST/NodeFactory/SimplifyingNodeFactory.cpp b/src/AST/NodeFactory/SimplifyingNodeFactory.cpp index a4cbc2d..944518f 100644 --- a/src/AST/NodeFactory/SimplifyingNodeFactory.cpp +++ b/src/AST/NodeFactory/SimplifyingNodeFactory.cpp @@ -407,6 +407,28 @@ ASTNode SimplifyingNodeFactory::CreateSimpleEQ(const ASTVec& children) } } } + + if (k1 == BEEV::BVCONST && k2 == BEEV::BVXOR && in2.Degree() == 2 && in2[0].GetKind() == BEEV::BVCONST ) + { + return NodeFactory::CreateNode(BEEV::EQ,NodeFactory::CreateTerm(BEEV::BVXOR,width,in1,in2[0] ), in2[1]); + } + + if (k2 == BEEV::BVCONST && k1 == BEEV::BVXOR && in1.Degree() == 2 && in1[0].GetKind() == BEEV::BVCONST ) + { + return NodeFactory::CreateNode(BEEV::EQ,NodeFactory::CreateTerm(BEEV::BVXOR,width,in2,in1[0] ), in1[1]); + } + + if (k2 == BEEV::BVXOR && in2.Degree() == 2 && in1 == in2[0]) + { + return NodeFactory::CreateNode(BEEV::EQ, bm.CreateZeroConst(width), in2[1]); + } + + if (k1 == BEEV::BVXOR && in1.Degree() == 2 && in2 == in1[0]) + { + return NodeFactory::CreateNode(BEEV::EQ, bm.CreateZeroConst(width), in1[1]); + } + + //last resort is to CreateNode return hashing.CreateNode(BEEV::EQ, children); }