Zulip Chat Archive

Stream: mathlib4

Topic: to_additive on MulZeroClass


Christian Merten (Mar 10 2024 at 11:35):

While working with shrinks, I encountered a to_additive failure that I tracked down to docs#Equiv.instMulZeroClassShrink which is tagged with to_additive and produces docs#Equiv.instAddZeroClassShrink (which has identical type signature).

Currently adding to_additive in (docs#Equiv.instMulOneClassShrink)

@[to_additive]
noncomputable instance [Small.{v} α] [MulOneClass α] : MulOneClass (Shrink.{v} α) :=
  (equivShrink α).symm.mulOneClass

yields a warning that the additive declaration already exists. Indeed, it generates the name Equiv.instAddZeroClassShrink which is the non-sensical docs#Equiv.instAddZeroClassShrink.

I suggest to remove the to_additive attribute on docs#Equiv.instMulZeroClassShrink and put it instead on docs#Equiv.instMulOneClassShrink. Do you agree?

(In general I suspect that any to_additive tag on something related to MulZeroClass is wrong).

Yaël Dillies (Mar 10 2024 at 12:10):

Yeah that just looks like an oversight

Christian Merten (Mar 10 2024 at 12:16):

#11277


Last updated: May 02 2025 at 03:31 UTC