Zulip Chat Archive

Stream: mathlib4

Topic: unmatched cases


Abhinav Menon (Oct 31 2024 at 11:32):

Hello! I have a function that uses a match on PNat, whose first case is 1. In the second case, I want to have the result that the argument is greater than 1 (using the fact that it would have matched the first case if it was 1). Is this possible?

This is a MWE:

def f (n : PNat) :  :=
  match n with
  | 1, _⟩ => 1
  | k, h =>
      let h' : k > 1 := by
        sorry
      5

Ruben Van de Velde (Oct 31 2024 at 11:33):

Can you write k+2 there?

Abhinav Menon (Oct 31 2024 at 11:38):

Hmm, wouldn't that give h : k + 2 > 0?

Abhinav Menon (Oct 31 2024 at 11:44):

Ah, never mind, sorry

Abhinav Menon (Oct 31 2024 at 11:44):

I see what to do

Abhinav Menon (Oct 31 2024 at 11:50):

Thank you!


Last updated: May 02 2025 at 03:31 UTC