Update to let inlining

This commit is contained in:
Martin Blicha 2023-08-11 21:39:51 +02:00
parent bbd7ef447f
commit 4101c67cba

View File

@ -484,8 +484,8 @@ namespace
SMTLib2Expression & operator[](std::string const& varName) SMTLib2Expression & operator[](std::string const& varName)
{ {
auto it = bindings.find(varName); auto it = bindings.find(varName);
assert(it != bindings.end()); solAssert(it != bindings.end());
assert(!it->second.empty()); solAssert(!it->second.empty());
return it->second.back(); return it->second.back();
} }
@ -529,14 +529,14 @@ namespace
auto const& atom = asAtom(expr); auto const& atom = asAtom(expr);
if (bindings.has(atom)) if (bindings.has(atom))
expr = bindings[atom]; expr = bindings[atom];
return;
} }
else
{
auto& subexprs = asSubExpressions(expr); auto& subexprs = asSubExpressions(expr);
assert(!subexprs.empty()); solAssert(!subexprs.empty());
auto const& first = subexprs.at(0); auto const& first = subexprs.at(0);
if (isAtom(first) && asAtom(first) == "let") if (isAtom(first) && asAtom(first) == "let")
{ {
solAssert(subexprs.size() >= 3);
solAssert(!isAtom(subexprs[1])); solAssert(!isAtom(subexprs[1]));
auto& bindingExpressions = asSubExpressions(subexprs[1]); auto& bindingExpressions = asSubExpressions(subexprs[1]);
// process new bindings // process new bindings
@ -571,7 +571,6 @@ namespace
inlineLetExpressions(subexpr, bindings); inlineLetExpressions(subexpr, bindings);
} }
} }
}
void inlineLetExpressions(SMTLib2Expression& expr) void inlineLetExpressions(SMTLib2Expression& expr)
{ {