Zulip Chat Archive

Stream: lean4

Topic: Anonymous hypothesis works with if, but not with match.


MrQubo (Jan 23 2025 at 17:42):

This works:

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

but this doesn't:

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

although using e.g. h instead of _ works in both. Shouldn't match support anonymous hypothesis as well?

Henrik Böving (Jan 23 2025 at 18:00):

I think that should work yes, could you open an issue?

MrQubo (Jan 23 2025 at 18:07):

I wanted to, but I couldn't find where is the place to report issues with lean. I've tried to find it on https://lean-lang.org/ and https://leanprover-community.github.io/ but no luck.

Henrik Böving (Jan 23 2025 at 19:03):

https://github.com/leanprover/lean4

MrQubo (Jan 24 2025 at 09:42):

Thanks! I've made an issue https://github.com/leanprover/lean4/issues/6759.


Last updated: May 02 2025 at 03:31 UTC