Zulip Chat Archive

Stream: lean4

Topic: precompileModules downstream of mathlib


James Gallicchio (Jan 06 2024 at 02:27):

It seems completely infeasible to have precompileModules := true downstream of mathlib. A lake build with prebuilt oleans present takes at least 25 minutes on my 12 core machine, and reloading file dependencies takes a minute or two (most of that time consumed by ld, from what I can tell). Which is unfortunate, because I want to write lazy proofs that just call slow automation tactics from mathlib.

Is there any way to specify a subset of modules to precompile? Or any other way to make it feasible to use this feature downstream of mathlib?

EDIT: clarified that lake build takes a while even with the prebuilt oleans

Sebastian Ullrich (Jan 06 2024 at 09:36):

"Downstream of mathlib" is not very precise, what size of dependency closure are we talking about here?

James Gallicchio (Jan 07 2024 at 02:53):

I think roughly half of mathlib? (is there a quick way to check?) I import Mathlib.Tactic somewhere which inflates the closure quite a bit.

Kim Morrison (Jan 07 2024 at 04:15):

import Mathlib.Tactic.Common might work better?

James Gallicchio (Jan 07 2024 at 06:31):

That appears to only cut out a couple hundred files. Let me figure out exactly which tactics I need.

James Gallicchio (Jan 07 2024 at 06:40):

Ok, I only import linarith, ring, and fincases.

James Gallicchio (Jan 07 2024 at 06:41):

(With dependencies, that gives 1400 ish modules)

Kim Morrison (Jan 07 2024 at 07:06):

Unfortunately the linarith -> ring -> norm_num chain of tactics picks up an absurd number of side dependencies...

James Gallicchio (Jan 07 2024 at 07:07):

And reducing the import closure is really only a bandaid on a feature that doesn't scale well...

Yaël Dillies (Jan 07 2024 at 08:35):

Note #9411 should help with that

Yaël Dillies (Jan 07 2024 at 08:37):

It doesn't really reduce the number of dependencies itself, but it makes it much easier to do so. And that's not just a bandaid. I need to reduce those imports for a mathematical reason: I need the map from ℚ≥0 to any DivisionSemiring.


Last updated: May 02 2025 at 03:31 UTC