Zulip Chat Archive

Stream: lean4

Topic: How to inspect attributes?


Josh Tilles (Aug 28 2022 at 00:21):

Given some identifier, is it possible to view what (if any) attributes are associated with it?

XY explanation: I'm reviewing some old notes I made when learning Lean 3 and I'm trying to determine what still holds in Lean 4. In this particular case, I had written down "The command instance is syntax sugar for attribute [instance, reducible]."

Mario Carneiro (Aug 28 2022 at 02:43):

I don't think the instance command implies reducible

Mario Carneiro (Aug 28 2022 at 02:43):

it's just instance = @[instance] def

Mario Carneiro (Aug 28 2022 at 02:45):

But for your question, there is no uniform mechanism for determining the attributes on a declaration in lean 4. Each attribute stores its data in a custom data structure, which may or may not allow getting the information back out again. Some attributes have no permanent association at all and just do a thing when executed

Kevin Buzzard (Aug 28 2022 at 08:58):

In lean 3 this is just #print right?

Mario Carneiro (Aug 28 2022 at 08:59):

yes

Mario Carneiro (Aug 28 2022 at 09:01):

in lean 4 I think you won't ever see attributes in the output of #print

Mario Carneiro (Aug 28 2022 at 09:03):

actually from the code it looks like you can see @[reducible] and @[irreducible] but nothing else

Mario Carneiro (Aug 28 2022 at 09:04):

A general system for regurgitating attributes is still TODO I think

Mario Carneiro (Aug 28 2022 at 09:06):

my inclination is to have a registration mechanism where each new attribute adds a print plugin which allows print to query the attribute's state and reconstruct either a Syntax or MessageData object which will then be collated and used by #print


Last updated: Dec 20 2023 at 11:08 UTC