Zulip Chat Archive
Stream: lean4
Topic: Naming the implicit assumption of an `@`-pattern
Hirotaka Sato (Jul 03 2025 at 06:27):
I don't know how to name the implicit assumption introduced by an @-pattern
def atPatternExample (list : List Nat) : Nat :=
match list with
| [] => sorry
| α@(A :: γ) =>
/-
Here, I want to also have `h : α = A :: γ` in the assumption.
Infoview claims `h✝ : α = A :: γ` with this at-pattern,
but I don't know how to name it.
-/
sorry
Hirotaka Sato (Jul 03 2025 at 06:33):
I understand that the following workaround works, but it's a little too verbose and tedious to use in the true proof that I am currently writing
def atPatternExample (list : List Nat) : Nat :=
match list with
| [] => sorry
| α@(A :: γ) =>
have h : α = A :: γ := by assumption
/-
Here, I want to also have `h : α = A :: γ` in the assumption.
Infoview claims `h✝ : α = A :: γ` with this at-pattern,
but I don't know how to name it.
-/
sorry
Robin Arnez (Jul 03 2025 at 07:37):
The hover on the syntax should tell you everything:
x@eorx@h:ematches the patterneand binds its value to the identifierx. If present, the identifierhis bound to a proof ofx = e.
In other words α@h:(A :: γ)
Last updated: Dec 20 2025 at 21:32 UTC