1 /********************* */
2 /*! \file boolean_simplification.cpp
4 ** Top contributors (to current version):
5 ** Morgan Deters, Tim King
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2016 by the authors listed in the file AUTHORS
8 ** in the top-level source directory) and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing information.\endverbatim
12 ** \brief Simple routines for Boolean simplification
14 ** Simple, commonly-used routines for Boolean simplification.
17 #include "smt_util/boolean_simplification.h"
22 BooleanSimplification::push_back_associative_commute_recursive
23 (Node n
, std::vector
<Node
>& buffer
, Kind k
, Kind notK
, bool negateNode
)
24 throw(AssertionException
) {
25 Node::iterator i
= n
.begin(), end
= n
.end();
28 if(child
.getKind() == k
){
29 if(! push_back_associative_commute_recursive(child
, buffer
, k
, notK
, negateNode
)) {
32 }else if(child
.getKind() == kind::NOT
&& child
[0].getKind() == notK
){
33 if(! push_back_associative_commute_recursive(child
[0], buffer
, notK
, k
, !negateNode
)) {
39 if((k
== kind::AND
&& child
.getConst
<bool>()) ||
40 (k
== kind::OR
&& !child
.getConst
<bool>())) {
42 buffer
.push_back(negate(child
));
46 buffer
.push_back(negate(child
));
50 if((k
== kind::OR
&& child
.getConst
<bool>()) ||
51 (k
== kind::AND
&& !child
.getConst
<bool>())) {
53 buffer
.push_back(child
);
57 buffer
.push_back(child
);
63 }/* BooleanSimplification::push_back_associative_commute_recursive() */