Zulip Chat Archive

Stream: mathlib4

Topic: Alias and to_additive


Anatole Dedecker (Jan 26 2024 at 16:56):

What is the correct way to mix to_additive and alias, in particular relative to the autogenerated documentation? I could add the "Alias of" text manually to the docstring of the additive version, but it should really be autogenerated...

Anatole Dedecker (Jan 26 2024 at 16:57):

Also, how does to_additive react to attr := deprecated some_mul_name? Will the additive version be registered as @[deprecated some_add_name]?

Emilie (Shad Amethyst) (Jan 26 2024 at 20:47):

I believe it should be, since parameters to attr are normally comma-separated

Anatole Dedecker (Jan 26 2024 at 22:21):

Yes, but the question is wether it additivizes the name that is passed as an argument to deprecated

Ruben Van de Velde (Jan 26 2024 at 22:26):

I just did

@[to_additive (attr := deprecated) AddMonoid.lcm_addOrder_eq_exponent] -- 2024-01-26
alias lcm_order_eq_exponent := lcm_orderOf_eq_exponent

which seemed to work

Floris van Doorn (Jan 30 2024 at 11:24):

Anatole Dedecker said:

Yes, but the question is wether it additivizes the name that is passed as an argument to deprecated

Arguments given to the deprecated attribute are not additivized, no. Just add the attribute [deprecated ...] afterwards.

Ruben Van de Velde (Jan 30 2024 at 12:04):

Oh, that's annoying. Would it be hard to make this "just work(TM)"?

Floris van Doorn (Jan 31 2024 at 10:31):

to_additive already uses a bunch of hacks to make it interact nicely with some common other attributes. It is indeed hard to make this work properly without redesigning the whole attribute system. We could add an additional hack to make it work specifically with the deprecated tactic, but I don't think that is the way to go.


Last updated: May 02 2025 at 03:31 UTC