Skip to content

[#15687] fix: make unfold on non-recursive definitions independent of eq_def realization - #265

Open
downstream-lean4[bot] wants to merge 5 commits into
masterfrom
adaptation-15687
Open

downstream-lean4[bot] wants to merge 5 commits into
masterfrom
adaptation-15687

Conversation

@downstream-lean4

Copy link
Copy Markdown
Contributor

This is the adaptation PR for leanprover/lean4#15687.

With lean4#15687, `unfold` on a non-recursive definition always unfolds by plain delta expansion and no longer reduces the resulting `match` on a constructor. In `pack_unpack`, `unfold pack` therefore leaves the `let`s inside a match arm where `extract_lets` cannot find them. Reduce the match with `dsimp -zeta only` first.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@downstream-lean4

Copy link
Copy Markdown
Contributor Author

Build report for downstream: follow upstream PR

Stayed green
Repo Critical Build Test Lint
aesop ✅ ✅ in 15s ✅ in 4s ⏭️
batteries ✅ ✅ in 11s ✅ in 3s ✅ in 1s
import-graph ✅ ✅ in 6s ✅ in 3s ⏭️
lean4-cli ✅ ✅ in 3s ✅ in 0s ⏭️
mathlib4 ✅ ✅ in 14m 15s ✅ in 34s ✅ in 47s
plausible ✅ ✅ in 3s ✅ in 2s ⏭️
ProofWidgets4 ✅ ✅ in 5s ✅ in 0s ⏭️
quote4 ✅ ✅ in 5s ✅ in 1s ⏭️
reference-manual ✅ ✅ in 1m 3s ⏭️ ⏭️
BibtexQuery ✅ in 3s ⏭️ ⏭️
cslib ✅ in 29s ✅ in 10s ✅ in 2s
doc-gen4 ✅ in 11s ⏭️ ⏭️
illuminate ✅ in 7s ✅ in 9s ⏭️
lean4-unicode-basic ✅ in 4s ⏭️ ⏭️
lean4export ✅ in 2s ✅ in 5s ⏭️
LeanSearchClient ✅ in 2s ✅ in 0s ⏭️
leansqlite ✅ in 8s ✅ in 15s ⏭️
nerodia ✅ in 6s ✅ in 22s ⏭️
repl ✅ in 3s ✅ in 2m 1s ⏭️
verso ✅ in 1m 38s ✅ in 3m 6s ⏭️
verso-slides ✅ in 20s ✅ in 9s ⏭️
verso-web-components ✅ in 4s ⏭️ ⏭️

View run

skip-checks: true
@downstream-lean4

downstream-lean4 Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

The automatic merge failed. @Kha, please fix any merge conflicts and merge this PR manually.

@downstream-lean4 downstream-lean4 Bot added merge-required This PR should be merged manually by the author. and removed cache-available labels Nov 22, 2026
Kha pushed a commit that referenced this pull request Nov 23, 2026
1 of 4 for [run
45055845730](https://github.com/leanprover/downstream-lean4/actions/runs/45055845730),
with #273, #274 and #275 — one PR per author of the upstream change
behind each breakage, so each asks that author for review. This one
stands alone: `batteries` and `aesop` go green with it and nothing else.

`batteries` was the only repo that CI could build this round: `aesop`,
`mathlib4` and
`cslib` were all skipped behind it, so this unblocks three more repos.

### `batteries` — lean4#15687 (`Kha`)

lean4#15687 makes `unfold` on a non-recursive definition independent of
whether
`f.eq_def` happens to have been realized already: it now always unfolds
by plain delta
expansion, and so no longer reduces the resulting `match` on a
constructor. In
`Float.Model.UnpackedFloat.pack_unpack`, `unfold pack` therefore leaves
the two `have`s
of `pack`'s `.finite` arm *inside* the unreduced `match`, where
`extract_lets` cannot
reach them:

```
Batteries/Data/Float/Lemmas/Basic.lean:77:4: Tactic `extract_lets` failed: made no progress
Batteries/Data/Float/Lemmas/Basic.lean:94:4: Tactic `extract_lets` failed: made no progress
```

Fix: reduce the match with `dsimp -zeta only` before `extract_lets`, in
both the
subnormal and the normal case.

This is byte-for-byte the hunk the bot already carries on
`adaptation-15687` (#265) and
`adaptation-16623` (#266) — both now `CONFLICTING`, because upstream has
since split
`Batteries/Data/Float/Lemmas.lean` into
`Batteries/Data/Float/Lemmas/{Basic,Arithmetic,Order}.lean`, so neither
can merge as it
stands. Applying it at the new location is what makes `master` build.

**Verified:** `batteries` `lake build --wfail`, `lake test` and `lake
lint` all green;
`aesop` `lake build --wfail` and `lake test` green (it has no lint
driver).

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

Co-authored-by: downstream-lean4[bot] <downstream-lean4[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adaptation This is an adaptation PR for a PR in the lean4 repository. merge-required This PR should be merged manually by the author. toolchain-available

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant