From: Andrew Reynolds Date: Fri, 3 Jun 2022 20:02:16 +0000 (-0500) Subject: Fix check for whether a term contains an uninterpreted constant (#8845) X-Git-Tag: cvc5-1.0.1~72 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=846189ff975b206326edc1540578c3f8df72138c;p=cvc5.git Fix check for whether a term contains an uninterpreted constant (#8845) Fixes #8842. We now say "unknown" for the benchmark on that issue. --- diff --git a/src/theory/quantifiers/term_util.cpp b/src/theory/quantifiers/term_util.cpp index 4df5d26df..342732965 100644 --- a/src/theory/quantifiers/term_util.cpp +++ b/src/theory/quantifiers/term_util.cpp @@ -15,6 +15,8 @@ #include "theory/quantifiers/term_util.h" +#include "expr/array_store_all.h" +#include "expr/function_array_const.h" #include "expr/node_algorithm.h" #include "expr/skolem_manager.h" #include "theory/arith/arith_msum.h" @@ -215,26 +217,40 @@ int TermUtil::getTermDepth( Node n ) { } bool TermUtil::containsUninterpretedConstant( Node n ) { - if (!n.hasAttribute(ContainsUConstAttribute()) ){ - bool ret = false; - if (n.getKind() == UNINTERPRETED_SORT_VALUE - && n.getType().isUninterpretedSort()) - { - ret = true; - } - else + if (n.hasAttribute(ContainsUConstAttribute())) + { + return n.getAttribute(ContainsUConstAttribute()) != 0; + } + bool ret = false; + Kind k = n.getKind(); + if (k == UNINTERPRETED_SORT_VALUE) + { + Assert(n.getType().isUninterpretedSort()); + ret = true; + } + else if (k == STORE_ALL) + { + ret = containsUninterpretedConstant(n.getConst().getValue()); + } + else if (k == FUNCTION_ARRAY_CONST) + { + ret = containsUninterpretedConstant( + n.getConst().getArrayValue()); + } + else + { + for (const Node& nc : n) { - for( unsigned i=0; i