Skip to content

fix: cslib breakage from the mathlib4 merge making Set a one-field structure - #166

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

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

Conversation

@downstream-lean4

Copy link
Copy Markdown
Contributor

master has been red since run
38385302531 on
batteries, and cslib is skipped behind it — so the downstream: update repo mathlib4
merge in cddb5d55 landed without cslib ever being built. It brings in
mathlib4#41506, which
replaces def Set (α : Type u) := α → Prop by a one-field structure. Ten cslib modules
relied on the lost definitional equality.

cslib

module what broke fix
Computability.Languages.Language Set.mem_of_mem_inter_left and mem_preimage.mp no longer unify against _ ∈ l - 1 go through mem_sub_one
Foundations.Combinatorics.InfiniteGraphRamsey biInter_subset_of_mem can no longer read s off m < n pass s := {m | m < n}
MachineLearning.PACLearning.Defs Nat.sInf_mem can no longer read the set off ∃ m, … pass it explicitly
Foundations.Data.OmegaSequence.Topology convert now descends into the Set structure and hands back an Iff, which the following ext cannot use using 1
Algorithms.StatefulProcesses.DiffieHellman.Basic fun μs => … is no longer a Set set-builder notation
Logics.LinearLogic.CLL.PhaseSemantics.Basic imp G H p is no longer a function application p ∈ imp (G : Set P) (H : Set P)
Logics.Modal.Denotation grind no longer gets from theory m w₁ = theory m w₂ to pointwise membership rw [TheoryEq.ext_iff] first
Logics.Modal.Lean.Basic ofSets f = ofPredicates f no longer typechecks: Model α τ (Set α) and Model α τ (α → Prop) are now different types restated at valuation level as ofSets_v_eq_ofPredicates_v, with an #adaptation_note
Computability.Automata.NA.BuchiEquiv the frequently_principal golf relied on nba.Run xs being usable as a Set give the witness directly
Computability.Automata.NA.Concat concat's start contains if [] ∈ language na1, which is now genuinely compiled and needs Classical.propDecidable concat and finConcat become noncomputable

The only API change is ofSets_eq_ofPredicates → ofSets_v_eq_ofPredicates_v: the old
statement cannot be restated, because the set model and the predicate model no longer
even have the same type.

Verification

On nightly-2026-10-13, with
#161 (batteries) and
#158 (ProofWidgets4) applied —
without them batteries does not build at all, and this PR deliberately does not
duplicate them:

  • cslib: lake build --wfail --iofail, lake test --wfail --iofail, lake lint — all pass.
  • Also re-verified on this master that the rest of the red set is covered by those two
    PRs: batteries build/test/lint, aesop build/test, ProofWidgets4 build/test,
    mathlib4 build (--wfail, all five targets) / test (--iofail) / lint, and repl
    build/test all pass. The mathlib4 merge was built from source, not replayed.

So master needs #161, #158 and this PR to go green; none of the three subsumes another.

…structure

`downstream: update repo mathlib4` brought in mathlib4#41506, which replaces
`def Set (α : Type u) := α → Prop` by a one-field structure. Ten cslib modules relied
on the lost definitional equality:

- `Languages.Language`: `Set.mem_of_mem_inter_left` / `mem_preimage.mp` no longer unify
  against `_ ∈ l - 1`; use `mem_sub_one` directly.
- `Combinatorics.InfiniteGraphRamsey`: `biInter_subset_of_mem` can no longer infer
  `s` from `m < n`; pass `s := {m | m < n}`.
- `MachineLearning.PACLearning.Defs`: `Nat.sInf_mem` can no longer infer the set from
  `∃ m, …`; pass it.
- `Data.OmegaSequence.Topology`: `convert` now descends into the `Set` structure, so it
  hands back an `Iff` the following `ext` cannot use; stop it with `using 1`.
- `StatefulProcesses.DiffieHellman.Basic`: `fun μs => …` is not a `Set`; use set-builder.
- `LinearLogic.CLL.PhaseSemantics.Basic`: `imp G H p` is no longer an application;
  write `p ∈ imp (G : Set P) (H : Set P)`.
- `Modal.Denotation`: `grind` no longer gets from `theory m w₁ = theory m w₂` to
  pointwise membership; `rw [TheoryEq.ext_iff]` first.
- `Modal.Lean.Basic`: `ofSets f = ofPredicates f` no longer typechecks — the two models
  have different atom types. Restated at valuation level as
  `ofSets_v_eq_ofPredicates_v`, with an `#adaptation_note`.
- `Automata.NA.BuchiEquiv`: the `frequently_principal` golf relied on `nba.Run xs` being
  usable as a `Set`; give the witness directly.
- `Automata.NA.Concat`: the `if [] ∈ language na1` in `concat`'s `start` is now genuinely
  compiled, so `concat` and `finConcat` become `noncomputable`.

Verified locally on nightly-2026-10-13: cslib `lake build --wfail --iofail`,
`lake test --wfail --iofail` and `lake lint` all pass (with downstream-lean4#161 and
downstream-lean4#158 applied, which this PR does not include).

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

Copy link
Copy Markdown
Contributor Author

Build report for fix: cslib breakage from the mathlib4 merge making Set a one-field structure

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

View run

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]>
@downstream-lean4

Copy link
Copy Markdown
Contributor Author

Superseded: upstream cslib#1134 — the same adaptation to Mathlib's Set becoming a one-field structure — merged on 2026-10-14 and the bot brought it into master, so cslib now builds, tests and lints green unpatched (verified locally on 16428f3, and green in run 38840386618). This was the upstream home Sebastian asked for.

@downstream-lean4 downstream-lean4 Bot closed this Oct 16, 2026
@downstream-lean4
downstream-lean4 Bot deleted the push-rstmunnrxlqt branch October 16, 2026 11:25
Kha pushed a commit that referenced this pull request Oct 16, 2026
`master` went red with the bump to `nightly-2026-10-16` ([run
38888679712](https://github.com/leanprover/downstream-lean4/actions/runs/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](leanprover/cslib#1134) merged on
2026-10-14 and the bot brought it in, which is why `cslib` was fully
green in [run
38840386618](https://github.com/leanprover/downstream-lean4/actions/runs/38840386618).
#166 is superseded and is being closed.

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.

0 participants