From: Andrew Reynolds Date: Fri, 8 Oct 2021 20:32:24 +0000 (-0500) Subject: Make skolem definition manager robust to function skolems (#7327) X-Git-Tag: cvc5-1.0.0~1098 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ef9375982d084eaf3b80674bf4c269f6f87de942;p=cvc5.git Make skolem definition manager robust to function skolems (#7327) This led to a model soundness issue in a development branch that reorganizes theory preprocessing. This ensures that skolem definition manager looks for skolems that appear in operators. This is important for inputs like: (declare-fun h (Int) Int) (declare-fun f (Int) Int) (declare-fun g (Int) Int) (assert (= h (ite A f g))) (assert (= (h 0) ...))) --- diff --git a/src/prop/skolem_def_manager.cpp b/src/prop/skolem_def_manager.cpp index 5b51d730c..36849424e 100644 --- a/src/prop/skolem_def_manager.cpp +++ b/src/prop/skolem_def_manager.cpp @@ -121,20 +121,33 @@ bool SkolemDefManager::hasSkolems(TNode n) const } else { + if (cur.getMetaKind() == kind::metakind::PARAMETERIZED) + { + visit.push_back(cur.getOperator()); + } visit.insert(visit.end(), cur.begin(), cur.end()); } } else { visit.pop_back(); - bool hasSkolem = false; - for (TNode i : cur) + bool hasSkolem; + if (cur.getMetaKind() == kind::metakind::PARAMETERIZED + && cur.getOperator().getAttribute(HasSkolemAttr())) { - Assert(i.getAttribute(HasSkolemComputedAttr())); - if (i.getAttribute(HasSkolemAttr())) + hasSkolem = true; + } + else + { + hasSkolem = false; + for (TNode i : cur) { - hasSkolem = true; - break; + Assert(i.getAttribute(HasSkolemComputedAttr())); + if (i.getAttribute(HasSkolemAttr())) + { + hasSkolem = true; + break; + } } } cur.setAttribute(HasSkolemAttr(), hasSkolem); @@ -172,11 +185,13 @@ void SkolemDefManager::getSkolems(TNode n, { skolems.insert(cur); } + continue; } - else + if (cur.getMetaKind() == kind::metakind::PARAMETERIZED) { - visit.insert(visit.end(), cur.begin(), cur.end()); + visit.push_back(cur.getOperator()); } + visit.insert(visit.end(), cur.begin(), cur.end()); } } while (!visit.empty()); }