We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please put an X between the brackets as you perform the following steps:
Incorrect "unused variable" warnings are reported around lambdas with pattern matches and explicit type annotations. See example below.
#check λα (p : α → Prop) (⟨x, _⟩ : {a // p a}) => x -- ^ ^ ^ -- 1 2 3
Expected behavior: No unused variable warnings.
Actual behavior: Lean reports 3 unused variable warnings at the indicated locations:
p
a
4.13.0
The "2" warning goes away if we use p in the body of the lambda:
#check λα (p : α → Prop) (⟨x, _⟩ : {a // p a}) => (x, p) -- ^ ^ ^ -- 1 2 3
as if Lean believes 2 is p's binding site which in turn shadows the p bound at 1.
The problem goes away if matching is moved out of the lambda:
#check λα (p : α → Prop) (x : {a // p a}) => match x with | ⟨x, _⟩ => x
The use of (Subtype.mk _ _) versus ⟨_, _⟩ makes no difference.
(Subtype.mk _ _)
⟨_, _⟩
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered:
Lean claims p at location 2 and a at location 3 are unused, even though these are not the variables' binding sites.
This behavior is indicative of an auto implicit, which has its definition site set to the first use if the variable.
Sorry, something went wrong.
This is a bug in the match compiler:
match
lean4/src/Lean/Elab/Match.lean
Lines 648 to 649 in 6e60d13
No branches or pull requests
Prerequisites
Please put an X between the brackets as you perform the following steps:
https://github.com/leanprover/lean4/issues
Avoid dependencies to Mathlib or Batteries.
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
Incorrect "unused variable" warnings are reported around lambdas with pattern matches and explicit type annotations. See example below.
Context
Steps to Reproduce
Expected behavior: No unused variable warnings.
Actual behavior: Lean reports 3 unused variable warnings at the indicated locations:
p
at location 1 is unused, even though though 2 is its use.p
at location 2 anda
at location 3 are unused, even though these are not the variables' binding sites.Versions
4.13.0
Additional Information
The "2" warning goes away if we use
p
in the body of the lambda:as if Lean believes 2 is
p
's binding site which in turn shadows thep
bound at 1.The problem goes away if matching is moved out of the lambda:
The use of
(Subtype.mk _ _)
versus⟨_, _⟩
makes no difference.Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: