Zulip Chat Archive

Stream: mathlib4

Topic: Naming of lemmas about / and % on Int


Michael Stoll (Sep 04 2023 at 16:34):

While trying to find a home for

theorem Int.mul_ediv_le {m : } (h : 0 < m) (n : ) : m * (n / m)  n := ...

I noticed that relevant lemmas in Std.Data.Int.DivMod use ediv and emod in their names (e.g., docs#Int.ediv_add_emod, which is used in the proof), whereas in Mathlib, we have, e.g., docs#Int.eq_of_mod_eq_of_natAbs_sub_lt_natAbs (in Mathlib.Data.Int.Div).

What is the naming convention here? Should the lemma above be Int.mul_div_le instead?

Michael Stoll (Sep 07 2023 at 10:55):

:ping_pong: It would be nice to get some reaction to this question. Is there a convention? Are there opionions?

Yaël Dillies (Sep 07 2023 at 10:57):

Use div and mod. ediv and emod are only used in Core and Std lemma names.

Yaël Dillies (Sep 07 2023 at 10:58):

mathlib overrides the definition of div and mod to be ediv and emod instead of quot and rem.

Michael Stoll (Sep 07 2023 at 11:13):

OK, thanks!
It is a bit unfortunate that there is some inconsistency here between Core/Std and Mathlib, but I guess it can't really be helped.

Yaël Dillies (Sep 07 2023 at 11:25):

We're not changing the mathlib definition because this is the mathematically sensible one. So the only way out is if core Lean changed its mind, which it probably won't either.

Scott Morrison (Sep 07 2023 at 12:06):

From memory long ago core agreed to change, but it is not high priority to actually do so. I think everyone agrees the Mathlib conventions are the correct optimal ones.


Last updated: Dec 20 2023 at 11:08 UTC