summaryrefslogtreecommitdiff
path: root/src/theory/arith/arith_utilities.h
diff options
context:
space:
mode:
authorTim King <taking@cs.nyu.edu>2014-03-08 14:44:56 -0500
committerTim King <taking@cs.nyu.edu>2014-03-08 14:44:56 -0500
commitbbb8637c877a312759547d6159be38866f47eb21 (patch)
tree86b217cb1889d8d6ad5411f7f4e02994d4e3bef1 /src/theory/arith/arith_utilities.h
parentd01269e2d5a02952fbda74dcd9629acfbf23dfd4 (diff)
parent0f47a28a18bb9a599514e199d355b8e793cf06de (diff)
Merge pull request #18 from timothy-king/master
Merging in the glpk changes
Diffstat (limited to 'src/theory/arith/arith_utilities.h')
-rw-r--r--src/theory/arith/arith_utilities.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/theory/arith/arith_utilities.h b/src/theory/arith/arith_utilities.h
index 11626c1de..98aa43e71 100644
--- a/src/theory/arith/arith_utilities.h
+++ b/src/theory/arith/arith_utilities.h
@@ -238,6 +238,25 @@ inline Node flattenAnd(Node n){
return NodeManager::currentNM()->mkNode(kind::AND, out);
}
+inline Node getIdentity(Kind k){
+ switch(k){
+ case kind::AND:
+ return NodeManager::currentNM()->mkConst<bool>(true);
+ case kind::PLUS:
+ return NodeManager::currentNM()->mkConst(Rational(1));
+ default:
+ Unreachable();
+ }
+}
+
+inline Node safeConstructNary(NodeBuilder<>& nb){
+ switch(nb.getNumChildren()){
+ case 0: return getIdentity(nb.getKind());
+ case 1: return nb[0];
+ default: return (Node)nb;
+ }
+}
+
}/* CVC4::theory::arith namespace */
}/* CVC4::theory namespace */
}/* CVC4 namespace */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback