diff options
author | Morgan Deters <mdeters@gmail.com> | 2011-05-05 22:23:50 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2011-05-05 22:23:50 +0000 |
commit | fef0f8190fc7e5f3b88b33e7574b7df1e629e80f (patch) | |
tree | dfdda739bf5008096860e19f6b9275fb2a257960 /src/util/boolean_simplification.cpp | |
parent | 90d8205a86b698c2548108ca4db124fe9c3f738a (diff) |
Merge from nonclausal-simplification-v2 branch:
* Preprocessing-time, non-clausal, Boolean simplification round to
support "quasi-non-linear rewrites" as discussed at last few meetings.
* --simplification=none is the default for now, but we'll probably
change that to --simplification=incremental. --simplification=batch
is also a possibility. See --simplification=help for details.
* RecursionBreaker<T> now uses a hash set for the seen trail.
* Fixes to TLS stuff to support that.
* Fixes to theory and SmtEngine documentation.
* Fixes to stream indentation.
* Other miscellaneous stuff.
Diffstat (limited to 'src/util/boolean_simplification.cpp')
-rw-r--r-- | src/util/boolean_simplification.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/util/boolean_simplification.cpp b/src/util/boolean_simplification.cpp index a154f342f..92534bfd4 100644 --- a/src/util/boolean_simplification.cpp +++ b/src/util/boolean_simplification.cpp @@ -20,7 +20,7 @@ namespace CVC4 { -void +bool BooleanSimplification::push_back_associative_commute_recursive (Node n, std::vector<Node>& buffer, Kind k, Kind notK, bool negateNode) throw(AssertionException) { @@ -28,17 +28,40 @@ BooleanSimplification::push_back_associative_commute_recursive for(; i != end; ++i){ Node child = *i; if(child.getKind() == k){ - push_back_associative_commute_recursive(child, buffer, k, notK, negateNode); + if(! push_back_associative_commute_recursive(child, buffer, k, notK, negateNode)) { + return false; + } }else if(child.getKind() == kind::NOT && child[0].getKind() == notK){ - push_back_associative_commute_recursive(child, buffer, notK, k, !negateNode); + if(! push_back_associative_commute_recursive(child[0], buffer, notK, k, !negateNode)) { + return false; + } }else{ if(negateNode){ - buffer.push_back(negate(child)); + if(child.getMetaKind() == kind::metakind::CONSTANT) { + if((k == kind::AND && child.getConst<bool>()) || + (k == kind::OR && !child.getConst<bool>())) { + buffer.clear(); + buffer.push_back(negate(child)); + return false; + } + } else { + buffer.push_back(negate(child)); + } }else{ - buffer.push_back(child); + if(child.getMetaKind() == kind::metakind::CONSTANT) { + if((k == kind::OR && child.getConst<bool>()) || + (k == kind::AND && !child.getConst<bool>())) { + buffer.clear(); + buffer.push_back(child); + return false; + } + } else { + buffer.push_back(child); + } } } } + return true; }/* BooleanSimplification::push_back_associative_commute_recursive() */ }/* CVC4 namespace */ |