Zulip Chat Archive

Stream: general

Topic: v4.8.0-rc1 discussion


Floris van Doorn (May 02 2024 at 20:39):

Let's discuss the new release here

Floris van Doorn (May 02 2024 at 20:47):

This is a great new release!
Even the new def-eq changes that I've seen look good. I looked through a few failing and succeeding def-eq traces, and there seems to be room for speedups. I don't have time to find another minimal example in the next 2 weeks, but after that I'll see if I can see if I can minimize some other non-optimal behavior.

Non-minimal example

Ruben Van de Velde (May 02 2024 at 21:02):

Has docgen been updated yet?

Patrick Stevens (May 02 2024 at 23:12):

(For those like me who didn't know what "functional induction" was, the first PR for this feature seems to be https://github.com/leanprover/lean4/pull/3432 which has a nice example of when to use it.)

Kyle Miller (May 02 2024 at 23:18):

The pretty printer now uses dot notation by default, so no need for @[pp_dot] anymore in mathlib (#12609 deprecates it)

FranΓ§ois G. Dorais (May 03 2024 at 20:39):

The lake update lean4#3835 is very big! Looks like some major improvements! It will take a while to digest...

Quick question: how do you properly use download in a lake script now?

Old script snippet:

for file in ["UnicodeData.txt", "PropList.txt"] do
     let url := "https://www.unicode.org/Public/UCD/latest/ucd/" ++ file
     IO.println s!"Downloading UCD/{file}"
     let _ ← LogIO.captureLog <| download file url (dataDir/file)

It looks like download lost the first argument and it also looks like I no longer need to drop the log. But LogIO.captureLog seems to have disappeared. Maybe this is an old x with a new and improved y?

FranΓ§ois G. Dorais (May 03 2024 at 20:40):

^^^ cc @Mac Malone

Mac Malone (May 03 2024 at 20:47):

@FranΓ§ois G. Dorais You are correct that the first argument has been removed. I am not quite sure why you were dropping the log originally, so I am not sure exactly what you should do now. captureLog still exists. It is just not part of theLogIO namespace. The following should work:

let _ <- download url (dateDir/file) |>.captureLog

FranΓ§ois G. Dorais (May 03 2024 at 20:57):

That was very quick! Your patch works fine. I found where captureLog went now. This is old code, I'm not sure why I was dropping the log. It's on my todo list to review that but now I can update my repo. Thanks Mac!

FranΓ§ois G. Dorais (May 03 2024 at 22:58):

PS: I haven't done any serious testing, but it feels like solid performance improvements for lake too! Thanks Mac! I'm loving this update!

FranΓ§ois G. Dorais (May 04 2024 at 12:56):

This is a strange one! Both of these alias declarations make lean crash:

import Std
alias foo := And.left
alias bar := And.right

So far, this seems to be localized to And.left and And.right. No issues with Or.left, Prod.fst, And.intro, nor anything else I tried.

Christian Merten (May 04 2024 at 14:10):

The new rfl tactic error message is great! It seems to override the default "no goals to be solved" message though:

example : 3 = 3 := by
  rfl
  rfl
  -- The rfl tactic failed. Possible reasons ...

YaΓ«l Dillies (May 04 2024 at 14:16):

A few comments about the new build progress:

  • I used to be able to see all build errors resurface during the linting step in mathlib CI. Now they are drowned in 4.5k lines of "Building ..." and all I get is a list of "Some build steps logged failures:" without actually telling me what the errors are, meaning that I can't start thinking about how to solve them while cache is downloading. Could the full errors resurface, rather than just their location?
  • Building doesn't seem to stop once all files depending only on non-erroring files have been built, meaning that I have no clear indicator of eg how far in mathlib I have pushed a refactor. Could we recover the indicator of how many files were successfully built?

Joachim Breitner (May 04 2024 at 16:58):

Christian Merten said:

The new rfl tactic error message is great! It seems to override the default "no goals to be solved" message though:

example : 3 = 3 := by
  rfl
  rfl
  -- The rfl tactic failed. Possible reasons ...

Thanks for the feedback, glad you like it! Can you open an issue?

Christian Merten (May 04 2024 at 18:35):

Joachim Breitner said:

Can you open an issue?

lean4#4063

FranΓ§ois G. Dorais (May 04 2024 at 21:28):

The alias command issue I mentioned above appears to be due to malformed constant info for And.left and And.right. I filed an issue: lean4#4064

Kim Morrison (May 05 2024 at 07:54):

YaΓ«l Dillies said:

A few comments about the new build progress:

  • I used to be able to see all build errors resurface during the linting step in mathlib CI. Now they are drowned in 4.5k lines of "Building ..." and all I get is a list of "Some build steps logged failures:" without actually telling me what the errors are, meaning that I can't start thinking about how to solve them while cache is downloading. Could the full errors resurface, rather than just their location?
  • Building doesn't seem to stop once all files depending only on non-erroring files have been built, meaning that I have no clear indicator of eg how far in mathlib I have pushed a refactor. Could we recover the indicator of how many files were successfully built?

@YaΓ«l Dillies, could you please open (separate) issues about these requests? In the first one, please explain carefully what you want in the first case without assuming that the current mathlib CI steps are known to all. :-)

Eric Wieser (May 05 2024 at 08:00):

Relating to mathlib CI, it seems that the problem matcher is no longer annotating the diff with build failures

Eric Wieser (May 05 2024 at 08:01):

I think this is probably because the messages are of the form error: ././././Mathlib/Algebra/MvPolynomial/Basic.lean:721:23-721:35, and nothing understands the - notation (VSCode also no longer lets you click the message to jump to the error)

Kim Morrison (May 05 2024 at 08:19):

Hmm, I've been successfully jumping to errors locally?

Eric Wieser (May 05 2024 at 08:20):

When I click on an error message, vscode gives me this behavior:

image.png

Eric Wieser (May 05 2024 at 08:21):

Removing the trailing -$line:$col fixes it

Eric Wieser (May 05 2024 at 08:21):

Maybe this is a gitpod quirk

Kim Morrison (May 05 2024 at 08:22):

Seem reasonable to open an issue for this one. Other tools are likely to get confused by the : in a way they wouldn't if it were just a space.

Sebastian Ullrich (May 05 2024 at 08:43):

I think support for the colon(s?) is pretty standard but the dash may not be

Mario Carneiro (May 05 2024 at 08:48):

I was discussing this with @Mac Malone . Apparently l:c-l.c works but it's a bit weird. Doing some quick comparative analysis, most other tools just show the initial l:c (including 4.7.0), which I think is fine since when you get there the line will be highlighted anyway

Eric Wieser (May 05 2024 at 09:46):

Yes, the problem is the dash not the colon

Eric Wieser (May 05 2024 at 09:48):

Though it looks like this can be fixed with extra configuration

Eric Wieser (May 05 2024 at 09:51):

Certainly problem-matchers support carrying this data, just not the parsers that vs code / our CI uses

Somo S. (May 05 2024 at 13:03):

tiny issue ..
image.png
Instead of being maked "latest", isn't an rc release supposed to be marked as "pre-release" like so
image.png
?

Kim Morrison (May 06 2024 at 03:04):

Fixed.

Kim Morrison (May 06 2024 at 04:55):

Re: lakefile.toml, I would like to see projects switch if possible / helpful! I'm hoping the toml file is useful, and that projects will try using it and come back with bug reports and feature requests. While we're unlikely to drop support for lakefile.lean anytime soon (perhaps ever), I hope that life is going to be simpler if most projects are using non-interpreted configuration files.

Kim Morrison (May 06 2024 at 04:56):

I've switched importGraph (see #12690 verifying that Mathlib is still happy). I think it should be no problem to switch std/batteries, but will wait to do so until after the rename.

Kim Morrison (May 06 2024 at 04:56):

We won't update Qq for now, as we prefer to leave that on the oldest compatible toolchain.

Kim Morrison (May 06 2024 at 04:56):

Similarly Cli? @Marc Huisinga?

Kim Morrison (May 06 2024 at 04:57):

proofwidgets has complicated requirements that can't be support from the toml yet.

Kim Morrison (May 06 2024 at 04:57):

I'll try aesop now, hopefully that is straightforward? (edit: https://github.com/leanprover-community/aesop/pull/131)

Kim Morrison (May 06 2024 at 04:57):

I'd be happy to hear reports of people making the migration in downstream projects, too!

Kim Morrison (May 06 2024 at 05:10):

It looks to me like meta if get_config? env = some "dev" then is the biggest blocker to moving more repositories to lakefile.toml.

@Mac Malone, do we have an issue about this?

Mario Carneiro (May 06 2024 at 06:12):

That's lake install I think: issue lean4#3423, PR lean4#3998

Mario Carneiro (May 06 2024 at 06:14):

I think it would be good to have an issue specifically for conditional dependencies in toml though, independently of lake install (which is poised to eliminate doc-gen from everyone's lakefiles)

YaΓ«l Dillies (May 06 2024 at 07:18):

Kim Morrison said:

It looks to me like meta if get_config? env = some "dev" then is the biggest blocker to moving more repositories to lakefile.toml.

Sadly, all of LeanAPAP, LeanCamCombi, Con(NF), PFR use conditional dependencies to avoid everyone having to download doc-gen, so I can't actually switch to lakefile.toml in any of my projects

Kim Morrison (May 06 2024 at 08:07):

Mario's message immediately above is about avoiding the need to have a dependency at all (conditional or otherwise) on doc-gen once lake install lands.

Marc Huisinga (May 06 2024 at 08:27):

Kim Morrison said:

Similarly Cli? Marc Huisinga?

Sure.

Jon Eugster (May 06 2024 at 09:43):

This is is probably more a featrue request more than anything else. Most of my lakefiles currently have the following pattern in there:

import Lake
open Lake DSL

def leanVersion : String := s!"v{Lean.versionString}"

[...]

require std from git "https://github.com/leanprover/std4.git" @ leanVersion
require i18n from git "https://github.com/hhu-adam/lean-i18n.git" @ leanVersion

[...]

This is mainly to ensure that packages that do not import mathlib are still compatible with the stable releases. So far that's been the most ideomatic way I know of: You update leantoolchain to the version you want, call lake update and you're good. I think it would be nice if the .toml files also supported an easy way to follow stable releases without editing the version once per dependency. My reasons are mainly:

  • non-mathlib/batteries projects should probably be encouraged to follow the stable releases. After all that's why there are releases, right?
  • lake update is a bit of a false friend for beginners/intermediates as it might mess up your project. Therefore, I like to set up my config in a way that rm -rf ./lake lake-manifest.json && lake update is a 100% reliable way to recover if things went wrong.

David Renshaw (May 06 2024 at 12:02):

Updated tryAtEachStep.
After lake translate-config toml, I needed to manually move the defaultTargets line up that that it did not fall under [leanOptions].

Siddhartha Gadgil (May 06 2024 at 14:06):

I seem to have trouble upgrading when meta-programming from a Lean script. Concretely, lines of the following form worked fine in earlier versions (after running initSearchPath):

let env' ← importModules #[{module := `LeanAide}] {}

But now I get the error uncaught exception: unknown package 'ImportGraph'.

This does not seem to depend on what the array of modules being imported is so long as it is non-empty. I get the same error with

let env' ← importModules #[{module := `Mathlib}] {}

Kim Morrison (May 06 2024 at 14:14):

@Siddhartha Gadgil, you might have to give us more context to be able to help you.

Eric Wieser (May 06 2024 at 14:30):

Does running lake build help?

Mac Malone (May 06 2024 at 14:51):

David Renshaw said:

Updated tryAtEachStep.
After lake translate-config toml, I needed to manually move the defaultTargets line up that that it did not fall under [leanOptions].

Could you elaborate on this and/or create an issue with a failing #mwe?

Siddhartha Gadgil (May 06 2024 at 15:09):

I am trying.

Jon Eugster (May 06 2024 at 15:26):

@Siddhartha Gadgil this does sound like it would help to check if importGraph is in your lake-manifest.json and also in .lake/packages/importGraph. That might give a hint whether your dependencies are imported correctly, it sounds a bit as if mathlib itself wouldnt properly work in your project, but that's a very far speculation.

Siddhartha Gadgil (May 06 2024 at 15:33):

Thanks @Jon Eugster

It was the case that this was missing from my initSearchPath. Adding this fixed the error @Kim Morrison @Mac Malone thanks.

Unfortunately there is another error. I will try to minimize and then report.
I was doing things in a needlessly complicated way. Cleaning my code (and the initSearchPath correction) fixes all issues.

Siddhartha Gadgil (May 07 2024 at 02:24):

@Mac Malone The root cause of the error was my manually including all the places where lake places oleans in my initSearchPath. For example:

def initFiles : List System.FilePath := [".lake/build/lib", ".lake/packages/mathlib/.lake/build/lib",  ".lake/packages/std/.lake/build/lib", ".lake/packages/Qq/.lake/build/lib", ".lake/packages/aesop/.lake/build/lib", ".lake/packages/proofwidgets/.lake/build/lib", ".lake/packages/importGraph/.lake/build/lib" ]

Is there a function in the Lake API I can use instead?

Kim Morrison (May 07 2024 at 02:25):

Maybe it is helpful to #xy here, and explain why you need those locations?

Siddhartha Gadgil (May 07 2024 at 02:28):

I need them because I write files in my main library that run to core, and then run in lean_exe targets by building and passing an environment. The relevant lines in my code are (within IO):

initSearchPath (← Lean.findSysroot) initFiles
let env ←
    importModules #[{module := `Mathlib},
    {module:= `LeanAide.TheoremElab},
    {module:= `LeanCodePrompts.Translate}] {}

Siddhartha Gadgil (May 07 2024 at 02:30):

By "run" above I meant use Core.run to get an EIO before passing to IO etc.

Siddhartha Gadgil (May 07 2024 at 02:32):

Just read what #xy means and my actual goal is to pass an environment to run CoreM stuff in compiled Lean code.

Kim Morrison (May 07 2024 at 02:39):

What about searchPathRef.set compile_time_search_path%?

Siddhartha Gadgil (May 07 2024 at 02:42):

Thanks @Kim Morrison
Indeed this worked fine as a replacement to my hacky initSearchpath

Peiran Wu (May 07 2024 at 21:23):

Mac Malone said:

David Renshaw said:

Updated tryAtEachStep.
After lake translate-config toml, I needed to manually move the defaultTargets line up that that it did not fall under [leanOptions].

Could you elaborate on this and/or create an issue with a failing #mwe?

I've encountered the same problem as David Renshaw has. I have filed an issue: https://github.com/leanprover/lean4/issues/4099

Kim Morrison (May 07 2024 at 22:54):

Thanks for the report. Hopefully we'll be able to include a fix for this in v4.8.0-rc2 (perhaps next week?)

Michael Rothgang (May 11 2024 at 07:57):

At yesterday's Lean workshop in Berlin, some participants had trouble installing Lean. I was particularly puzzled by one error message: typing lake exe cache get in the project's root directory resulted in the error could not find file ./lakefile.lean.

This was puzzling since the user was in the root directory --- but the repository we were using had a lakefile.toml and not lakefile.lean. (This error didn't occur for all users, just some.) Is this

  • just a bug in the error message (i.e., cache also checks for a lakefile.toml, but the error doesn't mention it)?
  • a bug in cache (not checking for lakefile.toml)
  • something else (mumble mumble paths) --- which belongs into a different thread?

Michael Rothgang (May 11 2024 at 07:58):

Alternatively, a pointer to cache's source code so I can check myself is also welcome.

Mario Carneiro (May 11 2024 at 07:58):

is there a find in there, or did it really say could not file?

Mario Carneiro (May 11 2024 at 07:59):

this is a lake error message, most likely caused by using a lake version that doesn't know about toml

Michael Rothgang (May 11 2024 at 08:00):

Mario Carneiro said:

is there a find in there, or did it really say could not file?

I don't remember precisely, but am pretty sure I just omitted the find now - fixed, thanks!

Kim Morrison (May 11 2024 at 08:00):

i.e. you need to make sure the lean-toolchain says v4.8.0-rc1

Michael Rothgang (May 11 2024 at 08:01):

Mario Carneiro said:

this is a lake error message, most likely caused by using a lake version that doesn't know about toml

So the fix would be to ensure participants have the right version of lake... I see!
(The lean-toolchain does say v4.8.0-rc1.)

Kim Morrison (May 11 2024 at 08:19):

Hmm -- as soon as the lean-toolchain is right, you should have the right version of lake.

Kim Morrison (May 11 2024 at 08:19):

That is determined by the lean-toolchain.


Last updated: May 02 2025 at 03:31 UTC