leanprover-community / leanprover-community/lean
Kernel failed to type-check due to name collision involving `include`
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 433
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Checked that your issue isn't already filed.
- Specifically, check out the wishlist, open RFCs,
or feature requests.
- Specifically, check out the wishlist, open RFCs,
- Reduced the issue to a self-contained, reproducible test case.
- Checked that your issue isn't already filed.
Description
Under the following conditions, we get an error in the kernel:
- two
variables, one depending on another - the dependent one is included, transitively
includeing its dependency - there is a local variable with the same name as the dependency
- the included
variablesare not used in the declaration
Steps to Reproduce
The following code errors:
variables (a : ℕ)
variables (ha : a = a)
include ha
theorem ex (a : ℕ) : a = a := rfl
/-
error:
kernel failed to type check declaration 'ex' this is usually due to a buggy tactic or a bug in the builtin elaborator
elaborated type:
a = a → ℕ → ∀ (a : ℕ), a = a
elaborated value:
λ (ha : a = a) (a a : ℕ), rfl
nested exception message:
failed to add declaration to environment, it contains local constants
-/
Expected behavior: No errors in the kernel, like when there's no name clash.
Actual behavior: An error:
error:
kernel failed to type check declaration 'ex' this is usually due to a buggy tactic or a bug in the builtin elaborator
elaborated type:
a = a → ℕ → ∀ (a : ℕ), a = a
elaborated value:
λ (ha : a = a) (a a : ℕ), rfl
nested exception message:
failed to add declaration to environment, it contains local constants
Reproduces how often: always
Versions
Lean (version 3.45.0, commit 22b09be35ef6, Release)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the self-contained Lean reproducer under Lean 3.45.0, focusing on the interaction between dependent variables, transitive include, and the local name collision. Done means the declaration type-checks without the kernel reporting local constants in the environment, while the no-name-clash case continues to work.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100