Zulip Chat Archive
Stream: mathlib4
Topic: Imports are out of date even after getting cache.
Wrenna Robson (Jan 12 2024 at 14:26):
Trying to work on one of my PRs, just pushed it and got a build failure. Was going to try and diagnose it but even when I do lake exe cache get!
it tells me that the imports are out of date and must be rebuilt. But I'm getting 4080/4120 cache files. What could be going on?
Mauricio Collares (Jan 12 2024 at 14:29):
Is that #9571 (branch#snoc_cons_optimise)?
Wrenna Robson (Jan 12 2024 at 14:30):
No, #9145
Wrenna Robson (Jan 12 2024 at 14:30):
#9571 is broken but not because of a merge, I just haven't got round to fixing it yet.
Josha Dekker (Jan 12 2024 at 14:31):
(deleted)
Mauricio Collares (Jan 12 2024 at 14:33):
I see the same thing, but "Rebuild Imports" takes just a second here (and needs to be done only once)
Wrenna Robson (Jan 12 2024 at 14:34):
Oh, I didn't actually press it out of fear :P
Wrenna Robson (Jan 12 2024 at 14:34):
That has crashed my computer before
Wrenna Robson (Jan 12 2024 at 14:36):
That worked. Thanks!
Notification Bot (Jan 12 2024 at 14:36):
Wrenna Robson has marked this topic as resolved.
Mauricio Collares (Jan 12 2024 at 14:38):
The only thing that gets rebuilt is ImportGraphs.Import
, and I think this is a new dependency. Maybe it isn't being cached properly?
Mauricio Collares (Jan 12 2024 at 14:39):
cc @Jon Eugster
Jon Eugster (Jan 13 2024 at 16:26):
ImportGraph
is in another repo and its not cached at all currently. (it contains lake exe graph
and some commands, mentioned below, which were in mathlib previously)
I asked Scott Morrison about this and he claimed there should be no problem with cache. Maybe that's not true?
There's no necessity for ImportGraph.Imports
to be imported in mathlib except for having the commands like #find_home
and #minimize_imports
still available in mathlib without adding the import manually.
How are other projects like aesop
or proof-widgets cached? Maybe that should be done for the import-graph too?
https://github.com/leanprover-community/import-graph
Kim Morrison (Jan 14 2024 at 02:30):
Sorry about the bad information, cache
does need an update.
Notification Bot (Jan 14 2024 at 02:30):
Scott Morrison has marked this topic as unresolved.
Kim Morrison (Jan 14 2024 at 02:30):
If you search for aesop
with the Cache/
directory of Mathlib you will find the function that needs a line added!
Kim Morrison (Jan 14 2024 at 02:31):
This is an unfortunate consequence of cache
being a giant (lovely, essential) hack. :-)
Mario Carneiro (Jan 14 2024 at 02:38):
why is ImportGraph
a dependency of mathlib in the first place? surely it isn't imported by anything
Mario Carneiro (Jan 14 2024 at 02:39):
we really need dev-dependencies...
Kim Morrison (Jan 14 2024 at 02:47):
Similarly lean4-cli
is only used by auxiliary utilities.
Eric Wieser (Jan 14 2024 at 11:54):
Is lean4-cli not used by cache get
?
Kim Morrison (Jan 14 2024 at 12:36):
No, cache just handles command line arguments manually.
Joachim Breitner (Jan 15 2024 at 13:30):
But ImportGraph
is imported, by Mathlib.Tactic.Common
:
~/build/lean/mathlib4 $ git log -n 1
commit 5964134838f12fb0ea6fde72764f6d985c312842 (HEAD -> master, origin/staging, origin/master, origin/HEAD)
Author: Kyle Miller <kmill31415@gmail.com>
Date: Mon Jan 15 11:29:49 2024 +0000
refactor: make `SimpleGraph.chromaticNumber` be `ENat`-valued (#8883)
This removes an awkwardness of the API, where theorems had to include colorability hypotheses. This trades that awkwardness for a smaller one, which is that one writes `G.Colorable (ENat.toNat G.chromaticNumber)` rather than `G.Colorable G.chromaticNumber`.
It would be good to have a followup refactoring PR to more carefully evaluate the API after this change.
~/build/lean/mathlib4 $ rm -rf .lake
~/build/lean/mathlib4 $ lake exec cache unpack
info: Cli: cloning https://github.com/leanprover/lean4-cli to './.lake/packages/Cli'
info: importGraph: cloning https://github.com/leanprover-community/import-graph.git to './.lake/packages/importGraph'
info: [0/9] Downloading proofwidgets cloud release
info: [0/9] Unpacking proofwidgets cloud release
info: [1/9] Building Cache.IO
info: [2/9] Compiling Cache.IO
info: [2/9] Building Cache.Hashing
info: [3/9] Compiling Cache.Hashing
info: [3/9] Building Cache.Requests
info: [4/9] Compiling Cache.Requests
info: [4/9] Building Cache.Main
info: [6/9] Compiling Cache.Main
info: [9/9] Linking cache
Decompressing 4120 file(s)
unpacked in 7537 ms
~/build/lean/mathlib4 $ ls .lake/packages/importGraph/.lake/build/lib/ImportGraph/Imports.olean
ls: Zugriff auf '.lake/packages/importGraph/.lake/build/lib/ImportGraph/Imports.olean' nicht möglich: No such file or directory
~/build/lean/mathlib4 $ find Imports.olean
find: ‘Imports.olean’: No such file or directory
~/build/lean/mathlib4 $ git grep ImportGraph
Mathlib/Tactic/Common.lean:import ImportGraph.Imports
~/build/lean/mathlib4 $ lake build Mathlib.Tactic.Common
[115/193] Building ImportGraph.RequiredModules
[433/435] Building ImportGraph.Imports
Joachim Breitner (Jan 15 2024 at 13:34):
Plausible fix: https://github.com/leanprover-community/mathlib4/pull/9760
Last updated: May 02 2025 at 03:31 UTC