diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2020-11-18 08:34:12 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 08:34:12 -0600 |
commit | 3c246952ce90ae7c27b4c0646fce05bc69037f46 (patch) | |
tree | abb7ef449ad0329157a5e5188a7500e8ea1d55c6 /src/parser/smt2/smt2.cpp | |
parent | 8cdef42785fd294d1727ce1df1b11d754c9bb3d1 (diff) |
Use symbol manager for get assignment (#5451)
This replaces the previous methods for get-assignment which involving making a DefinedNamedFunctIonCommand and storing the expression names map in the SmtEngine.
Note: we now limit :named terms to those not beneath quantifiers and let-bindings.
Diffstat (limited to 'src/parser/smt2/smt2.cpp')
-rw-r--r-- | src/parser/smt2/smt2.cpp | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/parser/smt2/smt2.cpp b/src/parser/smt2/smt2.cpp index 892c628dc..b9279fcb0 100644 --- a/src/parser/smt2/smt2.cpp +++ b/src/parser/smt2/smt2.cpp @@ -1218,28 +1218,16 @@ api::Term Smt2::applyParseOp(ParseOp& p, std::vector<api::Term>& args) return ret; } -api::Term Smt2::setNamedAttribute(api::Term& expr, const SExpr& sexpr) +void Smt2::notifyNamedExpression(api::Term& expr, std::string name) { - if (!sexpr.isKeyword()) - { - parseError("improperly formed :named annotation"); - } - std::string name = sexpr.getValue(); checkUserSymbol(name); - // ensure expr is a closed subterm - if (expr.getExpr().hasFreeVariable()) - { - std::stringstream ss; - ss << ":named annotations can only name terms that are closed"; - parseError(ss.str()); - } - // check that sexpr is a fresh function symbol, and reserve it - reserveSymbolAtAssertionLevel(name); - // define it - api::Term func = bindVar(name, expr.getSort(), ExprManager::VAR_FLAG_DEFINED); - // remember the last term to have been given a :named attribute + // remember the expression name in the symbol manager + getSymbolManager()->setExpressionName(expr, name, false); + // define the variable + defineVar(name, expr); + // set the last named term, which ensures that we catch when assertions are + // named setLastNamedTerm(expr, name); - return func; } api::Term Smt2::mkAnd(const std::vector<api::Term>& es) |