Zulip Chat Archive

Stream: mathlib4

Topic: What kind of contributions should go to mathlib?


Miguel Marco (Oct 22 2023 at 19:32):

I decided to try the steps to contribute to mathlib, and decided to play around with a toy project: implement range'(that is, the natural numbers between aand a+b as Multisetand Finset (so we can have things like ∑ i in range' a b, f i ). Now i am doubting if this kind of things are supposed to be added to Mathlib or not.

Is there something like an "official criterion" about that?

Yury G. Kudryashov (Oct 22 2023 at 19:34):

We have docs#Finset.Ico and other intervals

Yury G. Kudryashov (Oct 22 2023 at 19:35):

I guess, the most "official" criterion is: not a duplicate and some maintainers think it's useful.

Miguel Marco (Oct 22 2023 at 20:12):

Thanks. Although I think that the genericFinset.Ico is missing some lemmas that hold specificially over the naturals (or maybe something slightly more general cases), and can be useful. Things like

Finset.Ico a (b + 1) = insert (a + b) (Finset.Ico a b)

Would it make sense to add this kind of thing?

Ruben Van de Velde (Oct 22 2023 at 20:19):

docs#Nat.Ico_succ_right_eq_insert_Ico ?

Eric Wieser (Oct 22 2023 at 20:24):

In general the bar for adding new theorems to mathlib is much lower than the bar for adding new definitions; but in both cases, it can take a while to work out whether the declaration you want already exists!

Ruben Van de Velde (Oct 22 2023 at 20:26):

Note that your range' is Ico a (a + b), not Ico a b

Miguel Marco (Oct 22 2023 at 20:39):

Ruben Van de Velde said:

docs#Nat.Ico_succ_right_eq_insert_Ico ?

Didn't see that. Thanks!

Miguel Marco (Oct 22 2023 at 20:42):

Eric Wieser said:

In general the bar for adding new theorems to mathlib is much lower than the bar for adding new definitions; but in both cases, it can take a while to work out whether the declaration you want already exists!

In case of theorems, i usually try to write the statement and then try to solve it with a tactic that searches the library (apply?, and/or aesop mostly). But apparently it is not as useful as I thought.

Scott Morrison (Oct 22 2023 at 21:51):

Make sure when testing with apply? that you have imported all of Mathlib in your test file. It only reports things visible with the current imports.

Scott Morrison (Oct 22 2023 at 21:52):

And asking in "Is there code for X?" is fine too, where Yaël, of whom apply? is just a lame imitiation, can usually tell you exactly where to find it.


Last updated: Dec 20 2023 at 11:08 UTC