Zulip Chat Archive

Stream: mathlib4

Topic: to_additive translating pow to nsmul


Ruben Van de Velde (Jan 11 2023 at 20:34):

It seems like mathlib3 to_additive can translate pow to nsmul rather than smul (e.g. docs#set.nsmul_subset_nsmul), but mathlib4 doesn't. Is that known?

Yaël Dillies (Jan 11 2023 at 20:35):

Nevermind, I can't read

Floris van Doorn (Jan 12 2023 at 12:16):

In Lean 3 we had the translations

pow -> nsmul
npow -> nsmul
zpow -> zsmul

This is a bit inconsistent, and in many files we translate pow to smul, so I tried changing the translation in mathlib4: pow -> smul. This was probably a bad idea without backporting the change. Shall I change it back to pow -> nsmul in mathlib4?
Do we have an idea whether we have more lemmas that we want to be called nsmul than lemmas that want to be called smul?

Floris van Doorn (Jan 12 2023 at 12:22):

I opened mathlib4#1502 as WIP PR

Eric Wieser (Jan 12 2023 at 12:34):

I woudl expect the vast majority want to be called nsmul, there are vanishingly few places where the pow operator is generalized to more than just nat

Eric Wieser (Jan 12 2023 at 12:35):

(docs#pi.has_pow is the only one that comes to mind)

Floris van Doorn (Jan 12 2023 at 12:40):

But we're not consistent in always calling (n : ℕ) • _ nsmul and _ ^ (n : ℕ) pow. But you're probably right anyway, that the Lean 3 heuristic matches the current lemma names much better.

Eric Wieser (Jan 12 2023 at 12:43):

My claim would be that that inconsistency is accidental not deliberate, and we should fix such cases when we find them

Floris van Doorn (Jan 12 2023 at 12:47):

I'll try to flag such inconsistencies in mathlib4#1502. After that is merged, someone can go through the comments and change the names.

Floris van Doorn (Jan 23 2023 at 13:44):

I think I fixed all errors in mathlib4#1502, which is now ready for review


Last updated: Dec 20 2023 at 11:08 UTC