Skip to content

[Merged by Bors] - feat: to_dual attribute - #27887

Closed
JovanGerb wants to merge 52 commits into
leanprover-community:masterfrom
JovanGerb:Jovan-to_dual
Closed

JovanGerb wants to merge 52 commits into
leanprover-community:masterfrom
JovanGerb:Jovan-to_dual

Conversation

@JovanGerb

@JovanGerb JovanGerb commented Aug 2, 2025 •

Copy link
Copy Markdown
Contributor

This PR defines the to_dual attribute for translating lemmas to their dual. This is useful in order theory and in category theory. It is built on top of the to_additive machinery.

This PR only adds @[to_dual] tags in files that directly need to import ToDual, namely Order/Defs/PartialOrder, Order/Notation and Combinatorics/Quiver/Basic. Further tagging is left for (many) future PRs.

This PR continues the work from #21719

Related (mathlib3) issues:

Co-authored-by: @bryangingechen


Open in Gitpod

@JovanGerb
JovanGerb marked this pull request as draft August 2, 2025 22:21
@github-actions github-actions Bot added the large-import Automatically added label for PRs with a significant increase in transitive imports label Aug 2, 2025
@github-actions

github-actions Bot commented Aug 2, 2025 •

Copy link
Copy Markdown

PR summary 7f192e6c9f

Import changes exceeding 2%

% File
+10.49% Mathlib.Combinatorics.Quiver.Basic
+14.17% Mathlib.Order.Basic
+50.00% Mathlib.Order.Defs.PartialOrder
+72.00% Mathlib.Order.Notation

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Order.Notation 50 86 +36 (+72.00%)
Mathlib.Order.Defs.PartialOrder 62 93 +31 (+50.00%)
Mathlib.Order.Basic 127 145 +18 (+14.17%)
Mathlib.Combinatorics.Quiver.Basic 143 158 +15 (+10.49%)
Import changes for all files
Files Import difference
There are 6774 files with changed transitive imports taking up over 293088 characters: this is too many to display!
You can run scripts/import_trans_difference.sh all locally to see the whole output.

Declarations diff

+ GuessNameData
+ List.swapFirstTwo
+ TranslateData
+ abbreviationDict
+ elabTranslationAttr
+ findRelevantArg
+ instTransGE
+ instTransGEGT
+ instTransGT
+ instTransGTGE
+ instTransLE
+ instTransLELT
+ instTransLT
+ instTransLTLE
+ min_le_left
+ min_self
+ shouldTranslate
+ translateLemmas
++ data
++ max_comm'
- _root_.List.swapFirstTwo
- additiveTest
- additivizeLemmas
- elabToAdditive
- findMultiplicativeArg
- ge_antisymm
- ge_of_eq
- ge_trans
- gt_trans
- instance (priority := 100) bot_nonempty (α : Type*) [Bot α] : Nonempty α
- instance : @Trans α α α GE.ge GE.ge GE.ge := ⟨ge_trans⟩
- instance : @Trans α α α GE.ge GT.gt GT.gt := ⟨lt_of_le_of_lt'⟩
- instance : @Trans α α α GT.gt GE.ge GT.gt := ⟨lt_of_lt_of_le'⟩
- instance : @Trans α α α GT.gt GT.gt GT.gt := ⟨gt_trans⟩
- instance : @Trans α α α LE.le LE.le LE.le := ⟨le_trans⟩
- instance : @Trans α α α LE.le LT.lt LT.lt := ⟨lt_of_le_of_lt⟩
- instance : @Trans α α α LT.lt LE.le LT.lt := ⟨lt_of_lt_of_le⟩
- instance : @Trans α α α LT.lt LT.lt LT.lt := ⟨lt_trans⟩
- lt_of_le_of_lt'
- lt_of_le_of_ne'
- lt_of_lt_of_le'
- lt_or_eq_of_le'
- ne_of_gt
-++ nameDict

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@JovanGerb

Copy link
Copy Markdown
Contributor Author

This PR has quite a large increase in imports. Some of this will hopefully go away when I get back to #21965, which avoids importing LinearOrder (and hence the to_dual attribute) in the push_neg tactic.

@JovanGerb
JovanGerb marked this pull request as ready for review August 3, 2025 20:46
@mathlib4-merge-conflict-bot

Copy link
Copy Markdown

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

@mathlib4-merge-conflict-bot mathlib4-merge-conflict-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 Aug 4, 2025
@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 Aug 4, 2025
@grunweg grunweg added the t-meta Tactics, attributes or user commands label Aug 4, 2025
@mathlib4-merge-conflict-bot mathlib4-merge-conflict-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 Aug 11, 2025
@mathlib4-merge-conflict-bot

Copy link
Copy Markdown

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

@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 Aug 11, 2025
@JovanGerb

Copy link
Copy Markdown
Contributor Author

After merging master, the file Frontend.lean now exceeds 1500 lines. In a follow up PR I will split the file to fix this. (Doing that in this PR will complicate the git diff)

@mathlib4-merge-conflict-bot mathlib4-merge-conflict-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 Aug 13, 2025
@mathlib4-merge-conflict-bot

Copy link
Copy Markdown

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

@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 Aug 13, 2025
@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 Nov 13, 2025
@fpvandoorn

Copy link
Copy Markdown
Member

Can you rename Frontend to Basic or something, and the directory to Translate? Although maybe this is better in a follow-up PR, which would also be fine by me.

@fpvandoorn

Copy link
Copy Markdown
Member

Thanks!

bors d+

@mathlib-bors

mathlib-bors Bot commented Nov 13, 2025

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.

@ghost ghost added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Nov 13, 2025
@JovanGerb

Copy link
Copy Markdown
Contributor Author

bors r+

mathlib-bors Bot pushed a commit that referenced this pull request Nov 13, 2025
This PR defines the `to_dual` attribute for translating lemmas to their dual. This is useful in order theory and in category theory. It is built on top of the `to_additive` machinery.

This PR only adds `@[to_dual]` tags in files that directly need to import `ToDual`, namely `Order/Defs/PartialOrder`, `Order/Notation` and `Combinatorics/Quiver/Basic`. Further tagging is left for (many) future PRs.

This PR continues the work from #21719

Related (mathlib3) issues: 
- leanprover-community/mathlib3#13461
- leanprover-community/mathlib3#7691

Co-authored-by: @bryangingechen
Co-authored-by: Bryan Gin-ge Chen <[email protected]>
@mathlib-bors

mathlib-bors Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

Build failed:

@grunweg

grunweg commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

Needs a (no)shake, it seems

@JovanGerb

Copy link
Copy Markdown
Contributor Author

bors r+

mathlib-bors Bot pushed a commit that referenced this pull request Nov 13, 2025
This PR defines the `to_dual` attribute for translating lemmas to their dual. This is useful in order theory and in category theory. It is built on top of the `to_additive` machinery.

This PR only adds `@[to_dual]` tags in files that directly need to import `ToDual`, namely `Order/Defs/PartialOrder`, `Order/Notation` and `Combinatorics/Quiver/Basic`. Further tagging is left for (many) future PRs.

This PR continues the work from #21719

Related (mathlib3) issues: 
- leanprover-community/mathlib3#13461
- leanprover-community/mathlib3#7691

Co-authored-by: @bryangingechen
Co-authored-by: Bryan Gin-ge Chen <[email protected]>
@mathlib-bors

mathlib-bors Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat: to_dual attribute [Merged by Bors] - feat: to_dual attribute Nov 13, 2025
@mathlib-bors mathlib-bors Bot closed this Nov 13, 2025
thorimur pushed a commit to thorimur/mathlib4 that referenced this pull request Nov 16, 2025
This PR defines the `to_dual` attribute for translating lemmas to their dual. This is useful in order theory and in category theory. It is built on top of the `to_additive` machinery.

This PR only adds `@[to_dual]` tags in files that directly need to import `ToDual`, namely `Order/Defs/PartialOrder`, `Order/Notation` and `Combinatorics/Quiver/Basic`. Further tagging is left for (many) future PRs.

This PR continues the work from leanprover-community#21719

Related (mathlib3) issues: 
- leanprover-community/mathlib3#13461
- leanprover-community/mathlib3#7691

Co-authored-by: @bryangingechen
Co-authored-by: Bryan Gin-ge Chen <[email protected]>
@alexjbest alexjbest removed their assignment Feb 27, 2026
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). large-import Automatically added label for PRs with a significant increase in transitive imports t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants