Repository navigation
fix: batteries and mathlib4 breakage from the upstream batteries shake - #133
Closed
downstream-lean4[bot] wants to merge 2 commits into
Closed
downstream-lean4[bot] wants to merge 2 commits into
downstream-lean4[bot] wants to merge 2 commits into
Conversation
`chore: shake` (leanprover-community/batteries#2005), merged into `nightly-testing` by the last `downstream: update repo batteries`, replaced `public import Lean.Meta.DiscrTree` with `public import Lean.Meta.DiscrTree.Types` in `Batteries/Lean/Meta/DiscrTree.lean`. `Trie.asNode` and `Trie.mkNode` live in `Lean.Meta.DiscrTree.Util`, not in `.Types`, so `Trie.mergePreservingDuplicates` stopped elaborating. Import `Lean.Meta.DiscrTree.Util` instead; it publicly imports `.Basic`, which publicly imports `.Types`, so the `Key`/`Trie`/`DiscrTree` types stay available. Co-Authored-By: Claude Opus 5 <[email protected]>
The same `chore: shake` (leanprover-community/batteries#2005) that broke `batteries` itself also demoted `public import` to `import` across the library, so transitive re-exports Mathlib relied on are gone: * `Batteries.Logic` and `Batteries.Data.Nat.Lemmas` no longer re-export `Batteries.Tactic.Alias`, so every `alias` command in `Mathlib.Data.Nat.Init`, `Mathlib.Data.Int.Init`, `Mathlib.Basic.Logic.Basic` and `Mathlib.Basic.Logic.Lemmas` stopped parsing (`unexpected identifier; expected command`), taking `em`, `dec_em`, `Iff.not` and the rest down with them. Each of the four files now imports `Batteries.Tactic.Alias` itself. * `Counterexamples.ZeroDivisorsInAddMonoidAlgebras` lost `Batteries.Tactic.OpenPrivate`, whose `instance : DecidableEq ModuleIdx` its `guard_decl` elaborator needs; `ModuleIdx` is a plain `def`, so nothing else supplies the instance. Imported directly, as the error message suggests. Verified: `lake build --wfail Mathlib Archive Counterexamples Wanted cache`, `lake test --iofail` and `lake lint` all pass. Co-Authored-By: Claude Opus 5 <[email protected]>
Contributor
Author
Build report for fix: mathlib4 breakage from the upstream batteries
|
| Repo | Critical | Build | Test | Lint |
|---|---|---|---|---|
| aesop | ✅ | ✅ in 11s | ✅ in 4s | ⏭️ |
| batteries | ✅ | ✅ in 1s | ✅ in 4s | ✅ in 2s |
| mathlib4 | ✅ | ✅ in 16m 18s | ✅ in 41s | ✅ in 1m 30s |
| cslib | ✅ in 30s | ✅ in 9s | ✅ in 3s | |
| repl | ✅ in 0s | ✅ in 52s | ⏭️ |
Stayed red
| Repo | Critical | Build | Test | Lint |
|---|---|---|---|---|
| verso-slides | 🟥 in 27s | ⏭️ | ⏭️ |
Stayed green
| Repo | Critical | Build | Test | Lint |
|---|---|---|---|---|
| import-graph | ✅ | ✅ in 2s | ✅ in 4s | ⏭️ |
| lean4-cli | ✅ | ✅ in 0s | ✅ in 0s | ⏭️ |
| plausible | ✅ | ✅ in 0s | ✅ in 2s | ⏭️ |
| ProofWidgets4 | ✅ | ✅ in 1s | ✅ in 1s | ⏭️ |
| quote4 | ✅ | ✅ in 0s | ✅ in 1s | ⏭️ |
| reference-manual | ✅ | ✅ in 11s | ⏭️ | ⏭️ |
| BibtexQuery | ✅ in 1s | ⏭️ | ⏭️ | |
| comparator | ✅ in 2s | ⏭️ | ⏭️ | |
| doc-gen4 | ✅ in 4s | ⏭️ | ⏭️ | |
| illuminate | ✅ in 1s | ✅ in 10s | ⏭️ | |
| lean4-unicode-basic | ✅ in 0s | ⏭️ | ⏭️ | |
| lean4export | ✅ in 0s | ✅ in 8s | ⏭️ | |
| LeanSearchClient | ✅ in 0s | ✅ in 0s | ⏭️ | |
| leansqlite | ✅ in 3s | ✅ in 21s | ⏭️ | |
| nerodia | ✅ in 1s | ✅ in 22s | ⏭️ | |
| verso | ✅ in 16s | ✅ in 2m 59s | ⏭️ | |
| verso-web-components | ✅ in 25s | ⏭️ | ⏭️ |
Contributor
Author
|
Superseded by #134. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
masteris red in run 37324507057 onnightly-2026-10-05:batteriesfails to build,aesop,mathlib4andcslibare skipped behind it, andrepl's test phase compiles both and fails. The nightly is not to blame — run 37298300152 was green on the same toolchain three hours earlier. The one commit in between isdownstream: update repo batteries, which merged batteries'mainintonightly-testingand so brought inchore: shake(batteries#2005), a repo-wide import minimization computed on thev4.35.0-rc3toolchain.batteries —
Trie.asNodeis inLean.Meta.DiscrTree.Util, not.Typesshakereplacedpublic import Lean.Meta.DiscrTreebypublic import Lean.Meta.DiscrTree.TypesinBatteries/Lean/Meta/DiscrTree.lean. That is correct onmain, whereTrie.mergePreservingDuplicatespattern-matches thenodeconstructor directly. It is not correct onnightly-testing, which carries the adaptation to lean4#14805's newTrie.chainconstructor and therefore goes throughTrie.asNode/Trie.mkNode— and those live inLean.Meta.DiscrTree.Util. The merge combinedmain's import line withnightly-testing's body, so the module fails withFixed by importing
Lean.Meta.DiscrTree.Util, which publicly imports.Basicand hence.Types, soKey,TrieandDiscrTreestay in scope. Batteries' ownnightly-testingbuild is red the same way, so this hunk will most likely be superseded by their adaptation at the nextdownstream: update repo batteries.mathlib4 — transitive re-exports from batteries are gone
The same
shakedemotedpublic importtoimportthroughout batteries, which removes re-exports Mathlib was relying on. CI never saw this: it stopped atbatteries.Batteries.Logicnow importsBatteries.Tactic.Aliasprivately andBatteries.Data.Nat.Lemmasnot at all, so thealiascommand is no longer in scope inMathlib.Data.Nat.Init,Mathlib.Data.Int.Init,Mathlib.Basic.Logic.BasicandMathlib.Basic.Logic.Lemmas. Everyaliasin those files turns intounexpected identifier; expected command, which takesem,dec_em,Iff.not,HEq.eqand the rest of what they declare with it. Each of the four now importsBatteries.Tactic.Aliasitself.Counterexamples.ZeroDivisorsInAddMonoidAlgebraslostBatteries.Tactic.OpenPrivate, which is whereinstance : DecidableEq ModuleIdx := instDecidableEqNatlives. Its localguard_declelaborator compares twoModuleIdx, andModuleIdxis a plaindef, so without that instance nothing solvesDecidable (dcli = mdni)and the elaborator is never implemented. Imported directly, as the error message suggests.This half is not nightly-specific: upstream mathlib will meet it at its next batteries bump.
Verified locally on
nightly-2026-10-05batterieslake build --wfail✔,lake test✔,lake lint✔aesoplake build --wfail✔,lake test✔ (no change needed)mathlib4lake build --wfail Mathlib Archive Counterexamples Wanted cache✔,lake test --iofail✔,lake lint✔csliblake build --wfail --iofail✔,lake test --wfail --iofail✔,lake lint✔ (no change needed)repllake build✔,lake test✔ (no change needed)Not covered here:
verso-slides, which has been red since before this run for an unrelated reason and is fixed by #126.