Zulip Chat Archive

Stream: metaprogramming / tactics

Topic: More granular binder info control in `mkForallFvars`


Robin Carlier (Apr 28 2025 at 12:52):

When deconstructing a forall expression using forallMetaTelescope, the binder infos are extracted and returned in an array. When reconstructing such an expression using mkForallFVars, the argument binderInfoForMVars only accepts a single BinderInfo, and so every binders in the reconstructed expressions are the same.
Is there a relatively easy way around this that would let me reconstruct a forall expression in such a way that I can specify possibly different binder infos for every var?

Robin Carlier (Apr 28 2025 at 13:17):

(For reasons I don’t fully understand, it looks like mapForallTelescope is able to reconstruct the correct binders, despite using at first glance mkForallFVars behind the scene. I would be glad to have an explanation about the why, is it because it somehow tries to re-cast the result into the expected type of the telescope, which bundles the binder infos?)

Jovan Gerbscheid (Apr 28 2025 at 15:36):

mapForallTelescope uses forallTelescope, not forallMetaTelescope. The difference is that forallTelescope introduces free variables, while forallMetaTelescope introduces meta variables. Free variables store their BinderInfo in the environment. You might need to use free variables instead of metavariables, depending on your use case.

Robin Carlier (Apr 28 2025 at 15:39):

Thanks for the explanation.


Last updated: May 02 2025 at 03:31 UTC