Zulip Chat Archive

Stream: lean4

Topic: Matching on Exprs


Jannis Limperg (Jun 23 2021 at 11:23):

I want to check that a constant has a specific type (in my application, MVarId -> MetaM (List MVarId)). In Lean 3, I would match the constant's type against the pattern `(MVarId -> MetaM (List MVarId)). In Lean 4, afaict these expression quotations are not a thing any more, so what are my options (ideally in MetaM or lower)? I can think of a couple of inelegant solutions, but I'm sure you have something elegant as well.

Sebastian Ullrich (Jun 23 2021 at 11:29):

In Lean core, we usually put such a type behind an abbreviation and then check for the abbreviation name literally. But for true quotations you should take a look at @Gabriel Ebner's https://github.com/gebner/quote4

Jannis Limperg (Jun 23 2021 at 11:37):

All right, thanks. I'll use the abbrev hack for now to avoid the dependency, but Gabriel's quotations look very cool.


Last updated: Dec 20 2023 at 11:08 UTC