Skip to content

chore: increase priority of instSMulOfMul - #13554

Merged
kim-em merged 1 commit into
masterfrom
smul_prio
Sep 23, 2026
Merged

kim-em merged 1 commit into
masterfrom
smul_prio

Conversation

@kim-em

@kim-em kim-em commented Apr 28, 2026 •

Copy link
Copy Markdown
Collaborator

This PR raises the priority of instSMulOfMul from 910 to 1100, so that a type's own
multiplication is found as its scalar action ahead of the general SMul R M instances rather
than after them.

The instance has the shape [Mul α] → SMul α α, so it applies only when both arguments of
SMul are the same type. It therefore rarely applies, and when it does it is essentially
always the intended instance, which is the profile for a priority above the default rather
than below it. The 910 is inherited from a Mathlib convention of lowering the priority of
instances that generalise, adopted under a typeclass inference algorithm that Lean 4 no longer
uses.

Mathlib raised the rest of this family of Mul-to-SMul instances in
leanprover-community/mathlib4#38704, measuring a speedup of around 20%
in several of its slowest files, and currently re-declares this instance's priority from
Mathlib/Algebra/Group/Action/Defs.lean because it cannot edit core. Merging this lets that
override be removed, and gives the same default to downstream users who are not Mathlib.

🤖 Prepared with Claude Code

@kim-em

kim-em commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator Author

!bench

@leanprover-radar

leanprover-radar commented Apr 28, 2026 •

Copy link
Copy Markdown

Benchmark results for 9931332 against 3c6317b are in. No significant results found. @kim-em

  • 🟥 build//instructions: +114.3M (+0.00%)

Small changes (1🟥)

  • 🟥 elab/big_struct//instructions: +19.4M (+0.71%)

@kim-em

kim-em commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator Author

!bench mathlib

@leanprover-radar

leanprover-radar commented Apr 28, 2026 •

Copy link
Copy Markdown

Benchmark results for leanprover-community/mathlib4-nightly-testing@ad41295 against leanprover-community/mathlib4-nightly-testing@9fc131c are in. There are significant results. @kim-em

  • 🟥 main exited with code 1

No significant changes detected.

@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Apr 28, 2026
@leanprover-bot

leanprover-bot commented Apr 28, 2026 •

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-04-27 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-04-28 05:31:30)
  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-05-03 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-05-04 12:51:34)

@github-actions github-actions Bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label Apr 28, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Apr 28, 2026
@mathlib-lean-pr-testing

mathlib-lean-pr-testing Bot commented Apr 28, 2026 •

Copy link
Copy Markdown

Mathlib CI status (docs):

@kbuzzard

Copy link
Copy Markdown
Contributor

Now mathlib#38703 is merged, mathlib should compile against this core change.

mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request May 4, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 4, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels May 4, 2026
@kim-em kim-em added the downstream Request a downstream-lean4 adaptation PR. label Sep 22, 2026
@downstream-lean4

Copy link
Copy Markdown

The adaptation PR for this PR is leanprover/downstream-lean4#98.

@kim-em

kim-em commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

!bench mathlib

@kim-em

kim-em commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

!bench

@leanprover-radar

leanprover-radar commented Sep 22, 2026 •

Copy link
Copy Markdown

Benchmark results for cf69cba against 72f4cf5 are in. No significant results found. @kim-em

Warning

These warnings may indicate that the benchmark results are not directly comparable, for example due to changes in the runner configuration or hardware.

  • Bench repo commit hashes for run build differ between commits.
  • Bench repo commit hashes for run other differ between commits.
  • ✅ build//instructions: -66.1M (-0.00%)

Small changes (1✅, 2🟥)

  • 🟥 compiled/hashmap//task-clock: +10ms (+5.81%)
  • 🟥 compiled/hashmap//wall-clock: +10ms (+5.80%)
  • ✅ compiled/rbmap//maxrss: -375kiB (-0.44%)

@kim-em
kim-em marked this pull request as ready for review September 23, 2026 04:43
@kim-em
kim-em added this pull request to the merge queue Sep 23, 2026
Merged via the queue into master with commit 3fd252f Sep 23, 2026
20 checks passed
downstream-lean4 Bot added a commit to leanprover/downstream-lean4 that referenced this pull request Sep 24, 2026
This is the adaptation PR for leanprover/lean4#13554.

---------

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

Labels

builds-mathlib CI has verified that Mathlib builds against this PR downstream Request a downstream-lean4 adaptation PR. force-mathlib-ci mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants