Skip to content

Forward-port to Lean/mathlib v4.31.0#1

Merged
gotrevor merged 1 commit into
masterfrom
mathlib-v4.31-port
Jun 21, 2026
Merged

Forward-port to Lean/mathlib v4.31.0#1
gotrevor merged 1 commit into
masterfrom
mathlib-v4.31-port

Conversation

@gotrevor

@gotrevor gotrevor commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Forward-ports Foundation to Lean/mathlib v4.31.0 (from v4.29.0).

What changed

  • lean-toolchain: v4.29.0v4.31.0
  • mathlib require → v4.31.0; doc-gen4 require → v4.31.0 tag (upstream tracked main — flip back if preferred)
  • Source migration across 133 Foundation/*.lean files for the v4.29 → v4.31 API changes
  • ~29 instance declarations demoted to def/lemma (e.g. the Sound/Complete instances, buildAxioms.instHasJ*, instRooted, isTree, set_nonempty, set_countable). These were non-synthesizable (explicit non-class hypotheses like (hV : C ⊧* Ax), (ha : a ≠ M.root)) or non-class heads (Set.Nonempty/Set.Countable are Props, not classes), which v4.31's stricter instance check now rejects. None were firing in typeclass resolution, so the demotion is behavior-preserving — flagged here so instancedef in a mechanical port isn't surprising.

Faithfulness

  • sorry/admit baseline unchanged at 27, all pre-existing upstream (the heaviest files — ProvabilityLogic/Classification/Result.lean (9) and Modal/Maximal/Makinson.lean (6) — match upstream master exactly). Zero new holes introduced by the port.

Known follow-up — mathlib v4.31 deprecations

The build is green, but emits deprecation warnings (no sorry, no errors — pure hygiene). The port leans on still-working-but-deprecated mathlib API in a few spots. These are deliberately left for a focused follow-up PR to keep this bump minimal and reviewable. Inventory: 122 warning lines → 22 distinct symbols.

  • ~19 drop-in renames, dominated by mathlib's relation-predicate refactor: Reflexive/Irreflexive/Symmetric/AntiSymmetricStd.Refl/Std.Irrefl/Std.Symm/Std.Antisymm; IsRefl/IsIrrefl/IsAsymm/IsAntisymm/IsTotal/IsTrichotomousStd.*; plus Set.diff_subsetSet.sdiff_subset, Set.Infinite.diffSet.Infinite.sdiff, Set.insert_diff_singletonSet.insert_sdiff_singleton, List.max?_eq_some_iff'List.max?_eq_some_iff, WellFounded.isIrreflWellFounded.irrefl, _root_.not_impClassical.not_imp, and 3 deprecated module-imports (Mathlib.Data.Finite.Card, Mathlib.Data.Nat.Lattice, Mathlib.Logic.IsEmpty).
  • 3 need per-site care: TransitiveIsTrans _ (add the type placeholder), Nat.lt_succNat.lt_succ_iff (confirm same statement), Std.Irrefl.swapinferInstance (structural, not a rename).

Provenance ⚠️

This is a mechanical port produced with Claude Code, not yet human-reviewed. The tactic-level substitutions (using!, grindsimp, etc.) are written up here: https://github.com/gotrevor/mathlib-bump-cookbook/blob/main/v4.29.1-to-v4.31.0.md — treat it as a starting point, not vetted work.

This PR targets the fork's own master purely so CI can verify the build; it carries only the Lean + lockfile changes (the migration handoff notes live separately on the mathlib-v4.31 branch).

@gotrevor gotrevor closed this Jun 21, 2026
@gotrevor gotrevor reopened this Jun 21, 2026
lean-toolchain v4.29.0 -> v4.31.0; mathlib and doc-gen4 requires bumped to
v4.31.0, with the source migration across the Foundation library (133
files). sorry/admit baseline unchanged (27, all pre-existing upstream).

doc-gen4 pinned to its v4.31.0 tag (upstream tracked `main`); flip back to
`main` if preferred.

Mechanical port produced with Claude Code; not yet human-reviewed.
Porting cheat sheet:
https://github.com/gotrevor/mathlib-bump-cookbook/blob/main/v4.29.1-to-v4.31.0.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gotrevor gotrevor force-pushed the mathlib-v4.31-port branch from 72f1e97 to e6f6001 Compare June 21, 2026 20:37
@gotrevor gotrevor merged commit e6f6001 into master Jun 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant