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

Cannot use hole for context proof in match #6759

Open
3 tasks done
MrQubo opened this issue Jan 23, 2025 · 1 comment · May be fixed by #6853
Open
3 tasks done

Cannot use hole for context proof in match #6759

MrQubo opened this issue Jan 23, 2025 · 1 comment · May be fixed by #6853
Labels
bug Something isn't working P-medium We may work on this issue if we find the time

Comments

@MrQubo
Copy link

MrQubo commented Jan 23, 2025

Prerequisites

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

Description

This code doesn't work:

def last {α : Type} (a : Array α) : Option α :=
  match _ : a.size with
  | 0 => none
  | m + 1 => some a[m]

but works when explicitly naming proof:

def last {α : Type} (a : Array α) : Option α :=
  match h : a.size with
  | 0 => none
  | m + 1 => some a[m]

Context

Hole works with if-then-else:

def last {α : Type} (a : Array α) : Option α :=
  if _ : a.size = 0
    then none
    else some a[a.size-1]

For consistency should also work with match.

Versions

Lean 4.16.0-nightly-2025-01-23

Impact

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

@MrQubo MrQubo added the bug Something isn't working label Jan 23, 2025
@nomeata
Copy link
Collaborator

nomeata commented Jan 23, 2025

Thanks for reporting, I certainly have been hitting this myself

@leanprover-bot leanprover-bot added the P-medium We may work on this issue if we find the time label Jan 28, 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

Successfully merging a pull request may close this issue.

3 participants