Skip to content

fix: mathlib4 breakage from nightly-2026-10-16 - #174

Merged
Kha merged 1 commit into
masterfrom
push-uryqyyyqymmy
Oct 16, 2026
Merged

Kha merged 1 commit into
masterfrom
push-uryqyyyqymmy

Conversation

@downstream-lean4

Copy link
Copy Markdown
Contributor

master went red with the bump to nightly-2026-10-16 (run 38888679712): mathlib4 fails to build, and cslib (skipped behind it) and repl (its test phase compiles Mathlib) fall over with it. One repo needed a change.

mathlib4

lean4#15317 (feat: add Bool.dand and Ordering.dthen along with more lemmas, Robin Arnez) moved Ordering.dthen into core, so Mathlib/Data/Ordering/Basic.lean:37 fails with

error: Mathlib/Data/Ordering/Basic.lean:37:20: `Ordering.dthen` has already been declared

Core's Ordering.dthen has mathlib's signature and mathlib's two equations, and core also ships @[simp] theorem Ordering.dthen_eq_then — the same statement, the same attribute, as mathlib's lemma in Mathlib/Data/Ordering/Lemmas.lean. Both mathlib copies are therefore plain duplicates (and keeping the lemma while dropping the definition would just move the collision onto the lemma's name), so this deletes both.

Nothing else from lean4#15317 collides: Bool.dand, Bool.Reflects.of_imp, the root-namespace instance forall_forall_prop_decidable and the then/dand lemma batch have no mathlib counterparts, and mathlib has no other user of Ordering.dthen.

Upstream mathlib4-nightly-testing is still on nightly-2026-10-15 and still carries both declarations, so it will need the same deletion when it bumps.

Verified locally on 16428f35

repo build test lint
mathlib4 Mathlib Archive Counterexamples Wanted cache --wfail, 18440 jobs, 0 errors, 0 warnings lake test --iofail, 18962 jobs Linting passed for Mathlib.
cslib --wfail --iofail, 6690 jobs, 0 warnings --wfail --iofail, 18727 jobs Linting passed for Cslib.
repl lake build lake test — all cases PASSED, including the test/Mathlib batch (no driver)

cslib and repl are green unpatched on this master; they only needed mathlib4 to build. In particular cslib's own breakage from the Set-as-structure change is gone from master: upstream cslib#1134 merged on 2026-10-14 and the bot brought it in, which is why cslib was fully green in run 38840386618. #166 is superseded and is being closed.

Nothing was left unfinished.

`Ordering.dthen` and the `@[simp]` lemma `Ordering.dthen_eq_then` moved
into core in lean4#15317 (`feat: add `Bool.dand` and `Ordering.dthen`
along with more lemmas`), which landed in `nightly-2026-10-16`. Core's
`Ordering.dthen` has the same signature and the same two equations as
mathlib's, and core's `dthen_eq_then` is the same statement, also
`@[simp]` — so both mathlib copies are now plain duplicates and the
build fails with `'Ordering.dthen' has already been declared`.

Delete both. No other declaration added by lean4#15317 (`Bool.dand`,
`Bool.Reflects.of_imp`, `forall_forall_prop_decidable`, the `then`/`dand`
lemma batch) has a mathlib counterpart.

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

Copy link
Copy Markdown
Contributor Author

Build report for fix: mathlib4 breakage from nightly-2026-10-16

Turned green:

Repo Critical Build Test Lint
mathlib4 ✅ ✅ in 16m 59s ✅ in 44s ✅ in 1m 30s
cslib ✅ in 33s ✅ in 9s ✅ in 3s
repl ✅ in 0s ✅ in 48s ⏭️
Stayed green
Repo Critical Build Test Lint
aesop ✅ ✅ in 0s ✅ in 5s ⏭️
batteries ✅ ✅ in 0s ✅ in 4s ✅ in 2s
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 15s ⏭️ ⏭️
BibtexQuery ✅ in 3s ⏭️ ⏭️
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 16s ⏭️
nerodia ✅ in 1s ✅ in 21s ⏭️
verso ✅ in 1m 18s ✅ in 3m 14s ⏭️
verso-slides ✅ in 15s ✅ in 8s ⏭️
verso-web-components ✅ in 7s ⏭️ ⏭️

View run

@Kha
Kha merged commit b1dc7cd into master Oct 16, 2026
23 checks passed
Garmelon pushed a commit that referenced this pull request Oct 16, 2026
`master` is red again on `nightly-2026-10-16` ([run
38962929561](https://github.com/leanprover/downstream-lean4/actions/runs/38962929561))
with the very error
[#174](#174) fixed
and merged this morning:

```
error: Mathlib/Data/Ordering/Basic.lean:37:20: `Ordering.dthen` has already been declared
```

`cslib` (skipped behind it) and `repl` (its test phase compiles Mathlib)
fall over with it; every other repo is green.

## Why it came back

`chore: switch mathlib to new nightly model` (53b5956) repointed the
`mathlib4` entry in `repos.toml` from
`leanprover-community/mathlib4-nightly-testing`@`nightly-testing` to
`leanprover-community/mathlib4`@`master`, and the `downstream: reset
repo mathlib4` (d700dff) that followed reset the subrepo onto mathlib
`master` — 196 files, including a plain revert of #174's deletion.
Mathlib `master` builds on a *release* toolchain and so still carries
both declarations.

This is not a one-off: under the new model every nightly adaptation that
`nightly-testing` used to carry now has to live here and reach mathlib
through the `bump/v4.37.0` export, so each such reset will need its
adaptations re-landed in the monorepo.

## mathlib4

lean4#15317 (*feat: add `Bool.dand` and `Ordering.dthen` along with more
lemmas*, Robin Arnez) moved `Ordering.dthen` into core. Core's
`Ordering.dthen` has mathlib's signature and mathlib's two equations,
and core also ships `@[simp] theorem Ordering.dthen_eq_then` — the same
statement, the same attribute, as mathlib's lemma in
`Mathlib/Data/Ordering/Lemmas.lean`. Both mathlib copies are therefore
plain duplicates (and keeping the lemma while dropping the definition
would just move the collision onto the lemma's name), so this deletes
both — the same two hunks as #174, which applied unchanged.

Nothing else from lean4#15317 collides: `Bool.dand`,
`Bool.Reflects.of_imp`, the root-namespace instance
`forall_forall_prop_decidable` and the `then`/`dand` lemma batch have no
mathlib counterparts, and mathlib has no other user of `Ordering.dthen`.

## Verified locally on `d04c02ce`

| repo | build | test | lint |
| --- | --- | --- | --- |
| mathlib4 | `Mathlib Archive Counterexamples Wanted cache --wfail`,
18446 jobs recompiled, 0 errors, 0 warnings | `lake test --iofail`,
18972 jobs | `Linting passed for Mathlib.` |
| cslib | `--wfail --iofail`, 6694 jobs, 0 warnings | `--wfail
--iofail`, 18735 jobs | `Linting passed for Cslib.` |
| repl | `lake build` | `lake test` — 71 cases PASSED, 0 failed,
including the `test/Mathlib` batch | (no driver) |

`cslib` and `repl` are green **unpatched** on this master; they only
needed `mathlib4` to build. Nothing was left unfinished.

<!-- 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