Skip to content

fix: batteries breakage from nightly-2026-10-13 - #161

Closed
downstream-lean4[bot] wants to merge 1 commit into
masterfrom
push-lvzsqrulywym
Closed

downstream-lean4[bot] wants to merge 1 commit into
masterfrom
push-lvzsqrulywym

Conversation

@downstream-lean4

@downstream-lean4 downstream-lean4 Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

master is red at batteries since run 38385302531, which takes the critical aesop and mathlib4 down through the skip chain, along with cslib and repl.

batteries

Root cause. lean4#15559 stops a module from exporting constants that were realized only inside a proof. UnpackedFloat.pack.eq_def was such a constant: nothing in core realizes it except fun_cases pack in the proof of valid_pack. unfold reduces the exposed matcher only when it rewrites with an existing unfold theorem; for a non-recursive definition without one it falls back to delta expansion, which leaves the matcher application in the goal. Core-only reproducer, no batteries involved:

module
import all Init.Data.OfScientific

public section
open Float.Model Float.Model.UnpackedFloat

example (spec : Format) (s : Sign) (m : Nat) (e : Int) (h : 0 < m) (x : BitVec spec.numBits) :
    UnpackedFloat.pack spec (.finite s m e h) = x := by
  unfold UnpackedFloat.pack
  extract_lets a b
  sorry

On nightly-2026-10-12 the goal after unfold is have actualMantissaBits := …; have biasedExponent := …; if … and extract_lets picks up both bindings. On nightly-2026-10-13 it is match finite s m e h with | … => have … and extract_lets fails with Tactic `extract_lets` failed: made no progress, which is exactly the failure at Batteries/Data/Float/Lemmas.lean:79 and :96 in pack_unpack (the subnormal and the normal case).

The breakage arrived with nightly-2026-10-13 rather than nightly-2026-10-09 because that is the first stage2 nightly (lean4#15637): until then core's oleans were written by a stage0 that predates lean4#15559. The same behaviour reproduces without core on any nightly from 2026-10-09 on, with a two-module project where one module realizes f.eq_def in a proof and the other runs unfold f.

Fix. Interpose dsimp -zeta only, which performs the structural reduction without zeta-reducing the surrounding lets. This is the same hunk the batteries author already wrote against a stage2 pr-release in #152 (adaptation-15557); that PR cannot merge here, since lean4#15557 is still open.

Verified on nightly-2026-10-13, with #158 applied on top for mathlib4:

repo build test lint
batteries ✔ --wfail ✔ ✔
aesop ✔ --wfail ✔ n/a
ProofWidgets4 ✔ --wfail ✔ n/a
mathlib4 ✔ --wfail ✔ --iofail ✔
cslib ✔ --wfail --iofail ✔ --wfail --iofail ✔
repl ✔ ✔ (incl. the test/Mathlib build) n/a

Not fixed here. mathlib4 still needs #158 (the ProofWidgets.Jsx deprecation), which has been open since 2026-10-12; master goes green only once both merge.

`unfold pack` in `Batteries.Data.Float.Lemmas.pack_unpack` no longer
leaves the matcher application iota-reduced, so the `have`-bindings
`actualMantissaBits`/`biasedExponent` stay inside the unreduced `match`
and `extract_lets mantbits biasedexp` fails with "made no progress"
(both the subnormal and the normal case).

Interpose `dsimp -zeta only`, which performs the structural reduction
without zeta-reducing the surrounding `let`s. This is the same hunk the
batteries author already wrote for the pr-release in
#152 (adaptation-15557), which cannot merge
here: lean4#15557 is still open, so that PR stays unmerged while master
is red.

Verified: `lake build --wfail`, `lake test`, `lake lint` all pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
@downstream-lean4

Copy link
Copy Markdown
Contributor Author

Build report for fix: batteries breakage from nightly-2026-10-13

Turned green:

Repo Critical Build Test Lint
aesop ✅ ✅ in 16s ✅ in 4s ⏭️
batteries ✅ ✅ in 1s ✅ in 4s ✅ in 2s
repl ✅ in 0s ✅ in 52s ⏭️
Stayed red
Repo Critical Build Test Lint
mathlib4 ✅ 🟥 in 15m 25s ⏭️ ⏭️
cslib 🛑 by mathlib4 ⏭️ ⏭️
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 1m 40s ⏭️ ⏭️
BibtexQuery ✅ in 3s ⏭️ ⏭️
comparator ✅ in 2s ⏭️ ⏭️
doc-gen4 ✅ in 7s ⏭️ ⏭️
illuminate ✅ in 1s ✅ in 10s ⏭️
lean4-unicode-basic ✅ in 0s ⏭️ ⏭️
lean4export ✅ in 0s ✅ in 7s ⏭️
LeanSearchClient ✅ in 0s ✅ in 0s ⏭️
leansqlite ✅ in 7s ✅ in 21s ⏭️
nerodia ✅ in 1s ✅ in 21s ⏭️
verso ✅ in 1m 18s ✅ in 3m 22s ⏭️
verso-slides ✅ in 16s ✅ in 9s ⏭️
verso-web-components ✅ in 7s ⏭️ ⏭️

View run

@downstream-lean4

Copy link
Copy Markdown
Contributor Author

Superseded by nightly-2026-10-14: lean4#15655 reverted "do not export realizations triggered only from proofs", which is what had made unfold pack stop reducing the matcher. Batteries.Data.Float.Lemmas builds green on that nightly without this patch — and with it the added dsimp -zeta only now fails as "dsimp made no progress", so merging it would re-break the repo. Verified on master 81b76e9: batteries lake build --wfail, lake test, lake lint all pass unpatched.

@downstream-lean4 downstream-lean4 Bot closed this Oct 14, 2026
@downstream-lean4
downstream-lean4 Bot deleted the push-lvzsqrulywym branch October 14, 2026 11:26
Kha pushed a commit that referenced this pull request Oct 14, 2026
`master` bumped to `nightly-2026-10-14` in ac06c20, and the `Build
subrepos` runs for
that commit and for the `#15581` merge on top of it were both cancelled
before any step
ran — so no CI run has ever looked at the new nightly. Built locally
instead, and
`reference-manual` (critical) is the one repo the bump breaks.

## reference-manual

lean4#15630 added `--add-downstream` and `--add-public-downstream` to
`lake shake`.
`Manual/BuildTools/Lake/CLI.lean` checks the `lake shake --help` output
verbatim, so
`Manual.BuildTools.Lake.CLI` now fails with ``Mismatched `lake --help`
output``.

The two options are inserted into the `lakeHelp shake` block, copied
from the nightly's
own `lake shake --help`, and added to the prose option list below it,
which enumerates
every option of the subcommand.

**Verified:** `lake build` passes (1583 jobs). reference-manual defines
neither a test
nor a lint driver, so that is its full matrix.

## State of the rest of `master` on `nightly-2026-10-14`

Everything else in `repos.toml` was built locally at 81b76e9 — all 22
repos, every
phase its lakefile defines:

* **Green:** aesop, batteries, BibtexQuery, doc-gen4, illuminate,
import-graph,
lean4-cli, lean4-unicode-basic, lean4export, LeanSearchClient,
leansqlite, mathlib4
(all five build targets with `--wfail`, `test --iofail`, `lint`),
plausible,
ProofWidgets4, quote4, repl, verso, verso-slides, verso-web-components.
* **cslib** is still red for the reason given in #166 (mathlib4#41506
making `Set` a
one-field structure); that PR applies cleanly to 81b76e9 and was
re-verified on this
nightly — `build --wfail --iofail`, `test --wfail --iofail` and `lint`
all pass with
  it. Not duplicated here.
* **nerodia** fails only on this machine: its `pyconfig` step wants
Python 3.14+ and the
  box has 3.13.15. Green in CI.

Two earlier unattended PRs are obsolete as of this nightly and have been
closed:

* #161 (batteries `extract_lets`) — lean4#15655 reverted the
realization-export change
that caused it. batteries now builds green without the patch, and *with*
it the added
`dsimp -zeta only` fails as "`dsimp` made no progress", so merging it
would re-break
  the repo.
* #158 (ProofWidgets4 `Jsx` deprecation) — the `downstream: update repo
mathlib4` merge
in 68af6a9 migrated mathlib4 to `jsx%{…}` literals, leaving the
deprecated syntax
with no users in the tree. mathlib4 and ProofWidgets4 both build green
with the
  `deprecated_syntax` line in place.

<!-- downstream-watch: unattended -->

Co-authored-by: downstream-lean4[bot] <downstream-lean4[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant