Zulip Chat Archive

Stream: lean4

Topic: names of types of fields of a structure


Matthew Ballard (Jan 19 2024 at 13:59):

Suppose I have the Name of a structure. Returning the names of the fields as projection functions is straightforward. If I want instead the names of the types that are being projected to, what is the shortest path to that?

Kyle Miller (Jan 19 2024 at 14:16):

You can get constant declaration with let some decl := (← getEnv).find? projectionName | unreachable!, and then you can do something like forallTelescope decl.type fun _ body => pure body.getAppFn.constName? to get an Option Name

Matthew Ballard (Jan 19 2024 at 14:21):

Thanks. That’s about where I was. I was surprised that this isn’t part of the StructureInfo


Last updated: May 02 2025 at 03:31 UTC