“implicit lambda” works with `exact`, but not `apply`
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
I find this surprising:
example : {a : Nat} → a+1 = a.succ := rfl -- works
example : {a : Nat} → a+1 = a.succ := by exact rfl -- works
example : {a : Nat} → a+1 = a.succ := by apply rfl -- does not work
As a user I expect to apply work when exact works.
By using a wrong term we can see a bit more what’s happening:
example : {a : Nat} → a+1 = a.succ := by exact Iff.rfl
type mismatch
Iff.rfl
has type
?m.960 ↔ ?m.960 : Prop
but is expected to have type
a✝ + 1 = a✝.succ : Prop
the following variables have been introduced by the implicit lambda feature
a✝ : Nat
you can disable implicit lambdas using `@` or writing a lambda expression with `{}` or `[]` binder annotations.
So exact somehow triggers “implicit lambda feature” but apply doesn’t. Should it?
Versions
4.12.0-nightly-2024-09-16
Additional Information
This causes unexpected(?) regressions(?) when using @[refl] rather than extending the rfl macro, #5359.
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
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 reproducing the three examples from the issue on Lean 4 version 4.12.0-nightly-2024-09-16, comparing exact and apply with implicit lambdas enabled and disabled. Investigate the elaboration paths for these tactics and the interaction with @[refl] noted in #5359. Done means the intended behavior is decided and the examples either agree or the discrepancy is documented and covered by a regression test.
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
- Mostly clear
- Newbie friendliness
- 35/100