leanprover-community / leanprover-community/lean
λ with ⟨⟩ consumes following implicit arguments
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 434
- 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
If the ⟨⟩ brackets are used in a lambda binder, and the result type is a function with implicit arguments, those arguments are "implicitly introd", as though there were the same number of _ binders after the binder using ⟨⟩.
Steps to Reproduce
Consider the program
structure foo :=
(val : ℕ)
def bar : Π (x : foo) {k₁ k₂ : ℕ} (l : ℕ), ℕ := λ ⟨n⟩ m, m
#reduce bar ⟨1⟩ 2
Expected behavior: bar should be an error, since the right-hand side should be a function of only two arguments.
This is the behavior if k₁ and k₂ are explicit arguments, or if λ ⟨n⟩ is replaced by λ y.
(It makes no difference whether x is explicit or not.)
Actual behavior: bar compiles successfully and the #reduce line prints 2.
Reproduces how often: Always
Versions
Lean (version 3.26.0, commit 5a5c139af3e9, Release)
Ubuntu 20.04 LTS
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 by running the self-contained Lean reproducer and compare the behavior of the lambda using ⟨n⟩ with the versions using explicit arguments or λ y. Trace the compiler entry point that elaborates lambda binders and implicit function arguments. Done means the shown definition is rejected while the intended valid comparisons retain their existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100