Skip to content

feat(Translate): reorder universes#36604

Open
JovanGerb wants to merge 18 commits intoleanprover-community:masterfrom
JovanGerb:Jovan-reorder-universes
Open

feat(Translate): reorder universes#36604
JovanGerb wants to merge 18 commits intoleanprover-community:masterfrom
JovanGerb:Jovan-reorder-universes

Conversation

@JovanGerb
Copy link
Copy Markdown
Contributor

@JovanGerb JovanGerb commented Mar 13, 2026

This PR improves the heuristic for reordering of universes in to_dual/to_additive. The previous heuristic worked well when the first two universes had to be swapped. For example for translating a ^ n to n • a, and for dualizing GaloisConnection. However, in Category theory we sometimes need to swap more universes because a category instance comes with 2 universes which both need to be swapped. In particular, the comma category, and adjunctions both need this feature.

This PR doesn't add any syntax for specifying the reordering of universes. It is assumed that the universe reordering can always be inferred from the normal reordering and from the type.


Open in Gitpod

@JovanGerb JovanGerb marked this pull request as draft March 13, 2026 16:39
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Mar 13, 2026

This pull request is now in draft mode. No active bors state needed cleanup.

While this PR remains draft, bors will ignore commands on this PR. Mark it ready for review before using commands like bors r+ or bors try.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 13, 2026

PR summary b301d257a1

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ ArgReorder
+ Category.{v,u}
+ Comma
+ CommaMorphism.mk'
+ CommaMorphism.w'
+ Permutation
+ beq
+ guessUnivReorder
+ instance : BEq ArgReorder := ⟨beq⟩
+ instance : ToMessageData ArgReorder := ⟨fun x ↦ x.toString⟩
+ instance : ToString ArgReorder := ⟨fun x ↦ x.toString⟩
+ isEmpty
+ permuteList!
+ toString
+ universeTest1.{u,v,w}
+ universeTest2.{u,v}
+ universeTest3.{u,u',v,v'}
++ permute!
++ range
++ reverse
- Reorder.isEmpty
- Reorder.permute!
- Reorder.permuteUniv
- Reorder.range
- Reorder.toString
- comp_right
- id_right
- instance : BEq Reorder := ⟨Reorder.beq⟩
- instance : ToMessageData Reorder := ⟨fun x ↦ x.toString⟩
- instance : ToString Reorder := ⟨fun x ↦ x.toString⟩

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

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

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


No changes to technical debt.

You can run this locally as

./scripts/reporting/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).

@github-actions github-actions 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 Mar 14, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts 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 Mar 14, 2026
@JovanGerb JovanGerb added the t-meta Tactics, attributes or user commands label Mar 15, 2026
@mathlib-merge-conflicts
Copy link
Copy Markdown

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

@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 Mar 20, 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 Mar 20, 2026
@JovanGerb JovanGerb marked this pull request as ready for review March 20, 2026 09:59
@JovanGerb
Copy link
Copy Markdown
Contributor Author

Oh oops, I forgot to remove the draft status.

@bryangingechen
Copy link
Copy Markdown
Contributor

Could you add some tests?

@bryangingechen bryangingechen added the awaiting-author A reviewer has asked the author a question or requested changes. label Mar 21, 2026
@JovanGerb JovanGerb removed the awaiting-author A reviewer has asked the author a question or requested changes. label Mar 22, 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 Mar 24, 2026
@mathlib-merge-conflicts
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 Mar 24, 2026
@mathlib-merge-conflicts
Copy link
Copy Markdown

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

@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 Mar 27, 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 Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants