Zulip Chat Archive
Stream: mathlib4
Topic: Using (le/lt/ge/gt)_zero instead of (non)pos/neg
David Ang (May 20 2025 at 17:32):
Is it possible to enforce the naming convention of le_zero/lt_zero/ge_zero/gt_zero instead of pos/neg/nonpos/nonneg? The latter does not save much character space, but the former has the important advantage of not clashing with neg being negation (e.g. what should add_neg be?). I'm sure this has been discussed countless times, but I couldn't find a topic precisely about this.
Edward van de Meent (May 20 2025 at 17:45):
(possibly unpopular opinion: it should be add_neg_eq if it refers to x + -y = ..., which would disambiguate these uses)
David Ang (May 20 2025 at 17:47):
I think that's precisely my point - there is no need to have _eq if we don't allow ... -> x + y < 0 to be called add_neg in the first place.
Edward van de Meent (May 20 2025 at 17:49):
sure, but i think _eq does a good enough job that we don't need to change this.
David Ang (May 20 2025 at 17:52):
The other issue with x < 0 being neg is that there are two identical things being given different names, which I'd imagine is annoying in general.
David Ang (May 20 2025 at 17:53):
This is similar to x + 1 being add_one and succ amongst other things, but we do have Nat.succ x so that's understandable.
Yury G. Kudryashov (May 21 2025 at 03:51):
There were some discussions about that. AFAIR, they came to nothing.
Yury G. Kudryashov (May 21 2025 at 03:52):
(note: it should be zero_le_*, not *_ge_zero)
Alex Meiburg (May 21 2025 at 20:11):
Side note: docs#if_pos and docs#if_neg have always been a confusing name choice to me, in particular how they almost-clash with docs#ite_pos and docs#ite_neg. (Similar dif/dite versions.)
David Ang (May 21 2025 at 20:13):
I’d argue these should be if_true and if_false and zero_lt_ite and ite_lt_zero
Kevin Buzzard (May 21 2025 at 20:13):
The problem is that true means something else :-/ But I agree that the names feel more descriptive!
Ruben Van de Velde (May 21 2025 at 20:17):
if_of_true could work, if_true is currently correct
Alex Meiburg (May 22 2025 at 00:07):
I guess I would suggest if_cond and if_not_cond. There are docs#ite_cond_eq_false and docs#ite_cond_eq_true which kind of follow the pattern
Aaron Liu (May 22 2025 at 01:41):
I feel like this might clash with docs#cond
Ruben Van de Velde (May 22 2025 at 03:30):
OTOH, if_pos is short :)
Kevin Buzzard (May 22 2025 at 05:46):
And it's been there since at least 2017
Alex Meiburg (Jun 01 2025 at 16:02):
Was just reminded of this: spent some ten minutes trying to find a lemma only to find it was called docs#iSup_pos. The name is probably based on if_pos but I wouldn't have guessed it. :(
(I only found it by doing simp? [<the proof of h>] at the relevant goal)
Last updated: Dec 20 2025 at 21:32 UTC