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

pattern matching ignores inaccessibility annotation #6557

Open
3 tasks done
cppio opened this issue Jan 6, 2025 · 0 comments · May be fixed by #6558
Open
3 tasks done

pattern matching ignores inaccessibility annotation #6557

cppio opened this issue Jan 6, 2025 · 0 comments · May be fixed by #6558
Labels
bug Something isn't working P-low We are not planning to work on this issue

Comments

@cppio
Copy link
Contributor

cppio commented Jan 6, 2025

Prerequisites

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

Description

example : (x : Bool × Bool) → x.fst = x.snd ⊕' Unit → Unit
  | (.(b), b), .inl rfl => ()
  | (_, false), _ => ()
  | (_, true), _ => ()

During elaboration, Lean.Elab.Term.ToDepElimPattern.normalize ignores the explicit inaccessible pattern in (.(b), b) and rewrites it to (b, .(b)), which causes an error since the second component is now neither a constructor nor a variable pattern.

Steps to Reproduce

Run the code above.

Expected behavior: The code succeeds with no errors.

Actual behavior: The code results in the following error:

dependent match elimination failed, inaccessible pattern found
  .(fst✝)
constructor expected

Versions

Lean 4.16.0-nightly-2025-01-06
This behavior has existed since Lean 4.0.0-m1

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 6, 2025
@cppio cppio linked a pull request Jan 7, 2025 that will close this issue
@leanprover-bot leanprover-bot added the P-low We are not planning to work on this issue 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-low We are not planning to work on this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants