From 73bc16fbba65ca8d8cdc9dd6674ae9280658ee9a Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Mon, 5 Apr 2021 10:21:55 -0500 Subject: Fix subtyping for sets care graph (#6278) We were getting types for set singleton/membership in a way that was unsafe for subtyping, which was leading to incorrectly computing care graphs for sets of reals. Fixes #5705. --- src/theory/sets/theory_sets_private.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/theory') diff --git a/src/theory/sets/theory_sets_private.cpp b/src/theory/sets/theory_sets_private.cpp index 8d005c6fe..ea7e773b7 100644 --- a/src/theory/sets/theory_sets_private.cpp +++ b/src/theory/sets/theory_sets_private.cpp @@ -985,9 +985,20 @@ void TheorySetsPrivate::computeCareGraph() { Trace("sets-cg-debug") << "...build for " << f1 << std::endl; Assert(d_equalityEngine->hasTerm(f1)); - // break into index based on operator, and type of first argument (since - // some operators are parametric) - TypeNode tn = f1[0].getType(); + // break into index based on operator, and the type of the element + // type of the proper set, which notice must be safe wrt subtyping. + TypeNode tn; + if (k == kind::SINGLETON) + { + // get the type of the singleton set (not the type of its element) + tn = f1.getType().getSetElementType(); + } + else + { + Assert (k == kind::MEMBER); + // get the element type of the set (not the type of the element) + tn = f1[1].getType().getSetElementType(); + } std::vector reps; bool hasCareArg = false; for (unsigned j = 0; j < f1.getNumChildren(); j++) -- cgit v1.2.3