Skip to content

feat: overlapping instances linter#38126

Open
JovanGerb wants to merge 100 commits intoleanprover-community:masterfrom
JovanGerb:Jovan-overlappingInstances-2
Open

feat: overlapping instances linter#38126
JovanGerb wants to merge 100 commits intoleanprover-community:masterfrom
JovanGerb:Jovan-overlappingInstances-2

Conversation

@JovanGerb
Copy link
Copy Markdown
Contributor

@JovanGerb JovanGerb commented Apr 16, 2026

This is a new attempt at the overlapping instances linter, with better performance.

One question is where to put the yellow squiggle of the warning message. It is now at the start of the definition value, i.e. the by token for typical proofs. This is slightly annoying, because the yellow squiggle is overridden by the red squiggle from "unsolved goals".

Another annoyance is the need for withSetBoolOptionIn. This is a private declaration in the unusedInstancesInType linter, with a link to an unsolved issue. I've marked it public, but maybe it should go to a separate file, depending on how fast we think the issue will be resolved.

See #35095 and #34955 for previous iterations of this linter.

See #14731 for an old attempt at a weaker form of this linter.

Co-authored-by: @thorimur


Open in Gitpod

@JovanGerb JovanGerb added the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Apr 16, 2026
@JovanGerb
Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 16, 2026

Benchmark results for 3dec916 against 05475ca are in. No significant results found. @JovanGerb

  • 🟥 build//instructions: +655.2G (+0.38%)

Medium changes (2🟥)

  • 🟥 build/module/Mathlib.RingTheory.Polynomial.UniversalFactorizationRing//instructions: +18.6G (+6.70%)
  • 🟥 build/profile/interpretation//wall-clock: +8m 9s (+5.06%)

Small changes (3🟥)

  • 🟥 build//instructions: +655.2G (+0.38%)
  • 🟥 build/module/Mathlib.Analysis.Normed.Ring.Basic//instructions: +767.3M (+1.37%)
  • 🟥 build/module/Mathlib.Lean.Meta.Basic//instructions: +143.3M (+3.69%)

and 1 hidden

@github-actions github-actions bot removed the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Apr 17, 2026
@mathlib-dependent-issues mathlib-dependent-issues bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Apr 17, 2026
@mathlib-dependent-issues
Copy link
Copy Markdown

@JovanGerb
Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 17, 2026

Benchmark results for cfd593f against 05475ca are in. There are significant results. @JovanGerb

  • 🟥 build//instructions: +1.3T (+0.74%)

Large changes (1🟥)

  • 🟥 build/profile/interpretation//wall-clock: +10m 6s (+6.27%)

Medium changes (1🟥)

  • 🟥 build/module/Mathlib.RingTheory.Polynomial.UniversalFactorizationRing//instructions: +19.5G (+7.02%)

Small changes (24🟥)

Too many entries to display here. View the full report on radar instead.

@JovanGerb
Copy link
Copy Markdown
Contributor Author

Wow, inlining the InfoTree folding function caused the loop to be run in the interpreter, which causes a big slowdown!

@JovanGerb
Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 17, 2026

Benchmark results for 88dfef6 against 05475ca are in. No significant results found. @JovanGerb

  • 🟥 build//instructions: +587.2G (+0.34%)

Medium changes (1🟥)

  • 🟥 build/module/Mathlib.RingTheory.Polynomial.UniversalFactorizationRing//instructions: +18.6G (+6.70%)

Small changes (3🟥)

  • 🟥 build//instructions: +587.2G (+0.34%)
  • 🟥 build/module/Mathlib.Lean.Meta.Basic//instructions: +141.3M (+3.64%)
  • 🟥 build/profile/interpretation//wall-clock: +5m 59s (+3.71%)

and 1 hidden

@JovanGerb
Copy link
Copy Markdown
Contributor Author

I'm pretty happy with the benchmark now. I only don't understand what makes this file UniversalFactorizationRing slow down so much. There aren't even that many instance hypotheses there.

@JovanGerb
Copy link
Copy Markdown
Contributor Author

Just to confirm the UniversalFactorizationRing slowdown is not a fluke:

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 17, 2026

Benchmark results for bb07869 against 9470b68 are in. No significant results found. @JovanGerb

  • 🟥 build//instructions: +599.5G (+0.35%)

Medium changes (2🟥)

  • 🟥 build/module/Mathlib.RingTheory.Polynomial.UniversalFactorizationRing//instructions: +18.4G (+6.61%)
  • 🟥 build/profile/interpretation//wall-clock: +7m 57s (+4.95%)

Small changes (1🟥)

1 hidden

@JovanGerb JovanGerb requested a review from thorimur April 17, 2026 13:46
mathlib-bors bot pushed a commit that referenced this pull request Apr 17, 2026
This PR cleans up after #34249, replacing some uses of `to_additive existing` with just `to_additive`. The fields of `MulDistribMulAction` had to be reordered in order to align with the additive version `DistribMulAction`.

This is an adaptation for the overlapping instances linter (#38126)
@joneugster joneugster added the t-linter Linter label Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) t-linter Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants