Skip to content

[Merged by Bors] - refactor: rename Rel to SetRel, restore the old Rel#27447

Closed
eric-wieser wants to merge 10 commits intomasterfrom
eric-wieser/rename-to-set-rel
Closed

[Merged by Bors] - refactor: rename Rel to SetRel, restore the old Rel#27447
eric-wieser wants to merge 10 commits intomasterfrom
eric-wieser/rename-to-set-rel

Conversation

@eric-wieser
Copy link
Copy Markdown
Member

@eric-wieser eric-wieser commented Jul 24, 2025

Many users are confused that Rel no longer means what it used to. Since the design is not obvious (and the implementation is explicitly part of the interface thanks to abbrev), let's give it a name that makes the choice obvious.

This then restores the old definition of Rel, as an abbrev; it's conceivable that many users were just using this as a shorthand, and this stops them being broken by #25587. Such users will of course be broken if they used the old API.

This way, users bumping from 4.21.0 to 4.22.0 and using Rel only as a shorthand will not be broken.

#mathlib4 > Changing `Rel` to `Set (α × β)`, to help uniform spaces @ 💬


Open in Gitpod

Many users are confused that Rel no longer means what it used to. Since the design is not obvious, lets put it in a namespace that makes the choice obvious.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 24, 2025

PR summary 1b235f6e15

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ SetRel.FiniteDimensional.inv
+ SetRel.InfiniteDimensional.inv
+ SetRel.IsWellFounded.inv_of_finiteDimensional
+ SetRel.IsWellFounded.of_finiteDimensional
+ SetRel.exists_graph_eq_iff
+ SetRel.finiteDimensional_inv
+ SetRel.finiteDimensional_or_infiniteDimensional
+ SetRel.finiteDimensional_swap_iff
+ SetRel.infiniteDimensional_inv
+ SetRel.infiniteDimensional_swap_iff
+ SetRel.not_finiteDimensional_iff
+ SetRel.not_infiniteDimensional_iff
+ SetRel.wellFounded_of_finiteDimensional
+ SetRelation.is_graph_iff
+ instance {R : α → α → Prop} [IsIrrefl α R] : SetRel.IsIrrefl {(a, b) | R a b} := ‹_›
+ instance {R : α → α → Prop} [IsTrans α R] : SetRel.IsTrans {(a, b) | R a b} := ‹_›
+ instance {α : Type u} {β : Type v} [DecidableEq β] (R : SetRel α β)
+++ SetRel
+--- Rel
- Rel.FiniteDimensional.inv
- Rel.InfiniteDimensional.inv
- Rel.IsWellFounded.inv_of_finiteDimensional
- Rel.IsWellFounded.of_finiteDimensional
- Rel.exists_graph_eq_iff
- Rel.finiteDimensional_inv
- Rel.finiteDimensional_or_infiniteDimensional
- Rel.finiteDimensional_swap_iff
- Rel.infiniteDimensional_inv
- Rel.infiniteDimensional_swap_iff
- Rel.not_finiteDimensional_iff
- Rel.not_infiniteDimensional_iff
- Rel.wellFounded_of_finiteDimensional
- Relation.is_graph_iff
- instance {R : α → α → Prop} [IsIrrefl α R] : Rel.IsIrrefl {(a, b) | R a b} := ‹_›
- instance {R : α → α → Prop} [IsTrans α R] : Rel.IsTrans {(a, b) | R a b} := ‹_›
- instance {α : Type u} {β : Type v} [DecidableEq β] (R : Rel α β)

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).

@eric-wieser eric-wieser changed the title refactor: move Rel within the Set namespace refactor: rename Rel to Set.Rel, restore the old Rel Jul 25, 2025
@eric-wieser eric-wieser added the t-order Order theory label Jul 25, 2025
@eric-wieser eric-wieser marked this pull request as ready for review July 25, 2025 10:25
@YaelDillies
Copy link
Copy Markdown
Contributor

Would SetRel be better to avoid nameclash?

@eric-wieser
Copy link
Copy Markdown
Member Author

Perhaps; can you create a zulip poll?

@YaelDillies
Copy link
Copy Markdown
Contributor

SetRel is the clear winner of the poll

@YaelDillies YaelDillies added the awaiting-author A reviewer has asked the author a question or requested changes. label Aug 5, 2025
@eric-wieser eric-wieser changed the title refactor: rename Rel to Set.Rel, restore the old Rel refactor: rename Rel to SetRel, restore the old Rel Aug 12, 2025
@eric-wieser eric-wieser added awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. and removed awaiting-author A reviewer has asked the author a question or requested changes. labels Aug 12, 2025
@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 Aug 13, 2025
@kim-em
Copy link
Copy Markdown
Contributor

kim-em commented Aug 13, 2025

bors d+

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Aug 13, 2025

✌️ eric-wieser 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 Aug 13, 2025
@eric-wieser
Copy link
Copy Markdown
Member Author

bors merge

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Aug 13, 2025
mathlib-bors bot pushed a commit that referenced this pull request Aug 13, 2025
Many users are confused that Rel no longer means what it used to. Since the design is not obvious (and the implementation is explicitly part of the interface thanks to `abbrev`), let's give it a name that makes the choice obvious.

This then restores the old definition of `Rel`, as an abbrev; it's conceivable that many users were just using this as a shorthand, and this stops them being broken by #25587. Such users will of course be broken if they used [the old API](https://github.com/leanprover-community/mathlib4/blob/59bd63c72671849996d64c5d3b5f24a36333483c%5E/Mathlib/Data/Rel.lean).

This way, users bumping from 4.21.0 to 4.22.0 and using `Rel` only as a shorthand will not be broken.

[#mathlib4 > Changing &#96;Rel&#96; to &#96;Set (α × β)&#96;, to help uniform spaces @ 💬](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Changing.20.60Rel.60.20to.20.60Set.20.28.CE.B1.20.C3.97.20.CE.B2.29.60.2C.20to.20help.20uniform.20spaces/near/528531852)
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Aug 13, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title refactor: rename Rel to SetRel, restore the old Rel [Merged by Bors] - refactor: rename Rel to SetRel, restore the old Rel Aug 13, 2025
@mathlib-bors mathlib-bors bot closed this Aug 13, 2025
@mathlib-bors mathlib-bors bot deleted the eric-wieser/rename-to-set-rel branch August 13, 2025 01:25
Paul-Lez pushed a commit to Paul-Lez/mathlib4 that referenced this pull request Aug 23, 2025
…-community#27447)

Many users are confused that Rel no longer means what it used to. Since the design is not obvious (and the implementation is explicitly part of the interface thanks to `abbrev`), let's give it a name that makes the choice obvious.

This then restores the old definition of `Rel`, as an abbrev; it's conceivable that many users were just using this as a shorthand, and this stops them being broken by leanprover-community#25587. Such users will of course be broken if they used [the old API](https://github.com/leanprover-community/mathlib4/blob/59bd63c72671849996d64c5d3b5f24a36333483c%5E/Mathlib/Data/Rel.lean).

This way, users bumping from 4.21.0 to 4.22.0 and using `Rel` only as a shorthand will not be broken.

[#mathlib4 > Changing &leanprover-community#96;Rel&leanprover-community#96; to &leanprover-community#96;Set (α × β)&leanprover-community#96;, to help uniform spaces @ 💬](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Changing.20.60Rel.60.20to.20.60Set.20.28.CE.B1.20.C3.97.20.CE.B2.29.60.2C.20to.20help.20uniform.20spaces/near/528531852)
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). ready-to-merge This PR has been sent to bors. t-order Order theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants