summaryrefslogtreecommitdiff
path: root/src/theory/bv
diff options
context:
space:
mode:
authorMathias Preiner <mathias.preiner@gmail.com>2018-05-03 22:50:41 -0700
committerAndres Noetzli <andres.noetzli@gmail.com>2018-05-03 22:50:41 -0700
commitcbfcc24f0da280e21de5118cc2c0c6a18a71a629 (patch)
tree649c5f5c49aec6565e76df2a8e9c46f04e9bb5ee /src/theory/bv
parent8a3f9efe5856fc07fbc99b9b606397a5079ddd78 (diff)
Refactor bv-intro-pow2 preprocessing pass. (#1851)
Diffstat (limited to 'src/theory/bv')
-rw-r--r--src/theory/bv/bvintropow2.cpp85
-rw-r--r--src/theory/bv/bvintropow2.h51
2 files changed, 0 insertions, 136 deletions
diff --git a/src/theory/bv/bvintropow2.cpp b/src/theory/bv/bvintropow2.cpp
deleted file mode 100644
index e7b6caaef..000000000
--- a/src/theory/bv/bvintropow2.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/********************* */
-/*! \file bvintropow2.cpp
- ** \verbatim
- ** Top contributors (to current version):
- ** Liana Hadarean, Morgan Deters, Paul Meng
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS
- ** in the top-level source directory) and their institutional affiliations.
- ** All rights reserved. See the file COPYING in the top-level source
- ** directory for licensing information.\endverbatim
- **
- ** \brief [[ Add one-line brief description here ]]
- **
- ** [[ Add lengthier description here ]]
- ** \todo document this file
- **/
-
-#include "theory/bv/bvintropow2.h"
-#include "theory/rewriter.h"
-#include "theory/bv/theory_bv_rewrite_rules_simplification.h"
-
-
-namespace CVC4 {
-namespace theory {
-namespace bv {
-
-void BVIntroducePow2::pow2Rewrite(std::vector<Node>& assertionsToPreprocess){
- NodeMap cache;
- for(size_t i = 0, N= assertionsToPreprocess.size(); i < N; ++i){
- Node curr = assertionsToPreprocess[i];
- Node next = pow2Rewrite(curr, cache);
- if(next != curr){
- Node tmp = Rewriter::rewrite(next);
- next = tmp;
- }
- assertionsToPreprocess[i] = next;
- }
-}
-
-Node BVIntroducePow2::pow2Rewrite(Node node, NodeMap& cache){
- NodeMap::const_iterator ci = cache.find(node);
- if(ci != cache.end()){
- Node incache = (*ci).second;
-
- return incache.isNull() ? node : incache;
- }
-
- Node res = Node::null();
- switch(node.getKind()){
- case kind::AND:
- {
- bool changed = false;
- std::vector<Node> children;
- for(unsigned i = 0, N = node.getNumChildren(); i < N; ++i){
- Node child = node[i];
- Node found = pow2Rewrite(child, cache);
- changed = changed || (child != found);
- children.push_back(found);
- }
- if(changed){
- res = NodeManager::currentNM()->mkNode(kind::AND, children);
- }
- }
- break;
-
- case kind::EQUAL:
- if(node[0].getType().isBitVector()){
- if (RewriteRule<IsPowerOfTwo>::applies(node)) {
- res = RewriteRule<IsPowerOfTwo>::run<false>(node);
- }
- }
- break;
- default:
- break;
- }
-
- cache.insert(std::make_pair(node, res));
- return res.isNull() ? node : res;
-}
-
-
-}/* CVC4::theory::bv namespace */
-}/* CVC4::theory namespace */
-
-}/* CVC4 namespace */
diff --git a/src/theory/bv/bvintropow2.h b/src/theory/bv/bvintropow2.h
deleted file mode 100644
index e335c1339..000000000
--- a/src/theory/bv/bvintropow2.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/********************* */
-/*! \file bvintropow2.h
- ** \verbatim
- ** Top contributors (to current version):
- ** Liana Hadarean, Morgan Deters, Paul Meng
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS
- ** in the top-level source directory) and their institutional affiliations.
- ** All rights reserved. See the file COPYING in the top-level source
- ** directory for licensing information.\endverbatim
- **
- ** \brief [[ Add one-line brief description here ]]
- **
- ** [[ Add lengthier description here ]]
- ** \todo document this file
- **/
-
-
-
-#include "cvc4_private.h"
-#include "expr/node.h"
-
-#include <vector>
-#include <unordered_map>
-
-#ifndef __CVC4__THEORY__BV__BV_INTRO_POW_H
-#define __CVC4__THEORY__BV__BV_INTRO_POW_H
-
-namespace CVC4 {
-namespace theory {
-namespace bv {
-
-
-class BVIntroducePow2 {
-public:
- static void pow2Rewrite(std::vector<Node>& assertionsToPreprocess);
-
-private:
- typedef std::unordered_map<Node, Node, NodeHashFunction> NodeMap;
- static Node pow2Rewrite(Node assertionsToPreprocess, NodeMap& cache);
-};
-
-
-
-}/* CVC4::theory::bv namespace */
-}/* CVC4::theory namespace */
-
-}/* CVC4 namespace */
-
-
-#endif /* __CVC4__THEORY__BV__BV_INTRO_POW_H */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback