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.
25 lines
568 B
Text
25 lines
568 B
Text
/-!
|
|
# Auxiliary declaration name resolution in tactic blocks
|
|
|
|
https://github.com/leanprover/lean4/issues/7073
|
|
|
|
It should be possible to refer to auxiliary declarations by partially- or fully-qualified names
|
|
in tactic blocks.
|
|
-/
|
|
|
|
theorem A : True ∧ True := by
|
|
let rec B := trivial
|
|
exact And.intro A.B A.C
|
|
where C := trivial
|
|
|
|
namespace M
|
|
|
|
theorem N : True ∧ True ∧ True :=
|
|
let rec O := by exact M.N.P
|
|
by exact ⟨N.O, M.N.O, N.P⟩
|
|
where P := trivial
|
|
|
|
theorem Q.R : Nat → True
|
|
| 0 => trivial
|
|
| 1 => by exact Q.R 0
|
|
| n + 2 => by exact M.Q.R (n + 1)
|