Zulip Chat Archive

Stream: mathlib4

Topic: Pattern match against implicit arguments


Eric Wieser (Feb 09 2023 at 00:42):

Is there any way to name implicit arguments in a pattern match? the context is

import Mathlib.Data.Fin.VecNotation

example {k : } {x : Fin k  } : x = x := by
  induction x using Fin.consInduction with
  | h0 => rfl
  | h x₀ x ih => rfl  -- how do I name `n` here? Why is `k` still around?

James Gallicchio (Feb 09 2023 at 02:41):

You can use @s in patterns now -- so @h n x0 x ih should work

James Gallicchio (Feb 09 2023 at 02:43):

as for why k is still around, I have no idea. maybe induction is now smarter about not generalizing stuff when it doesn't have to? unsure

Mario Carneiro (Feb 09 2023 at 03:08):

why wouldn't k still be around? AFAIK induction never removes the "original" variables from the context unless it is reverting them for generalizing

Eric Wieser (Feb 09 2023 at 09:39):

It always removed them in Lean3

Eric Wieser (Feb 09 2023 at 09:40):

Because they stop existing anywhere else in the context, so in a proof they become useless


Last updated: Dec 20 2023 at 11:08 UTC