Skip to content

[Merged by Bors] - feat: overlapping instances linter#38126

Closed
JovanGerb wants to merge 157 commits into
leanprover-community:masterfrom
JovanGerb:Jovan-overlappingInstances-2
Closed

[Merged by Bors] - feat: overlapping instances linter#38126
JovanGerb wants to merge 157 commits into
leanprover-community:masterfrom
JovanGerb:Jovan-overlappingInstances-2

Conversation

@JovanGerb

@JovanGerb JovanGerb commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

This PR implements the overlapping instances linter, with better performance than the previous attempt.

The overlapping instances linter warns on data-carrying overlaps between instances in the local context of a declaration, as well as on redundant instances of Prop classes (i.e. those which can be synthesized from another instance in the context).

An annoyance is the need for withSetBoolOptionIn. This is a private declaration in the unusedInstancesInType linter, with a link to leanprover/lean4#13133, which has been merged. When that commit lands in mathlib, we should move to withSetOptionIn.

See #35095 and #33677 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

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label May 25, 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 May 25, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 26, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@jcommelin

Copy link
Copy Markdown
Member

bors d+

@mathlib-bors

mathlib-bors Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

✌️ JovanGerb can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@mathlib-triage mathlib-triage Bot added delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels May 26, 2026
mathlib-bors Bot pushed a commit that referenced this pull request May 26, 2026
This PR creates the `unrestricted` array in the unicode linter, which contains characters that have no restrictions on which selector they are followed by, and are not enforced to be followed by any selector at all.

We include `'⚠'` in it to allow `⚠️`. We don't want to ban the text version (`⚠`), as this is used in lake output (without the text selector) and so may conceivably be mentioned in a comment.

We plan to use `⚠️` in #38126.
@mathlib-dependent-issues mathlib-dependent-issues Bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label May 26, 2026
@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 26, 2026
@thorimur
thorimur force-pushed the Jovan-overlappingInstances-2 branch from 9e4d1bc to f0cfcfc Compare May 26, 2026 20:20
@JovanGerb

Copy link
Copy Markdown
Contributor Author

(By the way, I think it would be better not to use force push, because it is easy to mess something up, and there is no way to check this after the fact, appart from reading the whole +777 line diff again)

@thorimur

thorimur commented May 26, 2026

Copy link
Copy Markdown
Contributor

The force push only affects the last few commits that I overwrote, right? 👀 So presumably only those would need to be checked? (I guess there is a chance you accidentally delete a commit. 🤔)

In this case it was to banish the earlier merge of the #39796 branch, which was giving me a lot of trouble after the new version had been merged into master.

(Ah, I guess you can git revert merge commits, after looking into it...you just need some mysterious flags.)

@thorimur

Copy link
Copy Markdown
Contributor

Anyway, I think this is finally all ready... 😁

@JovanGerb

Copy link
Copy Markdown
Contributor Author

Ah yes I hadn't noticed that the force push only affected the last few commits. I think that soon we'll be able to remove withSetBoolOptionIn, but we can do that in a follow-up PR. Let's hope this merges without any new warnings:

bors r+

mathlib-bors Bot pushed a commit that referenced this pull request May 27, 2026
This PR implements the overlapping instances linter, with better performance than the previous attempt.

The overlapping instances linter warns on data-carrying overlaps between instances in the local context of a declaration, as well as on redundant instances of `Prop` classes (i.e. those which can be synthesized from another instance in the context).

An annoyance is the need for `withSetBoolOptionIn`. This is a private declaration in the `unusedInstancesInType` linter, with a link to leanprover/lean4#13133, which has been merged. When that commit lands in mathlib, we should move to `withSetOptionIn`.

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

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

Co-authored-by: @thorimur
Co-authored-by: thorimur <68410468+thorimur@users.noreply.github.com>
@mathlib-bors

mathlib-bors Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat: overlapping instances linter [Merged by Bors] - feat: overlapping instances linter May 27, 2026
@mathlib-bors mathlib-bors Bot closed this May 27, 2026
grunweg pushed a commit to grunweg/mathlib4 that referenced this pull request May 30, 2026
This PR implements the overlapping instances linter, with better performance than the previous attempt.

The overlapping instances linter warns on data-carrying overlaps between instances in the local context of a declaration, as well as on redundant instances of `Prop` classes (i.e. those which can be synthesized from another instance in the context).

An annoyance is the need for `withSetBoolOptionIn`. This is a private declaration in the `unusedInstancesInType` linter, with a link to leanprover/lean4#13133, which has been merged. When that commit lands in mathlib, we should move to `withSetOptionIn`.

See leanprover-community#35095 and leanprover-community#33677 for previous iterations of this linter.

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

Co-authored-by: @thorimur
Co-authored-by: thorimur <68410468+thorimur@users.noreply.github.com>
b-mehta pushed a commit to b-mehta/mathlib4 that referenced this pull request Jun 2, 2026
…unity#39796)

This PR creates the `unrestricted` array in the unicode linter, which contains characters that have no restrictions on which selector they are followed by, and are not enforced to be followed by any selector at all.

We include `'⚠'` in it to allow `⚠️`. We don't want to ban the text version (`⚠`), as this is used in lake output (without the text selector) and so may conceivably be mentioned in a comment.

We plan to use `⚠️` in leanprover-community#38126.
b-mehta pushed a commit to b-mehta/mathlib4 that referenced this pull request Jun 2, 2026
This PR implements the overlapping instances linter, with better performance than the previous attempt.

The overlapping instances linter warns on data-carrying overlaps between instances in the local context of a declaration, as well as on redundant instances of `Prop` classes (i.e. those which can be synthesized from another instance in the context).

An annoyance is the need for `withSetBoolOptionIn`. This is a private declaration in the `unusedInstancesInType` linter, with a link to leanprover/lean4#13133, which has been merged. When that commit lands in mathlib, we should move to `withSetOptionIn`.

See leanprover-community#35095 and leanprover-community#33677 for previous iterations of this linter.

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

Co-authored-by: @thorimur
Co-authored-by: thorimur <68410468+thorimur@users.noreply.github.com>
Bergschaf pushed a commit to Bergschaf/mathlib4 that referenced this pull request Jun 3, 2026
…unity#39796)

This PR creates the `unrestricted` array in the unicode linter, which contains characters that have no restrictions on which selector they are followed by, and are not enforced to be followed by any selector at all.

We include `'⚠'` in it to allow `⚠️`. We don't want to ban the text version (`⚠`), as this is used in lake output (without the text selector) and so may conceivably be mentioned in a comment.

We plan to use `⚠️` in leanprover-community#38126.
Bergschaf pushed a commit to Bergschaf/mathlib4 that referenced this pull request Jun 3, 2026
This PR implements the overlapping instances linter, with better performance than the previous attempt.

The overlapping instances linter warns on data-carrying overlaps between instances in the local context of a declaration, as well as on redundant instances of `Prop` classes (i.e. those which can be synthesized from another instance in the context).

An annoyance is the need for `withSetBoolOptionIn`. This is a private declaration in the `unusedInstancesInType` linter, with a link to leanprover/lean4#13133, which has been merged. When that commit lands in mathlib, we should move to `withSetOptionIn`.

See leanprover-community#35095 and leanprover-community#33677 for previous iterations of this linter.

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

Co-authored-by: @thorimur
Co-authored-by: thorimur <68410468+thorimur@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). t-linter Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants