This PR ensures that names suggested by tactics like `simp?` are not shadowed by auxiliary declarations in the local context and that names of `let rec` and `where` declarations are correctly resolved in tactic blocks. This PR contains the following potentially breaking changes: * Moves the `auxDeclToFullName` map from `TermElab.Context` to `LocalContext`. * Refactors `Lean.Elab.Term.resolveLocalName : Name → TermElabM …` to `Lean.resolveLocalName [MonadResolveName m] [MonadEnv m] [MonadLCtx m] : Name → m …`. * Refactors the `TermElabM` action `Lean.Elab.Term.withAuxDecl` to a monad-polymorphic action `Lean.Meta.withAuxDecl`. * Adds an optional `filter` argument to `Lean.unresolveNameGlobal`. Closes #6706, closes #7073.
22 lines
521 B
Text
22 lines
521 B
Text
/-!
|
|
# `simp?`-suggested names conflicting with auxiliary declarations
|
|
|
|
https://github.com/leanprover/lean4/issues/6706
|
|
|
|
This test ensures that "unresolved" names provided by `simp?` do not conflict with local auxiliary
|
|
declarations.
|
|
-/
|
|
|
|
def P := True
|
|
theorem N.A.B : P := trivial
|
|
/-- info: Try this: simp only [N.A.B] -/
|
|
#guard_msgs in
|
|
theorem N.X.A.B : P := by
|
|
simp? [N.A.B]
|
|
|
|
/-- info: Try this: simp only [_root_.N.A.B] -/
|
|
#guard_msgs in
|
|
theorem A : P :=
|
|
let rec N.A.B := ()
|
|
by simp? [_root_.N.A.B]
|
|
where B := ()
|