Zulip Chat Archive
Stream: Is there code for X?
Topic: Tactic for adding projections to the lctx
Adam Topaz (Sep 23 2025 at 15:17):
Do we have a tactic that, given a term t of a structure S with projections p1, ..., pk, adds the projections t.pi to the local context? Context: I'm experimenting with the use of grind in category theory, and I think such a thing would be useful.
Kenny Lau (Sep 23 2025 at 15:19):
as in, you want let pi_t := t.pi?
Adam Topaz (Sep 23 2025 at 15:20):
yeah, essentially (or have instead of let when appropriate)
Kenny Lau (Sep 23 2025 at 15:20):
is that "basically" cases t?
Adam Topaz (Sep 23 2025 at 15:20):
Kenny Lau said:
is that "basically"
cases t?
Yes, except that I want to keep t around as well.
Adam Topaz (Sep 23 2025 at 15:22):
structure Foo (a : ℕ) where
b : ℕ
h : a = b
example (a : ℕ) (t : Foo a) : True := by
let t_b := t.b
have h_b : a = t_b := t.h
sorry
Kenny Lau (Sep 23 2025 at 15:23):
yep I agree that it would be useful. an "eta-deriver" would also be useful
Adam Topaz (Sep 23 2025 at 15:23):
Kenny Lau said:
an "eta-deriver" would also be useful
What do you mean by this?
Kenny Lau (Sep 23 2025 at 15:25):
import Mathlib.Data.Nat.Notation
structure Foo (a : ℕ) where
b : ℕ
h : a = b
theorem Foo.eta {a : ℕ} (n : Foo a) : n = ⟨n.b, n.h⟩ :=
rfl
Adam Topaz (Sep 23 2025 at 15:25):
Oh I see, you want @[eta] to generate Foo.eta?
Adam Topaz (Sep 23 2025 at 15:26):
Yeah, I agree that would be useful as well.
Michael Rothgang (Sep 24 2025 at 14:39):
I would also have a use for this, in the context of positivity/finiteness/field_simp
Bhavik Mehta (Sep 27 2025 at 02:41):
Adam Topaz said:
Kenny Lau said:
is that "basically"
cases t?Yes, except that I want to keep
taround as well.
Does cases (id t) get you close enough?
Aaron Liu (Sep 27 2025 at 02:47):
you get the parts of t but not the fact that t is made of those parts
Ruben Van de Velde (Sep 27 2025 at 06:24):
cases h : id t?
Last updated: Dec 20 2025 at 21:32 UTC