diff options
author | Morgan Deters <mdeters@cs.nyu.edu> | 2014-03-07 10:24:04 -0500 |
---|---|---|
committer | Morgan Deters <mdeters@cs.nyu.edu> | 2014-03-07 23:48:49 -0500 |
commit | d01269e2d5a02952fbda74dcd9629acfbf23dfd4 (patch) | |
tree | d8f2a90ddd94ade15edf84b48523e7ff76f78554 /src/expr/node.cpp | |
parent | 01cff049fac316d84ee05f747975a26b04e9c3a2 (diff) |
Remove --ite-remove-quant; support pulling ground ITEs out of quantifier bodies; fix bug 551, improper ITE removal under quantifiers.
Diffstat (limited to 'src/expr/node.cpp')
-rw-r--r-- | src/expr/node.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/expr/node.cpp b/src/expr/node.cpp index c88fd187d..34a72e106 100644 --- a/src/expr/node.cpp +++ b/src/expr/node.cpp @@ -55,8 +55,13 @@ UnknownTypeException::UnknownTypeException(TNode n) throw() : /** Is this node constant? (and has that been computed yet?) */ struct IsConstTag { }; struct IsConstComputedTag { }; +struct HasBoundVarTag { }; +struct HasBoundVarComputedTag { }; typedef expr::Attribute<IsConstTag, bool> IsConstAttr; typedef expr::Attribute<IsConstComputedTag, bool> IsConstComputedAttr; +/** Attribute true for expressions with bound variables in them */ +typedef expr::Attribute<HasBoundVarTag, bool> HasBoundVarAttr; +typedef expr::Attribute<HasBoundVarComputedTag, bool> HasBoundVarComputedAttr; template <bool ref_count> bool NodeTemplate<ref_count>::isConst() const { @@ -91,7 +96,29 @@ bool NodeTemplate<ref_count>::isConst() const { } } +template <bool ref_count> +bool NodeTemplate<ref_count>::hasBoundVar() { + assertTNodeNotExpired(); + if(! getAttribute(HasBoundVarComputedAttr())) { + bool hasBv = false; + if(getKind() == kind::BOUND_VARIABLE) { + hasBv = true; + } else { + for(iterator i = begin(); i != end() && !hasBv; ++i) { + hasBv = (*i).hasBoundVar(); + } + } + setAttribute(HasBoundVarAttr(), hasBv); + setAttribute(HasBoundVarComputedAttr(), true); + Debug("bva") << *this << " has bva : " << getAttribute(HasBoundVarAttr()) << std::endl; + return hasBv; + } + return getAttribute(HasBoundVarAttr()); +} + template bool NodeTemplate<true>::isConst() const; template bool NodeTemplate<false>::isConst() const; +template bool NodeTemplate<true>::hasBoundVar(); +template bool NodeTemplate<false>::hasBoundVar(); }/* CVC4 namespace */ |