diff options
author | Tim King <taking@cs.nyu.edu> | 2014-03-08 14:44:56 -0500 |
---|---|---|
committer | Tim King <taking@cs.nyu.edu> | 2014-03-08 14:44:56 -0500 |
commit | bbb8637c877a312759547d6159be38866f47eb21 (patch) | |
tree | 86b217cb1889d8d6ad5411f7f4e02994d4e3bef1 /src/theory/arith/arith_utilities.h | |
parent | d01269e2d5a02952fbda74dcd9629acfbf23dfd4 (diff) | |
parent | 0f47a28a18bb9a599514e199d355b8e793cf06de (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.h | 19 |
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 */ |