Skip to content
New issue

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

dot ident pattern does not treat parameters as inaccessible #6570

Open
3 tasks done
cppio opened this issue Jan 8, 2025 · 0 comments
Open
3 tasks done

dot ident pattern does not treat parameters as inaccessible #6570

cppio opened this issue Jan 8, 2025 · 0 comments
Labels
bug Something isn't working P-medium We may work on this issue if we find the time

Comments

@cppio
Copy link
Contributor

cppio commented Jan 8, 2025

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

When elaborating a constructor pattern, the parameters are treated as inaccessible.

example : List α → Bool
  | List.nil (α := α) => false
  | List.cons (α := α) .. => true

In this example, (α := α) is equivalent to (α := .(α)) and does not bind a new variable. However, switching to the dot ident notation does not have this behavior, causing the example to fail.

example : List α → Bool
  | .nil (α := α) => false
  | .cons (α := α) .. => true

Context

This difference in behavior is relied upon in a mathlib test:
https://github.com/leanprover-community/mathlib4/blob/a7fc949f1b05c2a01e01c027fd9f480496a1253e/MathlibTest/congr.lean#L176-L181
Changing the pattern .nil n to walk.nil n causes it to no longer succeed.

Steps to Reproduce

Run the code above with the dot ident notation.

Expected behavior: No errors, same as the code which uses the full constructor name.

Actual behavior: The following error:

type mismatch
  []
has type
  List α : Type ?u.19
but is expected to have type
  List α✝ : Type ?u.9

Versions

Lean 4.16.0-nightly-2025-01-07
This bug has been present since the introduction of the dot ident feature in e1fa9c1

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@cppio cppio added the bug Something isn't working label Jan 8, 2025
cppio added a commit to leanprover-community/mathlib4 that referenced this issue Jan 9, 2025
@leanprover-bot leanprover-bot added the P-medium We may work on this issue if we find the time label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P-medium We may work on this issue if we find the time
Projects
None yet
Development

No branches or pull requests

2 participants