Fixes cvc5/cvc5-projects#501.
I am considering making this detail internal to SkolemManager to avoid similar issues in the future. However, there are some subtle performance implications in doing so, so this will be addressed later.
NodeManager* nm = NodeManager::currentNM();
SkolemManager* sm = nm->getSkolemManager();
- Node x = sm->mkPurifySkolem(node, "bagChoose");
+ // the skolem will occur in a term context, thus we give it Boolean
+ // term variable kind immediately.
+ SkolemManager::SkolemFlags flags = node.getType().isBoolean()
+ ? SkolemManager::SKOLEM_BOOL_TERM_VAR
+ : SkolemManager::SKOLEM_DEFAULT;
+ Node x = sm->mkPurifySkolem(
+ node, "bagChoose", "a variable used to eliminate bag choose", flags);
Node A = node[0];
TypeNode bagType = A.getType();
TypeNode ufType = nm->mkFunctionType(bagType, bagType.getBagElementType());
{
TypeNode elementType = eqc.getType().getSetElementType();
bool elementTypeFinite = d_env.isFiniteType(elementType);
- if (isModelValueBasic(eqc))
+ bool isBasic = isModelValueBasic(eqc);
+ Trace("sets-model") << "mkModelValueElementsFor: " << eqc
+ << ", isBasic = " << isBasic
+ << ", isFinite = " << elementTypeFinite
+ << ", els = " << els << std::endl;
+ if (isBasic)
{
std::map<Node, Node>::iterator it = d_eqc_to_card_term.find(eqc);
if (it != d_eqc_to_card_term.end())
// equality or disequality between members affects the number of elements
// in a set. Therefore we need to split on (= x y) for kind SET_MEMBER.
// Example:
- // Suppose (= (member x S) member(y S)) is true and there are
+ // Suppose (set.member x S) = (set.member y S) = true and there are
// no other members in S. We would get S = {x} if (= x y) is true.
// Otherwise we would get S = {x, y}.
if (a.getKind() != SET_MEMBER && d_state.areEqual(a, b))
Node n = (*eqc_i);
if (n != eqc)
{
- Trace("sets-eqc") << n << " (" << n.isConst() << ") ";
+ if (TraceIsOn("sets-eqc"))
+ {
+ Trace("sets-eqc") << n;
+ if (n.isConst())
+ {
+ Trace("sets-eqc") << " (const) ";
+ }
+ }
}
TypeNode tnn = n.getType();
if (isSet)
NodeManager* nm = NodeManager::currentNM();
SkolemManager* sm = nm->getSkolemManager();
- Node x = sm->mkPurifySkolem(node, "setChoose");
+ // the skolem will occur in a term context, thus we give it Boolean
+ // term variable kind immediately.
+ SkolemManager::SkolemFlags flags = node.getType().isBoolean()
+ ? SkolemManager::SKOLEM_BOOL_TERM_VAR
+ : SkolemManager::SKOLEM_DEFAULT;
+ Node x = sm->mkPurifySkolem(
+ node, "setChoose", "a variable used to eliminate set choose", flags);
Node A = node[0];
TypeNode setType = A.getType();
ensureFirstClassSetType(setType);
regress0/sets/proj-issue177.smt2
regress0/sets/proj-issue486-sets-split-eq.smt2
regress0/sets/proj-issue493-choose-det.smt2
+ regress0/sets/proj-issue501-choose-bool-term-var.smt2
regress0/sets/rec_copy_loop_check_heap_access_43_4.smt2
regress0/sets/setel-eq.smt2
regress0/sets/sets-deq-dd.smt2
--- /dev/null
+; COMMAND-LINE: -q
+; EXPECT: sat
+(set-logic ALL)
+(set-option :sets-ext true)
+(set-option :fmf-bound true)
+(declare-const x (Bag (Set Bool)))
+(declare-const x1 (Set Bool))
+(declare-const x3 (Set Bool))
+(declare-const x6 (Set Bool))
+(assert (set.choose (ite (set.is_singleton x3) x6 x1)))
+(assert (<= (set.card x6) (bag.count x6 x)))
+(check-sat)