From: Andrew Reynolds Date: Wed, 28 Aug 2019 02:07:13 +0000 (-0500) Subject: Fixes for get-abduct (#3229) X-Git-Tag: cvc5-1.0.0~3989 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=453de9df0af984491f6ced883220fdbf113f078b;p=cvc5.git Fixes for get-abduct (#3229) --- diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp index 1827d902c..3c10516e4 100644 --- a/src/smt/smt_engine.cpp +++ b/src/smt/smt_engine.cpp @@ -5127,7 +5127,7 @@ bool SmtEngine::getAbduct(const Expr& conj, const Type& grammarType, Expr& abd) } Trace("sygus-abduct") << "SmtEngine::getAbduct: conjecture " << conj << std::endl; - std::vector easserts = getAssertions(); + std::vector easserts = getExpandedAssertions(); std::vector axioms; for (unsigned i = 0, size = easserts.size(); i < size; i++) { @@ -5135,7 +5135,12 @@ bool SmtEngine::getAbduct(const Expr& conj, const Type& grammarType, Expr& abd) } std::vector asserts(axioms.begin(), axioms.end()); // negate the conjecture - Node conjn = Node::fromExpr(conj).negate(); + Node conjn = Node::fromExpr(conj); + // must expand definitions + std::unordered_map cache; + conjn = d_private->expandDefinitions(conjn, cache); + // now negate + conjn = conjn.negate(); d_abdConj = conjn.toExpr(); asserts.push_back(conjn); std::string name("A"); diff --git a/src/theory/quantifiers/sygus/sygus_abduct.cpp b/src/theory/quantifiers/sygus/sygus_abduct.cpp index 4f6219343..7e72ecb41 100644 --- a/src/theory/quantifiers/sygus/sygus_abduct.cpp +++ b/src/theory/quantifiers/sygus/sygus_abduct.cpp @@ -278,24 +278,22 @@ Node SygusAbduct::mkAbductionConjecture(const std::string& name, Node instAttr = nm->mkNode(INST_ATTRIBUTE, sygusVar); std::vector iplc; iplc.push_back(instAttr); - if (!axioms.empty()) - { - Node aconj = axioms.size() == 1 ? axioms[0] : nm->mkNode(AND, axioms); - aconj = - aconj.substitute(syms.begin(), syms.end(), vars.begin(), vars.end()); - Trace("sygus-abduct") << "---> Assumptions: " << aconj << std::endl; - Node sc = nm->mkNode(AND, aconj, abdApp); - Node vbvl = nm->mkNode(BOUND_VAR_LIST, vars); - sc = nm->mkNode(EXISTS, vbvl, sc); - Node sygusScVar = nm->mkSkolem("sygus_sc", nm->booleanType()); - sygusScVar.setAttribute(theory::SygusSideConditionAttribute(), sc); - instAttr = nm->mkNode(INST_ATTRIBUTE, sygusScVar); - // build in the side condition - // exists x. A( x ) ^ input_axioms( x ) - // as an additional annotation on the sygus conjecture. In other words, - // the abducts A we procedure must be consistent with our axioms. - iplc.push_back(instAttr); - } + Node aconj = axioms.size() == 0 + ? nm->mkConst(true) + : (axioms.size() == 1 ? axioms[0] : nm->mkNode(AND, axioms)); + aconj = aconj.substitute(syms.begin(), syms.end(), vars.begin(), vars.end()); + Trace("sygus-abduct") << "---> Assumptions: " << aconj << std::endl; + Node sc = nm->mkNode(AND, aconj, abdApp); + Node vbvl = nm->mkNode(BOUND_VAR_LIST, vars); + sc = nm->mkNode(EXISTS, vbvl, sc); + Node sygusScVar = nm->mkSkolem("sygus_sc", nm->booleanType()); + sygusScVar.setAttribute(theory::SygusSideConditionAttribute(), sc); + instAttr = nm->mkNode(INST_ATTRIBUTE, sygusScVar); + // build in the side condition + // exists x. A( x ) ^ input_axioms( x ) + // as an additional annotation on the sygus conjecture. In other words, + // the abducts A we procedure must be consistent with our axioms. + iplc.push_back(instAttr); Node instAttrList = nm->mkNode(INST_PATTERN_LIST, iplc); Node fbvl = nm->mkNode(BOUND_VAR_LIST, abd);