Zulip Chat Archive

Stream: PrimeNumberTheorem+

Topic: mathlib bump


Sébastien Gouëzel (May 29 2024 at 10:15):

I am bumping mathlib in https://github.com/AlexKontorovich/PrimeNumberTheoremAnd/pull/178, to use that mathlib knows that Fourier transform is a bijection on Schwartz space. The bump went really well thanks to deprecations (apart from the nat_cast renaming, on which we forgot to add deprecations). And Lean became more powerful at several places (less bugs in typeclass inference, gcongr more powerful), so most fixing was just removing things because the goal was already closed!

Yaël Dillies (May 29 2024 at 10:16):

Sébastien Gouëzel said:

apart from the nat_cast renaming, on which we forgot to add deprecations

Was this mine?

Sébastien Gouëzel (May 29 2024 at 10:27):

Probably, yes. I'll look if I can generate the deprecations automatically.

Sébastien Gouëzel (May 30 2024 at 10:02):

Deprecations in #13368 (around 275 deprecations...).

Yaël Dillies (May 30 2024 at 10:17):

Oh I see. Deprecations were not really "forgotten". Since there were so many of them and the name change was so mechanical, it was decided to not bother.

Alastair Irving (Jun 09 2024 at 11:29):

Maybe you should have specified specific commits for Mathlib and the other dependencies rather than just the master branch. When I run make I get an error:
error: ././.lake/packages/mathlib/lakefile.lean:86:2: error: unknown attribute [test_driver]
which I think is because Mathlib has now moved to Lean 4.9 but we're still on 4.8.

Ruben Van de Velde (Jun 09 2024 at 11:41):

This is what the JSON file is for

Ruben Van de Velde (Oct 03 2024 at 20:59):

Preparing one now

Ruben Van de Velde (Oct 03 2024 at 21:51):

https://github.com/AlexKontorovich/PrimeNumberTheoremAnd/pull/192

Alex Kontorovich (Oct 15 2024 at 15:37):

Darn, this broke again... (Building docs...) Any help?

Pietro Monticone (Oct 15 2024 at 16:53):

Sure, doc-gen4 isn't in manifest.

Fixed, tested locally and opened PR.

Mauricio Collares (Oct 15 2024 at 17:05):

I believe there's no need to update the manifest, since make doc does that in CI (the last passing commit doesn't have doc-gen4 in the manifest, for example). Pointing to the correct doc-gen4 commit in lakefile.lean should suffice.

Pietro Monticone (Oct 15 2024 at 17:12):

When I locally run

lake -R -Kenv=dev build PrimeNumberTheoremAnd:docs

It returns:

error: dependency '«doc-gen4»' not in manifest; use `lake update «doc-gen4»` to add it

I tend to believe it's better to have all the dependencies in the manifest file, but I'm not sure.

Mauricio Collares (Oct 15 2024 at 17:15):

I don't mind either way, but CI doesn't run lake directly. It runs make LAKEBIN='~/.elan/bin/lake' doc, and the Makefile takes care of running $(LAKEBIN) -R -Kenv=dev update before running a documentation build.

Pietro Monticone (Oct 15 2024 at 17:15):

I see... the PNT+ workflow is different from those I'm used to.

Thanks @Mauricio Collares for pointing that out.

Pietro Monticone (Oct 15 2024 at 17:16):

The changes in this PR should work in any case.

Alex Kontorovich (Oct 15 2024 at 17:40):

It worked! Thank you!!

Ruben Van de Velde (Nov 07 2024 at 10:40):

Not sure what's wrong with the CI in https://github.com/AlexKontorovich/PrimeNumberTheoremAnd/pull/203 ; it builds locally

Kevin Buzzard (Nov 07 2024 at 10:43):

When I've seen errors like this, they're sometimes caused by the fact that even though a file builds locally, it somehow conflicts with another file in the repo which isn't imported. Can you get the error locally if you import the entire project all in one go?

Ruben Van de Velde (Nov 07 2024 at 10:55):

That shouldn't be it - I'm also running lake build locally. In fact, I did see that error before, but I fixed it by changing the version of mathlib I depended on

Alex Kontorovich (Nov 07 2024 at 14:30):

Paging @Ian Jauslin - any idea what's going on here?

Mauricio Collares (Nov 07 2024 at 14:37):

Note that CI on PRs essentially runs lake update; lake exe cache get; lake build. If your lakefile does not use a pinned commit, the lake update step could cause problems. CI on master does a similar thing.

With this command I can reproduce the build failures in the PR because mathlib's v4.13.0 tag moved from d5ab93e3a3afadaf265a583a92f7e7c47203b540 to d7317655e2826dc1f1de9a0c138db2775c4bb841.

Mauricio Collares (Nov 07 2024 at 14:37):

Ah, the same problem is being discussed at #general > v4.13.0 discussion I believe

Ruben Van de Velde (Nov 07 2024 at 14:41):

Oh, why is it doing that?

Alex Kontorovich (Nov 07 2024 at 15:40):

Ack! Docs failing to build again...

Ruben Van de Velde (Nov 07 2024 at 15:44):

Oh, same issue

Ruben Van de Velde (Nov 07 2024 at 15:48):

https://github.com/AlexKontorovich/PrimeNumberTheoremAnd/pull/205 - alternatively I can pin the lake commit in the lakefile.lean

Ian Jauslin (Nov 07 2024 at 16:41):

We are using a pinned commit, so lake update should not cause issues, as long as there is no inherent incompatibility with the version of mathlib that is pinned.
So I'm adding lake update back into the workflow.

Ian Jauslin (Nov 07 2024 at 16:52):

The issue seems to be with the bump to version 4.13.0. Why is the bump needed? Should we revert to 4.12 for now?

Ruben Van de Velde (Nov 07 2024 at 16:52):

The issue is that a tag is not fixed, and the v4.13.0 tag changed after EulerProducts updated to it

Ruben Van de Velde (Nov 07 2024 at 16:53):

Why do you want to run lake update? What purpose does that serve?

Ian Jauslin (Nov 07 2024 at 16:54):

It downloads the appropriate versions of the dependencies, does it not?

Ian Jauslin (Nov 07 2024 at 16:56):

So if the tag is being moved, shouldn't we revert to 4.12 until things are settled?

Mauricio Collares (Nov 07 2024 at 17:00):

The tag was moved once to bump ProofWidgets (to get this fix), I don't think it's expected to change again. But since the tags point to master instead of a separate branch, applying the ProofWidgets bump meant picking up a bunch of unrelated commits as well.

Ian Jauslin (Nov 07 2024 at 17:15):

It seems that EulerProducts is not working properly with the newly tagged 4.13.0, as @Ruben Van de Velde mentioned. I'm guessing we should revert to the commit that was previously tagged as 4.13.0? Or revert everything to how it was with 4.12.0?

Ruben Van de Velde (Nov 07 2024 at 17:33):

Why do you want to revert things? What purpose does that serve?

Ian Jauslin (Nov 07 2024 at 17:33):

The project currently does not compile

Ruben Van de Velde (Nov 07 2024 at 17:34):

What makes you say that?

Ian Jauslin (Nov 07 2024 at 17:36):

In the CI, if we don't run lake update, then it keeps the old versions of the dependencies that are cached. So not running lake update is not a fix: it just prevents the version of mathlib and EulerProducts that was cached from being updated to the versions in the lakefile. If you download a fresh version of the repo and try to compile it, it fails, with an error related to EulerProducts.

Ruben Van de Velde (Nov 07 2024 at 17:37):

That's not true

Ruben Van de Velde (Nov 07 2024 at 17:38):

lake build will use the versions of dependencies that are listed in the JSON file

Ruben Van de Velde (Nov 07 2024 at 17:38):

Running lake update in CI will either do nothing or do the wrong thing

Ian Jauslin (Nov 07 2024 at 17:38):

But not the versions in the lakefile

Ian Jauslin (Nov 07 2024 at 17:38):

If lake update breaks the build, then there's a problem, wouldn't you agree?

Ruben Van de Velde (Nov 07 2024 at 17:39):

The JSON file is updated from the lake file locally

Ruben Van de Velde (Nov 07 2024 at 17:39):

No, that is expected

Ian Jauslin (Nov 07 2024 at 17:39):

Why should lake update break the build?

Ruben Van de Velde (Nov 07 2024 at 17:40):

Because it can change the versions of dependencies you're using - because that's its purpose

Ruben Van de Velde (Nov 07 2024 at 17:40):

And updating your dependencies will more likely than not break your build

Ian Jauslin (Nov 07 2024 at 17:41):

It changes the versions to those that are specified in the lakefile. We need to have a lakefile with the correct version.
If we don't get lake update to work, then whenever we want to bump a version a mathlib, we need to edit the JSON file. That does not seem to be the best way to proceed

Ian Jauslin (Nov 07 2024 at 17:42):

In fact, the JSON file has the mathlib commit that used to be pointed at by 4.13. So if we revert to that commit in the lakefile, then everything should run.

Mauricio Collares (Nov 07 2024 at 17:43):

I think the simplest option is to bump mathlib forward to match EulerProducts. It requires no code changes. I will submit a PR.

Mauricio Collares (Nov 07 2024 at 17:44):

Ian Jauslin said:

In fact, the JSON file has the mathlib commit that used to be pointed at by 4.13. So if we revert to that commit in the lakefile, then everything should run.

This will cause problems for people who don't have npm installed, since ProofWidgets is missing a cloud release for this version. See #mathlib4 > cache and proofwidgets

Ian Jauslin (Nov 07 2024 at 17:44):

I just submitted the PR, after checking it works

Ian Jauslin (Nov 07 2024 at 17:45):

Yeah... The alternative I see is to revert to 4.12 while we wait for EulerProducts to be updated to the new 4.13? Is that right?

Mauricio Collares (Nov 07 2024 at 17:47):

I think EulerProducts will never be updated to the new 4.13 since it's already at 4.14.0-rc2. Is using only stable releases a hard requirement? Otherwise there is an easy solution, as I mentioned above.

Ian Jauslin (Nov 07 2024 at 17:48):

Ah, to bump to 4.14.0-rc2. Let me see if that compiles.

Mauricio Collares (Nov 07 2024 at 17:57):

https://github.com/AlexKontorovich/PrimeNumberTheoremAnd/pull/207 CI just finished successfully

Ian Jauslin (Nov 07 2024 at 17:58):

Great thanks!

Michael Stoll (Nov 07 2024 at 18:48):

I should perhaps mention that EulerProducts is currently moving fairly fast, as I am PRing the orthogonality material to Mathlib (and update Mathlib in EulerProducts after each PR has been merged). I hope this will not cause further problems for PNT+.

Kim Morrison (Nov 07 2024 at 21:33):

I would recommend not using lake update in CI for contributor PRs. This is dangerous: it means you are moving to different versions of dependencies underneath your contributors, and they will see failures in their PRs which are unrelated to their changes.

Kim Morrison (Nov 07 2024 at 21:33):

lake build is sufficient to bring the dependencies to the versions that are specified in the lake-manifest.json

Kim Morrison (Nov 07 2024 at 21:39):

Then lake update should be run by a human who is planning on handling the fallout of the upstream repositories changing (or by a bot which commits if all goes well, or asks for help if something goes wrong).

Alex Kontorovich (Nov 08 2024 at 03:14):

I now see two pull requests, PNT#204 and PNT#208; are those safe to merge?

Ian Jauslin (Nov 08 2024 at 03:14):

Hold off on 208

Ian Jauslin (Nov 08 2024 at 03:16):

Let me rerun the checks on 204, to make sure they are compatible with the new version of mathlib

Ian Jauslin (Nov 08 2024 at 03:18):

Kim Morrison said:

I would recommend not using lake update in CI for contributor PRs. This is dangerous: it means you are moving to different versions of dependencies underneath your contributors, and they will see failures in their PRs which are unrelated to their changes.

I see. But if the contributors don't mess with the lakefile, then things should not break. And if they do mess with the lakefile in a way that breaks the compilation, shouldn't their PR be rejected?

Alex Kontorovich (Nov 08 2024 at 03:19):

I only ever merge things with the green checkmark. Is CI on PR's somehow doing something different from compiling once its merged...?

Ian Jauslin (Nov 08 2024 at 03:20):

Yeah, the green checkmark should be good enough. In this case, because we bumped up the mathlib version after the PR was submitted, the checkmark was awarded on the old version of mathlib, so I just wanted to check that the bump doesn't break the PR.

Ian Jauslin (Nov 08 2024 at 03:23):

Looks like it's all good, so you can go ahead and merge PR 204. I canceled 208

Kim Morrison (Nov 08 2024 at 06:36):

Ian Jauslin said:

But if the contributors don't mess with the lakefile, then things should not break.

If the lakefile points exclusively to tags or commit SHAs, then lake update is a noop. Otherwise, if it points to branches, then it moves the upstream repos to different commits. That's the thing you don't want happening!

Ian Jauslin (Nov 08 2024 at 13:32):

Right. That's why our lakefile points exclusively to tags and commit SHAs. So running lake update checks that the lake-manifest is the one corresponding to the lakefile, and wasn't changed manually. If we are doing version control through the lakefile and not the manifest, isn't that something we would want to check for? (Especially since running lake update does not have a downside given that we do not (and do not want to) point to branches?

Kim Morrison (Nov 08 2024 at 22:53):

Yes, you're right. I'm sorry for jumping the gun and assuming that the lakefile was pointing to upstream branches (in my defense, it's pretty common!). You're doing it right. :-)

Alastair Irving (Jan 01 2025 at 12:32):

I started to look at what changes would be needed to bump to Mathlib 4.14 and the latest EulerProducts. So far the biggest changes come from https://github.com/leanprover-community/mathlib4/pull/19442 which changes the notation for $C^\infty$ functions but mostly that just means replacing the notation. There's also various deprications which are easy to fix and one line which no longer compiles with Lean 4.14 (no idea why).

Is this worth doing? It would allow us to replace Abel summation in Consequences.lean with the one now in Mathlib and also keeping current with Mathlib seems like a good idea. I'm happy to keep working on this and submit a PR if it would be helpful.

Ruben Van de Velde (Jan 01 2025 at 12:58):

EulerProducts is at 4.14 already - do you mean 4.15?

Ruben Van de Velde (Jan 01 2025 at 12:59):

I think we'll definitely want to bump once 4.15 is officially released this week or next - but feel free to already make a PR with the changes you need so far

Alastair Irving (Jan 01 2025 at 21:08):

Sorry, I wasn't clear. I meant bumping the dependnecies of PNT to Mathlib 4.14 and to the latest EulerProducts (which as you say is already at 4.14).

Ruben Van de Velde (Jan 01 2025 at 21:12):

Oh no, I just didn't read properly

Ruben Van de Velde (Jan 01 2025 at 21:13):

Yes, good idea

Michael Stoll (Jan 01 2025 at 22:31):

Mathlib at version 4.14.0 should contain everything that PNT+ was using from EulerProducts, so you can probably remove EulerProducts as a dependency at this point.

Alastair Irving (Jan 04 2025 at 21:26):

I've got everything working with Mathlib 4.14, see https://github.com/AlexKontorovich/PrimeNumberTheoremAnd/pull/214 for details.

Michael Stoll (Jan 04 2025 at 21:49):

If you tell me which parts of EulerProducts.Auxiliary you need, I can try to get them into Mathlib.

Ruben Van de Velde (Feb 06 2025 at 13:59):

Michael Stoll said:

Mathlib at version 4.14.0 should contain everything that PNT+ was using from EulerProducts, so you can probably remove EulerProducts as a dependency at this point.

I did this in PNT#225. I do need explicit permission from @Michael Stoll and @Moritz Firsching to relicense the last bit of code we depend on away from the GPL, though.

I'll look at bumping after that

Michael Stoll (Feb 06 2025 at 14:04):

Permission granted!

Moritz Firsching (Feb 06 2025 at 14:06):

Permission granted!

Ruben Van de Velde (Feb 06 2025 at 14:16):

Michael Stoll said:

Permission granted!

Would you mind writing that on the PR as well? :)

Alex Kontorovich (Feb 06 2025 at 17:41):

Perfect, thank you!!

Ruben Van de Velde (Feb 06 2025 at 18:29):

And PNT#226 for the first bump

Ruben Van de Velde (Feb 07 2025 at 09:11):

And straight on to v4.16: PNT#227

Ruben Van de Velde (Apr 01 2025 at 11:51):

4.18: https://github.com/AlexKontorovich/PrimeNumberTheoremAnd/pull/248

(Didn't debug why additive_combination broke)

Ruben Van de Velde (May 01 2025 at 19:49):

4.19: https://github.com/AlexKontorovich/PrimeNumberTheoremAnd/pull/252


Last updated: May 02 2025 at 03:31 UTC