Prevent letification from shadowing variables (#3042)
authorAndres Noetzli <noetzli@stanford.edu>
Wed, 5 Jun 2019 20:01:34 +0000 (13:01 -0700)
committerGitHub <noreply@github.com>
Wed, 5 Jun 2019 20:01:34 +0000 (13:01 -0700)
commit6b01e8740111e69219e5d733e1123955f8cd2ea7
tree78dfded555702242e0f44aa98924ecce541b7599
parent9af5e9653582a18b1871dfc3774ab50dd24463ce
Prevent letification from shadowing variables (#3042)

Fixes #3005. When printing nodes, we introduce `let` expressions on the
fly. However, when doing that, we have to be careful that we don't
shadow existing variables with the same name. When quantifiers are
involved, we do not descend into the quantifiers to avoid letifying
terms with bound variables that then go out of scope (see #1863). Thus,
to avoid shadowing variables appearing in quantifiers, we have to
collect all the variables appearing in that term to make sure that the
let does not shadow them. In #3005, the issue was caused by a `let` that
was introduced outside of a quantifier and then was shadowed in the body
of the quantifier by another `let` introduced for that body.
src/expr/node_algorithm.cpp
src/expr/node_algorithm.h
src/printer/dagification_visitor.cpp
src/printer/dagification_visitor.h
test/regress/CMakeLists.txt
test/regress/regress0/printer/let_shadowing.smt2 [new file with mode: 0644]